Spanish Conjugator
Spanish Conjugator is a Python library designed to conjugate Spanish verbs. It provides a `Conjugator` class with a `conjugate` method that takes a root verb, tense, mood, and an optional pronoun to return the correctly conjugated form. The library is actively maintained and currently at version 2.3.9474, with a release cadence that appears to be driven by development cycles rather than a fixed schedule.
Common errors
-
KeyError: 'SomeUnsupportedTense'
cause The provided 'tense' string does not match any of the supported tenses within the library's internal mapping.fixCheck the official documentation or GitHub repository for the exact list of supported tense strings (e.g., 'imperfect', 'present', 'future'). -
TypeError: conjugate() missing 1 required positional argument: 'pronoun'
cause You attempted to conjugate a verb without providing a 'pronoun' parameter for a tense/mood combination where it is required.fixAdd the 'pronoun' argument to the `conjugate` method call, specifying the desired pronoun (e.g., 'yo', 'tu', 'el', 'nosotros', 'vosotros', 'ellos'). Remember it's only optional for 'present' 'indicative'. -
No conjugation returned or unexpected output for irregular verb.
cause While the library is designed for conjugation, highly irregular verbs or specific nuanced conjugations might not be perfectly handled by a rule-based system without explicit irregular forms.fixVerify if the specific irregular verb and its conjugation for the given tense/mood/pronoun is expected to be handled by the library. If issues persist, consult the library's issue tracker or consider contributing to expand its irregular verb handling.
Warnings
- gotcha The `pronoun` parameter is optional only for the 'present' 'indicative' mood. For other tenses or moods, omitting the pronoun will lead to incorrect or incomplete conjugations.
- gotcha The library expects specific string values for 'tense', 'mood', and 'pronoun'. Mismatched or misspelled parameters will result in an unhandled exception or incorrect output. Refer to the GitHub README for the exact supported values.
Install
-
pip install spanishconjugator
Imports
- Conjugator
from spanishconjugator import Conjugator
Quickstart
from spanishconjugator import Conjugator
# Conjugate 'hablar' in imperfect indicative for 'yo'
imperfect_conjugation = Conjugator().conjugate('hablar', 'imperfect', 'indicative', 'yo')
print(f"'hablar' in imperfect indicative for 'yo': {imperfect_conjugation}")
# Conjugate 'comer' in present indicative for 'nosotros'
present_conjugation = Conjugator().conjugate('comer', 'present', 'indicative', 'nosotros')
print(f"'comer' in present indicative for 'nosotros': {present_conjugation}")
# Conjugate 'vivir' in future simple for 'ellos'
future_conjugation = Conjugator().conjugate('vivir', 'future', 'indicative', 'ellos')
print(f"'vivir' in future simple for 'ellos': {future_conjugation}")
# Conjugate 'hablar' in present indicative without a pronoun (optional parameter)
present_indicative_no_pronoun = Conjugator().conjugate('hablar', 'present', 'indicative')
print(f"'hablar' in present indicative (no pronoun): {present_indicative_no_pronoun}")