3

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?

eshirvana
  • 23,227
  • 3
  • 22
  • 38
Bob
  • 43
  • 6

1 Answers1

5

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"
        ]
    }
}

Life is complex
  • 15,374
  • 5
  • 29
  • 58
  • Can you please add `OneLook Thesaurus` data? For example: https://www.onelook.com/thesaurus/?s=active , with some way to retain the subclasses split and retrieval and the order (All, Adjective, Nous, Verbs, Adverbs, Idioms/Slang, Old), and possibly the filters, for example the `most funny sounding` https://www.onelook.com/thesaurus/?s=active&sortby=hu1 More details here: https://www.onelook.com/thesaurus/?s=active#help https://datamuse.com/api/ https://www.youtube.com/@datamuse – Lod Aug 25 '23 at 09:11
  • 1
    I can look into adding this source to WordHoard. Adding a source requires some research and testing, so I don't know the time frame to complete these tasks. I have looked at adding Parts of Speech, but I need to adding some filtering in the code base. This is something in the pipeline for development. I will post back here when I have done some research into OneLook Thesaurus. – Life is complex Aug 25 '23 at 12:59
  • Thank you for your interest. They have 2 apis but I'm not yet familiar with it. For example: https://www.onelook.com/api/words?ml=active&qe=ml&md=dpfcy&max=850&rif=1&k=olthes_r4 The second api: https://www.datamuse.com/api/ Also a short overview: https://www.youtube.com/watch?v=AgPwm4FstXw Also those github hits might be of value: https://github.com/scalarwaves/leximaven https://github.com/howdyAnkit/Datamuse_apiWord- – Lod Aug 25 '23 at 14:19
  • I looked at the API info and it seems that the pull from WordNet. I already have the source in the code base for WordHoard. I need to do some research to see what Onelook has that can enhance WordHoard's capabilities. – Life is complex Aug 26 '23 at 14:44
  • Their source is from 1061 dictionaries (18,955,870 words in 1061 dictionaries indexed), from their `Dictionary` app on the onelook.com domain : https://onelook.com/ . Their `Thesaurus` is here https://onelook.com/thesaurus/ . Can you add the `Thesaurus` data? For a full presentation : https://www.youtube.com/watch?v=AcednTikRLk&t=1s – Lod Aug 26 '23 at 19:11