📄 cntospell.java
字号:
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Set;
import java.util.Date;
/**
*
* 汉字转化为全拼,码表利用输入法的码表导出,汉字信息非常全,平时见到的汉字
* 转拼音的API只能处理几千个一级汉字,很多字都没有法查到,尤其是我自己的姓
* 都查不到所以只好自己做一个汉字转拼音的API,该API除可以处理99%以上的汉字,
* 而且可以返回多音字的读音
* Author:逯永收<louis@easyea.com>
* JDK版本: 1.4
*/
public class CnToSpell {
private static LinkedHashMap spellMap = null;
static {
if (spellMap == null) {
spellMap = new LinkedHashMap(20901);
}
initialize();
}
private CnToSpell() {
}
private static void spellPut(String ascii, String spells) {
spellMap.put(ascii, spells);
}
private static void initialize() {
init0();
init1();
init2();
init3();
init4();
init5();
init6();
init7();
init8();
init9();
init10();
init11();
init12();
init13();
init14();
init15();
init16();
init17();
init18();
init19();
init20();
init21();
init22();
init23();
init24();
init25();
init26();
init27();
init28();
init29();
init30();
init31();
init32();
init33();
init34();
init35();
init36();
init37();
init38();
init39();
init40();
init41();
init42();
init43();
init44();
init45();
init46();
init47();
init48();
init49();
init50();
init51();
init52();
init53();
init54();
init55();
init56();
init57();
init58();
init59();
init60();
init61();
init62();
init63();
init64();
init65();
init66();
init67();
init68();
init69();
init70();
init71();
init72();
init73();
init74();
init75();
init76();
init77();
init78();
init79();
init80();
init81();
init82();
init83();
init84();
init85();
init86();
init87();
init88();
init89();
init90();
init91();
init92();
init93();
init94();
init95();
init96();
init97();
init98();
init99();
init100();
init101();
init102();
init103();
init104();
init105();
init106();
init107();
init108();
init109();
init110();
init111();
init112();
init113();
init114();
init115();
}
private static void init0() {
spellPut("129-64", "kao,qiao,yu");
spellPut("129-65", "shang");
spellPut("129-66", "xia");
spellPut("129-67", "mo ye o ne");
spellPut("129-68", "mian");
spellPut("129-69", "chou");
spellPut("129-70", "shi");
spellPut("129-71", "diu");
spellPut("129-72", "qiu");
spellPut("129-73", "liang");
spellPut("129-74", "you");
spellPut("129-75", "bing");
spellPut("129-76", "jiu");
spellPut("129-77", "ji");
spellPut("129-78", "jie");
spellPut("129-79", "guan,kuang");
spellPut("129-80", "chan");
spellPut("129-81", "zhuo");
spellPut("129-82", "ba");
spellPut("129-83", "jing");
spellPut("129-84", "fu");
spellPut("129-85", "yi,ji");
spellPut("129-86", "yi");
spellPut("129-87", "shi me");
spellPut("129-88", "jiu");
spellPut("129-89", "ho");
spellPut("129-90", "yin");
spellPut("129-91", "hu");
spellPut("129-92", "cheng,sheng");
spellPut("129-93", "hao,yi");
spellPut("129-94", "wBn");
spellPut("129-95", "gai");
spellPut("129-96", "jiu");
spellPut("129-97", "hB ri");
spellPut("129-98", "ho lo");
spellPut("129-99", "dou");
spellPut("129-100", "shi");
spellPut("129-101", "nang");
spellPut("129-102", "gB ri");
spellPut("129-103", "ge ri");
spellPut("129-104", "dBo ri");
spellPut("129-105", "mo ri");
spellPut("129-106", "o lo");
spellPut("129-107", "cB lo");
spellPut("129-108", "xue");
spellPut("129-109", "yan");
spellPut("129-110", "po ri");
spellPut("129-111", "sB lo");
spellPut("129-112", "na");
spellPut("129-113", "qian");
spellPut("129-114", "sBo ri");
spellPut("129-115", "er");
spellPut("129-116", "zu ri");
spellPut("129-117", "zB ri");
spellPut("129-118", "zhi,luan");
spellPut("129-119", "gui");
spellPut("129-120", "qian");
spellPut("129-121", "luan");
spellPut("129-122", "lin");
spellPut("129-123", "yi");
spellPut("129-124", "jue");
spellPut("129-125", "ma");
spellPut("129-126", "shi");
spellPut("129-128", "yu");
spellPut("129-129", "si");
spellPut("129-130", "sui");
spellPut("129-131", "gen");
spellPut("129-132", "ya");
spellPut("129-133", "qi,zhai");
spellPut("129-134", "ya");
spellPut("129-135", "da");
spellPut("129-136", "ye");
spellPut("129-137", "xiang");
spellPut("129-138", "jing");
spellPut("129-139", "ye");
spellPut("129-140", "you");
spellPut("129-141", "dan");
spellPut("129-142", "lian");
spellPut("129-143", "duo");
spellPut("129-144", "wei,men");
spellPut("129-145", "ji");
spellPut("129-146", "ji");
spellPut("129-147", "wang");
spellPut("129-148", "ba");
spellPut("129-149", "bing");
spellPut("129-150", "fo");
spellPut("129-151", "jin,san");
spellPut("129-152", "e o");
spellPut("129-153", "xian");
spellPut("129-154", "tuo,cha,duo");
spellPut("129-155", "hong");
spellPut("129-156", "gan,han");
spellPut("129-157", "bo");
spellPut("129-158", "chao");
spellPut("129-159", "chang,zhang");
spellPut("129-160", "chang");
spellPut("129-161", "ren");
spellPut("129-162", "fan");
spellPut("129-163", "chao,miao");
spellPut("129-164", "qian");
spellPut("129-165", "wo");
spellPut("129-166", "yao,fo");
spellPut("129-167", "feng");
spellPut("129-168", "cang");
spellPut("129-169", "wang");
spellPut("129-170", "di");
spellPut("129-171", "zhong");
spellPut("129-172", "pei");
spellPut("129-173", "yu");
spellPut("129-174", "diao");
spellPut("129-175", "dun");
spellPut("129-176", "wen");
spellPut("129-177", "yi");
spellPut("129-178", "xin");
spellPut("129-179", "ji");
spellPut("129-180", "ai");
spellPut("129-181", "jin");
spellPut("129-182", "pi");
spellPut("129-183", "dan");
spellPut("129-184", "fu");
spellPut("129-185", "tang");
spellPut("129-186", "cui");
spellPut("129-187", "yun");
spellPut("129-188", "che,ju");
spellPut("129-189", "qian");
spellPut("129-190", "xun");
spellPut("129-191", "xin");
spellPut("129-192", "chi");
spellPut("129-193", "xian,xuan");
spellPut("129-194", "nu");
spellPut("129-195", "ni");
spellPut("129-196", "xie");
spellPut("129-197", "xu");
spellPut("129-198", "zhou");
spellPut("129-199", "qu");
spellPut("129-200", "peng");
spellPut("129-201", "pi");
spellPut("129-202", "zhi");
spellPut("129-203", "si");
spellPut("129-204", "yi,chi");
spellPut("129-205", "zheng");
spellPut("129-206", "han,gan");
spellPut("129-207", "mai");
spellPut("129-208", "zhu");
spellPut("129-209", "bu");
spellPut("129-210", "qu");
spellPut("129-211", "bi");
spellPut("129-212", "zhao,shao");
spellPut("129-213", "ci");
spellPut("129-214", "yang");
spellPut("129-215", "zhan,dian");
spellPut("129-216", "bi");
spellPut("129-217", "xian");
spellPut("129-218", "qu");
spellPut("129-219", "shi");
spellPut("129-220", "bBo");
spellPut("129-221", "hui,huai");
spellPut("129-222", "ge");
spellPut("129-223", "xiang");
spellPut("129-224", "ge");
spellPut("129-225", "fa");
spellPut("129-226", "ming");
spellPut("129-227", "bing");
spellPut("129-228", "hen");
spellPut("129-229", "huo");
spellPut("129-230", "gui");
spellPut("129-231", "quan");
spellPut("129-232", "ci");
spellPut("129-233", "xing");
spellPut("129-234", "shen");
spellPut("129-235", "tuo");
spellPut("129-236", "gai");
spellPut("129-237", "lai");
spellPut("129-238", "yi");
spellPut("129-239", "gong");
spellPut("129-240", "yin");
spellPut("129-241", "mi");
spellPut("129-242", "xu");
spellPut("129-243", "an");
spellPut("129-244", "lu");
spellPut("129-245", "er");
spellPut("129-246", "lun");
spellPut("129-247", "cha");
spellPut("129-248", "chi");
spellPut("129-249", "xun");
spellPut("129-250", "zhou");
spellPut("129-251", "ru");
spellPut("129-252", "cun");
spellPut("129-253", "si");
spellPut("129-254", "dai");
}
private static void init1() {
spellPut("130-64", "tB");
spellPut("130-65", "ning");
spellPut("130-66", "jin");
spellPut("130-67", "jiong");
spellPut("130-68", "cheng,ting");
spellPut("130-69", "zhen");
spellPut("130-70", "zuo");
spellPut("130-71", "hao");
spellPut("130-72", "lv");
spellPut("130-73", "jv");
spellPut("130-74", "shu,dou");
spellPut("130-75", "ting");
spellPut("130-76", "shen");
spellPut("130-77", "tuo,tui");
spellPut("130-78", "bo");
spellPut("130-79", "nan");
spellPut("130-80", "xiao");
spellPut("130-81", "tui");
spellPut("130-82", "yu");
spellPut("130-83", "xi");
spellPut("130-84", "xu");
spellPut("130-85", "guang");
spellPut("130-86", "ku");
spellPut("130-87", "wu");
spellPut("130-88", "yi");
spellPut("130-89", "fu");
spellPut("130-90", "liang");
spellPut("130-91", "hun");
spellPut("130-92", "jing");
spellPut("130-93", "qian");
spellPut("130-94", "san");
spellPut("130-95", "pei");
spellPut("130-96", "xi");
spellPut("130-97", "fu");
spellPut("130-98", "xia");
spellPut("130-99", "xiu");
spellPut("130-100", "di");
spellPut("130-101", "che,ju");
spellPut("130-102", "zhi");
spellPut("130-103", "lai");
spellPut("130-104", "si");
spellPut("130-105", "huo");
spellPut("130-106", "xiao");
spellPut("130-107", "jian");
spellPut("130-108", "biao");
spellPut("130-109", "chu,ti");
spellPut("130-110", "fei");
spellPut("130-111", "ya");
spellPut("130-112", "bei");
spellPut("130-113", "yu");
spellPut("130-114", "xin");
spellPut("130-115", "hu,chi");
spellPut("130-116", "chang");
spellPut("130-117", "zhi");
spellPut("130-118", "bing");
spellPut("130-119", "jiu");
spellPut("130-120", "yao");
spellPut("130-121", "cui,zu");
spellPut("130-122", "liang,lia");
spellPut("130-123", "wan");
spellPut("130-124", "lai");
spellPut("130-125", "cang");
spellPut("130-126", "zong");
spellPut("130-128", "ge");
spellPut("130-129", "tian");
spellPut("130-130", "shu");
spellPut("130-131", "men");
spellPut("130-132", "tan");
spellPut("130-133", "chui");
spellPut("130-134", "xing");
spellPut("130-135", "peng");
spellPut("130-136", "qi");
spellPut("130-137", "gan");
spellPut("130-138", "liang,jing");
spellPut("130-139", "sui");
spellPut("130-140", "jie");
spellPut("130-141", "fang");
spellPut("130-142", "zhi");
spellPut("130-143", "zong");
spellPut("130-144", "lun");
spellPut("130-145", "song");
spellPut("130-146", "leng");
spellPut("130-147", "hun");
spellPut("130-148", "dong");
spellPut("130-149", "zi");
spellPut("130-150", "ben");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -