Documentation

About¶
- This documentation is about an open source Python programming language package built for Odia language.
openodiais a Python package which contains various tools on Odia language.- The short term goal of this package is to not make state-of-the-art methods, but to make tools which work.
- The documentation has been written to help you easily copy the code snippets and try out in your Python IDLE or iPython or Jupyter Notebook.
Installation¶
- Set up the library from PyPI using the following command in your terminal or command prompt.
- Requires Python 3.11 or higher.
-
The library is tested on Python 3.11, 3.12, 3.13, 3.14, and 3.15.
Python Installation instruction
You can download Python from Python official website and install on your system.
Using pip¶
pip install openodia
Using uv (recommended)¶
uv is a fast Python package installer and resolver.
# Install uv if you haven't already
pip install uv
# Install openodia
uv pip install openodia
# Or add to your project
uv add openodia
From source¶
If you want to install from the source with latest changes:
git clone https://github.com/soumendrak/openodia.git
cd openodia
uv sync # or: pip install -e .
Features¶
The tools are available in Odia language. Getting started is the short path. The guides are one task each, and the API reference is generated from the docstrings.
- Odia Alphabets
- Generate random Odia names
- Detect Odia Language
- Word Tokenizer
- Remove stopwords
- Google Translate
- Automatic extractive text summarization
- Add Dictionary corpus
- Unicode normalization & clean
- Corpus statistics
- Syllabifier (akshara)
- Phonetic matching
- Sandhi and compounds
- Indic-to-Indic transliteration
- Romanisation
- Phonetic typing
- Command-line interface
- Translation cache configuration
- Numbers, dates, and currency in words
- Sentence segmenter
- Odia spell checker
- PII detection and masking
- Legacy font conversion
Unicode normalization¶
- The same visible Odia string can be encoded in many byte sequences (e.g. precomposed vs decomposed nukta
ଡ଼, stray ZWJ/ZWNJ from copy-paste, Latin digits mixed in with Odia). - Normalize text before tokenizing, indexing, hashing, or comparing.
from openodia import normalize, clean
# Pure Unicode normalization (NFC / NFD / NFKC / NFKD)
normalize("ଡ" + "଼") # "ଡ଼" (composed)
normalize("ଡ଼", form="NFD") # "ଡ" + "଼" (decomposed)
# Opinionated cleanup: NFC + strip ZWJ/ZWNJ + collapse whitespace
clean(" ନମସ୍କାର ଓଡ଼ିଆ ")
# "ନମସ୍କାର ଓଡ଼ିଆ"
# Optional digit conversion (off by default)
from openodia.text import CleanOptions
clean("ଆଜି 123 ବର୍ଷ", options=CleanOptions(latin_to_odia_digits=True))
# "ଆଜି ୧୨୩ ବର୍ଷ"
clean("ଆଜି ୧୨୩ ବର୍ଷ", options=CleanOptions(odia_to_latin_digits=True))
# "ଆଜି 123 ବର୍ଷ"
clean() is idempotent
clean(clean(x)) == clean(x) always holds, so it is safe to apply repeatedly
or sprinkle through a pipeline without compounding side-effects.
Corpus statistics¶
- N-grams, frequency distribution, collocations, and co-occurrence — pure-stdlib utilities for corpus exploration.
- All functions accept either a pre-tokenised
list[str]or a raw string (auto-tokenised viaud.word_tokenizer).
from openodia import FreqDist, ngrams, collocations, cooccurrence
tokens = "ରାମ ସୀତା ରାମ ଲକ୍ଷ୍ମଣ".split()
# N-grams (generator)
list(ngrams(tokens, 2))
# [('ରାମ', 'ସୀତା'), ('ସୀତା', 'ରାମ'), ('ରାମ', 'ଲକ୍ଷ୍ମଣ')]
# Frequency distribution — a Counter subclass with hapaxes / entropy / TTR.
fd = FreqDist(tokens)
fd.most_common(2) # [('ରାମ', 2), ('ସୀତା', 1)]
fd.hapaxes() # ['ସୀତା', 'ଲକ୍ଷ୍ମଣ']
fd.entropy() # Shannon entropy (bits)
fd.ttr # type-token ratio
# PMI-scored bigram collocations.
collocations(tokens, top_k=5, min_count=1)
# [(('ରାମ', 'ଲକ୍ଷ୍ମଣ'), 1.0), ...]
# Co-occurrence within a window (symmetric by default).
cooccurrence(tokens, window=2)
# Counter({('ରାମ', 'ସୀତା'): 2, ...})
v1 scope
collocationsships PMI scoring only. Log-likelihood and chi-square are easy follow-ups.- Plot helpers are intentionally out of scope to keep the base install free of matplotlib.
Syllabifier¶
- Splits a word into aksharas (orthographic syllables) using the Odia Unicode block rules: independent vowels, consonant clusters joined by halant (
୍), matras, modifiers, and nukta. - Useful for TTS frontends, hyphenation/typography, character-level ML, and readability scoring.
from openodia import syllable
syllable.split("ନମସ୍କାର") # ['ନ', 'ମ', 'ସ୍କା', 'ର']
syllable.split("ଓଡ଼ିଆ") # ['ଓ', 'ଡ଼ି', 'ଆ']
syllable.split("ବିଦ୍ୟାଳୟ") # ['ବି', 'ଦ୍ୟା', 'ଳ', 'ୟ']
syllable.count("ବିଦ୍ୟାଳୟ") # 4
syllable.hyphenate("ବିଦ୍ୟାଳୟ") # 'ବି-ଦ୍ୟା-ଳ-ୟ'
syllable.hyphenate("ନମସ୍କାର ଓଡ଼ିଆ", separator="·")
# 'ନ·ମ·ସ୍କା·ର ଓ·ଡ଼ି·ଆ'
Round-trip property
"".join(syllable.split(word)) == word for any input — the splitter
is a strict tokeniser, never modifying or normalising characters.
Phonetic matching¶
These are Odia-adapted variants, not classic Soundex or Metaphone.
Soundex preserves the first Odia letter, including a leading vowel, and
pads or truncates to four characters. Both encoders normalize NFC.
Vowels and matras reset duplicate suppression; halant, nukta and zero-width
joiners do not. For example, ପାପା gives Soundex ପ600 and Metaphone ପପ.
Nonempty input with no Odia letters raises ValueError, including Latin-only
input, and soundex()/metaphone() raise TypeError for a non-str such as
None. In mixed input, non-Odia characters emit nothing but reset duplicate
suppression, like vowels. Empty input produces empty keys. similarity()
does not raise for non-Odia input: it returns 0.0 when either side is None
or has no Odia letters (Latin or whitespace-only), and similarity("", "")
is 0.0. Any other type (int, bytes, list) raises TypeError. It
assigns 0.5 to Soundex equality and 0.5 to normalized Metaphone edit
similarity.
- Two encoders for finding spelling variants of the same name / word:
- Soundex — fixed 4-character code based on place-of-articulation groups.
- Metaphone — variable-length consonant skeleton, aspirated/voiced pairs collapsed.
- A
similarity()score that combines both into a single[0, 1]value.
from openodia import phonetic
phonetic.soundex("ସୋମେନ୍ଦ୍ର") # 'ସ657' (4 chars)
phonetic.soundex("ସୋମେନ୍ଦ୍ର") == phonetic.soundex("ସୌମେନ୍ଦ୍ର") # True
phonetic.metaphone("ସୋମେନ୍ଦ୍ର") # 'ସପତର'
phonetic.similarity("ସୋମେନ୍ଦ୍ର", "ସୌମେନ୍ଦ୍ର") # 1.0
phonetic.similarity("ସୀତା", "ବିଜୟ") # ~ 0.0
When to use which
Soundex maximises recall (more collisions, broader match). Metaphone
is finer-grained. similarity() averages them so the score behaves
well as a sortable threshold for fuzzy-match queries.
Sandhi and compounds¶
- Splits a compound into the words sandhi joined, and joins those parts back.
- A known lemma, or a word that does not split into two known words, is returned unchanged.
openodia.sandhineeds a release newer than 0.1.14:import openodia.sandhifails on 0.1.14.splitandjoinNFC-normalize. For a compound the splitter accepts,join(split(word))equals the NFC form of the word.
from openodia import sandhi
sandhi.split("ବିଦ୍ୟାଳୟ") # ["ବିଦ୍ୟା", "ଆଳୟ"]
sandhi.split("ସୂର୍ଯ୍ୟୋଦୟ") # ["ସୂର୍ଯ୍ୟ", "ଉଦୟ"]
sandhi.split("ରାଜ୍ୟପାଳ") # ["ରାଜ୍ୟ", "ପାଳ"]
sandhi.split("ରାମ") # ["ରାମ"]
sandhi.join(["ବିଦ୍ୟା", "ଆଳୟ"]) # "ବିଦ୍ୟାଳୟ"
Indic transliteration¶
- Script-only transliteration between Brahmic Indic scripts: Devanagari, Bengali / Assamese, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam.
- Deterministic, no external dependencies. Each character is mapped by its Unicode identity (e.g.
DEVANAGARI LETTER KA→ORIYA LETTER KA), with short/long e/o aligned across north and south scripts. Chillus and khanda ta expand to consonant + virama. A composition-excluded nukta letter is consonant + nukta when the target has those parts, except Gurmukhi flap RRA and a target LLA, SHA, or YYA, which stay one letter. Characters with no counterpart are kept unchanged. Odia WA (ୱ) has no letter in the other scripts, so it stays and round-trips. Bengali has no VA and writes it as BA, so VA does not round-trip through Bengali. - Useful for cross-script reading, ML corpus alignment, and name normalisation across regions.
from openodia import indic
indic.transliterate("ଓଡ଼ିଆ", from_script="odia", to_script="devanagari")
# 'ओड़िआ'
indic.transliterate("नमस्ते", from_script="devanagari", to_script="odia")
# 'ନମସ୍ତେ'
indic.SCRIPTS # ('devanagari', 'bengali', 'assamese', 'gurmukhi', 'gujarati', 'odia', 'tamil', 'telugu', 'kannada', 'malayalam')
Tamil caveat
Tamil's encoding has only one consonant per articulation group.
Devanagari/Odia aspirated or voiced consonants have no Tamil letter, so
they are kept in the source script rather than silently collapsed.
Characters are mapped by Unicode identity, not by block offset: Malayalam
chillus become consonant + virama, and shared marks such as the danda
(।) are kept.
Romanisation¶
- Three schemes — pick by use case:
- ISO 15919 — academic / library transliteration, reversible, uses diacritics.
- Hunterian — Govt-of-India transliteration, ASCII, lossy (no diacritics).
- ITRANS — ASCII spellings for every letter and sign in its tables, keyboard-friendly, reversible.
from openodia import roman
roman.to_roman("ଓଡ଼ିଆ", "ISO15919") # 'ōṛiā'
roman.to_roman("ଓଡ଼ିଆ", "Hunterian") # 'oria'
roman.to_roman("ଓଡ଼ିଆ", "ITRANS") # 'o.DiA'
roman.from_roman("namaskara", "Hunterian") # 'ନମସ୍କର' (best-effort: Hunterian drops ā)
Phonetic typing¶
openodia.roman needs a release newer than 0.1.14. roman.type_odia needs a release newer than 0.2.0: it raises AttributeError on 0.2.0. roman.type_odia turns Roman typing into Odia, offline, without an IME.
Each ASCII word is the bundled-dictionary word with that folded Hunterian
spelling, and the more common gloss wins when several words share it.
Spaces and punctuation are left where they were. from_roman("namaskara", "Hunterian")
is still ନମସ୍କର; typing is a different call, and it is not openodia.phonetic.
roman.type_odia("namaskara") # 'ନମସ୍କାର'
roman.type_odia("odisha bhasha") # 'ଓଡ଼ିଶା ଭାଷା'
roman.type_odia("ki bhabare achanti") # 'କି ଭାବରେ ଅଛନ୍ତି'
roman.type_odia("ki", candidates=True) # ['କି', 'କୀ']
Round-trip
The nukta ଼ has no precomposed form after most consonants, so it gets its own
mark: · (U+00B7) in ISO 15919 and ` in ITRANS (ଖୋଜ଼ gives khōj·a and
khoj`a). Hunterian drops it (khoja). ଡ଼ and ଢ଼ keep their own
letters in all three schemes: ṛ/ṛh in ISO 15919, .D/.Dh in ITRANS,
and r/rh in Hunterian (where plain ଡ and ଢ give d/dh).
from_roman reads each scheme's mark back as the nukta, so
reversible=True quotes a literal · (ISO 15919) or ` (ITRANS).
By default, non-Odia text comes back exactly as given
(to_roman("file_name ନମସ୍କାର", "ITRANS") keeps file_name).
In ISO15919 and ITRANS, from_roman(to_roman(text, scheme, reversible=True),
scheme) gives back text with each run of Odia characters (U+0B00-U+0B7F) in NFC
and all other characters unchanged. NFC Odia therefore comes back with the same code
points, including vowel signs, viramas and nuktas that follow no consonant or follow
ZWJ/ZWNJ.
In all three schemes, each run of Odia characters (U+0B00-U+0B7F) in the output of
from_roman is in NFC, including Odia passed through or quoted in the input, so
U+0B5C gives U+0B21 U+0B3C. Non-Odia characters that from_roman does not decode
are left as given, except that ISO15919 applies NFC to its input outside quotes.
Hunterian is intentionally lossy; decoding is best-effort.
Hunterian from_roman decodes no Roman spelling as anusvara, candrabindu or visarga: an n or h that is not part of a longer letter such as ng or kh decodes as the consonant ନ or ହ. Odia ଂ, ଁ and ଃ in the input pass through.
For example, jesan gives ଜେସନ୍ and anka gives ଅନ୍କ; use ISO15919 or
ITRANS to keep anusvara and visarga. Where two tokens would otherwise merge, a boundary mark is
written (ka:i for କଇ in ISO 15919, ka_i in ITRANS). The same mark
after a consonant means a halant before a vowel (k:a for କ୍ଅ).
Hunterian and ITRANS write the Odia digits ୦-୯ as ASCII 0-9
(to_roman("୨୦୨୬", "ITRANS") gives 2026); from_roman keeps ASCII
digits as they are. ISO15919 keeps the Odia digits, and so does ITRANS with
reversible=True, because an ASCII digit could not be told from a literal one.
Hunterian ignores reversible and still writes ASCII digits
(to_roman("୨୦୨୬", "Hunterian", reversible=True) gives 2026).
For text that contains anything other than Odia, pass reversible=True:
a literal : (ISO) or _ (ITRANS) is doubled, and a non-Odia run that
could be read as Roman letters (or that has a character with a nonzero
canonical combining class, unicodedata.combining(c) != 0) is quoted
and kept verbatim by from_roman (roman.to_roman("କi",
reversible=True) gives ka:{i:}). A vowel sign or virama that follows no
consonant is passed through like non-Odia text and quoted by the same rule:
a virama has a nonzero canonical combining class, so it is quoted
(to_roman("ଅ୍", reversible=True) gives a:{୍:}); a vowel sign has
combining class 0 and is written as itself
(to_roman("ଓା", reversible=True) gives ōା) unless its run is quoted
(to_roman("୍ା", reversible=True) gives :{୍ା:}).
The avagraha ଽ is written ’ in ISO 15919, ' in Hunterian and .a in
ITRANS. from_roman in ITRANS also reads the common spellings aa, ii,
uu, R^i, R^I, L^i and L^I; to_roman keeps writing A, I,
U and RRi. from_roman in Hunterian reads ri and li as consonant
plus vowel sign (oria gives ଓରିଅ), not as the vocalic ଋ or ଌ.
Command-line interface¶
- Installing the package adds an
openodiacommand. Each subcommand wraps a function from the library so they're scriptable from any shell. - Add
--jsonto a subcommand for one machine-readable JSON document on stdout. This needs a release newer than 0.1.14: PyPI 0.1.14 has--jsonondetect-languageonly, and other subcommands exit with code 2 there. See AGENTS.md for the JSON shapes and exit codes, and llms.txt for an index aimed at AI agents. - Pass
-as the text argument to read from stdin. Pass--fileto read the text argument from a UTF-8 file; without it, an argument is always literal text, even if it matches a file name.
openodia --help
# Tokenisation
openodia tokenize "ରାମ ଓ ସୀତା ଆସୁଛନ୍ତି"
openodia tokenize --file input.txt --sentences
# Normalisation / cleanup
openodia normalize --file input.txt --form NFC
openodia clean " ନମସ୍କାର ଓଡ଼ିଆ " --latin-to-odia
# Translation
openodia translate "ନମସ୍କାର!ଭଲ ଲାଗୁଛି?" --from or --to en
echo "hello! feeling good?" | openodia translate - --from en --to or
# Language detection
openodia detect-language "ନମସ୍କାର" --json
# Random Odia names
openodia name --kind first --count 5
# Extractive summary
openodia summarize --file article.txt --threshold 3
# Find or mask phone, email, URL, Aadhaar, PAN, PIN code, date
openodia pii "ମୋ ଫୋନ ୯୮୭୬୫୪୩୨୧୦" --mask
# Stopword removal + corpus stats
openodia remove-stopwords "ରାମ ଓ ସୀତା"
openodia ngrams "ରାମ ସୀତା ଲକ୍ଷ୍ମଣ" -n 2
openodia freq --file corpus.txt --top 20
Translation cache¶
- Translations are memoised in an LRU. Defaults to 10,000 entries in memory.
- The cache is thread-safe, so sync and async translation can share it.
- Resize the cache, plug in a persistent disk backend, or inspect hit/miss counters.
- Environment variables
OPENODIA_CACHE_MAX_SIZEandOPENODIA_CACHE_DISKset defaults at process start.
from openodia import cache
cache.stats()
# {'hits': 0, 'misses': 0, 'size': 0, 'max_size': 10000, 'disk_size': 0}
# Resize the in-memory LRU.
cache.configure(max_size=50_000)
# Persist across runs (requires the [cache] extra: pip install openodia[cache]).
cache.configure(max_size=50_000, disk_path="~/.cache/openodia/translate")
cache.clear()
Disk persistence is opt-in
Disk persistence is gated behind the [cache] extra, which pulls in
diskcache. Calling
cache.configure(disk_path=...) without the extra raises a clear
ImportError. The base install has no new dependency.
Numbers and words¶
- Convert between integers and Odia words, in both Indian (lakh / crore) and short (million / billion / trillion) numbering scales.
- Verbalise dates, currency amounts, and ordinals.
- Bidirectional Odia ↔ ASCII digit conversion.
from openodia import numbers
# Cardinal numbers
numbers.to_words(1234)
# 'ଏକ ହଜାର ଦୁଇ ଶହ ଚଉତିରିଶ'
numbers.to_words(12_34_567) # Indian: lakh / crore
# 'ବାର ଲକ୍ଷ ଚଉତିରିଶ ହଜାର ପାଞ୍ଚ ଶହ ସତଷଠି'
numbers.to_words(1_000_000, scale="short")
# 'ଏକ ମିଲିୟନ'
numbers.to_words(-100)
# 'ଋଣାତ୍ମକ ଏକ ଶହ'
# Reverse direction
numbers.from_words("ଏକ ହଜାର ଦୁଇ ଶହ ଚଉତିରିଶ") # 1234
# Ordinals (1..10 irregular, 11+ uses 'ତମ' suffix)
numbers.to_ordinal(3) # 'ତୃତୀୟ'
numbers.to_ordinal(11) # 'ଏଗାରତମ'
# Currency
numbers.to_words_currency(1500.50)
# 'ଏକ ହଜାର ପାଞ୍ଚ ଶହ ଟଙ୍କା ପଚାଶ ପଇସା'
# Date verbalisation
from datetime import date
numbers.to_words_date(date(2026, 5, 27))
# '<day ordinal> ମଇ, ଦୁଇ ହଜାର ଛବିଶ'
# Digit conversion
numbers.ascii_to_odia("2026") # '୨୦୨୬'
numbers.odia_to_ascii("୨୦୨୬") # '2026'
Number words 0..99
The Odia counting table below 100 lives at openodia/numbers/_tables.py
as a single tuple of length 100. Native-speaker corrections land there
and are picked up by every API in this module automatically.
Sentence segmenter¶
- Splits text into sentences on Odia (
।,॥) and Latin (.,?,!,…) terminators. - Decimal numbers (
୨.୫,2.5) and common abbreviations (ଡଃ,Dr.,e.g.) do not trigger a split. - Each sentence keeps its terminator by default.
from openodia import sentences
sentences("ଆଜି ୨.୫ କୋଟି। ଆଗକୁ କଣ? ଭଲ ଦିନ!")
# ['ଆଜି ୨.୫ କୋଟି।', 'ଆଗକୁ କଣ?', 'ଭଲ ଦିନ!']
sentences("ଡଃ ସୁନୀତା ଆସିଲେ। ସେ କଲେଜରେ ପଢ଼ାନ୍ତି।")
# ['ଡଃ ସୁନୀତା ଆସିଲେ।', 'ସେ କଲେଜରେ ପଢ଼ାନ୍ତି।']
# Strict mode: only Odia terminators trigger splits.
sentences("Hi. ତୁମେ କେମିତି।", mode="strict")
# ['Hi. ତୁମେ କେମିତି।']
# Strip terminators
sentences("Hello. World!", keep_terminators=False)
# ['Hello', 'World']
Extending the abbreviations list
openodia.segment.ABBREVIATIONS is a public tuple. Project-specific
vocabulary (e.g. trade names, place abbreviations) can be added by
extending it in a wrapper module.
ud.sentence_tokenizer and sentences() differ
ud.sentence_tokenizer splits on ।, ॥, ? and ! only.
openodia.sentences() also splits on . and … and knows Odia
abbreviations. summarize and tokenize --sentences use the former.
Odia spell checker¶
openodia.spellchecks a word, suggests dictionary corrections, and rewrites text. It is offline and adds no dependency. It needs a release newer than 0.2.0:openodia spellexits 2 on 0.2.0, andimport openodia.spellfails on 0.2.0.- A suggestion is a dictionary word within akshara edit distance 2, closest first. Among words at the same akshara distance, each letter closer counts as much as appearing about 3.8 times as often in the offline dictionary. Letters are NFC code points, so a vowel sign such as
ୌis one letter.correct_textkeeps whitespace, punctuation, digits and non-Odia text, and leaves a word unchanged when nothing is within distance 2.
from openodia import spell
spell.is_correct("ନମସ୍କାର")
spell.suggest("ନମସ୍କର", top_k=5)
spell.correct_text("ସେ ଆମ ଘରକୁ ଆସୁଛନ୍ତ")
openodia spell "ସେ ଆମ ଘରକୁ ଆସୁଛନ୍ତ"
openodia spell --suggest --top 1 "ନମସ୍କର"
PII detection and masking¶
openodia.piifinds and masks personal identifiers in Odia text with patterns and one checksum. It is offline and adds no dependency. It needs a release newer than 0.1.14:openodia piiexits 2 on 0.1.14 andimport openodia.piifails there.DATEneeds a release newer than 0.2.0: on 0.2.0,pii.detect(text, types=["DATE"])raisesValueErrorandopenodia pii --type DATEexits 2.- Odia digits (
୦-୯) and ASCII digits are both recognised. Offsets in the result count characters of your original text. On the command line they count the text it read:--filedrops a leading BOM and turns CRLF and a lone CR into LF.-(stdin) drops a leading BOM only and keeps any\r: a Linux or macOS pipe delivers\r\nunchanged, so offsets from-can differ from--fileby one per line break. - Matches that overlap merge into one span typed by the longest match, so for every detected value no part of it stays visible; see the limits below. A tie goes to the earlier of
EMAIL,URL,AADHAAR,PAN,PHONE,PINCODE,DATE.min_confidenceis applied before merging. openodia pii --jsonputs the raw matchedtextin every entity, so it contains the PII. Use--mask --jsonfor output that holds only the masked text.
from openodia import pii
text = "ମୋ ଫୋନ ୯୮୭୬୫୪୩୨୧୦, ମେଲ a@b.com, ଆଧାର ୨୩୪୫ ୬୭୮୯ ୦୧୨୪, PIN ୭୫୧୦୦୧"
pii.detect(text)
# [PIIEntity(type='PHONE', text='୯୮୭୬୫୪୩୨୧୦', start=7, end=17, confidence=0.9), ...]
pii.mask(text)
# 'ମୋ ଫୋନ <PHONE>, ମେଲ <EMAIL>, ଆଧାର <AADHAAR>, PIN <PINCODE>'
pii.mask(text, types=["EMAIL"], placeholder=lambda entity: "***")
pii.detect(text, min_confidence=0.9)
| Type | What it matches | Confidence |
|---|---|---|
PHONE |
10-digit Indian mobile starting 6-9, optional +91, (+91), 0091, 91 followed by a space or -, or 0; optional space or - after the fifth digit |
0.9 |
EMAIL |
local@domain.tld; the local part is up to 64 characters of letters, digits and . _ % + - ! # $ & ' * / = ? ^ ` { | } ~ (RFC 5322 atext), top-level domain of two or more letters. A longer local part is not found, and if it contains punctuation only its last 64 characters may be masked, so the earlier part stays visible; this is a deliberate limit left for a follow-up. A domain label over 63 characters is not matched: if it is the first label the whole address stays visible (a@ + 64 b + .com is unchanged), and a later one leaves a tail (a@x. + 64 b + .com gives <EMAIL>b.com). A local part that starts with non-ASCII letters, such as ଅଭିa@x.com, is masked only from the first ASCII character, so ଅଭି stays visible |
0.95 |
URL |
http://, https:// or www. in any letter case, so HTTPS:// and WWW. are found (not glued to a letter, digit, @, . or - before it) up to whitespace; an apostrophe inside the URL is part of it (https://x.com/O'Connor?token=s is one <URL>), but one that closes a quoted URL is left out unless a URL character follows it ('https://a.com/x'+p, 'https://a.com/x'/y and 'https://a.com/x'9876543210 are masked to the end, which only over-masks), and so is one that ends the URL or comes before . , ; : ! ? ) ]; trailing . , ; : ! ? ) ] and । are left out |
0.9 |
AADHAAR |
12 digits starting 2-9, contiguous or grouped 4-4-4 by one space or -. 0.95 when the Verhoeff checksum passes, 0.5 when it fails |
0.95 / 0.5 |
PAN |
AAAPA1234A: uppercase, fourth letter one of PCHFATBLJG |
0.95 |
PINCODE |
6 digits, first 1-9, directly after PIN, Pincode, PIN code or ପିନ |
0.8 |
DATE |
A real calendar day from 1900 to 2099. Named: D Month YYYY or Month D, YYYY with an English or Odia month name (15 January 2024, 15th Jan. 2024, May 4, 2024, ୧୫ ଜାନୁଆରୀ ୨୦୨୪), confidence 0.85. Digits only, day-month-year with /, - or . (15/01/2024, 5.1.2024), confidence 0.7. 31/02/2024, month 13, years outside that range and a date split by a line break are not found |
0.85 / 0.7 |
The wider local-part class can mask more than the address: leading delimiters can be swallowed, so key=val@host.com, ?q=a@b.com, path/to/a@c.com and price$5@x.com lose their prefix, `a@b.com`, 'a@b.com' and **a@b.com** swallow only the leading delimiter, ssh://git@host.com loses // (ssh://git@host has no top-level domain and stays unchanged), and www.x.com/a@b.com becomes <EMAIL> instead of <URL>; nothing leaks.
Confidence ranks how specific a pattern is; it is not a probability.
What it does not catch
- Names, nicknames and addresses. A masked text can still identify a person, so this is not anonymisation.
- Dates outside the
DATEshapes, such as15 Januarywith no year or01/13/2024month first, amounts, bank account and card numbers, landline numbers, passport and voter IDs. - Lowercase PAN, Aadhaar written with other separators or split by line breaks, and a PIN code with no
PINorପିନbefore it. - Aadhaar numbers starting with 0 or 1, which UIDAI does not issue.
- A bare domain with no
http(s)://orwww., an email whose local part is over 64 characters (see theEMAILrow), and digits of other scripts such as Devanagari. - False positives: a 10-digit number starting 6-9 (an order or account number) is reported as
PHONEeven if nobody owns it, a 12-digit number starting 2-9 asAADHAARat confidence 0.5, and a PAN-shaped code asPAN, and a real calendar date that is not personal (including1.2.2024) asDATE. Filter withtypesandmin_confidence. - A bare
91before a mobile number is taken as its country code only when a space or-follows it.
maskrepeats detection and replacement until nothing changes, at most 10 passes, because masking a value can expose one that was glued to it, such as a PAN written right before a URL. With the default<TYPE>tags, masking its own output therefore changes nothing, unless the input chains more than 10 glued values. Past that, the textmaskreturns can still contain raw PII, so do not rely on it for input like that. A customplaceholderreceives entities from the later passes too, with offsets into the partly masked text, and one that returns PII-shaped text, for example one that keeps the last four digits, can keep the loop running to its limit.detectandmaskraiseTypeErrorfor atextthat is not astrortypesgiven as a bare string, andValueErrorfor an unknown type or amin_confidenceoutside 0 to 1.- There is no pseudonymisation or reversible mapping: masking is one-way.
Odia alphabets¶
- To get the Odia alphabets use the
alphabetmodule
from openodia import alphabet
alphabet.all_letters
'''
['ଁ', 'ଂ', 'ଃ', 'ଅ', 'ଆ', 'ଇ', 'ଈ', 'ଉ', 'ଊ', 'ଋ', 'ଌ', 'ଏ', 'ଐ', 'ଓ', 'ଔ',
'କ', 'ଖ', 'ଗ', 'ଘ', 'ଙ',
'ଚ', 'ଛ', 'ଜ', 'ଝ', 'ଞ',
'ଟ', 'ଠ', 'ଡ', 'ଢ', 'ଣ',
'ତ', 'ଥ', 'ଦ', 'ଧ', 'ନ',
'ପ', 'ଫ', 'ବ', 'ଭ', 'ମ',
'ଯ', 'ର', 'ଲ', 'ଳ', 'ଵ', 'ଶ', 'ଷ', 'ସ', 'ହ',
'ଡ଼', 'ଢ଼', 'ୟ', 'ୠ', 'ୡ',
'଼', 'ଽ', 'ା', 'ି', 'ୀ', 'ୁ', 'ୂ',
'ୃ', 'ୄ', 'େ', 'ୈ', 'ୋ', 'ୌ', '୍', 'ୖ', 'ୗ',
'ୢ', 'ୣ', '୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯',
'୰', 'ୱ', '୲']
'''
alphabet.consonants
'''
['କ', 'ଖ', 'ଗ', 'ଘ', 'ଙ',
'ଚ', 'ଛ', 'ଜ', 'ଝ', 'ଞ',
'ଟ', 'ଠ', 'ଡ', 'ଢ', 'ଣ',
'ତ', 'ଥ', 'ଦ', 'ଧ', 'ନ',
'ପ', 'ଫ', 'ବ', 'ଭ', 'ମ',
'ଯ', 'ର', 'ଲ', 'ଳ', 'ଵ',
'ଶ', 'ଷ', 'ସ', 'ହ']
'''
alphabet.vowels
'''
['ଅ', 'ଆ', 'ଇ', 'ଈ', 'ଉ', 'ଊ', 'ଋ', 'ଌ', 'ଏ', 'ଐ', 'ଓ', 'ଔ']
'''
alphabet.numbers
'''
['୦', '୧', '୨', '୩', '୪', '୫', '୬', '୭', '୮', '୯']
'''
alphabet.matras
'''
['ଁ', 'ଂ', 'ଃ', '଼', 'ଽ', 'ା', 'ି', 'ୀ', 'ୁ', 'ୂ',
'ୃ', 'ୄ', 'େ', 'ୈ', 'ୋ', 'ୌ', '୍', 'ୖ', 'ୗ', '୰', 'ୱ', '୲']
'''
Odia names¶
- You can generate Odia names using the
namemodule with the following syntax:
from openodia import name
name.generate_names()
'''
['ଯଦୁମଣୀ ମାଢ଼ୀ', 'ବାସନ୍ତି ବ୍ରହ୍ମା', 'ପ୍ରବୀଣ ସିଂହ ମୁକ୍କିମ', 'ବୃନ୍ଦାବନ ଧଳ', 'ଅଶ୍ୱିନୀ କିଶୋର ଜଗଦେବ',
'ଶ୍ରୀଯୁକ୍ତ ଇରାଶିଷ ସେଠୀ', 'କୁମାରୀ ସୁମନ ସିଂଦେଓ', 'ସଲିଲ ଅଲ୍ଲୀ ଛତ୍ରିଆ', 'ଦିବାକରନାଥ ରାଧାରାଣୀ ଆଚାର୍ଯ୍ୟ', 'ଦୁର୍ଗା ସୁନ୍ଦରସୁର୍ଯ୍ୟା ପୁଟୀ']
'''
from openodia import name
name.generate_names(20)
'''
['ସାବିତ୍ରୀ ଧଳ', 'ଶ୍ରୀଯୁକ୍ତ ଉତ୍କଳ ପାଳ', 'ଯଦୁମଣି ସୁବାହୁ', 'ପ୍ରେମଲତା ପମ', 'ଗୁରୁ ପୃଷ୍ଟି',
'ଗୀତା ଦାସବର୍ମା', 'କୁମାରୀ ଦୁର୍ଗା ବ୍ରହ୍ମା', 'କୁମାରୀ ପୁପୁଲ ହେମ୍ବ୍ରମ', 'ମକର ସାଇ', 'ଲକ୍ଷ୍ମୀକାନ୍ତ ନନ୍ଦି',
'ଶ୍ରୀ ଦୀନବନ୍ଧୁ ଲୋକ', 'କୁମାରୀ ଜିନା ଗଜପତି', 'ମୃଣାଳ ଭୂଷଣ ଛତ୍ରିଆ', 'ସୁଧାଂଶୁମାଳିନୀ ସିଂହ ସାଲୁଜା', 'ସୁଧାଂଶୁମାଳିନୀ ମହାନନ୍ଦ',
'ସୁମନୀ ନାଥ', 'କୁମାରୀ ନୀତୁ ହିକ୍କା', 'ଶ୍ରୀମତୀ ଲୀଳା କାଡାମ୍', 'ସନାତନ କୁଅଁର', 'କୁମାରୀ କବି ଦାସନାୟକ']
'''
from openodia import name
name.generate_firstnames()
'''
['ଅନିରୁଦ୍ଧ', 'ଦେବରାଜ', 'ଆଶ୍ରିତ', 'ବଦ୍ରି', 'ସଦାଶିବ',
'ପ୍ରଦିପ୍ତ', 'ଧୃବ', 'ଶ୍ରୀନାଥ', 'ସ୍ନିତି', 'ପ୍ରକୃତି']
'''
name.generate_prefixes()
'''
['ଶ୍ରୀଯୁକ୍ତ', 'ଶ୍ରୀମତୀ', 'କୁମାରୀ', 'ଶ୍ରୀମାନ', 'ସୁଶ୍ରୀ', 'ଶ୍ରୀ']
'''
name.generate_middlenames()
'''
['ଲେଖା', 'ଶ୍ରୀ', 'ମାଧବ', 'କେତନ', 'ଯୋଶେଫ୍',
'କେଶରୀ', 'ଭୂଷଣ', 'ରାଧାରାଣୀ', 'ମାନସିଂହ', 'କିଶୋର']
'''
name.generate_surnames()
'''
['ପରିଜା', 'ରଣସିଂହ', 'ମହାପାତ୍ର', 'ରଥ', 'ମହନ୍ତ',
'ବେହେରା', 'ଦେଓ', 'ଧଳ', 'ଦିଆନ', 'ହିମିରିକା']
'''
Detect Odia Language¶
- A binary language classification method used which will return if the input text is in Odia language or in any other non-Odia language.
- Along with this a confidence score also returned. The score provides how confident the library is that it is Odia or Non-Odia.
- There is a
thresholdparameter to the method which can be configured to tune the confidence score threshold after which it will be regarded as Odia. The default value is 0.5.
from openodia import ud
ud.detect_language("hey how are you?")
'''
{'language': 'non-odia', 'confidence_score': 1.0}
'''
ud.detect_language("hey how are you? ନ୍ୟାଚୁରାଲ ଲାଙ୍ଗୁଏଜ ପ୍ରୋସେସିଂ")
'''
{'language': 'odia', 'confidence_score': 0.67}
'''
ud.detect_language(
"hey how are you? ନ୍ୟାଚୁରାଲ ଲାଙ୍ଗୁଏଜ ପ୍ରୋସେସିଂ",
threshold=0.7)
'''
{'language': 'non-odia', 'confidence_score': 0.33}
'''
ud.detect_language(
"ନ୍ୟାଚୁରାଲ ଲାଙ୍ଗୁଏଜ ପ୍ରୋସେସିଂ ବା ପ୍ରାକୃତିକ ଭାଷା ପ୍ରକ୍ରିୟାକରଣ କଂପ୍ୟୁଟର ବିଜ୍ଞାନ ଏବଂ "\
"ଆର୍ଟିଫିସିଆଲ ଇଣ୍ଟେଲିଜେନ୍ସର ସେହି ବିଭାଗକୁ କୁହାଯ ାଏ ଯାହା" \
"ମନୁଷ୍ୟର ଭାଷାଗୁଡ଼ିକ ସହ କମ୍ପ୍ୟୁଟରର କଥାବାର୍ତ୍ତାକୁ ବୁଝାଇଥାଏ।")
'''
{'language': 'odia', 'confidence_score': 0.99}
'''
Word Tokenizer¶
- To tokenize odia text into multiple words or tokens
word_tokenizermodule can be used.
from openodia import ud
ud.word_tokenizer(
"କ୍ୱାଣ୍ଟମ କମ୍ପ୍ୟୁଟିଙ୍ଗ, ହେଉଛି ଏକ ଉଦୀୟମାନ ହାର୍ଡ଼ୱେର ଏବଂ ସଫ୍ଟୱେରର ପ୍ରଯୁକ୍ତିବିଦ୍ୟା," \
"ଯାହା କଠିନ ଗାଣିତିକ ସମସ୍ୟାଗୁଡ଼ିକର ସମାଧାନ ପାଇଁ ଉପ-ପାରମାଣବିକ ଘଟଣାଗୁଡ଼ିକର ଉପଯୋଗ କରିଥାଏ ।[୧]")
'''
['କ୍ୱାଣ୍ଟମ', 'କମ୍ପ୍ୟୁଟିଙ୍ଗ', 'ହେଉଛି', 'ଏକ', 'ଉଦୀୟମାନ', 'ହାର୍ଡ଼ୱେର', 'ଏବଂ',
'ସଫ୍ଟୱେରର', 'ପ୍ରଯୁକ୍ତିବିଦ୍ୟା', 'ଯାହା', 'କଠିନ', 'ଗାଣିତିକ', 'ସମସ୍ୟାଗୁଡ଼ିକର',
'ସମାଧାନ', 'ପାଇଁ', 'ଉପ', 'ପାରମାଣବିକ', 'ଘଟଣାଗୁଡ଼ିକର', 'ଉପଯୋଗ',
'କରିଥାଏ', '।', '୧']
'''
Sentence Tokenizer¶
- Tokenize a paragraph into multiple sentences.
- Splits after
।,॥,?and!, with or without a space after them, and keeps the terminator on each sentence. - A
?or!directly followed by an ASCII letter, digit or one of=&%#/_(as ina?id=5orYahoo!Mail) is not a boundary. A closing quote or bracket stays with its sentence. - A full stop
.is not a boundary here; useopenodia.sentences()for that. - A terminator with no words of its own (as in
ରାମ ଗଲା । । ସୀତା) joins the sentence before it, or the sentence after it when it comes first. Text with no words at all gives[]. - Empty or whitespace-only text gives
[].
from openodia import ud
ud.sentence_tokenizer("ଏକ ଦୁଇ । ତିନି ଚାରି ।")
'''
['ଏକ ଦୁଇ ।', 'ତିନି ଚାରି ।']
'''
Remove stopwords¶
- Frequently occurring words in a language are called as stopwords. Using the below function you can remove the stopwords.
- Internally this method calls the
word_tokenizemethod to get tokens from the text. - As most of the time processing happens in list by default a list of strings will be returned.
from openodia import ud
ud.remove_stopwords("ରାମ ଓ ସୀତା ଆମକୁ ଆଶୀର୍ବାଦ ଦେଇଛନ୍ତି")
'''
['ରାମ', 'ସୀତା', 'ଆମକୁ', 'ଆଶୀର୍ବାଦ']
'''
ud.remove_stopwords("ରାମ ଓ ସୀତା ଆମକୁ ଆଶୀର୍ବାଦ ଦେଇଛନ୍ତି ", get_str=True)
'''
'ରାମ ସୀତା ଆମକୁ ଆଶୀର୍ବାଦ'
'''
ଓ and ଦେଇଛନ୍ତି are removed from the text.
Customising the stopword list¶
STOPWORDS is a frozenset you can extend or replace per call. For richer
workflows use the Stopwords class, which supports add / remove,
loading from a file, deriving from a corpus, and saving back to disk.
from openodia import Stopwords, ud
# Start from the bundled list and tweak it.
sw = Stopwords.default().add("ପ୍ରାୟ").remove("ଓ")
ud.remove_stopwords("ରାମ ଓ ସୀତା", stopwords=sw)
# ['ରାମ', 'ଓ', 'ସୀତା'] — 'ଓ' kept because we removed it from the list
# Load a domain-specific list from disk.
legal = Stopwords.from_file("legal_stopwords.txt")
ud.remove_stopwords(article, stopwords=legal)
# Derive a list from corpus frequency.
auto = Stopwords.from_corpus(tokens, top_n=100)
auto.save("derived_stopwords.txt")
Any container supporting token in stopwords works — Stopwords,
frozenset[str], set[str], or list[str]. The bundled STOPWORDS
constant remains the default when the kwarg is omitted, so existing code
keeps working unchanged.
Translation¶
- The translation module is a wrapper on top of Google Translate API.
- There are two translation methods provided:
odia_to_other_langandother_lang_to_odia
other_lang_to_odia¶
- As the name suggests this function can be used to translate from any other language to Odia language.
- If you are translating from any other language other than English, please provide the language code of it.
from openodia import other_lang_to_odia
other_lang_to_odia("hello! feeling good?")
'''
'ନମସ୍କାର!ଭଲ ଲାଗୁଛି?'
'''
other_lang_to_odia("शेयर बाज़ार एक ऐसा बाज़ार है जहाँ कंपनियों के शेयर खरीदे-बेचे जा सकते हैं।", source_language_code="hi")
'''
'ଷ୍ଟକ୍ ମାର୍କେଟ୍ ହେଉଛି ଏକ ବଜାର ଯେଉଁଠାରେ କମ୍ପାନୀଗୁଡିକ କିଣାଯାଇପାରିବ |'
'''
odia_to_other_lang¶
- This function can be used to translate an Odia text into another language.
- The same language code you can choose from as provided above.
- By default, the function will translate to English language.
from openodia import odia_to_other_lang
odia_to_other_lang("ନମସ୍କାର!ଭଲ ଲାଗୁଛି?")
'''
'Hello! Sounds good?'
'''
Async and batch translation¶
- Async translation needs a release newer than 0.1.14:
from openodia import translate_batchfails on 0.1.14, which has no async API. From a source checkout it works. odia_to_other_lang_async,other_lang_to_odia_asyncanduniversal_translation_asyncare awaitable versions of the functions above. They share the same cache.translate_batchtranslates an iterable of strings (a list or a generator) concurrently and returns the results in input order as a list. Repeated texts are translated once.concurrency(default 8, an integer >= 1) caps the number of requests in flight.retries(default 0, an integer >= 0) retries a request afterbackoff * 2**attemptseconds, wherebackoffis a finite number >= 0. Bad values raiseValueError, and a singlestr,bytes,bytearrayormemoryviewinstead of a list, or an item that is not astr, raisesTypeError.- Only these failures are retried: a rate limit (HTTP 429), an HTTP 5xx status, and connection or timeout errors. Everything else is raised at once, including other HTTP statuses,
PermissionErrorand otherOSErrors, and unsupported language codes. deep-translator reports a failed HTTP response as aRequestErrorwithout a status, so that error is not retried and a 5xx served through it is not either. - Identical texts are translated once per call; repeats across calls come from the cache. A text of 5000 or more characters raises
NotValidLength, which aborts the whole batch unlessreturn_exceptions=True. - The first failure is raised and queued texts never start. Pass
return_exceptions=Trueto get one entry per text, either the translation or its exception. source="or"andto="or"use the same paths asodia_to_other_langandother_lang_to_odia, so English to Odia checks the offline dictionary first.
import asyncio
from openodia import translate_batch
asyncio.run(translate_batch(["ନମସ୍କାର", "ଧନ୍ୟବାଦ"], to="en", concurrency=4, retries=2))
Automatic extractive text summarization¶
Extracts the important summary snippet of a given text.
from openodia import WordFrequency
wf = WordFrequency(
text="ଭାରତୀୟ ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ, ଭାରତର ଉଚ୍ଚତମ ନ୍ୟାୟିକ ଅନୁଷ୍ଠାନ ଅଟେ ଏବଂ ଭାରତୀୟ ସମ୍ବିଧାନ ଅଧୀନସ୍ଥ "
"ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ ଅଟେ । "
"ଏହା ସର୍ବ ବରିଷ୍ଠ ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ଅଟେ ଏବଂ ଏହି ନ୍ୟାୟିକ ପୁନରାବଲୋକନର କ୍ଷମତା ରହିଛି । "
"ଭାରତର ମୁଖ୍ୟ ବିଚାରପତି ଏହାର ମୁଖ୍ୟ ଅଟନ୍ତି । ତତ୍ସହିତ ଏଥିରେ ସର୍ବାଧିକ ୩୪ ଜଣ ବିଚାରପତି ଅଛନ୍ତି । "
"ମୁଖ୍ୟ, ଅପିଲୀୟ ତଥା ପରାମର୍ଶିକ ଆଦି ଅଧିକାରକ୍ଷେତ୍ର ମାଧ୍ୟମରେ ଏହାର ବିସ୍ତୃତ କ୍ଷମତା ରହିଛି । "
"ଏହା ଭାରତରେ ସବୁଠାରୁ ଶକ୍ତିଶାଳୀ ଲୋକାନୁଷ୍ଠାନ ବୋଲି ଧରାଯାଇଅଛି । "
"ଦେଶର ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ହୋଇଥିବାରୁ, ଏହା ମୁଖ୍ୟତଃ ସଙ୍ଘର ବିଭିନ୍ନ ଉଚ୍ଚ ନ୍ୟାୟାଳୟ ତଥା "
"ଅନ୍ୟାନ୍ୟ ନ୍ୟାୟାଳୟ ଓ "
"ଟ୍ରିବ୍ୟୁନାଲମାନଙ୍କର ରାୟ ବିରୁଦ୍ଧରେ ଅପିଲ୍ ନିଏ । "
"ଏହା ନାଗରିକମାନଙ୍କର ମୌଳିକ ଅଧିକାରର ରକ୍ଷାକରେ ଏବଂ ବିଭିନ୍ନ ସରକାରୀ ଅଧିକାରୀ ତଥା "
"ଦେଶରେ କେନ୍ଦ୍ର ସରକାର ବନାମ ରାଜ୍ୟ ସରକାର କିମ୍ବା ଗୋଟିଏ ରାଜ୍ୟ ସରକାର ବନାମ ଅନ୍ୟ ରାଜ୍ୟ ସରକାର "
"ମଧ୍ୟରେ ବିବାଦର ସମାଧାନ କରେ । "
"ଏକ ପରାମର୍ଶଦାତା ହିସାବରେ, ଏହା ଭାରତୀୟ ସମ୍ବିଧାନ ଅନୁସାରେ ରାଷ୍ଟ୍ରପତିଙ୍କଦ୍ୱାରା ସୂଚୀତ ବିଭିନ୍ନ ବିଷୟବସ୍ତୁ "
"ଉପରେ ଶୁଣାଣି କରିଥାଏ । ")
wf.get_summary() # Auto threshold calculation
'''
'ଭାରତୀୟ ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ, ଭାରତର ଉଚ୍ଚତମ ନ୍ୟାୟିକ ଅନୁଷ୍ଠାନ ଅଟେ ଏବଂ ଭାରତୀୟ ସମ୍ବିଧାନ ଅଧୀନସ୍ଥ ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ ଅଟେ ।
ଏହା ସର୍ବ ବରିଷ୍ଠ ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ଅଟେ ଏବଂ ଏହି ନ୍ୟାୟିକ ପୁନରାବଲୋକନର କ୍ଷମତା ରହିଛି ।
ଭାରତର ମୁଖ୍ୟ ବିଚାରପତି ଏହାର ମୁଖ୍ୟ ଅଟନ୍ତି ।
ତତ୍ସହିତ ଏଥିରେ ସର୍ବାଧିକ ୩୪ ଜଣ ବିଚାରପତି ଅଛନ୍ତି ।
ମୁଖ୍ୟ, ଅପିଲୀୟ ତଥା ପରାମର୍ଶିକ ଆଦି ଅଧିକାରକ୍ଷେତ୍ର ମାଧ୍ୟମରେ ଏହାର ବିସ୍ତୃତ କ୍ଷମତା ରହିଛି ।
ଏହା ଭାରତରେ ସବୁଠାରୁ ଶକ୍ତିଶାଳୀ ଲୋକାନୁଷ୍ଠାନ ବୋଲି ଧରାଯାଇଅଛି ।
ଦେଶର ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ହୋଇଥିବାରୁ, ଏହା ମୁଖ୍ୟତଃ ସଙ୍ଘର ବିଭିନ୍ନ ଉଚ୍ଚ ନ୍ୟାୟାଳୟ ତଥା ଅନ୍ୟାନ୍ୟ ନ୍ୟାୟାଳୟ ଓ ଟ୍ରିବ୍ୟୁନାଲମାନଙ୍କର ରାୟ ବିରୁଦ୍ଧରେ ଅପିଲ୍ ନିଏ ।
ଏହା ନାଗରିକମାନଙ୍କର ମୌଳିକ ଅଧିକାରର ରକ୍ଷାକରେ ଏବଂ ବିଭିନ୍ନ ସରକାରୀ ଅଧିକାରୀ ତଥା ଦେଶରେ କେନ୍ଦ୍ର ସରକାର ବନାମ ରାଜ୍ୟ ସରକାର କିମ୍ବା ଗୋଟିଏ ରାଜ୍ୟ ସରକାର ବନାମ ଅନ୍ୟ ରାଜ୍ୟ ସରକାର ମଧ୍ୟରେ ବିବାଦର ସମାଧାନ କରେ ।
ଏକ ପରାମର୍ଶଦାତା ହିସାବରେ, ଏହା ଭାରତୀୟ ସମ୍ବିଧାନ ଅନୁସାରେ ରାଷ୍ଟ୍ରପତିଙ୍କଦ୍ୱାରା ସୂଚୀତ ବିଭିନ୍ନ ବିଷୟବସ୍ତୁ ଉପରେ ଶୁଣାଣି କରିଥାଏ ।'
'''
wf.get_summary(threshold=3.0) # higher the threshold lesser the summary text
'''
'ଭାରତୀୟ ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ, ଭାରତର ଉଚ୍ଚତମ ନ୍ୟାୟିକ ଅନୁଷ୍ଠାନ ଅଟେ ଏବଂ ଭାରତୀୟ ସମ୍ବିଧାନ ଅଧୀନସ୍ଥ ସର୍ବୋଚ୍ଚ ନ୍ୟାୟାଳୟ ଅଟେ ।
ଏହା ସର୍ବ ବରିଷ୍ଠ ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ଅଟେ ଏବଂ ଏହି ନ୍ୟାୟିକ ପୁନରାବଲୋକନର କ୍ଷମତା ରହିଛି ।
ଦେଶର ସାମ୍ବିଧାନିକ ନ୍ୟାୟାଳୟ ହୋଇଥିବାରୁ, ଏହା ମୁଖ୍ୟତଃ ସଙ୍ଘର ବିଭିନ୍ନ ଉଚ୍ଚ ନ୍ୟାୟାଳୟ ତଥା ଅନ୍ୟାନ୍ୟ ନ୍ୟାୟାଳୟ ଓ ଟ୍ରିବ୍ୟୁନାଲମାନଙ୍କର ରାୟ ବିରୁଦ୍ଧରେ ଅପିଲ୍ ନିଏ ।
ଏହା ନାଗରିକମାନଙ୍କର ମୌଳିକ ଅଧିକାରର ରକ୍ଷାକରେ ଏବଂ ବିଭିନ୍ନ ସରକାରୀ ଅଧିକାରୀ ତଥା ଦେଶରେ କେନ୍ଦ୍ର ସରକାର ବନାମ ରାଜ୍ୟ ସରକାର କିମ୍ବା ଗୋଟିଏ ରାଜ୍ୟ ସରକାର ବନାମ ଅନ୍ୟ ରାଜ୍ୟ ସରକାର ମଧ୍ୟରେ ବିବାଦର ସମାଧାନ କରେ ।'
'''
Offline Dictionary¶
- An offline dictionary will be downloaded as soon as you install this library.
- Therefore, when you translate from English to Odia words/phrases it will hit the offline dictionary first, if not found it will go for the Google translate API.
- Google Translate API responses have been cached, therefore from the 2nd call onwards on the same term(s) it will fetch fast from the local in-memory cache.
- We have used LRU (Least Recently Used) cache with a maximum size of 10000.
English to Odia translation Workflow
Therefore, we have three flows on English to Odia dictionary translation:
- English text → Check in Offline dictionary → Found → Return result
- English text → Check in Offline dictionary → Not Found → Check in Cache → Found → Return result from Cache
- English text → Check in Offline dictionary → Not Found → Check in Cache → Not Found → Hit Google Translate API → Update the Cache → Return result
Legacy fonts¶
openodia.legacy needs a release newer than 0.2.0: import openodia.legacy fails on 0.2.0. legacy.decode reads the bytes of text typed in an 8-bit Odia font as keystroke characters: cp1252 for each defined byte, while 0x81, 0x8D, 0x8F, 0x90 and 0x9D, which that codec leaves undefined, stay as those code points. legacy.to_unicode(text, font="ORTTSarala") converts those keystrokes to NFC Unicode Odia, so ଡ଼ is consonant plus nukta. SUPPORTED_FONTS is ("ORTTSarala",).
from openodia import legacy
legacy.decode(b"JX\xcf\x85") # 'JXÏ…'
legacy.to_unicode(legacy.decode(b"JX\xcf\xdeA"), font="ORTTSarala") # 'ଓଡ଼ିଆ'
After the glyph table, to_unicode rebuilds each syllable in Unicode order: reph, base consonant, subjoined forms in the order typed, vowel sign, then nasal or visarga. A reph, vowel sign, nasal or visarga typed before a subjoined form gives the same output as typed after it (ÒLÕÔÍ and ÒLÔÍÕ both give କ୍ୟ୍ରେଂ). A reph typed in a syllable with no base consonant stays where it was typed. The left matra Ò, typed before the consonant, joins its right half ß, × or Ð into ୈ, ୌ or ୋ wherever that half is typed in the syllable (ÒLàÔß and ÒLÔßà both give ର୍କ୍ୟୈ). Only the first right half joins it, and a later one stays as typed (ÒLÐß gives କୋß). A second Ò in the same syllable gives େ after the joined sign (ÒLÒÐ gives କୋେ). A second reph in the same syllable is dropped (Làà gives ର୍କ). Nasals and visarga keep the order typed (LÓÕ gives କଃଂ). A nukta, Ï or a Unicode ଼, goes right after the consonant typed last before it in the same syllable, ahead of any halant or zero-width joiner, also when a vowel sign, nasal, visarga or reph is typed in between (XÐÏ and XÏÐ both give ଡ଼ା). In a syllable with no consonant, a nukta goes ahead of the vowel signs. ú typed after କ, ସ or ପ puts a half ta before that consonant (DLúf gives ଉତ୍କଳ). A run of numeric separators all convert (1Ð2Ð3 gives ୧|୨|୩). The ORTTSarala glyph table and the ú half-ta rule come from the OdiaWikimedia ORTT-Sarala converter, https://github.com/OdiaWikimedia/Converter.
Known Issues¶
- There are few issues in the code an be found here.
- Contributions are highly welcomed.
Roadmap¶
In the upcoming future the following features will be implemented in the package.
- Add English-Odia Parallel corpus
- Add Odia Monolingual corpus
- Add NER dataset of places, actors, etc.
- Robust paragraph to sentence tokenizer covering edge cases
- Stemming tool
- Customized stopword support
- Add OdiaBert
- Improve the CI/CD pipeline
Quote
"In my dream of the 21st century for the State, I would have young men and women who put the interest of the State before them. They will have pride in themselves, confidence in themselves. They will not be at anybody’s mercy, except their own selves. By their brains, intelligence and capacity, they will recapture the history of Kalinga." - Biju Pattnaik
To cite this page, please use:
@misc{OpenOdia,
author = {Soumendra Kumar Sahoo},
title = {OpenOdia Documentation},
howpublished = {\url{https://www.openodia.soumendrak.com/}},
year = {2021}
}