Python 如何在TextBlob中指定我自己的功能提取器?

Python 如何在TextBlob中指定我自己的功能提取器?,python,nlp,nltk,textblob,Python,Nlp,Nltk,Textblob,我遵循了本教程: 我写了一个提取器: def phrases_extractor(document): r.extract_keywords_from_text(document) words = r.get_ranked_phrases() feats = {} for w in words: feats["contains({0})".format(w)] = True return feats 但我不知道为什么文档会说应该有“con

我遵循了本教程: 我写了一个提取器:

def phrases_extractor(document):
    r.extract_keywords_from_text(document)
    words = r.get_ranked_phrases()
    feats = {}
    for w in words:
        feats["contains({0})".format(w)] = True
    return feats
但我不知道为什么文档会说应该有“contains…=False”
我该怎么做?我是否应该首先收集所有可能的单词,并将它们添加到字典中,使其具有假值?

我一直在复习同样的内容。我敢肯定这是个打字错误。这必须是真的,因为字典表明最后一个单词是uuuuuuuuuuuuu。False意味着最后一个词不是,示例不是这样设置的