fix(core): replace the reexecute dictionary entry with re-execute - #4042
fix(core): replace the reexecute dictionary entry with re-execute#4042mauropereiira wants to merge 3 commits into
reexecute dictionary entry with re-execute#4042Conversation
`DisjointPrefixes` fires when the joined spelling is in the dictionary but the written form is not. Harper's affix system generates "reexecute" from `re` + `execute`, while the hyphenated "re-execute" is not derivable that way, so the linter told users to replace a correct spelling with a form that Collins and the OED do not list. Suppresses the suggestion when the prefix is "re", the separator is a hyphen, and the stem begins with "e". This only ever removes a suggestion, never adds one. Space-separated input, other prefixes, and non-e stems such as "re-run" and "re-open" are unchanged. Fixes Automattic#3954 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
I think an ideal fix would check all the online dictionaries for each affected word. If our dictionary generates any without hyphen that none of the pro dictionaries include, then we should stop our dictionary from generating it. We could introduce dictionary annotation flags for this but I think the number of affected words is small enough to handle one-by-one or as a special case in affected linters. (If you want to pursue this you might find my tool "dicting around" in my GitHub handy for looking up all the online professional dictionaries.) |
|
That makes a lot of sense. I revisited the change I'd made and turns out I was patching the symptom.
The others genuinely are generated, from the So I ran a test and removed just that one line, with no linter change at all: - reexecute/VSdG
That lines up with what you said about stopping the dictionary generating what the pro dictionaries don't have. It also fixes something my patch never touched. Right now Harper accepts Which makes my current patch too broad. It silences Happy to swap this PR over to the one-line deletion if you think that's the better shape. And if there are other entries like this one, I can go through them with dicting-around in the same pass. |
Yes I think that's the right approach. At some point there has been an import from Wiktionary, I'm not sure if it was from Wiktionary into Hunspell before Harper started using Hunspell, or if Harper brought in data from both Hunspell and Wiktionary before I found Harper. Note that Harper's dictionary now supports hyphenated entries, but they are limited. The spellchecker can suggest them and individual linters can look them up, but the spellchecker only works one token at a time and hyphens are separate tokens because they're ambiguous. So I would remove the current Also feel free to file bug reports or PRs against "dicting around" if you use it. The sites change their "URL magic" from time to time as well as their measures against CORS and scraping getting stronger. |
Revert the `DisjointPrefixes` special case. It suppressed the suggestion for every e-initial stem after `re`, which also silenced `re-elect`, `re-examine`, `re-enter`, `re-evaluate` and `re-establish`, whose joined spellings are attested. The actual cause is a dictionary entry. `reexecute` was an explicit entry rather than an affix-derived form, so Harper both accepted it as a spelling and offered it as the fix for `re-execute`. The OED lists `re-execute` as a verb and no professional dictionary lists `reexecute`, so the hyphenated form is the one that belongs here. Flags follow the neighbouring `re-enable/VdSG`, giving `re-executed`, `re-executes` and `re-executing`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G9k6gnF8CUtKAPo1LoLZyZ
reexecute dictionary entry with re-execute
|
Swapped over. The linter special case is fully reverted and this is now a dictionary change: -reexecute/VSdG
+re-execute/VdSGOn the flags, I followed On attestation, the reporter had already linked the OED entry for Worth noting that both halves of Behaviour:
I have not gone hunting for other entries of this kind yet. Happy to do a pass with dicting-around as a separate PR rather than growing this one, if that is useful. And thanks for the pointer to the tool. |
hippietrail
left a comment
There was a problem hiding this comment.
This looks ready to merge IMHO. Thanks!
Issues
Fixes #3954
Description
Reworked after review. The original version of this PR special-cased
DisjointPrefixes; that was patching the symptom, and it silenced far more than it should have. This is now a dictionary change.reexecutewas an explicit entry indictionary.dict, not an affix-derived form:That single entry caused both halves of the bug. Harper accepted
reexecuteas a correct spelling, andDisjointPrefixesoffered it as the replacement forre-execute.The reporter linked the OED entry for
re-execute, and no professional dictionary lists the closed spelling, so the hyphenated form is the one that belongs in the dictionary:Flags follow the neighbouring
re-enable/VdSG, which givesre-executed,re-executesandre-executing. The entry is placed with the otherre-hyphenated entries, afterre-enslavement.Both halves of
DisjointPrefixesnow decline independently.contains_word_str("re-execute")is true, so it returns early on the original form; and even past that point,joined_validis false becausereexecuteis gone.The linter special case is fully reverted.
re-elect,re-examine,re-enter,re-evaluateandre-establishkeep their current behaviour, which is what the review asked for, since those joined spellings are attested.Demo
How Has This Been Tested?
cargo test -p harper-coreharper-cli audit-dictionary harper-corereports nothing,cargo fmtis clean, and no files underharper-core/tests/text/change.AI Disclosure
If Your PR Implements or Enhances a Linter
The single test uses the reporter's own wording from the issue. The demo sentences above are mine, used to check the surrounding class rather than as test cases.
Checklist