/*
 * Copyright 2022-2025 兮玥(190785909@qq.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.chestnut.common.utils;

import lombok.extern.slf4j.Slf4j;

import java.io.UnsupportedEncodingException;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Slf4j
public class ChineseSpelling {

	private static LinkedHashMap<String, String> specialFamilyNames = new LinkedHashMap<>();

	public static int countChineseCharactersByRegex(String input) {
		// 使用正则表达式匹配中文字符
		String regex = "[\\u4e00-\\u9fa5]";
		Pattern pattern = Pattern.compile(regex);
		Matcher matcher = pattern.matcher(input);

		int count = 0;
		while (matcher.find()) {
			count++;
		}
		return count;
	}

	/**
	 * 获得单个汉字的GBK编码
	 * 
	 * @param cn char 汉字字符
	 * @return int 错误返回 0,否则返回ascii
	 */
	public static int getGBKCode(char cn) {
		byte[] bytes = null;
		try {
			bytes = String.valueOf(cn).getBytes("GBK");
		} catch (UnsupportedEncodingException e) {
			log.error(e.getMessage(), e);
		}
		if (bytes == null || bytes.length > 2 || bytes.length <= 0) { // 错误
			return 0;
		}
		if (bytes.length == 1) { // 英文字符
			return bytes[0];
		}
		// 中文字符
		int highByte = 256 + bytes[0];
		int lowByte = 256 + bytes[1];
        return 256 * highByte + lowByte - 256 * 256;
	}

	/**
	 * 根据GBK码到SpellMap中查找对应的拼音
	 * 
	 * @param code 字符对应的GBK码
	 * @return 拼音,首先判断code是否>0&<160,如果是返回对应的字符, <BR>
	 *         否则到spellMap中查找,如果没有找到拼音,则返回null,如果找到则返回拼音.
	 */
	private static String getSpellByGBKCode(int code) {
		if (code > 0 && code < 160) { // 单字符
			return String.valueOf((char) code);
		}
		if (code < -20319 || code > -10247) { // 不知道的字符
			return null;
		}
		String spell0 = null;
		int asciiRang0 = -20319;
		int asciiRang;
		for (Entry<String, Integer> e : spellMap.entrySet()) {
			asciiRang = e.getValue();
			if (code >= asciiRang0 && code < asciiRang) { // 区间找到
				return spell0 == null ? e.getKey() : spell0;
			} else {
				spell0 = e.getKey();
				asciiRang0 = asciiRang;
			}
		}
		return null;
	}

	/**
	 * 返回字符串的全拼,是汉字转化为全拼,其它字符不进行转换
	 * 
	 * @param str String 字符串
	 * @return String 转换成全拼后的字符串
	 */
	public static String getSpelling(String str) {
		if (str == null) {
			return null;
		}
		char[] chars = str.toCharArray();
		StringBuilder sb = new StringBuilder();
		for (char c : chars) {
			int code = getGBKCode(c);
			if (code == 0) { // 取ascii时出错
				sb.append(c);
			} else {
				String spell = getSpellByGBKCode(code);
				if (spell == null) {
					sb.append(convert2(c));
				} else {
					sb.append(spell);
				}
			}
		}
		return sb.toString();
	}

	private static String convert2(char c) {
		for (String[] element : all) {
			if (element[1].indexOf(c) != -1) {
				return element[0];
			}
		}
		return String.valueOf(c);
	}

	/**
	 * 得到姓名第一个汉字的全拼
	 */
	public static String getPersonNameSpelling(String str) {
		if (str == null) {
			return null;
		}
		String first = str.substring(0, 1);
		String v = specialFamilyNames.get(first);
		if (v != null) {
			return v;
		}
		return getSpelling(first);
	}

	/**
	 * 返回由字符串中每个汉字拼音首字母组成的字符串，非汉字字符维持原样输出
	 * 
	 * @param SourceStr
	 * @return
	 */
	public static String getCapitalizedSpelling(String SourceStr) {
		char[] cs = SourceStr.toCharArray();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < cs.length; i++) {
			char c = cs[i];
			if (SourceStr.substring(i, i + 1).matches("[\\w]\\-")) {
				sb.append(c);
			} else {
				String str = getSpelling(String.valueOf(c));
				str = str.replaceAll("\\s", "");
				if (!str.isEmpty()) {
					sb.append(str.charAt(0));
				}
			}
		}

		return sb.toString();
	}

	static {
		specialFamilyNames.put("翟", "Zhai");
		specialFamilyNames.put("朴", "Piao");
		specialFamilyNames.put("缪", "Miao");
		specialFamilyNames.put("卜", "Bu");
		specialFamilyNames.put("睢", "Sui");
		specialFamilyNames.put("尉", "Yu");
		specialFamilyNames.put("臧", "Zang");
		specialFamilyNames.put("薄", "Bo");
		specialFamilyNames.put("瞿", "Qu");
		specialFamilyNames.put("曾", "Zeng");
		specialFamilyNames.put("潘", "Pan");
		specialFamilyNames.put("单", "Shan");
		specialFamilyNames.put("蒿", "Hao");
		specialFamilyNames.put("逯", "Lu");

		specialFamilyNames.put("解", "Xie");
		specialFamilyNames.put("查", "Zha");
		specialFamilyNames.put("於", "Yu");
		specialFamilyNames.put("隗", "Kui");
		specialFamilyNames.put("折", "She");
		specialFamilyNames.put("阙", "Que");
		specialFamilyNames.put("区", "Ou");
		specialFamilyNames.put("仇", "Qiu");
		specialFamilyNames.put("颉", "Xie");

		specialFamilyNames.put("盖", "Ge");
		specialFamilyNames.put("逄", "Pang");
		specialFamilyNames.put("汶", "Wen");
		specialFamilyNames.put("乐", "Yue");
		specialFamilyNames.put("阚", "Kan");
		specialFamilyNames.put("眭", "Sui");
		specialFamilyNames.put("澹", "Tan");

		specialFamilyNames.put("宓", "Mi");
		specialFamilyNames.put("蔚", "Yu");
		specialFamilyNames.put("郗", "Xi");
		specialFamilyNames.put("种", "Chong");
		specialFamilyNames.put("柏", "Bo");
		specialFamilyNames.put("乜", "Nie");
		specialFamilyNames.put("伽", "Qie");
		specialFamilyNames.put("藏", "Zang");

		specialFamilyNames.put("朝", "Zhao");
		specialFamilyNames.put("缐", "Xian");
		specialFamilyNames.put("佴", "Nai");
		specialFamilyNames.put("禇", "Chu");
		specialFamilyNames.put("澹", "Tan");
	}

	private static String[][] all = new String[][] {
			new String[] { "A", "啊阿呵吖嗄腌锕錒" },
			new String[] { "Ai", "爱矮挨哎碍癌艾唉哀蔼隘埃皑呆嗌嫒瑷暧捱砹嗳锿霭乂乃伌僾儗凒剀剴叆呃呝啀嘊噫噯堨塧壒奇娭娾嬡嵦愛懓懝敱敳昹曖欬欸毐溰溾濭烠焥璦皚皧瞹硋磑礙絠薆藹諰譪譺賹躷醷鎄鑀閡阂阨阸隑靄靉餲馤騃鯦鱫鴱" },
			new String[] { "An", "按安暗岸俺案鞍氨胺厂广庵揞犴铵桉谙鹌埯黯侒儑匼厈咹唵啽垵垾堓婩媕屽峖干晻洝玵痷盒盦盫碪罯腤荌菴萻葊蓭裺誝諳豻貋遃鉗銨錌钳闇陰隂隌雸鞌韽頇頞顸馣鮟鴳鵪鶕" },
			new String[] { "Ang", "昂肮盎仰卬岇昻枊醃醠骯" },
			new String[] { "Ao", "袄凹傲奥熬懊敖翱澳嚣拗媪廒骜嗷坳遨聱螯獒鏊鳌鏖岙厫嗸噢嚻囂垇墺墽奡奧媼嫯岰嶅嶴慠扷抝摮擙柪梎棍泑浇滶澆澚熝爊獓璈眑磝磽礉翶翺芺蔜蝹襖謷謸軪郩鏕镺隞驁鰲鴁鴢鷔鼇" },
			new String[] { "Ba", "把八吧爸拔罢跋巴芭扒坝霸叭靶笆疤耙捌粑茇岜鲅钯魃菝灞仈伯叐哱哵坺垻墢壩夿妭峇弝抜抪捭朳杷柭欛湃炦犮玐癹皅矲笩紦罷羓胈茷萆蚆覇詙豝跁軷釛釟鈀颰魞鮁鮊鲃鲌鼥" },
			new String[] { "Bai", "百白摆败柏拜佰伯稗捭呗掰唄庍扒拝挀排擺敗栢派猈竡粨粺絔薜薭襬贁鞁鞴韛" },
			new String[] { "Ban", "半办班般拌搬版斑板伴扳扮瓣颁绊癍坂钣舨阪瘢並分坢埿姅岅彬怑搫攽斒昄朌柈湴瓪秚籓粄絆肦蝂螁螌褩覂豳跘辦辧辨辩辬辯鈑鉡闆靽頒魬鳻" },
			new String[] { "Bang", "帮棒绑磅镑邦榜蚌傍梆膀谤浜蒡並嗙垹埲塝嫎峀崗幇幚幫彭徬挷捠搒旁棓牓玤硥稖紡綁縍纺艕蚄蛖蜯螃謗邫鎊鞤騯髈" },
			new String[] { "Bao", "包抱报饱保暴薄宝爆剥豹刨雹褒堡苞胞鲍炮瀑龅孢煲褓鸨趵葆佨儤剝勹勽呆嘐嚗堢報媬嫑寚寳寶忁怉曓枹珤砲窇笣簿緥菢蕔藵虣蚫袌袍裒裦襃賲鉋鑤铇闁靌靤飹飽駂骲髱鮑鳵鴇齙宀" },
			new String[] { "Be", "萡" },
			new String[] { "Bei", "被北倍杯背悲备碑卑贝辈钡焙狈惫臂褙悖蓓鹎鐾呗邶鞴孛陂碚俻俾偝偹備僃哱唄喺垻埤怫愂憊揹昁杮柸桮梖棑棓椑波牬犕狽珼琲痺盃禙箃糒苝茀菩萆萯葡藣蛽蜚襬誖諀貝跋軰輩鄁鉳鋇錍鐴骳鵯" },
			new String[] { "Ben", "本奔苯笨夯锛贲畚坌体倴喯夲奙捹撪桳楍泍渀炃燌犇獖翉蟦賁輽逩錛鐼" },
			new String[] { "Beng", "蹦绷甭崩迸蚌泵甏嘣伻傍傰唪嗙埄埲堋塴奟嵭抨挷搒榜漨熢琣琫痭祊絣綳繃菶跰逬錋鏰镚閍鞛" },
			new String[] {
					"Bi",
					"比笔闭鼻碧必避逼毕臂彼鄙壁蓖币弊辟蔽毙庇敝陛毖痹秘泌秕薜荸芘萆匕裨畀俾嬖狴筚箅篦舭荜襞庳铋跸吡愎贲滗濞璧哔髀弼妣婢仳佊佖佛偪匂卑咇啚嗶坒埤堛复夶奰妼娝媲嬶屄崥幅幣幤庀廦弻彃怭怶悂愊拂捭斃旇服朼枇枈柀柲梐椑楅檗殍毴沘波湢滭潷煏熚獘獙珌畁畐畢疕疪痺皀皕瞥禆稫笓筆箃箄箆篳粃粊紕紴綼縪繴纰罷罼翍聛肶肸胇脾腗腷苾萞蓽蘗虑蜌螕袐被襅襣觱詖诐豍貏貱費賁贔费赑跛踾蹕躃躄邲鄨鄪鈚鉍錍鎞鏎鐴鐾閇閈閉閟闬陂陴鞁鞞鞸韠飶饆馝馥駜驆髲魓魮鮅鮩鰏鲾鴓鵖鶝鷝鷩鸊鼊" },
			new String[] { "Bia", "髟" },
			new String[] { "Bian", "边变便遍编辩扁贬鞭卞辨辫忭砭匾汴碥蝙褊鳊笾苄窆弁缏煸変封峅徧惼抃拚揙昪汳炞牑猵獱甂疺稨稹箯籩糄編緶臱艑萹藊覍覵變豍貶辡辦辧辮辯邉邊邲釆鍽閞鞕頨鯾鯿鴘鶣髟" },
			new String[] { "Biao", "表标彪膘杓婊飑飙鳔瘭飚镳裱骠镖俵僄儦剽墂嫖幖徱摽標檦淲滮漂瀌灬熛爂猋穮篻脿膔臕苞蔈藨褾諘謤贆錶鏖鏢鑣颮颷飆飇飈飊驃驫骉鰾麃髟" },
			new String[] { "Bie", "别憋鳖瘪蹩別咇彆徶扒拔捌撆撇柭柲猰癟秘穪苾莂蔽虌蛂蟞襒鱉鼈龞" },
			new String[] { "Bin", "宾濒摈彬斌滨豳膑殡缤髌傧槟鬓镔玢份儐擯椕殯氞汃浜濱濵瀕瑸璸砏繽臏虨蠙訜豩賓賔贇赟邠鑌霦頻顮频髕髩鬂鬢" },
			new String[] { "Bing", "并病兵冰丙饼屏秉柄炳摒槟禀邴並仌併倂偋傡冫垪寎平幷庰怲抦拼掤昞昺枋栟栤梹棅檳氷燷燹琕痭癛癝眪稟窉竝絣綆绠苪蛃誁跰鈵鉼鋲陃靐鞆鞞鞸餅餠鮩疒" },
			new String[] {
					"Bo",
					"拨波播泊博伯驳玻剥薄勃菠钵搏脖帛般柏舶渤铂箔膊魄卜礴跛檗亳鹁踣啵蕃簸钹饽擘仢佛侼僠僰剝募哱噃嚗壆妭孛孹嶓帗彴怕愽懪拍拔挬撥擗暴服柭桲榑檘欂殕泼浡淿湐潑潘瀑煿爆牔犦犻狛猼瓝瓟番癶發白百皪盋砵碆磻礡秡穛笩箥簙簿糪紴缽肑胉艊艴苩茀茷菩葧蒲蔔蔢薜蘖蘗蚾袚袯袹襎襏襮詙譒豰趵跑蹳郣鈸鉑鉢鋍鎛鑮镈餑餺馎馛馞駁駮驋髆髉鮁鮊鱍鲅鲌鵓掰" },
			new String[] { "Bu", "不步补布部捕卜簿哺堡埠怖埔瓿逋晡钸钚醭卟佈僕勏吥咘埗婄尃峬庯廍悑抪拊捗捬撲擈柨歨歩溥獛秿箁篰荹蔀薄補誧踄輹轐郶鈈鈽附陠鞴餔餢鯆鳪鵏鸔" },
			new String[] { "Ca", "擦拆礤嚓傪囃攃橴磣礸蔡遪" },
			new String[] { "Cai", "才菜采材财裁猜踩睬蔡彩倸偲啋埰婇寀戝扐採揌棌綵縩纔財跴" },
			new String[] { "Can", "蚕残掺参惨惭餐灿骖璨孱黪粲傪儏參叄叅喰嘇噆囋嬠嬱嵾慘慙慚憯戔摲朁殘淺湌澯燦爘穇篸薒蝅蠶蠺謲蹔鏒飡飱驂鯵鰺鲹黲" },
			new String[] { "Cang", "藏仓沧舱苍伧仺倉傖凔匨嵢欌滄濸獊瑲篬罉臧艙蒼蔵螥賶鑶鶬鸧" },
			new String[] { "Cao", "草操曹槽糙嘈艚螬漕傮屮嶆愺慅慒懆撡曺澡肏艸艹蓸褿襙造鄵鏪鐰騲鼜" },
			new String[] { "Ce", "册侧策测厕恻側冊厠墄嫧帻幘廁惻憡拺敇柵栅測畟笧筞筴箣簎粣荝萗萴蓛赦齰刂" },
			new String[] { "Cen", "参岑涔參叄叅嵾梣汵硶穇笒篸膥" },
			new String[] { "Ceng", "曾层蹭噌僧增層嶒橧竲繒缯驓" },
			new String[] { "Ceok", "硛硳" },
			new String[] { "Ceom", "岾" },
			new String[] { "Ceon", "猠" },
			new String[] { "Ceor", "乽" },
			new String[] { "Cha", "查插叉茶差岔搽察茬碴刹诧楂槎镲衩汊馇檫姹杈锸嚓仛侘偛剎嗏土垞奼岎嵖扠扱挿捈捷接揷摖斜査梌猹疀秅紁肞臿艖芆苴荖荼褨訍詧詫蹅釵銟鍤鎈鑔钗靫餷喳" },
			new String[] { "Chai", "柴拆差豺钗瘥虿侪儕勑叉喍囆扠搓查犲祡茈茝蔕蠆袃訍釵齜龇" },
			new String[] {
					"Chan",
					"产缠掺搀阐颤铲谗蝉单馋觇婵蒇谄冁廛孱蟾羼镡忏潺禅骣躔澶丳亶佔僝僤儃儳兎兔刬剗剷劖単厘啴單嘽嚵囅團墠壥嬋嬗崭嵼嶃嶄巉幝幨憚懴懺掸摌摲摻撣攙斺旵梴棎榐欃毚沾浐渐湹滻漸潹瀍瀺灛煘燀獑產産硟磛禪簅緂緾繟繵纏纒胀脠艬苫蕆螹蟬蟺袩裣裧襌襜襝覘誗諂譂讇讒讖谶蹍辿鄽酁醦鉆鋋鋓鏟鑱镵閳闡韂顫饞" },
			new String[] { "Chang", "长唱常场厂尝肠畅昌敞倡偿猖裳鲳氅菖惝嫦徜鬯阊怅伥昶苌娼仧倀倘僘償儻兏厰嘗嚐場塲尙尚廠悵晿暢棖椙淌淐焻玚琩瑒瑺瓺甞畼脹腸膓萇蟐裮誯鋹鋿錩鏛锠長镸閶闛韔鯧鱨鲿鼚" },
			new String[] { "Chao", "朝抄超吵潮巢炒嘲剿绰钞怊焯耖晁仦仯劋勦唠嘮巐巣弨摷槱樔欩涛漅濤焣煼牊眧窲粆紹綤綽縐繛绉绍罺觘訬謅謿诌趠趫轈鄛鈔麨鼂鼌" },
			new String[] { "Che", "车撤扯掣彻尺澈坼砗伡俥偖勶呫唓喢多夛奲宅屮徹揊摰撦斥池烢烲焎爡瞮硨硩聅莗蛼詀謵車迠頙" },
			new String[] { "Chen", "趁称辰臣尘晨沉陈衬橙忱郴榇抻碜谶宸龀嗔伧琛侲傖儭嚫堪塡填塵墋夦帘愖捵揨敐曟枕桭棧棽樄櫬沈谌湛瀋烥煁疢疹瘎瘨眈瞋硶磣稱綝縝缜肜胂茞莀莐蔯薼螴襯訦諃諶謓謲讖賝贂趂趻跈踸軙迧醦鈂鍖闖闯陳霃鷐麎齓齔秤" },
			new String[] { "Cheng",
					"成乘盛撑称城程呈诚惩逞骋澄橙承塍柽埕铖噌铛酲晟裎枨蛏丞瞠乗伥侱倀偁僜净呛嗆埩堘塖娍宬峸嵊庱徎徴徵悜憆憕懲抢挰掁搶摚摤撐撜敞朾棖棦椉槍樘橕橖檉檙氶泟洆浈浧浾淨溗澂瀓瀞爯牚珵珹琤瑲畻盯睈矃碀稱穪窚竀筬絾緽脀脭荿虰蟶觕誠赪赬趟踜蹦郕郢醒鋮鎗鏳鏿鐺阷靗頳饓騁騬鯎黨秤" },
			new String[] {
					"Chi",
					"吃尺迟池翅痴赤齿耻持斥侈弛驰炽匙踟坻茌墀饬媸豉褫敕哧瘛蚩啻鸱眵螭篪魑叱彳笞嗤傺佁侙俿剟勅卙卶叺呎呬呮呹哆啸喜喫嘨嘯噄噭坘垑奓她妛屟岻彨彲徲恜恥慗慸憏懘扡抬抶拆拕拖拸捇提搋摛摴攡杘柅柢樆欼歗歭歯汖沱沶治泜淔湁滞滯漦灻烾熾狋瓻痓痸瘈癡眙瞝祇离移竾筂箈箎粚糦絺翄翤翨耛肔胝胣胵脪腟芪茬荎莉菭蚇蚳蛇蝭袲袳裭訵誀誃誺謘謻貾赿趍趐趩跅跢跮踅踶軧迡迣遅遟遫遲邌鉓鉹銐鍉離雴飭飾餝饎饰馳騺驪骊鳷鴟鵄鵣鶒鶗鶙鷘麶黐齒齝郗" },
			new String[] { "Chong", "冲重虫充宠崇涌种艟忡舂铳憧茺偅傭僮喠嘃埫寵崈徸憃揰摏樁沖浺漴潼烛爞珫痋盅祌種緟罿翀茧蝩蟲衝褈蹖蹱酮銃隀" },
			new String[] { "Chou", "抽愁臭仇丑稠绸酬筹踌畴瞅惆俦帱瘳雠丒侴偢儔吜嚋圳妯婤媿嬦幬怞懤扭掫揄搊擣杻杽栦椆檮殠溴燽牰犨犫畤疇皗盩眣矁篘籌紬絒綢臰菗薵裯詶謅譸讎讐诌诪跾躊遚酧醔醜醻鈕钮雔魗鮘鯈鲋" },
			new String[] { "Chu",
					"出处初锄除触橱楚础储畜滁矗搐躇厨雏楮杵刍怵绌亍憷蹰黜蜍樗俶傗儊儲処助嘼埱媰岀幮廚慉懨拀摢摴敊斶柠椘榋槒橻檚櫉櫖櫥欪歜涂淑滀濋炪犓珿琡璴硫礎祝禇竌竐篨絀絮耝耡臅芻菆著蒢蒭蓫蕏藸處蟵蠩褚觕觸詘諔諸诎诸豖豠貙趎跦踀踰躕鄐鉏鋤閦雛鶵鸀齣齭齼屮" },
			new String[] { "Chua", "撮欻歘" },
			new String[] { "Chuai", "揣膪啜嘬搋踹欼腄膗" },
			new String[] { "Chuan", "穿船传串川喘椽氚遄钏舡舛巛傳僢剶圌堾惴掾暷歂汌猭玔瑏甎篅膞舩荈賗踳踹輲釧镩鶨" },
			new String[] { "Chuang", "窗床闯创疮幢怆仓仺倉傸刅刱剏剙創噇囪囱愴戧摐朣橦漴漺牀牎牕瘡磢窓窻膧舂葱蔥闖" },
			new String[] { "Chui", "吹垂炊锤捶椎槌棰陲倕圌埀惙搥桘箠腄菙郵錘鎚顀鬌魋龡" },
			new String[] { "Chun", "春唇纯蠢醇淳椿蝽莼鹑偆僢堾媋惷旾暙朐杶楯槆橁櫄沌浱湻滣漘犉瑃睶箺純肫胊脣膞芚萅萶蒓蓴賰踳輇輴辁醕錞陙鯙鰆鶉鶞" },
			new String[] { "Chuo", "戳绰踔啜龊辍促吷嚽娕娖婥婼孎惙拺擉斫歠涰淖焯磭箹簇綴綽繛缀腏荃蔟趠趵跿踱躇輟辵辶逴酫醛鋜錣鏃鑡镞齪齱" },
			new String[] { "Ci", "次此词瓷慈雌磁辞刺茨伺疵赐差兹呲鹚祠糍佌佽偨刾厕厠司呰啙垐堲姕嬨嵯嵳庛廁措朿枱柌柴栜栨泚滋澬濨玼珁甆皉礠粢絘縒胔茈茦茲荠莿萕薋薺蚝蛓螅螆蠀詞賜赼趀趑跐辝辤辭鈶飺餈骴髊鮆鴜鶿鷀齹" },
			new String[] { "Cis", "嗭" },
			new String[] { "Cong", "从丛葱匆聪囱琮枞淙璁骢苁偬叢囪婃孮従徖從忩怱悤悰慒憁暰棇楤樅樬樷欉漎漗潀潈潨灇焧熜燪爜瑽瞛碂窗篵総緫縦縱總繱纵聡聦聰茐菆蓯蔥藂蟌誴謥賨賩鏦騘驄" },
			new String[] { "Cou", "凑楱辏腠奏揍族湊玼簇蔟薮藪趋趣趨輳" },
			new String[] { "Cu", "粗醋簇促卒徂猝蔟蹙酢殂蹴且卆噈娕娖媨怚憱戚捽瘄瘯皻縐縬绉脨蔍蔖觕誎趋趗趣趥趨踀踓踤踧蹵錯错顣麁麄麆麤鼀" },
			new String[] { "Cuan", "窜蹿篡攒汆爨镩撺僔巑攅攛攢昕櫕欑殩濽灒熶穳窾竄篹簒菆襸躥鋑鑹" },
			new String[] { "Cui", "催脆摧翠崔淬衰瘁粹璀啐悴萃毳榱乼伜体倅凗啛墔察崒崪嶉忰慛椊槯漼濢焠熣獕琗疩皠磪竁粋紣綷縗繀缞翆脃脺膬膵臎襊趡踤鏙隹顇" },
			new String[] { "Cun", "村寸存蹲忖皴侟刌吋墫拵洊浚澊竴籿踆邨" },
			new String[] { "Cuo", "错撮搓挫措磋嵯厝鹾脞痤蹉瘥锉矬剉剒夎嵳庴摧昔最棤澨營瑳睉縒莝莡蒫蓌蔖虘襊諎躜躦逪遳酂酇醝銼錯髊鹺齹" },
			new String[] { "Da", "大答达打搭瘩塔笪耷哒褡疸怛靼妲沓嗒鞑亣剳匒呾咑噠垯塌墶憚搨撘橽毼汏溚炟燵畗畣眔矺笚繨羍胆荅荙薘蟽觰詚跶躂迏迖迭逹達鎉鎝鐽韃龖龘" },
			new String[] { "Dai", "带代呆戴待袋逮歹贷怠傣大殆呔玳迨岱甙黛骀绐埭侢叇嘚垈帒帯帶廗懛曃柋棣毒汏瀻獃瑇箉簤紿緿艜蔕蚮蝳螮襶詒诒貸跢蹛軑軚軩轪逯遞遰隶霴靆馱駄駘驮鮘鴏黱" },
			new String[] { "Dan",
					"但单蛋担弹掸胆淡丹耽旦氮诞郸惮石疸澹瘅萏殚眈聃箪赕儋啖丼亶伔倓僤儃冄冉刐勯匰単呾唌啗啿單嘾噉噡嚪坛壇妉娊媅帎弾彈忱怛惔愖憚憺憾抌撢撣擔柦檐欿殫沊泹湛潭澶澸燀狚玬瓭甔疍癉癚皽砃禫窞簞紞繵耼聸腅膻膽蜑蜒蟺衴褝襌襜覘觇觛訑詹誕譂贉贍赡蹛躭鄲酖醈霮頕餤饏馾駳髧鴠黕黮黵卩亻" },
			new String[] { "Dang", "当党挡档荡谠铛宕菪凼裆砀偒儅噹圵场垱場壋婸崵嵣愓擋攩檔欓氹潒澢灙烫燙珰瑒璗璫瓽當瘍盪瞊碭礑筜簜簹艡蕩蘯蟷襠譡讜趤逿鐺闣雼黨" },
			new String[] { "Dao", "到道倒刀岛盗稻捣悼导蹈祷帱纛忉焘氘叨俦儔受啁嘄噵壔宲導屶島嶋嶌嶹幬忑惆捯搗擣朷椡槝檤檮洮涛濤燾瓙盜禂禱稲箌絩翢翿舠菿薵虭衜衟裯軇醻釖陦陶隝隯魛鱽鳥鸟刂" },
			new String[] { "De", "的地得德底锝嘚徳恴悳惪棏淂登鍀陟" },
			new String[] { "Dei", "得哋" },
			new String[] { "Dem", "揼" },
			new String[] { "Den", "扥扽" },
			new String[] { "Deng", "等灯邓登澄瞪凳蹬磴镫噔嶝戥簦僜墱嬁憕橙櫈燈璒竳艠覴豋鄧鐙隥" },
			new String[] {
					"Di",
					"地第底低敌抵滴帝递嫡弟缔堤的涤提笛迪狄翟蒂觌邸谛诋嘀柢骶羝氐棣睇娣荻碲镝坻籴砥仾俤偙僀儥勺厎呧唙啇啲啻嚁坔坘埅埊埞墆墑墬奃媂嵽嶳廸弔弚弤彽怟慸扚拞掋揥摕敵旳杓杕枤梊梑楴樀浟渧滌焍牴玓珶甋疐眱碮磾祶禘篴糴約締约聜肑胝腣芍苐苖莜菂菧蓧蔋蔐蔕藋藡蚳蝃螮袛覿觝詆諟諦豴赿趆踧踶蹄蹏蹢軧逐逓逮遞適遰釱鉪鍉鏑阺隄隶靮鞮頔題题馰髢鬄魡鯳鸐" },
			new String[] { "Dia", "嗲" },
			new String[] { "Dian", "点电店殿淀掂颠垫碘惦奠典佃靛滇甸踮钿坫阽癫簟玷巅癜佔傎厧唸埝墊壂奌婝婰嵮巓巔扂拈攧敁敟椣槇槙橂橝沾涎湺澱琔痶瘨癲磹腍蒧蕇蜓蜔詀蹎鈿電頕顚顛驔點齻丶" },
			new String[] { "Diao", "掉钓叼吊雕调刁碉凋鸟铞铫鲷貂伄佻倜刀刟奝嬥屌弔弴彫扚挑椆殦汈淍琱瘹瞗矵稠窎窵竨簓粜糶絩綢绸莜蓧藋虭蛁蜩訋誂調赵趙跳踔軺轺釣鈟銱鋽錭鑃雿颩骠魡鮉鯛鳥鳭鵃鵰鸼鼦" },
			new String[] { "Die", "爹跌叠碟蝶迭谍牒堞瓞揲蹀耋鲽垤喋佚咥哋啑峌崼嵽幉怢恎惵戜挃挕昳曡柣楪槢殜氎泆涉渉渫牃畳疂疉疊眣眰窒絰绖耊胅至臷艓苵蜨螲褋褶褺詄諜趃跕跮踢蹛軼轶鐡鐵镻鞢鮙鰈鰨鳎踮" },
			new String[] { "Dim", "嚸" },
			new String[] { "Ding", "顶定盯订叮丁钉鼎锭町玎铤腚碇疔仃耵酊啶奠奵嵿帄忊掟椗汀濎灯甼矴碠磸聢艼萣葶薡虰訂釘鋌錠鐤靪頂顁飣饤" },
			new String[] { "Diu", "丢铥丟銩颩" },
			new String[] { "Dong", "动东懂洞冻冬董栋侗恫峒鸫垌胨胴硐氡岽咚倲働凍動勭埬墥姛娻嬞峝崠崬戙挏揰昸東桐棟氭涷湩烔燑狫甬笗筒筩箽絧腖苳菄蕫蝀衕詷諌迵酮霘駧騆鮗鯟鶇鶫鼕夂" },
			new String[] { "Dou", "都斗豆逗陡抖痘兜读蚪窦篼蔸乧侸兠凟剅吺唗投斣枓梪橷毭氀浢渎瀆瞗窬竇脰艔荳讀逾郖酘酡鈄鋀钭閗闘阧餖饾鬥鬦鬪鬬鬭" },
			new String[] { "Du", "读度毒渡堵独肚镀赌睹杜督都犊妒顿蠹笃嘟渎椟牍黩髑芏儥凟剢剫匵厾噣土塗妬嬻宅帾斁晵暏樚樞橐櫝殬殰涜瀆牘犢獨琽瓄皾睪秺竇笁篤纛荰蝳螙蠧裻襡襩覩詫読讀讟诧豄賭贕醏錖鍍鍺鑟锗闍阇陼靯韇韣韥頓騳黷" },
			new String[] { "Duan", "段短断端锻缎椴煅簖偳剬塅媏彖斷毈瑖碫篅籪緞耑腶葮褍踹躖鍛鍴" },
			new String[] { "Dui", "对队堆兑敦镦碓怼憝兊兌垖埻塠夺奪対對嵟憞懟搥杸濧濻瀢瀩痽磓祋綐膭薱謉譈譵追鈗銳鋭錞鎚鐓鐜锐陮隊頧鴭" },
			new String[] { "Dul", "乧" },
			new String[] { "Dun", "吨顿蹲墩敦钝盾囤遁不趸沌盹镦礅炖砘伅俊噸墪壿庉忳惇憞撉撴楯橔潡燉犜獤碷腞腯蜳豚踲蹾躉逇遯鈍鐓鐜頓驐" },
			new String[] { "Duo",
					"多朵夺舵剁垛跺惰堕掇哆驮度躲踱沲咄铎裰哚缍亸仛兊兌兑凙刴剟剫吋喥嚉嚲垜埵墮墯夛奪奲媠嫷尮崜嶞憜挅挆捶揣敓敚敠敪朶杂杕枤柁柂柮桗棰椯橢毲沰沱澤痥硾綞茤袳詑誃貀趓跢跥跿躱軃郸鄲鈬錞鍺鐸锗陀陊陏隋隓飿饳馱駄鬌鮵鵽點" },
			new String[] {
					"E",
					"饿哦额鹅蛾扼俄讹阿遏峨娥恶厄鄂锇谔垩锷阏萼苊轭婀莪鳄颚腭愕呃噩鹗屙亚亜亞伪佮侉偔偽僞僫匎匼卾吪呝咢咹哑唖啈啊啐啞噁囐囮垭埡堊堨堮妸妿姶娾娿媕屵岋峉峩崿庵廅悪惡戹搕搤搹擜曷枙椏櫮欸歞歹歺洝涐湂玀珴琧痷皒睋砈砐砨砵硆硪磀礘胺蒍蕚蘁蚅蝁覨訛詻誐諤譌讍豟軛軶輵迗遌遻邑鈋鋨鍔鑩閜閼阨阸隘頞頟額顎餓餩騀鬲魤魥鰐鰪鱷鴳鵈鵝鵞鶚齃齶齾" },
			new String[] { "En", "恩摁蒽嗯奀峎煾饐唔" },
			new String[] { "Eng", "鞥" },
			new String[] { "Eo", "仒" },
			new String[] { "Eol", "乻" },
			new String[] { "Eom", "欕" },
			new String[] { "Eos", "旕" },
			new String[] { "Er", "而二耳儿饵尔贰洱珥鲕鸸佴迩铒侕児兒刵咡唲嬭尒尓峏弍弐杒栭栮樲毦洏渪濡爾粫耏聏胹臑荋薾衈袻誀貮貳趰輀輭轜邇鉺陑陾隭餌駬髵髶鮞鴯" },
			new String[] { "Fa", "发法罚伐乏筏阀珐垡砝佱傠姂廢彂拔拨撥栰橃汎沷泛灋琺疺発發瞂笩罰罸茷蕟藅貶贬醗醱鍅閥髪髮" },
			new String[] { "Fan", "反饭翻番犯凡帆返泛繁烦贩范樊藩矾钒燔蘩畈蕃蹯梵幡仮伋凢凣勫匥噃墦奿婏嬎嬏嬔忛憣払拚旙旛杋柉棥楓橎氾汎渢滼瀪瀿煩犿璠畨盕礬笲笵範籓籵緐繙羳膰舤舧舩薠蟠蠜袢襎訉販軓軬轓辺釩鐇颿飜飯飰鱕鷭攵犭" },
			new String[] { "Fang", "放房防纺芳方访仿坊妨肪钫彷邡枋舫鲂倣匚埅堏旊昉昘昞汸淓牥瓬眆眪祊紡蚄訪趽鈁錺雱髣魴鰟鳑鴋鶭" },
			new String[] { "Fei", "非飞肥费肺废匪吠沸菲诽啡篚蜚腓扉妃斐狒芾悱镄霏翡榧淝鲱绯痱俷剕厞墢奜婓婔屝廃廢怫拂昲暃曊朏杮柹棐橃橨櫠渄濷犻猆琲疿癈砩祓笰紼緋绋胇胏胐茀茇萉蕜蕟蕡蜰蟦裴裵裶襏誹費鐨陫靅靟飛飝餥馡騑騛髴鯡鼣鼥" },
			new String[] { "Fen", "分份芬粉坟奋愤纷忿粪酚焚吩氛汾棼瀵鲼玢偾鼢僨匪喷噴坆坋墳奔奮妢岎帉幩弅愍憤扮拚敃昐朆朌枌梤棻橨歕濆炃燌燓燔獖盼瞓砏秎竕糞紛羒羵翂肦膹葐蒶蕡蚠蚡衯訜豮豶賁贲躮轒鈖錀鐼隫雰頒颁餴饙馚馩魵鱝鳻黂黺鼖" },
			new String[] { "Feng", "风封逢缝蜂丰枫疯冯奉讽凤峰锋烽砜俸酆葑沣唪仹偑僼凨凬凮埄堸夆妦寷峯崶捀捧摓桻楓檒沨泛浲渢湗溄漨灃炐焨煈熢犎猦琒甮瘋盽碸篈綘縫肨舽艂莑蘕蘴蚌覂諷豊豐賵赗逄鄷鋒鎽鏠靊風飌馮鳯鳳鴌鵬鹏麷覅" },
			new String[] { "Fo", "佛仏仸坲梻" },
			new String[] { "Fou", "否缶不垺妚炰紑缹缻芣衃雬鴀" },
			new String[] {
					"Fu",
					"副幅扶浮富福负伏付复服附俯斧赴缚拂夫父符孵敷赋辅府腐腹妇抚覆辐肤氟佛俘傅讣弗涪袱市甫釜脯腑阜咐黼砩苻趺跗蚨芾鲋幞茯滏蜉拊菔蝠鳆蝮绂绋赙罘稃匐麸凫桴莩孚馥驸怫祓呋郛芙艴黻不乀仅伕俌俛偩偪冨冹刜包呒咈哹哺嘸坿垘垺報妋姇娐婏婦媍嬎嬔尃岪峊巿帗弣彳彿復怀怤懯抙捊捬掊撫旉枎枹柎柫柭栿棴椨椱榑汱沕沸泭洑溥澓炥烰焤玞玸琈璷甶畉畐畗癁盙砆祔禣秿稪竎笰筟箁箙簠粰糐紨紱紼絥綍綒緮縛纀罦翇胕膚艀芣茀荂荴莆萉萯葍蓲蕧虙蚥蚹蛗蜅蝜衭袚袝複褔襆襥覄訃詂諨豧負費賦賻费踾軵輔輹輻还邚邞郍郙鄜酜酻釡鈇鉘鉜錇鍑鍢锫阝陚鞴韍韛韨頫颫颰駙髴鬴鮄鮒鮲鰒鳧鳬鳺鴔鵩鶝麩麬麱" },
			new String[] { "Ga", "噶胳夹嘎咖轧钆伽旮尬尕尜呷嘠玍軋釓錷魀" },
			new String[] { "Gad", "甴" },
			new String[] { "Gai", "该改盖概钙芥溉戤垓丐陔赅乢侅匃匄咳姟峐忋摡晐杚核槩槪汽漑瓂畡磑祴絠絯胲荄葢蓋該豥賅賌郂鈣鎅閡阂阣隑骸" },
			new String[] { "Gan", "赶干感敢竿甘肝柑杆赣秆旰酐矸疳泔苷擀绀橄澉淦尴坩个乹乾亁仠佄倝凎凲咁奸尲尶尷幹忓扞捍攼桿榦檊汗汵浛漧灨玕玵皯盰稈笴筸篢簳粓紺芉虷衦詌諴豃贑贛趕迀釬錎飦骭魐鰔鱤鳡鳱" },
			new String[] { "Gang", "刚钢纲港缸岗杠冈肛扛筻罡戆剛堈堽岡崗戅戇抗掆棡槓溝焵牨犅犺疘矼碙綱罁罓肮釭鋼鎠阬頏颃" },
			new String[] { "Gao", "高搞告稿膏篙羔糕镐皋郜诰杲缟睾槔锆槁藁勂吿咎夰峼暠槀槹橰檺櫜滜澔獋獔皐睪祮祰禞稁稾筶縞羙臯菒蒿藳誥鋯鎬韟餻髙鷎鷱鼛" },
			new String[] { "Ge",
					"个各歌割哥搁格阁隔革咯胳葛蛤戈鸽疙盖屹合铬硌骼颌袼塥虼圪镉仡舸鬲嗝膈搿纥哿介佫佮個匌可吤呄嘅嘢噶彁愅戓戨扢挌擱敋杚槅櫊滆滒澔牫牱犵猲獦砝秴箇紇肐臈臵茖菏蓋蛒裓觡詥諽謌輵轕鉀鉻鉿鎑鎘鎶钾铪閘閣閤闸鞈鞷韐韚頜騔髂魺鮥鮯鰪鲄鴐鴚鴿鵅" },
			new String[] { "Gei", "给" },
			new String[] { "Gen", "跟根哏茛亘艮揯搄" },
			new String[] { "Geng", "更耕颈梗耿庚羹埂赓鲠哽绠亙亢刯堩峺恆挭掶暅椩浭焿畊硬絙絚綆緪縆羮莄菮賡邢郉郠頸骾鯁鶊鹒" },
			new String[] { "Gib", "喼" },
			new String[] { "Go", "嗰" },
			new String[] { "Gong", "工公功共弓攻宫供恭拱贡躬巩汞龚红肱觥珙蚣匑匔厷咣唝嗊塨宮幊廾愩慐拲杛杠栱渱熕碽篢糼紅羾虹蛩觵貢贑贛赣躳輁銾鞏髸魟龏龔" },
			new String[] { "Gou", "够沟狗钩勾购构苟垢句岣彀枸鞲觏缑笱诟遘媾篝佝傋冓区區呴坸夠姤抅拘搆撀構泃溝煹玽簼緱耇耈耉茩蚼袧褠覯訽詬豰豿購軥鈎鉤雊韝鮈鴝鸜鸲" },
			new String[] { "Gu",
					"古股鼓谷故孤箍姑顾固雇估咕骨辜沽蛊贾菇梏鸪汩轱崮菰鹄鹘钴臌酤呱鲴诂牯瞽毂锢牿痼觚蛄罟嘏傦僱凅劷告哌唂唃啒嗀嗗堌夃嫴尳峠崓怘愲扢抇枯柧棝榖榾橭櫎泒淈滑濲瀔焸瓠皋皷盬硲磆祻稒穀笟箛篐糓縎罛羖胍脵臯苦苽蓇薣蛌蠱角詁賈軱軲轂逧鈲鈷錮頋顧餶馉骰鮕鯝鴣鵠鶻鼔" },
			new String[] { "Gua", "挂刮瓜寡剐褂卦呱胍鸹栝诖冎剮劀叧咶咼啩坬惴掛歄焻煱絓緺罣罫舌苽詿諣趏踻銛銽铦颪颳騧鴰括" },
			new String[] { "Guai", "怪拐乖掴叏哙噲夬恠枴柺箉罫" },
			new String[] { "Guan", "关管官观馆惯罐灌冠贯棺纶盥矜莞掼涫鳏鹳倌丱串卝婠悹悺慣懽摜斡果桄樌櫬權毌沦泴淉淪潅爟琯瓘痯瘝癏矔礶祼窤筦綸罆舘萖蒄覌観觀貫躀輨遦錧鏆鑵閞関闗關雚館鰥鱞鱹鳤鵍鸛" },
			new String[] { "Guang", "光广逛桄犷咣胱侊俇僙垙姯広廣恍扩挄撗擴横櫎欟洸潢灮炗炚炛烡獷珖硄臦臩茪趪輄迋銧黆" },
			new String[] { "Gui",
					"归贵鬼跪轨规硅桂柜龟诡闺瑰圭刽傀癸炔庋宄桧刿鳜鲑皈匦妫晷簋炅亀伪佹偽僞劊劌匭匮匱厬哇垝姽娃媯嫢嬀嶡嶲巂帰庪廆恑摫撌攰攱昋朹桅椝椢概槣槶槻槼檜櫃櫰櫷歸氿沩洼湀溎潙珪璝瓌癐瞆瞡瞶硊祈祪禬窐筀簂絵繪绘胿膭茥蓕蘬蛫螝蟡袿襘規觖觤詭謉貴赽趹蹶軌邽郌閨陒隗雟鞼騩鬶鬹鮭鱖鱥鳺鴂鴃龜" },
			new String[] { "Gun", "滚棍辊鲧衮磙绲丨惃棞浑混渾滾琯璭睔睴緄緷蓘蔉袞裷謴輥錕锟鮌鯀鰥鳏" },
			new String[] { "Guo", "过国果裹锅郭涡埚椁聒馘猓崞掴帼呙虢蜾蝈划咶咼唬啯嘓囗囯囶囻圀國埻堝墎幗彉彍惈慖搓摑敋枸楇槨櫎活淉渦漍濄瘑矌簂粿綶聝腂腘膕菓蔮蜮蝸蟈蠃褁輠過鈛錁鍋鐹锞餜馃" },
			new String[] { "Ha", "哈蛤虾铪丷吓呵奤妎為獬蝦鉿" },
			new String[] { "Hai", "还海害咳氦孩骇骸亥嗨醢胲侅咍咴嗐嚡塰拸欬烸猲絯還郂酼閡阂頦颏餀饚駭駴嘿" },
			new String[] { "Hal", "乤" },
			new String[] { "Han",
					"喊含汗寒汉旱酣韩焊涵函憨翰罕撼捍憾悍邯邗菡撖瀚阚顸蚶焓颔晗鼾仠佄傼兯凾厂厈咁哻唅嚂圅垾娢嫨屽崡嵅嵌忓感扞攼旰晘晥暵桿梒椷榦欦歛汵泔浛浫涆淊淦滩漢澉澏澣灘熯爳猂琀甘甝皔睅矸笒筨糮肣莟蔊蘫虷蛿蜬蜭螒譀谽豃軒轩釬鈐銲鋎鋡閈闞闬雗靬韓頇頜頷顄顩馠馯駻鬫魽鳱鶾" },
			new String[] { "Hang", "行巷航夯杭吭颃沆绗珩垳妔忼斻桁炕狼笐筕絎肮苀蚢貥迒邟酐頏魧" },
			new String[] { "Hao", "好号浩嚎壕郝毫豪耗貉镐昊颢灏嚆蚝嗥皓蒿濠薅傐儫呺哠唬嘷噑妞恏悎昦晧暠暤暭曍椃淏滈滜澔灝獆獋皋皜皞皡皥睾秏竓籇翯聕膠臯茠薃薧藃號虠蠔諕譹鄗鎒鎬鐞顥鰝" },
			new String[] {
					"He",
					"和喝合河禾核何呵荷贺赫褐盒鹤菏貉阂涸吓嗬劾盍翮阖颌壑诃纥曷佫呙呼咊咼哈哬啝喛嗃嗑噈嚇垎姀害寉峆惒愒抲挌揭敆柇格楁欱毼洽渇渮渴湼澕焃煂熆熇燺爀犵狢癋皬盇盉硅碋礉秴篕籺粭紇繳缴翯苛萂藃藿蚵蝎螛蠚袔覈訶訸詥謞貈賀輅轄辂辖郃鉌鑉閡闔阋隺霍靍靎靏鞨頜餄餲饸鬩魺鲄鵠鶡鶮鶴鸖鹄鹖麧齃齕龁龢" },
			new String[] { "Hei", "黑嗨嬒潶黒嘿" },
			new String[] { "Hen", "很狠恨痕佷哏噷拫掀艮詪鞎" },
			new String[] { "Heng", "横恒哼衡亨行桁珩蘅佷啈堼姮恆悙橫涥烆狟胻脝訇鑅鴴鵆鸻" },
			new String[] { "Ho", "乊" },
			new String[] { "Hol", "乥" },
