diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-06 01:34:22 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-06 01:34:22 +0400 |
commit | 12c4a0a68e104a38c8f0765078b063508413fab7 (patch) | |
tree | 04259f6b71804ee47479d8a3ea4a806ab89705f1 /moses/WordLattice.cpp | |
parent | 6f81004e206e2200c4d98c7090b3ecb7ec842daf (diff) |
lattice decoding with sparse features
Diffstat (limited to 'moses/WordLattice.cpp')
-rw-r--r-- | moses/WordLattice.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/moses/WordLattice.cpp b/moses/WordLattice.cpp index fd14da3e1..ff1d25e66 100644 --- a/moses/WordLattice.cpp +++ b/moses/WordLattice.cpp @@ -54,17 +54,16 @@ int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector< for (size_t j=0; j<col.size(); ++j) { const PCN::CNAlt& alt = col[j]; - //check for correct number of link parameters - if (alt.first.second.size() != numInputScores) { - TRACE_ERR("ERROR: need " << numInputScores << " link parameters, found " << alt.first.second.size() << " while reading column " << i << " from " << debug_line << "\n"); + 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"); return false; } //check each element for bounds std::vector<float>::const_iterator probsIterator; data[i][j].second = std::vector<float>(0); - for(probsIterator = alt.first.second.begin(); probsIterator < alt.first.second.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"); @@ -80,11 +79,11 @@ int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector< //store 'real' word count in last feature if we have one more weight than we do arc scores and not epsilon if (addRealWordCount) { //only add count if not epsilon - float value = (alt.first.first=="" || alt.first.first==EPSILON) ? 0.0f : -1.0f; + float value = (alt.m_word=="" || alt.m_word==EPSILON) ? 0.0f : -1.0f; data[i][j].second.push_back(value); } - String2Word(alt.first.first,data[i][j].first,factorOrder); - next_nodes[i][j] = alt.second; + String2Word(alt.m_word, data[i][j]. first, factorOrder); + next_nodes[i][j] = alt.m_next; if(next_nodes[i][j] > maxSizePhrase) { TRACE_ERR("ERROR: Jump length " << next_nodes[i][j] << " in word lattice exceeds maximum phrase length " << maxSizePhrase << ".\n"); |