Skip to main content

cleantxt

cleaning text from noise for nlp tasks

installation

with pip

pip install cleantxt

install from source

git clone https://github.com/jemiaymen/cleantxt.git

go to the cleantxt directory

cd cleantxt

install with pip

pip install .

cli usage

cleantxt --doc=[path_to_doc] --out=[path_out_file] --f=[0] --t=[100] --do_lower=True --white_space=True --punctuation=True --duplicated_chars=True --alpha_num=True --accent=True --escape key,value ə,a œ,oe

check example

api usage

import text module

from cleantxt import text

clean text

txt = text.clean_text('mella 7ayawaaanéé hadddddda mta3@@@@@ @tfih')

print the result

mella 7ayawane hada mta3 tfih

params

text : -> (str) raw text

whitespace : -> (boolean) escape spaces [default True ]

punctuation : -> (boolean) escape punctuation [default True ]

duplicated : -> (boolean) escape duplicated chars [default True ]

alphanum : -> (boolean) escape non alpha numeric chars [default True ]

accent : -> (boolean) escape accent [default True ]

do_lower : -> (boolean) lower case text [default True ]

others : -> ( list( tuple() ) ) escape rules [ default [('ə', 'a')] ]

new function

word count

wc => (word count) params (path :str, unique=False, both=False)

from cleartxt import text print( text.wc('file.txt',both=True) )

(51515,5547)

output tuple (all words , unique words)

word frequency

word_frequency => params (path : str, top=100)

from cleartxt import text print( text.word_frequency('file.txt') )

[('\n', 54898), ('', 48757), ('w', 27717), ('el', 16679), ('fi', 9399), ('ya', 8611)]

output list of tuples (word , frequency)

Metadata

Release files for cleantxt 0.0.7

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

Source distribution (sdist)

Source distribution for cleantxt 0.0.7
File Size Uploaded Provenance
cleantxt-0.0.7.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cleantxt 0.0.7
File Interpreter ABI Platform
cleantxt-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / cleantxt-0.0.7.tar.gz

Download URL cleantxt-0.0.7.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e0f55747c051db28f76f87e9d5be8a46454e6b4b1af424e78d64962d7ac63c6b
BLAKE2b-256 checksum
How to use checksums
0be0c75f403c800ccdba204edd04434413b2e0d4a77b130dd51fbceacfa91b35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

Release files / cleantxt-0.0.7-py3-none-any.whl

Download URL cleantxt-0.0.7-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b2abefddb1815a61ed48fdb1696ab00f172fc80e7732837ff8be732ee5e1802
BLAKE2b-256 checksum
How to use checksums
e67e9784fbfeddcd456ffdff3afd599b81ac49eda02d8ab4c40812e40d31dd43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.6

Security for cleantxt 0.0.7

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.

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