【发布时间】:2018-07-18 04:24:45
【问题描述】:
我有一个标记化句子的列表,并且想安装一个 tfidf Vectorizer。我尝试了以下方法:
tokenized_list_of_sentences = [['this', 'is', 'one'], ['this', 'is', 'another']]
def identity_tokenizer(text):
return text
tfidf = TfidfVectorizer(tokenizer=identity_tokenizer, stop_words='english')
tfidf.fit_transform(tokenized_list_of_sentences)
错误输出为
AttributeError: 'list' object has no attribute 'lower'
有没有办法做到这一点?我有十亿个句子,不想再次标记它们。在此之前的另一个阶段,它们被标记化。
【问题讨论】:
-
为了能够提供帮助,请添加完整的错误消息并添加重现错误所需的最少代码。
标签: scikit-learn tfidfvectorizer