You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-49Lines changed: 16 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ and if the search will be case sensitive or not.
32
32
There are 3 "implementations" of `SubstringEngine` that uses the libraries from
33
33
https://github.com/cloudflare/ahocorasick,
34
34
https://github.com/anknown/ahocorasick and
35
-
https://github.com/petar-dambovaliev/aho-corasick and a regexp implementation for the `RegexEngine`.
35
+
https://github.com/pedroegsilva/ahocorasick (fork from cloudflare with the addition for matching positions) and a regexp implementation for the `RegexEngine`.
36
36
But any other library can be used as long as it "implements" the `SubstringEngine` or `RegexEngine` interface.
37
37
```go
38
38
subEng:= &finder.CloudflareForkEngine{}
@@ -41,7 +41,7 @@ But any other library can be used as long as it "implements" the `SubstringEngin
To solve the expression we need a map of the terms that were matched and the position of each match. The positions are needed to solve the INORD operator and must be sorted to work properly, if there is no INORD operator in the expression, an empty array or a nil value will suffice.
The Iterative solution needs to create an array with the order in which the expressions need to be solved.
181
-
It is faster than the recursive if you need to solve the expression more than 8 times (the gain in performance is around 13% from the benchmark results)
182
-
183
-
The solvers also need to know if the map of matches is complete or not. If it is complete it will have the term as a key even if it was a no match.
184
-
The incomplete option will assume that if a key is not present the term was not found.
185
-
If an incomplete map is provided and the key is not found an error will be returned.
186
-
187
-
```go
188
-
// should return an error
189
-
_, err = expression.Solve(matches, true)
190
-
if err != nil {
191
162
192
-
log.Fatal(err)
193
-
}
194
-
}
195
-
196
-
```
197
163
The complete example can be found at `/examples/dsl/main.go`
164
+
198
165
## Run Locally
199
166
This project uses Bazel to build and test the code.
0 commit comments