public class WordTree extends HashMap<Character,WordTree>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| 限定符和类型 | 字段和说明 |
|---|---|
static int |
DEFAULT_GROUP
默认的类型
|
Map<Integer,Boolean> |
groups
关键词类型用于区分不同的
关键字类型,是否最后一个字符
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addWord(String word)
添加单词,使用默认类型
|
void |
addWord(String word,
int group)
添加单词,使用默认类型
|
void |
addWords(Collection<String> words)
增加一组单词,默认分组
|
void |
addWords(Collection<String> words,
int group)
增加一组单词
|
boolean |
isMatch(String text)
指定文本是否包含树中的词,默认类型
|
boolean |
isMatch(String text,
int group)
指定文本是否包含树中的词
|
String |
match(String text)
获得第一个匹配的关键字,默认类型
|
String |
match(String text,
int group)
获得第一个匹配的关键字
|
List<String> |
matchAll(String text)
找出所有匹配的关键字,默认类型
|
List<String> |
matchAll(String text,
int group)
找出所有匹配的关键字
|
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, valuesequals, hashCode, toStringpublic static final int DEFAULT_GROUP
public void addWords(Collection<String> words)
words - 单词public void addWords(Collection<String> words, int group)
words - 单词group - 分组public void addWord(String word)
word - 单词public void addWord(String word, int group)
word - 单词group - 分组public boolean isMatch(String text)
text - 被检查的文本public boolean isMatch(String text, int group)
text - 被检查的文本group - 类型Copyright © 2016. All rights reserved.