Code Monkey home page Code Monkey logo

jlangdetect's Introduction

JLangDetect

Build Status

A language detection library for the JVM.

How to use it ?

The simplest way to use JLangDetect is to use the UberLanguageDetector singleton, available in the jlangdetect-extra module :

import  me.champeau.ld.UberLanguageDetector;
UberLanguageDetector detector = UberLanguageDetector.getInstance();

// ..

String language = detector.detectLang("ceci est un petit texte en français");

Alternatively, if you don’t need to detect russian, chinese, japanese or korean languages, you can use the EuroparlDetector available in the jlangdetect-europarl module. Note that you can still create your own language detector and register custom languages using the core module.

Maven integration

JLangDetect is now available through Maven. To use it, you can add the following repository into your pom.xml file :

<repository>
  <id>jlangdetect-googlecode</id>
  <name>JLangDetect Maven repository</name>
  <url>https://jlangdetect.googlecode.com/svn/repo</url>
<repository>

Then use the following dependency :

<dependency>
  <groupId>me.champeau.jlangdetect</groupId>
  <artifactId>jlangdetect-extra</artifactId>
  <version>0.4</version>
</dependency>

Use from Groovy

As a last integration example, here is how to use it from Groovy, through a simple script :

@GrabResolver('https://jlangdetect.googlecode.com/svn/repo')
@Grab('me.champeau.jlangdetect:jlangdetect-extra:0.4')
import me.champeau.ld.UberLanguageDetector as ULD

ULD.instance.with {
  assert detectLang('ceci est un petit texte en français') == 'fr'
  assert detectLang('this is a text in english') == 'en'
}

jlangdetect's People

Contributors

melix avatar

Watchers

James Cloos avatar Michał Woś 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.