2010-08-10 17:12:00 +04:00
|
|
|
// $Id: PhraseDictionaryMemory.cpp 2477 2009-08-07 16:47:54Z bhaddow $
|
|
|
|
// vim:tabstop=2
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
Moses - factored phrase-based language decoder
|
|
|
|
Copyright (C) 2010 University of Edinburgh
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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
|
|
|
|
***********************************************************************/
|
|
|
|
#ifndef moses_DecodeFeature
|
|
|
|
#define moses_DecodeFeature
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2013-05-24 22:11:15 +04:00
|
|
|
#include "moses/FF/StatelessFeatureFunction.h"
|
2013-08-30 19:03:06 +04:00
|
|
|
#include "moses/FactorTypeSet.h"
|
|
|
|
#include "moses/TypeDef.h"
|
2010-08-10 17:12:00 +04:00
|
|
|
|
2011-02-24 16:14:42 +03:00
|
|
|
namespace Moses
|
|
|
|
{
|
2013-12-05 17:06:35 +04:00
|
|
|
class DecodeStep;
|
2014-05-12 18:16:11 +04:00
|
|
|
class DecodeGraph;
|
2010-08-10 17:12:00 +04:00
|
|
|
|
|
|
|
/**
|
2013-02-19 21:31:11 +04:00
|
|
|
* Baseclass for phrase-table or generation table feature function
|
2010-08-10 17:12:00 +04:00
|
|
|
**/
|
2013-05-29 21:16:15 +04:00
|
|
|
class DecodeFeature : public StatelessFeatureFunction
|
|
|
|
{
|
2010-08-10 17:12:00 +04:00
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
public:
|
2013-10-29 22:44:33 +04:00
|
|
|
DecodeFeature(const std::string &line);
|
2013-02-04 05:09:15 +04:00
|
|
|
|
2013-10-29 22:44:33 +04:00
|
|
|
DecodeFeature(size_t numScoreComponents
|
2014-01-15 19:42:02 +04:00
|
|
|
, const std::string &line);
|
2013-01-18 21:57:26 +04:00
|
|
|
|
2013-10-29 22:44:33 +04:00
|
|
|
DecodeFeature(size_t numScoreComponents
|
2014-01-15 19:42:02 +04:00
|
|
|
, const std::vector<FactorType> &input
|
|
|
|
, const std::vector<FactorType> &output
|
|
|
|
, const std::string &line);
|
2013-05-29 21:16:15 +04:00
|
|
|
|
|
|
|
//! returns output factor types as specified by the ini file
|
|
|
|
const FactorMask& GetOutputFactorMask() const;
|
|
|
|
|
|
|
|
//! returns input factor types as specified by the ini file
|
|
|
|
const FactorMask& GetInputFactorMask() const;
|
|
|
|
|
|
|
|
const std::vector<FactorType>& GetInput() const;
|
|
|
|
const std::vector<FactorType>& GetOutput() const;
|
|
|
|
|
2013-05-30 15:41:08 +04:00
|
|
|
bool IsUseable(const FactorMask &mask) const;
|
2013-06-20 16:25:02 +04:00
|
|
|
void SetParameter(const std::string& key, const std::string& value);
|
2013-05-29 21:16:15 +04:00
|
|
|
|
2014-07-10 02:41:08 +04:00
|
|
|
void EvaluateWhenApplied(const Hypothesis& hypo,
|
2013-09-27 12:35:24 +04:00
|
|
|
ScoreComponentCollection* accumulator) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
2014-07-10 02:54:16 +04:00
|
|
|
void EvaluateWhenApplied(const ChartHypothesis &hypo,
|
2013-09-27 12:35:24 +04:00
|
|
|
ScoreComponentCollection* accumulator) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
2014-11-04 16:13:56 +03:00
|
|
|
void EvaluateWhenApplied(const Syntax::SHyperedge &hyperedge,
|
|
|
|
ScoreComponentCollection* accumulator) const
|
|
|
|
{}
|
2014-07-10 02:06:54 +04:00
|
|
|
void EvaluateWithSourceContext(const InputType &input
|
2013-09-27 12:35:24 +04:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
2014-05-08 20:51:45 +04:00
|
|
|
, const StackVec *stackVec
|
2013-12-03 19:50:41 +04:00
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection *estimatedFutureScore = NULL) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
2015-01-06 15:56:13 +03:00
|
|
|
void EvaluateTranslationOptionListWithSourceContext(const InputType &input
|
|
|
|
, const TranslationOptionList &translationOptionList) const
|
2015-01-06 12:46:31 +03:00
|
|
|
{}
|
|
|
|
|
2014-07-10 01:35:59 +04:00
|
|
|
void EvaluateInIsolation(const Phrase &source
|
2013-09-27 12:35:24 +04:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const
|
2013-08-30 18:49:00 +04:00
|
|
|
{}
|
|
|
|
|
2014-01-15 19:42:02 +04:00
|
|
|
void SetContainer(const DecodeStep *container) {
|
|
|
|
m_container = container;
|
|
|
|
}
|
2013-12-05 17:06:35 +04:00
|
|
|
|
2014-05-12 18:16:11 +04:00
|
|
|
const DecodeGraph &GetDecodeGraph() const;
|
|
|
|
|
2013-05-29 21:16:15 +04:00
|
|
|
protected:
|
|
|
|
std::vector<FactorType> m_input;
|
|
|
|
std::vector<FactorType> m_output;
|
|
|
|
FactorMask m_inputFactors;
|
|
|
|
FactorMask m_outputFactors;
|
2013-12-05 17:06:35 +04:00
|
|
|
const DecodeStep *m_container;
|
2010-08-10 17:12:00 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|