This package searches for word meanings on dizionario-italiano.
pip install italian-dictionary
import italian_dictionary
# Use this to get only the meaning
definition = italian_dictionary.get_definition('cane', limit=3, all_data=False)
# Use this to get all data for a word (all_data default is True)
data = italian_dictionary.get_definition('albero')
# Use this to get a subset of the properties, for example 'grammatica' and 'pronuncia'
data = italian_dictionary('albero', all_data=False, properties=['grammatica', 'pronuncia'])
# Use this to get single property other than the meaning, for example 'lemma'
# Will return the value of the property, not a dictionary containing the one value.
data = italian_dictionary('albero', all_data=False, properties=['lemma'])
This function will return a dictionary like this:
{
'sillabe': ['al', 'be', 'ro'],
'lemma': 'àlbero',
'pronuncia': ' /ˈalbero/',
'grammatica': ['sostantivo maschile'],
'definizione': ['pianta con fusto alto, legnoso, provvisto di rami nella parte superiore',
"MARINERIA -- palo che regge i pennoni con le vele e tutta l'attrezzatura",
'MECCANICA -- parte rotante, generalmente cilindrica, che, in una macchina, ha la funzione di trasmettere potenza meccanica da un organo a un altro'],
'locuzioni': ["linea d'asse o d'alberi di una nave",
'ad albero che cade dàgli dàgli',
'svasare un albero',
'albero portaelica',
'albero a calcese',
'albero castalio',
'albero matricino',
'alberi a mezzovento',
'albero optronico',
'albero pizzuto',
'andare agli alberi pizzuti',
'alberi rinterzati',
'albero del sego']
}
To run tests you need pytest
.
When in project folder:
python -m pytest