More explanation on the usage
This commit is contained in:
parent
e1da9bd274
commit
10b59654b7
10
README.md
10
README.md
@ -33,12 +33,13 @@ Some examples you could use the Aho-Corasick algorithm for:
|
|||||||
* checking against a dictionary to see if syntactic errors were made
|
* checking against a dictionary to see if syntactic errors were made
|
||||||
|
|
||||||
This library is the Java implementation of the afore-mentioned Aho-Corasick algorithm for efficient string matching.
|
This library is the Java implementation of the afore-mentioned Aho-Corasick algorithm for efficient string matching.
|
||||||
The algorithm is explained in great detail in the white paper written by Aho and Corasick:
|
The algorithm is explained in great detail in the white paper written by
|
||||||
ftp://163.13.200.222/assistant/bearhero/prog/%A8%E4%A5%A6/ac_bm.pdf.
|
[Aho and Corasick](ftp://163.13.200.222/assistant/bearhero/prog/%A8%E4%A5%A6/ac_bm.pdf).
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
Setting up the Trie is a piece of cake:
|
||||||
```java
|
```java
|
||||||
Trie trie = new Trie();
|
Trie trie = new Trie();
|
||||||
trie.addKeyword("hers");
|
trie.addKeyword("hers");
|
||||||
@ -48,6 +49,11 @@ Usage
|
|||||||
Collection<Emit> emits = trie.parseText("ushers");
|
Collection<Emit> emits = trie.parseText("ushers");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can now read the set. In this case it will find the following:
|
||||||
|
* "she" at position 3
|
||||||
|
* "he" at position 3
|
||||||
|
* "hers" at position 5
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user