类 HanziToPinyinUtils
java.lang.Object
javabase.lorenwang.tools.common.HanziToPinyinUtils
public class HanziToPinyinUtils extends Object
An object to convert Chinese character to its corresponding pinyin string. For characters with
multiple possible pinyin string, only one is selected according to collator. Polyphone is not
supported in this implementation. This class is implemented to achieve the best runtime
performance and minimum runtime resources with tolerable sacrifice of accuracy. This
implementation highly depends on zh_CN ICU collation data and must be always synchronized with
ICU.
Currently this file is aligned to zh.txt in ICU 4.6
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classHanziToPinyinUtils.Token -
字段概要
-
构造器概要
构造器 限定符 构造器 说明 protectedHanziToPinyinUtils(boolean hasChinaCollator) -
方法概要
修饰符和类型 方法 说明 ArrayList<HanziToPinyinUtils.Token>get(String input)Convert the input to a array of tokens.static HanziToPinyinUtilsgetInstance()StringgetTokensForDialerSearch(String input, StringBuilder offsets)
-
字段详细资料
-
UNIHANS
protected static final char[] UNIHANSUnihans array. Each unihans is the first one within same pinyin. Use it to determine pinyin for all ~20k unihans. -
PINYINS
protected static final byte[][] PINYINSPinyin array. Each pinyin is corresponding to unihans of same offset in the unihans array.
-
-
构造器详细资料
-
HanziToPinyinUtils
protected HanziToPinyinUtils(boolean hasChinaCollator)
-
-
方法详细资料
-
getInstance
-
get
Convert the input to a array of tokens. The sequence of ASCII or Unknown characters without space will be put into a Token, One Hanzi character which has pinyin will be treated as a Token. If these is no China collator, the empty token array is returned.- 参数:
input- 输入的文字- 返回:
- 返回数据
-
getTokensForDialerSearch
-