ULAPI  8.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
ULInflector Class Reference

A ULInflector is a low-level worker that takes morphological information and constructs a word (or words) from it. For example, (bus, noun, plural) gets inflected into the pair of alternative spellings [buses, busses]. More...

#include <ulinflector.h>

Public Member Functions

 ULInflector ()
 
 ULInflector (const ULInflector &other)
 
virtual ~ULInflector ()
 
ULInflectoroperator= (const ULInflector &other)
 
void clear ()
 
const ULLanguagegetLanguage () const
 
void setLanguageDataSource (ULLanguageDataSource *dataSource)
 
ULLanguageDataSourcegetLanguageDataSource ()
 
void setDictionaryDataSource (ULDictionaryDataSource *dictionaryDataSource)
 
ULDictionaryDataSourcegetDictionaryDataSource ()
 
virtual bool isServiceAvailable (const ULServiceDescriptor &service)
 
virtual void getAvailableServices (ULList< ULServiceDescriptor > &services)
 
virtual ULError inflect (const ULString &word, const ULPartOfSpeech &sourcePartOfSpeech, const ULPartOfSpeech &targetPartOfSpeech, uluint32 maxDerivationLength, ULList< ULDerivation > &derivationList)
 
virtual ULError inflect (const ULDerivation &verb, const ULPartOfSpeech &targetPartOfSpeech, uluint32 maxDerivationLength, ULList< ULDerivation > &derivationList)
 
- Public Member Functions inherited from ULWorker
 ULWorker ()
 
virtual ~ULWorker ()
 
virtual void setCancelOperation (bool shouldCancel)
 
virtual bool shouldCancelOperation () const
 

Static Public Member Functions

static ULInflectorcreateInflector (const ULLanguage &language)
 

Protected Member Functions

ULError inflectWithWord (const ULString &originalSearchString, const ULDerivation &word, const ULPartOfSpeech &targetPartOfSpeech, uluint32 maxDerivationLength, ULList< ULDerivation > &derivationList)
 
void getInflections (const ULString &originalSearchString, ULDerivation &derivation, const ULPartOfSpeech &targetPartOfSpeech, uluint32 maxDerivationLength, ULList< ULDerivation > &derivationList)
 
bool isWordWithPartOfSpeech (const ULString &s, const ULPartOfSpeech &targetPartOfSpeech)
 
void getMatchingTerms (const ULString &s, ULList< ULPartOfSpeech > &pospList, ULList< ULDictionaryIterator > &iteratorList)
 

Static Protected Member Functions

static void filterRulesForInflection (const ULPartOfSpeech &targetPartOfSpeech, ULList< ULInflectionRule > &ruleList)
 

Protected Attributes

ULLanguageDataSourcelanguageDataSource
 
ULDictionaryDataSourcedictionaryDataSource
 

Friends

class ULDerivation
 

Detailed Description

A ULInflector is a low-level worker that takes morphological information and constructs a word (or words) from it. For example, (bus, noun, plural) gets inflected into the pair of alternative spellings [buses, busses].

Constructor & Destructor Documentation

ULInflector::ULInflector ( )

Default constructor.

ULInflector::ULInflector ( const ULInflector other)

Copy constructor.

ULInflector::~ULInflector ( )
virtual

Destructor.

Member Function Documentation

void ULInflector::clear ( )

Sets this inflector to its default values.

ULInflector * ULInflector::createInflector ( const ULLanguage language)
static

Static method that instantiates and initializes an object of the subclass appropriate for the specified language.

void ULInflector::filterRulesForInflection ( const ULPartOfSpeech targetPartOfSpeech,
ULList< ULInflectionRule > &  ruleList 
)
staticprotected

Private method that chooses among a set of inflection rules that could be chosen as the first rule in a derivation heading towards the specified target part of speech.

void ULInflector::getAvailableServices ( ULList< ULServiceDescriptor > &  serviceList)
virtual
Parameters
[out]serviceListUsed to return a list of all the services this ULWorker can provide.

Implements ULWorker.

ULDictionaryDataSource * ULInflector::getDictionaryDataSource ( )
Returns
a pointer to the dictionary data source used by this inflector.
void ULInflector::getInflections ( const ULString originalSearchString,
ULDerivation derivation,
const ULPartOfSpeech targetPartOfSpeech,
uluint32  maxDerivationLength,
ULList< ULDerivation > &  derivationList 
)
protected

