### Install Verbecc Library using Pip Source: https://github.com/bretttolbert/verbecc/blob/main/README.md This snippet shows how to clone the Verbecc repository and install it locally using pip. It assumes you have git and pip installed. ```bash git clone https://github.com/bretttolbert/verbecc.git cd verbecc pip install . ``` -------------------------------- ### Query Database Utility Methods Source: https://context7.com/bretttolbert/verbecc/llms.txt Provides examples of utility methods to list all infinitives, retrieve available conjugation templates, and search for verbs by prefix. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.fr) infinitives = ccg.get_infinitives() templates = ccg.get_template_names() results = ccg.get_verbs_that_start_with("lev", max_results=10) print(results) ``` -------------------------------- ### GET /verbs/search Source: https://context7.com/bretttolbert/verbecc/llms.txt Search for verbs starting with a specific prefix. ```APIDOC ## GET /verbs/search ### Description Retrieves a list of verbs that begin with the provided prefix string. ### Method GET ### Endpoint /verbs/search ### Parameters #### Query Parameters - **prefix** (string) - Required - The starting characters of the verbs to search for. - **max_results** (integer) - Optional - The maximum number of results to return. ### Request Example GET /verbs/search?prefix=se+lev&max_results=10 ### Response #### Success Response (200) - **results** (array) - A list of matching verb strings. #### Response Example ["se lever", "se léviger", "se levretter"] ``` -------------------------------- ### Search and Find Verbs with Verbecc Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates how to search for verbs starting with a specific prefix and find conjugation templates using the Verbecc library. It shows basic usage for retrieving verb lists and template names. ```python results = ccg.get_verbs_that_start_with("se lev", max_results=10) print(results) # ['se lever', 'se léviger', 'se levretter'] template = ccg.find_template("aim:er") print(template.name) # aim:er ``` -------------------------------- ### Reflexive Verb Conjugation (Python) Source: https://context7.com/bretttolbert/verbecc/llms.txt Illustrates how Verbecc handles reflexive verbs in French, automatically including the correct reflexive pronouns. Examples include present tense and passé composé. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses ccg = CompleteConjugator(Lang.fr) # French reflexive verb "se lever" (to get up) cc = ccg.conjugate("se lever") # Present tense with reflexive pronouns tc = cc[Moods.fr.Indicatif][Tenses.fr.Présent] print([c[0] for c in tc]) # ['je me lève', 'tu te lèves', 'il se lève', 'elle se lève', 'on se lève', # 'nous nous levons', 'vous vous levez', 'ils se lèvent', 'elles se lèvent'] # Passé composé (reflexive verbs use être) tc = cc[Moods.fr.Indicatif][Tenses.fr.PasséComposé] print([c[0] for c in tc]) # ['je me suis levée', 'je me suis levé', 'tu t'es levée', 'tu t'es levé', ...] ``` -------------------------------- ### TenseConjugator for Specific Tense Conjugations Source: https://context7.com/bretttolbert/verbecc/llms.txt Illustrates how to use the TenseConjugator to get conjugation forms for a specific mood and tense, including metadata like person, number, and pronouns. ```python from verbecc import TenseConjugator, LangCodeISO639_1 as Lang, Moods, Tenses tcg = TenseConjugator(lang=Lang.it) tc = tcg.conjugate_mood_tense("essere", Moods.it.Indicativo, Tenses.it.Presente) for conj in tc: person = conj.get_person() number = conj.get_number() pronoun = conj.get_pronoun() forms = conj.get_conjugations() print(f"{pronoun} -> {forms[0]}") ``` -------------------------------- ### GET /conjugate/{verb} Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/it.md Retrieves the full conjugation details for a specified verb in a given language. ```APIDOC ## GET /conjugate/{verb} ### Description Retrieves the complete conjugation table for a specific verb. The library trains a model on the first run and caches it for subsequent requests. ### Method GET ### Endpoint /conjugate/{verb} ### Parameters #### Path Parameters - **verb** (string) - Required - The infinitive form of the verb to conjugate. #### Query Parameters - **lang** (string) - Required - The ISO 639-1 language code (e.g., 'it' for Italian). ### Request Example GET /conjugate/essere?lang=it ### Response #### Success Response (200) - **conjugation** (object) - The full object containing all moods and tenses. #### Response Example { "verb": "essere", "moods": { "indicativo": { "presente": ["sono", "sei", "è", "siamo", "siete", "sono"] } } } ``` -------------------------------- ### GET /templates/{template_id} Source: https://context7.com/bretttolbert/verbecc/llms.txt Retrieve a specific conjugation template by its identifier. ```APIDOC ## GET /templates/{template_id} ### Description Fetches the details of a specific conjugation template used by the library. ### Method GET ### Endpoint /templates/{template_id} ### Parameters #### Path Parameters - **template_id** (string) - Required - The unique identifier for the conjugation template (e.g., 'aim:er'). ### Request Example GET /templates/aim:er ### Response #### Success Response (200) - **name** (string) - The name of the template. #### Response Example { "name": "aim:er" } ``` -------------------------------- ### GET /conjugate/{verb} Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/ca.md Retrieves the conjugation data for a specified verb in a target language. ```APIDOC ## GET /conjugate/{verb} ### Description Conjugates a given verb using the Verbecc CompleteConjugator model for a specified language. ### Method GET ### Endpoint /conjugate/{verb} ### Parameters #### Path Parameters - **verb** (string) - Required - The infinitive form of the verb to conjugate. #### Query Parameters - **lang** (string) - Required - The ISO 639-1 language code (e.g., 'ca' for Catalan). ### Request Example GET /conjugate/ser?lang=ca ### Response #### Success Response (200) - **conjugation_data** (object) - The full conjugation table for the requested verb. #### Response Example { "verb": "ser", "moods": { "indicative": { "present": ["sóc", "ets", "és", "som", "sou", "són"] } } } ``` -------------------------------- ### ML Prediction for French Verb 'ubériser' with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/fr.md This example illustrates how Verbecc can predict the conjugation of French verbs not explicitly present in its dataset, such as 'ubériser' (to _Uberize_). It utilizes a machine-learning model trained on Verbecc's French verb data. The conjugation is initiated by creating a CompleteConjugator for French and then conjugating the unknown verb. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.fr) cc = ccg.conjugate('ubériser') print(cc.to_json()) ``` -------------------------------- ### Configure Verb Conjugation Options Source: https://github.com/bretttolbert/verbecc/blob/main/CHANGELOG.md Demonstrates how to configure verb conjugation output using the include_alternates and conjugate_pronouns parameters. This allows users to toggle between standard scalar outputs and lists of alternate forms. ```json "condicional": { "present": [ "jo seria", "tu series", "ell seria", "nosaltres seríem", "vosaltres seríeu", "ells serien" ] } ``` ```json "condicional": { "present": [ ["seria", "fora"], ["series", "fores"], ["seria", "fora"], ["seríem", "fórem"], ["seríeu", "fóreu"], ["serien", "foren"] ] } ``` -------------------------------- ### Performing Multi-Language Conjugation Source: https://github.com/bretttolbert/verbecc/blob/main/README.md Shows how to initialize a CompleteConjugator for various languages and retrieve conjugated verb forms. It iterates through supported languages to demonstrate the conjugation of the verb 'to be'. ```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]]) print([c[0] for c in ccgs[Lang.es].conjugate('ser')[Moods.es.Indicativo][Tenses.es.Presente]]) print([c[0] for c in ccgs[Lang.ca].conjugate('ser')[Moods.ca.Indicatiu][Tenses.ca.Present]]) print([c[0] for c in ccgs[Lang.pt].conjugate('ser')[Moods.pt.Indicativo][Tenses.pt.Presente]]) print([c[0] for c in ccgs[Lang.it].conjugate('essere')[Moods.it.Indicativo][Tenses.it.Presente]]) print([c[0] for c in ccgs[Lang.ro].conjugate('fi')[Moods.ro.Indicativ][Tenses.ro.Prezent]]) ``` -------------------------------- ### Multi-Language Conjugation Support Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates initializing conjugators for multiple supported languages using the library's built-in language definitions. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses, grammar_defines conjugators = {lang: CompleteConjugator(lang) for lang in grammar_defines.SUPPORTED_LANGUAGES} fr_conj = conjugators[Lang.fr].conjugate("parler") print([c[0] for c in fr_conj[Moods.fr.Indicatif][Tenses.fr.Présent]]) ``` -------------------------------- ### Configure Regional Spanish Voseo Source: https://context7.com/bretttolbert/verbecc/llms.txt Shows how to apply different regional voseo variants in Spanish conjugation by passing specific options to the CompleteConjugator constructor. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses, LangSpecificOptionsEs, VoseoOptions # Classical voseo (Type 1) ccg_tipo1 = CompleteConjugator(Lang.es, lang_specific_options=LangSpecificOptionsEs(VoseoOptions.VoseoTipo1)) # Chilean voseo ccg_chileno = CompleteConjugator(Lang.es, lang_specific_options=LangSpecificOptionsEs(VoseoOptions.VoseoChileno)) ``` -------------------------------- ### Conjugate Spanish Reflexive Verbs Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates how to initialize the CompleteConjugator for Spanish and retrieve specific mood and tense conjugations for reflexive verbs like 'levantarse'. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses es_ccg = CompleteConjugator(Lang.es) es_cc = es_ccg.conjugate("levantarse") tc = es_cc[Moods.es.Indicativo][Tenses.es.Presente] print([c[0] for c in tc]) ``` -------------------------------- ### Conjugate Verbs in Multiple Languages (Python) Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates conjugating the verb 'ser' (to be) in its present indicative tense for Spanish, Portuguese, Catalan, Italian, and Romanian. It shows how to access conjugations using language-specific mood and tense constants. ```python from verbecc import conjugators, Lang, Moods, Tenses # Spanish conjugation es_conj = conjugators[Lang.es].conjugate("ser") print([c[0] for c in es_conj[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'] # Portuguese conjugation pt_conj = conjugators[Lang.pt].conjugate("ser") print([c[0] for c in pt_conj[Moods.pt.Indicativo][Tenses.pt.Presente]]) # ['eu sou', 'tu és', 'ele é', 'ela é', 'nós somos', 'vós sois', 'eles são', 'elas são'] # Catalan conjugation ca_conj = conjugators[Lang.ca].conjugate("ser") print([c[0] for c in ca_conj[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'] # Italian conjugation it_conj = conjugators[Lang.it].conjugate("essere") print([c[0] for c in it_conj[Moods.it.Indicativo][Tenses.it.Presente]]) # ['io sono', 'tu sei', 'lui è', 'lei è', 'noi siamo', 'voi siete', 'loro sono'] # Romanian conjugation ro_conj = conjugators[Lang.ro].conjugate("fi") print([c[0] for c in ro_conj[Moods.ro.Indicativ][Tenses.ro.Prezent]]) # ['eu sunt', 'tu ești', 'el e', 'ea e', 'noi suntem', 'voi sunteți', 'ei sunt', 'ele sunt'] ``` -------------------------------- ### Import Language Enum Source: https://github.com/bretttolbert/verbecc/blob/main/CHANGELOG.md Shows the recommended way to import the language enumeration for use in conjugation methods. ```python from verbecc import LangCodeISO639_1 as Lang ``` -------------------------------- ### Conjugate with English Mood/Tense Names (Python) Source: https://context7.com/bretttolbert/verbecc/llms.txt Shows how to use the localization module to conjugate verbs using English mood and tense names, which are then translated to the target language. This improves code readability for English speakers. ```python from verbecc import CompleteConjugator, localization, Moods, Tenses, LangCodeISO639_1 as Lang def conjugate_with_english_names(lang, infinitive, mood, tense): """Helper function using English mood/tense names.""" # Translate English mood/tense to target language target_mood = localization.xmood(lang, mood) target_tense = localization.xtense(lang, tense) cc = CompleteConjugator(lang).conjugate(infinitive) return [c[0] for c in cc[target_mood][target_tense]] # Use English names across all languages print(conjugate_with_english_names(Lang.fr, "etre", Moods.en.Indicative, Tenses.en.Present)) # ['je suis', 'tu es', 'il est', 'elle est', 'on est', 'nous sommes', 'vous êtes', 'ils sont', 'elles sont'] print(conjugate_with_english_names(Lang.es, "ser", Moods.en.Indicative, Tenses.en.Present)) # ['yo soy', 'tú eres', 'vos sos', 'él es', 'ella es', 'usted es', ...] print(conjugate_with_english_names(Lang.it, "essere", Moods.en.Indicative, Tenses.en.Present)) # ['io sono', 'tu sei', 'lui è', 'lei è', 'noi siamo', 'voi siete', 'loro sono'] # String values also work (backwards compatible) print(conjugate_with_english_names(Lang.fr, "parler", "indicative", "present")) # ['je parle', 'tu parles', 'il parle', ...] ``` -------------------------------- ### Conjugating with Localized Mood and Tense Names Source: https://github.com/bretttolbert/verbecc/blob/main/README.md Illustrates the use of the localization module to perform conjugations using English strings for mood and tense. This provides a simplified interface for users who prefer not to use the specific StrEnum types. ```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') xconj('es', 'ser', 'indicative', 'present') xconj('pt', 'ser', 'indicative', 'present') xconj('ca', 'ser', 'indicative', 'present') xconj('it', 'essere', 'indicative', 'present') xconj('ro', 'fi', 'indicative', 'present') ``` -------------------------------- ### Python Import Statements (Preferred) Source: https://github.com/bretttolbert/verbecc/blob/main/STYLE_GUIDE.md Demonstrates the preferred method for Python import statements, avoiding parentheses for easier sorting. This style is recommended to maintain consistency and facilitate automated sorting of imports. ```python from verbecc.src.conjugator.conjugation_object import ConjugationObjects from verbecc.src.defs.types.data.person_ending import PersonEnding from verbecc.src.defs.types.data.tense_template import TenseTemplate from verbecc.src.defs.types.gender import Gender from verbecc.src.defs.types.lang_code import LangCodeISO639_1 from verbecc.src.defs.types.lang_specific_options import LangSpecificOptions from verbecc.src.defs.types.lang_specific_options import LangSpecificOptionsEs from verbecc.src.defs.types.lang_specific_options import LangSpecificOptionsFactory from verbecc.src.defs.types.lang_specific_options import VoseoOptions from verbecc.src.defs.types.mood import Mood, Moods from verbecc.src.defs.types.number import Number from verbecc.src.defs.types.person import Person from verbecc.src.defs.types.tense import Tense, Tenses from verbecc.src.inflectors.inflector import Inflector from verbecc.src.utils.string_utils import strip_accents ``` -------------------------------- ### Conjugate Italian Verbs with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/it.md Initializes the CompleteConjugator for Italian, conjugates the verb 'essere', and outputs the result in both JSON and YAML formats. Note that the first execution may take time to train the model before saving it for future use. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.it) cc = ccg.conjugate('essere') print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### Using Type Annotations for Grammar Definitions Source: https://github.com/bretttolbert/verbecc/blob/main/README.md Demonstrates how to use StrEnum types for language, mood, tense, and person definitions in verbecc. This approach ensures type safety while maintaining compatibility with the library's internal data structures. ```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) # xmood(Lang.fr, Moods.en.Subjunctive) # Gender.f # Number.Singular # Person.First # ``` -------------------------------- ### Conjugate Portuguese Verbs with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/pt.md Initializes the CompleteConjugator for the Portuguese language and conjugates a specific verb. The output can be exported into JSON or YAML formats. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.pt) cc = ccg.conjugate('ser') print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### Conjugate Spanish Verbs with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/es.md Initializes the CompleteConjugator for the Spanish language and conjugates the verb 'ser'. The resulting object provides methods to export conjugation data into JSON or YAML formats. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(lang=Lang.es) cc = ccg.conjugate('ser') print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### CompleteConjugator Usage for Full Verb Conjugation Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates how to use the CompleteConjugator class to retrieve all moods and tenses for a verb. It includes accessing verb metadata and exporting results to JSON or YAML. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses ccg = CompleteConjugator(Lang.fr) cc = ccg.conjugate("être") verb_info = cc.get_verb_info() print(f"Infinitive: {verb_info.infinitive}") indicatif = cc[Moods.fr.Indicatif] present = indicatif[Tenses.fr.Présent] for conjugation in present: print(conjugation[0]) print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### Conjugate Catalan 'ser' verb using Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/ca.md This Python snippet shows how to conjugate the Catalan verb 'ser' using the `CompleteConjugator` from the Verbecc library. It initializes the conjugator for Catalan and then conjugates the verb, printing the result in both JSON and YAML formats. The first run may take time to train the model. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.ca) # If this is the first run, it will take a minute for the model to train, # but it should save the model .zip file and run fast subsequently cc = ccg.conjugate('ser') print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### Compound Tenses with Auxiliary Verbs (Python) Source: https://context7.com/bretttolbert/verbecc/llms.txt Demonstrates Verbecc's ability to handle compound tenses, such as Passé Composé and Plus-que-parfait, in French. It shows automatic handling of auxiliary verbs (avoir/être) and gender agreement. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses ccg = CompleteConjugator(Lang.fr) # Passé composé with 'avoir' (no gender agreement) tc = ccg.conjugate_mood_tense("manger", Moods.fr.Indicatif, Tenses.fr.PasséComposé) print([c[0] for c in tc]) # ['j'ai mangé', 'tu as mangé', 'il a mangé', 'elle a mangé', 'on a mangé', # 'nous avons mangé', 'vous avez mangé', 'ils ont mangé', 'elles ont mangé'] # Passé composé with 'être' (gender agreement required) tc = ccg.conjugate_mood_tense("aller", Moods.fr.Indicatif, Tenses.fr.PasséComposé) print([c[0] for c in tc]) # ['je suis allée', 'je suis allé', 'tu es allée', 'tu es allé', 'il est allé', # 'elle est allée', 'on est allée', 'on est allé', 'nous sommes allées', # 'nous sommes allés', 'vous êtes allées', 'vous êtes allés', # 'ils sont allés', 'elles sont allées'] # Plus-que-parfait (pluperfect) tc = ccg.conjugate_mood_tense("aller", Moods.fr.Indicatif, Tenses.fr.PlusQueParfait) print([c[0] for c in tc]) # ['j'étais allée', 'j'étais allé', 'tu étais allée', ...] # Conditional past tc = ccg.conjugate_mood_tense("aller", Moods.fr.Conditionnel, Tenses.fr.Passé) print([c[0] for c in tc]) # ['je serais allée', 'je serais allé', 'tu serais allée', ...] ``` -------------------------------- ### Conjugate Romanian Verb 'fi' using Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/ro.md Initializes the CompleteConjugator for Romanian and performs conjugation on the verb 'fi'. The resulting object provides methods to export conjugation data into JSON or YAML formats. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.ro) cc = ccg.conjugate('fi') print(cc.to_json()) print(cc.to_yaml()) ``` -------------------------------- ### POST /conjugate Source: https://context7.com/bretttolbert/verbecc/llms.txt Conjugate a specific verb in a target language by specifying the infinitive form, mood, and tense. ```APIDOC ## POST /conjugate ### Description Conjugates a given verb for a specific language, mood, and tense. Supports automatic handling of auxiliary verbs and reflexive pronouns. ### Method POST ### Endpoint /conjugate ### Parameters #### Request Body - **lang** (string) - Required - ISO 639-1 language code (e.g., 'fr', 'es', 'it'). - **infinitive** (string) - Required - The base form of the verb to conjugate. - **mood** (string) - Required - The grammatical mood (e.g., 'Indicative', 'Subjunctive'). - **tense** (string) - Required - The grammatical tense (e.g., 'Present', 'Past'). ### Request Example { "lang": "fr", "infinitive": "se lever", "mood": "Indicative", "tense": "Present" } ### Response #### Success Response (200) - **conjugations** (array) - A list of conjugated strings including pronouns. #### Response Example { "conjugations": ["je me lève", "tu te lèves", "il se lève", "elle se lève", "on se lève", "nous nous levons", "vous vous levez", "ils se lèvent", "elles se lèvent"] } ``` -------------------------------- ### MoodConjugator for Specific Grammatical Moods Source: https://context7.com/bretttolbert/verbecc/llms.txt Shows how to use the MoodConjugator to retrieve all tenses within a specific grammatical mood. This is useful for focused conjugation tasks. ```python from verbecc import MoodConjugator, LangCodeISO639_1 as Lang, Moods, Tenses mcg = MoodConjugator(lang=Lang.es) mood_conj = mcg.conjugate_mood("hablar", Moods.es.Indicativo) presente = mood_conj[Tenses.es.Presente] for c in presente: print(c[0]) tense_conj = mcg.conjugate_mood_tense("comer", Moods.es.Subjuntivo, Tenses.es.Presente) for c in tense_conj: print(f"{c.get_pronoun()}: {c[0]}") ``` -------------------------------- ### Python Import Statements (Avoid) Source: https://github.com/bretttolbert/verbecc/blob/main/STYLE_GUIDE.md Illustrates the discouraged method for Python import statements, which uses parentheses. This format hinders automated sorting of imports, making code maintenance more difficult. ```python from verbecc.src.conjugator.conjugation_object import ConjugationObjects from verbecc.src.defs.types.data.person_ending import PersonEnding from verbecc.src.defs.types.data.tense_template import TenseTemplate from verbecc.src.defs.types.gender import Gender from verbecc.src.defs.types.lang_code import LangCodeISO639_1 from verbecc.src.defs.types.lang_specific_options import ( LangSpecificOptions, LangSpecificOptionsEs, LangSpecificOptionsFactory, VoseoOptions, ) from verbecc.src.defs.types.mood import Mood, Moods from verbecc.src.defs.types.number import Number from verbecc.src.defs.types.person import Person from verbecc.src.defs.types.tense import Tense, Tenses from verbecc.src.inflectors.inflector import Inflector from verbecc.src.utils.string_utils import strip_accents ``` -------------------------------- ### Conjugate Verbs Source: https://github.com/bretttolbert/verbecc/blob/main/README.md Perform verb conjugation for a specific language, mood, and tense. ```APIDOC ## POST /conjugate ### Description Conjugates a given infinitive verb based on the specified language, mood, and tense. Supports both native language enums and English-based localization strings. ### Method POST ### Endpoint /conjugate ### Parameters #### Request Body - **lang** (string) - Required - ISO 639-1 language code (e.g., 'fr', 'es', 'it'). - **infinitive** (string) - Required - The verb in its infinitive form. - **mood** (string) - Required - The grammatical mood (e.g., 'indicative'). - **tense** (string) - Required - The grammatical tense (e.g., 'present'). ### Request Example { "lang": "fr", "infinitive": "etre", "mood": "indicative", "tense": "present" } ### Response #### Success Response (200) - **conjugations** (array) - List of conjugated verb forms. #### Response Example { "conjugations": ["je suis", "tu es", "il est", "elle est", "on est", "nous sommes", "vous êtes", "ils sont", "elles sont"] } ``` -------------------------------- ### Verbecc 1.x vs 2.x API Changes Source: https://github.com/bretttolbert/verbecc/blob/main/README.md This table highlights the key differences in API usage between Verbecc version 1.x and 2.x, focusing on language codes, moods, tenses, gender, person, and pronoun handling. It also details changes in data structures and return types. ```python # Verbecc 1.x example (conceptual) # conjugate(verb='manger', lang='fr', mood='indicatif', tense='présent', gender='f', person='1s') # Verbecc 2.x example (conceptual) # from verbecc import LangCodeISO639_1 as Lang, Moods, Tenses, Gender, Person, Number # conjugator = CompleteConjugator(lang=Lang.fr) # conjugations = conjugator.conjugate(mood=Moods.fr.Indicatif, tense=Tenses.fr.Présent) # for c in conjugations: # print(c.get_data()) ``` -------------------------------- ### CompleteConjugator API Source: https://context7.com/bretttolbert/verbecc/llms.txt Provides full verb conjugation across all moods and tenses for a specified language. ```APIDOC ## GET /conjugate/complete ### Description Retrieves the full conjugation table for a given verb in a specified language, including all moods and tenses. ### Method GET ### Endpoint /conjugate/complete ### Parameters #### Query Parameters - **verb** (string) - Required - The infinitive form of the verb to conjugate. - **lang** (string) - Required - ISO 639-1 language code (e.g., 'fr', 'es', 'it'). ### Request Example GET /conjugate/complete?verb=être&lang=fr ### Response #### Success Response (200) - **infinitive** (string) - The verb infinitive. - **conjugations** (object) - A nested object mapping moods to tenses and their respective forms. #### Response Example { "infinitive": "être", "conjugations": { "Indicatif": { "Présent": ["je suis", "tu es", "il est", ...] } } } ``` -------------------------------- ### POST /conjugate Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/pt.md Conjugates a given verb in the specified language and returns the result in a structured format. ```APIDOC ## POST /conjugate ### Description Conjugates a verb based on the provided language code and verb string. The process initializes a model if not already present. ### Method POST ### Endpoint /conjugate ### Parameters #### Request Body - **verb** (string) - Required - The infinitive form of the verb to conjugate. - **lang** (string) - Required - The ISO 639-1 language code (e.g., 'pt'). ### Request Example { "verb": "ser", "lang": "pt" } ### Response #### Success Response (200) - **conjugation** (object) - The full conjugation table for the requested verb. #### Response Example { "verb": "ser", "moods": { "indicative": { "present": { "eu": "sou", "tu": "és", "ele": "é" } } } } ``` -------------------------------- ### Predict Conjugations for Unknown Verbs Source: https://context7.com/bretttolbert/verbecc/llms.txt Utilizes Verbecc's machine learning capabilities to predict conjugation patterns for verbs not present in the database. It returns a prediction score and indicates whether the result was inferred. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses ccg = CompleteConjugator(Lang.fr) cc = ccg.conjugate("ubériser") verb_info = cc.get_verb_info() print(f"Predicted: {verb_info.predicted}") print(f"Prediction score: {verb_info.pred_score}") tc = ccg.conjugate_mood_tense("ubériser", Moods.fr.Indicatif, Tenses.fr.Présent) print([c[0] for c in tc]) ``` -------------------------------- ### Represent Non-Conjugated Tenses Source: https://github.com/bretttolbert/verbecc/blob/main/CHANGELOG.md Shows the structure used to represent tenses that do not have conjugations for specific persons, using a '-' placeholder. ```python [ "-", "-", "ella cal", "-", "-", "elles calen" ] ``` -------------------------------- ### TenseConjugator API Source: https://context7.com/bretttolbert/verbecc/llms.txt Provides conjugation for a specific mood and tense combination. ```APIDOC ## GET /conjugate/tense ### Description Retrieves the conjugation for a specific mood and tense combination. ### Method GET ### Endpoint /conjugate/tense ### Parameters #### Query Parameters - **verb** (string) - Required - The infinitive form of the verb. - **lang** (string) - Required - ISO 639-1 language code. - **mood** (string) - Required - The grammatical mood. - **tense** (string) - Required - The grammatical tense. ### Request Example GET /conjugate/tense?verb=essere&lang=it&mood=Indicativo&tense=Presente ### Response #### Success Response (200) - **forms** (array) - List of conjugated forms for the requested tense. #### Response Example { "forms": ["io sono", "tu sei", "lui è", ...] } ``` -------------------------------- ### Conjugate French Reflexive Verb 'se lever' with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/fr.md This snippet demonstrates conjugating the French reflexive verb 'se lever' (to lift oneself) with Verbecc. Reflexive verbs require inflection for gender and number, resulting in more extensive output. The conjugation is performed using CompleteConjugator, and results are available in JSON and YAML. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.fr) # If this is the first run, it will take a minute for the model to train, # but it should save the model .zip file and run fast subsequently cc = ccg.conjugate("se lever") print(cc.to_json()) ``` -------------------------------- ### Conjugate French Verb 'être' with Verbecc Source: https://github.com/bretttolbert/verbecc/blob/main/doc/example_output/fr.md This snippet shows how to conjugate the French verb 'être' (to be) using the Verbecc library. It initializes the CompleteConjugator for French and then conjugates the specified verb. The output can be viewed in JSON or YAML format. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang ccg = CompleteConjugator(Lang.fr) # If this is the first run, it will take a minute for the model to train, # but it should save the model .zip file and run fast subsequently cc = ccg.conjugate("être") print(cc.to_json()) ``` -------------------------------- ### Define Stem-Changing Conjugation Template Source: https://github.com/bretttolbert/verbecc/blob/main/CHANGELOG.md Demonstrates how to use the modify-stem attribute and the delete operator in XML templates to handle stem changes in verbs like 'conèix'. ```xml ``` -------------------------------- ### Access Conjugation Object Metadata Source: https://context7.com/bretttolbert/verbecc/llms.txt Iterates through conjugation results to extract metadata such as person, number, gender, and pronoun, as well as accessing primary and alternate forms. ```python from verbecc import CompleteConjugator, LangCodeISO639_1 as Lang, Moods, Tenses ccg = CompleteConjugator(Lang.fr) tc = ccg.conjugate_mood_tense("parler", Moods.fr.Indicatif, Tenses.fr.Présent) for conj in tc: person = conj.get_person() number = conj.get_number() pronoun = conj.get_pronoun() print(f"{pronoun} ({person}, {number}): {conj[0]}") ``` -------------------------------- ### MoodConjugator API Source: https://context7.com/bretttolbert/verbecc/llms.txt Conjugates a verb for a specific grammatical mood, returning all tenses within that mood. ```APIDOC ## GET /conjugate/mood ### Description Retrieves all tense conjugations for a specific grammatical mood. ### Method GET ### Endpoint /conjugate/mood ### Parameters #### Query Parameters - **verb** (string) - Required - The infinitive form of the verb. - **lang** (string) - Required - ISO 639-1 language code. - **mood** (string) - Required - The grammatical mood (e.g., 'Indicativo'). ### Request Example GET /conjugate/mood?verb=hablar&lang=es&mood=Indicativo ### Response #### Success Response (200) - **mood** (string) - The requested mood. - **tenses** (object) - Mapping of tenses to conjugated forms. #### Response Example { "mood": "Indicativo", "tenses": { "Presente": ["yo hablo", "tú hablas", ...] } } ``` -------------------------------- ### Verbecc Type Enums for Grammatical Categories Source: https://context7.com/bretttolbert/verbecc/llms.txt Illustrates the use of Verbecc's strongly-typed enums for grammatical categories like language codes, moods, tenses, person, number, and gender. These enums facilitate IDE autocompletion and type checking. ```python from verbecc import ( LangCodeISO639_1 as Lang, # Language codes Moods, Tenses, Person, Number, Gender, ) # Language codes (ISO 639-1) languages = [Lang.fr, Lang.es, Lang.ca, Lang.it, Lang.pt, Lang.ro] # Moods by language french_moods = [ Moods.fr.Indicatif, Moods.fr.Subjonctif, Moods.fr.Conditionnel, Moods.fr.Imperatif, Moods.fr.Infinitif, Moods.fr.Participe, ] # Tenses by language (French example) french_tenses = [ Tenses.fr.Présent, Tenses.fr.Imparfait, Tenses.fr.PasséSimple, Tenses.fr.FuturSimple, Tenses.fr.PasséComposé, Tenses.fr.PlusQueParfait, Tenses.fr.PasséAntérieur, Tenses.fr.FuturAntérieur, Tenses.fr.ParticipePassé, Tenses.fr.ParticipePresent, ] # Person and Number persons = [Person.First, Person.Second, Person.Third] numbers = [Number.Singular, Number.Plural] genders = [Gender.m, Gender.f] # String values work too (backwards compatible) # "indicatif" == Moods.fr.Indicatif # "présent" == Tenses.fr.Présent ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.