1. Pinyin the smallest size, Poapinyin's statement is almost 500 lines.
2. The speed is in fact similar to three, but do not use the Poapinyin native of that convert, that each time traversal lookup is very slow.
3. Contrast pinyin can only get the first letter of Chinese phonetic Alphabet, Pymethod was originally applied to the stock query, its number of pinyin is less than poapinyin.
For this Chinese character "hmm", I pinyin Input method is "en" dozen out, Pymethod get is en, but poapinyin get is Ng, Baidu Encyclopedia also read ng ...
4. Principle
Pinyin is to extract the first letter of the Chinese character in Unicode to the array, when the pinyin array [Chinese character's Unicode value-unicode the initial Chinese character value] is obtained directly.
Pymethod is to convert Unicode into GBK, and then according to GBK High and low two values to determine the position of the corresponding phonetic pinyin
Poapinyin is to put all the pinyin and the corresponding Chinese characters into a table, then to this list query (native Convert method)
The improved Quickconvert method is to get the upper and lower limit of the Unicode value of the Chinese character, and then convert the table above into unicode--Pinyin, the query is hash lookup, faster, if this Unicode is not continuous there will be a big problem ( There was a lack of words in the table: "? G?i?k still????????????? X?z? {???? Di She???? | Leng throw? Y-Matt???????????????????? Stuffed??? Terbium "). This function also skips some non-ASCII symbols. Another method Stringconvert fixes the problem of non-ASCII code. It is best to add the words mentioned above into the table when using.
Demo