A package used to convert indic language to iast & iast to inidc langauge viceversa
Project description
BashaFusion (PhoneticMap)
A package used to
- convert indic language like hinid, kannada, malayalam,telugu,Odia, Bengali,Gujarathi to
iast
and iast
to Other inidc langauge(hinid, kannada, malayalam,telugu,Odia, Bengali,Gujarathi) viceversa.Phonetic Word Search
: Searching word which sound similar or Phoneticly Similar in different languages like hinid, kannada, malayalam,telugu,Odia,Bengali,Gujarathi...etcNot Started
: addon for bash regual expression function to includePhonetic Word Search
for Indic LanguageInprogress
: Mapping all Indic alphabets to International Phonetic Alphabet (IPA)Not Started
: Generated Phonetic Word given new indic word using Phonetic Mapped AlphabetNot Started
: Generating audio file for indic wordNot Started
: Pull request of Postgress to include Phonetic Alphabet Search in IPA and IAST format
Installation
pip install BashaFusion
Usage
import sqlite3
import os
import sys
from BashaFusion import BashaFusion
#create a IAST object
bshf = BashaFusion()
# customization
# bshf = BashaFusion(db_path='iast-token.db', table_name_alpha='IndianAlphabet',table_name_barakadi='Barakhadi')
Converting All Indic language(hinid, telugu, kannada, Malayalam, Odia, Bengali&Assamese, Gujarati, tamil) to iast
InProgress
Research and Analysis is going on in Tamil Script, Nastaliq Script, Sinhala Script.
bshf.to_iast('''ଧୃତରାଷ୍ଟ୍ର ଉଵାଚ |\tধৃতরাষ্ট্র উবাচ |\tધૃતરાષ્ટ્ર ઉવાચ |\tத்றுதராஷ்ட்ர உவாச |''')
# >>>
# dhr̥tarāṣṭra uvāca | dhr̥tarāṣṭra ubāca | dhr̥tarāṣṭra uvāca | ta்ṟutarāṣa்ṭa்ra uvāca |
Convert iast
to Indic Language
Currently this can convert IAST
to kannada, hindi, telugu, malyalam
word = 'kaṁ itāḥ kiṁ yuyutsavaḥ kl̥̄ kl̥ pāṇḍavānīkaṁ itāḥ kiṁ āṁ īṁ yuyutsuṁ kiṁ rānsakhīṁstathā'
print(BashaFusion.iast2tokens( word) )
# >>> ['k', 'a', 'ṁ', ' ', 'i', 't', 'ā', 'ḥ', ' ', 'k', 'i', 'ṁ', ' ', 'y', 'u', 'y', 'u', 't', 's', 'a', 'v', 'aḥ', ' ', 'k', 'l̥̄', ' ', 'k', 'l̥', ' ', 'p', 'ā', 'ṇ', 'ḍ', 'a', 'v', 'ā', 'n', 'ī', 'k', 'a', 'ṁ', ' ', 'i', 't', 'ā', 'ḥ', ' ', 'k', 'i', 'ṁ', ' ', 'ā', 'ṁ', ' ', 'ī', 'ṁ', ' ', 'y', 'u', 'y', 'u', 't', 's', 'u', 'ṁ', ' ', 'k', 'i', 'ṁ', ' ', 'r', 'ā', 'n', 's', 'a', 'kh', 'ī', 'ṁ', 's', 't', 'a', 'th', 'ā']
indic_lang = 'Telugu' # 'Kannada' # 'Telugu', 'Odia', 'Gujarati', 'Bengali-Assamsese',
# indic_lang='Devanagari'
# indic_lang='Kannada'
# indic_lang='Telugu'
# indic_lang='Odia'
# indic_lang='Bengali–Assamese'
# indic_lang='Tamil' # In development state
print(bshf.iast2indic(word,indic_lang))
BashaFusion.dict_tokens2indic(dict_tokene_list,halant)
# >>> కం ఇతాః కిం యుయుత్సవః పాణ్డవానీకం ఇతాః కిం ఆం ఈం కిం యుయుత్సుం రాన్సఖీంస్తథా
Phonetic Hash for Phonetic Search
Presently there are two type of Phonetic Hash
-
BASIC HASHING :
- all vowel are removed and
- consonats are truncated
eg: kh is mapped to k,
श, ष, स are mapped to स (s)
ङ,ञ,ण,न are mapped न (n)
..etc
- all vowel are removed and
-
NORMAL HASHING
- vowel are truncated and
- consonats are truncated
- vowel are truncated and
zero_vowels={ '':['a', "ā", "â","i", "ī","u", "ū",chr(805),chr(803),
"l̥", "l̥̄","e", "ē", "ê","o", "ō", "ô",
"ṁ", "m̐", "ṃ", "ṃ","n̆", "n̆", "n̆","ḥ" , "ḫ", "ẖ", "ḥ"],
'r': ["r̥", "r̥̄"]
} # replacing with r is not working for 'r̥' so we replace with chr(805) above
truncated_vowels = { '':[chr(805), chr(803), chr(772),chr(784),chr(774)],
'a':["ā", "â"],
'i':["i", "ī"],
'u':["u", "ū"],
'r':["r̥", "r̥̄"],
'l':["l̥", "l̥̄"],
"e":["e", "ē", "ê"],
# "ai",
"o": ["o", "ō", "ô"],
# "au",
'm' :["ṁ", "m̐", "ṃ", "ṃ"],
'n': ["n̆", "n̆", "n̆"],
'h' :["ḥ" , "ḫ", "ẖ", "ḥ"],
}
basic_truncated_consonat = {
'k' : ['ḵ', 'k', 'kh','k͟ha'],
'g' :['g','g̈','gh','ġ'],
'n' : ['ṅ','n̆','ñ','ṇ','ṉ'],
'c' : ['c', 'ĉ','ch','ĉh'],
'j' : ['j','ǰ', 'ĵ', 'jh'],
't': ['ṭ','ṭa','t','th','ṯ','t̤'],
'd' : ['ḍ', 'd̤','ḍ','ḍh','d','dh','ḏ'],
'p' : ['p', 'ph'],
'b' : [ 'b', 'b̤', 'bh'],
'm' : ['m̆' ],
'r' : ['ṟ', 'r̆'],
'l' :['ḻ', 'ḷ', 'l̤'],
'y' : ['y', 'ẏ', 'y̌'],
's': ['ś', 'ṣ', 's','s̱', 's̤','sh' ],
"z": ["z","ž","ž","ž",'ẕ','ẕ','ẓ','ż'],
'h' : ['h','h̤']
}
search_word = 'dhr̥tarāṣṭra uvāca'
search_word = search_word.strip().lower()
# to_iast
search_iast = bshf.to_iast(search_word) # similar to idempotent matrx no loss of info if ':' not present
# >>> dhr̥tarāṣṭra uvāca
print(search_iast)
print("# Original Text:", search_word)
print('BASIC HASHING: ',BashaFusion.basic_hash(search_iast))
print('NORMAL HASHING',BashaFusion.normal_hash(search_iast))
# >>> Original Test: dhr̥tarāṣṭra uvāca
# >>> BASIC HASHING: drtrstr vc
# >>> NORMAL HASHING: drtarastra uvaca
Contribute
InProgress
Research and Analysis is going on in Tamil Script, Nastaliq Script(Urdu, Arabic), Sinhala(Sri Lanka) Script.
Not Strated
Marathi can easily added into this package
Issue
Please open an issue
here in case any bug was encountered.
Mail id : dankarthik25@gmail.com
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file BashaFusion-0.0.3.tar.gz
.
File metadata
- Download URL: BashaFusion-0.0.3.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 870baff771d868673edf24426160ae8c0eab5cf4aec8cab9883f84dcd5711a72 |
|
MD5 | 05bd028e5b46035cf4dafac8b6b3673d |
|
BLAKE2b-256 | d61f98b9e36b32b1b0ecfd43fa5eb3bd2bb8c89ecd63a0f8637f080e7720a8fd |
File details
Details for the file BashaFusion-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: BashaFusion-0.0.3-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9bfd54c85153af5944301eb329ad83f0bf3d24eaecf396bf6a84e14dec9228a |
|
MD5 | 100bf43a59a4d02bf3b6382457772793 |
|
BLAKE2b-256 | 4d57f309939528a543a4080397b0ccf8dd5e00e58c9a898ea60bd838dd8ed69e |