public class KeywordMatcher extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected StringStartWithMatcher |
matcher |
Constructor and Description |
---|
KeywordMatcher(KeywordMatcher toBeCopied)
Constructs a copy which has exactly the same matching definition as the original one.
创建一个副本,这个副本与原先的对象具有完全相同匹配方式定义。 |
KeywordMatcher(Map<String,? extends Object> keywordDefinitions)
Constructs a matcher object with specified keywords; When creating internal
data structure, choose to consume more memory for better matching speed.
根据关键词列表,创建一个匹配器; 在创建内部数据结构的时候,选择占用更多内存,而换取速度上的提升。 |
KeywordMatcher(Map<String,? extends Object> keywordDefinitions,
boolean moreSpaceForSpeed)
Constructs a matcher object with specified keywords.
根据关键词列表,创建一个匹配器。 |
Modifier and Type | Method and Description |
---|---|
Map<Object,org.apache.commons.lang3.mutable.MutableInt> |
match(CharSequence text)
Do the matching test, find out which keywords can be matched, and how many occurrences of each
keyword can be found.
进行匹配,返回所匹配上的关键词,以及匹配的次数。 |
protected StringStartWithMatcher matcher
public KeywordMatcher(KeywordMatcher toBeCopied)
toBeCopied
- original objectpublic KeywordMatcher(Map<String,? extends Object> keywordDefinitions)
keywordDefinitions
- Keywords and their associated attachment as identifier.public KeywordMatcher(Map<String,? extends Object> keywordDefinitions, boolean moreSpaceForSpeed)
keywordDefinitions
- Keywords and their associated attachment as identifier.moreSpaceForSpeed
- Whether or not to consume
more memory for better matching speed.public Map<Object,org.apache.commons.lang3.mutable.MutableInt> match(CharSequence text)
text
- the text string to be testedCopyright © 2014. All Rights Reserved.