diff --git a/nltk/test/wordnet.doctest b/nltk/test/wordnet.doctest index e1ed56657b..8758423e36 100644 --- a/nltk/test/wordnet.doctest +++ b/nltk/test/wordnet.doctest @@ -6,6 +6,7 @@ WordNet Interface ================= WordNet is just another NLTK corpus reader, and can be imported like this: + >>> from nltk.corpus import wordnet For more compact code, we recommend: @@ -53,11 +54,10 @@ WordNet, using ISO-639 language codes. >>> wn.synsets(b'\xe7\x8a\xac'.decode('utf-8'), lang='jpn') [Synset('dog.n.01'), Synset('spy.n.01')] - wn.synset('spy.n.01').lemma_names('jpn') - ['\u3044\u306c', '\u307e\u308f\u3057\u8005', '\u30b9\u30d1\u30a4', '\u56de\u3057\u8005', - '\u56de\u8005', '\u5bc6\u5075', '\u5de5\u4f5c\u54e1', '\u5efb\u3057\u8005', - '\u5efb\u8005', '\u63a2', '\u63a2\u308a', '\u72ac', '\u79d8\u5bc6\u635c\u67fb\u54e1', - '\u8adc\u5831\u54e1', '\u8adc\u8005', '\u9593\u8005', '\u9593\u8adc', '\u96a0\u5bc6'] + >>> wn.synset('spy.n.01').lemma_names('jpn') + ['いぬ', 'スパイ', '回者', '回し者', '密偵', '工作員', + '廻者', '廻し者', '探', '探り', '犬', '秘密捜査員', + 'まわし者', '諜報員', '諜者', '間者', '間諜', '隠密'] >>> wn.synset('dog.n.01').lemma_names('ita') ['cane', 'Canis_familiaris'] @@ -68,8 +68,8 @@ WordNet, using ISO-639 language codes. [Lemma('dog.n.01.hund'), Lemma('dog.n.01.k\xf8ter'), Lemma('dog.n.01.vovhund'), Lemma('dog.n.01.vovse')] - sorted(wn.synset('dog.n.01').lemmas('por')) - [Lemma('dog.n.01.cachorra'), Lemma('dog.n.01.cachorro'), Lemma('dog.n.01.cadela'), Lemma('dog.n.01.c\xe3o')] + >>> sorted(wn.synset('dog.n.01').lemmas('por')) + [Lemma('dog.n.01.cachorra'), Lemma('dog.n.01.cachorro'), Lemma('dog.n.01.cadela'), Lemma('dog.n.01.c\xe3o')] >>> dog_lemma = wn.lemma(b'dog.n.01.c\xc3\xa3o'.decode('utf-8'), lang='por') >>> dog_lemma @@ -450,6 +450,7 @@ as a base form for a POS for which that word is not defined: >>> wn.morphy('book', wn.NOUN) 'book' >>> wn.morphy('book', wn.ADJ) + >>> Bug 160: wup_similarity breaks when the two synsets have no common hypernym @@ -460,6 +461,7 @@ Bug 160: wup_similarity breaks when the two synsets have no common hypernym Issue #2278: wup_similarity not commutative when comparing a noun and a verb. Patch #2650 resolved this error. As a result, the output of the following use of wup_similarity no longer returns None. + >>> t = wn.synsets('titan')[1] >>> s = wn.synsets('say', wn.VERB)[0] >>> t.wup_similarity(s) @@ -598,6 +600,7 @@ Bug https://github.com/nltk/nltk/issues/1641: Non-English lemmas containing capi [Lemma('united_kingdom.n.01.Londres'), Lemma('london.n.01.Londres'), Lemma('london.n.02.Londres')] Patch-1 https://github.com/nltk/nltk/pull/2065 Adding 3 functions (relations) to WordNet class + >>> wn.synsets("computer_science")[0].in_topic_domains()[2] Synset('access_time.n.01') >>> wn.synsets("France")[0].in_region_domains()[18]