go get github.com/didasy/tek
None
package main
import (
"fmt"
"io/ioutil"
"github.com/didasy/tek"
)
func main() {
Tb, _ := ioutil.ReadFile("../sample.txt")
text := string(Tb)
tek.SetLang("en")
tags := tek.GetTags(text, 10)
for _, tag := range tags {
fmt.Println(tag.Term, tag.Tfidf)
}
}
To test, just run go test
, but you need to have gomega and ginkgo installed.
Using i3-3217U @1.8GHz with 370 total words from the sample.txt provided and command go test -bench . -benchtime=5s -cpu 4
:
BenchmarkGetTagEn-4 1000 11097404 ns/op
BenchmarkGetTagId-4 1000 6295201 ns/op
See LICENSE file, it is MIT