Skip to main content

This is my text processor that will process text using 9 NLP processing tehcniques and two display

Project description

TextPreprocessor

Overview

The TextPreprocessor is a Python class designed for comprehensive text preprocessing. This library can perform the following tasks:

1. Text lematization    --> text_lematizacion()
2. Text stemming        --> text_stemming()
3. Remove links         --> remove_links()
4. Remove hastags       --> remove_hastags()
5. Remove characters    --> remove_characters()
6. Convert to lowercase --> convert_to_lowercase()
7. Remove emojis        --> remove_emojis()
8. Remove numbers       --> remove_numbers()
9. Remove stopwords     --> remove_stopwords()
10. Cloud words         --> cloudwords()
11. Frequency words     --> frecwords()

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(
    text_lematizacion_flag =True, 
    text_stemming_flag=True, 
    remove_links=True, 
    remove_hastags=True,
    remove_characters=True,
    convert_to_lowercase=True, 
    remove_emojis=True, 
    remove_numbers=True,
    remove_stopwords_flag= True, 
    cloudwords =True,
    frecwords = 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"
texto = "If you need to tokenize the text before removing stopwords, you might want to incorporate a tokenization function such as word_tokenize from NLTK."
# lematizacion
p1 = pt.TextPreprocessor()
doc = p1.lematizacion_text(texto)
Output: "if you need to tokenize the text before remove stopword , you might want to incorporate a tokenization function such as word_tokenize from NLTK ."
texto = "If you need to tokenize the text before removing stopwords, you might want to incorporate a tokenization function such as word_tokenize from NLTK."
# stemming
p1 = pt.TextPreprocessor()
doc = p1.stemming_text(texto)
Output: "if you need to token the text befor remov stopword , you might want to incorpor a token function such as word_token from nltk ."

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

procesador_de_texto-1.0.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

procesador_de_texto-1.0.0.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file procesador_de_texto-1.0.0.0.tar.gz.

File metadata

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

File hashes

Hashes for procesador_de_texto-1.0.0.0.tar.gz
Algorithm Hash digest
SHA256 db16c9e23d412a1c9b28f0bf4cb9e0d59f07fb2178d7ba03d6ec226e60cfd71f
MD5 56c2510c0ecf7238ed3a27c3a39d6e54
BLAKE2b-256 a64b6949a253a5f9853bbf59de537a94916828493d4920d4a293a4183b2a5aa3

See more details on using hashes here.

File details

Details for the file procesador_de_texto-1.0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for procesador_de_texto-1.0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3231785efd97e171d861f1cccb9e4f9c1eab44f2251e7bcba738a6db94cfbf4
MD5 bc611d356c1ff85c7ef102362ba1d54f
BLAKE2b-256 30ea48f49acc7d3026c79b1b0b2773c4b4c4a84434015ea9c23bb09a0d0e5e8d

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