whatlanggo, Go的自然语言检测库

分享于 

3分钟阅读

GitHub

  繁體 雙語
Natural language detection library for Go
  • 源代码名称:whatlanggo
  • 源代码网址:http://www.github.com/abadojack/whatlanggo
  • whatlanggo源代码文档
  • whatlanggo源代码下载
  • Git URL:
    git://www.github.com/abadojack/whatlanggo.git
    Git Clone代码到本地:
    git clone http://www.github.com/abadojack/whatlanggo
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/abadojack/whatlanggo
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    Whatlanggo

    Build StatusGo Report CardGoDoc

    Go的自然语言检测。

    特性

    • 支持 84语言功能。
    • 100%写入
    • 无外部依赖关系
    • 快速
    • 识别语言,不仅识别语言,还识别文字( 拉丁文,西里尔语等)

    启动

    安装:

    
    
    
    
     go get -u github.com/abadojack/whatlanggo
    
    
    
    

    简单用法示例:

    
    
    
    
    package main
    
    
    
    import (
    
    
     "fmt"
    
    
     "github.com/abadojack/whatlanggo"
    
    
    )
    
    
    
    func main() {
    
    
     info := whatlanggo.Detect("Foje funkcias kaj foje ne funkcias")
    
    
     fmt.Println("Language:", whatlanggo.LangToString(info.Lang), "Script:", whatlanggo.Scripts[info.Script])
    
    
    }
    
    
    
    

    黑名单和白名单

    
    
    
    
    import "github.com/abadojack/whatlanggo"
    
    
    
    //Blacklist
    
    
    options := whatlanggo.Options{
    
    
     Blacklist: map[whatlanggo.Lang]bool{
    
    
     whatlanggo.Ydd: true,
    
    
     },
    
    
    }
    
    
    
    info := whatlanggo.DetectWithOptions("האקדמיה ללשון העברית", options)
    
    
    
    fmt.Println("Language:", whatlanggo.LangToString(info.Lang), "Script:", whatlanggo.Scripts[info.Script])
    
    
    
    //Whitelist
    
    
    options1 := whatlanggo.Options{
    
    
     Whitelist: map[whatlanggo.Lang]bool{
    
    
     whatlanggo.Epo: true,
    
    
     whatlanggo.Ukr: true,
    
    
     },
    
    
    }
    
    
    
    info = whatlanggo.DetectWithOptions("Mi ne scias", options1)
    
    
    fmt.Println("Language:", whatlanggo.LangToString(info.Lang), "Script:", whatlanggo.Scripts[info.Script])
    
    
    
    

    有关详细信息,请查看文档文档。

    ##TODO 在 信息结构中添加可靠性度量

    许可证

    派生

    whatlanggo是一个派生的Franc,由Wormer

    确认

    感谢 greyblake Potapov Sergey创建 whatlang-rs,从那里我得到了思想和逻辑。


    相关文章