+
    ÖÇÜhÜ  ã                   ó   € ^ RI Ht R tR# )é    )Údefaultdictc                óÌ  a aa	a
aa€ VP                  4        Uu. uF+  p\        \        \        VP                  R4      4      4      NK-  	  ppVP                  4        Uu. uF+  p\        \        \        VP                  R4      4      4      NK-  	  pp. ROo\	        V4      P                  \	        V4      4      o
\	        V4      P                  \	        V4      4      o\        \        4      o	S
 F5  w  rVS	R,          P                  V4       S	R,          P                  V4       K7  	  V	V
VV VV3R lpV	V
V VV3R lpV! 4        V! V4       V! V4       \        S
4      # u upi u upi )ub
  
This module symmetrisatizes the source-to-target and target-to-source
word alignment output and produces, aka. GDFA algorithm (Koehn, 2005).

Step 1: Find the intersection of the bidirectional alignment.

Step 2: Search for additional neighbor alignment points to be added, given
        these criteria: (i) neighbor alignments points are not in the
        intersection and (ii) neighbor alignments are in the union.

Step 3: Add all other alignment points that are not in the intersection, not in
        the neighboring alignments that met the criteria but in the original
        forward/backward alignment outputs.

    >>> forw = ('0-0 2-1 9-2 21-3 10-4 7-5 11-6 9-7 12-8 1-9 3-10 '
    ...         '4-11 17-12 17-13 25-14 13-15 24-16 11-17 28-18')
    >>> back = ('0-0 1-9 2-9 3-10 4-11 5-12 6-6 7-5 8-6 9-7 10-4 '
    ...         '11-6 12-8 13-12 15-12 17-13 18-13 19-12 20-13 '
    ...         '21-3 22-12 23-14 24-17 25-15 26-17 27-18 28-18')
    >>> srctext = ("ã�“ã�® ã‚ˆã�† ã�ª ãƒ�ãƒ­ãƒ¼ ç™½è‰² ã‚�ã�„ æ˜Ÿ ã�® ï¼¬ é–¢æ•° "
    ...            "ã�¯ ï¼¬ ã�¨ å…± ã�« ä¸�é€£ç¶š ã�« å¢—åŠ  ã�™ã‚‹ ã�“ã�¨ ã�Œ "
    ...            "æœŸå¾… ã�• ã‚Œã‚‹ ã�“ã�¨ ã‚’ ç¤ºã�— ã�Ÿ ã€‚")
    >>> trgtext = ("Therefore , we expect that the luminosity function "
    ...            "of such halo white dwarfs increases discontinuously "
    ...            "with the luminosity .")
    >>> srclen = len(srctext.split())
    >>> trglen = len(trgtext.split())
    >>>
    >>> gdfa = grow_diag_final_and(srclen, trglen, forw, back)
    >>> gdfa == sorted(set([(28, 18), (6, 6), (24, 17), (2, 1), (15, 12), (13, 12),
    ...         (2, 9), (3, 10), (26, 17), (25, 15), (8, 6), (9, 7), (20,
    ...         13), (18, 13), (0, 0), (10, 4), (13, 15), (23, 14), (7, 5),
    ...         (25, 14), (1, 9), (17, 13), (4, 11), (11, 17), (9, 2), (22,
    ...         12), (27, 18), (24, 16), (21, 3), (19, 12), (17, 12), (5,
    ...         12), (11, 6), (12, 8)]))
    True

References:
Koehn, P., A. Axelrod, A. Birch, C. Callison, M. Osborne, and D. Talbot.
2005. Edinburgh System Description for the 2005 IWSLT Speech
Translation Evaluation. In MT Eval Workshop.

:type srclen: int
:param srclen: the number of tokens in the source language
:type trglen: int
:param trglen: the number of tokens in the target language
:type e2f: str
:param e2f: the forward word alignment outputs from source-to-target
            language (in pharaoh output format)
:type f2e: str
:param f2e: the backward word alignment outputs from target-to-source
            language (in pharaoh output format)
:rtype: set(tuple(int))
:return: the symmetrized alignment points from the GDFA algorithm
Ú-ÚeÚfc            
     ó2  <€ \        S4      ^,
          p V \        S4      8  dô   Rp\        S
