PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different languages

Overview

PyMultiDictionary

@ppizarror License MIT Python 3.6+ PyPi package Travis Total alerts Language grade: Python Codecov Open issues PyPi downloads Total downloads Buy me a Ko-fi

PyMultiDictionary is a Dictionary Module for Python 3+ to get meanings, translations, synonyms and antonyms of words in 20 different languages. It uses educalingo.com, synonym.com, and WordNet for getting meanings, translations, synonyms, and antonyms.

Supported languages

  • Bengali (bn)
  • German (de)
  • English (en)
  • Spanish (es)
  • French (fr)
  • Hindi (hi)
  • Italian (it)
  • Japanese (ja)
  • Javanese (jv)
  • Korean (ko)
  • Marathi (mr)
  • Malay (ms)
  • Polish (pl)
  • Portuguese (pt)
  • Romanian (ro)
  • Russian (ru)
  • Tamil (ta)
  • Turkish (tr)
  • Ukranian (uk)
  • Chinese (zh)

Install Instructions

PyMultiDictionary can be installed via pip, for both MacOS, Windows & Linux. Simply run:

$> python3 -m pip install --upgrade PyMultiDictionary

Usage

PyMultiDictionary can be utilised in 2 ways, either by creating a dictionary instance which can take words as arguments or by creating a dictionary instance with a fixed amount of words.

Create a dictionary object:

For example,

from PyMultiDictionary import MultiDictionary
dictionary = MultiDictionary()

This is will create a local instance of the MultiDictionary class and now it can be used to get meanings, translations etc.

For Meanings,

print(dictionary.meaning('en', 'good'))

This will return a tuple containing the meanings of the word, in the format (word_type, word_meaning, word_wikipedia). For example the above code will return:

(['Noun', 'Adjective', 'Exclamation'],
 'The first definition of good in the dictionary is having admirable ...',
 'Good may refer to: ▪ Good and evil, the distinction between positiv...')

All methods support other dictionaries, for example, 'wordnet' can be used for english words.

from PyMultiDictionary import DICT_WORDNET
dictionary = MultiDictionary()
print(dictionary.meaning('en', 'good', dictionary=DICT_WORDNET))

Will return:

{
    'Noun': ['benefit', 'moral excellence or admirableness', ...],
    'Adjective': ['morally admirable', ...],
    'Adverb': [...]
}

For Synonyms,

print(dictionary.synonym('es', 'Bueno'))

This will return a list containing the Synonyms of the word.

For Antonyms,

print(dictionary.antonym('en', 'Life'))

This will return a list containing the Antonyms of the word. Currently only English is supported.

For Translations,

print(dictionary.translate('en', 'Range'))

This will return the Translation of the word 'Range' in 20 different languages. You can also extendthe scope of the translations by providing a target language, which will use google translate API, for example:

print(dictionary.translate('en', 'Range', to='ru'))

Alternatively, you can set a fixed number of words to the Dictionary Instance. This is useful if you just want to get the meanings of some words quickly without any development need.

Example:

from PyMultiDictionary import MultiDictionary, DICT_EDUCALINGO

dictionary=MultiDictionary('hotel', 'ambush', 'nonchalant', 'perceptive')
dictionary.set_words_lang('en') # All words are english

print(dictionary.get_meanings(dictionary=DICT_EDUCALINGO)) # This print the meanings of all the words
print(dictionary.get_synonyms()) # Get synonyms list
print(dictionary.get_antonyms()) # Get antonyms
print(dictionary.get_translations()) # This will translate all words to over 20 languages
print(dictionary.get_translations(to='ru')) # This will translate all words to Russian (if Google API available)

Supported dictionaries

  • DICT_EDUCALINGO: Meaning, synonym, translation for all languages
  • DICT_SYNONYMCOM: Synonyms and Antonyms (English)
  • DICT_THESAURUS: Synonyms (English)
  • DICT_WORDNET: Meanings (English)

There are much more dictionaries to come. Just contribute to this repo!

Author

Pablo Pizarro R. | 2021

You might also like...
Answer some questions and get your brawler csvs ready!

BRAWL-STARS-V11-BRAWLER-MAKER-TOOL Answer some questions and get your brawler csvs ready! HOW TO RUN on android: Install pydroid3 from playstore, and

The Levenshtein Python C extension module contains functions for fast computation of Levenshtein distance and string similarity

Contents Maintainer wanted Introduction Installation Documentation License History Source code Authors Maintainer wanted I am looking for a new mainta

TextStatistics - Get a text file wich contains English text

