Quest for homonyms, cont'd

I originally asked about this at Homonym or homophone for dictators, please?

Making my own snippet was beyond my abilities.

But I just ran across a discussion elsewhere in the forum where you mention the Spelling extension. I wonder if it could be adapted for my purposes…

Right now the Spelling option only shows up if you highlight a misspelled word. When that happens, I notice there’s a button at the left end of the PopClip popup to go to the regular menu of extensions for that selection.

What I’m wondering is if one could add a similar button to the regular popup that would take one to the Spelling extension, so that even if a correctly spelled word is selected, one might be offered homonymic alternatives. Since I can’t get the Spelling option with a correctly spelled word, I can’t tell if it would offer me homonyms or not.

As I explained in the other thread, I use Dictation almost exclusively and it frequently types the incorrect homonym.

That sounds like a very useful feature. I’ve no idea what kind of data source PopClip could use for homonym substitution. Any ideas?

First, the standard spelling lookup doesn’t offer homonyms. So much for that idea.

In a rudimentary search, it appears that it would involve using the Mac OS Dictionary Services API, and a downloadable dictionary. Ideally one would avoid using an online dictionary for lookups, because of speed and connectivity factors.

I know there are alternate dictionaries you can install; foreign language, medical, or legal, for example. It seems reasonable that a homonym dictionary is available, then the PopClip function could use the Dictionary Services API to specify that dictionary? I’m over my head here, so just guessing.

For Swift, I found this: Apple Developer Documentation

Apple has done away with a lot of useful functions like being able to add custom words to your own custom dictionary. I miss that.

Yep that’s the API that PopClip uses for the Dictionary feature. However it only provides dictionary definition, not replacement suggestions. There’s a different API, NSSpellChecker, that is used for the spelling feature. This also allows user-supplied dictionaries but I don’t think it has the concept of homophone replacement. It just tells you of it think the word is spelled correct or not. A feature like this would need a custom data source I think.

By the way, you can still have your own word list for spelling, the word list is at:

~/Library/Spelling/LocalDictionary

It’s just a plain text file.

I remember accessing that directly years ago to add items. You used to be able to Add to Dictionary or Learn Spelling in a contextual menu when spellchecking. This still appears in specific, unpredictable instances. Apple has done a very poor job of reading my mind the last few years!

Oooo! I want to try making a popclip extension for adding words to the local dictionary.

1 Like