void SpanLength::EvaluateWithSourceContext(const InputType &input , const InputPath &inputPath , const TargetPhrase &targetPhrase , const StackVec *stackVec , ScoreComponentCollection &scoreBreakdown , ScoreComponentCollection *estimatedFutureScore) const { assert(stackVec); const PhraseProperty *property = targetPhrase.GetProperty("SpanLength"); if (property == NULL) { return; } const SpanLengthPhraseProperty *slProp = static_cast<const SpanLengthPhraseProperty*>(property); const Phrase *ruleSource = targetPhrase.GetRuleSource(); assert(ruleSource); float score = 0; for (size_t i = 0; i < stackVec->size(); ++i) { const ChartCellLabel &cell = *stackVec->at(i); const WordsRange &ntRange = cell.GetCoverage(); size_t sourceWidth = ntRange.GetNumWordsCovered(); float prob = slProp->GetProb(i, sourceWidth, m_const); score += TransformScore(prob); } if (score < -100.0f) { float weight = StaticData::Instance().GetWeight(this); if (weight < 0) { score = -100; } } scoreBreakdown.PlusEquals(this, score); }