A means of conjugating a particular set of infinitives. ModelVerb instances define (via the matches() method) what infinitives this model can be used for, and provide a facility for retrieving segments of a conjugation using the getForm() method. ModelVerb instances are created on load using XML definition files, which specify what rules should be used for conjugation, and what infinitives are applicable.
Every model verb except one (per language) must be a child of one or more other model verbs. As such, each language has a model verb hierarchy, against which infinitives are matched. For more on the matching process, see ModelVerbFactory. Once a matching model verb has been selected, one creates a ConjugatedVerb instance against the model. That ConjugatedVerb then relies upon its enclosing model's rules and inheritance relationships to determine how to inflect the infinitive at hand for a particular tense and pronoun or form. In the following example, taken from the packaged model verbs for French, we see how the first person plural (i.e. 'nous') form of the present tense is conjugated for the infinitive 'manger', which matches model verb 'Ger' (so named because it matches infinitives with the suffix -ger).
Conjugated forms consist of up to three segments: a stem, infix and suffix. Concatonating these three (one or more segments may be the empty string) provides the required form. Different Segments can be sourced from different parts of the model verb hierarchy: in the preceding example, the infix is found in model 'Ger', while the stem and suffix are sourced from 'Root'.
To reduce redundancy, another form of rule is supported: the reference. To take the example of the provided French model again, 'Root' states that the stem, infix and suffix of the imperative present tense can be found by refering to the present tense. Hence, to conjugate the imperative present in French, we might traverse the tree looking for applicable rules until we come to 'Root', whereupon finding no actual segment definitions for this tense, the reference to the present tense is found and followed. It's important to note that after following a reference, flow returns down the tree to the matched model verb - only this time, looking for rules applicable to the referenced tense (the present in the example given).
Some tenses are composites - that is, they require a secondary auxiliary verb as part of the conjugated form. For instance, the French past perfect tense is formed by taking the present tense of the appropriate auxiliary verb, and adding on the past participle of the verb being conjugated. An example of how this is handled follows, using the regular er verb 'aimer':
In this example, the verb 'aimer' matches the model Er. Finding no rules for the perfect tense in Er, flow moves to Er's parent, Root. In Root, there are two relevant rules: a reference, such as the one described in the previous example, only this one indicates that the relevant form to use is the past participle. Following this reference, flow returns to Er, where a suffix is found for the past participle. No rules are found for the stem or infix, and so we return to Root, only this time looking for rules for the present tense rather than the perfect tense. Applicable rules are identified, and the main verb's conjugation is completed.
However, as the perfect tense is a composite, we also have to conjugate the auxiliary verb. Flow begins in the model auxiliary verb - in this instance, Avoir. Finding no rules for the perfect in Avoir or its parent Auxiliary, we move to Root. However, while we are searching for rules for the perfect, as we are trying to conjugate an auxiliary, normal references (such as the one followed from the perfect to the past participle) are not applicable. Instead, we find and use an auxiliary reference. For the perfect tense, Root defines an auxiliary reference to the present tense. Hence, we return to Avoir, but now searching for present tense rules. The suffix is found in Avoir; the stem and infix, in Root.
Multiple inheritance is supported between model verbs. Where multiple parents exist, each parent is searched in order for relevant rules. The search does not end when a match is found; rather, it continues to search the other parents, in case a more specific rule is found. A given rule R, belonging to model verb M, is considered to be 'more specific' than some other rule S belonging to model verb N if M is an ancestor of N. If two equally relevant rules are found, the first is used. It is recommended that in order to develop maintainable model verb trees, where multiple inheritance is used, most parents should be lightweight in terms of rules and their place in the inheritance hierarchy. This helps minimise difficult-to-diagnose specificity issues.
There are three supported types of conjugation rule.
Type | Description |
---|---|
Segment definitions | Defines stems, infixes and suffixes. |
References | Defines links between tenses and forms. |
Auxiliary references | Defines links between tenses and forms for auxiliaries. |
The simplest segment definitions are plain text strings, indicating the inflection to be used. However, there are three sorts of 'marker' that can be included, all of which are resolved by this class when conjugating a verb.
Marker | Description |
---|---|
<parent/> | Replaced with a parent's form. |
\X | Replaced with capture group X if the infinitive was matched using a regular expression. |
[-+]N | Replaced with the last N characters of the infinitive, if negative; or the first N, if positive. 0 refers to the entire infinitive. |
<parent/> markers are useful where a model needs to append or prepend some text on to an inherited form. For instance, the French model verb Cer defines the singular forms of the historic tense as '�
Regular expression capture group markers allow one to cover a wider array of infinitives in a single model verb, often using fewer rule definitions. For instance, using these markers, the English verbs 'buy', 'bring' and 'think' can be covered by a single model: their preterite forms (bought, brought and thought, respectively) can be expressed using the expression '\1ought', if the infinitives are matched with capture groups around the initial consonants of the infinitive.
Finally, substring references are a heavily used mechanism that allows one to cover a wider range of infinitives in a single model: if the Root node defines the stem of a verb as all but the last two letters of the infinitive ('-2'), this will avoids individually stating the stem for each infinitive.
Notes:
|
|
|
|
|
|
|
|