成功使用NLTK停用词和Lin词库找到句子中某些单词的附近含义
from nltk.corpus import stopwords, lin_thesaurus as thes
sentence = "The door is made of glass"
stop = set(stopwords.words('english'))
print [thes.synonyms(i,fileid="simN.lsp") for i in sentence.lower().split() if i not in stop]
问题?
1.如何从列表中“查找并替换”随机同义词?
例如假设门为1并检查方差为0.09加或减的单词并替换它。