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

A ULPartOfSpeechTagger marks the words in a sentence with parts of speech. The tagger uses a combination of dictionary look-up and rule-based ambiguity resolution to choose parts of speech for each word in the sentence. More...

#include <ulpartofspeechtagger.h>

Public Member Functions

 ULPartOfSpeechTagger ()
 
 ULPartOfSpeechTagger (const ULPartOfSpeechTagger &other)
 
virtual ~ULPartOfSpeechTagger ()
 
ULPartOfSpeechTaggeroperator= (const ULPartOfSpeechTagger &other)
 
void clear ()
 
const ULLanguagegetLanguage () const
 
void setDissector (ULDissector *newDissector)
 
ULDissectorgetDissector ()
 
virtual bool isServiceAvailable (const ULServiceDescriptor &service)
 
virtual void getAvailableServices (ULList< ULServiceDescriptor > &services)
 
ULError getTags (const ULString &sentence, ULList< ULTaggedWord > &taggedWords)
 
ULError getTags (const ULString &sentence, ULList< ULDerivation > &words)
 
- Public Member Functions inherited from ULWorker
 ULWorker ()
 
virtual ~ULWorker ()
 
virtual void setCancelOperation (bool shouldCancel)
 
virtual bool shouldCancelOperation () const
 

Detailed Description

A ULPartOfSpeechTagger marks the words in a sentence with parts of speech. The tagger uses a combination of dictionary look-up and rule-based ambiguity resolution to choose parts of speech for each word in the sentence.

Constructor & Destructor Documentation

ULPartOfSpeechTagger::ULPartOfSpeechTagger ( )

Default constructor.

ULPartOfSpeechTagger::ULPartOfSpeechTagger ( const ULPartOfSpeechTagger other)

Copy constructor.

ULPartOfSpeechTagger::~ULPartOfSpeechTagger ( )
virtual

Destructor.

Member Function Documentation

void ULPartOfSpeechTagger::clear ( )

Sets this tagger to its default state.

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

Implements ULWorker.

ULDissector * ULPartOfSpeechTagger::getDissector ( )
Returns
a pointer to the ULDissector used by this tagger.
const ULLanguage & ULPartOfSpeechTagger::getLanguage ( ) const
Returns
the language associated with this tagger.
ULError ULPartOfSpeechTagger::getTags ( const ULString sentence,
ULList< ULTaggedWord > &  taggedWords 
)

Computes part of speech tags for the words in the specified sentence. These tags are returned in the form of a list of ULTaggedWord objects. Each ULTaggedWord object represents the list of possible interpretations of a word from the sentence, ordered by decreasing likelihood. For example, in the sentence "Alice drinks coffee", the most likely interpretation of the word "drinks" would be as the third-person singular form of the verb "to drink". The word "drinks" also has a less likely (in this sentence) interpretation as the plural of the noun "drink". Thus, the ULTaggedWord corresponding to "drinks" in the context of the sentence "Alice drinks coffee" would have two elements, first the verb and second the noun.

Returns
ULError::NoError if the tagging is successful, or some other ULError value otherwise.
Parameters
[in]sentenceThe sentence to be tagged.
[out]taggedWordsThe resulting list of tagged words.
ULError ULPartOfSpeechTagger::getTags ( const ULString sentence,
ULList< ULDerivation > &  tags 
)

Computes part of speech tags for the words in the specified sentence. These tags are returned in the form of a list of ULDerivation objects. Each ULDerivation corresponds to a single word from the sentence, and identifies the word's surface form, root word, part of speech category, and other word feature information (e.g. the tense and person for a verb).

This version of getTags is provided as a simpler version of the getTags that returns a list of ULTaggedWords. For most applications, knowing the most likely part of speech of a word in a sentence (as opposed to an ordered list of possible parts of speech) will be sufficient.

Returns
ULError::NoError if the tagging is successful, or some other ULError value otherwise.
Parameters
[in]sentenceThe sentence to be tagged.
[out]tagsThe resulting word list.
bool ULPartOfSpeechTagger::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.

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

Assignment operator.

void ULPartOfSpeechTagger::setDissector ( ULDissector newDissector)

Assigns a ULDissector to be used by this tagger. The ULPartOfSpeechTagger 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]newDissectorA pointer to the desired dissector.

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