Approximate string matching in Ruby - ruby

I am implementing user search functionality in my Rails application. I want the application to suggest the correct spellings if the user makes a mistake in typing the spelling. Is there any plugin for this in ruby. Can this be done in sql?
Regards,
Pankaj

It looks like hunspell gem is there to help you. It requires some external dependencies so it's not pure Ruby. But according to this readme it seem to be exactly what you are looking for.
Alternatively, you can try BOSSMan. It looks like it spell checks via Yahoo.

Related

Implementing Driver Ruby

This may seem like a dumb question but I cannot seem to find an answer anywhere. I ran into this Gem and it is asking to implement a driver. How would one go abouts doing that? Here is the git link
https://github.com/ozfortress/tournament-system
Again sorry for the dumb question.
You copy-paste the driver scaffold provided by the gem author somewhere into your project’s tree and implement all the empty functions needed by the gem to actually know about your game of choice.
The easiest way would be to take a test driver implemented by the gem author for tests for inspiration.

Sphinx alternative without Rails

I need an indexing and searching gem like Sphinx but without needing Rails Any suggestions ? It has to run under Ruby 1.9.3 on a windows box. Tried Sphinx without rails but it needs MySql and a lot of configuration, diddn't succeed. Can you recommend something that uses a build in db or feature like Sqlite ?
While certain plugins (like thinking_sphinx) are Rails-specific, Sphinx itself is just a search server, and you can use the client gem directly to index and search whatever you want; it need not be in ActiveRecord (which, incidentally, you could also use outside of Rails if you wished).
Another alternative is Apache Solr, which provides similar functionality to Sphinx, including a sophisticated search system (supporting stemming and lots of other nice things).
Although Sphinx itself works regardless of whether you use Rails or not, if you're having difficulties with it, you can always try something like Solr or Elastic Search. I heard good things about the latter and it is quite trivial to get to run on Windows, as you seem to be.
Another alternative for sphinx,solr is OpenSearchServer . A search engine based on lucene. And it has a good windows support. Have a look at the documentation here how to install in windows.You can use the API to integrate in Ruby.

Extend RedCloth via Redmine plugin?

I'm new to Ruby/Redmine/Redcloth but I'm trying to achieve the following:
The default way to build a link in Textile is "foo":http://bar. However, 90% of the day I use Atlassian products, which use [foo|http://bar] as link markup.
To keep everything a bit uniform I'd like to implement this in Redmine via a plugin. However, it appears that you can't change the macro syntax so instead I'll have to look into extending RedCloth to accept this form of inserting links.
Does anyone know how I can achieve this?
Thank you and merry christmas,
Dennis
You might consider switching to one of the two Markdown plugins (one is Markdown Extra-like, based on Bluefeather), which are a bit more similar in link style, although not the same as what you are used to. Since you use SO, though, you're obviously familiar with it.
Otherwise you'd have to write a full plugin, for which either of the plugins I've mentioned would serve as a good model. Best of luck.

Ruby web spider & search engine library

I'm looking for a Ruby library or gem (or set of gems) which will not only do spidering, but also collect the data into, say, a database, and allow basic searches on the data (i.e. a typical web search).
I've found several spidering libraries, so that part seems well covered (I was going to try Anemone first), but I can't find anything that will take the spidered data and allow querying on it. For lack of an existing one, I was going to write something myself with Anemone.
Any suggestions?
That blog post might give you some pointers. Also, look into ferret for the search part.
there is a ruby gem may help you:
http://spidr.rubyforge.org/
There are lots of great stuff on github.com

Documentation how to

How do I best navigate the core docs? What are others doing when curious about what methods are available on standard classes?
This other SO question is the same, but the accepted answer isn't cutting it for me.
I was trying
f = File.open("some-file.txt","w+")
and then wanted to check what methods I have available on f after this. I tried the following:
ri File.open -> Nothing known about File.open
The core docs tells that File at least doesn't define "open". But the page doesn't mention which modules File mixes in, or inherits from. So I wrote a script:
p File.open("foo.txt", "w+").methods
But this seems quite inefficient (not to mention a raw list of methods isn't the best documentation).
I used pickaxe. It wasn't the be all and end all, but it was pretty decent.
Now I guess it would have to be http://ruby-doc.org
You can just do ri File and it will give you full info on the File class (including the methods it implements and its superclass) or ri open (which will tell you all the places open is implemented if there are several).
You can access the documentation on your system from a browser. This details how to set it up.
Honestly, I usually just go to google and enter "Ruby [method name]" and what I want is almost always in the top three results. If it's not, I fall back to rubybrain.
I use http://apidock.com/ruby for Ruby documentation and the site also features Rails and RSpec documentation.
I found Fxri is useful when you want to browse what method is avaiable for certain object.
It is default in Ruby windows install package.
https://rubygems.org/gems/fxri/

Resources