https://github.com/Lazin/go-ngram
Ngram index for golang
https://github.com/Lazin/go-ngram
Last synced: 7 months ago
JSON representation
Ngram index for golang
- Host: GitHub
- URL: https://github.com/Lazin/go-ngram
- Owner: Lazin
- License: mit
- Created: 2014-04-19T07:25:58.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-05-27T14:42:31.000Z (about 10 years ago)
- Last Synced: 2024-06-20T13:31:55.989Z (almost 2 years ago)
- Language: Go
- Homepage:
- Size: 26.4 KB
- Stars: 114
- Watchers: 7
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-machine-master - go-ngram - In-memory n-gram index with compression. (Go)
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. *[Deprecated]* (Go / [Tools](#tools-1))
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. (Go / Speech Recognition)
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. *[Deprecated]* (Go)
- fucking-awesome-machine-learning - go-ngram - In-memory n-gram index with compression. *[Deprecated]* (Go / [Tools](#tools-1))
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. *[Deprecated]* (Go / [Tools](#tools-1))
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. (Go / Speech Recognition)
- awesome-machine-learning - go-ngram - In-memory n-gram index with compression. *[Deprecated]* (Go / [Tools](#tools-1))
- awesome-advanced-metering-infrastructure - go-ngram - In-memory n-gram index with compression. (Go / Speech Recognition)
README
go-ngram [](https://travis-ci.org/Lazin/go-ngram)
========
N-gram index for Go.
## Key features
* Unicode support.
* Append only. Data can't be deleted from index.
* GC friendly (all strings are pooled and compressed)
* Application agnostic (there is no notion of document or something that user needs to implement)
## Usage
```go
index, err := ngram.NewNGramIndex(ngram.SetN(3))
tokenId, err := index.Add("hello")
str, err := index.GetString(tokenId) // str == "hello"
resultsList, err := index.Search("world")
```
## TODO:
* Smoothing functions (Laplace etc)
[](https://godoc.org/github.com/Lazin/go-ngram)
[](https://sourcegraph.com/github.com/Lazin/go-ngram)
[](https://sourcegraph.com/github.com/Lazin/go-ngram)