def checkCoherenceMeasure(topics1, topics2, coherence):
 if (coherence in boolean_document_based):
  cm1 = CoherenceModel(topics=topics1, corpus=corpus, dictionary=dictionary, coherence=coherence)
  cm2 = CoherenceModel(topics=topics2, corpus=corpus, dictionary=dictionary, coherence=coherence)
 else:
  cm1 = CoherenceModel(topics=topics1, texts=texts, dictionary=dictionary, coherence=coherence)
  cm2 = CoherenceModel(topics=topics2, texts=texts, dictionary=dictionary, coherence=coherence)
 return (cm1.get_coherence() > cm2.get_coherence())

def checkCoherenceMeasure ( topics1 , topics2 , coherence ) : if ( coherence in boolean_document_based ) : cm1 = CoherenceModel ( topics = topics1 , corpus = corpus , dictionary = dictionary , coherence = coherence ) cm2 = CoherenceModel ( topics = topics2 , corpus = corpus , dictionary = dictionary , coherence = coherence ) else : cm1 = CoherenceModel ( topics = topics1 , texts = texts , dictionary = dictionary , coherence = coherence ) cm2 = CoherenceModel ( topics = topics2 , texts = texts , dictionary = dictionary , coherence = coherence ) return ( cm1 . get_coherence ( ) > cm2 . get_coherence ( ) )
check provided topic coherence algorithm on given topics .