Skip to main content

This is my text processor that will process text using 10 NLP processing tehcniques for the ML SPECIALIZATION

Project description

TextPreprocessor

Overview

The TextPreprocessor is a Python class designed for comprehensive text preprocessing. It facilitates tasks like removing links, hashtags, special characters, emojis, numbers, and stopwords. Additionally, it provides functionality for converting text to lowercase.

Installation

Ensure you have NLTK installed. You can install NLTK via pip:

pip install nltk

Usage

### Import the TextPreprocessor class
from text_preprocessor import TextPreprocessor
# Initialize the preprocessor with default settings
preprocessor = TextPreprocessor()

# Customize the preprocessor by setting flags
preprocessor = TextPreprocessor(
    remove_links=True,
    remove_hashtags=True,
    remove_characters=True,
    convert_to_lowercase=True,
    remove_emojis=True,
    remove_numbers=True,
    remove_stopwords_flag=True
)



text = "Your text goes here..."


processed_text = preprocessor.preprocess_text(text)

Available Methods

  1. preprocess_text(text): Preprocesses the input text based on the initialized flags.
  2. Other methods in the class can be used individually for specific preprocessing steps (e.g., remove_links, remove_stopwords, etc.).

Examples

text = "Hello! This is an example text with #hashtags and links: https://example.com"



# Initialize preprocessor
preprocessor = TextPreprocessor(remove_links=True, remove_hashtags=True)

# Preprocess text
processed_text = preprocessor.preprocess_text(text)
print(processed_text)
Output: "Hello This is an example text with and links"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tweetprocessor_1-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tweetprocessor_1-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file tweetprocessor_1-1.0.0.tar.gz.

File metadata

  • Download URL: tweetprocessor_1-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for tweetprocessor_1-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1eb9725d89f9663e2cf114c9bc8eaeb2077ae5cf8cf502cb9750501dc366f9b4
MD5 705166734aea75951ecd9237856d49fd
BLAKE2b-256 71387153b3fbd89508d7e229b6a56b89f4acc62a0eb0e89fd18ce3ab79dc770e

See more details on using hashes here.

File details

Details for the file tweetprocessor_1-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tweetprocessor_1-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a34bf903276a8eab7d4acd227402aac18d536ed5f63487be8f599d0c32868b49
MD5 aac75898bd9201e90b4efd2796b8f881
BLAKE2b-256 c36981e0e42ec9df28379d1d5e1e1425303a6835ea3f001ffa3e21a21664290e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page