【问题标题】:NLTK.corpus and wordnetNLTK.corpus 和 wordnet
【发布时间】:2020-09-19 22:35:11
【问题描述】:

我遇到了一个关于 nltk.corpus 和 wordnet 的小问题。它似乎找不到“是”的同义词,即使 thesaurus.com 说有,我如何才能提取我的“是”系统词以正确评估底部部分的输入。

import textblob as txtnlp
from nltk.corpus import wordnet
def text_extraction():
    yes_ls = []
    for synset in wordnet.synsets("yes"):
        for lemma in synset.lemmas():
            yes_ls.append(lemma.name())
    init_conversation = str(input('Hello there my name is Therpibot 2.0, your name is? '))
    blob_1 = txtnlp.TextBlob(init_conversation)
    fragments_name = blob_1.words
    print(f'Hello there {fragments_name[0]}!', end=' ')
    print('My purpose is to make your day better through some cognitive behavioral therapy.')
    init_response = str(input('Would like to engage in a talk session? '))
    if init_response.lower() in yes_ls:
        therapy()
    #ex_1 = list(i.tags for i in fragments)
    #print(ex_1)
def therapy():
    print('Hi')

if __name__ in "__main__":
    text_extraction()

【问题讨论】:

    标签: python nltk wordnet


    【解决方案1】:

    我之前尝试过这样做,但 wordnet 不是我最好的选择,但你可以看看这里: Wordnet Find Synonyms

    我为你推荐http://www.conceptnet.io/,它对你的任务来说更好更容易,它是一个开放的数据集,你可以免费访问它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多