diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2012-12-06 00:21:33 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2012-12-06 00:21:33 +0400 |
commit | da9cd0e3aadc5154d262f8c37697b1c429280594 (patch) | |
tree | ea2d91a5074aeb472d0a315ca2246e40e544b8c6 /moses/WordLattice.cpp | |
parent | b8d4c64d6d8c3b1045d3d91772422d8ee4e5826e (diff) |
clean up weights code for confusion networks & lattices. Works, except for multiple phrase-tables or factors
Diffstat (limited to 'moses/WordLattice.cpp')
-rw-r--r-- | moses/WordLattice.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/moses/WordLattice.cpp b/moses/WordLattice.cpp index f3344dc67..228d8e995 100644 --- a/moses/WordLattice.cpp +++ b/moses/WordLattice.cpp @@ -33,12 +33,14 @@ void WordLattice::Print(std::ostream& out) const int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector<FactorType>& factorOrder, const std::string& debug_line) { - size_t numLinkParams = StaticData::Instance().GetNumLinkParams(); - size_t numLinkWeights = StaticData::Instance().GetNumInputScores(); size_t maxSizePhrase = StaticData::Instance().GetMaxPhraseLength(); + size_t numInputScores = StaticData::Instance().GetNumInputScores(); + size_t numRealWordCount = StaticData::Instance().GetNumRealWordsInInput(); + size_t totalCount = numInputScores + numRealWordCount; + bool addRealWordCount = (numRealWordCount > 0); + //when we have one more weight than params, we add a word count feature - bool addRealWordCount = ((numLinkParams + 1) == numLinkWeights); data.resize(cn.size()); next_nodes.resize(cn.size()); for(size_t i=0; i<cn.size(); ++i) { @@ -51,8 +53,8 @@ int WordLattice::InitializeFromPCNDataType(const PCN::CN& cn, const std::vector< //check for correct number of link parameters - if (alt.first.second.size() != numLinkParams) { - TRACE_ERR("ERROR: need " << numLinkParams << " link parameters, found " << alt.first.second.size() << " while reading column " << i << " from " << debug_line << "\n"); + 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"); return false; } |