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

A simplified interface to the noun pluralization services provided by ULInflector. More...

#include <ulpluralizer.h>

Public Member Functions

 ULPluralizer ()
 
 ULPluralizer (const ULPluralizer &other)
 
virtual ~ULPluralizer ()
 
ULPluralizeroperator= (const ULPluralizer &other)
 
void clear ()
 
ULInflectorgetInflector ()
 
void setInflector (ULInflector *newInflector)
 
ULDissectorgetDissector ()
 
void setDissector (ULDissector *newDissector)
 
const ULLanguagegetLanguage () const
 
virtual bool isServiceAvailable (const ULServiceDescriptor &service)
 
virtual void getAvailableServices (ULList< ULServiceDescriptor > &services)
 
ULError getPlural (const ULString &word, ULString &plural)
 
ULError getAllPlurals (const ULString &word, ULList< ULString > &pluralList)
 
ULError getPluralFromSingular (const ULString &singular, ULString &plural)
 
ULError getAllPluralsFromSingular (const ULString &singular, ULList< ULString > &pluralList)
 
- Public Member Functions inherited from ULWorker
 ULWorker ()
 
virtual ~ULWorker ()
 
virtual void setCancelOperation (bool shouldCancel)
 
virtual bool shouldCancelOperation () const
 

Detailed Description

A simplified interface to the noun pluralization services provided by ULInflector.

Constructor & Destructor Documentation

ULPluralizer::ULPluralizer ( )

Default constructor.

ULPluralizer::ULPluralizer ( const ULPluralizer other)

Copy constructor.

ULPluralizer::~ULPluralizer ( )
virtual

Destructor.

Member Function Documentation

void ULPluralizer::clear ( )

Sets this pluralizer to its default state.

ULError ULPluralizer::getAllPlurals ( const ULString word,
ULList< ULString > &  pluralList 
)

Computes all plural forms for the specified noun.

If you know for sure that your word is a singular noun, you might prefer the method getAllPluralsFromSingular, which is somewhat faster that getAllPlurals. getAllPlurals first stems the submitted word to determine whether it is a noun at all, and if so, whether it is already a plural. getAllPluralsFromSingular saves time by not performing this check. For example, getAllPluralsFromSingular applied to "buses" will return "buseses", while getPlural will return "buses" and "busses". Both, however, will produce "buses" and "busses" when given "bus".

Returns
ULError::NoError if the operation was successful, or another ULError value if not.
Parameters
[in]wordThe word for which plurals are requested.
[out]pluralListThe list of plural forms for the given singular noun.
ULError ULPluralizer::getAllPluralsFromSingular ( const ULString singular,
ULList< ULString > &  pluralList 
)

Computes all plural forms for the specified noun.

This method assumes that you are giving it a singular form, and makes its best effort to pluralize that form. Thus, if you hand it a noun that is already plural (or even a non-noun), you may get strange results (e.g. "fruits" will result in "fruitses"). If you want your word to be analyzed first to make sure it is not already a plural (and to determine whether it is a noun at all), you should use getPlural or getAllPlurals method. Those methods are slower, but they will allow you to submit any word and get the word's plural form if one exists.

Returns
ULError::NoError if the operation was successful, or another ULError value if not.
Parameters
[in]singularThe singular of the noun for which plurals are requested.
[out]pluralListThe list of plural forms for the given singular noun.
void ULPluralizer::getAvailableServices ( ULList< ULServiceDescriptor > &  serviceList)
virtual
Parameters
[out]serviceListUsed to return a list of all the services this ULWorker can provide.

Implements ULWorker.

ULDissector * ULPluralizer::getDissector ( )
Returns
a pointer to the ULDissector used by this pluralizer to determine the singular of a specified word before trying to compute its plural forms.
ULInflector * ULPluralizer::getInflector ( )
Returns
a pointer to the ULInflector used by this pluralizer to compute plurals.
const ULLanguage & ULPluralizer::getLanguage ( ) const
Returns
the language for which this pluralizer is able to compute plurals.
ULError ULPluralizer::getPlural ( const ULString word,
ULString plural 
)

Computes a plural for the specified word, if one exists. This interface is more convenient than that of getAllPlurals, and gives you complete plural information for all nouns that have only one plural. But for nouns that have multiple plurals (e.g. buses/busses, octopuses/octopi), getPlural only returns one of the available plurals.

If you know for sure that your word is a singular noun, you might prefer the method getPluralFromSingular, which is somewhat faster that getPlural. getPlural first stems the submitted word to determine whether it is a noun at all, and if so, whether it is already a plural. getPluralFromSingular saves time by not performing such a check. For example, getPluralFromSingular applied to "cats" will return "catses", while getPlural will return "cats".

Returns
ULError::NoError if the operation was successful, or another ULError value if not.
Parameters
[in]singularThe singular of the noun for which a plural is requested.
[out]pluralOne of the plural forms for the given singular noun.
ULError ULPluralizer::getPluralFromSingular ( const ULString singular,
ULString plural 
)

Computes a plural for the specified noun. This interface is more convenient than that of getAllPlurals, and gives you complete plural information for all nouns that have only one plural. But for nouns that have multiple plurals (e.g. buses/busses, octopuses/octopi), getPlural only returns one of the available plurals.

This method assumes that you are giving it a singular form, and makes its best effort to pluralize that form. Thus, if you hand it a noun that is already plural (or even a non-noun), you may get strange results (e.g. "fruits" will result in "fruitses"). If you want your word to be analyzed first to make sure it is not already a plural (and to determine whether it is a noun at all), you should use getPlural or getAllPlurals method. Those methods are slower, but they will allow you to submit any word and get the word's plural form if one exists.

Returns
ULError::NoError if the operation was successful, or another ULError value if not.
Parameters
[in]singularThe singular of the noun for which a plural is requested.
[out]pluralOne of the plural forms for the given singular noun.
bool ULPluralizer::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.

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

Assignment operator.

void ULPluralizer::setDissector ( ULDissector newDissector)
Parameters
[in]newDissectorA pointer to the ULDissector to be used by this pluralizer to determine the singular of a specified word before trying to compute its plural forms.
void ULPluralizer::setInflector ( ULInflector newInflector)
Parameters
[in]newInflectorA pointer to the ULInflector to be used by this pluralizer to compute plurals.

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