Home

Awesome

Tongue

Hex.pm Hex.pm

Elixir port of Nakatani Shuyo's natural language detector

Installation

Add tongue to your list of dependencies in mix.exs:

def deps do
  [{:tongue, "~> 2.2"}]
end

Usage

Detect language and return a scored list of languages:

iex> Tongue.detect("The octopus is a soft-bodied, eight-armed mollusc of the order Octopoda, with around 300 known species. Along with squids, cuttlefish and nautiloids, they are classed as cephalopods.")
[en: 0.9999986358008764]

Detect language within subset of supported languages:

use Mix.Config

config :tongue,
  languages: ~w(en ru fr de)a

Languages

Tongue supports 55 languages out of the box (ISO 639-1 codes):

af, ar, bg, bn, ca, cs, cy, da, de, el, en, es, et, fa, fi, fr, gu, he,
hi, hr, hu, id, it, ja, kn, ko, lt, lv, mk, ml, mr, ne, nl, no, pa, pl,
pt, ro, ru, sk, sl, so, sq, sv, sw, ta, te, th, tl, tr, uk, ur, vi, zh-cn, zh-tw

Derivation

Tongue is a derivative work from Nakatani Shuyo's language-detection library

License

Apache 2.0 © Danila Poyarkov