title: get_coherence() function error in python while using LDA
body: <p>I have a problem with using coherence model</p>
  <p>my code is</p>
  <pre><code>def compute_coherence_values(dictionary, corpus, texts, limit, start, step):
      coherence_values = []
      model_list = []
      for num_topics in range(start, limit, step):
          model = gensim.models.ldamodel.LdaModel(corpus=corpus, id2word=id2word, num_topics=num_topics)
          model_list.append(model)
  
          coherencemodel = CoherenceModel(model=model, texts=texts, dictionary=dictionary, coherence=&quot;c_v&quot;)
          coherence_values.append(coherencemodel.get_coherence())
  
      return model_list, coherence_values
  
  coherence_values = []
  model_list = []
  
  # topic number
  nt = pre_nt
  
  start_ = nt;
  limit_ = nt + 1;
  step_ = 1;
  
  model_list1, coherence_values1 = compute_coherence_values(dictionary=id2word, corpus=corpus, texts=texts_wi_new,
                                                          start=start_, limit=limit_, step=step_)
  </code></pre>
  <p>and the error is</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;string&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\spawn.py&quot;, line 105, in spawn_main
  Traceback (most recent call last):
    File &quot;&lt;input&gt;&quot;, line 3, in &lt;module&gt;
    File &quot;&lt;input&gt;&quot;, line 92, in compute_coherence_values
    File &quot;D:\All Python\venv\lib\site-packages\gensim\models\coherencemodel.py&quot;, line 609, in get_coherence
      confirmed_measures = self.get_coherence_per_topic()
    File &quot;D:\All Python\venv\lib\site-packages\gensim\models\coherencemodel.py&quot;, line 569, in get_coherence_per_topic
      self.estimate_probabilities(segmented_topics)
    File &quot;D:\All Python\venv\lib\site-packages\gensim\models\coherencemodel.py&quot;, line 541, in estimate_probabilities
      self._accumulator = self.measure.prob(**kwargs)
    File &quot;D:\All Python\venv\lib\site-packages\gensim\topic_coherence\probability_estimation.py&quot;, line 156, in p_boolean_sliding_window
      return accumulator.accumulate(texts, window_size)
    File &quot;D:\All Python\venv\lib\site-packages\gensim\topic_coherence\text_analysis.py&quot;, line 444, in accumulate
      workers, input_q, output_q = self.start_workers(window_size)
    File &quot;D:\All Python\venv\lib\site-packages\gensim\topic_coherence\text_analysis.py&quot;, line 478, in start_workers
      worker.start()
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\process.py&quot;, line 112, in start
      self._popen = self._Popen(self)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\context.py&quot;, line 223, in _Popen
      return _default_context.get_context().Process._Popen(process_obj)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\context.py&quot;, line 322, in _Popen
      return Popen(process_obj)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\popen_spawn_win32.py&quot;, line 89, in __init__
      reduction.dump(process_obj, to_child)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\reduction.py&quot;, line 60, in dump
      ForkingPickler(file, protocol).dump(obj)
  BrokenPipeError: [Errno 32] Broken pipe
      exitcode = _main(fd)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\spawn.py&quot;, line 114, in _main
      prepare(preparation_data)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\spawn.py&quot;, line 225, in prepare
      _fixup_main_from_path(data['init_main_from_path'])
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\multiprocessing\spawn.py&quot;, line 277, in _fixup_main_from_path
      run_name=&quot;__mp_main__&quot;)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\runpy.py&quot;, line 261, in run_path
      code, fname = _get_code_from_file(run_name, path_name)
    File &quot;C:\Users\lee96\AppData\Local\Programs\Python\Python37\Lib\runpy.py&quot;, line 231, in _get_code_from_file
      with open(fname, &quot;rb&quot;) as f:
  OSError: [Errno 22] Invalid argument: 'D:\\All Python\\&lt;input&gt;'
  </code></pre>
  <p>The error occurs in this part</p>
  <pre><code>coherencemodel.get_coherence()
  </code></pre>
  <p>I use pycharm.
  How can I solve it?</p>
  <p>sorry
  It looks like your post is mostly code; please add some more details.
  It looks like your post is mostly code; please add some more details.
  It looks like your post is mostly code; please add some more details.</p>