WordNet 索引概念(又名Synsets
)不是言语。
Use lemma_names()
访问词根(又名Lemma
)在WordNet中。
>>> from nltk.corpus import wordnet as wn
>>> for ss in wn.synsets('phone'): # Each synset represents a diff concept.
... print(ss.lemma_names())
...
['telephone', 'phone', 'telephone_set']
['phone', 'speech_sound', 'sound']
['earphone', 'earpiece', 'headphone', 'phone']
['call', 'telephone', 'call_up', 'phone', 'ring']
引理作为根形式或单词不应该有额外的词缀,因此您不会找到您在所需单词列表中列出的单词的复数或不同形式。
也可以看看:
- https://simple.wikipedia.org/wiki/Lemma_(语言学) https://simple.wikipedia.org/wiki/Lemma_(linguistics)
- https://en.wikipedia.org/wiki/WordNet https://en.wikipedia.org/wiki/WordNet
- python 中单词的所有同义词? https://stackoverflow.com/questions/19348973/all-synonyms-for-word-in-python
此外,单词是不明确的,可能需要通过上下文或我的词性 (POS) 来消除歧义,然后才能获得“相似”单词,例如,您看到动词含义中的“phone”与“phone”的含义并不完全相同电话如“名词”中所示。
>>> for ss in wn.synsets('phone'): # Each synset represents a diff concept.
... print(ss.lemma_names(), '\t', ss.definition())
...
['telephone', 'phone', 'telephone_set'] electronic equipment that converts sound into electrical signals that can be transmitted over distances and then converts received signals back into sounds
['phone', 'speech_sound', 'sound'] (phonetics) an individual sound unit of speech without concern as to whether or not it is a phoneme of some language
['earphone', 'earpiece', 'headphone', 'phone'] electro-acoustic transducer for converting electric signals into sounds; it is held over or inserted into the ear
['call', 'telephone', 'call_up', 'phone', 'ring'] get or try to get into communication (with someone) by telephone