ngtextpreprocess
ngtextpreprocess a simple Python package that removes noise and extracts the meaningful information from the given input text data.
Unlike plain tokenization and de-tokenization, where useful information like sentences, dates, percentages, monetary values etc becomes undentifiable, ngtextpreprocess goes one step ahead in preserving these crucial information while removing noisy data.
Table of contents:
Installation:
To install the package in your local environment, open a terminal inside your project directory and type:
pip install ngtextpreprocess
To upgrade the already existing installation, run
pip install -U ngtextpreprocess
Usage:
The package comes with a cleaning pipeline for performing all the
text cleaning processes in a single step.
Along with that, the package also can be used for specific text cleaning tasks
by accessing the individual methods.
Cleaning pipeline
# import the package
from ngtextpreprocess import CleanText
# initialize the input text
input_text = """
This is a #1234 sampl writtn 100% on 2022/04/14 ___
<a href=#> with $100.50 on my @abcd table.</a>
"""
# instantiate the class object by passing the input text
ct = CleanText(input_text=input_text)
# call the cleaning pipeline and get the output
output_text = ct.cleaning_pipeline()
print(output_text)
>> This is a sample written 100% on 2022/04/14 with $100.50 on my table.
You can customize the pipeline by deciding what all functions you would require in the same sequential manner.
This can be done by backward elimination technique where you can set the parameter for the required function as False.
Also you can enable the set_logging parameter to get the logging details as a log file in a dynamically created logging directory.
Here is how its done.
Using required functions in the pipeline
In this example, we want the name to stay intact in the output. So, we are disabling the remove_name function. Also we are enabling logging to get the log details in the logging directory.
# import
from ngtextpreprocess import CleanText
# initialize the input text
input_text = "This is John Doe from U.S. ."
# instantiate
cleaner = CleanText(input_text)
# call the cleaning_pipeline method
output_text = cleaner.cleaning_pipeline(set_logging=True, set_remove_name=False)
print(output_text)
>> This is John Doe from
As you can see, the name has been preserved and all other possible corrections have been made. Also, the logfiles have been generated.
Individual methods
The following are the individual functions used within the pipeline.
For Text Beautification
- Cleaning HTML
- Fixing ASCII decoding errors
- Removing Bullets
- Replacing Hexcodes
- Removing Symbols and Emojis
For Personal Information Removal
- Removing Personal Names
- Removing Contact Addresses
- Removing Contact Numbers
- Removing e-mail address
- Removing social-media tags
- Removing URL
For Text Correction
- Expanding Domain specific short-forms (Currently, financial domain has been covered.)
- Expanding General short-forms
- Fixing Contractions
- Removing Punctuations
- Removing Extra Whitespaces
- Fixing Spelling errors
Metadata
Release files for ngtextpreprocess 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ngtextpreprocess-0.0.1.tar.gz | 18.2 kB | Without provenance | Details for ngtextpreprocess-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ngtextpreprocess-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for ngtextpreprocess-0.0.1-py3-none-any.whl |
Total release size: 34.1 kB
Release files / ngtextpreprocess-0.0.1.tar.gz
| Download URL | ngtextpreprocess-0.0.1.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
08b41cd5abe19f9fca8fd9f67a5048d7e58fad4cfa6ce402f79e1d70994ff2db
|
|
BLAKE2b-256 checksum How to use checksums |
400b09c19b1c98b1313a8fef3dd2153c42022b1d7177debad51210004f407a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.0
|
Release files / ngtextpreprocess-0.0.1-py3-none-any.whl
| Download URL | ngtextpreprocess-0.0.1-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a14fd6bf4cef322b328843a046b20ed49aa1a980c7e9bd1f94931936e981aac
|
|
BLAKE2b-256 checksum How to use checksums |
dc2110bc0f51f93356f458f9d6d996ea3c589f82b43d44d356e2057267cdf2f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.0
|
Security for ngtextpreprocess 0.0.1
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.