ULAPI  8.0
Public Member Functions | List of all members
ULConjugator Class Reference

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>

Public Member Functions

 ULConjugator ()
 
 ULConjugator (const ULConjugator &other)
 
virtual ~ULConjugator ()
 
ULConjugatoroperator= (const ULConjugator &other)
 
void clear ()
 
ULInflectorgetInflector ()
 
void setInflector (ULInflector *inflector)
 
ULDissectorgetDissector ()
 
void setDissector (ULDissector *dissector)
 
const ULLanguagegetLanguage () 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)
 
- Public Member Functions inherited from ULWorker
 ULWorker ()
 
virtual ~ULWorker ()
 
virtual void setCancelOperation (bool shouldCancel)
 
virtual bool shouldCancelOperation () const
 

Detailed Description

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.

Constructor & Destructor Documentation

ULConjugator::ULConjugator ( )

Default constructor.

ULConjugator::ULConjugator ( const ULConjugator other)

Copy constructor.

ULConjugator::~ULConjugator ( )
virtual

Destructor.

Member Function Documentation

void ULConjugator::clear ( )

Sets this ULConjugator to its default values.

ULError ULConjugator::getAllConjugations ( const ULDerivation verb,
ULList< ULDerivation > &  conjugationList 
)

Computes all the conjugations of the specified verb.

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.
Parameters
[in]verbThe verb to be conjugated.
[out]conjugationListThe 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.
void ULConjugator::getAvailableServices ( ULList< ULServiceDescriptor > &  serviceList)
virtual
Parameters
[out]serviceListUsed to return a list of all the services this ULWorker can provide.

Implements ULWorker.

ULError ULConjugator::getConjugation ( const ULDerivation verb,
const ULTense tense,
const ULPerson person,
ULDerivation conjugation 
)

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]verbthe verb to be conjugated.
[in]tensethe tense of the desired conjugation.
[in]personthe person of the desired conjugation.
[out]conjugationthe conjugation.
void ULConjugator::getConjugationDisplayComponents ( const ULDerivation conjugation,
ULString pronounText,
ULString separatorText,
ULString conjugationText 
)

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]conjugationthe conjugation we wish to display.
[out]pronounTextthe pronoun text ("je", "j'", "wir", etc.).
[in]separatorTextthe separator text (typically either a space or the empty string).
[out]conjugationTextthe conjugation's verb form.
ULString ULConjugator::getConjugationDisplayText ( const ULDerivation conjugation)
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]conjugationthe conjugation we wish to display.
ULError ULConjugator::getConjugationsForTense ( const ULDerivation verb,
const ULTense tense,
ULList< ULDerivation > &  conjugationList 
)

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]verbthe verb to be conjugated.
[in]tensethe tense of the desired conjugation.
[out]conjugationListThe 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.
ULDissector * ULConjugator::getDissector ( )
Returns
a pointer to the ULDissector object that supports this ULConjugator's conjugation services.
ULError ULConjugator::getInfinitivesMatchingPrefix ( const ULString prefix,
uluint32  maxMatches,
ULList< ULString > &  infinitiveList 
)

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]prefixthe search string
[in]maxMatchesif 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]infinitiveListthe list of infinitives for which the specified prefix is a case-/accent-insensitive prefix.
ULError ULConjugator::getInfinitivesMatchingPrefix ( const ULString prefix,
uluint32  maxMatches,
ULList< ULDerivation > &  infinitiveList 
)
ULInflector * ULConjugator::getInflector ( )
Returns
a pointer to the ULInflector object that supports this ULConjugator's conjugation services.
const ULLanguage & ULConjugator::getLanguage ( ) const
Returns
the language whose verbs this conjugator can conjugate.
ULError ULConjugator::getPersonsForVerbAndTense ( const ULDerivation verb,
const ULTense tense,
ULList< ULPerson > &  personList 
)

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]verbthe verb
[in]tensethe tense
[out]personListthe persons appropriate for the specified verb and tense
void ULConjugator::getPronouns ( const ULPerson person,
ULList< ULString > &  pronounList 
)

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]personthe ULPerson value whose pronouns are sought
[out]pronounListthe desired pronouns
void ULConjugator::getPronouns ( const ULPerson person,
const ULNumber number,
const ULFormality formality,
ULList< ULString > &  pronounList 
)

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]pronounListthe desired pronouns
ULError ULConjugator::getTensesForVerb ( const ULDerivation verb,
ULList< ULTense > &  tenseList 
)

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]verbthe verb
[out]tenseListthe tenses appropriate for the specified verb
ULError ULConjugator::getVerbFromDictionaryIterator ( const ULDictionaryIterator dictionaryIterator,
ULDerivation 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]dictionaryIteratoran iterator pointing into a dictionary data source.
[out]verbif a match between the dictionary iterator and
ULError ULConjugator::getVerbsMatchingInfinitive ( const ULString infinitive,
ULList< ULDerivation > &  verbList 
)

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]infinitivethe desired infinitive
[out]verbListthe list of ULDerivation objects for verbs that match the specified infinitive.
ULError ULConjugator::getVerbsMatchingVerbForm ( const ULString verbForm,
ULList< ULDerivation > &  verbList 
)

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]verbFormthe search string.
[out]verbListthe list of ULDerivation objects for verbs that match the verbForm.
bool ULConjugator::isServiceAvailable ( const ULServiceDescriptor service)
virtual
Returns
true if the specified service can be performed by this ULWorker, and false otherwise.
Parameters
serviceThe desired service.

Implements ULWorker.

ULConjugator & ULConjugator::operator= ( const ULConjugator other)

Assignment operator.

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
[in]dissectorThe new ULDissector.
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
[in]inflectorThe new ULInflector.

The documentation for this class was generated from the following files: