efranc

Detect the language of text


Keywords
elixir, erlang, language, ngrams
License
BSD-3-Clause-Attribution

Documentation

efranc : Detect the language of text.

Copyright (c) 2017 G-Corp

Version: 0.0.1

Authors: Gregoire Lejeune (gregoire.lejeune@gmail.com).

Build Status

API

DATA TYPES

options() = #{whitelist => whitelist(), blacklist => blacklist(), min_length => integer()}

whitelist() = [code()]

blacklist() = [code()]

code() = string()

iso6393() = #{code => string(), part_2b => string(), part_2t => string(), part_1 => string(), scope => individual | macrolanguage | special, type => ancient | constructed | extinct | historical | living | special, ref => string(), comment => string()}

EXPORTS

efranc:detect(Text, Options) -> Lang

Types:

Text = string()
Options = options()
Lang = code() | iso6393()

detect/2 return the detected language for the Text or undefined.

efranc:detect(Text) -> Lang

Equivalent to efranc:detect(Text, #{})

efranc:detect_all(Text, Options) -> [{Lang, Weight}]

Types:

Text = string()
Options = options()
Lang = code() | iso6393()
Weight = float()

detect_all/2 return the list of possible detected language for the Text or undefined.

efranc:detect_all(Text) -> [{Lang, Weight}]

Equivalent to efranc:detect_all(Text, #{})

Command line tool

Build:


make script

Use :


./_build/escriptize/bin/efranc -h
Usage: efranc [-w <whitelist>] [-b <blacklist>] [-m <min_size>] [-h]

  -w, --whitelist  Whitelist
  -b, --blacklist  Blacklist
  -m, --min_size   Minimum size
  -h, --help       Display this help

Example :


./_build/escriptize/bin/efranc "Bonjour tout le monde, ceci est un example d'utilisation d'efranc en ligne de commande ! Enjoy ;)"
fra | Bonjour tout le monde, ceci est un example d'utilisation d'efranc en ligne de...

Derivation

eFranc is a port to Elang of franc.

Licence

efranc is available for use under the following license, commonly known as the 3-clause (or "modified") BSD license:

Copyright (c) 2017 G-Corp

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Modules

efranc
efranc_lang