Trying to use pyDictionary, but there is a problem with the commands synonyms and antonyms...
from PyDictionary import PyDictionary
dictionary=PyDictionary()
print (dictionary.synonym("Life"))
This error appears
Life has no Synonyms in the API
None
how do I fix this?
PyDictionary isn't actively maintained, so I would recommend looking at alternative packages.
I'm the author of the Python package WordHoard. This package can be used to find semantic relationships between words including a word's antonyms, synonyms, hypernyms, hyponyms and homophones.
from wordhoard import Synonyms
word = 'life'
results = Synonyms(search_string=word, output_format='json').find_synonyms()
print(results)
{
"synonyms": {
"life": [
"activity",
"aliveness",
"animation",
"being",
"bio",
"biography",
"breath",
"brio",
"dash",
"energy",
"enthusiasm",
"entity",
"esprit",
"essence",
"excitement",
"experience",
"get-up-and-go",
"go",
"growth",
"heart",
"high spirits",
"impulse",
"life history",
"life sentence",
"life story",
"life-time",
"lifeblood",
"lifespan",
"lifetime",
"liveliness",
"living",
"memoir",
"oomph",
"sentience",
"soul",
"sparkle",
"spirit",
"sprightliness",
"verve",
"viability",
"vigor",
"vitality",
"vivacity",
"zest",
"zing",
"élan",
"élan vital"
]
}
}