Skip to content

Instantly share code, notes, and snippets.

@CyrilRJK
Created June 7, 2022 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CyrilRJK/d6d500cd00906d5ae60c4a1810f759ee to your computer and use it in GitHub Desktop.
Save CyrilRJK/d6d500cd00906d5ae60c4a1810f759ee to your computer and use it in GitHub Desktop.
def get_coherence(topics, documents):
id2word = corpora.Dictionary(documents)
cm = CoherenceModel(topics=topics,
texts=documents,
dictionary=id2word,
coherence='c_v')
return cm.get_coherence()
get_coherence(topics, tokenized_docs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment