Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for lazy word generation #92

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add support for lazy word generation #92

wants to merge 2 commits into from

Conversation

tgross35
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Nov 25, 2023

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (0e1f7c0) 77.19% compared to head (fc3fa0e) 77.04%.

Files Patch % Lines
zspell/src/dict/rule.rs 57.14% 12 Missing ⚠️
zspell/src/dict/tests_rule.rs 94.44% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
- Coverage   77.19%   77.04%   -0.16%     
==========================================
  Files          27       27              
  Lines        3464     3502      +38     
==========================================
+ Hits         2674     2698      +24     
- Misses        790      804      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tgross35
Copy link
Contributor Author

I need to take a look at how hunspell does this - we need a way to take the rules and apply them to only entries in the hashmap that were from the dictionary.

Maybe we should iterate hashmap for entries that have Dictionary as source. Then we could change Source::Dict to also hold the Vec<Arc<AfxRule>> of the rules attached to that entry. Then we find these entries and test if our given word matches.

@tgross35
Copy link
Contributor Author

Hm. Maybe it would be more efficient if instead we stored a vector or hashset of all AffixRules. Then we iterate those rules and apply them, and see if the word exists in the

We might even be able to optimize this if we store it in a vector, dedup it. Then if we sort it by something useful, we could use a binary search to locate applicable rules.

As part of this, it could make sense to reverse AfxRulePattern and AfxRule so patterns point to rules rather than the other way around. Or a bidirectional reference where AfxRulePattern holds Arc<AfxRule> and AfxRule holds a Vec<Weak<AfxRulePattern>>. Or just store the needed data inline, AfxRule doesn't store much aside from the patterns.

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.

1 participant