masakhanePreprocessor
An effective language-first preprocessing tool for African languages (🔧 Beta version).
We build on the clean-text preprocessor.
How to Use 
Install:
git clone https://github.com/masakhane-io/masakhanePreprocessor.git
cd masakhanePreprocessor
pip install .
Preprocessor
You only need to specify your language and it loads the important preprocessing style for You!
You initialize the Preprocessor in Python as follows:
from masakhanePreprocessor import Preprocessor
my_prep = Preprocessor(lang='ig')
You can also directly include some additional parameters you want:
my_prep = Preprocessor(lang='ig',
lower=True,
strip_punctuation=True,
strip_symbols=True)
preproces_str
To preprocess a string use the preproces_str function:
clean_text = my_prep.preprocess_str('''Dịka● ndọrọndọrọọchịchị maka ntuliaka ọkwa Gọvanọ
Anambra steeti si na-aga nke afọ 2021, ndị nọ.''')
You get the following as output:
Dịka ndọrọndọrọọchịchị maka ntuliaka ọkwa Gọvanọ Anambra steeti si na-aga nke afọ 2021 ndị nọ
Notice how the
●character has been removed, but the-, which is an important part of Igbo, remains untouched.
preprocess_file
To preprocess a file use the preprocess_file function:
my_prep.preprocess_file('ig.txt',
output_path=None #Specify the output path. If unspecified, uses the parent directory of input file)
On successful completion you get this message:
Clean file(s) saved successfully to xxxxxxx/ig_CLEAN.txt
Properties of the preprocessing tool
-
Language-first It can:
- map any African language name provided to its language code. You can write
Preprocessor(lang='yoruba')using just the name. - map any language code to its BCP47 variant. So even if you use
yooryorit does not matter.
- map any African language name provided to its language code. You can write
-
Simple to use
Contribution
We are open to and grateful for ideas to make this better. You can propose ideas as issues or pull requests.
With 💙 From The Contributors
Metadata
Release files for masakhanePreprocessor 0.0.6
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 |
|---|---|---|---|---|
| masakhanePreprocessor-0.0.6.tar.gz | 31.6 kB | Without provenance | Details for masakhanePreprocessor-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| masakhanePreprocessor-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for masakhanePreprocessor-0.0.6-py3-none-any.whl |
Total release size: 62.9 kB
Release files / masakhanePreprocessor-0.0.6.tar.gz
| Download URL | masakhanePreprocessor-0.0.6.tar.gz |
|---|---|
| Size | 31.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bb7d30b011c3831c201da74d98de5e41cb5c23517f3cd089317fec4cdfb6833
|
|
BLAKE2b-256 checksum How to use checksums |
62bd0392b904d16a0918941ecf176c110ad777da78b62b8decb89a840591a8fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / masakhanePreprocessor-0.0.6-py3-none-any.whl
| Download URL | masakhanePreprocessor-0.0.6-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b03b24c037e93f3ac230e07725d1ea9987b70c8a8f4b65ebbd53e0b5250aa21f
|
|
BLAKE2b-256 checksum How to use checksums |
db933b26cb1fff410c73e2089e0d02c8bb2e872f0fe7c979ea44baf31a055846
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for masakhanePreprocessor 0.0.6
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.