Skip to main content

Tiny Tamil text utilities: normalize, tokenize, stopword removal, graphemes

Project description

# tamil-utils

Tiny **Tamil-first** text utilities for Unicode-safe text handling and preprocessing.

[![PyPI](https://img.shields.io/pypi/v/tamil-utils)](https://pypi.org/project/tamil-utils/)
[![CI](https://github.com/arulnidhii/tamil-utils/actions/workflows/ci.yml/badge.svg)](https://github.com/arulnidhii/tamil-utils/actions)
[![Docs](https://img.shields.io/badge/docs-mkdocs--material-blue)](https://arulnidhii.github.io/tamil-utils/)

---

## Features

- **Core**: `normalize`, `tokens`, `remove_stopwords`, `graphemes`
- **Sentences & numerals**: `sents`, `to_arabic_numerals`, `to_tamil_numerals`
- **Script & transliteration**: `script_of`, `token_scripts`, `transliterate_iso15919`
- **v0.2 (WIP)**: `ngrams`, `bigrams`, `trigrams`, `word_counts`, `syllables`, `sort_tamil`

---

## Install

```bash
pip install tamil-utils

Quick start (Python)

from tamil_utils import (
    normalize, tokens, remove_stopwords, graphemes,
    sents, to_arabic_numerals, to_tamil_numerals,
    script_of, token_scripts, transliterate_iso15919,
    # v0.2 (WIP)
    word_counts, sort_tamil
)

s = "இது ஒரு சோதனை. இது இரண்டாம்? சரி! ௨௦௨௫"
print(tokens(s))                                # ['இது','ஒரு','சோதனை','இது','இரண்டாம்','சரி','௨௦௨௫']
print(remove_stopwords(tokens(s), preset="ta")) # stopwords removed
print(graphemes("👩🏽‍💻"))                         # emoji-safe graphemes
print(sents(s))                                  # sentence split
print(to_arabic_numerals("௨௦௨௫"))                 # "2025"
print(transliterate_iso15919("தமிழ்"))             # "tamiḻ"
print(token_scripts(tokens("கோட்123 hello")))     # [('கோட்123','Mixed'), ('hello','Latin')]

# v0.2 (WIP)
print(word_counts("தமிழ் NLP தமிழ் பயன்பாடு தமிழ் NLP", n=2, top=2))  # bigram freq
print(sort_tamil(["இலங்கை","ஆதி","அடி"]))                         # ['அடி','ஆதி','இலங்கை']

CLI

# tokens / stopwords / graphemes / sents
python -m tamil_utils.cli tokens "இது ஒரு சோதனை"
python -m tamil_utils.cli tokens --rmstop "இது ஒரு சோதனை"
python -m tamil_utils.cli graphemes "👩🏽‍💻"
python -m tamil_utils.cli sents "இது ஒரு வாக்கியம். இது இரண்டாம்? சரி!"

# numerals
python -m tamil_utils.cli to-arabic "௨௦௨௫"   # -> 2025
python -m tamil_utils.cli to-tamil "123"     # -> ௧௨௩

# transliteration & script tags
python -m tamil_utils.cli to-iso "தமிழ்"
python -m tamil_utils.cli script "கோட்123 hello"

# v0.2 (WIP): n-grams, frequency, syllables, sort
python -m tamil_utils.cli ngrams -n 3 "தமிழ் NLP பயன்பாடு"
python -m tamil_utils.cli freq -n 2 --top 5 "தமிழ் NLP தமிழ் பயன்பாடு தமிழ் NLP"
python -m tamil_utils.cli syllables "தமிழ்🙂 test 123"
# sort: pass words as args or via stdin
python -m tamil_utils.cli sort இலங்கை ஆதி அடி
type words.txt | python -m tamil_utils.cli sort

Status


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

tamil_utils-0.2.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

tamil_utils-0.2.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file tamil_utils-0.2.0.tar.gz.

File metadata

  • Download URL: tamil_utils-0.2.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tamil_utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f361373eb38d92de59bc6c602622f562e953104b5905e9891b5de8b13678858e
MD5 ca724223c2cd6e274dc159ba5f93f7e5
BLAKE2b-256 0d17a035f505b5d337c663308ae28edd28e6d3ab886292a715abe9f1d21e5623

See more details on using hashes here.

File details

Details for the file tamil_utils-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: tamil_utils-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for tamil_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 01d0852e1858a7d08fa866be3f3f940058c7027bde550b63062bd75e525c73db
MD5 fd53897427d0457925ed03d9dc5cfc6d
BLAKE2b-256 fe15852084d0452d6856810c3196b69b0d7e1f7d7676f6db279c23f398b89769

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