Syllables¶
syllable ¶
Akshara (orthographic syllable) segmentation for Odia text.
Examples:
>>> from openodia import syllable
>>> syllable.split("ନମସ୍କାର")
['ନ', 'ମ', 'ସ୍କା', 'ର']
>>> syllable.count("ବିଦ୍ୟାଳୟ")
4
>>> syllable.hyphenate("ବିଦ୍ୟାଳୟ")
'ବି-ଦ୍ୟା-ଳ-ୟ'
count ¶
count(word: str) -> int
Number of Odia aksharas in word.
Non-Odia characters (whitespace, punctuation, digits, Latin letters) are not counted.
hyphenate ¶
hyphenate(word: str, separator: str = '-') -> str
Join aksharas with separator.
Whitespace runs in the input become natural breaks: each word is hyphenated independently and the original whitespace is preserved between them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word
|
str
|
Odia text (one or more words). |
required |
separator
|
str
|
String inserted between consecutive aksharas of the
same word. Defaults to |
'-'
|
Returns:
| Type | Description |
|---|---|
str
|
The hyphenated string. |
Examples:
>>> hyphenate("ବିଦ୍ୟାଳୟ")
'ବି-ଦ୍ୟା-ଳ-ୟ'
>>> hyphenate("ନମସ୍କାର ଓଡ଼ିଆ")
'ନ-ମ-ସ୍କା-ର ଓ-ଡ଼ି-ଆ'
split ¶
split(word: str) -> list[str]
Split a word into aksharas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
word
|
str
|
A single Odia word. Whitespace and non-Odia characters are emitted as their own units (one entry per character / run of whitespace). |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
A list of aksharas in source order. Empty input returns |
Examples:
>>> split("ନମସ୍କାର")
['ନ', 'ମ', 'ସ୍କା', 'ର']
>>> split("ଓଡ଼ିଆ")
['ଓ', 'ଡ଼ି', 'ଆ']