https://github.com/f1monkey/ngrams
Ngram generation library
https://github.com/f1monkey/ngrams
go golang ngram ngrams trigram trigrams
Last synced: 5 months ago
JSON representation
Ngram generation library
- Host: GitHub
- URL: https://github.com/f1monkey/ngrams
- Owner: f1monkey
- Created: 2022-11-09T16:48:55.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T00:28:21.000Z (over 3 years ago)
- Last Synced: 2026-01-15T05:38:29.778Z (5 months ago)
- Topics: go, golang, ngram, ngrams, trigram, trigrams
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ngrams
N-grams generation library written in go
## Install
```bash
$ go get -v github.com/f1monkey/ngrams
```
## Usage
```go
result := ngrams.From("orange", 3)
fmt.Println(result) // [ora, ran, ang, nge]
result := ngrams.FromRange("word", 2, 3)
fmt.Println(result) // [wo, or, rd, wor, ord]
```
## Benchmark
```
goos: linux
goarch: amd64
pkg: github.com/f1monkey/ngrams
cpu: Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Benchmark_MakeRange-12 493305 2446 ns/op 1440 B/op 31 allocs/op
Benchmark_From_6_3-12 2563634 456.1 ns/op 224 B/op 6 allocs/op
Benchmark_FromRunes_6_3-12 3208182 413.3 ns/op 224 B/op 6 allocs/op
PASS
coverage: 80.9% of statements
ok github.com/f1monkey/ngrams 4.593s
```