+
    ÖÇÜhG  ã                   ón   € ^ RI t ^ RIHt ^ RIHt ^ RIHt  ! R R]4      tR t]	R8X  d
   ]! 4        R# R# )	é    N)Údefaultdict)Úreduce)ÚCorpusReaderc                   ó’   a a€ ] tR t^t oRt]P                  ! R4      t]R 4       t	R
V 3R llt
RR ltRR ltRR ltR tR	tVtV ;t# )ÚLinThesaurusCorpusReaderzEWrapper for the LISP-formatted thesauruses distributed by Dekang Lin.z \("?([^"]+)"? \(desc [0-9.]+\).+c                 ó    € \        \        4      # )z6Factory for creating defaultdict of defaultdict(dict)s)r   Údict© ó    Ú8/usr/lib/python3/dist-packages/nltk/corpus/reader/lin.pyÚ__defaultdict_factoryÚ.LinThesaurusCorpusReader.__defaultdict_factory   s   € ô œ4Ó Ð r   c           	     óf  <€ \         SV `  VR4       \        \        P                  4      V n        W n        V P                  RRR7       FÐ  w  r4p\        V4      ;_uu_ 4       pRpV F¦  pVP                  4       pV'       d%   \        P                  P                  RV4      p	RpK?  VR8X  d   RpKJ  VP                  R4      p
\        V
4      ^8X  g   Km  V
w  r¼\        V4      V P
                  V,          X	,          VP                  R4      &   K¨  	  R	R	R	4       KÒ  	  R	#   + '       g   i     Kç  ; i)
zè
Initialize the thesaurus.

:param root: root directory containing thesaurus LISP files
:type root: C{string}
:param badscore: the score to give to words which do not appear in each other's sets of synonyms
:type badscore: C{float}
zsim[A-Z]\.lspT)Úinclude_encodingÚinclude_fileidz\1Fz))Ú	Ú"N)ÚsuperÚ__init__r   r   Ú._LinThesaurusCorpusReader__defaultdict_factoryÚ
_thesaurusÚ	_badscoreÚabspathsÚopenÚstripÚ_key_reÚsubÚsplitÚlenÚfloat)ÚselfÚrootÚbadscoreÚpathÚencodingÚfileidÚlin_fileÚfirstÚlineÚkeyÚ
split_lineÚngramÚscoreÚ	__class__s   &&&          €r   r   Ú!LinThesaurusCorpusReader.__init__   s   ø€ ô 	‰Ñ˜Ð/Ô0Ü%Ô&>×&TÑ&TÓUˆŒØ!ŒØ&*§m¡mØ!°$ð '4ö '
Ñ"ˆD˜Fô �d—”˜xØ�Û$�DØŸ:™:›<�DçÜ6×>Ñ>×BÑBÀ5È$ÓO˜Ø %šà œØ $šð &*§Z¡Z°Ó%5˜
Ü˜z›?¨aÖ/Ø+5™L˜EÜMRØ %óN˜DŸO™O¨FÕ3°CÕ8¸¿¹ÀSÓ9IÓJñ %÷ ‘ó'
÷ —�ús   Á"A-DÃ=DÄD0c                óä  € W8X  d(   V'       d   R# V P                    Uu. uF  qDR3NK  	  up# V'       dL   W P                  V,          V,          9   d"   V P                  V,          V,          V,          # V P                  # V P                    Uu. uFP  pTW P                  V,          V,          9   d"   V P                  V,          V,          V,          MV P                  3NKR  	  up# u upi u upi )a�  
Returns the similarity score for two ngrams.

:param ngram1: first ngram to compare
:type ngram1: C{string}
:param ngram2: second ngram to compare
:type ngram2: C{string}
:param fileid: thesaurus fileid to search in. If None, search all fileids.
:type fileid: C{string}
:return: If fileid is specified, just the score for the two ngrams; otherwise,
         list of tuples of fileids and scores.
