2
I’m having a problem and I’m having trouble solving it, the following is I have a list of the kind :
['Words', 4], ['evidenced', 3], ['presented', 2], ['showed', 2], ['second', 1], ['treaties', 1], ['realized', 1]
Where the first term is the word and the second the repetition of it in any text, the algorithm already returns me in descending order the number of repetitions now I need to rank, ie say that for example ['palavras',4]
is the most repeated term, 1\176; and
['tratados', 1]
, ['realizada', 1]
would be in this case the 4° placed (both in the same position because it has the same amount of repetitions) for example, I wanted if possible to have a return of type
['palavra','repetição','lugar do rankig']
, I’m hours trying but I can’t imagine how to do.
Excerpt from the code where it is generated:
for key,value in reversed(sorted(self.frequency.items(),key=itemgetter(1))):
self.palavras.append([key,value])
Thank you very much, it worked here, hug!
– Roger Amaro