Re: Using aspell programmatically

Kevin Atkinson <[email protected]> Sat, 8 May 2010 16:53:59 -0600 (MDT)
Newsgroups gmane.comp.gnu.aspell.user
Message-ID <[email protected]>
On Sat, 8 May 2010, John P. Hartmann wrote:

> On 8 May 2010 00:20, Kevin Atkinson <[email protected]> wrote:
>> use them unless you use the C ABI.  Basically if you add "foo-bar" and then
>> have "foo-bar" in a document Aspell will still check for "foo" and "bar" and
>> never "foo-bar", but if you use the aspell_speller_check or
>> aspell_speller_suggest things will work as expected.
>
> Right, I am using the C API.   And I guess I did as you describe
> simply by ignoring hyphens.  But when I add a hyphenated word by
> aspell_speller_add_to_personal, I get this error
>
> The word "built-in" is invalid. The character '-' (U+2D) may not
> appear in the middle of a word.

Did you try setting validate-words to false.  You can do this via the C 
API.

>>> About pushing/popping private word lists:
>>
>> You lost me.
>
> Can't have that!
>
> A script file (as they are called) can imbed other files that can
> imbed yet other files and so on.
>
> For each imbedded script file, I can have an addenda file that
> contains words that are considered valid within the script file, but
> not elsewhere.  Macro keywords, for example.
>
> Thus, I would like to add a number of words to the personal list for
> the duration of an imbedded file and then remove them again.  If there
> were an opposite to aspell_speller_add_to_personal, I could run the
> words through that, but there isn't.  A push/pop facility seems to be
> what supports my requirement best.  That is, words added after a push
> are all removed by the matching pop.

Some hints:

   The aspell core should be able to handle this but I'm not sure I expose
   enough of the internals to be able to do this.  You can always
   interface directly with Aspell using its native C++ API.  But I offer
   absolutely no guarantee that I won't break you code between releases.

   Aspell can only have 1 personal dictionary, but additional dictionaries
   can be loaded bu using the add-extra-dicts option.

   You might want to look into using the session dictionary which you can
   clear by using aspell_speller_clear_session.

_______________________________________________
Aspell-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/aspell-user