A ULConjugator is a worker that conjugates verbs. Most ULConjugator services are also available via ULInflector, but ULConjugator is designed to have simple interfaces to support the most common conjugation requests.
More...
#include <ulconjugator.h>
|
| ULConjugator () |
|
| ULConjugator (const ULConjugator &other) |
|
virtual | ~ULConjugator () |
|
ULConjugator & | operator= (const ULConjugator &other) |
|
void | clear () |
|
ULInflector * | getInflector () |
|
void | setInflector (ULInflector *inflector) |
|
ULDissector * | getDissector () |
|
void | setDissector (ULDissector *dissector) |
|
const ULLanguage & | getLanguage () const |
|
virtual bool | isServiceAvailable (const ULServiceDescriptor &service) |
|
virtual void | getAvailableServices (ULList< ULServiceDescriptor > &services) |
|
ULError | getVerbFromDictionaryIterator (const ULDictionaryIterator &dictionaryIterator, ULDerivation &verb) |
|
ULError | getVerbsMatchingVerbForm (const ULString &verbForm, ULList< ULDerivation > &verbList) |
|
ULError | getVerbsMatchingInfinitive (const ULString &infinitive, ULList< ULDerivation > &verbList) |
|
ULError | getInfinitivesMatchingPrefix (const ULString &prefix, uluint32 maxMatches, ULList< ULString > &infinitiveList) |
|
ULError | getInfinitivesMatchingPrefix (const ULString &prefix, uluint32 maxMatches, ULList< ULDerivation > &infinitiveList) |
|
ULError | getTensesForVerb (const ULDerivation &verb, ULList< ULTense > &tenseList) |
|
ULError | getPersonsForVerbAndTense (const ULDerivation &verb, const ULTense &tense, ULList< ULPerson > &personList) |
|
ULError | getConjugation (const ULDerivation &verb, const ULTense &tense, const ULPerson &person, ULDerivation &conjugation) |
|
ULError | getConjugationsForTense (const ULDerivation &verb, const ULTense &tense, ULList< ULDerivation > &conjugationList) |
|
ULError | getAllConjugations (const ULDerivation &verb, ULList< ULDerivation > &conjugationList) |
|
void | getPronouns (const ULPerson &person, ULList< ULString > &pronounList) |
|
void | getPronouns (const ULPerson &person, const ULNumber &number, const ULFormality &formality, ULList< ULString > &pronounList) |
|
void | getConjugationDisplayComponents (const ULDerivation &conjugation, ULString &pronounText, ULString &separatorText, ULString &conjugationText) |
|
ULString | getConjugationDisplayText (const ULDerivation &conjugation) |
|
| ULWorker () |
|
virtual | ~ULWorker () |
|
virtual void | setCancelOperation (bool shouldCancel) |
|
virtual bool | shouldCancelOperation () const |
|
A ULConjugator is a worker that conjugates verbs. Most ULConjugator services are also available via ULInflector, but ULConjugator is designed to have simple interfaces to support the most common conjugation requests.
ULConjugator::ULConjugator |
( |
| ) |
|
ULConjugator::~ULConjugator |
( |
| ) |
|
|
virtual |
void ULConjugator::clear |
( |
| ) |
|
- Parameters
-
[out] | serviceList | Used to return a list of all the services this ULWorker can provide. |
Implements ULWorker.
Computes the conjugation or conjugations for the specified verb, tense, and person. Typically, there will be only one conjugated form, but there are occasional alternate spellings (e.g. "bussed" and "bused" for the past tense of "to bus"). You can pass any form of the verb to getConjugation (e.g. "have", "had", and "has" will all give conjugations of the verb "be").
Use getVerbsMatchingVerbForm or getVerbsMatchingInfinitive to obtain a ULDerivation object to be conjugated.
- Returns
- ULError::NoError, ULError::ObjectUninitialized (if the conjugator's inflector or dissector have not been set), or ULError::NoMatch (if there is no matching conjugated form for this verb),
- Parameters
-
[in] | verb | the verb to be conjugated. |
[in] | tense | the tense of the desired conjugation. |
[in] | person | the person of the desired conjugation. |
[out] | conjugation | the conjugation. |
Computes the pieces used to assemble a display of a given conjugated form. For example, if the conjugation is the first-person singular present tense of "aller", then the pronounText is "je", the separator text is a space (" "), and the conjugation text is "vais". On the other hand, for the first-person singular present tense of "aimer", those components will be "j'", "", and "aime".
For more complex display situation (e.g. the verb "abhalten" in first-person plural imperative, which should be displayed as "halten wir ab"), you might want to call getConjugationDisplayText. For that example, getConjugationDisplayComponents yields "wir", "", and "halten ab".
- Parameters
-
[in] | conjugation | the conjugation we wish to display. |
[out] | pronounText | the pronoun text ("je", "j'", "wir", etc.). |
[in] | separatorText | the separator text (typically either a space or the empty string). |
[out] | conjugationText | the conjugation's verb form. |
- Returns
- a string suitable for displaying the given conjugation. For example, if conjugation has surface form "halten ab" and surface part of speech imperative first-person plural, the display text will be "halten wir ab".
- Parameters
-
[in] | conjugation | the conjugation we wish to display. |
Computes all of the conjugations for the specified verb in the specified tense.
Use getVerbsMatchingVerbForm or getVerbsMatchingInfinitive to obtain a ULDerivation object to be conjugated.
- Returns
- ULError::NoError, ULError::ObjectUninitialized (if the conjugator's inflector or dissector have not been set), or ULError::NoMatch (if there is no matching conjugated form for this verb),
- Parameters
-
[in] | verb | the verb to be conjugated. |
[in] | tense | the tense of the desired conjugation. |
[out] | conjugationList | The list of resulting conjugations. Each conjugated form is represented by a ULDerivation, which contains the root (the infinitive), the surface form(s) (the conjugation), and root and surface parts of speech, which include ULFeatureType::Tense, ULFeatureType::Person, and ULFeatureType::Number features. |
Retrieves the list of all infinitives in this conjugator's language data source that match the specified prefix. For example, if you search our standard English language data source for "jum", you will get "jumble", "jump", and "jump-start". The returned strings are guaranteed to be infinitives, and thus may be used successfully in a call to getVerbsMatchingInfinitive. Matches are case- and accent-insensitive.
- Returns
- ULError::NoError or ULError::NoMatch, as appropriate.
- Parameters
-
[in] | prefix | the search string |
[in] | maxMatches | if non-zero,this is the maximum number of matches to return; if zero, the method returns all matches (which can be a very long list if, for example, prefix is one letter) |
[out] | infinitiveList | the list of infinitives for which the specified prefix is a case-/accent-insensitive prefix. |
const ULLanguage & ULConjugator::getLanguage |
( |
| ) |
const |
- Returns
- the language whose verbs this conjugator can conjugate.
Retrieves the persons for which the specified verb has conjugations in the specified tense. Some tenses are only meaningful in a restricted set of persons. For example, in most languages the Imperative tense is only used for second person singular, second person plural, and first person plural.
- Returns
- ULError::ObjectUninitialized, ULError::NoError, or ULError::NoMatch. NoMatch should not happen if the ULDerivation object was retrieved using ULConjugator or ULLanguageDataSource.
- Parameters
-
[in] | verb | the verb |
[in] | tense | the tense |
[out] | personList | the persons appropriate for the specified verb and tense |
Retrieves a list of pronouns associated with the specified person. For example, an English ULConjugator would take ULPerson::ThirdSingular and produce a list containing the strings "he", "she", and "it".
This method should only be used for the compound (i.e. person+number+formality) ULPerson values like FirstSingular and SecondPluralFormal, and not the simple ULPerson values like First, Second, and Third.
- Parameters
-
[in] | person | the ULPerson value whose pronouns are sought |
[out] | pronounList | the desired pronouns |
Retrieves a list of pronouns associated with the specified person, number, and formality. For example, an English ULConjugator would take ULPerson::Third, ULNumber::Singular, and ULFormality::None and produce a list containing the strings "he", "she", and "it".
- Parameters
-
[in] | person | |
[in] | number | |
[in] | formality | |
[out] | pronounList | the desired pronouns |
Retrieves the list of tenses for which the specified verb has conjugations. The typical verb can be conjugated in any of its language's tenses. Some verbs (e.g. the English modal verbs "can", "should", etc.) are restricted to a smaller set of tenses. This method gives you the list of tenses available for your verb.
- Returns
- ULError::ObjectUninitialized, ULError::NoError, or ULError::NoMatch. NoMatch should not happen if the ULDerivation object was retrieved using ULConjugator or ULLanguageDataSource.
- Parameters
-
[in] | verb | the verb |
[out] | tenseList | the tenses appropriate for the specified verb |
Finds the verb (suitable for passing to getConjugation, getAllConjugations, getTensesForVerb, and getPersonsForVerbAndTense) pointed to by the specified dictionary iterator. This method takes into account disambiguation information when selecting the verb. For example, if the dictionary iterator points to a dictionary entry for the English verb "lie" with ULFeatureType::Disambiguation value "deceive", then the returned verb will be the version of "lie" from the language data source that also has disambiguation value "deceive" (as opposed to "recline").
- Returns
- ULError::NoError if the iterator points to a verb found in this conjugator's language data source, and ULError::NoMatch otherwise. The verb parameter is unchanged if there is no match.
- Parameters
-
[in] | dictionaryIterator | an iterator pointing into a dictionary data source. |
[out] | verb | if a match between the dictionary iterator and |
Retrieves the list of ULDerivation objects for verbs matching the specified infinitive. This method looks only for verbs whose infinitives match the specified infinitive, not for verbs matching a conjugated form. For example, if you look for "jumped" using this method, you will not get "jump". If you do not know whether your search string is an infinitive, use getVerbsMatchingVerbForm (which is slower but more flexible) instead.
This method performs case-insensitive and accent-insensitive matches. Thus, if you look for "Purée" in English, you will get both "purée" and "puree".
- Returns
- ULError::NoError or ULError::NoMatch, as appropriate.
- Parameters
-
[in] | infinitive | the desired infinitive |
[out] | verbList | the list of ULDerivation objects for verbs that match the specified infinitive. |
Retrieves the list of ULDerivation objects for verbs matching the specified verb form. This method stems the verbForm before searching for verbs, so "aller", "vais", "allez", etc. will all return the ULDerivation for the French verb "aller". If you know that you have an infinitive and not a conjugated form, you can save time by calling getVerbsMatchingInfinitive, which does not stem the search string.
- Returns
- ULError::NoError or ULError::NoMatch, as appropriate.
- Parameters
-
[in] | verbForm | the search string. |
[out] | verbList | the list of ULDerivation objects for verbs that match the verbForm. |
- Returns
- true if the specified service can be performed by this ULWorker, and false otherwise.
- Parameters
-
service | The desired service. |
Implements ULWorker.
void ULConjugator::setDissector |
( |
ULDissector * |
dissector | ) |
|
Sets this conjugator's dissector, which is used to stem the words provided to getConjugation and getAllConjugations to make sure we have an infinitive before we start conjugating.
- Parameters
-
void ULConjugator::setInflector |
( |
ULInflector * |
inflector | ) |
|
Sets this conjugator's inflector. ULConjugator is essentially a collection of wrappers for ULInflector operations, so this inflector will do most of the conjugation work.
- Parameters
-
The documentation for this class was generated from the following files: