go-lang-detector
go-lang-detector copied to clipboard
A small library in golang, that detects the language of a text. (text categorization)
Take into account only items of mapA that have a value BIGGER than 300. This if statement does the opposite.
If anyone is interested in migrating this repository to the newest GO practices around modules, I would appreciate some help.
English detector fails when checking czech text: package main import ( "fmt" "github.com/chrisport/go-lang-detector/langdet" "github.com/chrisport/go-lang-detector/langdet/langdetdef" ) var isEnglishDetector langdet.Detector func isEnglish(text string) bool { if len(isEnglishDetector.Languages) == 0 { fmt.Println("* Init...
Here's a first pass at modernizing the repo a little. Moves JSON file to using go embed, move to modules from dep, move to github actions from werker, etc. ~Probably...
No longer seems to work ```go package main import ( "fmt" "github.com/chrisport/go-lang-detector/langdet" "github.com/chrisport/go-lang-detector/langdet/langdetdef" ) var detector langdet.Detector func init() { detector = langdetdef.NewWithDefaultLanguages() } func main() { testString := "do...
package main import ( "fmt" //"github.com/chrisport/go-lang-detector" "github.com/chrisport/go-lang-detector/langdet/langdetdef" ) func main() { detector := langdetdef.NewWithDefaultLanguages() testString := "do not care about quantity" result := detector.GetClosestLanguage(testString) fmt.Println(result) }