Metadata-Version: 2.4
Name: verbecc
Version: 2.0.2
Summary: Verbs Completely Conjugated: machine learning conjugator for Catalan, French, Italian, Portuguese, Romanian and Spanish
Author-email: Brett Tolbert <bretttolbert@gmail.com>
Maintainer-email: Brett Tolbert <bretttolbert@gmail.com>
License:                    GNU LESSER GENERAL PUBLIC LICENSE
                               Version 3, 29 June 2007
        
         Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
         Everyone is permitted to copy and distribute verbatim copies
         of this license document, but changing it is not allowed.
        
        
          This version of the GNU Lesser General Public License incorporates
        the terms and conditions of version 3 of the GNU General Public
        License, supplemented by the additional permissions listed below.
        
          0. Additional Definitions.
        
          As used herein, "this License" refers to version 3 of the GNU Lesser
        General Public License, and the "GNU GPL" refers to version 3 of the GNU
        General Public License.
        
          "The Library" refers to a covered work governed by this License,
        other than an Application or a Combined Work as defined below.
        
          An "Application" is any work that makes use of an interface provided
        by the Library, but which is not otherwise based on the Library.
        Defining a subclass of a class defined by the Library is deemed a mode
        of using an interface provided by the Library.
        
          A "Combined Work" is a work produced by combining or linking an
        Application with the Library.  The particular version of the Library
        with which the Combined Work was made is also called the "Linked
        Version".
        
          The "Minimal Corresponding Source" for a Combined Work means the
        Corresponding Source for the Combined Work, excluding any source code
        for portions of the Combined Work that, considered in isolation, are
        based on the Application, and not on the Linked Version.
        
          The "Corresponding Application Code" for a Combined Work means the
        object code and/or source code for the Application, including any data
        and utility programs needed for reproducing the Combined Work from the
        Application, but excluding the System Libraries of the Combined Work.
        
          1. Exception to Section 3 of the GNU GPL.
        
          You may convey a covered work under sections 3 and 4 of this License
        without being bound by section 3 of the GNU GPL.
        
          2. Conveying Modified Versions.
        
          If you modify a copy of the Library, and, in your modifications, a
        facility refers to a function or data to be supplied by an Application
        that uses the facility (other than as an argument passed when the
        facility is invoked), then you may convey a copy of the modified
        version:
        
           a) under this License, provided that you make a good faith effort to
           ensure that, in the event an Application does not supply the
           function or data, the facility still operates, and performs
           whatever part of its purpose remains meaningful, or
        
           b) under the GNU GPL, with none of the additional permissions of
           this License applicable to that copy.
        
          3. Object Code Incorporating Material from Library Header Files.
        
          The object code form of an Application may incorporate material from
        a header file that is part of the Library.  You may convey such object
        code under terms of your choice, provided that, if the incorporated
        material is not limited to numerical parameters, data structure
        layouts and accessors, or small macros, inline functions and templates
        (ten or fewer lines in length), you do both of the following:
        
           a) Give prominent notice with each copy of the object code that the
           Library is used in it and that the Library and its use are
           covered by this License.
        
           b) Accompany the object code with a copy of the GNU GPL and this license
           document.
        
          4. Combined Works.
        
          You may convey a Combined Work under terms of your choice that,
        taken together, effectively do not restrict modification of the
        portions of the Library contained in the Combined Work and reverse
        engineering for debugging such modifications, if you also do each of
        the following:
        
           a) Give prominent notice with each copy of the Combined Work that
           the Library is used in it and that the Library and its use are
           covered by this License.
        
           b) Accompany the Combined Work with a copy of the GNU GPL and this license
           document.
        
           c) For a Combined Work that displays copyright notices during
           execution, include the copyright notice for the Library among
           these notices, as well as a reference directing the user to the
           copies of the GNU GPL and this license document.
        
           d) Do one of the following:
        
               0) Convey the Minimal Corresponding Source under the terms of this
               License, and the Corresponding Application Code in a form
               suitable for, and under terms that permit, the user to
               recombine or relink the Application with a modified version of
               the Linked Version to produce a modified Combined Work, in the
               manner specified by section 6 of the GNU GPL for conveying
               Corresponding Source.
        
               1) Use a suitable shared library mechanism for linking with the
               Library.  A suitable mechanism is one that (a) uses at run time
               a copy of the Library already present on the user's computer
               system, and (b) will operate properly with a modified version
               of the Library that is interface-compatible with the Linked
               Version.
        
           e) Provide Installation Information, but only if you would otherwise
           be required to provide such information under section 6 of the
           GNU GPL, and only to the extent that such information is
           necessary to install and execute a modified version of the
           Combined Work produced by recombining or relinking the
           Application with a modified version of the Linked Version. (If
           you use option 4d0, the Installation Information must accompany
           the Minimal Corresponding Source and Corresponding Application
           Code. If you use option 4d1, you must provide the Installation
           Information in the manner specified by section 6 of the GNU GPL
           for conveying Corresponding Source.)
        
          5. Combined Libraries.
        
          You may place library facilities that are a work based on the
        Library side by side in a single library together with other library
        facilities that are not Applications and are not covered by this
        License, and convey such a combined library under terms of your
        choice, if you do both of the following:
        
           a) Accompany the combined library with a copy of the same work based
           on the Library, uncombined with any other library facilities,
           conveyed under the terms of this License.
        
           b) Give prominent notice with the combined library that part of it
           is a work based on the Library, and explaining where to find the
           accompanying uncombined form of the same work.
        
          6. Revised Versions of the GNU Lesser General Public License.
        
          The Free Software Foundation may publish revised and/or new versions
        of the GNU Lesser General Public License from time to time. Such new
        versions will be similar in spirit to the present version, but may
        differ in detail to address new problems or concerns.
        
          Each version is given a distinguishing version number. If the
        Library as you received it specifies that a certain numbered version
        of the GNU Lesser General Public License "or any later version"
        applies to it, you have the option of following the terms and
        conditions either of that published version or of any later version
        published by the Free Software Foundation. If the Library as you
        received it does not specify a version number of the GNU Lesser
        General Public License, you may choose any version of the GNU Lesser
        General Public License ever published by the Free Software Foundation.
        
          If the Library as you received it specifies that a proxy can decide
        whether future versions of the GNU Lesser General Public License shall
        apply, that proxy's public statement of acceptance of any version is
        permanent authorization for you to choose that version for the
        Library.
        
