首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在python中找不到wordnet synset

在python中找不到wordnet synset
EN

Stack Overflow用户
提问于 2021-11-07 17:12:44
回答 1查看 30关注 0票数 1

我有功能

代码语言:javascript
复制
def find_n_similar():
    word = input("please enter a word: ")
    word_syntest = wordnet.synsets(word)[0]
    print(word_syntest)
    similarity_rate = {}
    with open("1-1000.txt", 'r') as file:
        file_words = file.read().split("\n")
    print(file_words)
    for file_word in file_words:
        file_word_syntest = wordnet.synsets(file_word)
        similarity_rate.update({f"{file_word}": word_syntest.path_similarity(file_word_syntest)})

如果我输入"the","of“等,它会抛出异常:IndexError: list index out of range我如何才能找到这些单词的同义词?

EN

回答 1

Stack Overflow用户

发布于 2021-11-23 04:33:58

WordNet实际上并不做文章。:(从他们的main page

名词、动词、形容词和副词被分组为一组认知同义词(同义词)

这很令人沮丧,但无论如何,没有任何"the“或"a”的同义词,对吧?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69874756

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档