英语到印地语的转换 [英] English to Hindi conversion

查看:206
本文介绍了英语到印地语的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要c#代码才能将英文字母转换为印地语。如果有人输入M,那么它应该显示印地语MOH。同样,如果我们输入ENGLISHMAA,那么它应该在印地语字母表中显示为MAA。请帮助我。

感谢您的关注。

I need c# code for converting English alphabet to hindi. If somebody type "M" then it should display hindi "MOH".Similarly ,if we type ENGLISH "MAA" then it should display as "MAA" in Hindi alphabets. Please help me.
Thank you for your kind attention.

推荐答案

以<$的数组形式创建查找表C $ C>字符串。例如,从某个文本文件中填充它。值将是音译( http://en.wikipedia.org/wiki/Transliteration [ ^ ])一些英文字符的字符串。这样,你将有一个使用这个数组的函数。



但请想一想:为什么不使用标准的IPA( http://en.wikipedia.org/wiki/International_Phonetic_Alphabet [ ^ ])?据我所知,它很好地涵盖了英语和印地语(我知道一些语言不能很好地覆盖,但印度语应该这样做。)



好​​的,这是由你决定。返回我们的功能:



Create a look-up table in the form of array of string. Populate it from some text file, for example. The value will be the transliteration (http://en.wikipedia.org/wiki/Transliteration[^]) string of some English character. This way, you will have a function using this array.

But think about it: why not using the standard IPA (http://en.wikipedia.org/wiki/International_Phonetic_Alphabet[^])? As far as I know it covers both English and Hindi well (I know some languages it does not cover well, but with Hindi it should do).

OK, it's up to you. Back to our function:

string[] TransliterationTable = new string[26]; //I assume lo- and hi-case letters are transliterated in the same way

//...

//Populate TransliterationTable from file...

//...

// instance method of the same class
// where TransliterationTable is declared:
string Transliterate(char English) {
   // pre-condition to guarantee: all English chars should be in the table,
   // other code points should not be used in call:
   bool upperCase = char.IsUpper(English);
   English = English.ToUpper();
   int index = (char)English - 0x41; //minus capital English 'A'
   string result = TransliterationTable[index];
   if (upperCase) //assume transliterations are in lower
      result = result.ToUpper;
   return TransliterationTable[index]; 
}

//one more in this class:
string Transliterate(string English) {
   System.Text.StringBuilder sb = new System.Text.StringBuilder();
   foreach(char eng in English)
       sb.Append(this.Transliterate(eng));
   return sb.ToString();
}





完成!



- SA


我想你想要创建一个音译逻辑。

首先,一些字的映射是通过使用数组完成的。<例如:
例如:अ映射为
$ b $bआ映射为a /

1 )之后你必须实现一些逻辑来检查aa是否在辅音之后它应该转换为matra。
I think you want to create a transliteration logic.
For this first some mapping of word is to be done by using array.
for example:अ is mapped with a
आ is mapped with aa
क is mapped with ka
1)after that you have to implement some logic to check if aa comes after consonant than it should convert it to matra.


使用字母的等效字符,你需要写一些代码结合辅音和元音。使用Unicode编码。
Use the character equivalent for the letters and you need to write some code for combining a consonant and a vowel. Use Unicode encoding.


这篇关于英语到印地语的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