PowerShell : Get Synonyms using Online Thesaurus


Internet is very Powerful ! Lots of online API’s, Tools and Programs are available that will make your life easy. Today in this post I’ll discuss with you how to get Synonyms of a word using an Online Thesaurus API and Powershell.

What is a Synonym ?
A Synonym is a word or phrase that means exactly or nearly the same as another word or phrase in the same language

What is Thesaurus ?
A book that lists words in groups of Synonyms and related concepts.

HOW IT WORKS : 

  1. A word is passed in a HTTP request as a URL to an online Thesarus API in order  to receive an XML based response. (Using Invoke-WebRequest cmdlet)
  2. Do some Data mining from the XML reponse
  3. Plus, some magic 😉  ( Go to my Script to see the magic )
  4. You get Synonyms of the word which was queried, like in the below screenshot.

syn

GET THE SCRIPT : Click here to go to my GitHub gist to get the code.

HOW TO USE IT : 

Feed the Script the word(s) you want to query and the script will return you the Synonyms of those words

syn2

You can Also Filter the Synonyms using the Part of Speech

syn

Or, you can Check Available Part of Speech’s  in the Thesaurus.

syn

And in case you feed in a word that is not available in Thesaurus you will get a 404 Not Found Error like in the below screenshot.

syn

Hope you guys find this post useful, Stay tuned for more fun !

Thank you for Stopping by 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s