rename Skeleton... to Example...

This commit is contained in:
Hieu Hoang 2017-04-26 13:10:32 +01:00
parent ae476ae531
commit 80791d1767
17 changed files with 125 additions and 128 deletions

View File

@ -1200,6 +1200,26 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/EditOps.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/FF/EditOps.h</locationURI>
</link> </link>
<link>
<name>FF/ExampleStatefulFF.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ExampleStatefulFF.cpp</locationURI>
</link>
<link>
<name>FF/ExampleStatefulFF.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ExampleStatefulFF.h</locationURI>
</link>
<link>
<name>FF/ExampleStatelessFF.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ExampleStatelessFF.cpp</locationURI>
</link>
<link>
<name>FF/ExampleStatelessFF.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/ExampleStatelessFF.h</locationURI>
</link>
<link> <link>
<name>FF/FFState.cpp</name> <name>FF/FFState.cpp</name>
<type>1</type> <type>1</type>
@ -1420,26 +1440,6 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SetSourcePhrase.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/FF/SetSourcePhrase.h</locationURI>
</link> </link>
<link>
<name>FF/SkeletonStatefulFF.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SkeletonStatefulFF.cpp</locationURI>
</link>
<link>
<name>FF/SkeletonStatefulFF.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SkeletonStatefulFF.h</locationURI>
</link>
<link>
<name>FF/SkeletonStatelessFF.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SkeletonStatelessFF.cpp</locationURI>
</link>
<link>
<name>FF/SkeletonStatelessFF.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/FF/SkeletonStatelessFF.h</locationURI>
</link>
<link> <link>
<name>FF/SoftMatchingFeature.cpp</name> <name>FF/SoftMatchingFeature.cpp</name>
<type>1</type> <type>1</type>
@ -1695,6 +1695,16 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/DALMWrapper.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/LM/DALMWrapper.h</locationURI>
</link> </link>
<link>
<name>LM/ExampleLM.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/ExampleLM.cpp</locationURI>
</link>
<link>
<name>LM/ExampleLM.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/ExampleLM.h</locationURI>
</link>
<link> <link>
<name>LM/IRST.cpp</name> <name>LM/IRST.cpp</name>
<type>1</type> <type>1</type>
@ -1845,16 +1855,6 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/SingleFactor.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/LM/SingleFactor.h</locationURI>
</link> </link>
<link>
<name>LM/SkeletonLM.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/SkeletonLM.cpp</locationURI>
</link>
<link>
<name>LM/SkeletonLM.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/SkeletonLM.h</locationURI>
</link>
<link> <link>
<name>LM/backward.arpa</name> <name>LM/backward.arpa</name>
<type>1</type> <type>1</type>
@ -2140,6 +2140,16 @@
<type>2</type> <type>2</type>
<locationURI>virtual:/virtual</locationURI> <locationURI>virtual:/virtual</locationURI>
</link> </link>
<link>
<name>TranslationModel/ExamplePT.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/ExamplePT.cpp</locationURI>
</link>
<link>
<name>TranslationModel/ExamplePT.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/ExamplePT.h</locationURI>
</link>
<link> <link>
<name>TranslationModel/PhraseDictionary.cpp</name> <name>TranslationModel/PhraseDictionary.cpp</name>
<type>1</type> <type>1</type>
@ -2290,16 +2300,6 @@
<type>2</type> <type>2</type>
<locationURI>virtual:/virtual</locationURI> <locationURI>virtual:/virtual</locationURI>
</link> </link>
<link>
<name>TranslationModel/SkeletonPT.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/SkeletonPT.cpp</locationURI>
</link>
<link>
<name>TranslationModel/SkeletonPT.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/SkeletonPT.h</locationURI>
</link>
<link> <link>
<name>TranslationModel/UG</name> <name>TranslationModel/UG</name>
<type>2</type> <type>2</type>
@ -3135,6 +3135,16 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerCYKPlus.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerCYKPlus.h</locationURI>
</link> </link>
<link>
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.cpp</locationURI>
</link>
<link>
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.h</locationURI>
</link>
<link> <link>
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp</name> <name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerMemory.cpp</name>
<type>1</type> <type>1</type>
@ -3165,16 +3175,6 @@
<type>1</type> <type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h</locationURI> <locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerOnDisk.h</locationURI>
</link> </link>
<link>
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.cpp</locationURI>
</link>
<link>
<name>TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h</locationURI>
</link>
<link> <link>
<name>TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp</name> <name>TranslationModel/CYKPlusParser/CompletedRuleCollection.cpp</name>
<type>1</type> <type>1</type>

