Skip to content

Mantej-Singh/Word-Frequency---Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Word-Frequency---Python

Counting the unique words coming from a file

From this:

screenshot_1490298494.png

To this:

screenshot_1490298350.png

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:

screenshot_1490298684.png

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()

About

Counting the unique words coming from a file

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published