Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CVocTrainer Class Reference

Vocabulary Trainer class. More...

#include <voctrainer.H>

Public Member Functions

 CVocTrainer (CVocPrinter *pvpPrinter)
 Constructor.
 ~CVocTrainer ()
 Default destructor.
int Init (char **files, const int &nNumFiles, const bool &bSynonym, const enVocLang &enLang)
 Initialization function.
void Learn (const enVocMode &enMode, const enVocLang &enLang, const int &nNumPasses, const bool &bDebugMode, const bool &bStackMode, const bool &bCaseMode, const bool &bBeep)
 Learning function.

Private Member Functions

bool compareStrings (std::string str1, std::string str2, const bool &casemode)
 Helper function.
bool checkWord (const std::string &word, const std::vector< std::string > &words, const bool &casemode)
 Helper function.
void sortVocabulary (const enVocLang &enLang)
 Helper function This function sorts the vocabulary alphabetically.

Static Private Member Functions

static bool compareLeftLanguage (const SWord &word1, const SWord &word2)
 Static helper function.
static bool compareRightLanguage (const SWord &word1, const SWord &word2)
 Static helper function.

Private Attributes

std::vector< SWordm_vocabulary
 vector with the hole vocabulary
CVocPrinterm_pvpPrinter
 pointer to printer class

Detailed Description

Vocabulary Trainer class.

This class provides the training process. It starts the learning process and checks the user-input.

Constructor & Destructor Documentation

CVocTrainer::CVocTrainer ( CVocPrinter pvpPrinter)

Constructor.

Parameters
pvpPrinterPointer to CVocPrinter class which will be used to write strings

Member Function Documentation

bool CVocTrainer::checkWord ( const std::string &  word,
const std::vector< std::string > &  words,
const bool &  casemode 
)
private

Helper function.

This function checks if the word is in the vector words.

Parameters
wordword to check
wordsvector with words
casemodecase-sensitive setting
Returns
This function returns true, if the word is in the vector; otherwise false.
See Also
compareStrings()

Referenced by Learn().

bool CVocTrainer::compareLeftLanguage ( const SWord word1,
const SWord word2 
)
staticprivate

Static helper function.

This function compares two words from the left language.

Parameters
word1first word
word2second word
Returns
This function returns false, if word1.lang1[0] is less than word2.lang1[0]; otherwise true.
See Also
sortVocabulary()

References SWord::lang1.

bool CVocTrainer::compareRightLanguage ( const SWord word1,
const SWord word2 
)
staticprivate

Static helper function.

This function compare two words from the right language.
Parameters
word1first word
word2second word
Returns
This function returns false, if word1.lang2[0] is less than word2.lang2[0]; otherwise true.
See Also
sortVocabulary()

References SWord::lang2.

bool CVocTrainer::compareStrings ( std::string  str1,
std::string  str2,
const bool &  casemode 
)
private

Helper function.

This function compares two strings case-sensitively or case-insensitively.

Parameters
str1string one
str2string two
casemodecase-sensitive setting
Returns
This function returns true, if the strings are equal; otherwise false.
int CVocTrainer::Init ( char **  files,
const int &  nNumFiles,
const bool &  bSynonym,
const enVocLang &  enLang 
)

Initialization function.

This function initializes the m_vocabulary vector with the help of CVocFile.

Parameters
filesnull-terminated file string array
nNumFilesnumber of files
bSynonymsynonym mode
enLanginquiry language
Returns
This function returns -1 if successful; otherwise a exit code.
See Also
CVocFile
m_vocabulary

References CVocFile::AppendVocabulary(), CVocatraInfo::GetName(), and m_vocabulary.

void CVocTrainer::Learn ( const enVocMode &  enMode,
const enVocLang &  enLang,
const int &  nNumPasses,
const bool &  bDebugMode,
const bool &  bStackMode,
const bool &  bCaseMode,
const bool &  bBeep 
)

Learning function.

This function starts the learning process and queries the user with the help of CVocAdmin.

Parameters
enModeinquiry mode
enLanginquiry language
nNumPassesnumber of passes
bDebugModedebug mode setting
bStackModestack mode setting
bCaseModecase-sensitive mode setting
bBeepenable beep sound
See Also
CVocAdmin

References checkWord(), m_pvpPrinter, m_vocabulary, CVocPrinter::PrintCorrectString(), CVocPrinter::PrintEndString(), CVocPrinter::PrintStartString(), CVocPrinter::PrintWords(), CVocPrinter::PrintWrongString(), and sortVocabulary().

void CVocTrainer::sortVocabulary ( const enVocLang &  enLang)
private

Helper function This function sorts the vocabulary alphabetically.

Parameters
enLangIf enLang is vlRight the right language will be sorted; otherwise the left one.

Referenced by Learn().


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

Get Vocatra at SourceForge.net. Fast, secure and Free Open Source software downloads Generated for Vocatra by doxygen