Skip to main content

Python package

Python package

Text Processing Functions

This project includes several text processing functions in tokenize_text.py:

  • clean_text(input_text): Converts text to lowercase and removes punctuation.
  • tokenize(input_text): Splits text into individual words.
  • count_words(input_text): Counts the occurrences of each word in the text.
  • count_lines(filename): Counts the number of lines in a file.
  • count_total_lines(filenames): Counts the total number of lines across multiple files.
  • count_total_words(filenames): Counts the total number of words across multiple files.
  • count_raven_occurrences(filename): Counts occurrences of the word 'raven' (case insensitive) in a file.

Example Usage

Here's a simple example of how to use the clean_text and count_words functions:

from tokenize_text import clean_text, count_words

text = "The Raven, by Edgar Allan Poe"
cleaned_text = clean_text(text)
word_counts = count_words(text)

print(f"Cleaned text: {cleaned_text}")
print(f"Word counts: {word_counts}")

# Output:
# Cleaned text: the raven by edgar allan poe
# Word counts: {'the': 1, 'raven': 1, 'by': 1, 'edgar': 1, 'allan': 1, 'poe': 1}


### Using `make all`

To automate the setup, text download, statistics generation, and testing processes, you can use the `make all` command. This command will:

1. Set up the Python virtual environment and install the required dependencies.
2. Download the specified text files from Project Gutenberg.
3. Generate statistics about the downloaded texts, including line and word counts for "The Raven" and total counts across all downloaded texts.
4. Run the test suite to ensure all functionalities are working correctly.

To use `make all`, simply run the following command in your terminal:

```bash
make all

Release files for qje5vf 0.0.1

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

Source distribution (sdist)

Source distribution for qje5vf 0.0.1
File Size Uploaded
qje5vf-0.0.1.tar.gz 13.3 kB Details

Built distribution (wheel)

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

Total release size: 21.2 kB

Release files / qje5vf-0.0.1.tar.gz

Download URL qje5vf-0.0.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bac8c3a417f172222d987fad7150853eb71a78e6dfb7a45e5c40642b8b2c96e5
BLAKE2b-256 checksum
How to use checksums
cb323c8bcbea8394a6be5ce4e3d96494b0545554ff1810d2e80142d4502667c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release files / qje5vf-0.0.1-py3-none-any.whl

Download URL qje5vf-0.0.1-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d39d7cdfef0602ed6f3a5527e8fd858b44ae00394459a7d5cb985b2628b9c026
BLAKE2b-256 checksum
How to use checksums
7be571d788f582adaaf17b476b90b2be12ffae422b51d3c99328bfd5b3edab87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

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