File tree 1 file changed +8
-1
lines changed
src/test/java/com/hankcs/lucene
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 10
10
import org .apache .lucene .analysis .tokenattributes .TypeAttribute ;
11
11
12
12
import java .io .StringReader ;
13
+ import java .util .HashMap ;
14
+ import java .util .Map ;
13
15
14
16
public class HanLPTokenizerTest extends TestCase
15
17
{
@@ -60,7 +62,12 @@ public void testMultiText() throws Exception
60
62
61
63
public void testPinyinTokenFilter () throws Exception
62
64
{
63
- TokenStream tokenStream = new HanLPPinyinTokenFilter (tokenizer );
65
+ Map <String , String > args = new HashMap <>();
66
+ args .put ("original" , "true" );
67
+ args .put ("pinyin" , "false" );
68
+ args .put ("pinyinFirstChar" , "true" );
69
+ HanLPPinyinTokenFilterFactory factory = new HanLPPinyinTokenFilterFactory (args );
70
+ TokenStream tokenStream = factory .create (tokenizer );
64
71
while (tokenStream .incrementToken ())
65
72
{
66
73
CharTermAttribute attribute = tokenizer .getAttribute (CharTermAttribute .class );
You can’t perform that action at this time.
0 commit comments