Update DfaTest.java

修正代码,使得与注释内容对应
This commit is contained in:
ET-yzk 2025-10-05 15:34:47 +08:00 committed by GitHub
parent 08cc041a4d
commit 2b3c7d6aac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,12 +118,12 @@ public class DfaTest {
/** /**
* Github Issue #4091 * Github Issue #4091
* 测试当关键词以停顿词如括号结尾时其合法前缀是否能被正确匹配 * 测试当关键词以停顿词结尾时其合法前缀是否能被正确匹配
*/ */
@Test @Test
public void addWordWithTrailingFilteredCharTest() { public void addWordWithTrailingFilteredCharTest() {
WordTree tree = new WordTree(); WordTree tree = new WordTree();
tree.addWord("hello "); // 以被过滤字符结尾 tree.addWord("hello("); // 以停顿词 '(' 结尾
List<String> matches = tree.matchAll("hello", -1); List<String> matches = tree.matchAll("hello", -1);
assertEquals(1, matches.size()); assertEquals(1, matches.size());
@ -137,7 +137,7 @@ public class DfaTest {
@Test @Test
public void addWordWithMiddleFilteredCharTest() { public void addWordWithMiddleFilteredCharTest() {
WordTree tree = new WordTree(); WordTree tree = new WordTree();
tree.addWord("he llo"); // 中间 '(' 被过滤 tree.addWord("he(llo"); // 中间 '(' 被过滤
List<String> matches = tree.matchAll("hello", -1); List<String> matches = tree.matchAll("hello", -1);
assertEquals(1, matches.size()); assertEquals(1, matches.size());