diff options
author | Matthias Huck <mhuck@inf.ed.ac.uk> | 2015-07-24 23:51:34 +0300 |
---|---|---|
committer | Matthias Huck <mhuck@inf.ed.ac.uk> | 2015-07-24 23:51:34 +0300 |
commit | 31df9593523974331990c0338d6717060b6bcc03 (patch) | |
tree | a897cd66bd921e8a2f9c0429ab5bd69a46769e85 /moses/FF | |
parent | 21aaec0105ffc69c48a4c8977b965af3e05c7a04 (diff) |
Model1Feature
Diffstat (limited to 'moses/FF')
-rw-r--r-- | moses/FF/Model1Feature.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/moses/FF/Model1Feature.cpp b/moses/FF/Model1Feature.cpp index 09cfd47ab..3bde70cfc 100644 --- a/moses/FF/Model1Feature.cpp +++ b/moses/FF/Model1Feature.cpp @@ -75,7 +75,7 @@ void Model1Vocabulary::Load(const std::string& fileName) ++i; std::vector<std::string> tokens = Tokenize(line); UTIL_THROW_IF2(tokens.size()!=3, "Line " << i << " in " << fileName << " has wrong number of tokens."); - unsigned id = Scan<unsigned>(tokens[0]); + unsigned id = std::atoll( tokens[0].c_str() ); if (! ( (id == 1) && (tokens[1] == "UNK") )) { const Factor* factor = factorCollection.AddFactor(tokens[1],false); // TODO: can we assume that the vocabulary is know and filter the model on loading? bool stored = Store(factor, id); @@ -86,7 +86,7 @@ void Model1Vocabulary::Load(const std::string& fileName) ++i; std::vector<std::string> tokens = Tokenize(line); UTIL_THROW_IF2(tokens.size()!=3, "Line " << i << " in " << fileName << " has wrong number of tokens."); - unsigned id = Scan<unsigned>(tokens[0]); + unsigned id = std::atoll( tokens[0].c_str() ); const Factor* factor = factorCollection.AddFactor(tokens[1],false); // TODO: can we assume that the vocabulary is know and filter the model on loading? bool stored = Store(factor, id); UTIL_THROW_IF2(!stored, "Line " << i << " in " << fileName << " overwrites existing vocabulary entry."); @@ -105,11 +105,11 @@ void Model1LexicalTable::Load(const std::string &fileName, const Model1Vocabular ++i; std::vector<std::string> tokens = Tokenize(line); UTIL_THROW_IF2(tokens.size()!=3, "Line " << i << " in " << fileName << " has wrong number of tokens."); - unsigned idS = Scan<unsigned>(tokens[0]); - unsigned idT = Scan<unsigned>(tokens[1]); + unsigned idS = std::atoll( tokens[0].c_str() ); + unsigned idT = std::atoll( tokens[1].c_str() ); const Factor* wordS = vcbS.GetWord(idS); const Factor* wordT = vcbT.GetWord(idT); - float prob = Scan<float>(tokens[2]); + float prob = std::atof( tokens[2].c_str() ); if ( (wordS != NULL) && (wordT != NULL) ) { m_ltable[ wordS ][ wordT ] = prob; } |