Whatlang NIF bindings for Elixir.
The package can be installed by adding whatlangex
to your list of dependencies in mix.exs
:
def deps do
[
{:whatlangex, "~> 0.2.1"}
]
end
To detect the language of a sentence:
iex> detect("This is a nice sentence, don't you think?")
{:ok,
%Whatlangex.Detection{
lang: "eng",
script: "Latin",
confidence: 0.5628587066030453
}}
To get full language name (in english) from language code:
iex> code_to_eng_name("jap")
"Japanese"
Or in the native language:
iex> code_to_name("slv")
"Slovenščina"