Romanizer
Converts Sinhala text into Roman (Latin) script using phonological character mapping.
Class
Romanizer
Section titled “Romanizer”Class to convert Sinhala scripts into phonetic Latin characters.
Constructor
Section titled “Constructor”Romanizer()
No arguments required.
Methods
Section titled “Methods”__call__
Section titled “__call__”Execute the romanization pipeline. Accepts a single string or a list of strings.
romanizer(text)
| Argument | Type | Description |
|---|---|---|
| text | str | list[str]Required | A single Sinhala text string or a list of texts to romanize. |
Code Examples
Section titled “Code Examples”Import and Load
Section titled “Import and Load”from sinlib import Romanizer
romanizer = Romanizer()Single Text Romanization
Section titled “Single Text Romanization”romanized = romanizer("මම ගෙදර ගියා")# 'mama gedara giya'Batch Romanization
Section titled “Batch Romanization”res = romanizer([ "මම සිංහල ඉගෙන ගන්නවා", "ලංකාව ලස්සන රටක්"])# ['mama sinhala igena gannawa',# 'lankawa lassana ratak']Non-Sinhala Content Preservation
Section titled “Non-Sinhala Content Preservation”romanizer("සිංහල 123 english!")# 'sinhala 123 english!'