mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
split classes in FeatureFunction files
This commit is contained in:
parent
a615421882
commit
75a1849bcf
@ -68,12 +68,6 @@
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.1495793082" name="SRI.h" rcbsApplicability="disable" resourcePath="LM/SRI.h" toolsToInvoke=""/>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.1830045369" name="Backward.h" rcbsApplicability="disable" resourcePath="LM/Backward.h" toolsToInvoke=""/>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.1283955357" name="BackwardLMState.h" rcbsApplicability="disable" resourcePath="LM/BackwardLMState.h" toolsToInvoke=""/>
|
||||
<fileInfo id="cdt.managedbuild.config.gnu.exe.debug.656913512.839127937" name="PhraseLengthFeatureTest.cpp" rcbsApplicability="disable" resourcePath="FF/PhraseLengthFeatureTest.cpp" toolsToInvoke="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327.2106803358">
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327.2106803358" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1774992327"/>
|
||||
</fileInfo>
|
||||
<sourceEntries>
|
||||
<entry excluding="FF/PhraseLengthFeatureTest.cpp|PhraseLengthFeatureTest.cpp|LM/BackwardTest.cpp|LM/BackwardLMState.h|LM/BackwardLMState.cpp|LM/Backward.h|LM/Backward.cpp|FeatureVectorTest.cpp|LM/ParallelBackoff.h|LM/ParallelBackoff.cpp|src/SyntacticLanguageModelState.h|src/SyntacticLanguageModelFiles.h|src/SyntacticLanguageModel.h|src/SyntacticLanguageModel.cpp|src/LM/SRI.h|src/LM/SRI.cpp|src/LM/Rand.h|src/LM/Rand.cpp|src/LM/LDHT.h|src/LM/LDHT.cpp|SyntacticLanguageModelState.h|SyntacticLanguageModelFiles.h|SyntacticLanguageModel.h|SyntacticLanguageModel.cpp|LM/Rand.h|LM/Rand.cpp|LM/LDHT.h|LM/LDHT.cpp" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
|
||||
</sourceEntries>
|
||||
|
@ -1056,6 +1056,16 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/BleuScoreFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/ChartBasedFeatureContext.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ChartBasedFeatureContext.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/ChartBasedFeatureContext.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ChartBasedFeatureContext.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/DummyScoreProducers.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1106,6 +1116,16 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/GlobalLexicalModelUnlimited.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/PhraseBasedFeatureContext.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/PhraseBasedFeatureContext.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/PhraseBasedFeatureContext.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/PhraseBasedFeatureContext.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/PhraseBoundaryFeature.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1151,6 +1171,26 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SourceWordDeletionFeature.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/StatefulFeatureFunction.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/StatefulFeatureFunction.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/StatefulFeatureFunction.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/StatefulFeatureFunction.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/StatelessFeatureFunction.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/StatelessFeatureFunction.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/StatelessFeatureFunction.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/StatelessFeatureFunction.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>FF/TargetBigramFeature.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1366,11 +1406,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/backward.arpa</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/BilingualDynSuffixArray.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1521,21 +1556,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/lm.log</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/lm.log</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/lm.log</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerCYKPlus.cpp</name>
|
||||
<type>1</type>
|
||||
@ -2066,16 +2086,6 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7</name>
|
||||
<type>2</type>
|
||||
@ -2096,16 +2106,6 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7/release</name>
|
||||
<type>2</type>
|
||||
@ -2121,16 +2121,6 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7/release/debug-symbols-on</name>
|
||||
<type>2</type>
|
||||
@ -2146,16 +2136,6 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7/release/debug-symbols-on/link-static</name>
|
||||
<type>2</type>
|
||||
@ -2781,36 +2761,6 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/moses_test.passed</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Factory.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Factory.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/IRST.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/IRST.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/ORLM.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/ORLM.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/ParallelBackoff.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/ParallelBackoff.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/SRI.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/SRI.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi</name>
|
||||
<type>2</type>
|
||||
@ -2961,76 +2911,6 @@
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Backward.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Backward.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardLMState.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardLMState.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.output</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.output</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.run</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.run</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.test</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BackwardTest.test</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Base.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Base.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Implementation.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Implementation.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Joint.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Joint.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Ken.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Ken.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/MultiFactor.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/MultiFactor.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Remote.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/Remote.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/SingleFactor.o</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/bin/BackwardTest.test/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/SingleFactor.o</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/CompactPT/bin/gcc-4.7/release/debug-symbols-on/link-static/threading-multi/BlockHashIndex.o</name>
|
||||
<type>1</type>
|
||||
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <vector>
|
||||
|
||||
#include "FactorTypeSet.h"
|
||||
#include "moses/FF/FeatureFunction.h"
|
||||
#include "moses/FF/StatelessFeatureFunction.h"
|
||||
#include "TypeDef.h"
|
||||
|
||||
namespace Moses
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatefulFeatureFunction.h"
|
||||
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "moses/Phrase.h"
|
||||
|
@ -3,7 +3,8 @@
|
||||
#ifndef moses_DummyScoreProducers_h
|
||||
#define moses_DummyScoreProducers_h
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "StatefulFeatureFunction.h"
|
||||
#include "util/check.hh"
|
||||
|
||||
namespace Moses
|
||||
|
@ -83,75 +83,6 @@ public:
|
||||
, ScoreComponentCollection &scoreBreakdown) const;
|
||||
};
|
||||
|
||||
/** base class for all stateless feature functions.
|
||||
* eg. phrase table, word penalty, phrase penalty
|
||||
*/
|
||||
class StatelessFeatureFunction: public FeatureFunction
|
||||
{
|
||||
//All stateless FFs, except those that cache scores in T-Option
|
||||
static std::vector<const StatelessFeatureFunction*> m_statelessFFs;
|
||||
|
||||
public:
|
||||
static const std::vector<const StatelessFeatureFunction*>& GetStatelessFeatureFunctions() {return m_statelessFFs;}
|
||||
|
||||
StatelessFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatelessFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
/**
|
||||
* This should be implemented for features that apply to phrase-based models.
|
||||
**/
|
||||
virtual void Evaluate(const PhraseBasedFeatureContext& context,
|
||||
ScoreComponentCollection* accumulator) const
|
||||
{}
|
||||
|
||||
/**
|
||||
* Same for chart-based features.
|
||||
**/
|
||||
virtual void EvaluateChart(const ChartBasedFeatureContext& context,
|
||||
ScoreComponentCollection* accumulator) const
|
||||
{}
|
||||
|
||||
virtual bool IsStateless() const
|
||||
{ return true; }
|
||||
|
||||
};
|
||||
|
||||
/** base class for all stateful feature functions.
|
||||
* eg. LM, distortion penalty
|
||||
*/
|
||||
class StatefulFeatureFunction: public FeatureFunction
|
||||
{
|
||||
//All statefull FFs
|
||||
static std::vector<const StatefulFeatureFunction*> m_statefulFFs;
|
||||
|
||||
public:
|
||||
static const std::vector<const StatefulFeatureFunction*>& GetStatefulFeatureFunctions() {return m_statefulFFs;}
|
||||
|
||||
StatefulFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
|
||||
/**
|
||||
* \brief This interface should be implemented.
|
||||
* Notes: When evaluating the value of this feature function, you should avoid
|
||||
* calling hypo.GetPrevHypo(). If you need something from the "previous"
|
||||
* hypothesis, you should store it in an FFState object which will be passed
|
||||
* in as prev_state. If you don't do this, you will get in trouble.
|
||||
*/
|
||||
virtual FFState* Evaluate(
|
||||
const Hypothesis& cur_hypo,
|
||||
const FFState* prev_state,
|
||||
ScoreComponentCollection* accumulator) const = 0;
|
||||
|
||||
virtual FFState* EvaluateChart(
|
||||
const ChartHypothesis& /* cur_hypo */,
|
||||
int /* featureID - used to index the state in the previous hypotheses */,
|
||||
ScoreComponentCollection* accumulator) const = 0;
|
||||
|
||||
//! return the state associated with the empty hypothesis for a given sentence
|
||||
virtual const FFState* EmptyHypothesisState(const InputType &input) const = 0;
|
||||
|
||||
bool IsStateless() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/Factor.h"
|
||||
#include "moses/Phrase.h"
|
||||
#include "moses/TypeDef.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/Factor.h"
|
||||
#include "moses/Phrase.h"
|
||||
#include "moses/TypeDef.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatefulFeatureFunction.h"
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "moses/Word.h"
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "moses/Word.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/Factor.h"
|
||||
#include "moses/Sentence.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
#include "moses/AlignmentInfo.h"
|
||||
|
||||
|
2
moses/FF/StatefulFeatureFunction.cpp
Normal file
2
moses/FF/StatefulFeatureFunction.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "StatefulFeatureFunction.h"
|
||||
|
49
moses/FF/StatefulFeatureFunction.h
Normal file
49
moses/FF/StatefulFeatureFunction.h
Normal file
@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
/** base class for all stateful feature functions.
|
||||
* eg. LM, distortion penalty
|
||||
*/
|
||||
class StatefulFeatureFunction: public FeatureFunction
|
||||
{
|
||||
//All statefull FFs
|
||||
static std::vector<const StatefulFeatureFunction*> m_statefulFFs;
|
||||
|
||||
public:
|
||||
static const std::vector<const StatefulFeatureFunction*>& GetStatefulFeatureFunctions() {return m_statefulFFs;}
|
||||
|
||||
StatefulFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatefulFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
|
||||
/**
|
||||
* \brief This interface should be implemented.
|
||||
* Notes: When evaluating the value of this feature function, you should avoid
|
||||
* calling hypo.GetPrevHypo(). If you need something from the "previous"
|
||||
* hypothesis, you should store it in an FFState object which will be passed
|
||||
* in as prev_state. If you don't do this, you will get in trouble.
|
||||
*/
|
||||
virtual FFState* Evaluate(
|
||||
const Hypothesis& cur_hypo,
|
||||
const FFState* prev_state,
|
||||
ScoreComponentCollection* accumulator) const = 0;
|
||||
|
||||
virtual FFState* EvaluateChart(
|
||||
const ChartHypothesis& /* cur_hypo */,
|
||||
int /* featureID - used to index the state in the previous hypotheses */,
|
||||
ScoreComponentCollection* accumulator) const = 0;
|
||||
|
||||
//! return the state associated with the empty hypothesis for a given sentence
|
||||
virtual const FFState* EmptyHypothesisState(const InputType &input) const = 0;
|
||||
|
||||
bool IsStateless() const;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,8 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
/** base class for all stateless feature functions.
|
||||
* eg. phrase table, word penalty, phrase penalty
|
||||
*/
|
||||
class StatelessFeatureFunction: public FeatureFunction
|
||||
{
|
||||
//All stateless FFs, except those that cache scores in T-Option
|
||||
static std::vector<const StatelessFeatureFunction*> m_statelessFFs;
|
||||
|
||||
public:
|
||||
static const std::vector<const StatelessFeatureFunction*>& GetStatelessFeatureFunctions() {return m_statelessFFs;}
|
||||
|
||||
StatelessFeatureFunction(const std::string& description, const std::string &line);
|
||||
StatelessFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
||||
/**
|
||||
* This should be implemented for features that apply to phrase-based models.
|
||||
**/
|
||||
virtual void Evaluate(const PhraseBasedFeatureContext& context,
|
||||
ScoreComponentCollection* accumulator) const
|
||||
{}
|
||||
|
||||
/**
|
||||
* Same for chart-based features.
|
||||
**/
|
||||
virtual void EvaluateChart(const ChartBasedFeatureContext& context,
|
||||
ScoreComponentCollection* accumulator) const
|
||||
{}
|
||||
|
||||
virtual bool IsStateless() const
|
||||
{ return true; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <map>
|
||||
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatefulFeatureFunction.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
#include "moses/Word.h"
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatefulFeatureFunction.h"
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "moses/Word.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "FeatureFunction.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
#include "moses/AlignmentInfo.h"
|
||||
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include <string>
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include "moses/FF/FFState.h"
|
||||
#include "FeatureFunction.h"
|
||||
#include "moses/FactorCollection.h"
|
||||
#include "moses/Sentence.h"
|
||||
#include "FFState.h"
|
||||
#include "StatelessFeatureFunction.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
@ -45,6 +45,8 @@ class TranslationOption;
|
||||
class WordsRange;
|
||||
class Hypothesis;
|
||||
class FFState;
|
||||
class StatelessFeatureFunction;
|
||||
class StatefulFeatureFunction;
|
||||
class Manager;
|
||||
class LexicalReordering;
|
||||
|
||||
|
@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <string>
|
||||
#include <cstddef>
|
||||
|
||||
#include "moses/FF/FeatureFunction.h"
|
||||
#include "moses/FF/StatefulFeatureFunction.h"
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#include "LexicalReorderingState.h"
|
||||
#include "LexicalReorderingTable.h"
|
||||
#include "moses/FF/FeatureFunction.h"
|
||||
#include "moses/FF/StatefulFeatureFunction.h"
|
||||
|
||||
|
||||
namespace Moses
|
||||
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include "moses/FF/DummyScoreProducers.h"
|
||||
#include "moses/FF/FeatureFunction.h"
|
||||
#include "moses/FF/StatelessFeatureFunction.h"
|
||||
#include "ScoreComponentCollection.h"
|
||||
|
||||
using namespace Moses;
|
||||
|
Loading…
Reference in New Issue
Block a user