Wrong English is an often problem while developing any website product asit gives bad view to website user and thus does direct impact on product.BOSSMan is a ruby gem that interacts with yahoo web service and provides asimplest way to overcome such errors.
Installation:gem sources -a http://gems.github.comgem install jpignata-bossman
Apply and get Application ID from yahoo developer networkURl https://developer.apps.yahoo.com/
Make sure to note it for reference
Usage in ruby apprequire 'rubygems'require 'bossman'include BOSSManBOSSMan.application_id = "Your Application ID here"
Spelling Suggestionstext = BOSSMan::Search.spelling("gooogle")=> #{"resultset_spell"=>[{"suggestion"=>"google"}], "responsecode"=>"200", "deephits"=>"1", "start"=>"0", "count"=>"1", "totalhits"=>"1"}}>text.suggestion => "google"
More sophisticated way of use –
1. Create a YML file containing list of kewords
2. Load YML file
3. Iterate YML hash to find out spell suggestions
Example: spelling.yml
1 keywords: 2 gooogle: 3 Barack Oabama: 4 Indian: 5 Latuur:keywords = YAML.load_file('spelling.yml')['keywords'].keys puts "Correction suggested" keywords.each do |keyword| text = BOSSMan::Search.spelling(keyword) if defined? text.suggestion puts "#{keyword} => #{text.suggestion}" end end
Output
Correction suggestedgooogle => googleBarack Oabama => Barack ObamaLatuur => Latour
Analyze suggestions manually and make neccesary corrections..