T9Search
V1.1.0
Android T9 search.
提供T9匹配,支援多音字匹配。
注意:由於生成漢字拼音的方案有多種,因此本庫並不包含漢字拼音的生成,需要自己選擇合適的方案生成拼音。 另外值得注意的是,使用多音字的話將會使匹配串的長度呈倍數增加。
================================================== =========
產生匹配串
String t9Key = T9Utils . buildT9Key ( "重新称重" , new PinyinProvider () {
@ Override
public String [] getPinyin ( char input ) {
// 在这里生成拼音,如果需要支持多音字匹配,返回多个拼音就行了。
// 由于多音字的拼音可能只是声调不同,去除声调后是一样的(如:“啊”字),所以建议做一下去重复操作。
return new String []{ /*拼音...*/ };
}
});
// ...
匹配
String t9Key ;
String constraint ;
// ...
T9MatchInfo matchInfo = T9Matcher . matches ( t9Key , constraint );
// ...
具體使用方法請看範例。
compile ' cn.tinkling.t9:t9search:1.1.0 '
< dependency >
< groupId >cn.tinkling.t9</ groupId >
< artifactId >t9search</ artifactId >
< version >1.1.0</ version >
< type >aar</ type >
</ dependency >