abadojack / whatlanggo

Natural language detection library for Go
MIT License
637 stars 64 forks source link

Non-deterministic output for certain language queries with white list options #11

Open mikai21 opened 5 years ago

mikai21 commented 5 years ago

Here is example

package main

import (
    "fmt"
    "github.com/abadojack/whatlanggo"
)

var whitelist_options = whatlanggo.Options{
    Whitelist: map[whatlanggo.Lang]bool{
        whatlanggo.Eng: true,
        whatlanggo.Jpn: true,
        whatlanggo.Kor: true,
        whatlanggo.Vie: true,
        whatlanggo.Ind: true,
        whatlanggo.Cmn: true,
    },
}

func main() {
    info := whatlanggo.DetectWithOptions("appel", whitelist_options)
    fmt.Println("Language:", whatlanggo.LangToString(info.Lang), "Script:", whatlanggo.Scripts[info.Script])
}
mikai21 commented 5 years ago

I want to get whole language list If there are same distance(probability). Or I want to function that whole languages of probability.