[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [aspell-devel] Re: Can I get "edit distance" for the suggestions?

From: Kevin Atkinson
Subject: Re: [aspell-devel] Re: Can I get "edit distance" for the suggestions?
Date: Mon, 1 May 2006 23:55:29 -0600 (MDT)

All the various indirection in the data structures confuses me, though I
think I've settled in to a proposal for the internal architecture.

(1) I leave the SuggestionList and SuggestionEnumeration virtual.
(2) In suggest.cpp, I rename the SuggestionList class to SuggestList (so
not to collide with the new acommon::SuggestionList).
(3) I add a vector of Suggestions to SuggestionListImpl (renamed
SuggestListImpl), parallel to the vector of Strings in the field
"suggestions"; I can call it "scored_suggestions".
(4) When Speller->suggest is called, it calculates scored_suggestions,
copies that into suggestions and continues as now.
(5) I create a derived class of (new) SuggestionList in suggest.cppwhich
contains SuggestListImpl, called SuggestionListImpl.
(6) Its elements() call returns a SuggestionEnumeration pointing to the
new scored_suggestions field of its SuggestionListImpl.
    -- I hope this can use MakeEnumeration from enumeration.hpp.
(7) A new method in Speller (maybe "scored_suggest") returns a new
SuggestionList initialized with code common to the existing suggest

An option is to store only the vector of Suggestion and make the
which returns string suggestions know about the Suggestion structure,
extracting the string it needs from that.  I don't favor that because
extra work and doesn't save much space.

I'm not sure I 100% understand.  Please show me some what the interface
will look like so I can have a better understanding of what you propose.

At the interface level, a dialog will look something like this, matching (as
far as I understand it) what you asked for:

    AspellSuggestionList * suggestions =
                                                          word, size);
    AspellSuggestionEnumeration * elements =
    while (!aspell_string_enumeration_atend(aspell_elements))
      AspellSuggestion sug =
      // Use sug...

Ok that looks good. AspellSuggestion should proabaly be a const pointer rather than an object.

At a lower level, I'm planning to add memory for an extra vector of
Suggestion in the class that aspell_speller_suggestion returns (which will
also be the main part of the class that aspell_speller_scored_suggest

reply via email to

[Prev in Thread] Current Thread [Next in Thread]