The program tests if a given word is a Semordnilap or not. A Semordnilap is any word whose letters, when reversed, spell another word. Examples of such words are: live, swap, diaper etc.
Semordnilap, the word formed by reversing the letters in the word palindromes, is a word that has the property of forming another word (could also be the same word) when its letters are reversed. Other names for such words are Anadrome, half-palindrome, Heteropalindrome, Reversgram, reversible anagram, semi-palindrome, word reversal, Levidrome and Emordnilap. It is to be noted that all palindromes are semordnilap but not all semordnilap are palindromes.
Here is a program in Python that finds whether a string is a semordnilap or not. If it is found that the word given by the user is a semordnilap, the program is designed to print the meaning of the semordnilap formed by it.
To find the meanings of the words, Pydictionary is used. PyDictionary is a dictionary (as in the English language dictionary) module for Python2 and Python3, which provides the following services for a word:
1. Meanings
2. Translations
It uses WordNet for getting meanings, Google for translations, and synonym.com for getting synonyms and antonyms.
WordNet is a directory of words in the English language. Unlike a dictionary that's set up alphabetically, WordNet is organized by the concept and meaning of the words.
here is the output of the code:
Submitted by Tasneem Fatima (tasneem)
Download packets of source code on Coders Packet
Comments