Skip to content

Sandhi

openodia.sandhi needs a release newer than 0.1.14: import openodia.sandhi fails on 0.1.14. split and join NFC-normalize. For a compound the splitter accepts, join(split(word)) equals the NFC form of the word.

sandhi

Sandhi and compound splitting for Odia.

import openodia.sandhi fails on 0.1.14; it needs a release newer than 0.1.14. split and join NFC-normalize. For a compound the splitter accepts, join(split(word)) equals unicodedata.normalize("NFC", word).

Examples:

>>> from openodia import sandhi
>>> sandhi.split("ବିଦ୍ୟାଳୟ")
['ବିଦ୍ୟା', 'ଆଳୟ']
>>> sandhi.split("ସୂର୍ଯ୍ୟୋଦୟ")
['ସୂର୍ଯ୍ୟ', 'ଉଦୟ']
>>> sandhi.split("ରାଜ୍ୟପାଳ")
['ରାଜ୍ୟ', 'ପାଳ']
>>> sandhi.join(["ବିଦ୍ୟା", "ଆଳୟ"])
'ବିଦ୍ୟାଳୟ'

join

join(parts: Sequence[str]) -> str

Join words, applying sandhi at each boundary.

Each part is NFC-normalized before the boundary rules run.

Examples:

>>> join(["ବିଦ୍ୟା", "ଆଳୟ"])
'ବିଦ୍ୟାଳୟ'
>>> join(["ରାଜ୍ୟ", "ପାଳ"])
'ରାଜ୍ୟପାଳ'

split

split(
    word: str, *, candidates: Literal[False] = False
) -> list[str]
split(
    word: str, *, candidates: Literal[True]
) -> list[list[str]]
split(
    word: str, *, candidates: bool = False
) -> list[str] | list[list[str]]

Split a compound into the words sandhi joined.

The input is NFC-normalized before matching, and the parts of an accepted split are NFC. A lemma, and any word that does not split into two lemmas, comes back as [word] with its original spelling. candidates=True returns every accepted split, longest left part first, or [] when nothing splits. For a compound the splitter accepts, join(split(word)) equals unicodedata.normalize("NFC", word).

Examples:

>>> split("ବିଦ୍ୟାଳୟ")
['ବିଦ୍ୟା', 'ଆଳୟ']
>>> split("ରାମ")
['ରାମ']