zgrim / yali-go

Lingua::YALI Go port

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lingua::YALI (Yet Another Language Identifier)

ported from Perl

http://search.cpan.org/perldoc?Lingua%3A%3AYALI%3A%3ALanguageIdentifier

(expects use of go-bindata to embed the resources, otherwise is easily adapted for fs)

cp /from/perl/src/share/*.gz data/
go-bindata -nocompress -nometadata -nomemcopy -pkg yali -prefix data data/
go build
y := yali.New("")
y.LoadAllMem()

or

y := yali.New("/from/disk/path")
y.LoadAllFS()

use

for i, lp := range y.IdentifyString("Foo bar has gone very baz") {
	fmt.Printf("#%d. Language %s = %.4f\n", i, lp.Lang, lp.Score)
}

About

Lingua::YALI Go port

License:MIT License


Languages

Language:Go 100.0%