replaced usage of deprecated method removeOverlaps() with ignoreOverlaps in README
This commit is contained in:
parent
f218ba40c6
commit
8bded03f55
@ -77,14 +77,14 @@ matches.
|
|||||||
|
|
||||||
```java
|
```java
|
||||||
Trie trie = Trie.builder()
|
Trie trie = Trie.builder()
|
||||||
.removeOverlaps()
|
.ignoreOverlaps()
|
||||||
.addKeyword("hot")
|
.addKeyword("hot")
|
||||||
.addKeyword("hot chocolate")
|
.addKeyword("hot chocolate")
|
||||||
.build();
|
.build();
|
||||||
Collection<Emit> emits = trie.parseText("hot chocolate");
|
Collection<Emit> emits = trie.parseText("hot chocolate");
|
||||||
```
|
```
|
||||||
|
|
||||||
The removeOverlaps method tells the Trie to remove all overlapping matches. For this it relies on the following
|
The ignoreOverlaps method tells the Trie to remove all overlapping matches. For this it relies on the following
|
||||||
conflict resolution rules: 1) longer matches prevail over shorter matches, 2) left-most prevails over right-most.
|
conflict resolution rules: 1) longer matches prevail over shorter matches, 2) left-most prevails over right-most.
|
||||||
There is only one result now:
|
There is only one result now:
|
||||||
* "hot chocolate" starting at position 0, ending at position 12
|
* "hot chocolate" starting at position 0, ending at position 12
|
||||||
@ -121,7 +121,7 @@ It is also possible to just ask whether the text matches any of the keywords, or
|
|||||||
finds.
|
finds.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Trie trie = Trie.builder().removeOverlaps()
|
Trie trie = Trie.builder().ignoreOverlaps()
|
||||||
.addKeyword("ab")
|
.addKeyword("ab")
|
||||||
.addKeyword("cba")
|
.addKeyword("cba")
|
||||||
.addKeyword("ababc")
|
.addKeyword("ababc")
|
||||||
@ -161,7 +161,7 @@ matches as soon as you encounter them. Let's look at an example where we want to
|
|||||||
String speech = "The Answer to the Great Question... Of Life, " +
|
String speech = "The Answer to the Great Question... Of Life, " +
|
||||||
"the Universe and Everything... Is... Forty-two,' said " +
|
"the Universe and Everything... Is... Forty-two,' said " +
|
||||||
"Deep Thought, with infinite majesty and calm.";
|
"Deep Thought, with infinite majesty and calm.";
|
||||||
Trie trie = Trie.builder().removeOverlaps().onlyWholeWords().caseInsensitive()
|
Trie trie = Trie.builder().ignoreOverlaps().onlyWholeWords().caseInsensitive()
|
||||||
.addKeyword("great question")
|
.addKeyword("great question")
|
||||||
.addKeyword("forty-two")
|
.addKeyword("forty-two")
|
||||||
.addKeyword("deep thought")
|
.addKeyword("deep thought")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user