platers / obsidian-linter

An Obsidian plugin that formats and styles your notes with a focus on configurability and extensibility.
https://platers.github.io/obsidian-linter/
MIT License
1.23k stars 81 forks source link

FR: (How to) Add custom misspelling autocorrection rules (?) #915

Closed zanodor closed 11 months ago

zanodor commented 1 year ago

Hello there,

I searched the issues for a similar request and found none.

Is Your Feature Request Related to a Problem? Please Describe.

I was hoping to find some info about this in the Wiki. Found none. I write bilingually; I'd like to add my own BadWord -- GoodWord dictionary.

Describe the Solution You'd Like

Make the file editable. On install of the plugin, the txt or json file would be downloaded and freely editable.
Alternatively, make the user able to add their own txt or json file that would 1) either override the plugin's own solution 2) or would coexist with it.
In the Various Complements plugin, one can add multiple dictionaries (but has no autocorrection capabilitles).

Describe Alternatives You've Considered

Currently, I have multiple dictionaries on in Obsidian, and my text is red all over as I do etymologies and etymons, so it's impossible to tell the difference from a typo or a legit, say "Hottentottese" word.
I have not tried any other service. Actually, BadWord -- GoodWord lists are hard to come by as well. (Would like some advice as well from someone.)

Thanks for considering my request,

All the best

pjkaufman commented 1 year ago

Hey @zanodor , this is definitely an interesting request. At this time the Linter does not support this operation and it would take some work to make this possible, so the Linter likely won't support this any time soon without a desire from the community to get it added or someone else writing this functionality.

When you say there is a "BadWord -- GoodWord" list, the first thing that comes to mind to me is the custom replace logic in the Linter. You can specify the word to find (case sensitive) with the value to replace it with. That seems to me like the best option for you within the bounds of the Linter unless you personally know how to code JavaScript or would be willing to learn some.

Here is an example of some find and replace values you could use: Find Replace Flags
([Aa])lgor $1lgo gm
([Ww])od $1ord gm

Notice that the regex capture group should handle both the capitalized and capitalized versions of the words automatically. Do note that there may be a better way, but this is just my first impression based on what you have said. This could get unruly if you are trying to create a large list. This would be a list you would need to maintain since the list the Linter uses is meant for English, but it does bleed over into some other languages.

zanodor commented 1 year ago

Hi,

I understand that for a big addendum like that we'd need to bring in a large support group. I just never used your autocorrection and didn't even know it existed.
I tried to create my own bad-good word list as I wasn't able to get anything out of MS Word, Open/LibreOffice or my iPad. It was not effective as all I could do with it was neutralize accents for bad words and that is not enough. Building one from scratch is not an option, so I'll have to grow better eyes and less fumbly fingers.

Cheers

pjkaufman commented 1 year ago

Depending upon the languages you use it may be possible to find some online, but I do not have any lists that I have built myself. The only list included in the Linter comes from codespell. It is a general auto correct system, but I am not sure it cares which language you are using. Their dictionaries are located here, but they are mostly in English. You might be able to use Codespell manually via the CLI and use a custom dictionary if someone has one out there for the languages you are looking for.

zanodor commented 1 year ago

Thanks.

I may be wrong that one of the industry standard spelling dictionaries were from my compatriots who made Hunspell (actually Neumann was from my country too...). But I never could find a simple badword - goodword dictionary.

pjkaufman commented 11 months ago

Gotcha. I am going to close this since it sounds like there is nothing to be done about this.