TextProcessor Class Reference

makes general text processing More...

Inheritance diagram for TextProcessor:

AbstractTextProcessor

List of all members.

Public Member Functions

void addReplacement (LangId langId, const std::wstring &oldValue, const std::wstring &newValue)
 Adds new text replacement.
void associate (const std::wstring &str, LangId langId)
 Specifies the characters to be processed by specified language.
void process (const TextItem &text, std::list< TextItem > &items) const
 Processes text before speaking.
void processLetter (wchar_t c, TextParam volume, TextParam pitch, TextParam rate, TextItemList &items) const
 Processes single letter.
void setDefaultLangId (LangId langId)
 Sets new value for default language.
void setMode (int digitsMode, bool capitalization, bool separation)
 Sets some text processing parameters.
void setSpecialValueFor (wchar_t c, const std::wstring &value)
 Set special value to describe character.
 TextProcessor (const AbstractLangIdResolver &langIdResolver)
 The constructor.
virtual ~TextProcessor ()
 The destructor.


Detailed Description

This class plays the major role in text processing. It splits input string to a sequence of items by language settings, makes replacements and invokes language-specific operations such numbers processing and selecting characters for phonetic pronunciation. It is almost complete required text handling except output assignment to generated text items and output-specific processing. Output assignment must be performed later because all clients can have own preferences which output must serve some language.

See also:
Output ProtocolHandler

Constructor & Destructor Documentation

TextProcessor::TextProcessor ( const AbstractLangIdResolver langIdResolver  )  [inline]

Parameters:
[in] langIdResolver The class to translate language identifiers to a valid language objects


Member Function Documentation

void TextProcessor::addReplacement ( LangId  langId,
const std::wstring &  oldValue,
const std::wstring &  newValue 
) [virtual]

This method adds new replacement, associated with some language.

Parameters:
[in] langId The ID of a language to add replacement for
[in] oldValue The text to be replaced
[in] newValue The text to replace with
See also:
Replacement

Implements AbstractTextProcessor.

void TextProcessor::associate ( const std::wstring &  str,
LangId  langId 
) [virtual]

This method selects which characters must be processed by some language. Note, the language ID can have LANG_ID_NONE value. It means to process characters by the same language as preceding text.

Parameters:
[in] str Teh string of characters to associate with language
[in] langId The ID of a language to associate with

Implements AbstractTextProcessor.

void TextProcessor::process ( const TextItem text,
std::list< TextItem > &  items 
) const [virtual]

This method splits text string onto sequence of text items regarding current language settings. Produced items is almost ready to be sent to speech sinthesizer but exact output is not selected. It must be choosed explicitly according with current client preferences.

Parameters:
[in] text The text to process
[out] items The reference to text item list to receive a result

Implements AbstractTextProcessor.

void TextProcessor::processLetter ( wchar_t  c,
TextParam  volume,
TextParam  pitch,
TextParam  rate,
TextItemList &  items 
) const [virtual]

This method handles the "LETTER" command and generates corresponding text item.

Parameters:
[in] c The character to process
[in] volume The desired volume value
[in] pitch The desired pitch value
[in] rate The desired rate value
[out] items The reference to text item list to receive a result

Implements AbstractTextProcessor.

void TextProcessor::setDefaultLangId ( LangId  langId  )  [virtual]

This method sets new value for default language. Some characters can be marked to be processed by the language of precedent text. Default language is used if such characters was met but there is no preceding text.

Parameters:
[in] langId The new default language ID

Implements AbstractTextProcessor.

void TextProcessor::setMode ( int  digitsMode,
bool  capitalization,
bool  separation 
)

This method sets some text processing parameters. Digits mode means how numbers must be processed. There are three variants: replace by usual words representation, replace each digit by corresponding single word or do nothing and let speech synthesizer process numbers by itself. Used word "Capitalization" is not proper term. It means invocation of language-specific function to mark letters for phonetic pronunciation. Separation feature inserts space after any non-capital letter followed by capital letter (for example, can be very useful for Hungarian notation processing).

Parameters:
[in] digitsMode The mode of digits processing (can be DigitsModeNormal, DigitsModeSingle or DigitsModeNone)
[in] capitalization The capitalization mode
[in] separation The separation mode

void TextProcessor::setSpecialValueFor ( wchar_t  c,
const std::wstring &  value 
) [virtual]

Special value is used to describe the single letter on corresponding letter command.

Parameters:
[in] c The character to set value for
[in] value The value to set

Implements AbstractTextProcessor.


Generated on Thu May 6 16:10:58 2010 for VoiceMan by  doxygen 1.5.9