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< SWord > | m_vocabulary |
| vector with the hole vocabulary | |
| CVocPrinter * | m_pvpPrinter |
| pointer to printer class | |
Vocabulary Trainer class.
This class provides the training process. It starts the learning process and checks the user-input.
| CVocTrainer::CVocTrainer | ( | CVocPrinter * | pvpPrinter | ) |
Constructor.
| pvpPrinter | Pointer to CVocPrinter class which will be used to write strings |
| 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.
| word | word to check | |
| words | vector with words | |
| casemode | case-sensitive setting |
References compareStrings().
Referenced by Learn().
| bool CVocTrainer::compareLeftLanguage | ( | const SWord & | word1, | |
| const SWord & | word2 | |||
| ) | [static, private] |
Static helper function.
This function compares two words from the left language.
| word1 | first word | |
| word2 | second word |
References SWord::lang1.
Referenced by sortVocabulary().
| bool CVocTrainer::compareRightLanguage | ( | const SWord & | word1, | |
| const SWord & | word2 | |||
| ) | [static, private] |
Static helper function.
This function compare two words from the right language.
| word1 | first word | |
| word2 | second word |
References SWord::lang2.
Referenced by sortVocabulary().
| 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.
| str1 | string one | |
| str2 | string two | |
| casemode | case-sensitive setting |
Referenced by checkWord().
| 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.
| files | null-terminated file string array | |
| nNumFiles | number of files | |
| bSynonym | synonym mode | |
| enLang | inquiry language |
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.
| enMode | inquiry mode | |
| enLang | inquiry language | |
| nNumPasses | number of passes | |
| bDebugMode | debug mode setting | |
| bStackMode | stack mode setting | |
| bCaseMode | case-sensitive mode setting | |
| bBeep | enable beep sound |
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.
| enLang | If enLang is vlRight the right language will be sorted; otherwise the left one. |
References compareLeftLanguage(), compareRightLanguage(), and m_vocabulary.
Referenced by Learn().
|
|
Generated for Vocatra by
|