Skip to main content

Tools for cleaning and preprocessing text

Project description

Text Cleaner. Cleaning & Preprocessing Text Data

made-with-python GitHub release (latest by date)

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:

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

text-cleaner-emagister-2.0.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

text_cleaner_emagister-2.0.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file text-cleaner-emagister-2.0.2.tar.gz.

File metadata

  • Download URL: text-cleaner-emagister-2.0.2.tar.gz
  • Upload date:
  • Size: 4.8 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.13

File hashes

Hashes for text-cleaner-emagister-2.0.2.tar.gz
Algorithm Hash digest
SHA256 491697ca1c9f72a222255dcefaf9aba7d10577010f36a50a4f26462ff00c0e22
MD5 4590e24cf953c682d5f2da01e16d1153
BLAKE2b-256 1d29605e3037377978bc816be8a66f6b1d63c8cc715e023f9f908e081f54bc96

See more details on using hashes here.

File details

Details for the file text_cleaner_emagister-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: text_cleaner_emagister-2.0.2-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.13

File hashes

Hashes for text_cleaner_emagister-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 830ec5dffca08fa8add15387d06c8105cc256a11972e1c574bdb63e34a9cfba4
MD5 47096b1ee7b97e51973041779420b9bd
BLAKE2b-256 d781cfbe7727a7362981d4816f0490a733d555cf5c585d8626ecd7a9374f62cc

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