Skip to content

Add Dictionary::remove_stem#11

Merged
the-mikedavis merged 4 commits intomasterfrom
remove_stem
Dec 27, 2025
Merged

Add Dictionary::remove_stem#11
the-mikedavis merged 4 commits intomasterfrom
remove_stem

Conversation

@the-mikedavis
Copy link
Member

@the-mikedavis the-mikedavis commented Dec 18, 2025

Fixes #10

This is the same as Hunspell::remove: it acts on stems rather than full words. (See the doctest for a nice example.) That behavior is a little bit unintuitive so I'm using a slightly more specific name for the function.

TODO: how does this interact with Dictionary::add? Do we need to remove the forbidden_word_flag when adding back a word which was removed? Edit: looks like Hunspell does some extra handling which spellbook does not in add which we could adopt. But that can be done later

Hunspell defaults this flag to 65510 so that words can be marked as
forbidden even if the dictionary does not set a `FORBIDDENWORD` flag
explicitly. So instead of an `Option<Flag>` this is a `Flag`.

This includes a logic change in the suggester to eliminate a check that
the forbidden_word_flag is Some. Because of the non-zero default in
Hunspell this branch is always `true` and can be removed.
This is the same as `Hunspell::remove`: the given stem is marked with
the FORBIDDENWORD flag if it is not already.
@the-mikedavis the-mikedavis self-assigned this Dec 18, 2025
@the-mikedavis the-mikedavis merged commit 0fa2e22 into master Dec 27, 2025
4 checks passed
@the-mikedavis the-mikedavis deleted the remove_stem branch December 27, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request: add remove method to Dictionary.

1 participant

Comments