A class Conjugator containing a function conjugate which conjugates spanish verbs by tense, mood and pronoun.
pip install spanishconjugator
Example python usage; the conjugate
function of the Conjugator
Class takes 4 parameters being root-verb, tense, mood, pronoun respectively
from spanishconjugator import Conjugator
imperfect_conjugation = Conjugator().conjugate('hablar','imperfect','indicative','yo')
print(imperfect_conjugation)
>>> hablaba
All pronouns are implemented
yo, tu, usted, nosotros, vosotros, ustedes
All moods currently implemented are
indicative, conditional
All tenses currently implemented are
present, imperfect, preterite, future, present_perfect, past_anterior, future_perfect, conditional_simple
Exaple usage of different moods/tenses with hablar and yo
Conjugator().conjugate('hablar','present','indicative','yo')
>>> hablo
In case of indicative present, 4th param pronoun is optional.
from spanishconjugator import Conjugator
present_indicative_conjugation = Conjugator().conjugate('hablar','present','indicative')
print(present_indicative_conjugation)
>>> {'el/ella/usted': 'habla', 'ellos/ellas/ustedes': 'hablan', 'tu': 'hablas', 'vosotros': 'habláis', 'yo': 'hablo', 'nosotros': 'hablamos'}
Conjugator().conjugate('hablar','imperfect','indicative','yo')
>>> hablaba
Conjugator().conjugate('hablar','preterite','indicative','yo')
>>> hablé
Conjugator().conjugate('hablar','future','indicative','yo')
>>> hablaré
Conjugator().conjugate('hablar','present_perfect','indicative','yo')
>>> he hablado
Conjugator().conjugate('hablar','past_anterior','indicative','yo')
>>> hube hablado
Conjugator().conjugate('hablar','future_perfect','indicative','yo')
>>> habré hablado
Conjugator().conjugate('hablar','simple_conditional','conditional','yo')
>>> hablaría
Conjugator().conjugate('hablar','perfect','conditional','yo')
>>> habría hablado
Conjugator().conjugate('hablar','affirmative','imperative','tu')
>>> habla
Conjugator().conjugate('hablar','negative','imperative','tu')
>>> hables
Conjugator().conjugate('hablar','present','subjunctive','yo')
>>> hable
Conjugator().conjugate('hablar','imperfect','subjunctive','yo')
>>> hablara
Conjugator().conjugate('hablar','imperfect_se','subjunctive','yo')
>>> hablase
Conjugator().conjugate('hablar','future','subjunctive','yo')
>>> hablare
if you would like to help develop spanishconjugator, follow succeeding code
Whilst in command line create a folder in which you would like to work (name only reccommended)
$ mkdir spanish_conjugator_enviroment
change directory into the enviroment you have just made
$ cd spanish_conjugator_enviroment
install virtualenv
$ pip install virtualenv
create a virtual enviroment from path of python3
$ virtualenv -p $(which python3) my_venv
activate virtual enviroment
$ source my_venv/bin/activate
tip: once you want to disactivate your virtual enviroment simply run
$ deactivate
Clone Spanish-Conjugator
$ git clone https://github.com/Benedict-Carling/spanish-conjugator.git
Install developer dependencies for unit test e.g pytest and for other library tools
pip install -e .[dev]
We have chosen to use the library pytest for our unit test
At this point in the developing guide you can check the code works by running it against out current unit tests located in the /tests
folder
$ pytest
output should show the different tenses implemented should pass their unit tests as below.(27/08/2020)
To submit code to this repositry please fork and submit a pull request 🚀
Check out the Javascript npm version of the library if you are working in a node or browser enviroment
https://github.com/Benedict-Carling/spanish-conjugatorjs