diff options
author | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-04-30 10:32:46 +0400 |
---|---|---|
committer | Nicola Bertoldi <bertoldi@fbk.eu> | 2014-04-30 10:32:46 +0400 |
commit | fe1ed42f812072f548cc98418f4aaa06fed98695 (patch) | |
tree | e5a55e73456df1e5d77df07e0ed00ccd2234c35f /moses/WordLattice.cpp | |
parent | 0313523d7dbc4a7c576e290043880959a87e94df (diff) | |
parent | ae4ab9aae0643defd9edaaa7c9d11b6589d4811b (diff) |
Merge branch 'master' into dynamic-models
Diffstat (limited to 'moses/WordLattice.cpp')
-rw-r--r-- | moses/WordLattice.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/moses/WordLattice.cpp b/moses/WordLattice.cpp index ab2a23861..cc91345cb 100644 --- a/moses/WordLattice.cpp +++ b/moses/WordLattice.cpp @@ -49,7 +49,12 @@ void WordLattice::Print(std::ostream& out) const out<<"\n\n"; } -int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector<FactorType>& factorOrder, const std::string& debug_line) +int +WordLattice:: +InitializeFromPCNDataType +(const PCN::CN& cn, + const std::vector<FactorType>& factorOrder, + const std::string& debug_line) { const StaticData &staticData = StaticData::Instance(); const InputFeature &inputFeature = InputFeature::Instance(); @@ -73,14 +78,20 @@ int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector< //check for correct number of link parameters if (alt.m_denseFeatures.size() != numInputScores) { - TRACE_ERR("ERROR: need " << numInputScores << " link parameters, found " << alt.m_denseFeatures.size() << " while reading column " << i << " from " << debug_line << "\n"); + TRACE_ERR("ERROR: need " << numInputScores + << " link parameters, found " + << alt.m_denseFeatures.size() + << " while reading column " << i + << " from " << debug_line << "\n"); return false; } //check each element for bounds std::vector<float>::const_iterator probsIterator; data[i][j].second = std::vector<float>(0); - for(probsIterator = alt.m_denseFeatures.begin(); probsIterator < alt.m_denseFeatures.end(); probsIterator++) { + for(probsIterator = alt.m_denseFeatures.begin(); + probsIterator < alt.m_denseFeatures.end(); + probsIterator++) { IFVERBOSE(1) { if (*probsIterator < 0.0f) { TRACE_ERR("WARN: neg probability: " << *probsIterator << "\n"); @@ -102,7 +113,9 @@ int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector< float value = (alt.m_word=="" || alt.m_word==EPSILON) ? 0.0f : -1.0f; data[i][j].second.denseScores.push_back(value); } - String2Word(alt.m_word, data[i][j]. first, factorOrder); + Word& w = data[i][j].first; + w.CreateFromString(Input,factorOrder,StringPiece(alt.m_word),false); + // String2Word(alt.m_word, data[i][j]. first, factorOrder); next_nodes[i][j] = alt.m_next; if(next_nodes[i][j] > maxSizePhrase) { |