Tools for cleaning and preprocessing text
Project description
Text Cleaner. Cleaning & Preprocessing Text Data
text-cleaner is a tool created to perform NLP Text preprocessing. This tool helps to remove noise from text and make it ready to feed to models.
Table of Contents
Dependencies
text-cleaner requires:
- Python (>=3.8)
- BeautifulSoup (4.9.3)
- Unidecode (1.3.2)
Installation
You can install text-cleaner using pip
pip install text-cleaner-fdelgados
That easy!
Instructions
You can clean text using the clean
method of the TextCleaner
class:
from textcleaner import TextCleaner
text = '<p><i><b>2001: A Space Odyssey</b></i> \n\nis a 1968 <a href="/wiki/Epic_film" title="Epic ' \
'film">epic</a> <a href="/wiki/Science_fiction_film" title="Science fiction film">science fiction film</a> ' \
'produced and directed by\t <a href="/wiki/Stanley_Kubrick" title="Stanley Kubrick">Stanley Kubrick</a>. ' \
'The screenplay was written by Kubrick and <a href="/wiki/Arthur_C._Clarke" title="Arthur C. ' \
'Clarke">Arthur C. Clarke</a>, and was inspired by Clarke\'s short story ""<a href="/wiki/The_Sentinel_(' \
'short_story)" title="The Sentinel (short story)">The Sentinel</a>" and other short stories by Clarke. A ' \
'<a href="/wiki/2001:_A_Space_Odyssey_(novel)" title="2001: A Space Odyssey (novel)">novelisation of the ' \
'film</a> released after the film\'s premiere was in part written concurrently with the screenplay. The ' \
'film, which follows a voyage to <a href="/wiki/Jupiter" title="Jupiter">Jupiter</a> with the <a ' \
'href="/wiki/Sentience" title="Sentience">sentient</a> computer <a href="/wiki/HAL_9000" title="HAL ' \
'9000">HAL</a> after the discovery of a <a href="/wiki/Monolith_(Space_Odyssey)" title="Monolith (Space ' \
'Odyssey)">featureless alien monolith</a> affecting human evolution, deals with themes of <a ' \
'href="/wiki/Existentialism" title="Existentialism">existentialism</a>, <a href="/wiki/Human_evolution" ' \
'title="Human evolution">human evolution</a>, technology, <a href="/wiki/Artificial_intelligence" ' \
'title="Artificial intelligence">artificial intelligence</a>, and the possibility of <a ' \
'href="/wiki/Extraterrestrial_life" title="Extraterrestrial life">extraterrestrial life</a>.</p> '
cleaner = TextCleaner(text)
print(cleaner.clean())
# output
# 2001: A Space Odyssey is a 1968 epic science fiction film produced and directed by Stanley Kubrick. The screenplay
# was written by Kubrick and Arthur C. Clarke, and was inspired by Clarke's short story "The Sentinel" and other
# short stories by Clarke. A novelisation of the film released after the film's premiere was in part written
# concurrently with the screenplay. The film, which follows a voyage to Jupiter with the sentient computer HAL after
# the discovery of a featureless alien monolith affecting human evolution, deals with themes of existentialism,
# human evolution, technology, artificial intelligence, and the possibility of extraterrestrial life.
License
MIT License
Copyright (c) 2021 Cisco Delgado
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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
Built Distribution
File details
Details for the file text-cleaner-fdelgados-2.0.1.tar.gz
.
File metadata
- Download URL: text-cleaner-fdelgados-2.0.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1409333a3f0be9d529141f38e5a95990af28d991a87704bba7a2849a93c976bc |
|
MD5 | f9ff157904baf6507edf929d9b9ec9f5 |
|
BLAKE2b-256 | 1738f16baaf7dd464294c4ae71c0835b6091fdfd560971b824e37ade31d7073c |
File details
Details for the file text_cleaner_fdelgados-2.0.1-py3-none-any.whl
.
File metadata
- Download URL: text_cleaner_fdelgados-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28f900291c1cf028c31212406f0ccb4313467b5dad82451676533e5cb7ed8811 |
|
MD5 | 85f99e770934fee62122748cee4e51df |
|
BLAKE2b-256 | 0e5fbf06c1e579f018fbcbf7107320bc923e5a724f50fa901c78ca443869be83 |