Skip to main content

No project description provided

Project description

tnkeeh (تنقيح) is an Arabic preprocessing library for python. It was designed using re for creating quick replacement expressions for several examples.

Installation

pip install tnkeeh

Features

  • Quick cleaning
  • Segmentation
  • Normalization
  • Data splitting

Examples

Data Cleaning

import tnkeeh as tn
tn.clean_data(file_path = 'data.txt', save_path = 'cleaned_data.txt',)

Arguments

  • segment uses farasa for segmentation.
  • remove_diacritics removes all diacritics.
  • remove_special_chars removes all sepcial chars.
  • remove_english removes english alphabets and digits.
  • normalize match digits that have the same writing but different encodings.
  • remove_tatweel tatweel character ـ is used a lot in arabic writing.
  • remove_repeated_chars remove characters that appear three times in sequence.
  • remove_html_elements remove html elements in the form with their attirbutes.
  • remove_links remove links.
  • remove_twitter_meta remove twitter mentions, links and hashtags.
  • remove_long_words remove words longer than 15 chars.
  • by_chunk read files by chunks with size chunk_size.

HuggingFace datasets

import tnkeeh as tn 
from datasets import load_dataset

dataset = load_dataset('metrec')

cleander = tn.Tnqeeh(remove_diacritics = True)
cleaned_dataset = cleander.clean_hf_dataset(dataset, 'text')

Data Splitting

Splits raw data into training and testing using the split_ratio

import tnkeeh as tn
tn.split_raw_data(data_path, split_ratio = 0.8)

Splits data and labels into training and testing using the split_ratio

import tnkeeh as tn
tn.split_classification_data(data_path, lbls_path, split_ratio = 0.8)

Splits input and target data with ration split_ratio. Commonly used for translation

tn.split_parallel_data('ar_data.txt','en_data.txt')

Data Reading

Read split data, depending if it was raw or classification

import tnkeeh as tn
train_data, test_data = tn.read_data(mode = 0)

Arguments

  • mode = 0 read raw data.
  • mode = 1 read labeled data.
  • mode = 2 read parallel data.

Contribution

This is an open source project where we encourage contributions from the community.

License

MIT license.

Citation

@misc{tnkeeh2020,
  author = {Zaid Alyafeai and Maged Saeed},
  title = {tkseem: A Preprocessing Library for Arabic.},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/ARBML/tnkeeh}}
}

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

tnkeeh-0.0.5.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

tnkeeh-0.0.5-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file tnkeeh-0.0.5.tar.gz.

File metadata

  • Download URL: tnkeeh-0.0.5.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for tnkeeh-0.0.5.tar.gz
Algorithm Hash digest
SHA256 757305fdbf008a104d0b22be9d9bdc9f418ca2428e7fc5bcf6fbd940791fc8c9
MD5 05de85041b375a4f312544928b269de7
BLAKE2b-256 1e8a681e057e3dd3945d64e1a51b27e61b0b0d6f8eaceed652c1abe79b4522f0

See more details on using hashes here.

File details

Details for the file tnkeeh-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: tnkeeh-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.2

File hashes

Hashes for tnkeeh-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9474c0cd887b3f3534fb4c1d0adadca3a9fa4bc54ad479327656c592994fdc99
MD5 e1499ecabb7f73f1b7257d0ce0aa37e3
BLAKE2b-256 47022037b834c1ad7fab17cb3c1163146720c5a5ae5ff395da0e21776c6720f9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page