Adding a dictionary to Aspell/Pspell

6.6k Views Asked by At

I have Aspell successfully installed and have compiled PHP with Pspell, and everything seems to be working fine.

The only thing I am unable to do, is create a list of "ignore" words, or a personal dictionary, however you want to refer to it.

I've tried the steps outlined here and here but neither had any effect.

As described at the above link and on the Aspell documentation, I tried creating a personal dictionary as outlined in the manual:

personal_ws-1.1 en 0
Rubiflex
quasirhombicosidodecahedron

I placed this in the aspell directory, my home directory, the root directory, and it was never picked up. The Aspell documentation never actually says where it should live or how to otherwise load it.

The other reference is to creating an individual word list:

Create a txt file with the words that you'd like to add to the dictionary, where each word is on a separate line then run the following command:

 aspell --lang=en create master ./custom.rws < test.txt

This will create a file called custom.rws that will contain the aspell encoded word(s) for the dictionary. You can name the file anything you want as long as the extension is .rws. Now to add this to the dictionary move the custom.rws file to the dictionary location which is /usr/lib/aspell by running the following command:

cp custom.rws /usr/lib/aspell/

To finish adding it to the dictionary change into the dictionary directory by running the following:

 cd /usr/lib/aspell/
 then edit the following file: nano en_US.multi

and add the following line:

add custom.rws

Neither of these methods seemed to work and I cannot find any clear examples of how to properly add a dictionary or word list. These were the two most promising methods I was able to find and neither worked. Does anyone know how I can get Aspell to use a personal dictionary file I create?

Thank you for your time.

EDIT: The steps outlined here worked for me. The are much like the ones outlined here except that the latter refers to "en_US.multi" where the former refers to "en.multi". After adding the custom list to en.multi (as opposed to en_US.multi), it was working as expected.

3

There are 3 best solutions below

0
On

Using the aspell version below with Cygwin:

International Ispell Version 3.1.20 (but really Aspell 0.60.6.1)

it was looking for a personal dictionary named .aspell.en.pws in my home directory, regardless of what I specified on the command line with the --personal option. I was able to place a symbolic link named .aspell.en.pws in my home directory and let it point to a different location on my file system. I had to create the file first and add the required header before aspell would start adding to my personal dictionary.

In short, you can do this:

echo "personal_ws-1.1 en" > ~/my/file/location.pws
ln -s ~/my/file/location.pws ~/.aspell.en.pws
0
On

I was able to add a personal dictonary using option --add-extra-dicts to aspell call

aspell -c --add-extra-dicts=./custom.rws my_text_to_spell_check.txt

custom.rws has been created as depicted by OP:

aspell --encoding=UTF-8 --lang=<lang> create master ./custom.rws < test.txt

And remember to add --encoding opton to match the correct encoding for your source file.

I Hope this can help someone!

0
On

For my latest work onto the Perl's Text::Aspell module and code to determine the mother language of a Web visitor querying a company's search engine, I came across some of the pitfalls you describe (personal dictionary not implemented in Aspell6). However I worked it around using the 'extra-dicts' notion, one for each possible language.

I also had to workaround the fact that Aspell owns no dictionary for the Arabic, Hebrew, Japanese, Chinese and Korean languages. These languages are dealt with specifically.

You may view the full latest Perl's and bash codes for Linux and Windows running Windows/MinGW at http://vouters.dyndns.org/tima/Linux-Windows-Perl-Aspell-Determining_the_country_of_a_Web_query.html. You may use the URL links in the REFERENCES section of the document to adjust some of the Perl's code notions to PHP.