https://github.com/rafatbiin/gongram
Ngram generator in Go that just works
https://github.com/rafatbiin/gongram
go go-package golang ngram ngrams nlp
Last synced: 6 months ago
JSON representation
Ngram generator in Go that just works
- Host: GitHub
- URL: https://github.com/rafatbiin/gongram
- Owner: rafatbiin
- License: mit
- Created: 2020-07-13T14:51:24.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-04T12:31:32.000Z (almost 6 years ago)
- Last Synced: 2023-07-26T15:13:49.429Z (almost 3 years ago)
- Topics: go, go-package, golang, ngram, ngrams, nlp
- Language: Go
- Homepage:
- Size: 9.77 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gongram 
Ngram generator in Go that just works.
## Overview
gongram provides a Go package which generates Ngrams of given
gram size from given text. It has support for unicode language as well.
It'll remove all the punctuations but keep the cases of the letters untouched.
In *addition* this library provides a [CLI](#cli) to perform the above operation via console.
## Installing
To start using gongram, install Go and run `go get`:
```sh
$ go get github.com/rafatbiin/gongram/...
```
This will retrieve the library and install the `gongram` command line utility into
your `$GOBIN` path.
## Generating Ngram
```go
package main
import (
"fmt"
"github.com/rafatbiin/gongram"
)
func main() {
text := "It’s not about ideas. It’s about making ideas happen!"
ngrams, err:= gongram.Generate(text, 4) // ["Its not about ideas","not about ideas Its","about ideas Its about","ideas Its about making","Its about making ideas","about making ideas happen"]
if err != nil {
// Handle error
}
...
}
```
## CLI
```sh
$ gongram ngram -g 4 It’s not about ideas. It’s about making ideas happen!
["Its not about ideas","not about ideas Its","about ideas Its about","ideas Its about making","Its about making ideas","about making ideas happen"]
```