Example usage

To use mypkg-edne in a project:

import mypkg_edne

print(mypkg_edne.__version__)
0.3.2

Imports

from mypkg_edne.mypkg_edne import count_words
from mypkg_edne.plotting import plot_words

Create a text file

quote = """Insanity is doing the same thing over and over and
expecting different results."""
with open("einstein.txt", "w") as file:
    file.write(quote)

Count words

counts = count_words("einstein.txt")
print(counts)
Counter({'over': 2, 'and': 2, 'insanity': 1, 'is': 1, 'doing': 1, 'the': 1, 'same': 1, 'thing': 1, 'expecting': 1, 'different': 1, 'results': 1})

Plot words

fig = plot_words(counts, n=5)
_images/example_9_0.png