tags:

views:

164

answers:

2

I'm building a "did you mean" funcionality on an internal search engine, using aspell and php (php-pspell).

I have a catalog of products and I want the names of those products to be also words in the dictionary so the "did you mean" can suggest'em.

The problem is that when I try to create a custom dictionary with PHP Pspell functions, I receive errors when the words contain characters that are not in the a-z range, as numbers, hifens, etc.

For example:

iphone 3gs: iphone is added smoothly, but 3gs isn't

blu-ray: can't be added due to the -

Is it possible to add that kind of word in a dictionary? Or aspell just don't accept them?

A: 

You may want to check out http://www.php.net/manual/en/function.pspell-add-to-session.php

More reference is here http://php.net/manual/en/ref.pspell.php

Hope that helps!

Lizard
I've being using pspell_add_to_personal() and it seems to be quite similar, and in the comments of pspell-add-to-session there's also someone complaining about hyphens :-)
Felipe Ribeiro
A: 

The best way to do this is replace the special characters including white space with some key sequence. say xxx. You will have to do that for all characters outside the ones aspell accepts.

Jithin