GithubHelp home page GithubHelp logo

isabella232 / node-cld Goto Github PK

View Code? Open in Web Editor NEW

This project forked from discord/node-cld

0.0 0.0 0.0 41.25 MB

Language detection for Javascript (Node). Based on the CLD2 (Compact Language Detector) library from Google.

License: Apache License 2.0

JavaScript 19.57% Python 1.17% C++ 79.26%

node-cld's Introduction

node-cld

Build Status Dependencies NPM version

Language detection for Javascript. Based on the CLD2 (Compact Language Detector) library from Google.

Highly optimized for space and speed. Runs about 10x faster than other libraries. Detects over 160 languages. Full test coverage. Runs on Linux, OS X, and Windows.

Installation

$ npm install cld

Linux users, make sure you have g++ >= 4.8. If this is not an option, you should be able to install node-cld 2.4.4 even with an older g++ build.

Examples

Simple

require('cld').detect('This is a language recognition example', function(err, result) {
  console.log(result);
});

Advanced

var text    = 'Това е пример за разпознаване на Български език';
var options = {
  isHTML       : false,
  languageHint : 'BULGARIAN',
  encodingHint : 'ISO_8859_5',
  tldHint      : 'bg',
  httpHint     : 'bg'
};

require('cld').detect(text, options, function(err, result) {
  console.log(result);
});

Options

isHTML

Set to true if the string contains HTML tags

languageHint

Pass a LANGUAGES key or value as a hint

encodingHint

Pass an ENCODINGS value as a hint

tldHint

Pass top level domain as a hint

httpHint

Pass an HTTP "Content-Encoding" value as a hint

Warning

Once the module has been installed, the underlying C source will remain in the deps/cld folder and continue to occupy considerable space. If you are under severe constraints you can delete this folder and reclam >100M

Copyright

Copyright 2011-2015, Blagovest Dachev.

License

Apache 2

node-cld's People

Contributors

dachev avatar darashi avatar lovell avatar aarono avatar nornagon avatar kylehg avatar anaisbetts avatar nokel81 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.