I have a problem and I can not solve it, it's the following I have a list of type list:
['Words', 4], ['evidenced', 3], ['presented', 2], [1], [1], ['performed'], [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 amount of repetitions now I need to rank, ie say that ['palavras',4]
is the term that most repeats or is it is the 1st and
['tratados', 1]
, ['realizada', 1]
would in this case be the 4th place (both in the same position because it has the same amount of repetitions) for example, I wanted if possible had a return of type
['palavra','repetição','lugar do rankig']
, I'm trying for hours but I can not figure out how to do it.
Excerpt of the code where it is generated:
for key,value in reversed(sorted(self.frequency.items(),key=itemgetter(1))):
self.palavras.append([key,value])