Skip to content

Commit

Permalink
Release 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hankcs committed Apr 1, 2018
1 parent 438023c commit 5fa8ccf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ This implementation has been widely used in my [HanLP: Han Language Processing](
Dependency
----------
Include this dependency in your POM. Be sure to check for the latest version in Maven Central.

```xml
<dependency>
<groupId>com.hankcs</groupId>
<artifactId>aho-corasick-double-array-trie</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
</dependency>
```

Usage
-----
Setting up the `AhoCorasickDoubleArrayTrie` is a piece of cake:

```java
// Collect test data set
TreeMap<String, String> map = new TreeMap<String, String>();
Expand All @@ -52,7 +54,7 @@ Setting up the `AhoCorasickDoubleArrayTrie` is a piece of cake:
acdat.build(map);
// Test it
final String text = "uhers";
List<AhoCorasickDoubleArrayTrie<String>.Hit<String>> wordList = acdat.parseText(text);
List<AhoCorasickDoubleArrayTrie.Hit<String>> wordList = acdat.parseText(text);
```

Of course, there remains many useful methods to be discovered, feel free to try:
Expand All @@ -74,6 +76,7 @@ In other situations you probably do not need a huge wordList, then please try th
```

or a lambda function

```
acdat.parseText(text, (begin, end, value) -> {
System.out.printf("[%d:%d]=%s\n", begin, end, value);
Expand All @@ -83,6 +86,7 @@ or a lambda function
Comparison
-----
I compared my AhoCorasickDoubleArrayTrie with robert-bor's aho-corasick, ACDAT represents for AhoCorasickDoubleArrayTrie and Naive represents for aho-corasick, the result is :

```
Parsing English document which contains 3409283 characters, with a dictionary of 127142 words.
Naive ACDAT
Expand Down Expand Up @@ -119,3 +123,5 @@ License
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.hankcs</groupId>
<artifactId>aho-corasick-double-array-trie</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>

<name>AhoCorasickDoubleArrayTrie</name>
<url>https://github.com/hankcs/AhoCorasickDoubleArrayTrie</url>
Expand Down

0 comments on commit 5fa8ccf

Please sign in to comment.