在使用PyEnchant时,是否可以从字典中排除某些单词?例如,我想检查一个单词是英语(在我的例子中是'en_EN')还是法语('fr_FR')。但是,当我在两个字典中检查字符串"de“时,它们都返回true。
发布于 2016-02-17 05:15:18
你可以试着在传递给Pyenchant之前删除停用的单词
from nltk.corpus import stopwords
def remove_stop_words(self, tokenized_docs_no_punctuation):
"""
:param tokenized_docs_no_punctuation:
:return:
"""
# print 'CleanupText.remove_stop_words()'
tokenized_docs_no_stopwords = []
for token in tokenized_docs_no_punctuation:
if not token in stopwords.words('english'):
tokenized_docs_no_stopwords.append(token)
return tokenized_docs_no_stopwords然后这些令牌将它们传递给Pyenchant
https://stackoverflow.com/questions/24810770
复制相似问题