store pointer to vocab id

This commit is contained in:
Hieu Hoang 2016-01-01 15:12:16 +00:00
parent 0dec823c60
commit 8107bcf1ea
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ QueryEngine::QueryEngine(const char * filepath) : decoder(filepath)
read_map(&source_vocabids, path_to_source_vocabid.c_str());
//Target phrase vocabIDs
vocabids = decoder.get_target_lookup_map();
vocabids = &decoder.get_target_lookup_map();
//Read config file
std::string line;
@ -156,7 +156,7 @@ void QueryEngine::printTargetInfo(const std::vector<target_text> &target_phrases
for (int i = 0; i<entries; i++) {
std::cout << "Entry " << i+1 << " of " << entries << ":" << std::endl;
//Print text
std::cout << getTargetWordsFromIDs(target_phrases[i].target_phrase, vocabids) << "\t";
std::cout << getTargetWordsFromIDs(target_phrases[i].target_phrase, *vocabids) << "\t";
//Print probabilities:
for (int j = 0; j<target_phrases[i].prob.size(); j++) {

View File

@ -18,7 +18,7 @@ char * read_binary_file(char * filename);
class QueryEngine
{
unsigned char * binary_mmaped; //The binari phrase table file
std::map<unsigned int, std::string> vocabids;
const std::map<unsigned int, std::string> *vocabids;
std::map<uint64_t, std::string> source_vocabids;
Table table;