Error in TopicalPageRank: 'numpy.ndarray' object has no attribute 'index'
artdream-dubai opened this issue · 3 comments
Good afternoon. I occurred with an error when working with TopicalPageRank in the step of candidates extraction. Here:
elif model.name in ["TopicalPageRank"]:
extractor.candidate_weighting(lda_model=lda_model)
I worked with this algorithm in December and it worked ok. But now it gives an error:
AttributeError Traceback (most recent call last)
in
102 extractor.candidate_weighting(df=df)
103 elif model.name in ["TopicalPageRank"]:
--> 104 extractor.candidate_weighting(lda_model=lda_model)
105 else:
106 extractor.candidate_weighting()
/usr/local/lib/python3.8/dist-packages/pke/unsupervised/graph_based/single_tpr.py in candidate_weighting(self, window, pos, lda_model, normalized)
168 for word in self.graph.nodes():
169 if word in dictionary:
--> 170 index = dictionary.index(word)
171 distribution_word_topic = [distributions[k][index] for k
172 in range(K)]
AttributeError: 'numpy.ndarray' object has no attribute 'index'
Hi, thanks for your issue. In your code what is lda_model
? How do you obtain it ?
Could you please share your code ?
I use code from here
https://github.com/boudinfl/pke/blob/master/examples/benchmarking-models.ipynb
- I add it into Colab and start