我正在尝试调用函数tfidf对一个列表total\u all。我在运行下面的行时收到一条错误消息:TypeError:'int'object is not iterable
tfidf(total_all)
def tfidf(documents):
global dftfidf
dftfidf = pd.DataFrame()
tokenized_documents = [tokenize(d) for d in documents]
idf = inverse_document_frequencies(tokenized_documents)
for term in idf.keys():
tf = sublinear_term_frequency(term, document)
doc_tfidf.append(tf * idf[term])
tfidf_documents.append(doc_tfidf)
dftfidf=pd.DataFrame(data ={'term frequency':tf,'tfidf':doc_tfidf})
return dftfidf
tfidf(total_all)
目前没有回答
相关问题 更多 >
编程相关推荐