Skip to content

A Python word counter module to quickly count number of words in a sentence

License

Notifications You must be signed in to change notification settings

OmkarPathak/Word-Counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word-Counter

A Python Word Counter module

Downloads

Installation

pip install wordcounter

Usage

  • Import the module after installation
import wordcounter
  • Create a object with sentence and delimiter as arguments to WordCounter class. Default value for delimiter is ' ' (a single space)
word_counter = WordCounter('The, quick, brown, fox, jumps, over, the, lazy, dog', delimiter=', ')
  • Get word count
word_counter.get_word_count()
  • Get count of specific words
word_counter.count('the')       # a case insensitive count

# if you want to have a case sensitive search just set ignore_case=False
word_counter.count('the', ignore_case=False)       # a case sensitive count
  • Get word frequencies
word_counter.get_word_frequencies()

About

A Python word counter module to quickly count number of words in a sentence

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages