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
|
2012-07-10 12:18:37 +04:00
|
|
|
* of translations and provdes an estimate of the best score. For a specific range in the input sentence
|
2012-06-27 03:45:02 +04:00
|
|
|
*/
|
2012-09-25 20:34:43 +04:00
|
|
|
class ChartTranslationOptions
|
2010-04-08 21:16:10 +04:00
|
|
|
{
|
2013-05-29 21:16:15 +04:00
|
|
|
public:
|
2012-07-10 12:18:37 +04:00
|
|
|
/** Constructor
|
|
|
|
\param targetPhraseColl @todo dunno
|
|
|
|
\param stackVec @todo dunno
|
|
|
|
\param wordsRange the range in the source sentence this translation option covers
|
|
|
|
\param score @todo dunno
|
|
|
|
*/
|
2012-09-25 20:34:43 +04:00
|
|
|
ChartTranslationOptions(const TargetPhraseCollection &targetPhraseColl,
|
2013-05-29 21:16:15 +04:00
|
|
|
const StackVec &stackVec,
|
|
|
|
const WordsRange &wordsRange,
|
|
|
|
float score)
|
|
|
|
: m_stackVec(stackVec)
|
|
|
|
, m_targetPhraseCollection(&targetPhraseColl)
|
|
|
|
, m_wordsRange(&wordsRange)
|
2013-06-10 21:11:55 +04:00
|
|
|
, m_estimateOfBestScore(score) {
|
|
|
|
}
|
2011-04-05 00:43:02 +04:00
|
|
|
|
2012-09-25 20:34:43 +04:00
|
|
|
~ChartTranslationOptions() {}
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2012-02-07 03:54:01 +04:00
|
|
|
static float CalcEstimateOfBestScore(const TargetPhraseCollection &,
|
|
|
|
const StackVec &);
|
|
|
|
|
2012-07-10 12:18:37 +04:00
|
|
|
//! @todo dunno
|
2013-05-29 21:16:15 +04:00
|
|
|
const StackVec &GetStackVec() const {
|
|
|
|
return m_stackVec;
|
|
|
|
}
|
2011-02-24 16:14:42 +03:00
|
|
|
|
2012-07-10 12:18:37 +04:00
|
|
|
//! @todo isn't the translation suppose to just contain 1 target phrase, not a whole collection of them?
|
2013-05-29 21:16: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
|
|
|
}
|
|
|
|
|
2012-07-10 12:18:37 +04:00
|
|
|
//! the range in the source sentence this translation option covers
|
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
|
|
|
}
|
|
|
|
|
2012-07-10 12:18:37 +04:00
|
|
|
/** return an estimate of the best score possible with this translation option.
|
|
|
|
* the estimate is the sum of the top target phrase's estimated score plus the
|
|
|
|
* scores of the best child hypotheses.
|
|
|
|
*/
|
2013-05-29 21:16:15 +04:00
|
|
|
inline float GetEstimateOfBestScore() const {
|
|
|
|
return m_estimateOfBestScore;
|
|
|
|
}
|
2011-06-27 19:13:15 +04:00
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
private:
|
2011-06-27 19:13:15 +04:00
|
|
|
|
2012-07-10 12:18:37 +04:00
|
|
|
StackVec m_stackVec; //! vector of hypothesis list!
|
2012-02-07 03:54:01 +04:00
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|