Skip to main content

Traduttore Latino: lemma, paradigma, grammatica e traduzione da Dizionario Olivetti ©.

Project description

Latino

Latino è una libreria python che traduce dal latino usando il Dizionario Latino.

Latino is a python library that translates latin text by making requests to the Online Latin Dictionary.

Written for Python 3.8+.

pip install latino

latino.Translator

You have to create an instance of Translator to use this API

Parameters:

  • lang - language to be translated to
  • settings (available from the next releases)

translate(text, **kwargs)
Translate text from latin to destination language\

  • Parameters:
    • text (str; string sequence) - The latin source text(s) to be translated.
  • Return type: list[Translated]
  • Return type: list[list[Translated]] (when a list is passed)

Basic usage:

>>> from latino import Translator
>>> translator = Translator()  # lang="it" (italian default)

>>> # translator.translate returns a list of all possible translations
>>> puella = translator.translate("puella")[0]  # let's get the first result

>>> puella.lemma
pŭella

>>> puella.grammatica
sostantivo femminile  I declinazione

>>> puella.paradigma # might not exist
[puellă], puellae

>>> puella.traduzione
['bambina', 'ragazza', 'fanciulla', 
 'amante', 'donna amata', 'sposa', 
 'giovane donna', 'figlia', 'schiava']

>>> puella.table()
{'FEMMINILE': {'PLURALE': ['Nom.puellae',
                           'Gen.puellārum',
                           'Dat.puellis',
                           'Acc.puellas',
                           'Abl.puellis',
                           'Voc.puellae'],
               'SINGOLARE': ['Nom.puellă',
                             'Gen.puellae',
                             'Dat.puellae',
                             'Acc.puellam',
                             'Abl.puellā',
                             'Voc.puellă']}}

from latino import Translator

# Translator() takes as arg a lang between "it"/"en"/"fr"
translator = Translator("en") 

# Gonna print possible meaning for "es"
for translated in translator.translate("es"):
    print(translated.traduzione[0])
to eat
to be

from latino import Translator
translator = Translator("fr") 

text = "pulchram puellam sum"
# any string sequence such as list can also be taken as argument!
for i in translator.translate(text.split()):
    print(i[0].paradigma)
[pulcher], pulchră, pulchrum
[puellă], puellae
[sum], es, esse, fui

latino.models

latino.models.Translated

Members:

  • grammatica - grammar
  • lemma - lemma
  • paradigma - paradigm
  • traduzione - list of translations

table()
Returns the Declension table or the Conjugation table

latino.LANGUAGES

# languages which can be translated from
LANGUAGES = {
    'it': 'italiano', 
    'en': 'english', 
    'fr': 'francais'
 }

Licenza | License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

latino-0.1.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

latino-0.1.1-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page