Skip to content

Commit 28310c6

Browse files
committed
补充TokenFilterFactory测试用例
1 parent b26cfc6 commit 28310c6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/com/hankcs/lucene/HanLPTokenizerTest.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
1111

1212
import java.io.StringReader;
13+
import java.util.HashMap;
14+
import java.util.Map;
1315

1416
public class HanLPTokenizerTest extends TestCase
1517
{
@@ -60,7 +62,12 @@ public void testMultiText() throws Exception
6062

6163
public void testPinyinTokenFilter() throws Exception
6264
{
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);
6471
while (tokenStream.incrementToken())
6572
{
6673
CharTermAttribute attribute = tokenizer.getAttribute(CharTermAttribute.class);

0 commit comments

Comments
 (0)