Awesome
Lingua
Lingua is an Elixir wrapper for the Rust lingua crate with Rustler.
Summary
Lingua is a NIF-based bridge for the lingua Rust language detection library.
Usage
iex> Lingua.detect("this is definitely English")
{:ok, :english}
iex> Lingua.detect("וזה בעברית")
{:ok, :hebrew}
iex> Lingua.detect("państwowych", builder_option: :with_languages, languages: [:english, :russian, :polish])
{:ok, :polish}
iex> Lingua.detect("ѕидови", builder_option: :all_languages_with_cyrillic_script)
{:ok, :macedonian}
iex> Lingua.detect("כלב", builder_option: :with_languages, languages: [:english, :russian, :polish])
{:ok, :no_match}
iex> Lingua.detect("what in the world is this", builder_option: :with_languages, languages: [:english, :russian, :hebrew], compute_language_confidence_values: true)
{:ok, [english: 1.0]}
Installation
The package can be installed by adding lingua
to your list of dependencies in mix.exs
:
def deps do
[
{:lingua, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/lingua.