feedbackmine / language_detector Goto Github PK
View Code? Open in Web Editor NEWruby language detection library using n-gram
Home Page: http://HelpdeskOnTwitter.com
ruby language detection library using n-gram
Home Page: http://HelpdeskOnTwitter.com
== Welcome This is a n-gram based language detector, written in ruby. For technical details about language detection, I recommend this paper: http://www.sfs.uni-tuebingen.de/iscl/Theses/kranig.pdf == Installation sudo gem sources -a http://gems.github.com (you only have to do this once) sudo gem install feedbackmine-language_detector == Usage require 'language_detector' d = LanguageDetector.new p d.detect('this text is in English') == Thanks Kevin Burton (http://feedblog.org/2005/08/19/ngram-language-categorization-source/ ). I used all the training data in his ngramcat project. == Follow us on twitter http://twitter.com/feedbackmine
With ruby 2.0.0-p247 I've the follow error:
2.0.0p247 :001 > require 'language_detector'
=> true
2.0.0p247 :002 > d = LanguageDetector.new
Psych::SyntaxError: (/Users/pioz/.rvm/gems/ruby-2.0.0-p247/gems/language_detector-0.1.0/lib/model-tc.yml): did not find expected key while parsing a block mapping at line 5 column 5
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:153:in `parse'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:129:in `load'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:299:in `block in load_file'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:299:in `open'
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/psych.rb:299:in `load_file'
from /Users/pioz/.rvm/gems/ruby-2.0.0-p247/gems/language_detector-0.1.0/lib/language_detector.rb:141:in `load_model'
from /Users/pioz/.rvm/gems/ruby-2.0.0-p247/gems/language_detector-0.1.0/lib/language_detector.rb:14:in `initialize'
from (irb):2:in `new'
from (irb):2
from /Users/pioz/.rvm/rubies/ruby-2.0.0-p247/bin/irb:12:in `<main>'
2.0.0p247 :003 >
I use this library to detect the language of Tweets. It's not perfect, but does pretty well given it only has 140 characters to work with.
My Spanish users complain that quite often Portuguese tweets get identified as Spanish Tweets. One of them said that the letter ç only belongs to Portuguese. ã and ê may also be used to further differentiate.
The gem feedbackmine-language_detector on http://gems.github.com does not include the "Ruby >= 1.9 doesn't have jcode" bugfix.
Can you please update the gem based on the latest github source?
Thanks,
A.
Where is the source text dataset for the Ngrams of those 96 languages? Would like to see if it is different from wooorm/franc#78 usage of UDHR, and if it is more accurate than them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.