PyDictionary

repository·master·Indexed 43 days ago

https://github.com/geekpradd/pydictionary

A deprecated Python module for retrieving word meanings, translations, synonyms, and antonyms using WordNet, Google Translate, and synonym.com. It provides methods for single word lookups, such as meaning(), synonym(), antonym(), and translate(), as well as batch processing capabilities.

Tokens
714
Snippets
3
Records
4
Agent score
5%

What's inside PyDictionary

  1. Important: PyDictionary is DEPRECATED

    master

    ⚠️ DEPRECATION NOTICE

    PyDictionary is currently DEPRECATED. Maintaining this module requires constantly updating scraping endpoints, which is no longer being supported.

    Recommendation: Users should look for alternative dictionary modules available on PyPI.

  2. Use PyDictionary for single word lookups

    master

    To look up specific properties for a single word, create an instance of PyDictionary and call its methods with the target word as an argument.

    Available methods:

    • meaning(word): Returns a dictionary where keys are parts of speech (e.g., 'Noun', 'Verb') and values are lists of meanings.
    • synonym(word): Returns a list of synonyms.
    • antonym(word): Returns a list of antonyms.
    • translate(word, language_code): Returns the translation of the word. Use language codes compatible with Google Translate (e.g., 'es' for Spanish).
    from PyDictionary import PyDictionary
    
    dictionary = PyDictionary()
    
    # Get meanings
    print(dictionary.meaning("indentation"))
    
    # Get synonyms
    print(dictionary.synonym("Life"))
    
    # Get antonyms
    print(dictionary.antonym("Life"))
    
    # Get translation (e.g., to Spanish)
    print(dictionary.translate("Range", 'es'))
  3. Use PyDictionary for batch word processing

    master

    You can initialize a PyDictionary instance with a fixed list of words to perform batch operations. This is useful for processing a predefined set of words without calling individual methods for each.

    Available batch methods:

    • printMeanings(): Prints the meanings of all words in the instance to the screen.
    • getMeanings(): Returns a dictionary containing the meanings of all words in the instance.
    • getSynonyms(): Returns synonyms for all words in the instance.
    • translateTo(language_code): Translates all words in the instance to the specified language code (e.g., 'hi' for Hindi).
    from PyDictionary import PyDictionary
    
    # Initialize with a list of words
    dictionary = PyDictionary("hotel", "ambush", "nonchalant", "perceptive")
    
    # Batch operations
    dictionary.printMeanings()
    print(dictionary.getMeanings())
    print(dictionary.getSynonyms())
    print(dictionary.translateTo("hi"))