-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Closed
Description
Problem description
Trying to use export_phrases function on a phrases model.
Instead getting Runtime error
Steps/code/corpus to reproduce
from gensim.models.phrases import Phrases, ENGLISH_CONNECTOR_WORDS
documents = ["I am interested in machine learning projects",
"machine learning projects can be useful sometimes",
"I love working on machine learning projects",
"interested does not mean the same thing as likes",
"i am interested in blockchain"]
sentence_stream = [doc.split(" ") for doc in documents]
bigrams = Phrases(sentence_stream, min_count=2, threshold=1, connector_words=ENGLISH_CONNECTOR_WORDS)
trigrams = Phrases(bigrams[sentence_stream], min_count=2, threshold=1)
trigrams.export_phrases()RuntimeError Traceback (most recent call last)
<ipython-input-190-0f7e41471301> in <module>
----> 1 trigrams.export_phrases()
~\Anaconda3\lib\site-packages\gensim\models\phrases.py in export_phrases(self)
716 """
717 result, source_vocab = {}, self.vocab
--> 718 for token in source_vocab:
719 unigrams = token.split(self.delimiter)
720 if len(unigrams) < 2:
RuntimeError: dictionary changed size during iteration
Versions
Please provide the output of:
Windows-10-10.0.17763-SP0
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Bits 64
NumPy 1.19.5
SciPy 1.5.2
gensim 4.0.0beta
FAST_VERSION 0Metadata
Metadata
Assignees
Labels
bugIssue described a bugIssue described a bug