doc2bow ожидает массив токенов Unicode на входе, а не одну строку
Тематическое моделирование
как этот корпоративный словарь является Tokenize, так как я использую Dataframe в качестве набора данных.
from gensim import corpora, models
from gensim.models import CoherenceModel
# create a dictionary
dictionary = corpora.Dictionary([listed_reviews])
# create a corpus
corpus = [dictionary.doc2bow(text) for text in reviews['ReviewBody']]
# create a LDA model
lda_model = models.ldamodel.LdaModel(corpus=corpus,
id2word=dictionary,
num_topics=10,
random_state=100,
update_every=1,
chunksize=100,
passes=10,
alpha='auto',
per_word_topics=True)
# display the topics
lda_model.print_topics(num_topics=10, num_words=10)
# create a coherence model
coherence_model_lda = CoherenceModel(model=lda_model, texts=reviews['ReviewBody'], dictionary=dictionary, coherence='c_v')
# compute coherence score
coherence_lda = coherence_model_lda.get_coherence()
print('\nCoherence Score: ', coherence_lda)
Привет, ребята, я хочу создать тематическое моделирование, но эта ошибка. я немного знаю, но не знаю, как исправить.