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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
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

Post 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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply