Zamansky: Elisp 17

Mike Zamansky is back is back with part 2 of his thesaurus project. In his last video he started a project to explore using Web APIs. He chose to implement a thesaurus to illustrate the concepts and used the Merriam-Webster dictionary interface as his example API.

Once he had a key for the Merriam-Webster API it was a simple matter to retrieve the JSON that Merriam-Webster returns. The current video shows how to parse the JSON, chose a synonym, and replace the target word with it. Again, this turns out to be pretty simple. Once you have the JSON response string and have parsed it with json-parse-string it’s simply a matter of pulling out the required array from the JSON, converting it to a list, presenting it in a completing read, and replacing the target word with the choice from the completing read.

Zamansky finishes the project by turning the code into a minor mode and binding a key shortcut to it. The amazing thing about all this is how simple it is. There’s just a tiny amount of code that implements a reasonably complete thesaurus application. To be sure, a lot of the work is being done by Merriam-Webster but almost all such projects do the same thing with one dictionary provider or another.

This is a very instructive couple of videos that showcase how easy it is to leverage Elisp into a significant application. This last video is 16 minutes, 35 seconds long so you’ll need to schedule some time but it’s definitely worth your time. Be sure to take a look.

This entry was posted in General and tagged , . Bookmark the permalink.