Skip to main content

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...etc
  • Not Started: addon for bash regual expression function to include Phonetic Word Search for Indic Language
  • Inprogress: Mapping all Indic alphabets to International Phonetic Alphabet (IPA)
  • Not Started: Generated Phonetic Word given new indic word using Phonetic Mapped Alphabet
  • Not Started: Generating audio file for indic word
  • Not 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)
# >>> కం  ఇతాః కిం  యుయుత్సవః  పాణ్డవానీకం ఇతాః కిం ఆం  ఈం  కిం యుయుత్సుం రాన్సఖీంస్తథా

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
  • NORMAL HASHING

    • vowel are truncated and
    • consonats are truncated
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

Metadata

Release files for BashaFusion 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for BashaFusion 0.0.3
File Size Uploaded
BashaFusion-0.0.3.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for BashaFusion 0.0.3
File Interpreter ABI Platform
BashaFusion-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 44.0 kB

Release files / BashaFusion-0.0.3.tar.gz

Download URL BashaFusion-0.0.3.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
870baff771d868673edf24426160ae8c0eab5cf4aec8cab9883f84dcd5711a72
BLAKE2b-256 checksum
How to use checksums
d61f98b9e36b32b1b0ecfd43fa5eb3bd2bb8c89ecd63a0f8637f080e7720a8fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release files / BashaFusion-0.0.3-py3-none-any.whl

Download URL BashaFusion-0.0.3-py3-none-any.whl
Size 27.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9bfd54c85153af5944301eb329ad83f0bf3d24eaecf396bf6a84e14dec9228a
BLAKE2b-256 checksum
How to use checksums
4d57f309939528a543a4080397b0ccf8dd5e00e58c9a898ea60bd838dd8ed69e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page