Skip to content

rafatbiin/gongram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gongram CI

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 to perform the above operation via console.

Installing

To start using gongram, install Go and run go get:

$ go get github.com/rafatbiin/gongram/...

This will retrieve the library and install the gongram command line utility into your $GOBIN path.

Generating Ngram

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

$ 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"]

Releases

No releases published

Packages

No packages published

Languages