Page 1 of 1

create a python function, rank_words(corpus, n, index)which takes parameters corpus (type list), n (type int), and index

Posted: Wed Apr 27, 2022 3:48 pm
by answerhappygod
create a python function, rank_words(corpus, n, index)which
takes parameters corpus (type
list), n (type int), and index (type int)
& returns list containing tuples of words and
their frequencies in top n of words. Corpus is a
list of sentences. n is the no of ranks to return. Can
assume n would be selected such that exactly n ranked words
will be matched. Must not use break or import any other functions
eg. import operator can NOT be used. Thank you for helping
!!!!
eg. corpus = ['hi hi hi hi', 'hello hello say bye', 'bye
bye']
n = 3
index = 1
returns;
while index = 0 returns