Module: Ultrasphinx::Spell
- Defined in:
- lib/ultrasphinx/spell.rb
Overview
Spelling support
In order to spellcheck your user’s query, Ultrasphinx bundles a small spelling module. First, make sure Aspell 0.6, an appropriate Aspell dictionary, and the Rubygem ‘raspell’ are all installed.
Then, copy examples/app.multi
into your Aspell dictionary folder. It allows you to use Sphinx to generate a custom wordlist for your app. Modify it if you don’t want to also use the default American English dictionary.
Then, to build the custom wordlist, run:
rake ultrasphinx:spelling:build
Now you can see if a query is correctly spelled as so:
@correction = Ultrasphinx::Spell.correct(@search.query)
If @correction is not nil, go ahead and suggest it to the user. Otherwise, the query was already correct.
Constant Summary collapse
- SP =
Aspell.new("app")