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
create a python function, rank_words(corpus, n, index)which takes parameters corpus (type list), n (type int), and index
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
create a python function, rank_words(corpus, n, index)which takes parameters corpus (type list), n (type int), and index
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!