├── LICENSE ├── README.md └── src └── net └── hasnath └── ridmikparser ├── BanglaUnicode.java ├── RidmikParser.java └── test ├── FileTest.java └── ParserTest.java /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, Shamim Hasnath 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of the above copyright holder nor the 12 | names of its contributors may be used to endorse or promote products 13 | derived from this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL ABOVE COPYRIGHT HOLDER BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ridmik Parser # 2 | 3 | **English to Bangla Phonetic Converter** 4 | 5 | ----- 6 | 7 | Ridmik parser is used in **Ridmik Keyboard**, an on screen keyboard for the Android OS. 8 | 9 | It's very light-weight, fast and can be converted to any other language very easily. 10 | 11 | 12 | **Usage:** 13 | 14 | first import 15 | 16 | import net.hasnath.ridmikparser.RidmikParser 17 | 18 | then its pretty straight forward: 19 | 20 | RidmikParser parser = new RidmikParser(); 21 | String bangla = parser.toBangla("amar sOnar bangla"); 22 | System.out.println(bangla); 23 | 24 | Output: 25 | 26 | আমার সোনার বাংলা 27 | 28 | 29 | **License: New BSD License** 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/net/hasnath/ridmikparser/BanglaUnicode.java: -------------------------------------------------------------------------------- 1 | package net.hasnath.ridmikparser; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class BanglaUnicode { 7 | 8 | private Map map = new HashMap(); 9 | private Map kars = new HashMap(); 10 | private Map jkt = new HashMap(); 11 | private Map djkt = new HashMap(); 12 | private Map djktt = new HashMap(); 13 | 14 | public BanglaUnicode(){ 15 | // Same : a, k, g, c, f, e, b, v, l, m, p 16 | map.put("o", "\u0985"); // shore o 17 | map.put("O", "\u0993"); // rossho o 18 | map.put("a", "\u0986"); // aa 19 | map.put("A", "\u0986"); // aa 20 | map.put("S", "\u09B6"); // talobbo sho 21 | map.put("sh", "\u09B6"); // talobbo sho 22 | map.put("s", "\u09B8"); // donto sho 23 | map.put("Sh", "\u09B7"); // murdonno sho 24 | map.put("h", "\u09B9"); // ho 25 | map.put("H", "\u09B9"); // ho 26 | map.put("r", "\u09B0"); // ro 27 | map.put("R", "\u09DC"); // dhoye shunne ro 28 | map.put("Rh", "\u09DD"); // dhoye shunne ro 29 | map.put("k", "\u0995"); // ko 30 | map.put("K", "\u0995"); // ko 31 | map.put("q", "\u0995"); 32 | map.put("qq", "\u0981"); // chondro bindu 33 | map.put("kh", "\u0996"); // kho 34 | map.put("g", "\u0997"); // go 35 | map.put("G", "\u0997"); //go 36 | map.put("gh", "\u0998"); // gho 37 | map.put("Ng", "\u0999"); // unga 38 | map.put("c", "\u099A"); // cho 39 | map.put("C", "\u099A"); // cho 40 | map.put("ch", "\u099B"); // ccho 41 | map.put("j", "\u099C"); // jo 42 | map.put("jh", "\u099D"); // jho 43 | map.put("J", "\u099C"); // jho 44 | map.put("NG", "\u099E"); // niyo 45 | map.put("T", "\u099F"); // To 46 | map.put("Th", "\u09A0"); // Tho 47 | map.put("TH", "\u09CE"); // khondiyo to 48 | map.put("f", "\u09AB"); // fo 49 | map.put("F", "\u09AB"); // fo 50 | map.put("ph", "\u09AB"); // fo 51 | map.put("i", "\u0987"); // rossho i 52 | map.put("I", "\u0988"); // dhirgo i 53 | map.put("e", "\u098F"); // e 54 | map.put("E", "\u098F"); // e 55 | map.put("u", "\u0989"); // rossho u 56 | map.put("U", "\u098A"); // dhirgo u 57 | map.put("b", "\u09AC"); // bo 58 | map.put("B", "\u09AC"); // bo 59 | map.put("w", "\u09AC"); // bo 60 | map.put("bh", "\u09AD"); // bho 61 | map.put("V", "\u09AD"); // bho 62 | map.put("v", "\u09AD"); // bho 63 | map.put("t", "\u09A4"); // to 64 | map.put("th", "\u09A5"); // tho 65 | map.put("d", "\u09A6"); // do 66 | map.put("dh", "\u09A7"); // dho 67 | map.put("D", "\u09A1"); // do 68 | map.put("Dh", "\u09A2"); // dho 69 | map.put("n", "\u09A8"); // donto no 70 | map.put("N", "\u09A3"); // murdo no 71 | map.put("z", "\u09AF"); // zho 72 | map.put("Z", "\u09AF"); // zho fola 73 | map.put("y", "\u09DF"); // ontosto yo 74 | map.put("l", "\u09B2"); // lo 75 | map.put("L", "\u09B2"); // lo 76 | map.put("m", "\u09AE"); // mo 77 | map.put("M", "\u09AE"); // mo 78 | map.put("P", "\u09AA"); // po 79 | map.put("p", "\u09AA"); // po 80 | map.put("ng", "\u0982"); // onushar 81 | map.put("cb", "\u0981"); // chondro point 82 | map.put("x", "\u0995\u09CD\u09B8"); 83 | map.put("OU", "\u0994"); 84 | map.put("OI", "\u0990"); 85 | map.put("hs", "\u09CD"); 86 | map.put("nj", "\u099E\u09CD\u099C"); // 87 | map.put("nc", "\u099E\u09CD\u099A"); // 88 | 89 | 90 | kars.put("o", ""); // o kar 91 | kars.put("a", "\u09BE"); // aa kar 92 | kars.put("A", "\u09BE"); // aa kar 93 | kars.put("e", "\u09C7"); // e kar 94 | kars.put("E", "\u09C7"); // e kar 95 | kars.put("O", "\u09CB"); // O kar 96 | kars.put("OI", "\u09C8"); // OI kar 97 | kars.put("OU", "\u09CC"); 98 | kars.put("i", "\u09BF"); // rossho i kar 99 | kars.put("I", "\u09C0"); //dhirgo i karu 100 | kars.put("u", "\u09C1"); // rossho u kar 101 | kars.put("U", "\u09C2"); // dhirgo u kar 102 | kars.put("oo", "\u09C1"); // rossho u kar 103 | 104 | // each of 2nd sits under 1st 105 | jkt.put("k", "kTtnNslw"); 106 | jkt.put("g", "gnNmlw"); 107 | jkt.put("ch", "w"); 108 | jkt.put("Ng", "gkm"); 109 | jkt.put("NG", "cj"); 110 | jkt.put("g", "gnNmlw"); 111 | jkt.put("G", "gnNmlw"); 112 | jkt.put("th", "w"); 113 | jkt.put("gh", "Nn"); 114 | jkt.put("c", "c"); 115 | jkt.put("j", "jw"); 116 | jkt.put("T", "T"); 117 | jkt.put("D", "D"); 118 | jkt.put("R", "g"); 119 | jkt.put("N", "DNmw"); 120 | jkt.put("t", "tnmwN"); 121 | jkt.put("d", "wdm"); 122 | jkt.put("dh", "wn"); 123 | jkt.put("n", "ndwmtsDT"); 124 | jkt.put("p", "plTtns"); 125 | jkt.put("f", "l"); 126 | jkt.put("ph", "l"); 127 | jkt.put("b", "jdbwl"); 128 | jkt.put("v", "l"); 129 | jkt.put("bh", "l"); 130 | jkt.put("m", "npfwvmlb"); 131 | jkt.put("l", "lwmpkgTDf"); 132 | jkt.put("Sh", "kTNpmf"); 133 | jkt.put("S", "clwnm"); 134 | jkt.put("sh", "clwnm"); 135 | jkt.put("s", "kTtnpfmlw"); 136 | jkt.put("h", "Nnmlw"); 137 | jkt.put("cb", ""); 138 | jkt.put("jh", ""); 139 | jkt.put("TH", ""); 140 | jkt.put("qq", ""); 141 | jkt.put("ng", ""); 142 | jkt.put("kh", ""); 143 | jkt.put("gg", ""); 144 | jkt.put("dh", ""); 145 | jkt.put("Th", ""); 146 | 147 | // first sits under each of 2nd 148 | djkt.put("kh", "Ngs"); 149 | djkt.put("ch", "c"); 150 | djkt.put("Dh", "N"); 151 | djkt.put("ph", "mls"); 152 | djkt.put("dh", "gdnbl"); 153 | djkt.put("bh", "dm"); 154 | djkt.put("Sh", "k"); 155 | djkt.put("th", "tns"); 156 | djkt.put("Th", "Nn"); 157 | djkt.put("jh", "j"); 158 | djkt.put("NG", "cj"); 159 | 160 | // first sits under 2nd(dual) 161 | djktt.put("ch", "NG"); 162 | djktt.put("gh", "Ng"); 163 | djktt.put("Th", "Sh"); 164 | djktt.put("jh", "NG"); 165 | djktt.put("sh", "ch"); 166 | 167 | } 168 | 169 | public String getDual(char x, char carry){ 170 | return map.get(Character.toString(carry)+Character.toString(x)); 171 | } 172 | public String get(char x){ 173 | return map.get(Character.toString(x)); 174 | } 175 | public String getKar(char x){ 176 | return kars.get(Character.toString(x)); 177 | } 178 | public String getDualKar(char x, char carry){ 179 | return kars.get(Character.toString(carry)+Character.toString(x)); 180 | } 181 | public String getJkt(char carry){ 182 | return jkt.get(Character.toString(carry)); 183 | } 184 | public String getDualJkt(char secondCarry, char carry){ 185 | return jkt.get(Character.toString(secondCarry)+Character.toString(carry)); 186 | } 187 | public String getDjkt(char secondCarry, char carry){ 188 | return djkt.get(Character.toString(secondCarry)+Character.toString(carry)); 189 | } 190 | public String getDjktt(char secondCarry, char carry){ 191 | return djktt.get(Character.toString(secondCarry)+Character.toString(carry)); 192 | } 193 | public static void main(String[] a){ 194 | RidmikParser.main(new String[]{}); 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /src/net/hasnath/ridmikparser/RidmikParser.java: -------------------------------------------------------------------------------- 1 | package net.hasnath.ridmikparser; 2 | 3 | import java.util.Scanner; 4 | 5 | /** 6 | * 7 | * @author Shamim Hasnath 8 | * @version 1.2 9 | * @since 2012 10 | * 11 | */ 12 | 13 | 14 | public class RidmikParser{ 15 | 16 | private BanglaUnicode unicode = new BanglaUnicode(); 17 | 18 | public static void main(String[] arg){ 19 | RidmikParser parser = new RidmikParser(); 20 | Scanner sc = new Scanner(System.in); 21 | System.out.println("Enter:"); 22 | 23 | while(sc.hasNext()){ 24 | String eng = sc.nextLine(); 25 | System.out.println(parser.toBangla(eng)); 26 | } 27 | 28 | } 29 | 30 | /** 31 | * 32 | * @param engWord (String) the english word, might contain spaces or any other characters 33 | * @return parsed Bangla string in unicode 34 | */ 35 | 36 | public String toBangla(String engWord){ 37 | 38 | StringBuilder st = new StringBuilder(); 39 | char carry = 0; 40 | char secondCarry = 0; 41 | char thirdCarry = 0; 42 | boolean tempNoCarry = false; 43 | boolean jukta = false; 44 | char[] charArray; 45 | boolean prevJukta = false; 46 | 47 | 48 | charArray = engWord.toCharArray(); 49 | 50 | // ======================= The great for loop starts ======================= 51 | for(char now : charArray){ 52 | 53 | // we won't parse anything other than english letters & digits 54 | if(!((now >= 'a' && now <= 'z') || (now >= 'A' && now <= 'Z') || (now >= '0' && now <= '9'))){ 55 | st.append(now); 56 | carry = 0; 57 | // if a bug shows up first thing to do is reset secondCarry, thirdCarry etc here 58 | continue; 59 | } 60 | 61 | if(now == 'A' || now == 'B' || now == 'C' || now == 'E' || now == 'F' || now == 'P' || now == 'X') 62 | now = Character.toLowerCase(now); 63 | if(now == 'K' || now == 'L' || now == 'M' || now == 'V' || now == 'Y' || now == 'W' || now == 'Q' ) 64 | now = Character.toLowerCase(now); 65 | 66 | if(now == 'H' && carry != 'T') // khondiyo to -> TH 67 | now = 'h'; 68 | 69 | // 'w' should be 'O' when it's the first one or comes after a vowel 70 | if((carry == 0 || isVowel(carry)) && now == 'w') 71 | now = 'O'; 72 | 73 | 74 | if(isVowel(now)){ 75 | 76 | // special for wri kar & wri 77 | if(carry=='r' && secondCarry == 'r' && now =='i'){ 78 | 79 | if(thirdCarry == 0){ 80 | st.delete(st.length()-2, st.length()); 81 | st.append("\u098B"); // wri 82 | }else { 83 | st.delete(st.length()-3, st.length()); 84 | st.append("\u09C3"); // wri kar 85 | } 86 | carry = 'i'; 87 | continue; 88 | 89 | } 90 | 91 | String dual; 92 | if(secondCarry != 0) 93 | dual = unicode.getDualKar(now, carry); 94 | else dual = unicode.getDual(now, carry); // dual as the first character of st 95 | 96 | if(dual != null){ 97 | if(carry != 'o') 98 | st.delete(st.length()-1, st.length()); 99 | if(isVowel(secondCarry)){ // a dual kar does not applied on vowel 100 | st.append(unicode.get(carry)).append(unicode.get(now)); 101 | }else 102 | st.append(dual); 103 | }else if(now == 'o' && carry != 0){ 104 | if(isVowel(carry)) 105 | st.append(unicode.get('O')); 106 | else { 107 | thirdCarry = secondCarry; 108 | secondCarry = carry; 109 | carry = now; // carry = 0 110 | continue; 111 | } 112 | }else if(isVowel(carry) || carry == 0){ 113 | if(now == 'a' && carry != 0) // not first a 114 | st.append(unicode.get('y')).append(unicode.getKar('a')); 115 | else 116 | st.append(unicode.get(now)); 117 | }else { 118 | st.append(unicode.getKar(now)); 119 | } 120 | 121 | } 122 | 123 | 124 | if(now == 'y' || now == 'Z' || now == 'r') 125 | jukta = false; 126 | 127 | // when previous was a jukta and dual of the later two is not available 128 | // go to the else part of the next if block i.e now is independent 129 | tempNoCarry = jukta && unicode.getDual(now, carry) == null; 130 | 131 | if(isConsonant(now) && isConsonant(carry) && !tempNoCarry){ 132 | 133 | // handle jo fola 134 | 135 | if(now == 'y' || now == 'Z'){ 136 | if(now == 'y' && carry == 'q' && secondCarry == 'q'); 137 | else 138 | now = 'z'; 139 | } 140 | 141 | //handle gg as in gyan, 142 | //second carry not n, to skip onushar/unga 143 | 144 | if(carry=='g' && now=='g' && secondCarry !='N' && secondCarry != 'n'){ 145 | st.delete(st.length()-1, st.length()); 146 | st.append("\u099C\u09CD\u099E"); 147 | prevJukta = jukta; 148 | jukta = true; 149 | secondCarry = 'g'; 150 | continue; 151 | } 152 | 153 | // handle kkh = kSh 154 | if(secondCarry == 'k' && carry == 'k' && now == 'h') 155 | carry = 'S'; 156 | 157 | // check if dual 158 | String dual = unicode.getDual(now, carry); 159 | 160 | if(dual != null){ 161 | 162 | // handle kaNgkShito 163 | if(thirdCarry == 'g' && secondCarry == 'k' && carry == 'S' && now == 'h') 164 | prevJukta = jukta = false; 165 | 166 | boolean firstOrAfterVowelOrJukta = isVowel(secondCarry) || secondCarry == 0 || prevJukta; 167 | 168 | if(dualSitsUnder(thirdCarry, secondCarry, carry, now) && !firstOrAfterVowelOrJukta){ 169 | st.delete(st.length()-1, st.length()); 170 | if(secondCarry == 'r' && thirdCarry == 'r') 171 | st.delete(st.length()-1, st.length()); 172 | if(jukta); 173 | else if(secondCarry != 0 && !isVowel(secondCarry)) 174 | st.append("\u09CD"); 175 | 176 | st.append(dual); 177 | prevJukta = jukta; 178 | // Jukta should be false in case we want to have three jukta letters 179 | jukta = true; 180 | 181 | }else { 182 | if(jukta) 183 | st.delete(st.length()-2, st.length()); 184 | else st.delete(st.length()-1, st.length()); 185 | 186 | if(secondCarry == 'g' && carry == 'g' && now == 'h'){ // handled gg previously, now more pain 187 | st.delete(st.length()-1, st.length()); 188 | st.append(unicode.get('g')); 189 | } 190 | 191 | st.append(dual); 192 | prevJukta = jukta; 193 | jukta = false; 194 | } 195 | 196 | 197 | }else { 198 | 199 | prevJukta = jukta; 200 | jukta = false; 201 | 202 | if(secondCarry != 'r' && carry == 'r' && now == 'z'){ 203 | st.append("\u200D\u09CD"); // handle rya as in ransom/rapid 204 | } 205 | else if(carry == 'r' && secondCarry != 'r'); 206 | // no ref when (c) rr (c) 207 | else if(carry == 'r' && secondCarry == 'r' && isConsonant(thirdCarry)); 208 | // ref when (v) rr (c) 209 | else if(carry == 'r' && secondCarry == 'r' && (isVowel(thirdCarry) || thirdCarry == 0)){ 210 | st.delete(st.length()-1, st.length()); 211 | st.append("\u09CD"); // jukta added for ref, but jukta not true 212 | } 213 | 214 | else if(notJukta(thirdCarry, secondCarry, carry, now)); 215 | else { 216 | st.append("\u09CD"); 217 | //prevJukta = jukta; 218 | jukta = true; 219 | } 220 | 221 | st.append(unicode.get(now)); 222 | 223 | } 224 | 225 | } else if(isConsonant(now)){ 226 | 227 | if(isVowel(carry) && now == 'Z') 228 | st.append("\u09CD"); 229 | 230 | if(carry == 0 && now == 'x') 231 | st.append(unicode.get('e')); 232 | 233 | prevJukta = jukta; 234 | jukta = false; 235 | 236 | // to write b-fola 237 | if(now == 'w' && isConsonant(carry) && isConsonant(secondCarry)){ 238 | st.append("\u09CD"); 239 | prevJukta = jukta; 240 | jukta = true; 241 | } 242 | // handle lakshmi/ lokhnou 243 | if(thirdCarry == 'k' && secondCarry == 'S' && carry == 'h' && (now == 'N' || now == 'm')){ 244 | st.append("\u09CD"); 245 | prevJukta = false; 246 | jukta = true; 247 | } 248 | st.append(unicode.get(now)); 249 | 250 | } 251 | 252 | thirdCarry = secondCarry; 253 | secondCarry = carry; 254 | carry = now; 255 | } // end of for loop 256 | 257 | return st.toString(); 258 | } 259 | 260 | boolean isVowel(char now){ 261 | if("AEIOUaeiou".indexOf(now) == -1) 262 | return false; 263 | return true; 264 | } 265 | 266 | boolean isConsonant(char now){ 267 | return !isVowel(now) && Character.isLetter(now); 268 | } 269 | 270 | boolean isCharInString(char now, String foo){ 271 | if(foo.indexOf(now) == -1) 272 | return false; 273 | return true; 274 | } 275 | 276 | boolean dualSitsUnder(char thirdCarry, char secondCarry, char carry, char now){ 277 | 278 | if(secondCarry == 'r' && thirdCarry == 'r') 279 | return true; 280 | 281 | if(secondCarry == 'r') 282 | return false; 283 | 284 | String djkt = unicode.getDjkt(carry, now); 285 | if(djkt != null) 286 | if(isCharInString(secondCarry, djkt)) 287 | return true; 288 | 289 | String djktt = unicode.getDjktt(carry, now); 290 | if(djktt != null) 291 | return djktt.contains(Character.toString(thirdCarry)+Character.toString(secondCarry)); // ? true : false; 292 | 293 | // if we didn't cover it here, let's assume it sits under a consonant so we return true 294 | // but making it false has some advantages, e.g. the blocks that has only two lines 295 | // can be removed.. So when we're finished this function should return false 296 | return false; 297 | } 298 | 299 | boolean notJukta(char thirdCarry, char secondCarry, char carry, char now){ 300 | 301 | if(now == 'r' || now == 'z' || now == 'w') 302 | return false; 303 | 304 | String foo = unicode.getDualJkt(secondCarry, carry); 305 | 306 | if(foo != null) 307 | return !isCharInString(now, foo); //? false : true; 308 | 309 | foo = unicode.getJkt(carry); 310 | if(foo != null) 311 | return !isCharInString(now, foo); // ? false : true; 312 | 313 | 314 | // if we didn't cover it here let's assume a consonant sits under it so we return false 315 | // but making it true has some advantages, e.g. the blocks that has only two lines 316 | // can be removed.. So when we're finished, this function should return true 317 | return true; 318 | } 319 | 320 | } 321 | -------------------------------------------------------------------------------- /src/net/hasnath/ridmikparser/test/FileTest.java: -------------------------------------------------------------------------------- 1 | package net.hasnath.ridmikparser.test; 2 | 3 | import java.io.*; 4 | import net.hasnath.ridmikparser.RidmikParser; 5 | 6 | public class FileTest { 7 | 8 | 9 | public static void main(String args[]) { 10 | try { 11 | 12 | FileInputStream fstream = new FileInputStream("wordlist.txt"); 13 | 14 | RidmikParser parser = new RidmikParser(); 15 | 16 | DataInputStream in = new DataInputStream(fstream); 17 | BufferedReader br = new BufferedReader(new InputStreamReader(in)); 18 | String strLine; 19 | long pretime = System.currentTimeMillis(); 20 | 21 | while ((strLine = br.readLine()) != null) { 22 | System.out.println(parser.toBangla(strLine)); 23 | // System.out.print("Assert.assertEquals(\""); //", p.parse("amar", false)); 24 | // String sto = strLine.split(" ")[1]; 25 | // System.out.print(parser.toBangla(sto)); 26 | // System.out.print("\", p.parse(\""); 27 | // System.out.print(sto+"\", false));"); 28 | // System.out.println(); 29 | } 30 | System.out.println(System.currentTimeMillis() - pretime); 31 | in.close(); 32 | } catch (Exception e) { 33 | System.err.println("Error: " + e.getMessage()); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/net/hasnath/ridmikparser/test/ParserTest.java: -------------------------------------------------------------------------------- 1 | package net.hasnath.ridmikparser.test; 2 | 3 | import static org.junit.Assert.*; 4 | import junit.framework.Assert; 5 | 6 | import net.hasnath.ridmikparser.RidmikParser; 7 | import org.junit.Test; 8 | 9 | public class ParserTest { 10 | 11 | @Test 12 | public void specialTest(){ 13 | RidmikParser p = new RidmikParser(); 14 | Assert.assertEquals("উদ্ধত", p.toBangla("uddhot")); 15 | Assert.assertEquals("রাষ্ট্র", p.toBangla("raShTro")); 16 | Assert.assertEquals("বৈষ্ণব", p.toBangla("bOIShNb")); 17 | Assert.assertEquals("লক্ষ্মী", p.toBangla("lokkhmI")); 18 | Assert.assertEquals("বাংলা", p.toBangla("bangla")); 19 | Assert.assertEquals("চাঁদ", p.toBangla("cacbd")); 20 | Assert.assertEquals("ভাঙাঘর", p.toBangla("vaNgaghor")); 21 | Assert.assertEquals("র‍্যান্সম", p.toBangla("ryansom")); 22 | Assert.assertEquals("আঘ্নেয়া", p.toBangla("aghneya")); 23 | Assert.assertEquals("কর্তৃক", p.toBangla("korrtrrik")); 24 | Assert.assertEquals("বঞ্চনা", p.toBangla("boNGcona")); 25 | Assert.assertEquals("ঝঞ্ঝা", p.toBangla("jhoNGjha")); 26 | Assert.assertEquals("উধভ্রান্ত", p.toBangla("udhbhranto")); 27 | Assert.assertEquals("অয়ার", p.toBangla("oar")); 28 | Assert.assertEquals("বিজ্ঞান", p.toBangla("biggan")); 29 | Assert.assertEquals("চিহ্ন", p.toBangla("cihn")); 30 | Assert.assertEquals("", p.toBangla("")); 31 | 32 | } 33 | 34 | 35 | } 36 | --------------------------------------------------------------------------------