diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-31 15:50:52 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-31 15:50:52 +0300 |
commit | 324c378f7fc54f02a8ea264915d3eade867ff23d (patch) | |
tree | 2bb934fee448845b0524427d437c871e7118ac2c /moses/ConfusionNet.cpp | |
parent | dc8ad899454bd82408c6a371d5f50e497ede0caa (diff) |
Options refactoring. Moses crashed in server mode when asked to provide n-best translations with scores.
Diffstat (limited to 'moses/ConfusionNet.cpp')
-rw-r--r-- | moses/ConfusionNet.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/moses/ConfusionNet.cpp b/moses/ConfusionNet.cpp index 41522268d..188c57438 100644 --- a/moses/ConfusionNet.cpp +++ b/moses/ConfusionNet.cpp @@ -110,29 +110,14 @@ ReadF(std::istream& in, const std::vector<FactorType>& factorOrder, int format) int ConfusionNet:: Read(std::istream& in, - const std::vector<FactorType>& factorOrder) + const std::vector<FactorType>& factorOrder, + AllOptions const& opts) { int rv=ReadF(in,factorOrder,0); if(rv) stats.collect(*this); return rv; } -#if 0 -// Deprecated due to code duplication; -// use Word::CreateFromString() instead -void -ConfusionNet:: -String2Word(const std::string& s,Word& w, - const std::vector<FactorType>& factorOrder) -{ - std::vector<std::string> factorStrVector = Tokenize(s, "|"); - for(size_t i=0; i<factorOrder.size(); ++i) - w.SetFactor(factorOrder[i], - FactorCollection::Instance().AddFactor - (Input,factorOrder[i], factorStrVector[i])); -} -#endif - bool ConfusionNet:: ReadFormat0(std::istream& in, const std::vector<FactorType>& factorOrder) @@ -161,7 +146,8 @@ ReadFormat0(std::istream& in, const std::vector<FactorType>& factorOrder) for(size_t i=0; i < numInputScores; i++) { double prob; if (!(is>>prob)) { - TRACE_ERR("ERROR: unable to parse CN input - bad link probability, or wrong number of scores\n"); + TRACE_ERR("ERROR: unable to parse CN input - bad link probability, " + << "or wrong number of scores\n"); return false; } if(prob<0.0) { @@ -174,7 +160,8 @@ ReadFormat0(std::istream& in, const std::vector<FactorType>& factorOrder) probs[i] = (std::max(static_cast<float>(log(prob)),LOWEST_SCORE)); } - //store 'real' word count in last feature if we have one more weight than we do arc scores and not epsilon + // store 'real' word count in last feature if we have one more + // weight than we do arc scores and not epsilon if (addRealWordCount && word!=EPSILON && word!="") probs.back() = -1.0; |