VoiceMan
Classes | Public Member Functions
EngLang Class Reference

The class for English language operations. More...

Inheritance diagram for EngLang:
Lang

List of all members.

Classes

struct  CapItem

Public Member Functions

bool equalChars (wchar_t c1, wchar_t c2) const
 Checks if specified characters are represent same letter.
void expandNumbers (std::wstring &str, bool singleDigits) const
 Replaces numbers with their word representation.
std::wstring getAllChars () const
 Returns all characters of English alphabet (in both cases)
Lang::CharType getCharType (wchar_t c) const
 Returns type of specified character.
void loadCaps (const std::string &fileName)
 Loads table of phonetic pronounciation strings.
void markCapitals (const std::wstring &text, BoolVector &marks) const
 Marks letters to speak separately (usual acronims)
std::wstring separate (const std::wstring &text) const
 Inserts additional spaces to better words processing.
wchar_t toLower (wchar_t ch) const
 Returns lower case of the specified character.
std::wstring toLower (const std::wstring &str) const
 Returns lower case of the specified string.
wchar_t toUpper (wchar_t ch) const
 Returns upper case of the specified character.
std::wstring toUpper (const std::wstring &str) const
 Returns upper case of the specified string.
virtual ~EngLang ()
 The destructor.

Detailed Description

This class is used to provide all language-specific information for English language. VoiceMan server has associated language object for all portions of text.Usually these objects are used to get set of characters, translate digits into words representation, perform case insensitive characters comparing and for some others.

See also:
LangManager RusLang

Member Function Documentation

bool EngLang::equalChars ( wchar_t  c1,
wchar_t  c2 
) const [virtual]

Almost in every language each letter can be represented in different cases and different characters are used. This method checks, if specified characters are represent the same letter.

Parameters:
[in]c1The first character to compare
[in]c2The second character to compare
Returns:
Non-zero if provided characters are the same letters or zero otherwise

Implements Lang.

void EngLang::expandNumbers ( std::wstring &  str,
bool  singleDigits 
) const [virtual]

This method replaces all digits by their words representation with the rules of English language. Single digits mode replaces just each digit with corresponding word.

Parameters:
[in/out]str The string to process
[in]singleDigitsProcess each digit as separate number

Implements Lang.

std::wstring EngLang::getAllChars ( ) const [virtual]

This method allows you to enumerate all characters used in English language.

Returns:
All characters of English language

Implements Lang.

Lang::CharType EngLang::getCharType ( wchar_t  c) const [virtual]

This method allows you to get class of specified character. It returns one of the following values: Lang::UpCase, Lang::LowCase or Lang::Other.

Parameters:
[in]cThe character to get type of
Returns:
Type of specified character (Lang::UpCase, Lang::LowCase or Lang::Other)

Implements Lang.

void EngLang::loadCaps ( const std::string &  fileName)

This class has internal table to select characters for speak phonetically. This method loads it from external file.

Parameters:
[in]fileNameThe name of file to read table from
void EngLang::markCapitals ( const std::wstring &  text,
BoolVector &  marks 
) const [virtual]

This method marks characters to speak phonetically . Usually some heuristic or predefined table are used.

Parameters:
[in]textThe string to process
[out]marksThe boolean vector to save marks

Implements Lang.

std::wstring EngLang::separate ( const std::wstring &  text) const [virtual]

This method inserts additional spaces to split words to avoid using capital letters in the middle of the words. If capital letter are used in the middle of the word this method will insert space before it. It is useful for Hungarian notation.

Parameters:
[in]textThe string to process
Returns:
The string with splitted words

Implements Lang.

wchar_t EngLang::toLower ( wchar_t  ch) const [virtual]

This method adjusts provided character to lower case.

Parameters:
[in]chThe character to return lower case of
Returns:
The lower case of provided character

Implements Lang.

std::wstring EngLang::toLower ( const std::wstring &  str) const [virtual]

This method adjusts characters of provided string to lower case.

Parameters:
[in]strThe string to return lower case of
Returns:
The lower case of provided string

Implements Lang.

wchar_t EngLang::toUpper ( wchar_t  ch) const [virtual]

This method adjusts provided character to upper case.

Parameters:
[in]chThe character to return upper case of
Returns:
The upper case of provided character

Implements Lang.

std::wstring EngLang::toUpper ( const std::wstring &  str) const [virtual]

This method adjusts characters of provided string to upper case.

Parameters:
[in]strThe string to return upper case of
Returns:
The upper case of provided string

Implements Lang.