0
What is the best solution for the following word frequency counter?
The counter should get text from an URL and print top 100 of the most frequently used words in this text without conjunctions and prepositions. • CODE: from collections import Counter words = [] for _ in range(int(input())): words.extend(input().split()) counter = Counter(words) pairs = [(-pair[1], pair[0]) for pair in counter.most_common()] words = [pair[1] for pair in sorted(pairs)] print('\n'.join(words)) But I still have no clue, what is the best and elegance solution for requesting an URL and clear it from all the headers, and metadata, etc. except the text itself. Thank you.
3 ответов
+ 3
I would try Pandas, it should allow you to read the contents of the URL and use the DataFrame features
+ 2
Dmitry Tsygankov please show us your code as the community is not here to do your work or give you the answer...
https://www.sololearn.com/Blog/38/8-simple-rules-to-get-help-from-the-community
Thanks and happy coding.
+ 1
BroFar 1st of all, thank you for the answer. Maybe the word "solution" was not the best for te question. I was asking for hints and some of best practices.
As for my code, I've just code only the counter itself:
<appended to question>