Skip to main content

## Natural Language Text Preprocessor (nltp)

A simplified package for automating text preprocessing activities such as lemmatization, tokenization, removal of stop words, removal of certain pattern from text using regular expression. Working under the hood, this package makes use of the NLTK library for its text cleaning activities.

Installation

Requirements:

  • Python 3.7 or higher
  • NLTK

Install latest release:

pip install nltp

Install from source:

git clone https://github.com/izzyx6/nltp.git
cd nltp
pip install .

Usage: the basics

Here's how to perform text cleaning with nltp

First, we pass text in a list to the instantiated Preprocessor object as it takes an argument text.

This lines of code returns a tokenized version of the text passed on instantiating the text Preprocessor .

from nltp import Preprocessor

text = ["I like eat delicious food", "That's I'm cooking food myself, case '10 Best Foods' helps lot, also 'Best Before (Shelf Life)'"]

output = Preprocessor(text)
output.token()

You can retrive the text with their index (default set to 0):

output.token(1)

Next, you can get the cleaned version of the text passed in a list with lemmatization, stop word and unwanted patterns in text removed.

Available parameters to modify are stop_words and patterns.

output = Preprocessor(text,stop_words = [USER DEFINED], pattern = [USER DEFINED])

Note: the purpose of having these parameters are to by pass the defualt parameters that remove non alphabets, repeted sequence of words, and users name (identified with the @User).

output = Preprocessor(text)
output.text_cleaner()

Note: Using the output. you can get the default stop word, patterns, and text passed

output = Preprocessor(text)
output.patterns
output.stop_words
output.text

Citation

BibTex entry:

@misc{omalley2019kerastuner,
	title        = {Natural Language Text Preprocessor {nltp}},
	author       = { Ufumaka Isreal},
	year         = 2020,
	howpublished = {\url{https://github.com/izzyx6/nltp}}
}

Metadata

Release files for nltp 0.1.0

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

Source distribution (sdist)

Source distribution for nltp 0.1.0
File Size Uploaded
nltp-0.1.0.tar.gz 3.7 kB Details

Release files / nltp-0.1.0.tar.gz

Download URL nltp-0.1.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dcc555fd7a265328e5ba05a5473254637628e6f917196f2cd1d908eb803ab283
BLAKE2b-256 checksum
How to use checksums
2f4ec83a50edd05219e21d65948c42f61d94d744fdeecab583be54dba4b4d50a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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