Project-URL: Homepage, https://github.com/bretttolbert/verbecc
Project-URL: Documentation, https://github.com/bretttolbert/verbecc
Project-URL: Repository, https://github.com/bretttolbert/verbecc.git
Project-URL: Bug Tracker, https://github.com/bretttolbert/verbecc/issues
Project-URL: Changelog, https://github.com/bretttolbert/verbecc/blob/master/CHANGELOG.md
Keywords: català,Catalan,conjugation,conjugator,Education,español,français,French,Italian,italiano,Language Learning,Linguistics,Machine Learning,Natural Language Processing,NLP,português,Portuguese,română,Romanian,Spanish,verb,
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Natural Language :: Catalan
Classifier: Natural Language :: French
Classifier: Natural Language :: Italian
Classifier: Natural Language :: Portuguese
Classifier: Natural Language :: Romanian
Classifier: Natural Language :: Spanish
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Linguistic
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: backports.strenum<2.0,>=1.3.1; python_version < "3.11"
Requires-Dist: cython>=3.1.4
Requires-Dist: dataclass-wizard==0.35.1
Requires-Dist: importlib_resources==6.4.5; python_version < "3.13"
Requires-Dist: importlib_resources==6.5.2; python_version >= "3.13"
Requires-Dist: jsbeautifier<2.0,>=1.15.4
Requires-Dist: lxml-stubs>=0.5.1
Requires-Dist: lxml>=6.0.2
Requires-Dist: numpy==1.26.2; python_version < "3.11"
Requires-Dist: numpy==2.3.3; python_version >= "3.11"
Requires-Dist: pyaml==25.7.0
Requires-Dist: scikit-learn==1.6.1; python_version < "3.10"
Requires-Dist: scikit-learn==1.7.2; python_version >= "3.10"
Requires-Dist: scipy==1.13.1; python_version < "3.10"
Requires-Dist: scipy==1.15.3; python_version == "3.10"
Requires-Dist: scipy==1.16.2; python_version >= "3.11"
Dynamic: license-file

