GithubHelp home page GithubHelp logo

franc's Introduction

franc

Build Status Coverage Status Code Climate

Detect the language of text.

What’s so cool about franc?

  1. franc supports more languages(†) than any other library, or Google;
  2. franc is easily forked to support 300+ languages;
  3. 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:

$ npm install franc

Component:

$ component install wooorm/franc

Bower:

$ bower install franc

Usage

var franc = require('franc');

franc('Alle menslike wesens word vry'); // "afr"
franc('এটি একটি ভাষা একক IBM স্ক্রিপ্ট'); // "ben"
franc('Alle mennesker er født frie og'); // "nno"
franc(''); // "und"

franc.all('O Brasil caiu 26 posições em');
/*
 * [
 *   [ 'por', 5507 ],
 *   [ 'glg', 6270 ],
 *   [ 'src', 6292 ],
 *   [ 'lav', 6391 ],
 *   [ 'cat', 6432 ],
 *   [ 'spa', 6481 ],
 *   [ 'bos', 6509 ],
 *   [ 'tpi', 6526 ],
 *   [ 'hrv', 6532 ],
 *   [ 'snn', 6556 ],
 *   [ 'bam', 6693 ],
 *   [ 'sco', 6695 ],
 *   ...
 * ]
 */

franc.all(''); // [ [ 'und', 1 ] ]

Note!: franc returns the "und" language code for an undetermined language. This happens when the input value is too short to give a significant answer.

Supported languages

franc supports 168 languages. For a complete list, check out Supported-Languages.md.

Other Language detection libraries

Benchmark

On a MacBook Air, it runs 169 paragraphs 2 times per second (total: 338 op/s).

         benchmarks * 169 paragraphs in different languages
  2 op/s » franc -- this module
  2 op/s » guesslanguage
  2 op/s » languagedetect
  2 op/s » vac

(I’ll work on a better benchmark soon)

License

LGPL © Titus Wormer

franc's People

Contributors

wooorm avatar jeffhuys avatar

Watchers

Navid Nikpour avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.