https://github.com/bep/triebytesmapper
Work in progress.
https://github.com/bep/triebytesmapper
Last synced: 3 months ago
JSON representation
Work in progress.
- Host: GitHub
- URL: https://github.com/bep/triebytesmapper
- Owner: bep
- License: mit
- Created: 2023-05-23T10:36:22.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-25T07:50:37.000Z (almost 3 years ago)
- Last Synced: 2025-02-13T14:41:03.453Z (about 1 year ago)
- Language: Go
- Size: 87.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/bep/triebytesmapper/actions?query=workflow:Test)
[](https://goreportcard.com/report/github.com/bep/triebytesmapper)
[](https://godoc.org/github.com/bep/triebytesmapper)
Mapper builds a trie from a set of keywords and can be used to map a byte slice (typically file content) against these keywords.
There are some settings:
```go
// Options for the mapper.
type Options struct {
// NormalizeRune will be applied to both the input and the keywords before matching.
// Defaults to nil.
// Typically used to do lower casing and accent folding.
NormalizeRune func(rune) rune
// IsWordBoundary is used to determine word boundaries.
// A default implementation is used if nil.
IsWordBoundary func(rune) bool
}
```
Note that this library currently does not work for CJK languages.