4       FÕ  p\        S4       FÃ  pW#3S9   g   K  S	 F°  p\        ;QJ d    . R \        W#3V4       4       F  NK  	  5M! R \        W#3V4       4       4      pVw  rVVS9  g   KR  VS9  g   K[  VS9   g   Kd  SP	                  V4       SR,          P	                  V4       SR,          P	                  V4       V ^,          p RpK²  	  KÅ  	  K×  	  V'       g   EK  R# R# )zb
Search for the neighbor points and them to the intersected alignment
points if criteria are met.
Tc              3   ó6   "  € T F  w  rW,           x € K  	  R # 5i)N© )Ú.0ÚiÚjs   &  Ú5/usr/lib/python3/dist-packages/nltk/translate/gdfa.pyÚ	<genexpr>Ú9grow_diag_final_and.<locals>.grow_diag.<locals>.<genexpr>c   s   é € Ð,UÑ?T±t°q¨Q¯UªUÓ?Tùs   ‚r   r   FN)ÚlenÚrangeÚtupleÚzipÚadd)Úprev_lenÚno_new_pointsr   r   ÚneighborÚe_newÚf_newÚalignedÚ	alignmentÚ	neighborsÚsrclenÚtrglenÚunions          €€€€€€r   Ú	grow_diagÚ&grow_diag_final_and.<locals>.grow_diagR   sñ   ø€ ô
 �y“> AÕ%ˆàœ˜Y›Ô'Ø ˆMä˜6–]�ä˜vž�Aà�v Ö*ã(1˜Hß',¤uÑ,U¼sÀAÀ6È8Ô?TÓ,U§u¡uÑ,U¼sÀAÀ6È8Ô?TÓ,UÓ'U˜HØ+3™L˜Eð !&¨WÖ 4¸ÀgÖ9MØ"*¨eÖ"3Ø )§¡¨hÔ 7Ø '¨¥× 0Ñ 0°Ô 7Ø '¨¥× 0Ñ 0°Ô 7Ø (¨A¥ Ø05¢ó )2ó	 'ñ #÷( Š}Ùñ1 (ó    c                ó  <€ \        S4       Fs  p\        S4       Fa  pVS9  g   K  VS9  g   K  W3S9   g   K  SP                  W34       SR,          P                  V4       SR,          P                  V4       Kc  	  Ku  	  R# )zŠ
Adds remaining points that are not in the intersection, not in the
neighboring alignments but in the original *e2f* and *f2e* alignments
r   r   N)r   r   )Úar   r   r   r   r   r   r    s   &  €€€€€r   Ú	final_andÚ&grow_diag_final_and.<locals>.final_ands   so   ø€ ô ˜6–]ˆEä˜vž�ð  Ö(Ø WÖ,Ø˜¨%Ö/à—M‘M 5 .Ô1Ø˜C•L×$Ñ$ UÔ+Ø˜C•L×$Ñ$ UÖ+ó 'ó #r#   ))éÿÿÿÿr   )r   r(   )é   r   )r   r)   )r(   r(   )r(   r)   )r)   r(   )r)   r)   )
Úsplitr   ÚmapÚintÚsetÚintersectionr    r   r   Úsorted)r   r   Úe2fÚf2er%   r   r   r!   r&   r   r   r   r    s   ff&&     @@@@r   Úgrow_diag_final_andr2      s  ý€ ðt 36·)±)´+Ó
>±+¨QŒ5””S˜!Ÿ'™' #›,Ó'Ö(±+€CÐ
>Ø25·)±)´+Ó
>±+¨QŒ5””S˜!Ÿ'™' #›,Ó'Ö(±+€CÐ
>âV€IÜ�C“×%Ñ%¤c¨#£hÓ/€IÜ�‹H�N‰Nœ3˜s›8Ó$€Eô œ#Ó€GÛ‰ˆØ��×Ñ˜ÔØ��×Ñ˜Öñ ÷ò ÷B,ñ ,ñ( „KÙˆc„NÙˆc„NÜ�)ÓÐùòK ?ùÚ
>s   ™1EÁ1E!N)Úcollectionsr   r2   r
   r#   r   Ú<module>r4      s   ðõ $ôr#   