6

I want to generate phonetic text from English to Bengali words in unicode. For example, if I write,

\bn{ami vat khai}

I want the output be like "আমি ভাত খাই"

So my question is: How can I generate phonetic Bengali text from English?

1

1 Answer 1

6

You can use expl3 replace function, or regex function.

A one-to-one mapping is required, from English to Bengali; you can decide what string values to use on the English side to become the Bengali values.

Here I illustrate using ASCII characters on plain keyboard.

one to one

Because English has so few characters, using single letters is not enough. Therefore combinations of English letters are needed in some cases to make the one-to-one, example: a= is used for , aa= for because aa is used for , and so on.

Use / to split a string that would otherwise be parsed incorrectly, example: to stop the sequence aai= being misread as a + ai=(ঐ), use /: aa/i= which is then read as aa (া) + i= (ই) and / is removed from the output. To get a / in the output, type //.

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{fontspec}
\usepackage{multicol}
\newfontface\translitfont{Noto Serif}
\newfontface\bengalifont{Noto Sans Bengali}[Script=Bengali,Renderer=HarfBuzz,Colour=blue]

\ExplSyntaxOn
\tl_new:N \l_mytrans_tl



% transliteration: Latin-to-Bangla
\NewDocumentCommand{\bn}{ m }
{
    \tl_set:Nn \l_mytrans_tl { #1 }

    \dobntrans
        
    { \bengalifont
                    \tl_use:N \l_mytrans_tl
        }
}

\newcommand\dobntrans{
%
\tl_replace_all:Nnn \l_mytrans_tl { // } { xxx } 
%
\tl_replace_all:Nnn \l_mytrans_tl { mmcb } { ঁ } 
\tl_replace_all:Nnn \l_mytrans_tl { hlnt } { ্ } 
\tl_replace_all:Nnn \l_mytrans_tl { aa= } { আ } 
\tl_replace_all:Nnn \l_mytrans_tl { ii= } { ঈ } 
\tl_replace_all:Nnn \l_mytrans_tl { uu= } { ঊ } 
\tl_replace_all:Nnn \l_mytrans_tl { rr= } { ৠ } 
\tl_replace_all:Nnn \l_mytrans_tl { ll= } { ৡ } 
\tl_replace_all:Nnn \l_mytrans_tl { ee= } { এ } 
\tl_replace_all:Nnn \l_mytrans_tl { ai= } { ঐ } 
\tl_replace_all:Nnn \l_mytrans_tl { oo= } { ও } 
\tl_replace_all:Nnn \l_mytrans_tl { au= } { ঔ } 
\tl_replace_all:Nnn \l_mytrans_tl { tth } { ঠ } 
\tl_replace_all:Nnn \l_mytrans_tl { ddh } { ঢ } 
\tl_replace_all:Nnn \l_mytrans_tl { rrr } { ড় } 
\tl_replace_all:Nnn \l_mytrans_tl { rrh } { ণ } 
\tl_replace_all:Nnn \l_mytrans_tl { -rr } { ৄ } 
\tl_replace_all:Nnn \l_mytrans_tl { -aa } { া } 
\tl_replace_all:Nnn \l_mytrans_tl { a= } { অ } 
\tl_replace_all:Nnn \l_mytrans_tl { i= } { ই } 
\tl_replace_all:Nnn \l_mytrans_tl { u= } { উ } 
\tl_replace_all:Nnn \l_mytrans_tl { r= } { ঋ } 
\tl_replace_all:Nnn \l_mytrans_tl { l= } { ঌ } 
\tl_replace_all:Nnn \l_mytrans_tl { mm } { ং } 
\tl_replace_all:Nnn \l_mytrans_tl { hh } { ঃ } 
\tl_replace_all:Nnn \l_mytrans_tl { kh } { খ } 
\tl_replace_all:Nnn \l_mytrans_tl { gh } { ঘ } 
\tl_replace_all:Nnn \l_mytrans_tl { nn } { ঙ } 
\tl_replace_all:Nnn \l_mytrans_tl { ch } { ছ } 
\tl_replace_all:Nnn \l_mytrans_tl { jh } { ঝ } 
\tl_replace_all:Nnn \l_mytrans_tl { ny } { ঞ } 
\tl_replace_all:Nnn \l_mytrans_tl { tt } { ট } 
\tl_replace_all:Nnn \l_mytrans_tl { dd } { ড } 
\tl_replace_all:Nnn \l_mytrans_tl { rr } { ঢ় } 
\tl_replace_all:Nnn \l_mytrans_tl { th } { থ } 
\tl_replace_all:Nnn \l_mytrans_tl { dh } { ধ } 
\tl_replace_all:Nnn \l_mytrans_tl { ph } { ফ } 
\tl_replace_all:Nnn \l_mytrans_tl { bh } { ভ } 
\tl_replace_all:Nnn \l_mytrans_tl { yy } { য় } 
\tl_replace_all:Nnn \l_mytrans_tl { rm } { ৰ } 
\tl_replace_all:Nnn \l_mytrans_tl { sh } { শ } 
\tl_replace_all:Nnn \l_mytrans_tl { ss } { ষ } 
\tl_replace_all:Nnn \l_mytrans_tl { qh } { খ় } 
\tl_replace_all:Nnn \l_mytrans_tl { gg } { গ় } 
\tl_replace_all:Nnn \l_mytrans_tl { aa } { া } 
\tl_replace_all:Nnn \l_mytrans_tl { ii } { ী } 
\tl_replace_all:Nnn \l_mytrans_tl { uu } { ূ } 
\tl_replace_all:Nnn \l_mytrans_tl { -r } { ৃ } 
\tl_replace_all:Nnn \l_mytrans_tl { ai } { ৈ } 
\tl_replace_all:Nnn \l_mytrans_tl { au } { ৌ } 
\tl_replace_all:Nnn \l_mytrans_tl { t- } { ৎ } 
\tl_replace_all:Nnn \l_mytrans_tl { k } { ক } 
\tl_replace_all:Nnn \l_mytrans_tl { g } { গ } 
\tl_replace_all:Nnn \l_mytrans_tl { c } { চ } 
\tl_replace_all:Nnn \l_mytrans_tl { j } { জ } 
\tl_replace_all:Nnn \l_mytrans_tl { t } { ত } 
\tl_replace_all:Nnn \l_mytrans_tl { d } { দ } 
\tl_replace_all:Nnn \l_mytrans_tl { n } { ন } 
\tl_replace_all:Nnn \l_mytrans_tl { p } { প } 
\tl_replace_all:Nnn \l_mytrans_tl { b } { ব } 
\tl_replace_all:Nnn \l_mytrans_tl { m } { ম } 
\tl_replace_all:Nnn \l_mytrans_tl { y } { য } 
\tl_replace_all:Nnn \l_mytrans_tl { r } { র } 
\tl_replace_all:Nnn \l_mytrans_tl { l } { ল } 
\tl_replace_all:Nnn \l_mytrans_tl { v } { ৱ } 
\tl_replace_all:Nnn \l_mytrans_tl { s } { স } 
\tl_replace_all:Nnn \l_mytrans_tl { h } { হ } 
\tl_replace_all:Nnn \l_mytrans_tl { ’ } { ঽ } 
\tl_replace_all:Nnn \l_mytrans_tl { q } { ক় } 
\tl_replace_all:Nnn \l_mytrans_tl { z } { জ় } 
\tl_replace_all:Nnn \l_mytrans_tl { f } { ফ় } 
\tl_replace_all:Nnn \l_mytrans_tl { . } { । } 
\tl_replace_all:Nnn \l_mytrans_tl { i } { ি } 
\tl_replace_all:Nnn \l_mytrans_tl { u } { ু } 
\tl_replace_all:Nnn \l_mytrans_tl { e } { ে } 
\tl_replace_all:Nnn \l_mytrans_tl { o } { ো } 
\tl_replace_all:Nnn \l_mytrans_tl { - } { ৗ } 
\tl_replace_all:Nnn \l_mytrans_tl { 0 } { ০ } 
\tl_replace_all:Nnn \l_mytrans_tl { 1 } { ১ } 
\tl_replace_all:Nnn \l_mytrans_tl { 2 } { ২ } 
\tl_replace_all:Nnn \l_mytrans_tl { 3 } { ৩ } 
\tl_replace_all:Nnn \l_mytrans_tl { 4 } { ৪ } 
\tl_replace_all:Nnn \l_mytrans_tl { 5 } { ৫ } 
\tl_replace_all:Nnn \l_mytrans_tl { 6 } { ৬ } 
\tl_replace_all:Nnn \l_mytrans_tl { 7 } { ৭ } 
\tl_replace_all:Nnn \l_mytrans_tl { 8 } { ৮ } 
\tl_replace_all:Nnn \l_mytrans_tl { 9 } { ৯ } 
% tidy-up: inherent a, etc
\tl_replace_all:Nnn \l_mytrans_tl { a } {  } 
\tl_replace_all:Nnn \l_mytrans_tl { / } {  } 
\tl_replace_all:Nnn \l_mytrans_tl { xxx } {  } 

}



%-----------------------------------
% transliteration: Bangla-to-Latin
\NewDocumentCommand{\indictrans}{ m }
{
\tl_set:Nn \l_mytrans_tl { #1 }
\doindictrans
    { \translitfont
                    \tl_use:N \l_mytrans_tl
        }
}

% text (transliteration)
\NewDocumentCommand{\indictransg}{ m }
{
    #1 ~ (
\tl_set:Nn \l_mytrans_tl { #1 }
\doindictrans
    { \translitfont
                    \tl_use:N \l_mytrans_tl
        } )
}

% multi-line environment
\NewDocumentEnvironment{isoindictranse}{ +b }
{
\tl_set:Nn \l_mytrans_tl { #1 }
\doindictrans
%\bengalifont
    { \translitfont
                    \tl_use:N \l_mytrans_tl
        }
}
{ }

% the mapping
\newcommand\doindictrans{
\tl_replace_all:Nnn \l_mytrans_tl { ড় } { r^^^^0323a } 
\tl_replace_all:Nnn \l_mytrans_tl { ঢ় } { r^^^^0323ha } 
\tl_replace_all:Nnn \l_mytrans_tl { য় } { y^^^^0307a } 
\tl_replace_all:Nnn \l_mytrans_tl { ক় } { qa } 
\tl_replace_all:Nnn \l_mytrans_tl { খ় } { k͟ha } 
\tl_replace_all:Nnn \l_mytrans_tl { গ় } { g^^^^0307a } 
\tl_replace_all:Nnn \l_mytrans_tl { জ় } { za } 
\tl_replace_all:Nnn \l_mytrans_tl { ফ় } { fa } 
\tl_replace_all:Nnn \l_mytrans_tl { অ } { a } 
\tl_replace_all:Nnn \l_mytrans_tl { আ } { ā } 
\tl_replace_all:Nnn \l_mytrans_tl { ই } { i } 
\tl_replace_all:Nnn \l_mytrans_tl { ঈ } { ī } 
\tl_replace_all:Nnn \l_mytrans_tl { উ } { u } 
\tl_replace_all:Nnn \l_mytrans_tl { ঊ } { ū } 
\tl_replace_all:Nnn \l_mytrans_tl { ঋ } { r̥ } 
\tl_replace_all:Nnn \l_mytrans_tl { ৠ } { r̥̄ } 
\tl_replace_all:Nnn \l_mytrans_tl { ঌ } { l̥ } 
\tl_replace_all:Nnn \l_mytrans_tl { ৡ } { l̥̄ } 
\tl_replace_all:Nnn \l_mytrans_tl { এ } { ē } 
\tl_replace_all:Nnn \l_mytrans_tl { ঐ } { ai } 
\tl_replace_all:Nnn \l_mytrans_tl { ও } { ō } 
\tl_replace_all:Nnn \l_mytrans_tl { ঔ } { au } 
\tl_replace_all:Nnn \l_mytrans_tl { ং } { ṁ } 
\tl_replace_all:Nnn \l_mytrans_tl { ঁ } { m̐ } 
\tl_replace_all:Nnn \l_mytrans_tl { ঃ } { ḥ } 
\tl_replace_all:Nnn \l_mytrans_tl { ক } { ka } 
\tl_replace_all:Nnn \l_mytrans_tl { খ } { kha } 
\tl_replace_all:Nnn \l_mytrans_tl { গ } { ga } 
\tl_replace_all:Nnn \l_mytrans_tl { ঘ } { gha } 
\tl_replace_all:Nnn \l_mytrans_tl { ঙ } { ṅa } 
\tl_replace_all:Nnn \l_mytrans_tl { চ } { ca } 
\tl_replace_all:Nnn \l_mytrans_tl { ছ } { cha } 
\tl_replace_all:Nnn \l_mytrans_tl { জ } { ja } 
\tl_replace_all:Nnn \l_mytrans_tl { ঝ } { jha } 
\tl_replace_all:Nnn \l_mytrans_tl { ঞ } { ña } 
\tl_replace_all:Nnn \l_mytrans_tl { ট } { ṭa } 
\tl_replace_all:Nnn \l_mytrans_tl { ঠ } { ṭha } 
\tl_replace_all:Nnn \l_mytrans_tl { ড } { ḍa } 
\tl_replace_all:Nnn \l_mytrans_tl { ঢ } { ḍha } 
\tl_replace_all:Nnn \l_mytrans_tl { ণ } { ṇa } 
\tl_replace_all:Nnn \l_mytrans_tl { ত } { ta } 
\tl_replace_all:Nnn \l_mytrans_tl { থ } { tha } 
\tl_replace_all:Nnn \l_mytrans_tl { দ } { da } 
\tl_replace_all:Nnn \l_mytrans_tl { ধ } { dha } 
\tl_replace_all:Nnn \l_mytrans_tl { ন } { na } 
\tl_replace_all:Nnn \l_mytrans_tl { প } { pa } 
\tl_replace_all:Nnn \l_mytrans_tl { ফ } { pha } 
\tl_replace_all:Nnn \l_mytrans_tl { ব } { ba } 
\tl_replace_all:Nnn \l_mytrans_tl { ভ } { bha } 
\tl_replace_all:Nnn \l_mytrans_tl { ম } { ma } 
\tl_replace_all:Nnn \l_mytrans_tl { য } { ya } 
\tl_replace_all:Nnn \l_mytrans_tl { র } { ra } 
\tl_replace_all:Nnn \l_mytrans_tl { ৰ } { ra } 
\tl_replace_all:Nnn \l_mytrans_tl { ল } { la } 
\tl_replace_all:Nnn \l_mytrans_tl { ৱ } { va } 
\tl_replace_all:Nnn \l_mytrans_tl { শ } { śa } 
\tl_replace_all:Nnn \l_mytrans_tl { ষ } { ṣa } 
\tl_replace_all:Nnn \l_mytrans_tl { স } { sa } 
\tl_replace_all:Nnn \l_mytrans_tl { হ } { ha } 
\tl_replace_all:Nnn \l_mytrans_tl { ঽ } { ’ } 
\tl_replace_all:Nnn \l_mytrans_tl { । } { . } 
\tl_replace_all:Nnn \l_mytrans_tl { া } { -ā } 
\tl_replace_all:Nnn \l_mytrans_tl { ি } { -i } 
\tl_replace_all:Nnn \l_mytrans_tl { ী } { -ī } 
\tl_replace_all:Nnn \l_mytrans_tl { ু } { -u } 
\tl_replace_all:Nnn \l_mytrans_tl { ূ } { -ū } 
\tl_replace_all:Nnn \l_mytrans_tl { ৃ } { -r } 
\tl_replace_all:Nnn \l_mytrans_tl { ৄ } { -rr } 
\tl_replace_all:Nnn \l_mytrans_tl { ে } { -e } 
\tl_replace_all:Nnn \l_mytrans_tl { ৈ } { -ai } 
\tl_replace_all:Nnn \l_mytrans_tl { ো } { -o } 
\tl_replace_all:Nnn \l_mytrans_tl { ৌ } { -au } 
\tl_replace_all:Nnn \l_mytrans_tl { ্ } {  virama } 
\tl_replace_all:Nnn \l_mytrans_tl { ৎ } { t } 
\tl_replace_all:Nnn \l_mytrans_tl { ৗ } { - } 
\tl_replace_all:Nnn \l_mytrans_tl { ০ } { 0 } 
\tl_replace_all:Nnn \l_mytrans_tl { ১ } { 1 } 
\tl_replace_all:Nnn \l_mytrans_tl { ২ } { 2 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৩ } { 3 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৪ } { 4 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৫ } { 5 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৬ } { 6 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৭ } { 7 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৮ } { 8 } 
\tl_replace_all:Nnn \l_mytrans_tl { ৯ } { 9 } 


% tidy-up: inherent a, etc
\regex_replace_all:nnN { a\-(ai) } { \1 } \l_mytrans_tl
\regex_replace_all:nnN { a\-(au) } { \1 } \l_mytrans_tl
\regex_replace_all:nnN { a\-([āiueoīū]{1}) } { \1 } \l_mytrans_tl
\regex_replace_all:nnN { a\-(rr) } { \1 } \l_mytrans_tl
\regex_replace_all:nnN { a\-(r) } { \1 } \l_mytrans_tl
\tl_replace_all:Nnn \l_mytrans_tl { avirama } { } 
\tl_replace_all:Nnn \l_mytrans_tl { ṁ } { ng } 
\regex_replace_all:nnN { \-([āiueoīū]{1}) } { \1 } \l_mytrans_tl
%...
}
 


\ExplSyntaxOff


\begin{document}
\section{Latin to Bangla}

\textbackslash bn\{a=mi bhaat kh-aa/i=\}
$\mapsto$
\bn{a=mi bhaat kh-aa/i=}

\begin{multicols}{5}
\noindent a= (\bn{a=})\par
\noindent aa= (\bn{aa=})\par


\noindent i= (\bn{i=})\par
\noindent ii= (\bn{ii=})\par
\noindent u= (\bn{u=})\par
\noindent uu= (\bn{uu=})\par

\noindent r= (\bn{r=})\par
\noindent rr= (\bn{rr=})\par
\noindent l= (\bn{l=})\par
\noindent ll= (\bn{ll=})\par

\noindent ee= (\bn{ee=})\par

\noindent ai= (\bn{ai=})\par

\noindent oo= (\bn{oo=})\par

\noindent au= (\bn{au=})\par
\noindent mm (\bn{mm})\par

\noindent mmcb (\bn{mmcb})\par

\noindent hh (\bn{hh})\par



\noindent k (\bn{k})\par
\noindent kh (\bn{kh})\par
\noindent g (\bn{g})\par
\noindent gh (\bn{gh})\par
\noindent nn (\bn{nn})\par

\noindent c (\bn{c})\par

\noindent ch (\bn{ch})\par
\noindent j (\bn{j})\par
\noindent jh (\bn{jh})\par
\noindent ny (\bn{ny})\par

\noindent tt (\bn{tt})\par
\noindent tth (\bn{tth})\par
\noindent dd (\bn{dd})\par
\noindent ddh (\bn{ddh})\par
\noindent rrr (\bn{rrr})\par
\noindent rr (\bn{rr})\par
\noindent rrh (\bn{rrh})\par

\noindent t (\bn{t})\par
\noindent th (\bn{th})\par
\noindent d (\bn{d})\par
\noindent dh (\bn{dh})\par
\noindent n (\bn{n})\par

\noindent p (\bn{p})\par
\noindent ph (\bn{ph})\par
\noindent b (\bn{b})\par
\noindent bh (\bn{bh})\par
\noindent m (\bn{m})\par





\noindent y (\bn{y})\par
\noindent yy (\bn{yy})\par
\noindent r (\bn{r})\par
\noindent rm (\bn{rm})\par

\noindent l (\bn{l})\par

\noindent v (\bn{v})\par
\noindent sh (\bn{sh})\par
\noindent ss (\bn{ss})\par
\noindent s (\bn{s})\par
\noindent h (\bn{h})\par
\noindent ’ (\bn{’})\par
\noindent q (\bn{q})\par
\noindent qh (\bn{qh})\par
\noindent gg (\bn{gg})\par
\noindent z (\bn{z})\par
\noindent f (\bn{f})\par










\noindent . (\bn{.})\par
\noindent aa (\bn{aa})\par
\noindent i (\bn{i})\par
\noindent ii (\bn{ii})\par
\noindent u (\bn{u})\par
\noindent uu (\bn{uu})\par
\noindent -r (\bn{-r})\par
\noindent -rr (\bn{-rr})\par
\noindent e (\bn{e})\par
\noindent ai (\bn{ai})\par
\noindent o (\bn{o})\par
\noindent au (\bn{au})\par
\noindent hlnt (\bn{hlnt})\par
\noindent t- (\bn{t-})\par
\noindent - (\bn{-})\par
\noindent 0 (\bn{0})\par
\noindent 1 (\bn{1})\par
\noindent 2 (\bn{2})\par
\noindent 3 (\bn{3})\par
\noindent 4 (\bn{4})\par
\noindent 5 (\bn{5})\par
\noindent 6 (\bn{6})\par
\noindent 7 (\bn{7})\par
\noindent 8 (\bn{8})\par
\noindent 9 (\bn{9})\par
\noindent -aa (\bn{-aa})\par
\end{multicols}



\section{Bangla to Latin}
\bengalifont
\begin{multicols}{5}
\noindent অ (\indictrans{অ})\par
\noindent আ (\indictrans{আ})\par
\noindent ই (\indictrans{ই})\par
\noindent ঈ (\indictrans{ঈ})\par
\noindent উ (\indictrans{উ})\par
\noindent ঊ (\indictrans{ঊ})\par
\noindent ঋ (\indictrans{ঋ})\par
\noindent ৠ (\indictrans{ৠ})\par
\noindent ঌ (\indictrans{ঌ})\par
\noindent ৡ (\indictrans{ৡ})\par
\noindent এ (\indictrans{এ})\par
\noindent ঐ (\indictrans{ঐ})\par
\noindent ও (\indictrans{ও})\par
\noindent ঔ (\indictrans{ঔ})\par
\noindent ং (\indictrans{ং})\par
\noindent ঁ (\indictrans{ঁ})\par
\noindent ঃ (\indictrans{ঃ})\par
\noindent ক (\indictrans{ক})\par
\noindent খ (\indictrans{খ})\par
\noindent গ (\indictrans{গ})\par
\noindent ঘ (\indictrans{ঘ})\par
\noindent ঙ (\indictrans{ঙ})\par
\noindent চ (\indictrans{চ})\par
\noindent ছ (\indictrans{ছ})\par
\noindent জ (\indictrans{জ})\par
\noindent ঝ (\indictrans{ঝ})\par
\noindent ঞ (\indictrans{ঞ})\par
\noindent ট (\indictrans{ট})\par
\noindent ঠ (\indictrans{ঠ})\par
\noindent ড (\indictrans{ড})\par
\noindent ঢ (\indictrans{ঢ})\par
\noindent ড় (\indictrans{ড়})\par
\noindent ঢ় (\indictrans{ঢ়})\par
\noindent ণ (\indictrans{ণ})\par
\noindent ত (\indictrans{ত})\par
\noindent থ (\indictrans{থ})\par
\noindent দ (\indictrans{দ})\par
\noindent ধ (\indictrans{ধ})\par
\noindent ন (\indictrans{ন})\par
\noindent প (\indictrans{প})\par
\noindent ফ (\indictrans{ফ})\par
\noindent ব (\indictrans{ব})\par
\noindent ভ (\indictrans{ভ})\par
\noindent ম (\indictrans{ম})\par
\noindent য (\indictrans{য})\par
\noindent য় (\indictrans{য়})\par
\noindent র (\indictrans{র})\par
\noindent ৰ (\indictrans{ৰ})\par
\noindent ল (\indictrans{ল})\par
\noindent ৱ (\indictrans{ৱ})\par
\noindent শ (\indictrans{শ})\par
\noindent ষ (\indictrans{ষ})\par
\noindent স (\indictrans{স})\par
\noindent হ (\indictrans{হ})\par
\noindent ঽ (\indictrans{ঽ})\par
\noindent ক় (\indictrans{ক়})\par
\noindent খ় (\indictrans{খ়})\par
\noindent গ় (\indictrans{গ়})\par
\noindent জ় (\indictrans{জ়})\par
\noindent ফ় (\indictrans{ফ়})\par
\noindent । (\indictrans{।})\par
\noindent া (\indictrans{া})\par
\noindent ি (\indictrans{ি})\par
\noindent ী (\indictrans{ী})\par
\noindent ু (\indictrans{ু})\par
\noindent ূ (\indictrans{ূ})\par
\noindent ৃ (\indictrans{ৃ})\par
\noindent ৄ (\indictrans{ৄ})\par
\noindent ে (\indictrans{ে})\par
\noindent ৈ (\indictrans{ৈ})\par
\noindent ো (\indictrans{ো})\par
\noindent ৌ (\indictrans{ৌ})\par
\noindent ্ (\indictrans{্})\par
\noindent ৎ (\indictrans{ৎ})\par
\noindent ৗ (\indictrans{ৗ})\par
\noindent ০ (\indictrans{০})\par
\noindent ১ (\indictrans{১})\par
\noindent ২ (\indictrans{২})\par
\noindent ৩ (\indictrans{৩})\par
\noindent ৪ (\indictrans{৪})\par
\noindent ৫ (\indictrans{৫})\par
\noindent ৬ (\indictrans{৬})\par
\noindent ৭ (\indictrans{৭})\par
\noindent ৮ (\indictrans{৮})\par
\noindent ৯ (\indictrans{৯})\par
\end{multicols}

\indictransg{আমার সোনার বাংলা}

\indictransg{সৌরজগৎ}

\begin{isoindictranse}


সৌরজগৎ হল সূর্য ও প্রত্যক্ষ বা পরোক্ষভাবে[ক] সূর্য-প্রদক্ষিণকারী তথা পরস্পরের প্রতি অভিকর্ষজ টানে আবদ্ধ মহাজাগতিক বস্তুগুলিকে নিয়ে গড়ে একটি ব্যবস্থা। আকাশগঙ্গা ছায়াপথের কেন্দ্রস্থল থেকে ২৬,০০০ আলোকবর্ষ দূরে কালপুরুষ বাহুতে এই গ্রহ ব্যবস্থাটি অবস্থিত। সৌরজগতে প্রত্যক্ষভাবে সূর্য-প্রদক্ষিণকারী বস্তুগুলির মধ্যে আটটি গ্রহই বৃহত্তম।[খ] অন্য ক্ষুদ্রতর বস্তুগুলির মধ্যে রয়েছে বামন গ্রহ ও সৌরজগতের ক্ষুদ্র বস্তুসমূহ। পরোক্ষভাবে সূর্য-প্রদক্ষিণকারী বস্তুগুলির মধ্যে দু’টি প্রাকৃতিক উপগ্রহ ক্ষুদ্রতম গ্রহ বুধের থেকেও আকারে বড়ো।[গ] 
\end{isoindictranse}


\end{document}
9
  • 1
    Partly related: tex.stackexchange.com/questions/597535/… Transliteration in the reverse direction, Bengali to Latin letters.
    – Cicada
    Commented Oct 21, 2021 at 11:03
  • 1
    Cicada I am having problem with space. I just edited your code and compiled. But there are a lot of spaces in my output. my code: \section{\bn{banglay likhi}} \bn{a=mader desh bangladesh. a=mra banglay ktha bli. bangladesh e=kTi chOToT desh. e=Ti dkoShiN e=Siya mHadeshe o=bsothit.}
    – mmr
    Commented Oct 21, 2021 at 14:31
  • 1
    Always replace the longest first. Arrange the replace commands so that the longest strings are examined before the shorter ones. If I have text cat, and I replace c with m, and then I replaced cat with dog, the result is mat. But if I do longest first, the result is dog. The spaces are from English letters remaining in the output but the font is Bengali, if you are still using the Noto fonts.
    – Cicada
    Commented Oct 22, 2021 at 1:30
  • 1
    The tokenn list was being repeated: I have fixed MWE code,
    – Cicada
    Commented Oct 22, 2021 at 6:04
  • 2
    Do texdoc interface3, see part XXVIII, page 226: all about regex command. With both regex and with replace, the testing sequence is important. I'll see if I can do an example regex for you (maybe, don't have much time at the moment). Better: ask a separate question, so more eyes see it.
    – Cicada
    Commented Oct 23, 2021 at 6:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .