Skip to main content

“What specific words would you like to read?” Counting words in “Pan Tadeusz” poem

It is a Python-based command-line tool designed to efficiently find and count occurrences of specific words within text files. It offers flexible input options, supporting both individual words, patterns and word lists in various formats.

Python version

tested with Python >= 3.10.6

Why

It was started as a project to exercise python language. The code helped to find specific words in a selected file. It became command line tool that help find any word within any file. The files can be selected by command line

Install

you can run the following command in your terminal to install the program from pip:

pip install PTWordFinder

This will download and install the program, along with any required dependencies.

If you prefer, you can also install the program from source:

Clone the repository containing the program code:

git clone https://github.com/DarekRepos/PanTadeuszWordFinder.git

Replace your-username with your actual username on GitHub. Navigate to the cloned directory:

cd  PanTadeuszWordFinder

This method requires poetry or Python build tools. If you don’t have them, install poetry using pip install poetry or install your system’s package manager’s equivalent for build. Install the program using poetry (https://python-poetry.org/):

poetry install

The second method involves directly building the wheel and installing it, which is less commonly used. Install the program directly:

python -m build
python -m pip install dist/PTWordFinder-*.whl

Note:

If you install from source, you will need to have Python development tools installed. You can usually install these using your system’s package manager. Installing from pip is the easiest and most recommended method for most users.

Usage:

python word_counter.py [OPTIONS]
Options:
 -w, --words-input-file FILE          File containing words to search for (mutually exclusive with --single-word)
 -s, --searched-file FILE              Path to the text file to search in (required)
 -w, --single-word WORD                Specific word to count (mutually exclusive with --words-input-file)
 -p, --pattern PATTERN                 Regular expression pattern to match
 -h, --help                            Show this help message and exit

Examples:

Count the word “python” in my_text.txt:

python word_counter.py --single-word python --searched-file my_text.txt

Find the frequency of all words in word_list.txt in large_file.txt:

python word_counter.py --words-input-file word_list.txt --searched-file large_file.txt

Match instances of the regular expression [a-z0-9]{5} in passwords.txt:

python word_counter.py --pattern "[a-z0-9]{5}" --searched-file passwords.txt

Metadata

Release files for PTWordFinder 1.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PTWordFinder 1.2.9
File Size Uploaded Provenance Actions
ptwordfinder-1.2.9.tar.gz 7.9 kB Without provenance Details for ptwordfinder-1.2.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PTWordFinder 1.2.9
File Interpreter ABI Platform Actions
PTWordFinder-1.2.9-py3-none-any.whl Python 3 none any Details for PTWordFinder-1.2.9-py3-none-any.whl

Total release size: 15.5 kB

Release files / ptwordfinder-1.2.9.tar.gz

Download URL ptwordfinder-1.2.9.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f5006317fc1640154f6602b39da8b855cae42b84da5c2447067fe3345606a051
BLAKE2b-256 checksum
How to use checksums
e611be688f9076209dad62d8170d55f6cc295981190280dca1c6a4f94d44cd5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Release files / PTWordFinder-1.2.9-py3-none-any.whl

Download URL PTWordFinder-1.2.9-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0fe064e599104a2fadb8e67c2c480d5610a7e7f137a9e95f1c44b6fa965680e1
BLAKE2b-256 checksum
How to use checksums
946b526e384becfd3d87953af61f75953c33ba2258b40c76ee5654307e5fe9f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.19

Security for PTWordFinder 1.2.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page