简体   繁体   中英

Find Synonyms for multi-word phrases

Is it possible for the python library NLTK to suggest/create synonyms for groups of words?

For example; for the word/group "main course" can I use NLTK to get the synonyms "main dish", "main meal", "dinner" etc.?

Heres my code that works for single word synonyms but not multiwords:

from nltk.corpus import wordnet as wn
print wn.synset("eat.v.01").lemma_names # prints synonyms of eat
print wn.synset("main course.n.01").lemma_names # throws WordNetError

使用下划线:

print wn.synset("main_course.n.01").lemma_names

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM