Throws zero division error
shyambhu-mukherjee opened this issue · 3 comments
shyambhu-mukherjee commented
pke/pke/unsupervised/graph_based/topicrank.py
Line 189 in 5af1f81
This line throws zerodivision error when we try to use
ngram_selection=5
.ygorg commented
shyambhu-mukherjee commented
Example code:
extractor = pke.unsupervised.TopicRank()
extractor.load_document(input = total_text,
language = 'en')
#extractor.candidate_selection()
extractor.ngram_selection(n=3)
#this default weight was 0.74 in original algorithm
extractor.candidate_weighting(threshold = 0.2)
keyphrases_response = extractor.get_n_best(n = 30,
redundancy_removal = True)
When we remove the candidate weighting line, i.e. let it choose default 0.74 value, then it starts generating empty phrase list. Hope this helps.
ygorg commented
Please try to see whether any candidates were selected using len(extractor.candidates)
before extractor.candidate_weighting
.
Does the code you provided throws ZerodivisionError ? I can't reproduce the behaviour as I don't know what total_text
contains.
About Minimal Reproducible Examples