check that pt exists

This commit is contained in:
Hieu Hoang 2016-10-06 13:48:06 +01:00
parent d03991acec
commit babc5acf70
2 changed files with 12 additions and 2 deletions

View File

@ -12,10 +12,15 @@ QueryEngine::QueryEngine(const char * filepath)
//Create filepaths
std::string basepath(filepath);
std::string path_to_config = basepath + "/config";
std::string path_to_hashtable = basepath + "/probing_hash.dat";
std::string path_to_source_vocabid = basepath + "/source_vocabids";
std::string alignPath = basepath + "/Alignments.dat";
if (!FileExists(path_to_config)) {
UTIL_THROW2("Binary table doesn't exist is didn't finish binarizing: " << path_to_config);
}
///Source phrase vocabids
read_map(source_vocabids, path_to_source_vocabid.c_str());
@ -25,7 +30,7 @@ QueryEngine::QueryEngine(const char * filepath)
//Read config file
boost::unordered_map<std::string, std::string> keyValue;
std::ifstream config((basepath + "/config").c_str());
std::ifstream config(path_to_config.c_str());
std::string line;
while (getline(config, line)) {
std::vector<std::string> toks = Moses2::Tokenize(line, "\t");

View File

@ -11,10 +11,15 @@ QueryEngine::QueryEngine(const char * filepath)
//Create filepaths
std::string basepath(filepath);
std::string path_to_config = basepath + "/config";
std::string path_to_hashtable = basepath + "/probing_hash.dat";
std::string path_to_source_vocabid = basepath + "/source_vocabids";
std::string alignPath = basepath + "/Alignments.dat";
if (!FileExists(path_to_config)) {
UTIL_THROW2("Binary table doesn't exist is didn't finish binarizing: " << path_to_config);
}
///Source phrase vocabids
read_map(source_vocabids, path_to_source_vocabid.c_str());
@ -24,7 +29,7 @@ QueryEngine::QueryEngine(const char * filepath)
//Read config file
boost::unordered_map<std::string, std::string> keyValue;
std::ifstream config((basepath + "/config").c_str());
std::ifstream config(path_to_config.c_str());
std::string line;
while (getline(config, line)) {
std::vector<std::string> toks = Tokenize(line, "\t");