TextStatistics This program get a text file wich contains English text. The program analyses the text, and print some information. For this program I

A simple Python module for parsing human names into their individual components

Name Parser A simple Python (3.2+ & 2.6+) module for parsing human names into their individual components. hn.title hn.first hn.middle hn.last hn.suff

A non-validating SQL parser module for Python

python-sqlparse - Parse SQL statements sqlparse is a non-validating SQL parser for Python. It provides support for parsing, splitting and formatting S

Implementation of hashids (http://hashids.org) in Python. Compatible with Python 2 and Python 3

hashids for Python 2.7 & 3 A python port of the JavaScript hashids implementation. It generates YouTube-like hashes from one or many numbers. Use hash

Markup is an online annotation tool that can be used to transform unstructured documents into structured formats for NLP and ML tasks, such as named-entity recognition. Markup learns as you annotate in order to predict and suggest complex annotations. Markup also provides integrated access to existing and custom ontologies, enabling the prediction and suggestion of ontology mappings based on the text you're annotating.
Markup is an online annotation tool that can be used to transform unstructured documents into structured formats for NLP and ML tasks, such as named-entity recognition. Markup learns as you annotate in order to predict and suggest complex annotations. Markup also provides integrated access to existing and custom ontologies, enabling the prediction and suggestion of ontology mappings based on the text you're annotating.

Markup is an online annotation tool that can be used to transform unstructured documents into structured formats for NLP and ML tasks, such as named-entity recognition. Markup learns as you annotate in order to predict and suggest complex annotations. Markup also provides integrated access to existing and custom ontologies, enabling the prediction and suggestion of ontology mappings based on the text you're annotating.

A Python library that provides an easy way to identify devices like mobile phones, tablets and their capabilities by parsing (browser) user agent strings.

Python User Agents user_agents is a Python library that provides an easy way to identify/detect devices like mobile phones, tablets and their capabili

Etranslate is a free and unlimited python library for transiting your texts

Etranslate is a free and unlimited python library for transiting your texts

Comments
  • urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1076)>

    urllib.error.URLError:

    Hi,

    I got this issue when I want to run the program to call the dictionary.antonym. It seems the certificate has expired. Does anyone know how to sovle that issue? Thanks. urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1076)>

    bug 
    opened by 14H034160212 4
Owner
Pablo Pizarro R.
I love coding... who doesn't at github? 🤔
Pablo Pizarro R.
JSON and CSV data for Swahili dictionary with over 16600+ words

kamusi JSON and CSV data for swahili dictionary with over 16600+ words. This repo consists of data from swahili dictionary with about 16683 words toge

Jordan Kalebu 8 Jan 13, 2022
Migrates translations to the REDCap native Multi-Language Management system

Automates much of the process of moving translations from the old Multilingual external module to the newer built-in Multi-Language Management (MLM) page.

UCI MIND 3 Sep 27, 2022
py-trans is a Free Python library for translate text into different languages.

Free Python library to translate text into different languages.

I'm Not A Bot #Left_TG 13 Aug 27, 2022
Add your new words to a text file and get them randomly.

Memorize-New-Words In this very very very little project, I've wrote a code to memorize new english words. Therefore you can add the words and their m

Mostafa 2 Jul 4, 2022
Little python script + dictionary to help solve Wordle puzzles

Wordle Solver Little python script + dictionary to help solve Wordle puzzles Usage Usage: ./wordlesolver.py [letters in word] [letters not in word] [p

Luke Stephens (hakluke) 4 Jul 24, 2022
Correcting typos in a word based on the frequency dictionary

Auto-correct text Correcting typos in a word based on the frequency dictionary. This algorithm is based on the distance between words according to the

Anton Yakovlev 2 Feb 5, 2022
Fuzz a language by mixing up only few words.

afasi Fuzz a language by mixing up only few words. Status Beta. Note: The default branch is default. Use Examples Version General Help Translate Help

Stefan Hagen 2 Dec 14, 2022
Converts a Bangla numeric string to literal words.

Bangla Number in Words Converts a Bangla numeric string to literal words. Install $ pip install banglanum2words Usage

Syed Mostofa Monsur 3 Aug 29, 2022
Wordle strategy: Find frequency of letters appearing in 5-letter words in the English language

Find frequency of letters appearing in 5-letter words in the English language In

Gabriel Apolinário 1 Jan 17, 2022
Auto translate Localizable.strings for multiple languages in Xcode

auto_localize Auto translate Localizable.strings for multiple languages in Xcode Usage put your origin Localizable.strings file in folder pip3 install

Wesley Zhang 13 Nov 22, 2022