getlang provides fast natural language detection in Go.
- Offline -- no internet connection required
- Supports 29 languages
- Provides ISO 639 language codes
- Fast
Installation:
go get -u github.com/rylans/getlang
example:
package main
import (
"fmt"
"github.com/rylans/getlang"
)
func main(){
info := getlang.FromString("Wszyscy ludzie rodzą się wolni i równi w swojej godności i prawach")
fmt.Println(info.LanguageCode(), info.Confidence())
}
- Thanks to abadojack for the trigram generation logic in whatlanggo
- Cavnar, William B., and John M. Trenkle. "N-gram-based text categorization." Ann arbor mi 48113.2 (1994): 161-175.