Giter Club home page Giter Club logo

whatlanggo's Introduction

Whatlanggo

Build Status Go Report Card GoDoc

Natural language detection for Go.

Features

  • Supports 84 languages
  • 100% written in Go
  • No external dependencies
  • Fast
  • Recognizes not only a language, but also a script (Latin, Cyrillic, etc)

Getting started

Installation:

    go get -u github.com/abadojack/whatlanggo

Simple usage example:

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])
}

Blacklisting and whitelisting

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])

For more details, please check the documentation

##TODO Add reliabilty metrics in the Info struct

License

MIT

Derivation

whatlanggo is a derivative Franc (JavaScript, MIT) by Titus Wormer

Acknowledgements

Thanks to greyblake Potapov Sergey for creating whatlang-rs from where I got the idea and logic.

whatlanggo's People

Contributors

abadojack avatar

Watchers

James Cloos avatar Konstantin avatar Mikhail Sisin avatar  avatar

Forkers

allen-oneill

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.