Rails plugin to detect the language of a given string
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

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