word_text_counter
Subpackages
Submodules
Package Contents
Functions
|
Counting words from a text. |
|
get sample text file path, with name "flatland.txt". |
|
get sample text file path, with name "time_machine.txt". |
|
get sample text file path, with name "lostworld.txt". |
- word_text_counter.count_words(filename: str) dict[source]
Counting words from a text.
Words are made lowercase and punctuation is removed before counting.
- Parameters
filename (str) – a file path.
- Returns
total words and count details for each word.
- Return type
dict
Examples
>>> from word_text_counter import count_words >>> count_words("data/text.txt")
- word_text_counter.get_flatland_path() str[source]
get sample text file path, with name “flatland.txt”.
- Returns
a flatland.txt path.
- Return type
str