Hi Kevin
We've been using aspell for just over a year using a similar method to the one you've outlined. The command line I've been using to build the custom dictionary (on a Windows box) is:
aspell.exe --lang=en_GB create master ./title.list < titlewords.txt
...where "titlewords.txt" is a file containing the unique words from the item titles (with each word on a separate line) and "title.list" is the dictionary file that gets created.
Unfortunately I did our implementation in mod_perl, so I'm not sure how you go about getting PHP to pick up a custom dictionary. Anyway, using the Perl Text::Aspell module, our code contains:
my $speller = Text::Aspell->new;
$speller->set_option('sug-mode','ultra');
$speller->set_option('master','/Apache2/modperl/HIP/title.list');
....
my @suggestions = $speller->suggest( $word );
If you want to see it in action, try these:
http://library.hud.ac.uk/catlink/title/newmonia <http://library.hud.ac.uk/catlink/title/newmonia>
http://library.hud.ac.uk/catlink/author/newmonia <http://library.hud.ac.uk/catlink/author/newmonia>
http://library.hud.ac.uk/catlink/title/gibberish <http://library.hud.ac.uk/catlink/title/gibberish>
...also, be aware that using your own custom dictionaries might highlight the typos in some of your MARC records!
http://library.hud.ac.uk/catlink/general/suckcesful <http://library.hud.ac.uk/catlink/general/suckcesful>
regards
Dave Pattern
University of Huddersfield
________________________________
From: Code for Libraries on behalf of Kevin Kierans
Sent: Tue 4/3/2007 5:40 PM
To: [log in to unmask]
Subject: [CODE4LIB] pspell aspell: make your own word lists/dictionaries
Has anyone created their own "dictionaries"
for aspell? We've created blank delimited
lists of words from our opac. One for title,
one for subjects, and one for authors. (We're thinking
of a series one as well)
We would like to use
one of these word lists to offer suggestions
depending on which search the patron is making.
We're assuming we can make better suggestions
if the words come from our actual opac.
We've got it working with the dictionary that
comes with aspell, but having problems (we can't do it!)
substituting our own "dictionaries."
Does anyone have any experience/knowledge/hints/pointers
they can share with us?
We are using linux, php 5, aspell 0.50.5, and
php -> pspell functions.
Thanks,
Kevin
TNRD Library System, Kamloops, British Columbia, Canada
This transmission is confidential and may be legally privileged. If you receive it in error, please notify us immediately by e-mail and remove it from your system. If the content of this e-mail does not relate to the business of the University of Huddersfield, then we do not endorse it and will accept no liability.
|