Skip to main content

A python library to conjugate spanish words with parameters tense, mood and pronoun

Project description

Spanish Conjugator 🇪🇸

GitHub Workflow Status GitHub repo size PyPI - Downloads GitHub top language GitHub PyPI

A class Conjugator containing a function conjugate which conjugates spanish verbs by tense, mood and pronoun.

Installation

pip install spanishconjugator

Example usage

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

Tenses, Moods and Pronouns implemented

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

Indicative Present

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'}

Indicative Imperfect

Conjugator().conjugate('hablar','imperfect','indicative','yo')
>>> hablaba

Indicative Preterite

Conjugator().conjugate('hablar','preterite','indicative','yo')
>>> hablé

Indicative Future

Conjugator().conjugate('hablar','future','indicative','yo')
>>> hablaré

Indicative Present_Perfect

Conjugator().conjugate('hablar','present_perfect','indicative','yo')
>>> he hablado

Indicative Past_Anterior

Conjugator().conjugate('hablar','past_anterior','indicative','yo')
>>> hube hablado

Indicative Future_Perfect

Conjugator().conjugate('hablar','future_perfect','indicative','yo')
>>> habré hablado

Conditional Simple

Conjugator().conjugate('hablar','simple_conditional','conditional','yo')
>>> hablaría

Conditional Perfect

Conjugator().conjugate('hablar','perfect','conditional','yo')
>>> habría hablado

Imperative Afferative

Conjugator().conjugate('hablar','affirmative','imperative','tu')
>>> habla

Imperative Negative

Conjugator().conjugate('hablar','negative','imperative','tu')
>>> hables

Subjunctive Present

Conjugator().conjugate('hablar','present','subjunctive','yo')
>>> hable

Subjunctive Imperfect

Conjugator().conjugate('hablar','imperfect','subjunctive','yo')
>>> hablara

Subjunctive Imperfect_se

Conjugator().conjugate('hablar','imperfect_se','subjunctive','yo')
>>> hablase

Subjunctive Future

Conjugator().conjugate('hablar','future','subjunctive','yo')
>>> hablare

Developing

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]

Developing - Testing

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) alt text

Developing - Submission

To submit code to this repositry please fork and submit a pull request 🚀

Alternative Versions

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

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

spanishconjugator-2.3.9302.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

spanishconjugator-2.3.9302-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file spanishconjugator-2.3.9302.tar.gz.

File metadata

  • Download URL: spanishconjugator-2.3.9302.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for spanishconjugator-2.3.9302.tar.gz
Algorithm Hash digest
SHA256 c0d5f2ee4f371699ce08e5a2f77e48b010e9b9d39ef27101d44af24bcc5d0ea9
MD5 e1962a167cb3a72fb22edfca1243b9c1
BLAKE2b-256 21e1ba6284e27aa5cdf0b6e40226f2852d406e5495499c0339f038c9e90f3c94

See more details on using hashes here.

File details

Details for the file spanishconjugator-2.3.9302-py3-none-any.whl.

File metadata

File hashes

Hashes for spanishconjugator-2.3.9302-py3-none-any.whl
Algorithm Hash digest
SHA256 ac91cd4d885a0793a7553cf356fda9c189c13bab9eb2c0a6456bbf1c6531e0e2
MD5 6e0888341fa423265ce43a3e7bd885db
BLAKE2b-256 2644281e35e7cdfbdc17df51a906399fbba19b7a7c2c15a2c44598d71938e75d

See more details on using hashes here.

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