Ç°ÑÔ
ÍøÉϹØÓÚJSʵÏÖºº×ÖºÍÆ´Òô»¥×ªµÄÎÄÕºܶ࣬µ«ÊDZȽÏÔÓÂÒ£¬¶¼ÊÇ»¥Ïà³À´³È¥£¬¶øÇÒÓеIJ»Ö§³Ö¶àÒô×Ö£¬ÓеIJ»Ö§³ÖÉùµ÷£¬ÓеÄ×ÖµäÎļþÌ«´ó£¬»¹±ÈÈçÓÐʱºòÎÒ½ö½öÊÇÐèÒª»ñÈ¡ºº×ÖÆ´ÒôÊ××ÖĸȴҪÒýÈë200kbµÄ×ÖµäÎļþ£¬ÎÞ·¨¸ù¾Ýʵ¼ÊÐèÒªÂú×ãÐèÇó¡£
×ÛÉÏ£¬ÎÒ¾«ÐÄÕûÀí²¢ÐÞ¸ÄÁËÍøÉϼ¸ÖÖ³£¼ûµÄ×ÖµäÎļþ²¢¼òµ¥·â×°ÁËһϿÉÒÔÖ±½ÓÄÃÀ´ÓõŤ¾ß¿â¡£
ÕâƪÎÄÕ²¶àÒ»¸öÔÂÇ°¾ÍдºÃÁ˴󲿷ÖÁË£¬µ«ÊǾͲîÆ´ÒôÊäÈë·¨ÕâÒ»¿éһֱûʱ¼äȥŪ(ÓëÆä˵ÊÇûʱ¼ä£¬»¹²»Èç˵ÊDZ¾ÈËÌ«ÀÁ)£¬ËùÒÔÒ»Ö±Íϵ½½ñÌì²Å·¢±í¡£
´úÂëºÍDEMOÑÝʾgithubÏîÄ¿µØÖ·£ºhttps://github.com/liuxianan/pinyinjs
ÍêÕûdemoÑÝʾ£º
´ø¶àÒô×Öʶ±ðµÄÑÝʾ£º
ºº×ÖתƴÒô£º
´ø´Ê¿âµÄʶ±ð¶àÒô×ֵĺº×ÖתƴÒô£º
Æ´Òôתºº×Ö£¨¼òµ¥µÄÆ´ÒôÊäÈë·¨£©£º
¹ØÓÚ¶àÒô×Ö¼øÓںܶàÈ˶¼±È½Ï¹ØÐĶàÒô×ÖµÄÎÊÌ⣬ËùÒÔµ¥¶ÀÄóöÒ»¸öСÕ½ÚÀ´½éÉܶàÒô×ÖµÄÏà¹ØÎÊÌâ¡£
׼ȷʶ±ð¸÷ÖÖ¸´ÔÓÓï¾äÖлìÔӵĶàÒô×ÖÆäʵ²¢Ã»ÓÐÄÇôÈÝÒ×£¬ÓÐÁ½¸ö¹Ø¼üµÄµØ·½£¬Ò»¸öÊǶàÒô×Ö´Ê¿âµÄ·á¸»³Ì¶È£¬Ò»¸öÊÇÄÜ·ñÕýÈ·µÄ¸øÓï¾ä½øÐзִʡ£¶ø´Ê¿âºÍ·Ö´ÊµÄʵÏÖ¶¼ÐèÒªÒ»¸ö·Ç³£·á¸»µÄ´ÊµäÎļþ£¬ÏÖ´úººÓï´ÊÓïÓжàÉÙ¸ö£¬¹À¼ÆûÓÐÈËËãµÃÇ壬ÔÙ¼ÓÉÏÿÌìгöÏÖµÄÈËÃû¡¢ÍøÂç´ÊÓï¡¢¿Æ¼¼´ÊÓïµÈµÈ¡£Ò»¸öÆÕͨµÄ´Ê¿âÎļþÖÁÉÙÒ²Óм¸°Ùkb£¬ËùÒÔ²»Ì«ÊʺÏweb»·¾³ÏÂȥʵÏÖ£¬Ò»°ã×îºÃ·ÅÔÚ·þÎñÆ÷¶Ë×ö³ÉÒ»¸ö½Ó¿Ú¡£
¼øÓںܶàÈ˶¼Ï£ÍûÓжàÒô×Öʶ±ðµÄ¹¦ÄÜ£¬ËùÒÔÎÒ¼òµ¥ÊµÏÖÁËÒ»¸ö°æ±¾¡£´Ê¿âÎļþÊÇ´ÓÕâÀïÕÒµ½µÄ£¬²¢¸ù¾Ýʵ¼ÊÇé¿ö½«Îļþ´Ó1.8MѹËõµ½ÁË912kb£¬·Ö´ÊÔÝʱֻÊÇ×Ô¼º·Ç³£¼òµ¥µÄʵÏÖ(Ò²¿ÉÒÔ˵ѹ¸ù¾ÍûÓзִÊ)£¬Èç¹ûÊÇ·þÎñÆ÷¶ËÍƼö¼¸¸ö²»´íµÄÖÐÎķִʹ¤¾ß£ºPython°æµÄJiebaºÍNodeJieba£¬ÐÔÄܷdz£ºÃ£¬ÆäËüÓïÑÔ°æµÄ²Î¿¼ÉÏÃæÏîÄ¿µÄREADME¡£
¹ØÓÚ·Ö´Ê£¬Õª³Ò»¶ÎÍøÂç½âÊÍ£º
´ÊÊÇ×îСµÄÄܹ»¶ÀÁ¢»î¶¯µÄÓÐÒâÒåµÄÓïÑԳɷ֣¬Ó¢Îĵ¥´ÊÖ®¼äÊÇÒÔ¿Õ¸ñ×÷Ϊ×ÔÈ»·Ö½ç·ûµÄ£¬¶øººÓïÊÇÒÔ×ÖΪ»ù±¾µÄÊéдµ¥Î»£¬´ÊÓïÖ®¼äûÓÐÃ÷ÏÔµÄÇø·Ö±ê¼Ç£¬Òò´Ë£¬Òª¶ÔÖÐÎÄÐÅÏ¢½øÐд¦Àí£¬ÕýÈ·µÄ·Ö´Ê¾ÍÏÔµÃÓÈΪ¹Ø¼ü¡£
±ÈÈç¿´ÖйúÕâÒ»¸ö´Ê£¬µ¥¶ÀµÄ¿´ÖжÁk¨¤n zh¨°ng£¬Öйú¶Ázh¨ng gu¨®£¬Á¬ÔÚÒ»ÆðÈ´¶Á×÷k¨¤n zh¨ng gu¨®¡£
ÎÒÕâ¸öʵÏַdz£µÃ¼òµ¥£¬Ð§¹ûÒ»°ã£¬ÐÔÄÜÒ²Ò»°ã£¬ÐèÒªÏÂÔؽ«½ü1MµÄ´Ê¿âÎļþ£¬ËùÒÔ²»ÊʺÏweb»·¾³£¬ÑÝʾµØÖ·£º
ºº×ÖÓëÆ´ÒôÏà¹Ø֪ʶÆÕ¼° ºº×Ö·¶Î§Ò»°ãÈÏΪUnicode±àÂëÖеĺº×Ö·¶Î§ÊÇ /^[\u2E80-\u9FFF]+$/(11904-40959)£¬µ«ÊÇÆäÖÐÓкܶ಻ÊǺº×Ö£¬»òÕß˵ÊÇ¿ÉÒÔ¶ÁµÄºº×Ö£¬±¾ÎÄÓõ½µÄ¼¸¸ö×ÖµäÎļþµÄºº×Ö·¶Î§¾ùÊÇ /^[\u4E00-\u9FA5]+$/£¬Ò²¾ÍÊÇ(19968-40869)£¬ÁíÍ⻹ÓÐÒ»¸öµ¥¶ÀµÄºº×Ö©–£¬ÆäUnicodeλÖÃÊÇ12295¡£
Æ´Òô×éºÏºº×ÖÓÐ21¸öÉùĸ£ºb, p, m, f, d, t, n, l, g, k, h, j, q, x, zh, ch, sh, r, z, c, s£¬24¸öÔÏĸ£¬ÆäÖе¥ÔÏĸÓÐ6¸ö£ºa, o, e, i, u, v, ¸´ÔÏĸÓÐ18¸ö£ºai , ei, ui , ao, ou, iu , ie, ve, er, an , en , in, un , vn , ang, eng, ing , ong£¬¼ÙÉèÉùĸºÍÔÏĸÁ½Á½×éºÏµÄ»°£¬»áÓÐ24X21=504ÖÖ×éºÏ£¬Êµ¼ÊÇé¿öÊÇÓÐЩ×éºÏÊÇûÓÐÒâÒåµÄ£¬±ÈÈçbv, gie, veµÈ£¬È¥³ýÕⲿ·Öºó£¬»¹Ê£Óà412ÖÖ¡£
Æ´Òô×ÖµäÎļþ°´ÕÕ×ÖµäÎļþµÄ´óС´ÓСµ½´óÒÀ´Î½éÉÜ¡£
×ÖµäÒ»£ºÆ´ÒôÊ××Öĸ¸Ã×ÖµäÎļþµÄÄÚÈÝ´óÖÂÈçÏ£º
pinyin_dict_firstletter .....};
¸ÃÊý¾Ý×ֵ佫Unicode×Ö·ûÖÐ4E00(19968)-9FA5(40869)¹²¼Æ20902¸öºº×ÖµÄÆ´ÒôÊ××Öĸƴ½ÓÔÚÒ»ÆðµÃµ½Ò»¸öºÜ³¤µÄ×Ö·û´®£¬È»ºóÔÙ½«ÓжàÒô×ֵĺº×Ö£¨¹²¼Æ370¸ö¶àÒô×Ö£©µ¥¶ÀÁгöÀ´¡£¸Ã×ÖµäÎļþ´óСΪ25kb¡£
¸Ã×ÖµäÎļþÓŵãÊÇÌå»ýС£¬Ö§³Ö¶àÒô×Ö£¬È±µãÊÇÖ»ÄÜ»ñÈ¡Æ´ÒôÊ××Öĸ¡£
×Öµä¶þ£º³£Óúº×Ö¸Ã×ÖµäÎļþ½«ºº×Ö°´ÕÕÆ´Òô½øÐйéÀ࣬¹²¼Æ401ÖÖ×éºÏ£¬ÊÕ¼ÁË6763¸ö³£Óúº×Ö£¬²»Ö§³Ö¶àÒô×Ö¡£ÓÉÓÚ´ÓÍøÂçÉÏÊÕ¼¯µÄ£¬ÊÕ¼×ÖÊý½ÏÉÙ£¬ËùÒÔÎļþÌå»ýÖ»ÓÐ24kb£¬ºóÐøÓпտ´Äܲ»ÄܸøÀ©³äһϡ£
×ÖµäÎļþ´óÖÂÄÚÈÝÈçÏ£¨ÕâÀïÖ»ÊÇʾÀý£¬ËùÒÔֻչʾһС²¿·Ö£©£º
pinyin_dict_notone
ºóÀ´ÂýÂý·¢ÏÖÕâ¸ö×ÖµäÎļþÖдæÔÚÖî¶à´íÎ󣬱ÈÈç°ÑÅ°µÄÆ´Òôд³ÉÁËnue£¨Õýȷд·¨Ó¦¸ÃÊÇnve£©,ÌÉд³ÉÁËthang£¬¶øÇÒ²»Ö§³Ö¶àÒô×Ö£¬ËùÒÔºóÀ´ÎÒ¸ù¾ÝÆäËü×ÖµäÎļþ×Ô¼ºÖØÐÂÉú³ÉÁËÒ»·ÝÕâÑù¸ñʽµÄ ×ÖµäÎļþ£º
ͬʱ£¬ÎÒ¸ù¾ÝÍøÉÏÒ»·Ý³£ÓÃ6763¸öºº×ÖʹÓÃƵÂÊ±í£¬½«Õâ6763¸öºº×Ö°´ÕÕʹÓÃƵÂʽøÐÐÁËÅÅÐò£¬ÕâÑù¾Í¿ÉÒÔʵÏÖÒ»¸ö²îÇ¿ÈËÒâµÄJS°æÊäÈë·¨ÁË¡£
ÁíÍ⣬¸ù¾ÝÁíÍâÒ»·Ý¸üÍêÕûµÄ×ÖµäÎļþ·¢ÏÖÆäʵ¹²ÓÐ412ÖÖÆ´Òô×éºÏ£¬ÉÏÃæ×ÖµäÎļþÖÐûÓгöÏÖµÄ8ÖÖ·¢ÒôÊÇ£º
chua,den,eng,fiao,m,kei,nun,shei ×ÖµäÈý£ºÖÕ¼«×ÖµäÊ×ÏÈ£¬´ÓÍøÉÏÕÒµÄÈçϽṹ×ÖµäÎļþ£¨ÏÂÃæ³ÆΪ×ÖµäA£©£¬¾ßÌåÊÇÄIJ»¼ÇµÃÁË£¬Ö§³ÖÉùµ÷ºÍ¶àÒô×Ö£¬Ëü½«Unicode×Ö·ûÖÐ4E00(19968)-9FA5(40869)¹²¼Æ20902¸öºº×Ö£¨Èç¹ûËãÉÏ©–µÄ»°ÄǾÍÊÇ20903¸ö£©Æ´ÒôÈ«²¿Áо٣¬¸Ã×ÖµäÎļþ´óСΪ280kb£º
3007 (ling2) 4E00 (yi1) 4E01 (ding1,zheng1) 4E02 (kao3) 4E03 (qi1) 4E04 (shang4,shang3) 4E05 (xia4) 4E06 (none0) 4E07 (wan4,mo4) 4E08 (zhang4) 4E09 (san1) 4E0A (shang4,shang3) 4E0B (xia4) 4E0C (ji1) 4E0D (bu4,bu2,fou3) 4E0E (yu3,yu4,yu2) 4E0F (mian3) 4E10 (gai4) 4E11 (chou3) 4E12 (chou3) 4E13 (zhuan1) 4E14 (qie3,ju1) ...ÆäÖУ¬¶ÔÓÚûÓлòÕßÕÒ²»µ½¶ÁÒôµÄºº×Ö£¬Í³Ò»±êעΪnone0£¬ÎÒͳ¼ÆÁËһϣ¬ÕâÑùµÄºº×ÖÒ»¹²ÓÐ525¸ö¡£
±¾×Ž«×ÖµäÎļþ¾¡¿ÉÄܼõСÌå»ýµÄÄ¿±ê£¬·¢ÏÖÉÏÊöÎļþÖгýÁ˵ÚÒ»¸ö©–(3007)Ö®Í⣬ÆäËü¶¼ÊÇÁ¬ÐøµÄ£¬ËùÒÔÎÒ°ÑËü¸Ä³ÉÁËÈçϽṹ£¬ÎļþÌå»ýÒ²´Ó280kb¼õСµ½ÁË117kb£º
¸Ã×ÖµäÎļþµÄȱµãÊÇÉùµ÷ÊÇÓÃÊý×Ö±ê³öµÄ£¬Èç¹ûÏëÒªµÃ³öÀàËÆxi¨£o m¨ªng t¨®ng xu¨¦ÕâÑùµÄÆ´ÒôµÄ»°£¬ÐèÒªÒ»¸öËã·¨½«ºÏÊÊλÖõÄ×Öĸת»»³É¨¡¨¢¨£¨¤¨¨®¨¯¨°¨¥¨¦¨§¨¨¨©¨ª¨«¨¬¨±¨²¨³¨´¨¹¨µ¨¶¨·¨¸¨½¨¾¡£
±¾À´»¹×¼±¸×Ô¼º³¢ÊÔдһ¸öת»»µÄ·½·¨µÄ£¬ºóÀ´ÓÖÕÒµ½ÁËÈçÏÂ×ÖµäÎļþ(ÏÂÃæ³ÆΪ×ÖµäB)£¬ËüÊÕ¼ÁË20867¸öºº×Ö£¬Ò²Ö§³ÖÉùµ÷ºÍ¶àÒô×Ö£¬µ«ÊÇÉùµ÷ÊÇÖ±½Ó±êÔÚ×ÖĸÉÏ·½µÄ£¬ÓÉÓÚËü½«ºº×ÖÒ²ÁоٳöÀ´£¬ËùÒÔÎļþÌå»ý±È½Ï´ó£¬ÓÐ327kb£¬´óÖÂÄÚÈÝÈçÏ£º
µ«ÊǾ¹ý±È¶Ô£¬·¢ÏÖÓÐ502¸öºº×ÖÊÇ×ÖµäAÖжÁÒôΪnoneµ«ÊÇ×ÖµäBÖÐÓжÁÒôµÄ£¬»¹ÓÐ21¸öºº×ÖÊÇ×ÖµäAÖÐÓе«ÊÇBÖÐûÓеģº
»¹ÓÐ7¸öºº×ÖÊÇBÖÐÓе«ÊÇAÖÐûÓеģº
¡¡