0

When adding new documents to top2vec topic model, I am getting the following error:

# Here is the building model:
# df["text"] is text column of dataframe df
from top2vec import Top2Vec
model = Top2Vec(documents=df["text"]) # document_ids not provided here

# adding new document
# df_new is the new dataframe with text column
# df_new.index is the index column that I want to use as IDs
model.add_documents(df_new["text"], doc_id=df_new.index) # want to add new documents with IDs

This will create an error saying document IDs have not been provided in the training phase, which is true. My question here how I can solve the problem and add new documents with document IDs to the exiting trained top2vec model where document IDs have not provided there. In fact when you type model.document_ids it returns 0, 1, ... when IDs not provided in the trained model.

Any solution/way to tackle the problem much appreciated!

Sam S.
  • 627
  • 1
  • 7
  • 23

0 Answers0