This error message indicates that you are trying to create a new object using the wrong type of input. The constructor now requires a list of Node objects, but you are passing in a list of Document objects.
To fix this issue, you should use the from_documents
method instead of the constructor. This method is used to create an object from a list of Document objects.
Here’s an example:
from gensim import corpora
documents = ["This is the first document", "This is the second document", "And this is the third one"]
# Create a list of Document objects
doc_list = [corpora.Document(doc) for doc in documents]
# Use from_documents method to create a new object
my_corpus = corpora.Dictionary.from_documents(doc_list)
In this example, we create a list of Document objects called doc_list
, and then use the from_documents
method to create a new object called my_corpus
.