Private method called by inflect that recursively evaluates possible derivations leading to the desired part of speech.

Parameters
[in]derivationthe derivation to build upon.
[in]targetPartOfSpeechthe part of speech we're trying to build towards.
[in]maxDerivationLengththe longest rule sequence we're willing to allow in a derivation. A value of 0 means any length is acceptable
[out]derivationListthe list of accepted derivations. This list starts out empty at the initial call of getInflections, but builds up as the recursion proceeds.
const ULLanguage & ULInflector::getLanguage ( ) const
Returns
the language for which this inflector can provide inflections.
ULLanguageDataSource * ULInflector::getLanguageDataSource ( )
Returns
a pointer to the language data source associated with this inflector.
void ULInflector::getMatchingTerms ( const ULString s,
ULList< ULPartOfSpeech > &  pospList,
ULList< ULDictionaryIterator > &  iteratorList 
)
protected
ULError ULInflector::inflect ( const ULString word,
const ULPartOfSpeech sourcePartOfSpeech,
const ULPartOfSpeech targetPartOfSpeech,
uluint32  maxDerivationLength,
ULList< ULDerivation > &  derivationList 
)
virtual

Computes all inflections (i.e. morphological derivations) for the specified word, starting with the assumption that the word has the given (source) part of speech, and that the inflected form has the given target part of speech.

Returns
ULError::NoMatch, ULError::ObjectUninitialized, or ULError::NoError.
Parameters
[in]wordthe word to inflect
[in]sourcePartOfSpeechthe part of speech of the original word
[in]targetPartOfSpeechthe desired part of speech of the inflected form
[in]maxDerivationLengthif greater than 0, the maximum number of inflection rules allowed in a derivation. If zero, any length of derivation is allowed.
[out]derivationListthe desired derivations
ULError ULInflector::inflect ( const ULDerivation verb,
const ULPartOfSpeech targetPartOfSpeech,
uluint32  maxDerivationLength,
ULList< ULDerivation > &  derivationList 
)
virtual

Computes all inflections (i.e. morphological derivations) for the specified verb, resulting in the inflected (conjugated) form or forms with the given target part of speech.

Returns
ULError::NoMatch, ULError::ObjectUninitialized, or ULError::NoError.
Parameters
[in]verbthe verb to inflect
[in]targetPartOfSpeechthe desired part of speech of the inflected form
[in]maxDerivationLengthif greater than 0, the maximum number of inflection rules allowed in a derivation. If zero, any length of derivation is allowed.
[out]derivationListthe desired derivations
ULError ULInflector::inflectWithWord ( const ULString originalSearchString,
const ULDerivation word,
const ULPartOfSpeech targetPartOfSpeech,
uluint32  maxDerivationLength,
ULList< ULDerivation > &  derivationList 
)
protected
bool ULInflector::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.

bool ULInflector::isWordWithPartOfSpeech ( const ULString s,
const ULPartOfSpeech targetPartOfSpeech 
)
protected
ULInflector & ULInflector::operator= ( const ULInflector other)

Assignment operator.

void ULInflector::setDictionaryDataSource ( ULDictionaryDataSource dataSource)

Assigns the dictionary data source to be used by this inflector. The ULInflector does not take responsibility for deleting the data source. That will need to happen elsewhere (typically the ULFactory will take care of it if your application uses ULFactory to instantiate data sources and workers).

Parameters
[in]dataSourceA pointer to the desired dictionary data source.
void ULInflector::setLanguageDataSource ( ULLanguageDataSource dataSource)

Set the language data source used by this ULInflector to perform inflections. The ULInflector does not take responsibility for deleting the data source. That will need to happen elsewhere (typically the ULFactory will take care of it if your application uses ULFactory to instantiate data sources and workers).

Parameters
[in]dataSourceThe desired language data source.

Friends And Related Function Documentation

friend class ULDerivation
friend

Member Data Documentation

ULDictionaryDataSource* ULInflector::dictionaryDataSource
protected
ULLanguageDataSource* ULInflector::languageDataSource
protected

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