class_docstr: Objects of this class allow for building and maintaining a model for topic coherence.
  
  Examples
  ---------
  One way of using this feature is through providing a trained topic model. A dictionary has to be explicitly provided
  if the model does not contain a dictionary already
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus, common_dictionary
      >>> from gensim.models.ldamodel import LdaModel
      >>> from gensim.models.coherencemodel import CoherenceModel
      >>>
      >>> model = LdaModel(common_corpus, 5, common_dictionary)
      >>>
      >>> cm = CoherenceModel(model=model, corpus=common_corpus, coherence='u_mass')
      >>> coherence = cm.get_coherence()  # get coherence value
  
  Another way of using this feature is through providing tokenized topics such as:
  
  .. sourcecode:: pycon
  
      >>> from gensim.test.utils import common_corpus, common_dictionary
      >>> from gensim.models.coherencemodel import CoherenceModel
      >>> topics = [
      ...     ['human', 'computer', 'system', 'interface'],
      ...     ['graph', 'minors', 'trees', 'eps']
      ... ]
      >>>
      >>> cm = CoherenceModel(topics=topics, corpus=common_corpus, dictionary=common_dictionary, coherence='u_mass')
      >>> coherence = cm.get_coherence()  # get coherence value
class_docstr_tok: ["Objects","of","this","class","allow","for","building","and","maintaining","a","model","for","topic","coherence",".","Examples","--","--","--","--","-","One","way","of","using","this","feature","is","through","providing","a","trained","topic","model",".","A","dictionary","has","to","be","explicitly","provided","if","the","model","does","not","contain","a","dictionary","already","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",",","common_dictionary",">",">",">","from","gensim.models.ldamodel","import","LdaModel",">",">",">","from","gensim.models.coherencemodel","import","CoherenceModel",">",">",">",">",">",">","model","=","LdaModel","(","common_corpus",",","5",",","common_dictionary",")",">",">",">",">",">",">","cm","=","CoherenceModel","(","model=model",",","corpus=common_corpus",",","coherence='u_mass","'",")",">",">",">","coherence","=","cm.get_coherence","(",")","#","get","coherence","value","Another","way","of","using","this","feature","is","through","providing","tokenized","topics","such","as",":","..","sourcecode",":",":","pycon",">",">",">","from","gensim.test.utils","import","common_corpus",",","common_dictionary",">",">",">","from","gensim.models.coherencemodel","import","CoherenceModel",">",">",">","topics","=","[","...","[","'human","'",",","'computer","'",",","'system","'",",","'interface","'","]",",","...","[","'graph","'",",","'minors","'",",","'trees","'",",","'eps","'","]","...","]",">",">",">",">",">",">","cm","=","CoherenceModel","(","topics=topics",",","corpus=common_corpus",",","dictionary=common_dictionary",",","coherence='u_mass","'",")",">",">",">","coherence","=","cm.get_coherence","(",")","#","get","coherence","value"]
docstr: Set topics `self._topics`.
  
  Parameters
  ----------
  topics : list of list of str
      Topics.
docstr_tok: ["Set","topics","`","self._topics","`",".","Parameters","--","--","--","--","--","topics",":","list","of","list","of","str","Topics","."]
code: def topics(self, topics):
      """Set topics `self._topics`.
  
      Parameters
      ----------
      topics : list of list of str
          Topics.
  
      """
      if topics is not None:
          new_topics = []
          for topic in topics:
              topic_token_ids = self._ensure_elements_are_ids(topic)
              new_topics.append(topic_token_ids)
  
          if self.model is not None:
              logger.warning(
                  "The currently set model '%s' may be inconsistent with the newly set topics",
                  self.model,
              )
      elif self.model is not None:
          new_topics = self._get_topics()
          logger.debug(
              "Setting topics to those of the model: %s", self.model
          )
      else:
          new_topics = None
  
      self._update_accumulator(new_topics)
      self._topics = new_topics
  
imports: import logging
  import multiprocessing
  from collections import namedtuple
  import numpy
  from gensim import interfaces, matutils
  from gensim import utils
  from gensim.topic_coherence import segmentation, probability_estimation, direct_confirmation_measure, indirect_confirmation_measure, aggregation
  from gensim.topic_coherence.probability_estimation import unique_ids_from_segments
label_desc: Use image node_id 12 for calling the CoherenceModel obj's underlying member method code with example usage: obj.topics(topics) without return types