PageRenderTime 57ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 1ms

/lucene-3.6.0/contrib/analyzers/kuromoji/src/java/org/apache/lucene/analysis/ja/util/ToStringUtil.java

#
Java | 1039 lines | 989 code | 11 blank | 39 comment | 367 complexity | ba37499ca1f0423cffe90306a2fbca3f MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1, MIT, BSD-3-Clause, CPL-1.0, Apache-2.0, AGPL-1.0, GPL-2.0
  1. package org.apache.lucene.analysis.ja.util;
  2. /**
  3. * Licensed to the Apache Software Foundation (ASF) under one or more
  4. * contributor license agreements. See the NOTICE file distributed with
  5. * this work for additional information regarding copyright ownership.
  6. * The ASF licenses this file to You under the Apache License, Version 2.0
  7. * (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. import java.io.IOException;
  19. import java.util.HashMap;
  20. /**
  21. * Utility class for english translations of morphological data,
  22. * used only for debugging.
  23. */
  24. public class ToStringUtil {
  25. // a translation map for parts of speech, only used for reflectWith
  26. private static final HashMap<String,String> posTranslations = new HashMap<String,String>();
  27. static {
  28. posTranslations.put("??", "noun");
  29. posTranslations.put("??-??", "noun-common");
  30. posTranslations.put("??-????", "noun-proper");
  31. posTranslations.put("??-????-??", "noun-proper-misc");
  32. posTranslations.put("??-????-??", "noun-proper-person");
  33. posTranslations.put("??-????-??-??", "noun-proper-person-misc");
  34. posTranslations.put("??-????-??-?", "noun-proper-person-surname");
  35. posTranslations.put("??-????-??-?", "noun-proper-person-given_name");
  36. posTranslations.put("??-????-??", "noun-proper-organization");
  37. posTranslations.put("??-????-??", "noun-proper-place");
  38. posTranslations.put("??-????-??-??", "noun-proper-place-misc");
  39. posTranslations.put("??-????-??-?", "noun-proper-place-country");
  40. posTranslations.put("??-???", "noun-pronoun");
  41. posTranslations.put("??-???-??", "noun-pronoun-misc");
  42. posTranslations.put("??-???-??", "noun-pronoun-contraction");
  43. posTranslations.put("??-????", "noun-adverbial");
  44. posTranslations.put("??-????", "noun-verbal");
  45. posTranslations.put("??-??????", "noun-adjective-base");
  46. posTranslations.put("??-?", "noun-numeric");
  47. posTranslations.put("??-???", "noun-affix");
  48. posTranslations.put("??-???-??", "noun-affix-misc");
  49. posTranslations.put("??-???-????", "noun-affix-adverbial");
  50. posTranslations.put("??-???-?????", "noun-affix-aux");
  51. posTranslations.put("??-???-??????", "noun-affix-adjective-base");
  52. posTranslations.put("??-??", "noun-special");
  53. posTranslations.put("??-??-?????", "noun-special-aux");
  54. posTranslations.put("??-??", "noun-suffix");
  55. posTranslations.put("??-??-??", "noun-suffix-misc");
  56. posTranslations.put("??-??-??", "noun-suffix-person");
  57. posTranslations.put("??-??-??", "noun-suffix-place");
  58. posTranslations.put("??-??-????", "noun-suffix-verbal");
  59. posTranslations.put("??-??-?????", "noun-suffix-aux");
  60. posTranslations.put("??-??-??????", "noun-suffix-adjective-base");
  61. posTranslations.put("??-??-????", "noun-suffix-adverbial");
  62. posTranslations.put("??-??-???", "noun-suffix-classifier");
  63. posTranslations.put("??-??-??", "noun-suffix-special");
  64. posTranslations.put("??-????", "noun-suffix-conjunctive");
  65. posTranslations.put("??-??????", "noun-verbal_aux");
  66. posTranslations.put("??-?????", "noun-quotation");
  67. posTranslations.put("??-???????", "noun-nai_adjective");
  68. posTranslations.put("???", "prefix");
  69. posTranslations.put("???-????", "prefix-nominal");
  70. posTranslations.put("???-????", "prefix-verbal");
  71. posTranslations.put("???-?????", "prefix-adjectival");
  72. posTranslations.put("???-???", "prefix-numerical");
  73. posTranslations.put("??", "verb");
  74. posTranslations.put("??-??", "verb-main");
  75. posTranslations.put("??-???", "verb-auxiliary");
  76. posTranslations.put("??-??", "verb-suffix");
  77. posTranslations.put("???", "adjective");
  78. posTranslations.put("???-??", "adjective-main");
  79. posTranslations.put("???-???", "adjective-auxiliary");
  80. posTranslations.put("???-??", "adjective-suffix");
  81. posTranslations.put("??", "adverb");
  82. posTranslations.put("??-??", "adverb-misc");
  83. posTranslations.put("??-?????", "adverb-particle_conjunction");
  84. posTranslations.put("???", "adnominal");
  85. posTranslations.put("???", "conjunction");
  86. posTranslations.put("??", "particle");
  87. posTranslations.put("??-???", "particle-case");
  88. posTranslations.put("??-???-??", "particle-case-misc");
  89. posTranslations.put("??-???-??", "particle-case-quote");
  90. posTranslations.put("??-???-??", "particle-case-compound");
  91. posTranslations.put("??-????", "particle-conjunctive");
  92. posTranslations.put("??-???", "particle-dependency");
  93. posTranslations.put("??-???", "particle-adverbial");
  94. posTranslations.put("??-????", "particle-interjective");
  95. posTranslations.put("??-????", "particle-coordinate");
  96. posTranslations.put("??-???", "particle-final");
  97. posTranslations.put("??-????????????", "particle-adverbial/conjunctive/final");
  98. posTranslations.put("??-???", "particle-adnominalizer");
  99. posTranslations.put("??-???", "particle-adnominalizer");
  100. posTranslations.put("??-??", "particle-special");
  101. posTranslations.put("???", "auxiliary-verb");
  102. posTranslations.put("???", "interjection");
  103. posTranslations.put("??", "symbol");
  104. posTranslations.put("??-??", "symbol-misc");
  105. posTranslations.put("??-??", "symbol-period");
  106. posTranslations.put("??-??", "symbol-comma");
  107. posTranslations.put("??-??", "symbol-space");
  108. posTranslations.put("??-???", "symbol-open_bracket");
  109. posTranslations.put("??-???", "symbol-close_bracket");
  110. posTranslations.put("??-???????", "symbol-alphabetic");
  111. posTranslations.put("???", "other");
  112. posTranslations.put("???-??", "other-interjection");
  113. posTranslations.put("????", "filler");
  114. posTranslations.put("????", "non-verbal");
  115. posTranslations.put("???", "fragment");
  116. posTranslations.put("???", "unknown");
  117. }
  118. /**
  119. * Get the english form of a POS tag
  120. */
  121. public static String getPOSTranslation(String s) {
  122. return posTranslations.get(s);
  123. }
  124. // a translation map for inflection types, only used for reflectWith
  125. private static final HashMap<String,String> inflTypeTranslations = new HashMap<String,String>();
  126. static {
  127. inflTypeTranslations.put("*", "*");
  128. inflTypeTranslations.put("????????", "adj-group-a-o-u");
  129. inflTypeTranslations.put("??????", "adj-group-i");
  130. inflTypeTranslations.put("??????", "adj-group-ii");
  131. inflTypeTranslations.put("????", "non-inflectional");
  132. inflTypeTranslations.put("????", "special-da");
  133. inflTypeTranslations.put("????", "special-ta");
  134. inflTypeTranslations.put("??????", "classical-gotoshi");
  135. inflTypeTranslations.put("?????", "special-ja");
  136. inflTypeTranslations.put("?????", "special-nai");
  137. inflTypeTranslations.put("???????", "5-row-cons-r-special");
  138. inflTypeTranslations.put("????", "special-nu");
  139. inflTypeTranslations.put("????", "classical-ki");
  140. inflTypeTranslations.put("?????", "special-tai");
  141. inflTypeTranslations.put("?????", "classical-beshi");
  142. inflTypeTranslations.put("????", "special-ya");
  143. inflTypeTranslations.put("?????", "classical-maji");
  144. inflTypeTranslations.put("?????", "2-row-lower-cons-t");
  145. inflTypeTranslations.put("?????", "special-desu");
  146. inflTypeTranslations.put("?????", "special-masu");
  147. inflTypeTranslations.put("???????", "5-row-aru");
  148. inflTypeTranslations.put("?????", "classical-nari");
  149. inflTypeTranslations.put("????", "classical-ri");
  150. inflTypeTranslations.put("?????", "classical-keri");
  151. inflTypeTranslations.put("????", "classical-ru");
  152. inflTypeTranslations.put("????????", "5-row-cons-k-i-onbin");
  153. inflTypeTranslations.put("?????", "5-row-cons-s");
  154. inflTypeTranslations.put("??", "1-row");
  155. inflTypeTranslations.put("????????", "5-row-cons-w-cons-onbin");
  156. inflTypeTranslations.put("?????", "5-row-cons-m");
  157. inflTypeTranslations.put("?????", "5-row-cons-t");
  158. inflTypeTranslations.put("?????", "5-row-cons-r");
  159. inflTypeTranslations.put("??????", "irregular-suffix-suru");
  160. inflTypeTranslations.put("?????", "5-row-cons-g");
  161. inflTypeTranslations.put("??????", "irregular-suffix-zuru");
  162. inflTypeTranslations.put("?????", "5-row-cons-b");
  163. inflTypeTranslations.put("????????", "5-row-cons-w-u-onbin");
  164. inflTypeTranslations.put("?????", "2-row-lower-cons-d");
  165. inflTypeTranslations.put("??????????", "5-row-cons-k-cons-onbin-yuku");
  166. inflTypeTranslations.put("?????", "2-row-upper-cons-d");
  167. inflTypeTranslations.put("????????", "5-row-cons-k-cons-onbin");
  168. inflTypeTranslations.put("?????", "1-row-eru");
  169. inflTypeTranslations.put("?????", "4-row-cons-t");
  170. inflTypeTranslations.put("?????", "5-row-cons-n");
  171. inflTypeTranslations.put("?????", "2-row-lower-cons-h");
  172. inflTypeTranslations.put("?????", "4-row-cons-h");
  173. inflTypeTranslations.put("?????", "4-row-cons-b");
  174. inflTypeTranslations.put("?????", "irregular-suru");
  175. inflTypeTranslations.put("?????", "2-row-upper-cons-h");
  176. inflTypeTranslations.put("?????", "2-row-lower-cons-m");
  177. inflTypeTranslations.put("?????", "4-row-cons-s");
  178. inflTypeTranslations.put("?????", "2-row-lower-cons-g");
  179. inflTypeTranslations.put("?????", "kuru-kanji");
  180. inflTypeTranslations.put("??????", "1-row-kureru");
  181. inflTypeTranslations.put("????", "2-row-lower-u");
  182. inflTypeTranslations.put("?????", "kuru-kana");
  183. inflTypeTranslations.put("??", "irregular-cons-r");
  184. inflTypeTranslations.put("?????", "2-row-lower-cons-k");
  185. }
  186. /**
  187. * Get the english form of inflection type
  188. */
  189. public static String getInflectionTypeTranslation(String s) {
  190. return inflTypeTranslations.get(s);
  191. }
  192. // a translation map for inflection forms, only used for reflectWith
  193. private static final HashMap<String,String> inflFormTranslations = new HashMap<String,String>();
  194. static {
  195. inflFormTranslations.put("*", "*");
  196. inflFormTranslations.put("???", "base");
  197. inflFormTranslations.put("?????", "classical-base");
  198. inflFormTranslations.put("?????", "imperfective-nu-connection");
  199. inflFormTranslations.put("?????", "imperfective-u-connection");
  200. inflFormTranslations.put("?????", "conjunctive-ta-connection");
  201. inflFormTranslations.put("?????", "conjunctive-te-connection");
  202. inflFormTranslations.put("???????", "conjunctive-gozai-connection");
  203. inflFormTranslations.put("????", "uninflected-connection");
  204. inflFormTranslations.put("???", "subjunctive");
  205. inflFormTranslations.put("???", "imperative-e");
  206. inflFormTranslations.put("?????", "conditional-contracted-1");
  207. inflFormTranslations.put("?????", "conditional-contracted-2");
  208. inflFormTranslations.put("????", "garu-connection");
  209. inflFormTranslations.put("???", "imperfective");
  210. inflFormTranslations.put("???", "conjunctive");
  211. inflFormTranslations.put("?????", "onbin-base");
  212. inflFormTranslations.put("?????", "conjunctive-de-connection");
  213. inflFormTranslations.put("????", "imperfective-special");
  214. inflFormTranslations.put("???", "imperative-i");
  215. inflFormTranslations.put("?????", "conjunctive-ni-connection");
  216. inflFormTranslations.put("????", "imperative-yo");
  217. inflFormTranslations.put("??????", "adnominal-special");
  218. inflFormTranslations.put("????", "imperative-ro");
  219. inflFormTranslations.put("???????", "uninflected-special-connection-2");
  220. inflFormTranslations.put("??????", "imperfective-reru-connection");
  221. inflFormTranslations.put("?????", "modern-base");
  222. inflFormTranslations.put("???-???", "base-onbin"); // not sure about this
  223. }
  224. /**
  225. * Get the english form of inflected form
  226. */
  227. public static String getInflectedFormTranslation(String s) {
  228. return inflFormTranslations.get(s);
  229. }
  230. /**
  231. * Romanize katakana with modified hepburn
  232. */
  233. public static String getRomanization(String s) {
  234. StringBuilder out = new StringBuilder();
  235. try {
  236. getRomanization(out, s);
  237. } catch (IOException bogus) {
  238. throw new RuntimeException(bogus);
  239. }
  240. return out.toString();
  241. }
  242. /**
  243. * Romanize katakana with modified hepburn
  244. */
  245. public static void getRomanization(Appendable builder, CharSequence s) throws IOException {
  246. final int len = s.length();
  247. for (int i = 0; i < len; i++) {
  248. // maximum lookahead: 3
  249. char ch = s.charAt(i);
  250. char ch2 = (i < len - 1) ? s.charAt(i + 1) : 0;
  251. char ch3 = (i < len - 2) ? s.charAt(i + 2) : 0;
  252. main: switch (ch) {
  253. case '?':
  254. switch (ch2) {
  255. case '?':
  256. case '?':
  257. case '?':
  258. case '?':
  259. case '?':
  260. builder.append('k');
  261. break main;
  262. case '?':
  263. case '?':
  264. case '?':
  265. case '?':
  266. case '?':
  267. builder.append('s');
  268. break main;
  269. case '?':
  270. case '?':
  271. case '?':
  272. case '?':
  273. case '?':
  274. builder.append('t');
  275. break main;
  276. case '?':
  277. case '?':
  278. case '?':
  279. case '?':
  280. case '?':
  281. builder.append('p');
  282. break main;
  283. }
  284. break;
  285. case '?':
  286. builder.append('a');
  287. break;
  288. case '?':
  289. if (ch2 == '?') {
  290. builder.append("yi");
  291. i++;
  292. } else if (ch2 == '?') {
  293. builder.append("ye");
  294. i++;
  295. } else {
  296. builder.append('i');
  297. }
  298. break;
  299. case '?':
  300. switch(ch2) {
  301. case '?':
  302. builder.append("wa");
  303. i++;
  304. break;
  305. case '?':
  306. builder.append("wi");
  307. i++;
  308. break;
  309. case '?':
  310. builder.append("wu");
  311. i++;
  312. break;
  313. case '?':
  314. builder.append("we");
  315. i++;
  316. break;
  317. case '?':
  318. builder.append("wo");
  319. i++;
  320. break;
  321. case '?':
  322. builder.append("wyu");
  323. i++;
  324. break;
  325. default:
  326. builder.append('u');
  327. break;
  328. }
  329. break;
  330. case '?':
  331. builder.append('e');
  332. break;
  333. case '?':
  334. if (ch2 == '?') {
  335. builder.append('?');
  336. i++;
  337. } else {
  338. builder.append('o');
  339. }
  340. break;
  341. case '?':
  342. builder.append("ka");
  343. break;
  344. case '?':
  345. if (ch2 == '?' && ch3 == '?') {
  346. builder.append("ky?");
  347. i += 2;
  348. } else if (ch2 == '?' && ch3 == '?') {
  349. builder.append("ky?");
  350. i += 2;
  351. } else if (ch2 == '?') {
  352. builder.append("kya");
  353. i++;
  354. } else if (ch2 == '?') {
  355. builder.append("kyo");
  356. i++;
  357. } else if (ch2 == '?') {
  358. builder.append("kyu");
  359. i++;
  360. } else if (ch2 == '?') {
  361. builder.append("kye");
  362. i++;
  363. } else {
  364. builder.append("ki");
  365. }
  366. break;
  367. case '?':
  368. switch(ch2) {
  369. case '?':
  370. builder.append("kwa");
  371. i++;
  372. break;
  373. case '?':
  374. builder.append("kwi");
  375. i++;
  376. break;
  377. case '?':
  378. builder.append("kwe");
  379. i++;
  380. break;
  381. case '?':
  382. builder.append("kwo");
  383. i++;
  384. break;
  385. case '?':
  386. builder.append("kwa");
  387. i++;
  388. break;
  389. default:
  390. builder.append("ku");
  391. break;
  392. }
  393. break;
  394. case '?':
  395. builder.append("ke");
  396. break;
  397. case '?':
  398. if (ch2 == '?') {
  399. builder.append("k?");
  400. i++;
  401. } else {
  402. builder.append("ko");
  403. }
  404. break;
  405. case '?':
  406. builder.append("sa");
  407. break;
  408. case '?':
  409. if (ch2 == '?' && ch3 == '?') {
  410. builder.append("sh?");
  411. i += 2;
  412. } else if (ch2 == '?' && ch3 == '?') {
  413. builder.append("sh?");
  414. i += 2;
  415. } else if (ch2 == '?') {
  416. builder.append("sha");
  417. i++;
  418. } else if (ch2 == '?') {
  419. builder.append("sho");
  420. i++;
  421. } else if (ch2 == '?') {
  422. builder.append("shu");
  423. i++;
  424. } else if (ch2 == '?') {
  425. builder.append("she");
  426. i++;
  427. } else {
  428. builder.append("shi");
  429. }
  430. break;
  431. case '?':
  432. if (ch2 == '?') {
  433. builder.append("si");
  434. i++;
  435. } else {
  436. builder.append("su");
  437. }
  438. break;
  439. case '?':
  440. builder.append("se");
  441. break;
  442. case '?':
  443. if (ch2 == '?') {
  444. builder.append("s?");
  445. i++;
  446. } else {
  447. builder.append("so");
  448. }
  449. break;
  450. case '?':
  451. builder.append("ta");
  452. break;
  453. case '?':
  454. if (ch2 == '?' && ch3 == '?') {
  455. builder.append("ch?");
  456. i += 2;
  457. } else if (ch2 == '?' && ch3 == '?') {
  458. builder.append("ch?");
  459. i += 2;
  460. } else if (ch2 == '?') {
  461. builder.append("cha");
  462. i++;
  463. } else if (ch2 == '?') {
  464. builder.append("cho");
  465. i++;
  466. } else if (ch2 == '?') {
  467. builder.append("chu");
  468. i++;
  469. } else if (ch2 == '?') {
  470. builder.append("che");
  471. i++;
  472. } else {
  473. builder.append("chi");
  474. }
  475. break;
  476. case '?':
  477. if (ch2 == '?') {
  478. builder.append("tsa");
  479. i++;
  480. } else if (ch2 == '?') {
  481. builder.append("tsi");
  482. i++;
  483. } else if (ch2 == '?') {
  484. builder.append("tse");
  485. i++;
  486. } else if (ch2 == '?') {
  487. builder.append("tso");
  488. i++;
  489. } else if (ch2 == '?') {
  490. builder.append("tsyu");
  491. i++;
  492. } else {
  493. builder.append("tsu");
  494. }
  495. break;
  496. case '?':
  497. if (ch2 == '?') {
  498. builder.append("ti");
  499. i++;
  500. } else if (ch2 == '?') {
  501. builder.append("tu");
  502. i++;
  503. } else if (ch2 == '?') {
  504. builder.append("tyu");
  505. i++;
  506. } else {
  507. builder.append("te");
  508. }
  509. break;
  510. case '?':
  511. if (ch2 == '?') {
  512. builder.append("t?");
  513. i++;
  514. } else {
  515. builder.append("to");
  516. }
  517. break;
  518. case '?':
  519. builder.append("na");
  520. break;
  521. case '?':
  522. if (ch2 == '?' && ch3 == '?') {
  523. builder.append("ny?");
  524. i += 2;
  525. } else if (ch2 == '?' && ch3 == '?') {
  526. builder.append("ny?");
  527. i += 2;
  528. } else if (ch2 == '?') {
  529. builder.append("nya");
  530. i++;
  531. } else if (ch2 == '?') {
  532. builder.append("nyo");
  533. i++;
  534. } else if (ch2 == '?') {
  535. builder.append("nyu");
  536. i++;
  537. } else if (ch2 == '?') {
  538. builder.append("nye");
  539. i++;
  540. } else {
  541. builder.append("ni");
  542. }
  543. break;
  544. case '?':
  545. builder.append("nu");
  546. break;
  547. case '?':
  548. builder.append("ne");
  549. break;
  550. case '?':
  551. if (ch2 == '?') {
  552. builder.append("n?");
  553. i++;
  554. } else {
  555. builder.append("no");
  556. }
  557. break;
  558. case '?':
  559. builder.append("ha");
  560. break;
  561. case '?':
  562. if (ch2 == '?' && ch3 == '?') {
  563. builder.append("hy?");
  564. i += 2;
  565. } else if (ch2 == '?' && ch3 == '?') {
  566. builder.append("hy?");
  567. i += 2;
  568. } else if (ch2 == '?') {
  569. builder.append("hya");
  570. i++;
  571. } else if (ch2 == '?') {
  572. builder.append("hyo");
  573. i++;
  574. } else if (ch2 == '?') {
  575. builder.append("hyu");
  576. i++;
  577. } else if (ch2 == '?') {
  578. builder.append("hye");
  579. i++;
  580. } else {
  581. builder.append("hi");
  582. }
  583. break;
  584. case '?':
  585. if (ch2 == '?') {
  586. builder.append("fya");
  587. i++;
  588. } else if (ch2 == '?') {
  589. builder.append("fyu");
  590. i++;
  591. } else if (ch2 == '?' && ch3 == '?') {
  592. builder.append("fye");
  593. i+=2;
  594. } else if (ch2 == '?') {
  595. builder.append("fyo");
  596. i++;
  597. } else if (ch2 == '?') {
  598. builder.append("fa");
  599. i++;
  600. } else if (ch2 == '?') {
  601. builder.append("fi");
  602. i++;
  603. } else if (ch2 == '?') {
  604. builder.append("fe");
  605. i++;
  606. } else if (ch2 == '?') {
  607. builder.append("fo");
  608. i++;
  609. } else {
  610. builder.append("fu");
  611. }
  612. break;
  613. case '?':
  614. builder.append("he");
  615. break;
  616. case '?':
  617. if (ch2 == '?') {
  618. builder.append("h?");
  619. i++;
  620. } else if (ch2 == '?') {
  621. builder.append("hu");
  622. i++;
  623. } else {
  624. builder.append("ho");
  625. }
  626. break;
  627. case '?':
  628. builder.append("ma");
  629. break;
  630. case '?':
  631. if (ch2 == '?' && ch3 == '?') {
  632. builder.append("my?");
  633. i += 2;
  634. } else if (ch2 == '?' && ch3 == '?') {
  635. builder.append("my?");
  636. i += 2;
  637. } else if (ch2 == '?') {
  638. builder.append("mya");
  639. i++;
  640. } else if (ch2 == '?') {
  641. builder.append("myo");
  642. i++;
  643. } else if (ch2 == '?') {
  644. builder.append("myu");
  645. i++;
  646. } else if (ch2 == '?') {
  647. builder.append("mye");
  648. i++;
  649. } else {
  650. builder.append("mi");
  651. }
  652. break;
  653. case '?':
  654. builder.append("mu");
  655. break;
  656. case '?':
  657. builder.append("mi");
  658. break;
  659. case '?':
  660. if (ch2 == '?') {
  661. builder.append("m?");
  662. i++;
  663. } else {
  664. builder.append("mo");
  665. }
  666. break;
  667. case '?':
  668. builder.append("ya");
  669. break;
  670. case '?':
  671. builder.append("yu");
  672. break;
  673. case '?':
  674. if (ch2 == '?') {
  675. builder.append("y?");
  676. i++;
  677. } else {
  678. builder.append("yo");
  679. }
  680. break;
  681. case '?':
  682. builder.append("ra");
  683. break;
  684. case '?':
  685. if (ch2 == '?' && ch3 == '?') {
  686. builder.append("ry?");
  687. i += 2;
  688. } else if (ch2 == '?' && ch3 == '?') {
  689. builder.append("ry?");
  690. i += 2;
  691. } else if (ch2 == '?') {
  692. builder.append("rya");
  693. i++;
  694. } else if (ch2 == '?') {
  695. builder.append("ryo");
  696. i++;
  697. } else if (ch2 == '?') {
  698. builder.append("ryu");
  699. i++;
  700. } else if (ch2 == '?') {
  701. builder.append("rye");
  702. i++;
  703. } else {
  704. builder.append("ri");
  705. }
  706. break;
  707. case '?':
  708. builder.append("ru");
  709. break;
  710. case '?':
  711. builder.append("re");
  712. break;
  713. case '?':
  714. if (ch2 == '?') {
  715. builder.append("r?");
  716. i++;
  717. } else {
  718. builder.append("ro");
  719. }
  720. break;
  721. case '?':
  722. builder.append("wa");
  723. break;
  724. case '?':
  725. builder.append("i");
  726. break;
  727. case '?':
  728. builder.append("e");
  729. break;
  730. case '?':
  731. builder.append("o");
  732. break;
  733. case '?':
  734. switch (ch2) {
  735. case '?':
  736. case '?':
  737. case '?':
  738. case '?':
  739. case '?':
  740. case '?':
  741. case '?':
  742. case '?':
  743. case '?':
  744. case '?':
  745. case '?':
  746. case '?':
  747. case '?':
  748. case '?':
  749. case '?':
  750. builder.append('m');
  751. break main;
  752. case '?':
  753. case '?':
  754. case '?':
  755. case '?':
  756. case '?':
  757. case '?':
  758. case '?':
  759. case '?':
  760. builder.append("n'");
  761. break main;
  762. default:
  763. builder.append("n");
  764. break main;
  765. }
  766. case '?':
  767. builder.append("ga");
  768. break;
  769. case '?':
  770. if (ch2 == '?' && ch3 == '?') {
  771. builder.append("gy?");
  772. i += 2;
  773. } else if (ch2 == '?' && ch3 == '?') {
  774. builder.append("gy?");
  775. i += 2;
  776. } else if (ch2 == '?') {
  777. builder.append("gya");
  778. i++;
  779. } else if (ch2 == '?') {
  780. builder.append("gyo");
  781. i++;
  782. } else if (ch2 == '?') {
  783. builder.append("gyu");
  784. i++;
  785. } else if (ch2 == '?') {
  786. builder.append("gye");
  787. i++;
  788. } else {
  789. builder.append("gi");
  790. }
  791. break;
  792. case '?':
  793. switch(ch2) {
  794. case '?':
  795. builder.append("gwa");
  796. i++;
  797. break;
  798. case '?':
  799. builder.append("gwi");
  800. i++;
  801. break;
  802. case '?':
  803. builder.append("gwe");
  804. i++;
  805. break;
  806. case '?':
  807. builder.append("gwo");
  808. i++;
  809. break;
  810. case '?':
  811. builder.append("gwa");
  812. i++;
  813. break;
  814. default:
  815. builder.append("gu");
  816. break;
  817. }
  818. break;
  819. case '?':
  820. builder.append("ge");
  821. break;
  822. case '?':
  823. if (ch2 == '?') {
  824. builder.append("g?");
  825. i++;
  826. } else {
  827. builder.append("go");
  828. }
  829. break;
  830. case '?':
  831. builder.append("za");
  832. break;
  833. case '?':
  834. if (ch2 == '?' && ch3 == '?') {
  835. builder.append("j?");
  836. i += 2;
  837. } else if (ch2 == '?' && ch3 == '?') {
  838. builder.append("j?");
  839. i += 2;
  840. } else if (ch2 == '?') {
  841. builder.append("ja");
  842. i++;
  843. } else if (ch2 == '?') {
  844. builder.append("jo");
  845. i++;
  846. } else if (ch2 == '?') {
  847. builder.append("ju");
  848. i++;
  849. } else if (ch2 == '?') {
  850. builder.append("je");
  851. i++;
  852. } else {
  853. builder.append("ji");
  854. }
  855. break;
  856. case '?':
  857. if (ch2 == '?') {
  858. builder.append("zi");
  859. i++;
  860. } else {
  861. builder.append("zu");
  862. }
  863. break;
  864. case '?':
  865. builder.append("ze");
  866. break;
  867. case '?':
  868. if (ch2 == '?') {
  869. builder.append("z?");
  870. i++;
  871. } else {
  872. builder.append("zo");
  873. }
  874. break;
  875. case '?':
  876. builder.append("da");
  877. break;
  878. case '?':
  879. builder.append("ji");
  880. break;
  881. case '?':
  882. builder.append("zu");
  883. break;
  884. case '?':
  885. if (ch2 == '?') {
  886. builder.append("di");
  887. i++;
  888. } else if (ch2 == '?') {
  889. builder.append("dyu");
  890. i++;
  891. } else {
  892. builder.append("de");
  893. }
  894. break;
  895. case '?':
  896. if (ch2 == '?') {
  897. builder.append("d?");
  898. i++;
  899. } else if (ch2 == '?') {
  900. builder.append("du");
  901. i++;
  902. } else {
  903. builder.append("do");
  904. }
  905. break;
  906. case '?':
  907. builder.append("ba");
  908. break;
  909. case '?':
  910. if (ch2 == '?' && ch3 == '?') {
  911. builder.append("by?");
  912. i += 2;
  913. } else if (ch2 == '?' && ch3 == '?') {
  914. builder.append("by?");
  915. i += 2;
  916. } else if (ch2 == '?') {
  917. builder.append("bya");
  918. i++;
  919. } else if (ch2 == '?') {
  920. builder.append("byo");
  921. i++;
  922. } else if (ch2 == '?') {
  923. builder.append("byu");
  924. i++;
  925. } else if (ch2 == '?') {
  926. builder.append("bye");
  927. i++;
  928. } else {
  929. builder.append("bi");
  930. }
  931. break;
  932. case '?':
  933. builder.append("bu");
  934. break;
  935. case '?':
  936. builder.append("be");
  937. break;
  938. case '?':
  939. if (ch2 == '?') {
  940. builder.append("b?");
  941. i++;
  942. } else {
  943. builder.append("bo");
  944. }
  945. break;
  946. case '?':
  947. builder.append("pa");
  948. break;
  949. case '?':
  950. if (ch2 == '?' && ch3 == '?') {
  951. builder.append("py?");
  952. i += 2;
  953. } else if (ch2 == '?' && ch3 == '?') {
  954. builder.append("py?");
  955. i += 2;
  956. } else if (ch2 == '?') {
  957. builder.append("pya");
  958. i++;
  959. } else if (ch2 == '?') {
  960. builder.append("pyo");
  961. i++;
  962. } else if (ch2 == '?') {
  963. builder.append("pyu");
  964. i++;
  965. } else if (ch2 == '?') {
  966. builder.append("pye");
  967. i++;
  968. } else {
  969. builder.append("pi");
  970. }
  971. break;
  972. case '?':
  973. builder.append("pu");
  974. break;
  975. case '?':
  976. builder.append("pe");
  977. break;
  978. case '?':
  979. if (ch2 == '?') {
  980. builder.append("p?");
  981. i++;
  982. } else {
  983. builder.append("po");
  984. }
  985. break;
  986. case '?':
  987. if (ch2 == '?' && ch3 == '?') {
  988. builder.append("vye");
  989. i+= 2;
  990. } else {
  991. builder.append('v');
  992. }
  993. break;
  994. case '?':
  995. builder.append('a');
  996. break;
  997. case '?':
  998. builder.append('i');
  999. break;
  1000. case '?':
  1001. builder.append('u');
  1002. break;
  1003. case '?':
  1004. builder.append('e');
  1005. break;
  1006. case '?':
  1007. builder.append('o');
  1008. break;
  1009. case '?':
  1010. builder.append("wa");
  1011. break;
  1012. case '?':
  1013. builder.append("ya");
  1014. break;
  1015. case '?':
  1016. builder.append("yu");
  1017. break;
  1018. case '?':
  1019. builder.append("yo");
  1020. break;
  1021. case '?':
  1022. break;
  1023. default:
  1024. builder.append(ch);
  1025. }
  1026. }
  1027. }
  1028. }