ddangelov / Top2Vec

Top2Vec learns jointly embedded topic, document and word vectors.
BSD 3-Clause "New" or "Revised" License
2.95k stars 374 forks source link

error 'dict' object is not callable when deleting document #316

Closed ardiantovn closed 1 year ago

ardiantovn commented 1 year ago

I ran this code

model_tag.delete_documents([1])

and get this error

TypeError                                 Traceback (most recent call last)
Cell In [337], line 1
----> 1 model_tag.delete_documents([1])

File /opt/homebrew/lib/python3.10/site-packages/top2vec/Top2Vec.py:1599, in Top2Vec.delete_documents(self, doc_ids)
   1596 # update index
   1597 if self.documents_indexed:
   1598     # delete doc_ids from index
-> 1599     index_ids = [self.doc_id2index_id(doc_id) for doc_id in doc_ids]
   1600     for index_id in index_ids:
   1601         self.document_index.mark_deleted(index_id)

File /opt/homebrew/lib/python3.10/site-packages/top2vec/Top2Vec.py:1599, in <listcomp>(.0)
   1596 # update index
   1597 if self.documents_indexed:
   1598     # delete doc_ids from index
-> 1599     index_ids = [self.doc_id2index_id(doc_id) for doc_id in doc_ids]
   1600     for index_id in index_ids:
   1601         self.document_index.mark_deleted(index_id)

TypeError: 'dict' object is not callable
ddangelov commented 1 year ago

Fixed in version 1.0.29.