public
Description: Rails plugin to detect the language of a given string
Clone URL: git://github.com/porras/language_detection.git
name age message
file MIT-LICENSE Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
file README Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
file Rakefile Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
file init.rb Sun Apr 20 15:03:53 -0700 2008 Plugin initialization [porras]
file install.rb Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
directory lib/ Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
directory tasks/ Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
directory test/ Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
file uninstall.rb Sun Apr 20 12:11:13 -0700 2008 Initial import [porras]
README
= LanguageDetection Rails plugin

It adds +language+ method to String class. It uses Classifier (<tt>gem install classifier</tt>) to try to detect the 
language, based on the samples present in <tt>RAILS_ROOT/lang/<lang>/*.txt</tt>. This path is configurable:

  LanguageDetection::LanguageClassifier.samples_dir = "/another/path"

To detect the language of a string, simply use the +language+ method:

  > "hola".language
  => "es"
  > "hello".language
  => "en"
  
Remember this is a bayesian filter, so:

* Results are not bullet-proof
* And depends on the size and quality of your samples

Copyright (c) 2008 Sergio Gil, released under the MIT license