Skip to content

didasy/tek

Repository files navigation

tek

A golang package to get tags of an article


GoDoc

Installation

go get github.com/didasy/tek

Dependencies

None

Usage

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)
	}
}

Testing

To test, just run go test, but you need to have gomega and ginkgo installed.

Benchmark

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

License

See LICENSE file, it is MIT

About

A golang package to get an article's tag

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages