JT_script_normaliser
Language-aware text normalisation for the 22 scheduled Indian languages plus several foreign languages (English, Romanian, Portuguese, Vietnamese, Arabic).
It is built for ASR / speech pipelines: it canonicalises Unicode, strips or preserves punctuation and symbols depending on the mode, normalises digit scripts, and flags text that contains characters foreign to the chosen language.
Install
pip install JT_script_normaliser
Optional mojibake / encoding repair via ftfy:
pip install "JT_script_normaliser[ftfy]"
Quick start
from JT_script_normaliser import verbatim, verbatim_with_numbers, display
verbatim("नमस्ते, दुनिया!", "hindi")
# 'नमस्ते दुनिया'
verbatim_with_numbers("मेरे पास 5 आम", "hindi", number_script="native")
# 'मेरे पास ५ आम'
display("कीमत ₹1,00,000.50 है।", "hindi")
# 'कीमत ₹100000.50 है'
Modes
All modes apply a shared base: Unicode NFC, whitespace collapsing, removal of invisible formatting characters (BOM, bidi marks, ...), language-specific canonicalisation (e.g. Malayalam chillu folding), and a foreign-character gate (see below).
| Mode | Punctuation | Symbols (₹ % °) | Numbers |
|---|---|---|---|
verbatim |
removed | removed | removed (presence redacts) |
verbatim_with_numbers |
removed | removed | kept, normalised |
display |
removed | kept | kept, normalised |
verbatim(text, language, *, remove_zero_width=True, use_ftfy=False)
Spoken text only — punctuation, symbols and numbers are stripped, meaning preserved. If any number or foreign character remains, the whole input is redacted (see below).
verbatim_with_numbers(text, language, *, number_script="latin", remove_zero_width=True, use_ftfy=False)
Like verbatim, but numbers are kept and unified to one digit script.
A decimal point between two digits is kept (3.14); a grouping comma between
two digits is removed (1,00,000 -> 100000).
display(text, language, *, number_script="latin", remove_zero_width=True, use_ftfy=False)
Readable output for downstream/ASR consumers. Keeps numbers, decimals and essential symbols while removing ordinary punctuation:
- Always kept: currency (
$ ₹ €),° © ™ ®, and% ‰ ‱ @ # &. - Kept only next to a digit: math symbols (
+ − × ÷ = ± < > | ~) and the affixes: - / * ^(so5:30,-9,3/4,2*3are kept, buta-b,and/or,x = yare not). - Vulgar fractions are folded to ASCII:
½->1/2.
display("meet at 5:30, pay $5 + €3 = ¥8 - well-known", "english")
# 'meet at 5:30 pay $5 + €3 = ¥8 well known'
Options
| Option | Default | Values | Applies to |
|---|---|---|---|
language |
— (required) | name or alias / ISO code ("hindi", "hi") |
all |
number_script |
"latin" |
"latin", "native" |
numbers, display |
remove_zero_width |
True |
True, False |
all |
use_ftfy |
False |
True, False (needs [ftfy] extra) |
all |
number_script—"latin"renders all digits as0-9;"native"renders them in the language's script (e.g. Devanagari५, Tamil௫, Urdu۵). Both Latin and native input digits are unified to the target.remove_zero_width— ZWJ/ZWNJ are removed by default. SetFalseto preserve them (e.g. to keep Telugu vibhakti rendering). Lexically meaningful sequences (Malayalam chillu, Bengali khanda-ta) are folded to their atomic forms first, so they survive either way.use_ftfy— whenTrue, runsftfy.fix_textfirst to repair mojibake (e.g.हि...->हि...).
Foreign-character gate
After normalisation, any surviving character that is not a letter/mark of the
chosen language — a foreign letter, or any digit in verbatim mode — causes the
whole input to be returned as a redaction marker:
verbatim("नमस्ते hello", "hindi")
# 'REDACTED_FOREIGN_CHAR (h)'
verbatim_with_numbers("मेरे पास ৫ आम", "hindi") # Bengali digit in Hindi
# 'REDACTED_FOREIGN_CHAR (৫)'
Supported languages
from JT_script_normaliser import available_languages
available_languages()
Indian: assamese, bengali, bodo, bhojpuri, chhattisgarhi, dogri, gujarati, hindi, kannada, kashmiri, konkani, maithili, malayalam, manipuri (Meetei Mayek), marathi, nepali, odia, punjabi, sanskrit, santali, sindhi, tamil, telugu, urdu.
Foreign: english, romanian, portuguese, vietnamese, arabic.
Common aliases and ISO codes are accepted (hi, bn, ta, ur, en, ...).
Per-language canonicalisation
Beyond the base pipeline, some languages get script-specific fixes:
- Malayalam — legacy chillu (consonant + virama + ZWJ) folded to atomic
chillu (
ൻ ർ ൽ ...), so ZWJ removal doesn't corrupt them. - Bengali / Assamese — legacy khanda-ta folded to atomic
ৎ. - Urdu / Sindhi / Kashmiri / Arabic — presentation forms folded to base letters; tatweel (kashida) removed.
- Romanian — cedilla
ş ţfolded to comma-belowș ț.
License
MIT
Metadata
Release files for JT_script_normaliser 0.1.0
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 |
|---|---|---|---|---|
| jt_script_normaliser-0.1.0.tar.gz | 25.6 kB | Without provenance | Details for jt_script_normaliser-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jt_script_normaliser-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for jt_script_normaliser-0.1.0-py3-none-any.whl |
Total release size: 42.4 kB
Release files / jt_script_normaliser-0.1.0.tar.gz
| Download URL | jt_script_normaliser-0.1.0.tar.gz |
|---|---|
| Size | 25.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57aa60ec42e7b4353f6e6fc1c7131f866d32741f71f450542f6a1e9f118f72ad
|
|
BLAKE2b-256 checksum How to use checksums |
7a510d1b965614cbf5a6b4702db76ee14698739401bfaeaf3f76d5c07f42263e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / jt_script_normaliser-0.1.0-py3-none-any.whl
| Download URL | jt_script_normaliser-0.1.0-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
039852363ecaf3a057464f089a61f912d835702e6ce2d0d26a4263c76d8c72a3
|
|
BLAKE2b-256 checksum How to use checksums |
a763a0a7a89c834273f9097db5ea60ddc23ed1546f2f413788c9fcbfc11f6a8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for JT_script_normaliser 0.1.0
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.