Ejemplo n.º 1
0
void LexicalReordering::EmptyHypothesisState(FFState &state,
    const ManagerBase &mgr, const InputType &input,
    const Hypothesis &hypo) const
{
  BidirectionalReorderingState &stateCast =
      static_cast<BidirectionalReorderingState&>(state);
  stateCast.Init(NULL, hypo.GetTargetPhrase(), hypo.GetInputPath(), true,
      &hypo.GetBitmap());
}
void PhraseBasedReorderingState::Expand(const ManagerBase &mgr,
    const LexicalReordering &ff, const Hypothesis &hypo, size_t phraseTableInd,
    Scores &scores, FFState &state) const
{
  if ((m_direction != LRModel::Forward) || !m_first) {
    LRModel const& lrmodel = m_configuration;
    Range const &cur = hypo.GetInputPath().range;
    LRModel::ReorderingType reoType = (
        m_first ?
            lrmodel.GetOrientation(cur) :
            lrmodel.GetOrientation(prevPath->range, cur));
    CopyScores(mgr.system, scores, hypo.GetTargetPhrase(), reoType);
  }

  PhraseBasedReorderingState &stateCast =
      static_cast<PhraseBasedReorderingState&>(state);
  stateCast.Init(this, hypo.GetTargetPhrase(), hypo.GetInputPath(), false,
      NULL);
}