franc / 0.7.1 last updated 5 days ago created on Jul 19th 2014
Install
npm install --save franc
Clone
git clone git@github.com:wooorm/franc.git
dependencies
| main |
|
trigram-utils | 0.1.1 | MIT |
maintainers
versions
19 total
| 0.7.1 | 5 days ago | wooorm |
| 0.7.0 | a month ago | wooorm |
| 0.6.2 | a month ago | wooorm |
| 0.6.1 | 2 months ago | wooorm |
| 0.6.0 | 2 months ago | wooorm |
| 0.5.1 | 2 months ago | wooorm |
| 0.5.0 | 2 months ago | wooorm |
| 0.4.1 | 2 months ago | wooorm |
| 0.4.0 | 3 months ago | wooorm |
| 0.3.0 | 3 months ago | wooorm |
| 0.2.3 | 3 months ago | wooorm |
| 0.2.2 | 3 months ago | wooorm |
| 0.2.1 | 3 months ago | wooorm |
| 0.2.0 | 3 months ago | wooorm |
| 0.2.0-rc.2 | 4 months ago | wooorm |
| 0.2.0-rc.1 | 4 months ago | wooorm |
| 0.1.1 | 4 months ago | wooorm |
| 0.1.0 | 6 months ago | wooorm |
| 0.0.1 | 6 months ago | wooorm |
readme
Detect the language of text.
What’s so cool about franc?
- franc supports more languages(†) than any other library, or Google;
- franc is easily forked to support 335 languages;
- franc is just as fast as the competition.
† - If humans write in the language, on the web, and the language has more than one million speakers, franc detects it.
Installation
npm:
Duo:
Browser globals (info):
Usage
CLI
Install:
Use:
Supported languages
franc supports 175 “languages”. For a complete list, check out Supported-Languages.md.
Supporting more or less languages
Supporting more or less languages is easy: fork the project and run the following:
The above would create a version of franc with support for any language with 100,000 or more speakers. To support all languages, even dead ones like Latin, specify -1.
Browser
I’ve compiled three versions of franc for use in the browser. They’re UMD compliant: they work with AMD, CommonJS, and <script>s.
- dist/franc.js — franc with support for languages with 8 million or more speakers (75 languages);
- dist/franc-most.js — franc with support for languages with 1 million or more speakers (175 languages, the same as the Node or Component version);
- dist/franc-all.js — franc with support for all languages (335 languages, carful, huge!).
Benchmark
On a MacBook Air, it runs 175 paragraphs 2 times per second (total: 350 op/s).
(I’ll work on a better benchmark soon)
Derivation
Franc is a derivative work from guess-language (Python, LGPL), guesslanguage (C++, LGPL), and Language::Guess (Perl, GPL). Their creators granted me the rights to distribute franc under the MIT license: respectively, Maciej Ceglowski, Jacob R. Rideout, and Kent S. Johnson.