g      ð?)Ú_fileidsr   r   )r!   Úngram1Úngram2r&   Úfids   &&&& r   Ú
similarityÚ#LinThesaurusCorpusReader.similarity?   sÝ   € ð ÔßÙà.2¯mªmÓ<©m s˜c›
©mÑ<Ð<çð §¡°Õ!8¸Õ!@Ô@ð —O‘O FÕ+¨FÕ3°FÕ;ðð Ÿ™ðð  $Ÿ}š}ó
ñ  -˜ð ð  &¯©¸Õ)=¸fÕ)EÔEð !ŸO™O¨CÕ0°Õ8¸Ö@à!%§¡óñ  -ñ
ð 
ùò =ùò
s   ŸC(ÂAC-c                óò   € V'       d)   V P                   V,          V,          P                  4       # V P                   Uu. uF,  pW P                   V,          V,          P                  4       3NK.  	  up# u upi )a¸  
Returns a list of scored synonyms (tuples of synonyms and scores) for the current ngram

:param ngram: ngram to lookup
:type ngram: C{string}
:param fileid: thesaurus fileid to search in. If None, search all fileids.
:type fileid: C{string}
:return: If fileid is specified, list of tuples of scores and synonyms; otherwise,
         list of tuples of fileids and lists, where inner lists consist of tuples of
         scores and synonyms.
)r   Úitemsr1   ©r!   r,   r&   s   &&&r   Úscored_synonymsÚ(LinThesaurusCorpusReader.scored_synonymsf   si   € ÷ Ø—?‘? 6Õ*¨5Õ1×7Ñ7Ó9Ð9ð #Ÿmšmóá+�Fð Ÿ™¨Õ0°Õ7×=Ñ=Ó?Ó@Ù+ñð ùò ó   ¿2A4c                óò   € V'       d)   V P                   V,          V,          P                  4       # V P                   Uu. uF,  pW P                   V,          V,          P                  4       3NK.  	  up# u upi )a\  
Returns a list of synonyms for the current ngram.

:param ngram: ngram to lookup
:type ngram: C{string}
:param fileid: thesaurus fileid to search in. If None, search all fileids.
:type fileid: C{string}
:return: If fileid is specified, list of synonyms; otherwise, list of tuples of fileids and
         lists, where inner lists contain synonyms.
)r   Úkeysr1   r9   s   &&&r   ÚsynonymsÚ!LinThesaurusCorpusReader.synonymsz   si   € ÷ Ø—?‘? 6Õ*¨5Õ1×6Ñ6Ó8Ð8ð #Ÿmšmóá+�Fð Ÿ™¨Õ0°Õ7×<Ñ<Ó>Ó?Ù+ñð ùò r<   c                ó>   a a€ \        VV 3R lS P                  R4      # )z¬
Determines whether or not the given ngram is in the thesaurus.

:param ngram: ngram to lookup
:type ngram: C{string}
:return: whether the given ngram is in the thesaurus.
c                 óD   <€ T ;'       g    SSP                   V,          9   # ©N)r   )Úaccumr&   r,   r!   s   &&€€r   Ú<lambda>Ú7LinThesaurusCorpusReader.__contains__.<locals>.<lambda>–   s   ø€  %×"MÐ"M¨E°T·_±_ÀVÕ5LÑ,LÐ"Mr   F)r   r1   )r!   r,   s   ffr   Ú__contains__Ú%LinThesaurusCorpusReader.__contains__�   s   ù€ ô ÝMØ�M‰MØó
ð 	
r   )r   r   )g        rC   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__ÚreÚcompiler   Ústaticmethodr   r   r5   r:   r?   rG   Ú__static_attributes__Ú__classdictcell__Ú__classcell__)r.   Ú__classdict__s   @@r   r   r      sK   ù‡ € ÙOð �jŠjÐ<Ó=€Gàñ!ó ð!÷"ôH%ôNô(÷&
ò 
r   r   c                  óÚ  € ^ RI Hp  RpRp\        RV,           4       \        V P                  V4      4       \        RV,           4       \        V P	                  V4      4       \        RV,           4       \        V P                  VRR7      4       \        RV,           4       \        V P                  VRR7      4       \        R	V R
V R24       \        V P                  W4      4       R# )r   )Úlin_thesaurusÚbusinessÚ
enterprisezGetting synonyms for zGetting scored synonyms for z5Getting synonyms from simN.lsp (noun subsection) for zsimN.lsp)r&   zSimilarity score for z and Ú:N)Únltk.corpusrV   Úprintr?   r:   r5   )ÚthesÚword1Úword2s      r   Údemor_   ¡   s¾   € Ý1à€EØ€EÜ	Ð
! EÕ
)Ô*Ü	ˆ$�-‰-˜Ó
Ôä	Ð
(¨5Õ
0Ô1Ü	ˆ$×
Ñ
˜uÓ
%Ô&ä	Ð
AÀEÕ
IÔJÜ	ˆ$�-‰-˜ jˆ-Ó
1Ô2ä	Ð
AÀEÕ
IÔJÜ	ˆ$�-‰-˜ jˆ-Ó
1Ô2ä	Ð! % ¨¨e¨W°AÐ
6Ô7Ü	ˆ$�/‰/˜%Ó
'Ö(r   Ú__main__)
rN   Úcollectionsr   Ú	functoolsr   Únltk.corpus.readerr   r   r_   rI   r
   r   r   Ú<module>rd      s;   ðó 
Ý #Ý å +ôJ
˜|ô J
òd)ð* ˆzÔÙ†Fñ r   