0

how to remove these numbers from output of LDA while using Gensim package?

2015-08-25 15:26:20,439 : INFO : topic #8 (0.100): 0.038*watch + 0.020*water + 0.014*strap + 0.011*analog + 0.011*resistance + 0.010*atm + 0.010*coloured + 0.010*timepiece + 0.010*5 + 0.009*classy

so that output will be watch,water,strap...etc

Thomas N T
  • 459
  • 1
  • 3
  • 14

1 Answers1

0

you can use show_topic which returns a list of tuples (prob, word) and then print the words using for example :

topic_tuple = lda.show_topic(0, 10)

print ','.join([str(word_tuple[1]) for word_tuple in topic_tuple])

Based on gensim source code

Bernard
  • 301
  • 2
  • 6