Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/g-corp/efranc
Detect the language of text
https://github.com/g-corp/efranc
elixir erlang language ngrams
Last synced: 2 months ago
JSON representation
Detect the language of text
- Host: GitHub
- URL: https://github.com/g-corp/efranc
- Owner: G-Corp
- Created: 2017-05-31T21:55:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-29T17:41:17.000Z (over 7 years ago)
- Last Synced: 2024-09-18T11:51:44.690Z (3 months ago)
- Topics: elixir, erlang, language, ngrams
- Language: Erlang
- Size: 1.14 MB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# efranc : Detect the language of text. #
Copyright (c) 2017 G-Corp
__Version:__ 0.0.1
__Authors:__ Gregoire Lejeune ([`[email protected]`](mailto:[email protected])).
[![Build Status](https://travis-ci.org/G-Corp/efranc.svg?branch=master)](https://travis-ci.org/G-Corp/efranc)
### 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 ] [-b ] [-m ] [-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](https://github.com/wooorm/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
Copyright (c) 2014 Titus Wormer <[email protected]>
Copyright (c) 2008 Kent S Johnson
Copyright (c) 2006 Jacob R Rideout <[email protected]>
Copyright (c) 2004 Maciej CeglowskiRedistribution 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 ##