|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.hankcs.hanlp.collection.AhoCorasick.AhoCorasickDoubleArrayTrie<V>
public class AhoCorasickDoubleArrayTrie<V>
基于双数组Trie树的AhoCorasick自动机
| 嵌套类摘要 | |
|---|---|
class |
AhoCorasickDoubleArrayTrie.Hit<V>
一个命中结果 |
static interface |
AhoCorasickDoubleArrayTrie.IHit<V>
命中一个模式串的处理方法 |
static interface |
AhoCorasickDoubleArrayTrie.IHitFull<V>
|
| 字段摘要 | |
|---|---|
protected int[] |
base
双数组之base |
protected int[] |
check
双数组值check |
protected int[] |
l
每个key的长度 |
protected int |
size
base 和 check 的大小 |
protected V[] |
v
保存value |
| 构造方法摘要 | |
|---|---|
AhoCorasickDoubleArrayTrie()
|
|
| 方法摘要 | |
|---|---|
void |
build(TreeMap<String,V> map)
由一个排序好的map创建 |
int |
exactMatchSearch(String key)
精确匹配 |
V |
get(int index)
从值数组中提取下标为index的值 注意为了效率,此处不进行参数校验 |
V |
get(String key)
获取值 |
boolean |
load(ByteArray byteArray,
V[] value)
载入 |
void |
load(ObjectInputStream in,
V[] value)
载入 |
void |
parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHit<V> processor)
处理文本 |
void |
parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHitFull<V> processor)
处理文本 |
List<AhoCorasickDoubleArrayTrie.Hit<V>> |
parseText(String text)
匹配母文本 |
void |
parseText(String text,
AhoCorasickDoubleArrayTrie.IHit<V> processor)
处理文本 |
void |
save(DataOutputStream out)
持久化 |
void |
save(ObjectOutputStream out)
持久化 |
boolean |
set(String key,
V value)
更新某个键对应的值 |
int |
size()
大小,即包含多少个模式串 |
protected int |
transition(int current,
char c)
转移状态 |
protected int |
transitionWithRoot(int nodePos,
char c)
c转移,如果是根节点则返回自己 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected int[] check
protected int[] base
protected V[] v
protected int[] l
protected int size
| 构造方法详细信息 |
|---|
public AhoCorasickDoubleArrayTrie()
| 方法详细信息 |
|---|
public List<AhoCorasickDoubleArrayTrie.Hit<V>> parseText(String text)
text - 一些文本
public void parseText(String text,
AhoCorasickDoubleArrayTrie.IHit<V> processor)
text - 文本processor - 处理器
public void parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHit<V> processor)
text - processor -
public void parseText(char[] text,
AhoCorasickDoubleArrayTrie.IHitFull<V> processor)
text - processor -
public void save(DataOutputStream out)
throws Exception
out - 一个DataOutputStream
Exception - 可能的IO异常等
public void save(ObjectOutputStream out)
throws IOException
out - 一个ObjectOutputStream
IOException - 可能的IO异常
public void load(ObjectInputStream in,
V[] value)
throws IOException,
ClassNotFoundException
in - 一个ObjectInputStreamvalue - 值(持久化的时候并没有持久化值,现在需要额外提供)
IOException
ClassNotFoundException
public boolean load(ByteArray byteArray,
V[] value)
byteArray - 一个字节数组value - 值数组
public V get(String key)
key - 键
public boolean set(String key,
V value)
key - 键value - 值
public V get(int index)
index - 下标
protected int transition(int current,
char c)
current - c -
protected int transitionWithRoot(int nodePos,
char c)
nodePos - c -
public void build(TreeMap<String,V> map)
public int exactMatchSearch(String key)
key - 键
public int size()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||