T9Search
V1.1.0
Android T9 search.
Provide T9 matching and support multi-phonetic word matching.
Note: Since there are many solutions for generating Chinese pinyin, this library does not include the generation of Chinese pinyin. You need to choose a suitable solution to generate pinyin. It is also worth noting that using polyphonic characters will multiply the length of the matching string.
================================================== =========
Generate matching string
String t9Key = T9Utils . buildT9Key ( "重新称重" , new PinyinProvider () {
@ Override
public String [] getPinyin ( char input ) {
// 在这里生成拼音,如果需要支持多音字匹配,返回多个拼音就行了。
// 由于多音字的拼音可能只是声调不同,去除声调后是一样的(如:“啊”字),所以建议做一下去重复操作。
return new String []{ /*拼音...*/ };
}
});
// ...
match
String t9Key ;
String constraint ;
// ...
T9MatchInfo matchInfo = T9Matcher . matches ( t9Key , constraint );
// ...
Please see examples for specific usage.
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 >