Re: clear_session, store_replacement, and support

Bill Moseley <[email protected]>
Newsgroups gmane.comp.gnu.aspell.devel
Message-ID <[email protected]>
Thanks for the reply, Gary:

On Fri, Jul 29, 2005 at 08:35:24AM -0500, Gary Setter wrote:
> ___POINT 1___
> The function seems to be in error. Take a look at the
> implmentation of store_replacement.
> 
>   PosibErr<void> SpellerImpl::store_replacement(const String &
> mis,
>                                                 const String &
> cor,
>                                                 bool memory)
> 
> It returns a void, not a bool. There is no data returned.

Is the API *suppose* to return a value?  And if false should the
error number and error message be available with aspell_speller_error_number
and aspell_speller_error_message?  That's what I'm not clear on.


> ___POINT 2___
> Maybe someone else can quickly reproduce the problem, but if your
> need someone to investigate, I'm willing as long as you show me
> how to reproduce the problem. I have perl, but I don't have the
> perl to aspell interface. I don't know what you're talking about
> when you say "running "make test" on the Perl module". I don't
> know the functions session functions either, but I'm willing to
> learn :-).

Again, I'd like to first make sure that I'm using clear_session
correctly and I understand the Aspell usage correctly.

Perl modules are built like this:

    $ perl Makefile.PL    (creates a Makefile)
    $ make
    $ make test  ( runs test scripts in the "t" directory)

The tests are run via a standard perl module that looks simply for
"ok" and "not ok" output from the script for each of its tests.

To get verbose output from running "make test" you do:

    $ make test TEST_VERBOSE=1

and you see output from each test.

I'll attach the Perl module for you to try.  I may or may not fail
tests on your machine.

The tests in question do this:


    ok( $speller->add_to_session('testt'), "add 'testtt' to the aspell session") or
        diag( 'Error: ' . $speller->errstr );

    @s_words = $speller->suggest('testt');
    ok( grep(/testt/, @s_words), "'testtt' added to session now is returned in suggest" );

then later the session is cleared and I check that "testt' is no
longer in the words suggested:

    ok_to_fail( $speller->clear_session, 'Clear the aspell session' ) or
        diag("clear_session may fail like store_replacement.  See README" );


    @s_words = $speller->suggest('testt');
    ok( !grep(/testt/, @s_words), "'testt' should not be a suggestion after clearing the session'")
        or diag( "suggested words were [@s_words]" );

Notice that it's negating the grep (so it's making sure "testt" isn't
in @s_words).


Again, I want to be clear about the API -- I want to make sure I'm
testing return values for every function that returns a value
indicating an error.

What seems to be happening is that I may be testing return values
when I should not be testing them, or maybe Aspell is not returning
them correctly when it should -- as you saw from the
store_replacement() problem above.  The problem is not consistent
(fails for some users, others it doesn't).


Thanks,


PS -- one other question:  I require the en_US dictionary installed
for testing.  Of course, not everyone has that dictionary, but I'm
not sure how I can test Aspell without knowing a specific dictionary
is installed -- I want to make sure I can lookup mispelled words, so
seems like I need a specific dictionary to do that.  If you or anyone
has a better idea I'd like to hear.  Also, I'm not 100% clear how to
verify that the dictionary I need is installed -- but I haven't
looked at that yet.




-- 
Bill Moseley
[email protected]

_______________________________________________
Aspell-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/aspell-devel
Text-Aspell-0.05.tar.gz (application/octet-stream, 12.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.