Package: indo-arabic-transliteration
Indic-PersoArabic-Script-ConverterIndo-Pakistani TransliterationA python library to convert from Indian scripts to Pakistani scripts and vice-versa.Currently supported methodsRule-based conversionFaster, but does not support short vowelsWill not be accurate, especially for Arabic-to-IndicSangam Project's online transliterationAPIUses an online endpoint for the conversionProduces much better results, but much slowerUsageInstallationPre-requisites:Use Python 3.7+pip install git+https://github.com/GokulNC/indic_nlp_librarypip install indo-arabic-transliterationUsing rule-based conversionfromindo_arabic_transliteration.mapperimportscript_convertscript_convert(text:str,from_script:str,to_script:str)Using Sangam APIfromindo_arabic_transliteration.sangam_apiimportonline_transliterateonline_transliterate(text:str,from_script:str,to_script:str)LanguagesWe use the standardBCP 47 language tagsto refer to the language-script combinations.Hindi-Urdu (Hindustani)LanguageScriptCodeHindiDevanagarihi-INUrduPerso-Arabicur-PKExample:# Rule-basedscript_convert("हैदराबाद‎",'hi-IN','ur-PK')# حیدرآبادscript_convert("حيدرآباد‎",'ur-PK','hi-IN')# हीदराबाद‎# Online-APIonline_transliterate("حيدرآباد‎",'ur-PK','hi-IN')# हैदराबाद‎online_transliterate("हैदराबाद‎",'hi-IN','ur-PK')# حیدرآباد‎Notes & Resources:Both the nations share a common national language (Hindustani) but written in different scripts and also registered as different languages.Official ToolsSoftware by Pakistani Center for Language EngineeringOnline Tool by Indian Center for Development of Advanced ComputingDevanagari to PersoArabic mappingNote: This same rule-based function can be used forSaraikiandShinalanguages alsoTODO: Shina charactershereseems to be bit different. So use with cautionPanjabiLanguageScriptCodeEast PunjabiGur'Mukhipa-INWest PunjabiShahMukhipa-PKExample:# Rule-basedscript_convert("ਸਿੰਘ",'pa-IN','pa-PK')# سںگھscript_convert("سںگھ",'pa-PK','pa-IN')# ਸਂਘ# Online-APIonline_transliterate("سنگھ",'pa-PK','pa-IN')# ਸਿੰਘonline_transliterate("ਸਿੰਘ",'pa-IN','pa-PK')# سِنگھNotes & Resources:You can also use these JavaScript libraries:Anvaad-JS by KhalisFoundationGurmukhi-Utils by ShabadOS(Demo)Gurmukhi to Shahmukhi mappingSindhiLanguageScriptCodeIndian SindhiDevanagarisd-INPakistani SindhiPerso-Arabicsd-PKExample:# Rule-basedscript_convert("हैदराबाद‎",'sd-IN','sd-PK')# حیدرآبادscript_convert("حيدرآباد‎",'sd-PK','sd-IN')# हीदराबाद‎# Online-APIonline_transliterate("حيدرآباد‎",'sd-PK','sd-IN')# हैदराबाद‎online_transliterate("हैदराबाद‎",'sd-IN','sd-PK')# حیدرآباد‎Notes & Resources:Before Devanagari standardization, Sindhi was written in Landa scripts like Khojki, Khudawadi, Multani, Gurmukhi, etc. depending upon the region.To convert from Devanagari to the above legacy scripts, useAksharaMukha's python library.You can also use thisJavaScript libraryoronline converter.Sindhi-PersoArabic to Devanagari mappingOther MethodsMachineLearning-based TransliterationUsesLibIndicTrans libraryfor modelsInstall it bypip install git+https://github.com/libindic/indic-transCurrently supports only Hindi-Urdu languagesAPI:fromindo_arabic_transliteration.ml_basedimportml_transliterate# Same interface as script_convert()Indic-to-Arabic with DiacriticsIndic scripts are mostly phonetic. Use this to retain diacritics in PersoArabicCurrently only supports Hindustani (Hindi to Urdu) and Punjabi (Gurmukhi to Shahmukhi)UsesAksharaMukhi libraryAPI:fromindo_arabic_transliteration.lossless_converterimportconvert_with_diacritics# Same interface as script_convert()SupportFor help in using the library, please use the GitHub Issues section.For script conversion errors from the online API, please write directly to the Sangam team. We are not related to them in anyway and this is not an official library.