Vocabulary File class. More...
#include <vocfile.H>
Public Member Functions | |
CVocFile (char *filename) | |
Constructor. | |
void | AppendVocabulary (std::vector< SWord > &vocabulary, const bool &bSynonym, const enVocLang &enLang) |
Append Vocabulary function. |
Private Member Functions | |
void | trim (std::string &str) |
Helper function. | |
size_t | checkLine (std::string &line) |
Helper function. | |
void | seperateWords (std::string str, std::vector< std::string > &words) |
Helper function. | |
void | addWordToVocabulary (const SWord &word, std::vector< SWord > &vocabulary, const bool &bSynonym, const enVocLang &enLang) |
Helper function. |
Private Attributes | |
std::string | m_strFilename |
vocabulary filename |
Vocabulary File class.
This class reads a vocabulary file and appends the words to a vector.
CVocFile::CVocFile | ( | char * | filename | ) |
Constructor.
This constructor initializes the vocabulary filename.
filename | vocabulary filename |
|
private |
Helper function.
This function adds a word to a vocabulary vector. If the synonym mode is enabled, it will also split one vocabulary word into n-lang-synonym vocabulary items.
word | This word will be added to a vocabulary vector. |
vocabulary | Word will be appended to this vocabulary vector. |
bSynonym | synonym mode |
enLang | inquiry language |
References SWord::lang1, SWord::lang2, and SWord::numPasses.
Referenced by AppendVocabulary().
void CVocFile::AppendVocabulary | ( | std::vector< SWord > & | vocabulary, |
const bool & | bSynonym, | ||
const enVocLang & | enLang | ||
) |
Append Vocabulary function.
This function reads a vocabulary file and appends the words to a vector. A error message will be written to the stderr if a line is incorrect. If the synonym mode is enabled, it will also split one vocabulary word resp. one line into n-lang-synonym items.
vocabulary | Words will be appended to this vector. |
bSynonym | synonym mode |
enLang | inquiry language |
References addWordToVocabulary(), checkLine(), CVocatraInfo::GetName(), SWord::lang1, SWord::lang2, m_strFilename, SWord::numPasses, and seperateWords().
Referenced by CVocTrainer::Init().
|
private |
Helper function.
This function trims a line and checks if this line is in the correct format.
line | This string will be checked. |
References trim().
Referenced by AppendVocabulary().
|
private |
Helper function.
This function separates a string into words. The separation sign is a comma.
str | This string will be separated. |
words | Words will be assigned to this vector. |
References trim().
Referenced by AppendVocabulary().
|
private |
Helper function.
This function trims spaces and tabulators from a string.
str | This string will be trimmed. |
Referenced by checkLine(), and seperateWords().
Generated for Vocatra by |