2010-04-12 14:15:49 +04:00
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based language decoder
|
|
|
|
Copyright (C) 2010 Hieu Hoang
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +04:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +04:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2010-04-12 14:15:49 +04:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
***********************************************************************/
|
2010-04-08 21:16:10 +04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2012-01-25 16:26:28 +04:00
|
|
|
#include "StackVec.h"
|
2011-06-27 19:13:15 +04:00
|
|
|
#include "TargetPhrase.h"
|
|
|
|
#include "TargetPhraseCollection.h"
|
|
|
|
#include "WordsRange.h"
|
|
|
|
|
2011-11-18 16:07:41 +04:00
|
|
|
#include "util/check.hh"
|
2010-04-08 21:16:10 +04:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
2011-06-27 19:13:15 +04:00
|
|
|
|
2012-06-27 03:45:02 +04:00
|
|
|
/** Similar to a DottedRule, but contains a direct reference to a list
|
|
|
|
* of translations and provdes an estimate of the best score.
|
|
|
|
*/
|
2010-09-23 21:39:32 +04:00
|
|
|
class ChartTranslationOption
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2011-06-27 19:13:15 +04:00
|
|
|
public:
|
|
|
|
ChartTranslationOption(const TargetPhraseCollection &targetPhraseColl,
|
2012-01-25 16:26:28 +04:00
|
|
|
const StackVec &stackVec,
|
2012-02-07 03:54:01 +04:00
|
|
|
const WordsRange &wordsRange,
|
|
|
|
float score)
|
2012-01-25 16:26:28 +04:00
|
|
|
: m_stackVec(stackVec)
|
2012-02-07 03:54:01 +04:00
|
|
|
, m_targetPhraseCollection(&targetPhraseColl)
|
|
|
|
, m_wordsRange(&wordsRange)
|
|
|
|
, m_estimateOfBestScore(score) {}
|
2011-04-05 00:43:02 +04:00
|
|
|
|
2011-06-27 19:13:15 +04:00
|
|
|
~ChartTranslationOption() {}
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2012-02-07 03:54:01 +04:00
|
|
|
static float CalcEstimateOfBestScore(const TargetPhraseCollection &,
|
|
|
|
const StackVec &);
|
|
|
|
|
2012-01-25 16:26:28 +04:00
|
|
|
const StackVec &GetStackVec() const { return m_stackVec; }
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2011-06-27 19:13:15 +04:00
|
|
|
const TargetPhraseCollection &GetTargetPhraseCollection() const {
|
2012-02-07 03:54:01 +04:00
|
|
|
return *m_targetPhraseCollection;
|
2011-06-27 19:13:15 +04:00
|
|
|
}
|
|
|
|
|
2011-03-11 19:28:36 +03:00
|
|
|
const WordsRange &GetSourceWordsRange() const {
|
2012-02-07 03:54:01 +04:00
|
|
|
return *m_wordsRange;
|
2011-02-24 16:14:42 +03:00
|
|
|
}
|
|
|
|
|
2011-04-05 00:43:02 +04:00
|
|
|
// return an estimate of the best score possible with this translation option.
|
2011-06-27 19:13:15 +04:00
|
|
|
// the estimate is the sum of the top target phrase's estimated score plus the
|
|
|
|
// scores of the best child hypotheses.
|
|
|
|
inline float GetEstimateOfBestScore() const { return m_estimateOfBestScore; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2012-02-07 03:54:01 +04:00
|
|
|
StackVec m_stackVec;
|
|
|
|
const TargetPhraseCollection *m_targetPhraseCollection;
|
|
|
|
const WordsRange *m_wordsRange;
|
2011-06-27 19:13:15 +04:00
|
|
|
float m_estimateOfBestScore;
|
2010-04-08 21:16:10 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|