ropensci / spelling

Tools for Spell Checking in R
https://docs.ropensci.org/spelling
Other
107 stars 25 forks source link

Add support for using multiple dictionaries / languages #73

Open Bisaloo opened 1 year ago

Bisaloo commented 1 year ago

There is a growing interest in multilingual R packages, and this relates to recent rOpenSci work.

Would it be possible to add the ability to spellcheck a package with multiple languages? To address, e.g., the case when documentation or a README is provided in two languages (real-life example). I understand that this might then miss some typos because they are a valid word in the other languages.

From a quick glance, it looks like this might require a change to the hunspell (this change? https://github.com/ropensci/hunspell/pull/37) so feel free to move there if you believe that's more appropriate.

Bisaloo commented 1 year ago

There is also this related question which suggests interest in this feature: https://stackoverflow.com/questions/50168526/use-multiple-dictionaries-using-hunspell-in-r

jeroen commented 1 year ago

I'm not a linguist but I think the concept of "multiple languages" is a ambiguous. Would you expect it to be able to check sentences using a mix of languages and accept e.g. a spanish word pluralized with english grammar rules? What about chineese and english?

I think if you want to mix languages we probably need some way you can mark a specific section or file with a given language and we can check it in that language. But I generally feel it is a bad idea to randomly mix languages in a document...

Bisaloo commented 1 year ago

Yes, I think you make a good point about using multiple languages in a single document. But let's say I want to use different languages in two different vignettes. How would you go with using spelling in this situation?