Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: adding to an ispell dictionary

by tall_man (Parson)
on Apr 15, 2003 at 14:38 UTC ( [id://250577]=note: print w/replies, xml ) Need Help??


in reply to adding to an ispell dictionary

The following (adapted from the man page) works for me from the command line:
use strict; use Lingua::Ispell qw( :all ); # import all symbols add_word_lc("shrdlu"); for my $r ( spellcheck( "hello hacking perl shrdlu 42" ) ) { print "$r->{'type'}: $r->{'term'}\n"; }
When I go to my home directory, I find that "shrdlu" has been added to the file .ispell_english.

I think what you will need is to specify a use_personal_dictionary, giving a file that can be written from your web browser interface, before attempting to add words.

Replies are listed 'Best First'.
Re: Re: adding to an ispell dictionary
by cbro (Pilgrim) on Apr 15, 2003 at 14:45 UTC
    And if what tall_man wrote is the only (or best) fix for you, here's a link that explains the use_dictionary, and use_personal_dictionary function.
Re: Re: adding to an ispell dictionary
by CodeJunkie (Monk) on Apr 15, 2003 at 15:03 UTC

    Ok yeah that sounds possible, i've tried running the script you have above but it doesn't add to my personal dictionary.

    The code I have is a follows

    #!/usr/bin/perl -w use strict; use Lingua::Ispell qw( :all ); # import all symbols use_personal_dictionary('.ispell_english'); add_word_lc("shrdlu"); save_dictionary(); for my $r ( spellcheck( "hello hacking perl shrdlu 42" ) ) { print "$r->{'type'}: $r->{'term'}\n"; }

    Unfortunately this does not add to the empty .ispell_english file in my home directory. Even with permissions set to chmod 666 and user: nobody, group: other (i.e. same as web server)

    Do I need to set a personal_dictionary variable in my ispell local.h file and re- 'make' the ispell installation?

    I hate this sys-admin stuff :-( Appreciate the help though thanks!

      What about using an absolute path to the personal dictionary? The user the web browser runs scripts with isn't you (it might be "apache").
        I just did a fresh install of the Lingua::Ispell module, and ran the program that tall_man provided w/out problems.
        Even when I didn't already have .ispell_english created, the program ran, gave me an error (No such file .ipsell_english), created the file, and correctly inserted the word
        Any luck finding an error logged to your apache logs?
        Chris
        Update: Never mind. I didn't see that you had fixed the problem until I increased my 'Notes' depth.

        I wish there was a way I could vote this node 10 times!!! That sorted it :-) Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://250577]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-26 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found