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 option to only spellcheck parts of hyphenated words, not the entire word #16

Open
tbroadley opened this issue Jan 1, 2018 · 13 comments

Comments

@tbroadley
Copy link
Owner

tbroadley commented Jan 1, 2018

For example, check space, infix, and ops when presented with space-infix-ops, but don't try to spell-check space-infix-ops.


Originally, this issue was about spell-checking the parts of the hyphenated word in addition to the hyphenated words. Updated based on the comments below.

@bjankord
Copy link

This would be really helpful. We are planning to generate some markdown docs with variable names that will use hyphens between words. Having this feature would be super helpful so we could automatically spellcheck these variable names.

@tbroadley
Copy link
Owner Author

tbroadley commented Jan 15, 2019

@bjankord thanks for the feedback!

I've been thinking about this a bit more. Currently, spellchecker-cli will flag hyphenated words that contain at least one part with a spelling mistake (like spellig in spellig-mistake) and are not included in a custom dictionary. For your use case, would it be enough to add these variable names to a dictionary? Then, any incorrectly typed variable name would be caught by the tool (assuming at least one part contained a spelling mistake) and correctly typed names would be ignored.

Or perhaps it would be more helpful to have an option for the tool to only spellcheck the parts of hyphenated words. For example, it would check spellig and mistake, but not the entire word spellig-mistake. What do you think?

@bjankord
Copy link

For my use case, it would be nice to check just spellig and mistake, but not the entire word spellig-mistake.

@tbroadley
Copy link
Owner Author

OK thanks! That makes sense to me as a feature.

@ryanblock
Copy link

Any word on what became of this feature? We have a large and growing dictionary of valid hyphenations that must be added as custom dictionary words (e.g. pre-provisioning). Thank you!

@tbroadley tbroadley changed the title Add option to spellcheck parts of hyphenated words as well as the entire word Add option to only spellcheck parts of hyphenated words, not the entire word Feb 15, 2022
@tbroadley
Copy link
Owner Author

@ryanblock Thanks for the feedback! I'm not actively working on spellchecker-cli, so I don't have plans to add this feature. I'd definitely review and merge a PR that added it.

@ryanblock
Copy link

Ok, good to know! Did you have any early research / notes on implementation here to crib if I were to take a swing? Thank you!

@tbroadley
Copy link
Owner Author

I haven't looked into how we could implement this. I don't think retext-spell has this capability built in. One option is to look for hyphenated words and replace the hyphens with spaces before passing the text to spellcheck into Retext (e.g. "It pre-provisions a server" would become "It pre provisions a server").

@a2937
Copy link
Contributor

a2937 commented Nov 7, 2022

I haven't looked into how we could implement this. I don't think retext-spell has this capability built in. One option is to look for hyphenated words and replace the hyphens with spaces before passing the text to spellcheck into Retext (e.g. "It pre-provisions a server" would become "It pre provisions a server").

But wouldn't that turn words like "x-ray" into "x ray" and make it very difficult to spellcheck in some instances? This comes from experience on a personal project of mine.

@tbroadley
Copy link
Owner Author

That's a good point. I think that's the reason why I wouldn't make this the default behaviour for spellchecker-cli. People would have to pass a flag like --replace-hyphens-with-spaces to opt into the behaviour.

@a2937
Copy link
Contributor

a2937 commented Nov 13, 2022

I just thought of something kinda related. Should we treat equal signs as spaces as well? While it doesn't show up in normal communication; it does show up in technical documentation on occasion to illustrate a point.

@tbroadley
Copy link
Owner Author

Good question. I imagine that Retext would already treat a and b as two separate words in the text a=b, so maybe we don't need to consider that case explicitly. But we can double-check.

@ryanblock
Copy link

But wouldn't that turn words like "x-ray" into "x ray" and make it very difficult to spellcheck in some instances? This comes from experience on a personal project of mine.

This is an example of a hyphenated compound word, and those words should probably be known and ignored by this feature. x-ray is a great example – that is the correct spelling of that word, no need to break it up by hyphen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants