Dhwani¶
English to Indic language phonetic conversion engine. Read more about the project here.
Installation¶
Dhwani is currently not stable. However, the developmental release is avalibale at PyPI.
Installing from PyPI¶
$ pip install dhwani
Installing from sources¶
$ git clone https://github.com/ndyashas/Dhwani.git
$ cd Dhwani
$ pip install -r requirements.txt
$ pip install -e .
Core API¶
Most of the core functionality of Dhwani can be levraged through an object of the Converter
class.
Converter
class¶
-
class
dhwani.core.converter.
Converter
(src_lang_code: str, dest_lang_code: str)¶ Bases:
object
The
dhwani.Converter
(implementation atdhwani.core.converter.Converter
) class is the main entry point for Dhwani. You can make an object of this class and configure it to perform phonetic conversion from one language to another.Parameters: - src_lang_code (str) – ISO 639-3 code of the source language.
- dest_lang_code (str) – ISO 639-3 code of the destination language.
-
convert
(src_text: str) → str¶ Converts the full source text from source language to destination language.
Parameters: src_text (str) – The text in src_lang_code
language to be convertedReturns: The text in dest_lang_code
language converted fromsrc_lang_code
Return type: str
Examples¶
Convert from English to Kannada¶
# Import the main converter class
from dhwani import Converter
# Make a converter object. The first argument is the
# ISO 639-3 code of the source language, and the second
# argument is the ISO 639-3 code of the destination language.
converter = Converter('eng', 'kan')
src_string = "kannaDa"
# Use the 'convert' method of converter object to get the converter
# string back.
dest_string = converter.convert(src_string)
# Print the result
# Note that the display for standard output needs to support the unicode
# characters.
print(dest_string)