Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derekparker/trie
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching.
https://github.com/derekparker/trie
Last synced: 6 days ago
JSON representation
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching.
- Host: GitHub
- URL: https://github.com/derekparker/trie
- Owner: derekparker
- License: mit
- Created: 2014-03-06T22:01:49.000Z (over 10 years ago)
- Default Branch: v3
- Last Pushed: 2024-09-16T17:44:16.000Z (about 2 months ago)
- Last Synced: 2024-10-13T14:35:47.054Z (23 days ago)
- Language: Go
- Homepage:
- Size: 74.2 KB
- Stars: 760
- Watchers: 23
- Forks: 115
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - trie - Trie implementation in Go. (Data Structures and Algorithms / Text Analysis)
- awesome-go - trie - Trie implementation in Go. (Data Structures and Algorithms / Text Analysis)
- awesome-go - trie - Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching. - ★ 325 (Data Structures)
- awesome-go-extra - trie - 03-06T22:01:49Z|2022-03-19T00:15:59Z| (Generators / Text Analysis)
README
[![GoDoc](https://godoc.org/github.com/derekparker/trie?status.svg)](https://godoc.org/github.com/derekparker/trie)
# Trie
Data structure and relevant algorithms for extremely fast prefix/fuzzy string searching.## Usage
Create a Trie with:
```Go
t := trie.New()
```Add Keys with:
```Go
// Add can take in meta information which can be stored with the key.
// i.e. you could store any information you would like to associate with
// this particular key.
t.Add("foobar", 1)
```Find a key with:
```Go
node, ok := t.Find("foobar")
meta := node.Meta()
// use meta with meta.(type)
```Remove Keys with:
```Go
t.Remove("foobar")
```Prefix search with:
```Go
t.PrefixSearch("foo")
```Fast test for valid prefix:
```Go
t.HasKeysWithPrefix("foo")
```Fuzzy search with:
```Go
t.FuzzySearch("fb")
```## Contributing
Fork this repo and run tests with:go test
Create a feature branch, write your tests and code and submit a pull request.
## License
MIT