feat: multi-word dictionary entries
There are some cases where you want a spelling to be valid only in a certain context, for instance a title in a foreign language.
For instance, one document I have contains the term Dao De Ching, but it is considered a misspelling. I want these words only to be considered correct when they occur in the complete title. So, for instance De Ching would be considered incorrect, but Dao De Ching would be correct.
I tried adding the complete title to the file dictionary, but this didn't work.
I've been adding multi-word entries to the curated dictionary for a while and those changes were recently accepted. (I think #902 is the main one.) They're in their own section near the bottom in case we decide to break them out into another file, use different annotations for them, remove them all for some reason, or whatever else. It includes space-separated and hyphen-separated lexemes.
For now they are not used in spellchecking for deciding if words are correctly spelled or not. But they are used when the spellchecker suggests corrections.
I've also used them as part of heuristics in some of my linters.
As an aside to this, certain names get flagged even when they're in the dictionary. The Hebrew name Ben-ammi springs to mind here. Even if a spellchecker has the name "Ben-ammi" in its dictionary, most spellcheckers flag "ammi" as incorrect because their tokenizers split the word on the hyphen and test, rather than first checking the compound for validity. Harper appears to have the same issue (at least in Obsidian).
Yes Harper does split words at whitespace and hyphens. Hyphens are ambiguous and are used for various things besides joining parts of compound words together.
That's why it doesn't handle hyphenated words like other words. But it doesn't mean Harper shouldn't handle both. I feel it should handle compound words separated by hyphens or spaces.
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 14 days. Thank you for your contribution!
@elijah-potter I think I somehow accidentally made this blocked by #1450 instead of this blocking #1450 - looks like I can't edit it to fix it but I'm assuming you can.