YZ,d?efd@YZ-e.e/dAZ0e+j0je0_e.e/dBZ1e+j1je1_e.e/dCZ2e+j2je2_e.dDZ3e+j3je3_e.dEZ4e+j4je4_e.dFZ5e+j5je5_e.dGZ6dHZ7dIZ8e"dJZ9dKZ:e;dLkre:ndS(Mu An NLTK interface for WordNet WordNet is a lexical database of English. Using synsets, helps find conceptual relationships between words such as hypernyms, hyponyms, synonyms, antonyms etc. For details about WordNet see: http://wordnet.princeton.edu/ This module also allows you to find lemmas in languages other than English from the Open Multilingual Wordnet http://compling.hss.ntu.edu.sg/omw/ i(tprint_functiontunicode_literalsN(tislicetchain(t itemgettert attrgetter(t defaultdicttdeque(t CorpusReader(tbinary_search_file(tFreqDist(t iteritemstpython_2_unicode_compatiblettotal_orderingtxrangegu<7~uausurunuvu Something %su Somebody %su It is %singuSomething is %sing PPu%Something %s something Adjective/NounuSomething %s Adjective/NounuSomebody %s AdjectiveuSomebody %s somethinguSomebody %s somebodyuSomething %s somebodyuSomething %s somethinguSomething %s to somebodyuSomebody %s on somethinguSomebody %s somebody somethingu!Somebody %s something to somebodyu#Somebody %s something from somebodyu#Somebody %s somebody with somethingu!Somebody %s somebody of somethingu!Somebody %s something on somebodyuSomebody %s somebody PPuSomebody %s something PPuSomebody %s PPuSomebody's (body part) %su"Somebody %s somebody to INFINITIVEuSomebody %s somebody INFINITIVEuSomebody %s that CLAUSEuSomebody %s to somebodyuSomebody %s to INFINITIVEuSomebody %s whether INFINITIVEu)Somebody %s somebody into V-ing somethingu$Somebody %s something with somethinguSomebody %s INFINITIVEuSomebody %s VERB-inguIt %s that CLAUSEuSomething %s INFINITIVEu\.\d\d\.t WordNetErrorcBseZdZRS(u.An exception class for wordnet-related errors.(t__name__t __module__t__doc__(((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRust_WordNetObjectcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZRS(u+A common base class for lemmas and synsets.cCs |jdS(Nu@(t_related(tself((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt hypernyms}scCs|jddtS(Nu@tsort(RtFalse(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt _hypernymsscCs |jdS(Nu@i(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytinstance_hypernymsscCs|jddtS(Nu@iR(RR(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt_instance_hypernymsscCs |jdS(Nu~(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pythyponymsscCs |jdS(Nu~i(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytinstance_hyponymsscCs |jdS(Nu#m(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytmember_holonymsscCs |jdS(Nu#s(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytsubstance_holonymsscCs |jdS(Nu#p(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt part_holonymsscCs |jdS(Nu%m(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytmember_meronymsscCs |jdS(Nu%s(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytsubstance_meronymsscCs |jdS(Nu%p(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt part_meronymsscCs |jdS(Nu;c(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt topic_domainsscCs |jdS(Nu;r(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytregion_domainsscCs |jdS(Nu;u(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt usage_domainsscCs |jdS(Nu=(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt attributesscCs |jdS(Nu*(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt entailmentsscCs |jdS(Nu>(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytcausesscCs |jdS(Nu^(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt also_seesscCs |jdS(Nu$(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt verb_groupsscCs |jdS(Nu&(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt similar_tosscCs t|jS(N(thasht_name(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__hash__scCs|j|jkS(N(R.(Rtother((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__eq__scCs|j|jkS(N(R.(RR0((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__ne__scCs|j|jkS(N(R.(RR0((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__lt__s(RRRRRRRRRRRR R!R"R#R$R%R&R'R(R)R*R+R,R/R1R2R3(((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRys4                        tLemmac BseZdZddddddddd d g Zd Zd Zd ZdZdZdZ dZ dZ dZ dZ dZdZdZdZRS(u The lexical entry for a single morphological form of a sense-disambiguated word. Create a Lemma from a "..." string where: is the morphological stem identifying the synset is one of the module attributes ADJ, ADJ_SAT, ADV, NOUN or VERB is the sense number, counting from 0. is the morphological form of interest Note that and can be different, e.g. the Synset 'salt.n.03' has the Lemmas 'salt.n.03.salt', 'salt.n.03.saltiness' and 'salt.n.03.salinity'. Lemma attributes, accessible via methods with the same name:: - name: The canonical name of this lemma. - synset: The synset that this lemma belongs to. - syntactic_marker: For adjectives, the WordNet string identifying the syntactic position relative modified noun. See: http://wordnet.princeton.edu/man/wninput.5WN.html#sect10 For all other parts of speech, this attribute is None. - count: The frequency of this lemma in wordnet. Lemma methods: Lemmas have the following methods for retrieving related Lemmas. They correspond to the names for the pointer symbols defined here: http://wordnet.princeton.edu/man/wninput.5WN.html#sect3 These methods all return lists of Lemmas: - antonyms - hypernyms, instance_hypernyms - hyponyms, instance_hyponyms - member_holonyms, substance_holonyms, part_holonyms - member_meronyms, substance_meronyms, part_meronyms - topic_domains, region_domains, usage_domains - attributes - derivationally_related_forms - entailments - causes - also_sees - verb_groups - similar_tos - pertainyms u_wordnet_corpus_readeru_nameu_syntactic_markeru_synsetu_frame_stringsu _frame_idsu_lexname_indexu_lex_idu_langu_keycCs^||_||_||_||_g|_g|_||_||_d|_d|_ dS(Nueng( t_wordnet_corpus_readerR.t_syntactic_markert_synsett_frame_stringst _frame_idst_lexname_indext_lex_idt_langtNonet_key(Rtwordnet_corpus_readertsynsettnamet lexname_indextlex_idtsyntactic_marker((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__init__s         cCs|jS(N(R.(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRA scCs|jS(N(R6(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRDscCs|jS(N(R7(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR@scCs|jS(N(R8(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt frame_stringsscCs|jS(N(R9(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt frame_idsscCs|jS(N(R<(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlangscCs|jS(N(R>(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytkeyscCs)t|j|jj|jf}d|S(Nu %s('%s.%s')(ttypeRR7R.(Rttup((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt__repr__!s!cCsU|jj}tg|jj|j|fD]%\}}}|||j|^q)S(N(R5t_synset_from_pos_and_offsettsortedR7t_lemma_pointersR.t_lemmas(Rtrelation_symbolt get_synsettpostoffsett lemma_index((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR%s cCs|jj|S(u)Return the frequency count for this Lemma(R5t lemma_count(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytcount+scCs |jdS(Nu!(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytantonyms/scCs |jdS(Nu+(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytderivationally_related_forms2scCs |jdS(Nu\(R(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt pertainyms5s(RRRt __slots__RERARDR@RFRGRHRIRLRRWRXRYRZ(((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR4s$/               tSynsetc BseZdZddddddddd d d d d g ZdZdZdZdZdZdZ dZ dZ dZ ddZ ddZdZdZdZddZdZd Zeed!Zd"ed#Zd$Zed%Zdd0d&Zeed'Zeed(Zeed)Zed*Z ed+Z!ed,Z"d-Z#d.Z$ed/Z%RS(1ukCreate a Synset from a ".." string where: is the word's morphological stem is one of the module attributes ADJ, ADJ_SAT, ADV, NOUN or VERB is the sense number, counting from 0. Synset attributes, accessible via methods with the same name: - name: The canonical name of this synset, formed using the first lemma of this synset. Note that this may be different from the name passed to the constructor if that string used a different lemma to identify the synset. - pos: The synset's part of speech, matching one of the module level attributes ADJ, ADJ_SAT, ADV, NOUN or VERB. - lemmas: A list of the Lemma objects for this synset. - definition: The definition for this synset. - examples: A list of example strings for this synset. - offset: The offset in the WordNet dict file of this synset. - lexname: The name of the lexicographer file containing this synset. Synset methods: Synsets have the following methods for retrieving related Synsets. They correspond to the names for the pointer symbols defined here: http://wordnet.princeton.edu/man/wninput.5WN.html#sect3 These methods all return lists of Synsets. - hypernyms, instance_hypernyms - hyponyms, instance_hyponyms - member_holonyms, substance_holonyms, part_holonyms - member_meronyms, substance_meronyms, part_meronyms - attributes - entailments - causes - also_sees - verb_groups - similar_tos Additionally, Synsets support the following methods specific to the hypernym relation: - root_hypernyms - common_hypernyms - lowest_common_hypernyms Note that Synsets do not support the following relations because these are defined by WordNet as lexical relations: - antonyms - derivationally_related_forms - pertainyms u_posu_offsetu_nameu _frame_idsu_lemmasu _lemma_namesu _definitionu _examplesu_lexnameu _pointersu_lemma_pointersu _max_depthu _min_depthcCs||_d|_d|_d|_g|_g|_g|_d|_g|_ d|_ d|_ t t |_t t |_dS(N(R5R=t_post_offsetR.R9RPt _lemma_namest _definitiont _examplest_lexnamet_all_hypernymsRtsett _pointersRO(RR?((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyREus           cCs|jS(N(R](R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRSscCs|jS(N(R^(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRTscCs|jS(N(R.(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRAscCs|jS(N(R9(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRGscCs|jS(N(R`(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt definitionscCs|jS(N(Ra(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytexamplesscCs|jS(N(Rb(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlexnamescCsF|jtkr/|jjdkr(tStSn|jtkrBtSdS(Nu1.6(R]tNOUNR5t get_versiontTrueRtVERB(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt _needs_roots uengcCsm|dkr|jS|jj||jj|}||jj|dkre|jj|d|SgSdS(u5Return all the lemma_names associated with the synsetuengiN(R_R5t_load_lang_datatss2oft _lang_data(RRHti((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt lemma_namess cCs|dkr|jS|jj|g}|j|}xW|D]O}t|j|||jjj|jdd}||_ |j |q?W|SdS(u7Return all the lemma objects associated with the synsetuengiN( RPR5RnRrR4t _lexnamestindexRhR=R<tappend(RRHtlemmarktlemmytlemttemp((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlemmass  3 cCsg}t}|g}xk|r|j}||kr|j||j|j}|sr|j|q|j|qqW|S(u4Get the topmost hypernyms of this synset in WordNet.(RdtpoptaddRRRutextend(Rtresulttseenttodot next_synsettnext_hypernyms((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytroot_hypernymss        cCs^d|jkrW|j|j}|s7d|_qWdtd|D|_n|jS(uh :return: The length of the longest hypernym path from this synset to the root. u _max_depthiicss|]}|jVqdS(N(t max_depth(t.0th((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys s(t__dict__RRt _max_depthtmax(RR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs   cCs^d|jkrW|j|j}|s7d|_qWdtd|D|_n|jS(ui :return: The length of the shortest hypernym path from this synset to the root. u _min_depthiicss|]}|jVqdS(N(t min_depth(RR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys s(RRRt _min_depthtmin(RR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs   iccssddlm}g}xV||||D]B}|j|jkr)|j|krk|j|j|Vqkq)q)WdS(uReturn the transitive closure of source under the rel relationship, breadth-first >>> from nltk.corpus import wordnet as wn >>> dog = wn.synset('dog.n.01') >>> hyp = lambda s:s.hypernyms() >>> list(dog.closure(hyp)) [Synset('canine.n.02'), Synset('domestic_animal.n.01'), Synset('carnivore.n.01'), Synset('animal.n.01'), Synset('placental.n.01'), Synset('organism.n.01'), Synset('mammal.n.01'), Synset('living_thing.n.01'), Synset('vertebrate.n.01'), Synset('whole.n.02'), Synset('chordate.n.01'), Synset('object.n.01'), Synset('physical_entity.n.01'), Synset('entity.n.01')] i(t breadth_firstN(t nltk.utilRR^Ru(RtreltdepthRtsynset_offsetsR@((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytclosurescCsg}|j|j}t|dkr=|gg}nx?|D]7}x.|jD] }|j||j|qWWqDW|S(u% Get the path(s) from this synset to the root, where each path is a list of the synset nodes traversed on the way to the root. :return: A list of lists, where each list gives the node sequence connecting the initial ``Synset`` node and a root node. i(RRtlenthypernym_pathsRu(RtpathsRthypernymt ancestor_list((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs  cCso|js+td|jD|_n|jsVtd|jD|_nt|jj|jS(u Find all synsets that are hypernyms of this synset and the other synset. :type other: Synset :param other: other input synset. :return: The synsets that are hypernyms of both synsets. css"|]}|D] }|Vq qdS(N((Rt self_synsetst self_synset((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys .scss"|]}|D] }|Vq qdS(N((Rt other_synsetst other_synset((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys 2s(RcRdt_iter_hypernym_liststlistt intersection(RR0((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytcommon_hypernyms$s    c Cs|j|}|rRtd}d|_d|_d|_|j|ny|rtd|D}g|D]}|j|krx|^qx}nAtd|D}g|D]}|j |kr|^q}t |SWnt k rgSXdS(u& Get a list of lowest synset(s) that both synsets have as a hypernym. When `use_min_depth == False` this means that the synset which appears as a hypernym of both `self` and `other` with the lowest maximum depth is returned or if there are multiple such synsets at the same depth they are all returned However, if `use_min_depth == True` then the synset(s) which has/have the lowest minimum depth and appear(s) in both paths is/are returned. By setting the use_min_depth flag to True, the behavior of NLTK2 can be preserved. This was changed in NLTK3 to give more accurate results in a small set of cases, generally with synsets concerning people. (eg: 'chef.n.01', 'fireman.n.01', etc.) This method is an implementation of Ted Pedersen's "Lowest Common Subsumer" method from the Perl Wordnet module. It can return either "self" or "other" if they are a hypernym of the other. :type other: Synset :param other: other input synset :type simulate_root: bool :param simulate_root: The various verb taxonomies do not share a single root which disallows this metric from working for synsets that are not connected. This flag (False by default) creates a fake root that connects all the taxonomies. Set it to True to enable this behavior. For the noun taxonomy, there is usually a default root except for WordNet version 1.6. If you are using wordnet 1.6, a fake root will need to be added for nouns as well. :type use_min_depth: bool :param use_min_depth: This setting mimics older (v2) behavior of NLTK wordnet If True, will use the min_depth function to calculate the lowest common hypernyms. This is known to give strange results for some synset pairs (eg: 'chef.n.01', 'fireman.n.01') but is retained for backwards compatibility :return: The synsets that are the lowest common hypernyms of both synsets u*ROOT*cSsgS(N((((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt_scSsgS(N((((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR`scss|]}|jVqdS(N(R(Rts((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys escss|]}|jVqdS(N(R(RR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys hsN( RR\R=R.RRRuRRRRNt ValueError( RR0t simulate_roott use_min_depthtsynsetst fake_synsetRRt unsorted_lch((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlowest_common_hypernyms7s $    .+ icCst||fg}x;|j|jD]#}||j|ddtO}q,W|rtd}d|_t|dt dd}|j ||dfn|S(u Get the path(s) from this synset to the root, counting the distance of each node from the initial node on the way. A set of (synset, distance) tuples is returned. :type distance: int :param distance: the distance (number of edges) from this hypernym to the original hypernym ``Synset`` on which this method was called. :return: A set of ``(Synset, int)`` tuples where each ``Synset`` is a hypernym of the first ``Synset``. iRu*ROOT*RIN( RdRRthypernym_distancesRR\R=R.RRR|(RtdistanceRt distancesRRtfake_synset_distance((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRns !  cs|jdkrid|6St|dfg}i}x|r|j\}||krbq8n||<d7|jfd|jD|jfd|jDq8W|rtd}d|_t|j d||sc3s|]}|fVqdS(N((RR(R(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys s( R.RtpopleftR}RRR\R=Rtvalues(RRtqueuetpathRR((Rsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt_shortest_hypernym_pathss"     #'  c Cs||krdS|j|}|j|}td}|}x?t|D]1\}}|j||} t||| }qMWtj|rdS|S(u Returns the distance of the shortest path linking the two synsets (if one exists). For each synset, all the ancestor nodes and their distances are recorded and compared. The ancestor node common to both synsets that can be reached with the minimum number of traversals is used. If no ancestor nodes are common, None is returned. If a node is compared with itself 0 is returned. :type other: Synset :param other: The Synset to which the shortest path will be found. :return: The number of edges in the shortest path connecting the two nodes, or None if no path exists. iuinfN(RtfloatR tgetRtmathtisinfR=( RR0Rt dist_dict1t dist_dict2tinft path_distanceR@td1td2((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytshortest_path_distances  cCsh|g}|dkrN|g||D]}|j||d|^q%7}n|rd||g7}n|S(uJ >>> from nltk.corpus import wordnet as wn >>> dog = wn.synset('dog.n.01') >>> hyp = lambda s:s.hypernyms() >>> from pprint import pprint >>> pprint(dog.tree(hyp)) [Synset('dog.n.01'), [Synset('canine.n.02'), [Synset('carnivore.n.01'), [Synset('placental.n.01'), [Synset('mammal.n.01'), [Synset('vertebrate.n.01'), [Synset('chordate.n.01'), [Synset('animal.n.01'), [Synset('organism.n.01'), [Synset('living_thing.n.01'), [Synset('whole.n.02'), [Synset('object.n.01'), [Synset('physical_entity.n.01'), [Synset('entity.n.01')]]]]]]]]]]]]], [Synset('domestic_animal.n.01'), [Synset('animal.n.01'), [Synset('organism.n.01'), [Synset('living_thing.n.01'), [Synset('whole.n.02'), [Synset('object.n.01'), [Synset('physical_entity.n.01'), [Synset('entity.n.01')]]]]]]]]] ii(ttree(RRRtcut_markRtx((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs   9cCsI|j|d|o|j}|dks9|dkr=dSd|dS(u Path Distance Similarity: Return a score denoting how similar two word senses are, based on the shortest path that connects the senses in the is-a (hypernym/hypnoym) taxonomy. The score is in the range 0 to 1, except in those cases where a path cannot be found (will only be true for verbs as there are many distinct verb taxonomies), in which case None is returned. A score of 1 represents identity i.e. comparing a sense with itself will return 1. :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type simulate_root: bool :param simulate_root: The various verb taxonomies do not share a single root which disallows this metric from working for synsets that are not connected. This flag (True by default) creates a fake root that connects all the taxonomies. Set it to false to disable this behavior. For the noun taxonomy, there is usually a default root except for WordNet version 1.6. If you are using wordnet 1.6, a fake root will be added for nouns as well. :return: A score denoting the similarity of the two ``Synset`` objects, normally between 0 and 1. None is returned if no connecting path could be found. 1 is returned if a ``Synset`` is compared with itself. Rig?iN(RRmR=(RR0tverboseRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytpath_similaritys!cCs|j|jkr/tdd||fn|j}|j|jjkri|jj|j|n|jj|j}|j|d|o|}|dks|dks|dkrdStj |dd| S(ub Leacock Chodorow Similarity: Return a score denoting how similar two word senses are, based on the shortest path that connects the senses (as above) and the maximum depth of the taxonomy in which the senses occur. The relationship is given as -log(p/2d) where p is the shortest path length and d is the taxonomy depth. :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type simulate_root: bool :param simulate_root: The various verb taxonomies do not share a single root which disallows this metric from working for synsets that are not connected. This flag (True by default) creates a fake root that connects all the taxonomies. Set it to false to disable this behavior. For the noun taxonomy, there is usually a default root except for WordNet version 1.6. If you are using wordnet 1.6, a fake root will be added for nouns as well. :return: A score denoting the similarity of the two ``Synset`` objects, normally greater than 0. None is returned if no connecting path could be found. If a ``Synset`` is compared with itself, the maximum score is returned, which varies depending on the taxonomy depth. u&Computing the lch similarity requires u*%s and %s to have the same part of speech.Riig@N( R]RRmR5Rt_compute_max_depthRR=Rtlog(RR0RRt need_rootRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlch_similaritys $c Cs|j}|j|d|o!|dt}t|dkrCdS|d}|jd}|j|d|or|}|j|d|o|} |dks| dkrdS||7}| |7} d||| S(u Wu-Palmer Similarity: Return a score denoting how similar two word senses are, based on the depth of the two senses in the taxonomy and that of their Least Common Subsumer (most specific ancestor node). Previously, the scores computed by this implementation did _not_ always agree with those given by Pedersen's Perl implementation of WordNet Similarity. However, with the addition of the simulate_root flag (see below), the score for verbs now almost always agree but not always for nouns. The LCS does not necessarily feature in the shortest path connecting the two senses, as it is by definition the common ancestor deepest in the taxonomy, not closest to the two senses. Typically, however, it will so feature. Where multiple candidates for the LCS exist, that whose shortest path to the root node is the longest will be selected. Where the LCS has multiple paths to the root, the longer path is used for the purposes of the calculation. :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type simulate_root: bool :param simulate_root: The various verb taxonomies do not share a single root which disallows this metric from working for synsets that are not connected. This flag (True by default) creates a fake root that connects all the taxonomies. Set it to false to disable this behavior. For the noun taxonomy, there is usually a default root except for WordNet version 1.6. If you are using wordnet 1.6, a fake root will be added for nouns as well. :return: A float score denoting the similarity of the two ``Synset`` objects, normally greater than zero. If no connecting path between the two senses can be found, None is returned. RRiig@N(RmRRkRR=RR( RR0RRRt subsumerstsubsumerRtlen1tlen2((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytwup_similarity/s$ !    cCst|||\}}}|S(u Resnik Similarity: Return a score denoting how similar two word senses are, based on the Information Content (IC) of the Least Common Subsumer (most specific ancestor node). :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type ic: dict :param ic: an information content object (as returned by ``nltk.corpus.wordnet_ic.ic()``). :return: A float score denoting the similarity of the two ``Synset`` objects. Synsets whose LCS is the root node of the taxonomy will have a score of 0 (e.g. N['dog'][0] and N['table'][0]). (t_lcs_ic(RR0ticRtic1tic2tlcs_ic((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytres_similarityvscCsq||krtSt|||\}}}|dksC|dkrGdS||d|}|dkritSd|S(u Jiang-Conrath Similarity: Return a score denoting how similar two word senses are, based on the Information Content (IC) of the Least Common Subsumer (most specific ancestor node) and that of the two input Synsets. The relationship is given by the equation 1 / (IC(s1) + IC(s2) - 2 * IC(lcs)). :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type ic: dict :param ic: an information content object (as returned by ``nltk.corpus.wordnet_ic.ic()``). :return: A float score denoting the similarity of the two ``Synset`` objects. iii(t_INFR(RR0RRRRRt ic_difference((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytjcn_similaritys  cCs+t|||\}}}d|||S(u Lin Similarity: Return a score denoting how similar two word senses are, based on the Information Content (IC) of the Least Common Subsumer (most specific ancestor node) and that of the two input Synsets. The relationship is given by the equation 2 * IC(lcs) / (IC(s1) + IC(s2)). :type other: Synset :param other: The ``Synset`` that this ``Synset`` is being compared to. :type ic: dict :param ic: an information content object (as returned by ``nltk.corpus.wordnet_ic.ic()``). :return: A float score denoting the similarity of the two ``Synset`` objects, in the range 0 to 1. g@(R(RR0RRRRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlin_similaritysccs|g}t}xo|rx|D]}|j|q"W|Vg|D]5}|j|jD]}||kr_|^q_qE}qWdS(u :return: An iterator over ``Synset`` objects that are either proper hypernyms or instance of hypernyms of the synset. N(RdR|RR(RRRR@R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs      cCsdt|j|jfS(Nu%s('%s')(RJRR.(R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRLscCsX|jj}|j|}g|D]\}}|||^q }|rT|jn|S(N(R5RMReR(RRQRRRtpointer_tuplesRSRTtr((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs   ( N(&RRRR[RERSRTRARGRfRgRhRmRrRzRRRRRRRRRRRR=RRkRRRRRRRRLR(((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR\9sJ4                   7  & -G    tWordNetCorpusReadercBseZdZdZdZ\ZZZZZide6de6d e6d e6Z id e6d e6d e6de6de6Z e de j DZ d[Zd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zd(Zd)d*Zd+Zd,Zd-Zd.Zd/Zd\d)d0Zd\d)d1Z d\d)d2Z!d\d3Z"d)d4Z#d)d5Z$d6d7Z%d6d8Z&d9Z'e(e)d:Z*e+j*je*_e(e)d;Z,e+j,je,_e(e)d<Z-e+j-je-_e(d=Z.e+j.je._e(d>Z/e+j/je/_e(d?Z0e+j0je0_d\d@Z1id]d^d_d`dadbdcdddeg e6dfdgdhdidjdkdldmge6dndodpdqge6ge6Z2e2ee2esu cntlist.revulexnamesu index.senseu index.adju index.advu index.nounu index.verbudata.adjudata.advu data.nounu data.verbuadj.excuadv.excunoun.excuverb.exccCstt|j||jd|jtt|_tt|_tt|_ ||_ tt |_ i|_ i|_g|_d|_d|_x`t|jdD]I\}}|j\}}}t||kst|jj|qW|j|jdS(u_ Construct a new wordnet corpus reader, with the given root directory. tencodingulexnamesN(tsuperRREt_FILESt _ENCODINGRtdictt_lemma_pos_offset_mapt_synset_offset_cacheRt _omw_readerRRpt_data_file_mapt_exception_mapRsR=t_key_count_filet_key_synset_filet enumeratetopentsplittinttAssertionErrorRut_load_lemma_pos_offset_mapt_load_exception_map(Rtroott omw_readerRqtlineRtRht_((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyREs$       " cCs|j|dt|d S(u# take an id and return the synsets ii(RMR(Rtof((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytof2ss'scCsdj|j|jS(u return the ID of the synset u {:08d}-{}(tformatRTRS(Rtss((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRo+scCs<||jkr!tdn||jjkr:dS|jjdj|}|j|jtt |j|jtt x|j D]}|j dd}|j dd}|dd kr|j d }|j|d|dj|d |j|d |d j|dqqW|j dS( uX load the wordnet data of the requested language from the file to the cache, _lang_data uLanguage is not supported.Nu{0:}/wn-data-{0:}.tabu uu u_iu#u ii(tlangsRRptkeysRRRRuRRt readlinestreplaceRtclose(RRHtftltword((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRn/s$+cCszddl}dg}|jj}xO|D]G}|jj|\}}|dkr+|j|jddq+q+W|S(u> return a list of languages supported by Multilingual Wordnet iNuengu.tabu-(tosRtfileidsRtsplitextRuR(RRRRtfileidt file_nametfile_extension((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRFs    !csx|jjD]}xt|jd|D]v\}}|jdrQq0nt|jfd}y|}|}t|}|dkstt|}gt |D]} |^q} t|} || kstt|} gt |D]} t|^q} Wn@tt fk rt} d||d| f} t d| nX| |j ||<|t kr0| |j |t( RRIR"t lex_senset pos_numberRBRCRRSt synset_lineRTR@R ((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlemma_from_keys c Csd|jjdd\}}}t|d}y|j|||}Wntk ryd}t|||fnqtk rt|j||}d}|dkr|||df} n|||df} t|| nX|j||} |dkr0| j d kr0d }t||n| j |ks`|d krZ| j dks`t | S( Nu.iiu"no lemma %r with part of speech %ru.lemma %r with part of speech %r has only %i %susenseusensesusuauIadjective satellite requested but only plain adjective found for lemma %r( R#trsplitRRtKeyErrorRt IndexErrorRRMR]R( RRAR RStsynset_index_strt synset_indexRTtmessageRRKR@((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR@s(!   0cCsb|tkrt}n|jj|dkrWd|j|}|j||j|RRt(&RRSR3R@t columns_strtglosst definitionst gloss_partR RBtn_lemmasRR"RCtmtsyn_markR R tsymbolRTt lemma_ids_strt source_indext target_indextsource_lemma_nametlemma_pointersttupst frame_counttplust frame_numbertframe_string_fmtt lemma_numberRt head_lemmat head_namethead_idRKtoffsetst sense_index((Rsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyR1s                    c Cs|j}|dkr|j}|j}|dkr?t}ng|D]K}|j||D]2}||j|gD]}|||^qvq\qFS|j|g} xU|j|d|D]>} |dk r| d|krqn| j |j | qW| SdS(uLoad all synsets with a given lemma and part of speech tag. If no pos is specified, all synsets for all parts of speech will be loaded. If lang is specified, all the synsets associated with the lemma name of that language will be returned. uengiiN( R#RMRR=tPOS_LISTt_morphyRRnRpRuR( RR RSRHRRRttptformRTt synset_listR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs"       3 c Cs|dkrf|j}g|j||D]7}|jD]$}|jj|kr;|^q;q+S|j|g}|j|d|}xu|D]m}|dk r|j|krqnt||||jj |j dd} || _ |j | qW|SdS(uReturn all Lemma objects with a name matching the specified lemma name and part of speech tag. Matches any part of speech tag if none is specified.uengRHiN( R#RRzRARnR=RSR4RsRtRhR<Ru( RR RSRHR@t lemma_objRztsynRta((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRzs   %  - cs|dkrBdkr%tjSfdjDSnj|g}xWj|dD]D}dk r|dkrqgn|jj|d|qgWtt|}|SdS(uReturn all lemma names for all synsets for the given part of speech tag and langauge or languages. If pos is not specified, all synsets for all parts of speech will be used.uengc3s(|]}j|kr|VqdS(N(R(RR (RSR(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys siiN(R=RRRnRpR}RRd(RRSRHR Rq((RSRsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytall_lemma_namess     c csR|dkr|jj}n |g}|j}|j}x|D] }|tkr[t}nd|j|}|j|}y|j}|j } x| r'| dj s |||kr|||} n||| } | |||<| j tkr| Vq | Vn|j}|j } qWWn|j q@X|j q@WdS(uIterate over all synsets with a given part of speech tag. If no pos is specified, all synsets for all parts of speech will be loaded. udata.%siN( R=RRRR1RRRttellR0tisspaceR]R( RRStpos_tagstcachetfrom_pos_and_linetpos_tagRR2RTRR@((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs8            cCs|jd|S(u4return lemmas of the given language as list of wordsRH(RZ(RRH((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytwordsscCs|dkr|jdjS||jkrP|jjdj|jS|dkrr|jjdjStddS(uoReturn the contents of LICENSE (for omw) use lang=lang to get the license for an individual languageuenguLICENSEu {}/LICENSEuomwuLanguage is not supported.N(RtreadRRRR(RRH((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytlicense s  uomwcCs|dkr|jdjS||jkrP|jjdj|jS|dkrr|jjdjStddS(umReturn the contents of README (for omw) use lang=lang to get the readme for an individual languageuenguREADMEu {}/READMEuomwuLanguage is not supported.N(RRbRRRR(RRH((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytreadmes  cCs|dkr|jdjS||jkrP|jjdj|jS|dkrr|jjdjStddS(uzReturn the contents of citation.bib file (for omw) use lang=lang to get the citation for an individual languageuengu citation.bibu{}/citation.bibuomwuLanguage is not supported.N(RRbRRRR(RRH((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytcitation$s  cCst|jdkrdS|jdkr7|jd|_nt|j|j}|rlt|jdddSdSdS(u)Return the frequency count for this Lemmauengiu cntlist.revu iiN(R<RR=RR%R>RR*(RR R((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRV6scCs|j|||S(N(R(Rtsynset1tsynset2RR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyREscCs|j|||S(N(R(RRfRgRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRIscCs|j|||S(N(R(RRfRgRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRMscCs|j|||S(N(R(RRfRgRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRQscCs|j|||S(N(R(RRfRgRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRUscCs|j|||S(N(R(RRfRgRR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRYscs|dkr7|jtfdtD}n|j|}tt|d}t|dkrx|dSdSdS(u Find a possible base form for the given form, with the given part of speech, by checking WordNet's list of exceptional forms, and by recursively stripping affixes for this part of speech until a form in WordNet is found. >>> from nltk.corpus import wordnet as wn >>> print(wn.morphy('dogs')) dog >>> print(wn.morphy('churches')) church >>> print(wn.morphy('aardwolves')) aardwolf >>> print(wn.morphy('abaci')) abacus >>> wn.morphy('hardrock', wn.ADV) >>> print(wn.morphy('book', wn.NOUN)) book >>> wn.morphy('book', wn.ADJ) c3s+|]!}|D] }|VqqdS(N((RRTRY(RUtmorphy(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pys ysiiN(R=RSRRRRRR(RRURStanalysestfirst((RURhsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRhas  "uusesuvesufuxesuxuzesuzuchesuchushesushumenumanuiesuyuesueueduingueruestcsj}jfd}fd}||kr\||g||S||g}||g|}|r|Sx,|r||}||}|r|SqWgS(NcsHg|D]=}D]0\}}|j|r|t| |^qqS(N(tendswithR(tformsRUtoldtnew(t substitutions(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt apply_ruless csug}t}x_|D]W}|jkrj|krm||krj|j||j|qjqmqqW|S(N(RdRRuR|(RlR~RRU(RSR(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt filter_formss    (RtMORPHOLOGICAL_SUBSTITUTIONS(RRURSt exceptionsRpRqRltresults((RSRRosl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRSs       g?cCst}x$|jD]}||cd7lsu> LCS Subsumer by content:(R]RRRRRR(RfRgRRRRRt subsumer_ic((Rsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRPs cCsuy||j}Wn*tk r=d}t||jnX||j}|dkr[tStj||d SdS(Nu>Information content file has no entries for part-of-speech: %si(R]R+RR^RRR(R@RticpostmsgRx((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRvs   cCsB|ddkrtS|ddkr(tSd|}t|dS(NiunuvuLUnidentified part of speech in WordNet Information Content file for field %s(RiRlR(tfieldR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyRs  cCsddlm}|jdS(Ni(twordnet(t nltk.corpusRt_unload(tmoduleR((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytteardown_modulesc sddl}tdt|jjdd}td|j|j}tdd}t|j|j |j t|j t|j t|j dg}dd d d g}fd }||}||}t|t|td tdjtdjtdjt|djt|djt|djt|djtdjtdjtdjtdjtdjtdjtdjtdjtdjtdjtdjtdjt|d jt|d!jtd"jtd#jtd$jtd#jt|d%jtd&jtd'jtd(jtd&jdtd)jd*tdj d+tdj!d+tdj"d+t#|jjd,d-} | j$d.} tdj%d+| | j$d/} tdj&d+| td0j'td1j(td2j)dS(3Niuloading wordnetucorpora/wordnetu done loadingugetting a synset for gougo.v.21uzap.n.01uzap.v.01uzap.v.02u nuke.v.01umicrowave.v.01csg|D]}|^qS(N((tsynset_stringsR@(tS(sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyt _get_synsetssu Navigations:u travel.v.01u travel.v.02u travel.v.03u zap.v.03.nukeuzap.v.03.atomizeuzap.v.03.atomiseu zap.v.03.zapudog.n.01u breakfast.n.1umeal.n.1u Austen.n.1u composer.n.1u faculty.n.2u copilot.n.1u table.n.2u course.n.7u water.n.1ugin.n.1uleader.n.1.leaderuincrease.v.1.increaseu snore.v.1u heavy.a.1u light.a.1uEnglish.a.1.Englishu person.n.01u sail.v.01u fall.v.12u woman.n.01ugirlfriend.n.02ucat.n.01ucorpora/wordnet_icu.*\.datu ic-brown.datu ic-semcor.datu code.n.03u pukka.a.01u freaky.a.01(*tnltkRRtdatatfindR=R@R RARSRhRrRfRgRRYRR#RRRR!R R"RRXR(R,R'RZRRRRRRRRRR$R%R&( RtwntLt move_synsettzap_ntzap_vRt zap_n_synsetst zap_v_synsetstwnicR((Rsl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pytdemos~       "       ""u__main__(<Rt __future__RRRRt itertoolsRRtoperatorRRt collectionsRRtnltk.corpus.readerRRR R%tnltk.probabilityR t nltk.compatR R R RRRRRRiRlRRR=R8tcompileRt ExceptionRtobjectRR4R\RRRRkRRRRRRRRRRRR(((sl/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/reader/wordnet.pyts  "$ Oo%3    &  X