Romanisation¶
roman ¶
Romanisation (Odia ↔ Latin script).
Examples:
>>> from openodia import roman
>>> roman.to_roman("ଓଡ଼ିଆ", scheme="ISO15919")
'ōṛiā'
>>> roman.to_roman("ଓଡ଼ିଆ", scheme="Hunterian")
'oria'
>>> roman.to_roman("ଓଡ଼ିଆ", scheme="ITRANS")
'o.DiA'
from_roman ¶
from_roman(text: str, scheme: Scheme = 'ISO15919') -> str
Reverse of to_roman.
Best-effort for Hunterian since that scheme is intentionally lossy (no
diacritics). 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. ନ୍ endings and clusters such as ନ୍ସ
and ଙ୍କ come back intact; anusvara and visarga need the explicit marks of
ISO15919 (ṁ, ḥ) or ITRANS (M, H).
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.
The decoder tracks context: a vowel straight after a consonant becomes
a vowel sign (ā after n gives ନା), the inherent a adds
nothing, and a consonant with no vowel after it gets a halant.
Elsewhere a vowel is written as the independent letter (ଆ).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Roman-script input. |
required |
scheme
|
Scheme
|
Scheme to decode against. |
'ISO15919'
|
Returns:
| Type | Description |
|---|---|
str
|
Best-effort Odia output. Unknown characters pass through, with runs of |
str
|
Odia characters in NFC. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from_roman("namaskāra")
'ନମସ୍କାର'
>>> from_roman("ā")
'ଆ'
>>> from_roman("jesan", "Hunterian")
'ଜେସନ୍'
to_roman ¶
to_roman(
text: str,
scheme: Scheme = "ISO15919",
*,
reversible: bool = False,
) -> str
Transliterate Odia text to the Latin script.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Source Odia string. |
required |
scheme
|
Scheme
|
One of |
'ISO15919'
|
reversible
|
bool
|
For |
False
|
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.
A nukta after any consonant except ଡ and ଢ is written as · (ISO 15919)
or a backtick (ITRANS) right after the consonant; Hunterian drops it.
ଡ଼ and ଢ଼ keep their own letters: ṛ/ṛh (ISO 15919), .D/.Dh
(ITRANS) and r/rh (Hunterian, where plain ଡ and ଢ give d/dh).
Returns:
| Type | Description |
|---|---|
str
|
The transliterated string. Unless |
str
|
outside the Odia block come back exactly as given. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> to_roman("ଓଡ଼ିଆ", "ISO15919")
'ōṛiā'
>>> to_roman("ନମସ୍କାର", "Hunterian")
'namaskara'