View File

@ -1,5 +1,5 @@
#include <vector> #include <vector>
#include "SkeletonStatefulFF.h" #include "ExampleStatefulFF.h"
#include "moses/ScoreComponentCollection.h" #include "moses/ScoreComponentCollection.h"
#include "moses/Hypothesis.h" #include "moses/Hypothesis.h"
@ -9,7 +9,7 @@ namespace Moses
{ {
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
SkeletonStatefulFF::SkeletonStatefulFF(const std::string &line) ExampleStatefulFF::ExampleStatefulFF(const std::string &line)
:StatefulFeatureFunction(3, line) :StatefulFeatureFunction(3, line)
{ {
ReadParameters(); ReadParameters();
@ -19,7 +19,7 @@ SkeletonStatefulFF::SkeletonStatefulFF(const std::string &line)
// An empty implementation of this function is provided by StatefulFeatureFunction. // An empty implementation of this function is provided by StatefulFeatureFunction.
// Unless you are actually implementing this, please remove it from your // Unless you are actually implementing this, please remove it from your
// implementation (and the declaration in the header file to reduce code clutter. // implementation (and the declaration in the header file to reduce code clutter.
void SkeletonStatefulFF::EvaluateInIsolation(const Phrase &source void ExampleStatefulFF::EvaluateInIsolation(const Phrase &source
, const TargetPhrase &targetPhrase , const TargetPhrase &targetPhrase
, ScoreComponentCollection &scoreBreakdown , ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection &estimatedScores) const , ScoreComponentCollection &estimatedScores) const
@ -28,7 +28,7 @@ void SkeletonStatefulFF::EvaluateInIsolation(const Phrase &source
// An empty implementation of this function is provided by StatefulFeatureFunction. // An empty implementation of this function is provided by StatefulFeatureFunction.
// Unless you are actually implementing this, please remove it from your // Unless you are actually implementing this, please remove it from your
// implementation (and the declaration in the header file to reduce code clutter. // implementation (and the declaration in the header file to reduce code clutter.
void SkeletonStatefulFF::EvaluateWithSourceContext(const InputType &input void ExampleStatefulFF::EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath , const InputPath &inputPath
, const TargetPhrase &targetPhrase , const TargetPhrase &targetPhrase
, const StackVec *stackVec , const StackVec *stackVec
@ -39,11 +39,11 @@ void SkeletonStatefulFF::EvaluateWithSourceContext(const InputType &input
// An empty implementation of this function is provided by StatefulFeatureFunction. // An empty implementation of this function is provided by StatefulFeatureFunction.
// Unless you are actually implementing this, please remove it from your // Unless you are actually implementing this, please remove it from your
// implementation (and the declaration in the header file to reduce code clutter. // implementation (and the declaration in the header file to reduce code clutter.
void SkeletonStatefulFF::EvaluateTranslationOptionListWithSourceContext void ExampleStatefulFF::EvaluateTranslationOptionListWithSourceContext
(const InputType &input, const TranslationOptionList &translationOptionList) const (const InputType &input, const TranslationOptionList &translationOptionList) const
{} {}
FFState* SkeletonStatefulFF::EvaluateWhenApplied( FFState* ExampleStatefulFF::EvaluateWhenApplied(
const Hypothesis& cur_hypo, const Hypothesis& cur_hypo,
const FFState* prev_state, const FFState* prev_state,
ScoreComponentCollection* accumulator) const ScoreComponentCollection* accumulator) const
@ -59,18 +59,18 @@ FFState* SkeletonStatefulFF::EvaluateWhenApplied(
accumulator->PlusEquals(this, "sparse-name", 2.4); accumulator->PlusEquals(this, "sparse-name", 2.4);
// int targetLen = cur_hypo.GetCurrTargetPhrase().GetSize(); // ??? [UG] // int targetLen = cur_hypo.GetCurrTargetPhrase().GetSize(); // ??? [UG]
return new SkeletonState(0); return new ExampleState(0);
} }
FFState* SkeletonStatefulFF::EvaluateWhenApplied( FFState* ExampleStatefulFF::EvaluateWhenApplied(
const ChartHypothesis& /* cur_hypo */, const ChartHypothesis& /* cur_hypo */,
int /* featureID - used to index the state in the previous hypotheses */, int /* featureID - used to index the state in the previous hypotheses */,
ScoreComponentCollection* accumulator) const ScoreComponentCollection* accumulator) const
{ {
return new SkeletonState(0); return new ExampleState(0);
} }
void SkeletonStatefulFF::SetParameter(const std::string& key, const std::string& value) void ExampleStatefulFF::SetParameter(const std::string& key, const std::string& value)
{ {
if (key == "arg") { if (key == "arg") {
// set value here // set value here

View File

@ -7,11 +7,11 @@
namespace Moses namespace Moses
{ {
class SkeletonState : public FFState class ExampleState : public FFState
{ {
int m_targetLen; int m_targetLen;
public: public:
SkeletonState(int targetLen) ExampleState(int targetLen)
:m_targetLen(targetLen) { :m_targetLen(targetLen) {
} }
@ -19,22 +19,22 @@ public:
return (size_t) m_targetLen; return (size_t) m_targetLen;
} }
virtual bool operator==(const FFState& o) const { virtual bool operator==(const FFState& o) const {
const SkeletonState& other = static_cast<const SkeletonState&>(o); const ExampleState& other = static_cast<const ExampleState&>(o);
return m_targetLen == other.m_targetLen; return m_targetLen == other.m_targetLen;
} }
}; };
class SkeletonStatefulFF : public StatefulFeatureFunction class ExampleStatefulFF : public StatefulFeatureFunction
{ {
public: public:
SkeletonStatefulFF(const std::string &line); ExampleStatefulFF(const std::string &line);
bool IsUseable(const FactorMask &mask) const { bool IsUseable(const FactorMask &mask) const {
return true; return true;
} }
virtual const FFState* EmptyHypothesisState(const InputType &input) const { virtual const FFState* EmptyHypothesisState(const InputType &input) const {
return new SkeletonState(0); return new ExampleState(0);
} }
// An empty implementation of this function is provided by StatefulFeatureFunction. // An empty implementation of this function is provided by StatefulFeatureFunction.

View File

@ -1,5 +1,5 @@
#include <vector> #include <vector>
#include "SkeletonStatelessFF.h" #include "ExampleStatelessFF.h"
#include "moses/ScoreComponentCollection.h" #include "moses/ScoreComponentCollection.h"
#include "moses/TargetPhrase.h" #include "moses/TargetPhrase.h"
@ -7,13 +7,13 @@ using namespace std;
namespace Moses namespace Moses
{ {
SkeletonStatelessFF::SkeletonStatelessFF(const std::string &line) ExampleStatelessFF::ExampleStatelessFF(const std::string &line)
:StatelessFeatureFunction(2, line) :StatelessFeatureFunction(2, line)
{ {
ReadParameters(); ReadParameters();
} }
void SkeletonStatelessFF::EvaluateInIsolation(const Phrase &source void ExampleStatelessFF::EvaluateInIsolation(const Phrase &source
, const TargetPhrase &targetPhrase , const TargetPhrase &targetPhrase
, ScoreComponentCollection &scoreBreakdown , ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection &estimatedScores) const , ScoreComponentCollection &estimatedScores) const
@ -29,7 +29,7 @@ void SkeletonStatelessFF::EvaluateInIsolation(const Phrase &source
} }
void SkeletonStatelessFF::EvaluateWithSourceContext(const InputType &input void ExampleStatelessFF::EvaluateWithSourceContext(const InputType &input
, const InputPath &inputPath , const InputPath &inputPath
, const TargetPhrase &targetPhrase , const TargetPhrase &targetPhrase
, const StackVec *stackVec , const StackVec *stackVec
@ -43,20 +43,20 @@ void SkeletonStatelessFF::EvaluateWithSourceContext(const InputType &input
} }
} }
void SkeletonStatelessFF::EvaluateTranslationOptionListWithSourceContext(const InputType &input void ExampleStatelessFF::EvaluateTranslationOptionListWithSourceContext(const InputType &input
, const TranslationOptionList &translationOptionList) const , const TranslationOptionList &translationOptionList) const
{} {}
void SkeletonStatelessFF::EvaluateWhenApplied(const Hypothesis& hypo, void ExampleStatelessFF::EvaluateWhenApplied(const Hypothesis& hypo,
ScoreComponentCollection* accumulator) const ScoreComponentCollection* accumulator) const
{} {}
void SkeletonStatelessFF::EvaluateWhenApplied(const ChartHypothesis &hypo, void ExampleStatelessFF::EvaluateWhenApplied(const ChartHypothesis &hypo,
ScoreComponentCollection* accumulator) const ScoreComponentCollection* accumulator) const
{} {}
void SkeletonStatelessFF::SetParameter(const std::string& key, const std::string& value) void ExampleStatelessFF::SetParameter(const std::string& key, const std::string& value)
{ {
if (key == "arg") { if (key == "arg") {
// set value here // set value here

View File

@ -6,10 +6,10 @@
namespace Moses namespace Moses
{ {
class SkeletonStatelessFF : public StatelessFeatureFunction class ExampleStatelessFF : public StatelessFeatureFunction
{ {
public: public:
SkeletonStatelessFF(const std::string &line); ExampleStatelessFF(const std::string &line);
bool IsUseable(const FactorMask &mask) const { bool IsUseable(const FactorMask &mask) const {
return true; return true;

View File

@ -65,13 +65,13 @@
#include "SyntaxRHS.h" #include "SyntaxRHS.h"
#include "DeleteRules.h" #include "DeleteRules.h"
#include "moses/FF/SkeletonStatelessFF.h" #include "moses/FF/ExampleStatelessFF.h"
#include "moses/FF/SkeletonStatefulFF.h" #include "moses/FF/ExampleStatefulFF.h"
#include "moses/LM/SkeletonLM.h" #include "moses/LM/ExampleLM.h"
#include "moses/LM/InMemoryPerSentenceOnDemandLM.h" #include "moses/LM/InMemoryPerSentenceOnDemandLM.h"
#include "moses/FF/SkeletonTranslationOptionListFeature.h" #include "moses/FF/SkeletonTranslationOptionListFeature.h"
#include "moses/LM/BilingualLM.h" #include "moses/LM/BilingualLM.h"
#include "moses/TranslationModel/SkeletonPT.h" #include "moses/TranslationModel/ExamplePT.h"
#include "moses/Syntax/InputWeightFF.h" #include "moses/Syntax/InputWeightFF.h"
#include "moses/Syntax/RuleTableFF.h" #include "moses/Syntax/RuleTableFF.h"
@ -297,12 +297,12 @@ FeatureRegistry::FeatureRegistry()
MOSES_FNAME(UnalignedWordCountFeature); MOSES_FNAME(UnalignedWordCountFeature);
MOSES_FNAME(DeleteRules); MOSES_FNAME(DeleteRules);
MOSES_FNAME(SkeletonStatelessFF); MOSES_FNAME(ExampleStatelessFF);
MOSES_FNAME(SkeletonStatefulFF); MOSES_FNAME(ExampleStatefulFF);
MOSES_FNAME(SkeletonLM); MOSES_FNAME(ExampleLM);
MOSES_FNAME(InMemoryPerSentenceOnDemandLM); MOSES_FNAME(InMemoryPerSentenceOnDemandLM);
MOSES_FNAME(SkeletonTranslationOptionListFeature); MOSES_FNAME(SkeletonTranslationOptionListFeature);
MOSES_FNAME(SkeletonPT); MOSES_FNAME(ExamplePT);
MOSES_FNAME(EditOps); MOSES_FNAME(EditOps);
MOSES_FNAME(CorrectionPattern); MOSES_FNAME(CorrectionPattern);

View File

@ -1,12 +1,12 @@
#include "SkeletonLM.h" #include "ExampleLM.h"
#include "moses/FactorCollection.h" #include "moses/FactorCollection.h"
using namespace std; using namespace std;
namespace Moses namespace Moses
{ {
SkeletonLM::SkeletonLM(const std::string &line) ExampleLM::ExampleLM(const std::string &line)
:LanguageModelSingleFactor(line) :LanguageModelSingleFactor(line)
{ {
ReadParameters(); ReadParameters();
@ -24,11 +24,11 @@ SkeletonLM::SkeletonLM(const std::string &line)
m_sentenceEndWord[m_factorType] = m_sentenceEnd; m_sentenceEndWord[m_factorType] = m_sentenceEnd;
} }
SkeletonLM::~SkeletonLM() ExampleLM::~ExampleLM()
{ {
} }
LMResult SkeletonLM::GetValue(const vector<const Word*> &contextFactor, State* finalState) const LMResult ExampleLM::GetValue(const vector<const Word*> &contextFactor, State* finalState) const
{ {
LMResult ret; LMResult ret;
ret.score = contextFactor.size(); ret.score = contextFactor.size();

View File

@ -7,13 +7,13 @@
namespace Moses namespace Moses
{ {
class SkeletonLM : public LanguageModelSingleFactor class ExampleLM : public LanguageModelSingleFactor
{ {
protected: protected:
public: public:
SkeletonLM(const std::string &line); ExampleLM(const std::string &line);
~SkeletonLM(); ~ExampleLM();
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const; virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = 0) const;
}; };

View File

@ -138,7 +138,7 @@ if $(with-dalm) {
#Top-level LM library. If you've added a file that doesn't depend on external #Top-level LM library. If you've added a file that doesn't depend on external
#libraries, put it here. #libraries, put it here.
alias LM : Backward.cpp BackwardLMState.cpp Base.cpp BilingualLM.cpp Implementation.cpp InMemoryPerSentenceOnDemandLM.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp SkeletonLM.cpp alias LM : Backward.cpp BackwardLMState.cpp Base.cpp BilingualLM.cpp Implementation.cpp InMemoryPerSentenceOnDemandLM.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp ExampleLM.cpp
../../lm//kenlm ..//headers $(dependencies) ; ../../lm//kenlm ..//headers $(dependencies) ;
alias macros : : : : <define>$(lmmacros) ; alias macros : : : : <define>$(lmmacros) ;

View File

@ -18,7 +18,7 @@
***********************************************************************/ ***********************************************************************/
#include <iostream> #include <iostream>
#include "ChartRuleLookupManagerSkeleton.h" #include "ChartRuleLookupManagerExample.h"
#include "DotChartInMemory.h" #include "DotChartInMemory.h"
#include "moses/Util.h" #include "moses/Util.h"
@ -29,29 +29,29 @@
#include "moses/NonTerminal.h" #include "moses/NonTerminal.h"
#include "moses/ChartCellCollection.h" #include "moses/ChartCellCollection.h"
#include "moses/TranslationModel/PhraseDictionaryMemory.h" #include "moses/TranslationModel/PhraseDictionaryMemory.h"
#include "moses/TranslationModel/SkeletonPT.h" #include "moses/TranslationModel/ExamplePT.h"
using namespace std; using namespace std;
namespace Moses namespace Moses
{ {
ChartRuleLookupManagerSkeleton::ChartRuleLookupManagerSkeleton( ChartRuleLookupManagerExample::ChartRuleLookupManagerExample(
const ChartParser &parser, const ChartParser &parser,
const ChartCellCollectionBase &cellColl, const ChartCellCollectionBase &cellColl,
const SkeletonPT &skeletonPt) const ExamplePT &skeletonPt)
: ChartRuleLookupManager(parser, cellColl) : ChartRuleLookupManager(parser, cellColl)
, m_skeletonPT(skeletonPt) , m_skeletonPT(skeletonPt)
{ {
cerr << "starting ChartRuleLookupManagerSkeleton" << endl; cerr << "starting ChartRuleLookupManagerExample" << endl;
} }
ChartRuleLookupManagerSkeleton::~ChartRuleLookupManagerSkeleton() ChartRuleLookupManagerExample::~ChartRuleLookupManagerExample()
{ {
// RemoveAllInColl(m_tpColl); // RemoveAllInColl(m_tpColl);
} }
void ChartRuleLookupManagerSkeleton::GetChartRuleCollection( void ChartRuleLookupManagerExample::GetChartRuleCollection(
const InputPath &inputPath, const InputPath &inputPath,
size_t last, size_t last,
ChartParserCallback &outColl) ChartParserCallback &outColl)
@ -74,12 +74,12 @@ void ChartRuleLookupManagerSkeleton::GetChartRuleCollection(
} }
TargetPhrase * TargetPhrase *
ChartRuleLookupManagerSkeleton:: ChartRuleLookupManagerExample::
CreateTargetPhrase(const Word &sourceWord) const CreateTargetPhrase(const Word &sourceWord) const
{ {
// create a target phrase from the 1st word of the source, prefix with 'ChartManagerSkeleton:' // create a target phrase from the 1st word of the source, prefix with 'ChartManagerExample:'
string str = sourceWord.GetFactor(0)->GetString().as_string(); string str = sourceWord.GetFactor(0)->GetString().as_string();
str = "ChartManagerSkeleton:" + str; str = "ChartManagerExample:" + str;
TargetPhrase *tp = new TargetPhrase(&m_skeletonPT); TargetPhrase *tp = new TargetPhrase(&m_skeletonPT);
Word &word = tp->AddWord(); Word &word = tp->AddWord();

View File

@ -29,16 +29,16 @@ class TargetPhraseCollection;
class ChartParserCallback; class ChartParserCallback;
class DottedRuleColl; class DottedRuleColl;
class Range; class Range;
class SkeletonPT; class ExamplePT;
class ChartRuleLookupManagerSkeleton : public ChartRuleLookupManager class ChartRuleLookupManagerExample : public ChartRuleLookupManager
{ {
public: public:
ChartRuleLookupManagerSkeleton(const ChartParser &parser, ChartRuleLookupManagerExample(const ChartParser &parser,
const ChartCellCollectionBase &cellColl, const ChartCellCollectionBase &cellColl,
const SkeletonPT &skeletonPt); const ExamplePT &skeletonPt);
~ChartRuleLookupManagerSkeleton(); ~ChartRuleLookupManagerExample();
virtual void GetChartRuleCollection( virtual void GetChartRuleCollection(
const InputPath &inputPath, const InputPath &inputPath,
@ -50,7 +50,7 @@ private:
StackVec m_stackVec; StackVec m_stackVec;
std::vector<TargetPhraseCollection::shared_ptr > m_tpColl; std::vector<TargetPhraseCollection::shared_ptr > m_tpColl;
const SkeletonPT &m_skeletonPT; const ExamplePT &m_skeletonPT;
}; };
} // namespace Moses } // namespace Moses

View File

@ -1,29 +1,29 @@
// vim:tabstop=2 // vim:tabstop=2
#include "SkeletonPT.h" #include "ExamplePT.h"
#include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h" #include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.h"
using namespace std; using namespace std;
namespace Moses namespace Moses
{ {
SkeletonPT::SkeletonPT(const std::string &line) ExamplePT::ExamplePT(const std::string &line)
: PhraseDictionary(line, true) : PhraseDictionary(line, true)
{ {
ReadParameters(); ReadParameters();
} }
void SkeletonPT::Load(AllOptions::ptr const& opts) void ExamplePT::Load(AllOptions::ptr const& opts)
{ {
m_options = opts; m_options = opts;
SetFeaturesToApply(); SetFeaturesToApply();
} }
void SkeletonPT::InitializeForInput(ttasksptr const& ttask) void ExamplePT::InitializeForInput(ttasksptr const& ttask)
{ {
ReduceCache(); ReduceCache();
} }
void SkeletonPT::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const void ExamplePT::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const
{ {
CacheColl &cache = GetCache(); CacheColl &cache = GetCache();
@ -46,14 +46,14 @@ void SkeletonPT::GetTargetPhraseCollectionBatch(const InputPathList &inputPathQu
} }
} }
TargetPhrase *SkeletonPT::CreateTargetPhrase(const Phrase &sourcePhrase) const TargetPhrase *ExamplePT::CreateTargetPhrase(const Phrase &sourcePhrase) const
{ {
// create a target phrase from the 1st word of the source, prefix with 'SkeletonPT:' // create a target phrase from the 1st word of the source, prefix with 'ExamplePT:'
assert(sourcePhrase.GetSize()); assert(sourcePhrase.GetSize());
assert(m_output.size() == 1); assert(m_output.size() == 1);
string str = sourcePhrase.GetWord(0).GetFactor(0)->GetString().as_string(); string str = sourcePhrase.GetWord(0).GetFactor(0)->GetString().as_string();
str = "SkeletonPT:" + str; str = "ExamplePT:" + str;
TargetPhrase *tp = new TargetPhrase(this); TargetPhrase *tp = new TargetPhrase(this);
Word &word = tp->AddWord(); Word &word = tp->AddWord();
@ -69,17 +69,17 @@ TargetPhrase *SkeletonPT::CreateTargetPhrase(const Phrase &sourcePhrase) const
return tp; return tp;
} }
ChartRuleLookupManager* SkeletonPT::CreateRuleLookupManager(const ChartParser &parser, ChartRuleLookupManager* ExamplePT::CreateRuleLookupManager(const ChartParser &parser,
const ChartCellCollectionBase &cellCollection, const ChartCellCollectionBase &cellCollection,
std::size_t /*maxChartSpan*/) std::size_t /*maxChartSpan*/)
{ {
return new ChartRuleLookupManagerSkeleton(parser, cellCollection, *this); return new ChartRuleLookupManagerExample(parser, cellCollection, *this);
} }
TO_STRING_BODY(SkeletonPT); TO_STRING_BODY(ExamplePT);
// friend // friend
ostream& operator<<(ostream& out, const SkeletonPT& phraseDict) ostream& operator<<(ostream& out, const ExamplePT& phraseDict)
{ {
return out; return out;
} }

View File

@ -9,12 +9,12 @@ class ChartParser;
class ChartCellCollectionBase; class ChartCellCollectionBase;
class ChartRuleLookupManager; class ChartRuleLookupManager;
class SkeletonPT : public PhraseDictionary class ExamplePT : public PhraseDictionary
{ {
friend std::ostream& operator<<(std::ostream&, const SkeletonPT&); friend std::ostream& operator<<(std::ostream&, const ExamplePT&);
public: public:
SkeletonPT(const std::string &line); ExamplePT(const std::string &line);
void Load(AllOptions::ptr const& opts); void Load(AllOptions::ptr const& opts);

View File

@ -1,6 +1,6 @@
// vim:tabstop=2 // vim:tabstop=2
#include "PhraseDictionaryMemoryPerSentence.h" #include "PhraseDictionaryMemoryPerSentence.h"
#include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h" #include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerExample.h"
using namespace std; using namespace std;

View File

@ -1,6 +1,5 @@
// vim:tabstop=2 // vim:tabstop=2
#include "PhraseDictionaryMemoryPerSentenceOnDemand.h" #include "PhraseDictionaryMemoryPerSentenceOnDemand.h"
#include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h"
#include <sstream> #include <sstream>
using namespace std; using namespace std;

View File

@ -2,7 +2,6 @@
#include <cstdlib> #include <cstdlib>
#include "PhraseDictionaryTransliteration.h" #include "PhraseDictionaryTransliteration.h"
#include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h"
#include "moses/DecodeGraph.h" #include "moses/DecodeGraph.h"
#include "moses/DecodeStep.h" #include "moses/DecodeStep.h"
#include "util/tempfile.hh" #include "util/tempfile.hh"

View File

@ -4,7 +4,6 @@
#include "moses/FactorCollection.h" #include "moses/FactorCollection.h"
#include "moses/TargetPhraseCollection.h" #include "moses/TargetPhraseCollection.h"
#include "moses/InputFileStream.h" #include "moses/InputFileStream.h"
#include "moses/TranslationModel/CYKPlusParser/ChartRuleLookupManagerSkeleton.h"
#include "probingpt/querying.h" #include "probingpt/querying.h"
#include "probingpt/probing_hash_utils.h" #include "probingpt/probing_hash_utils.h"