Example usage

To use word_text_counter in a project:

import word_text_counter

print(word_text_counter.__version__)
0.3.0

Create a text file

First create a sample text file

quote = """'Whoever fears Allah (God), 
Allah (God) will find a way out for him (from every difficulty) 
and He will provide for him from sources that he could never have imagined.' 
Quran surah At-Talaq  verses 2 - 3
"""

with open("quote.txt",'w') as file:
    file.write(quote)

Count Words

We count the words from the text file using count_words function.

from word_text_counter import count_words
counts = count_words("quote.txt")
print(counts)
{'total': 36, 'details': {'whoever': 1, 'fears': 1, 'allah': 2, 'god': 2, 'will': 2, 'find': 1, 'a': 1, 'way': 1, 'out': 1, 'for': 2, 'him': 2, 'from': 2, 'every': 1, 'difficulty': 1, 'and': 1, 'he': 2, 'provide': 1, 'sources': 1, 'that': 1, 'could': 1, 'never': 1, 'have': 1, 'imagined': 1, 'quran': 1, 'surah': 1, 'attalaq': 1, 'verses': 1, '2': 1, '3': 1}}