Word-Frequency---Python
Counting the unique words coming from a file
From this:
To this:
Regular Expressions:
Collecting all the words from 3 to 15 characters in length
match_pattern = re.findall(r'\b[a-z]{3,15}\b', final_text)
Collecting the Words:
plotting the Words:
# Plot histogram using matplotlib bar()
plt.xlabel('Top 10 Words')
plt.ylabel('Frequency')
plt.title('Plotting Word Frequency')
indexes = np.arange(len(words_names) )
width = .4
plt.bar(indexes, words_count, width)
plt.xticks(indexes + width * .4, words_names)
#plt.legend()
plt.tight_layout()
plt.show()