lang_frequency.py
contains two functions:
load_data(filepath)
– takes path to text file and returns its content
get_most_frequent_words(text)
– takes string and returns list with ten most frequent words
How to use:
python3 lang_frequency.py <path to file>
Result (10 most frequent words):
Ten most frequent words: ['this', 'list', 'contains', 'ten', 'most', 'frequent', 'words', 'in', 'descending', 'order']
The code is written for educational purposes. Training course for web-developers - DEVMAN.org