mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-06 17:18:54 +08:00
Update DfaTest.java
修正代码,使得与注释内容对应
This commit is contained in:
parent
08cc041a4d
commit
2b3c7d6aac
@ -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());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user