# Python library for verb conjugation in French, Spanish, Catalan, Italian, Portuguese, and Romanian, enhanced by machine learning

- `verbecc` python library
[![Python Package Index Status](https://img.shields.io/pypi/v/verbecc.svg)](https://pypi.python.org/pypi/verbecc) 
[![PyPi Downloads Per Month](https://img.shields.io/pypi/dm/verbecc)](https://pypistats.org/packages/verbecc)
[![GitHub Actions CI status](https://github.com/bretttolbert/verbecc/actions/workflows/python-package.yml/badge.svg)](https://github.com/bretttolbert/verbecc/actions/workflows/python-package.yml?query=branch%3Amain)

##### [EN] Verbs completely conjugated: verb conjugations for French, Spanish, Portuguese, Italian, Romanian and Catalan, enhanced by machine learning
##### [CA] Verbs completament conjugats: conjugacions verbals per a francès, espanyol, portuguès, italià, romanès i català, millorades per l'aprenentatge automàtic
##### [ES] Verbos completamente conjugados: conjugaciones de verbos en francés, español, portugués, italiano, rumano y catalán, mejoradas por aprendizaje automático
##### [FR] Verbes complètement conjugués: conjugaisons des verbes français, espagnol, portugais, italien, roumain et catalan, à l'aide de l'apprentissage automatique
##### [IT] Verbi completamente coniugati: coniugazioni di verbi per francese, spagnolo, portoghese, italiano, rumeno e catalano, migliorate dall'apprendimento automatico
##### [PT] Verbos completamente conjugados: conjugações verbais para francês, espanhol, português, italiano, romeno e catalão, aprimoradas pelo aprendizado de máquina
##### [RO] Verbe complet conjugate: conjugări de verbe pentru franceză, spaniolă, portugheză, italiană, română și catalană, îmbunătățite de învățarea automată

## Contents

- [Quick Start](#quick-start)
- [Live Demo](#live-demo)
- [Example Output](#example-output)
- [What's new in Verbecc 2.0](#whats-new-in-verbecc-20)
- [Academic publications referencing Verbecc](#academic-publications-referencing-verbecc)
- [Typing - Parameter and Data Type Annotations](#typing---parameter-and-data-type-annotations)
- [Multi-Language Conjugation](#multi-language-conjugation)
- [Multi-Language Conjugation using English mood and tense names via `localization` module](#multi-language-conjugation-using-english-mood-and-tense-names-via-localization-module)
- [Credits](#credits)

## Live Demo
- [Web GUI](http://verbe.cc)
- [HTTP API : /verbecc/conjugate/fr/manger](http://verbe.cc/verbecc/conjugate/fr/manger)

### Example Output

| Français / French | Català / Catalan | Español / Castellano / Spanish | Português / Portuguese | Italiano / Italian | Română / Romanian |
| ------ | ------ | ------- | -------- | --------- | ------ |
| [Français / French](./doc/example_output/fr.md) | [Català / Catalan](./doc/example_output/ca.md) | [Español / Castellano /Spanish](./doc/example_output/es.md) | [Português / Portuguese](./doc/example_output/pt.md) | [Italiano / Italian](./doc/example_output/it.md) | [Română / Romanian](./doc/example_output/ro.md) |
| [French `être` (to be)](./doc/example_output/fr.md#french-être-to-be) | [Catalan `ser` (to be)](./doc/example_output/ca.md#example-catalan-ser-to-be) | [Spanish `ser` (to be)](./doc/example_output/es.md#example-spanish-ser-to-be) | [Portuguese `ser` (to be)](./doc/example_output/pt.md#example-portuguese--ser-to-be) | [Italian `essere` (to be)](./doc/example_output/it.md#italian-essere-to-be) | [Romanian `fi` (to be)](./doc/example_output/ro.md#romanian-fi-to-be) |
| [French `se lever` (to lift oneself)](./doc/example_output/fr.md#french-se-lever-to-lift-oneself) |  |  |  |  |  |
| [French `ubériser` (to "uberize") (unknown verb conjugated with ML template prediction))](./doc/example_output/fr.md#ml-prediction-french-uberiser-to-uberize) |  |  |  |  |  |

## Features
* **Multilingual**
    * Conjugate verbs in six romance languages: French, Spanish, Portuguese, Italian, Romanian, Catalan
    * Includes Spanish voseo conjugation, with regional options in development.
    * Predict conjugation of unknown verbs with 99% accuracy using machine learning techniques
    * Conjugate thousands of known verbs without machine learning, using simple string transformations based on XML conjugation templates
* **Complete**
    * Includes both simple and compound conjugations (i.e. with helping/auxiliary verbs)
    * Includes alternate conjugations (for regional variations, e.g. Catalan vs. Valencian)
    * Includes inflections for all genders where applicable
    * Includes inlections for misc. pronouns such as the Spanish pronouns `usted` and `ustedes` and the French pronoun `on`.
* **Quality**
    * Fully type-annotated python library
        * Unit-tests require type-annotations on everything
    * Typed return data
    * Meticulously organized source tree
    * Has a plethora of unit-tests to ensure correctness of verb conjugations
    * Continuous Integration with GitHub Actions CI/CD pipeline
        * CI tests python 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14.
    * Dependencies: `scikit-learn`, `scipy`, `numpy`, `lxml`, `pyaml`, `jsbeautifier`, `importlib_resources`
* **Trusted**
    * Cited in [academic publications](#academic-publications-referencing-verbecc)


## Quick Start
```bash
git clone https://github.com/bretttolbert/verbecc.git
cd verbecc
pip install .
```

### Academic publications referencing verbecc

- [Segura Lores, Alba. (2025) Estudio de la variación del sujeto pronominal en la ciudad de Málaga: sociolingüística cognitiva de su producción y percepción. Universität Heidelberg. pp. 69. [DOI:10.11588/heidok.00037508]](https://nbn-resolving.org/urn:nbn:de:bsz:16-heidok-375088)


### What's new in Verbecc 2.0

| verbecc 1.x | verbecc 2.x |
| --- | --- |
| `lang='fr'` | `lang=Lang.fr` / `from verbecc import LangCodeISO639_1 as Lang` |
| `mood="indicatif"` | `mood=Moods.fr.Indicatif` / `from verbecc import Moods` |
| `tense="présent"` | `tense=Tenses.fr.Présent` / `from verbecc import Tenses` |
| `gender='f'` | `gender=Gender.f` / `from verbecc import Gender` |
| `person="1s"` | `person=Person.First, number=Number.Singular` / `from verbecc import Person, Number` | 
| Conjugations include masculine pronouns (default) or feminine but not both | All pronouns, including both masculine and feminine third-person pronouns are included | 
| `lang_specific_options` is a parameter of the `conjugate` method | `lang_specific_options` is a parameter of the `CompleteConjugator` class constructor |
| `gender` is a parameter of the `conjugate` method | there is no `gender` parameter, instead all possible gender inflections are returned |
| `alternate_options` is a parameter of the `conjugate` method | there is no `alternate_options` parameter, instead all possible conjugations, including alternates, are returned (use `c[0]` to get default conjugation, `c[1]` to get first alternate, etc.) |
| Spanish Conjugations include `tú` (default) or `vos` but not both | All pronouns, including both `tú` and `vos` are included | 
| Pronouns such as French `on` and Spanish `usted/ustedes` not included | French `on` and Spanish `usted/ustedes` pronouns are included |
| Array index is used to determine `Person`, i.e. `1s, 2s, 3s, 1p, 2p, 3p` | Each `Conjugation` object in the `TenseConjugation` has `Person`, `Number` and `Gender` values (any of which may be `None` if not-applicable) |
| Returned objects are primitive (`Dict`) data types | Returned wrapper objects are subclasses of `AbstractConjugation` (e.g. `CompleteConjugation`) with `get_data()` and `to_json()` methods |
| `Conjugator` returns `CompleteConjugationData` | `CompleteConjugator` returns wrapper type `CompleteConjugation`, `CompleteConjugation.get_data()` returns `CompleteConjugationData` |
| (no wrapper types) | Wrapper types hierarchy: `CompleteConjugation` > `MoodsConjugation` > `MoodConjugation` > `TenseConjugation` > `Conjugation` -> `conjugations: List[str]` |
| Primitive data types hierarchy: `Conjugation` > `MoodsConjugation` > `MoodConjugation` > `TenseConjugation` > `PersonConjugation` | Primitive data types hierarchy: `CompleteConjugationData` > `MoodsConjugationData` > `MoodConjugationData` > `TenseConjugationData` > `ConjugationData` -> `conjugations: List[str]` |
| `pred_score` was always included in the output | `pred_score` is only included in output if `predicted` is `true` |
| Only returned primitive Python data | `Conjugation` objects have both `.to_json()` and `.to_yaml()` methods | | 

### Typing - Parameter and Data Type Annotations

Originally `verbecc` used strings for most parameters. `verbecc` is now fully type-annotated but strings are still supported for backwards-compatibility and ease of use. This is accomplished using `StrEnum` for parameters and by defining a hierarchy of `typing` type definitions for the returned data objects (See [conjugation.py](./verbecc/src/defs/types/conjugation/conjugation.py)).

E.g.:

```python
>>> from verbecc import grammar_defines, localization, Moods, Tenses, Person, Number, Gender, LangCodeISO639_1 as Lang
>>> xmood = localization.xmood
>>> xtense = localization.xtense
>>> grammar_defines.SUPPORTED_LANGUAGES[Lang.fr]
'français'
>>> xtense(Lang.fr, Tenses.en.Present)
<TenseFr.Présent: 'présent'>
>>> xmood(Lang.fr, Moods.en.Subjunctive)
<MoodFr.Subjonctif: 'subjonctif'>
>>> Gender.f
<Gender.f: 'f'>
>>> Number.Singular
<Number.Singular: 's'>
>>> Person.First
<Person.First: '1'>
```

### Multi-Language Conjugation

```python
>>> from functools import partial
>>> from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, grammar_defines, Moods, Tenses
>>> ccgs = {lang : CompleteConjugator(lang) for lang in grammar_defines.SUPPORTED_LANGUAGES}

>>> print([c[0] for c in ccgs[Lang.fr].conjugate('être')[Moods.fr.Indicatif][Tenses.fr.Présent]])
['je suis', 'tu es', 'il est', 'elle est', 'on est', 'nous sommes', 'vous êtes', 'ils sont', 'elles sont']
>>> print([c[0] for c in ccgs[Lang.es].conjugate('ser')[Moods.es.Indicativo][Tenses.es.Presente]])
['yo soy', 'tú eres', 'vos sos', 'él es', 'ella es', 'usted es', 'nosotros somos', 'vosotros sois', 'ellos son', 'ellas son', 'ustedes son']
>>> print([c[0] for c in ccgs[Lang.ca].conjugate('ser')[Moods.ca.Indicatiu][Tenses.ca.Present]])
['jo sóc', 'tu ets', 'ell és', 'ella és', 'nosaltres som', 'vosaltres sou', 'ells són', 'elles són']
>>> print([c[0] for c in ccgs[Lang.pt].conjugate('ser')[Moods.pt.Indicativo][Tenses.pt.Presente]])
['eu sou', 'tu és', 'ele é', 'ela é', 'nós somos', 'vós sois', 'eles são', 'elas são']
>>> print([c[0] for c in ccgs[Lang.it].conjugate('essere')[Moods.it.Indicativo][Tenses.it.Presente]])
['io sono', 'tu sei', 'lui è', 'lei è', 'noi siamo', 'voi siete', 'loro sono']
>>> print([c[0] for c in ccgs[Lang.it].conjugate('essere')[Moods.it.Indicativo][Tenses.it.Presente]])
['io sono', 'tu sei', 'lui è', 'lei è', 'noi siamo', 'voi siete', 'loro sono']
>>> print([c[0] for c in ccgs[Lang.ro].conjugate('fi')[Moods.ro.Indicativ][Tenses.ro.Prezent]])
['eu sunt', 'tu ești', 'el e', 'ea e', 'noi suntem', 'voi sunteţi', 'ei sunt', 'ele sunt']
```

### Multi-Language Conjugation using English mood and tense names via localization module

Observe below that strings may be still used for mood and tense, rather than the `Mood` and `Tense` (`StrEnum`) types. E.g. `indicative` is interchangeable with `Moods.en.Indicative` and `present` is interchangeable with `Tenses.en.Present`.

```python
>>> from verbecc import CompleteConjugator, localization
>>> def xconj(lang, infinitive, mood, tense):
    m = localization.xmood(lang, mood)
    t = localization.xtense(lang, tense)
    cc = CompleteConjugator(lang).conjugate(infinitive)
    return [c[0] for c in cc[m][t]]

>>> xconj('fr', 'etre', 'indicative', 'present')
['je suis', 'tu es', 'il est', 'elle est', 'on est', 'nous sommes', 'vous êtes', 'ils sont', 'elles sont']
>>> xconj('es', 'ser', 'indicative', 'present')
['yo soy', 'tú eres', 'vos sos', 'él es', 'ella es', 'usted es', 'nosotros somos', 'vosotros sois', 'ellos son', 'ellas son', 'ustedes son']
>>> xconj('pt', 'ser', 'indicative', 'present')
['eu sou', 'tu és', 'ele é', 'ela é', 'nós somos', 'vós sois', 'eles são', 'elas são']
>>> xconj('ca', 'ser', 'indicative', 'present')
['jo sóc', 'tu ets', 'ell és', 'ella és', 'nosaltres som', 'vosaltres sou', 'ells són', 'elles són']
>>> xconj('it', 'essere', 'indicative', 'present')
['io sono', 'tu sei', 'lui è', 'lei è', 'noi siamo', 'voi siete', 'loro sono']
>>> xconj('ro', 'fi', 'indicative', 'present')
['eu sunt', 'tu ești', 'el e', 'ea e', 'noi suntem', 'voi sunteţi', 'ei sunt', 'ele sunt']
```

### Credits
- Created with the help of [scikit-learn](https://scikit-learn.org), [lxml](https://github.com/lxml/lxml), [pytest](https://docs.pytest.org) and [python](https://www.python.org/)
- French verb conjugation template XML files derived from Pierre Sarrazin's C++ program [Verbiste](https://perso.b2b2c.ca/~sarrazip/dev/verbiste.html). 
- Conjugation XML files (Verbiste format) for Spanish, Portuguese, Italian and Romanian and machine-learning conjugation template prediction for unknown verbs dervied from Sekou Diao's older project [mlconjug](https://github.com/SekouD/mlconjug) however they have a newer version out now: [mlconjug3](https://github.com/SekouDiaoNlp/mlconjug3/)
- Catalan verbs list imported from [catverbs](https://github.com/bpeel/catverbs)
