Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-06-02 20:00:32 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-06-02 20:00:32 +0300
commitefdb8566b17d19783aa65caf22b24e48a789fbb8 (patch)
treefe43728c533e13268905595fae5a5dc488347975
parent2f04d4a56ebab78a97b9fa9ecf4b50ef845a1bdb (diff)
delete ChangeSource(). Not used
-rw-r--r--contrib/other-builds/all.workspace1
-rw-r--r--contrib/other-builds/moses/moses.project8
-rw-r--r--moses-cmd/MainVW.cpp3
-rw-r--r--moses/ExportInterface.cpp4
-rw-r--r--moses/FF/Factory.cpp2
-rw-r--r--moses/FF/FeatureFunction.cpp14
-rw-r--r--moses/FF/FeatureFunction.h6
-rw-r--r--moses/FF/SkeletonChangeInput.cpp96
-rw-r--r--moses/FF/SkeletonChangeInput.h45
9 files changed, 3 insertions, 176 deletions
diff --git a/contrib/other-builds/all.workspace b/contrib/other-builds/all.workspace
index 3df758293..66dafe3d2 100644
--- a/contrib/other-builds/all.workspace
+++ b/contrib/other-builds/all.workspace
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Workspace Name="all" Database="all.tags">
- <Project Name="manual-label" Path="manual-label/manual-label.project" Active="No"/>
<Project Name="extract" Path="extract/extract.project" Active="No"/>
<Project Name="util" Path="util/util.project" Active="No"/>
<Project Name="extract-mixed-syntax" Path="extract-mixed-syntax/extract-mixed-syntax.project" Active="No"/>
diff --git a/contrib/other-builds/moses/moses.project b/contrib/other-builds/moses/moses.project
index 2c2affd45..f902dd1f4 100644
--- a/contrib/other-builds/moses/moses.project
+++ b/contrib/other-builds/moses/moses.project
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="moses" InternalType="Library">
<Plugins>
+ <Plugin Name="qmake">
+ <![CDATA[00010001N0005Debug000000000000]]>
+ </Plugin>
<Plugin Name="CMakePlugin">
<![CDATA[[{
"name": "Debug",
@@ -13,9 +16,6 @@
"parentProject": ""
}]]]>
</Plugin>
- <Plugin Name="qmake">
- <![CDATA[00010001N0005Debug000000000000]]>
- </Plugin>
</Plugins>
<VirtualDirectory Name="TranslationModel">
<VirtualDirectory Name="UG">
@@ -531,8 +531,6 @@
<File Name="../../../moses/FF/RuleScope.h"/>
<File Name="../../../moses/FF/SetSourcePhrase.cpp"/>
<File Name="../../../moses/FF/SetSourcePhrase.h"/>
- <File Name="../../../moses/FF/SkeletonChangeInput.cpp"/>
- <File Name="../../../moses/FF/SkeletonChangeInput.h"/>
<File Name="../../../moses/FF/SkeletonStatefulFF.cpp"/>
<File Name="../../../moses/FF/SkeletonStatefulFF.h"/>
<File Name="../../../moses/FF/SkeletonStatelessFF.cpp"/>
diff --git a/moses-cmd/MainVW.cpp b/moses-cmd/MainVW.cpp
index ac54c1ed6..c8047c201 100644
--- a/moses-cmd/MainVW.cpp
+++ b/moses-cmd/MainVW.cpp
@@ -151,9 +151,6 @@ int main(int argc, char** argv)
ResetUserTime();
}
- InputType* foo = source.get();
- FeatureFunction::CallChangeSource(foo);
-
// set up task of training one sentence
boost::shared_ptr<TrainingTask> task;
task = TrainingTask::create(source, ioWrapper);
diff --git a/moses/ExportInterface.cpp b/moses/ExportInterface.cpp
index 0ceeceec1..c444e98c9 100644
--- a/moses/ExportInterface.cpp
+++ b/moses/ExportInterface.cpp
@@ -118,8 +118,6 @@ string SimpleTranslationInterface::translate(const string &inputString)
ResetUserTime();
}
- FeatureFunction::CallChangeSource(&*source);
-
// set up task of translating one sentence
boost::shared_ptr<TranslationTask> task
= TranslationTask::create(source, ioWrapper);
@@ -223,8 +221,6 @@ batch_run()
while ((source = ioWrapper->ReadInput()) != NULL) {
IFVERBOSE(1) ResetUserTime();
- FeatureFunction::CallChangeSource(source.get());
-
// set up task of translating one sentence
boost::shared_ptr<TranslationTask>
task = TranslationTask::create(source, ioWrapper);
diff --git a/moses/FF/Factory.cpp b/moses/FF/Factory.cpp
index c797381ff..167e02370 100644
--- a/moses/FF/Factory.cpp
+++ b/moses/FF/Factory.cpp
@@ -62,7 +62,6 @@
#include "moses/LM/SkeletonLM.h"
#include "moses/FF/SkeletonTranslationOptionListFeature.h"
#include "moses/LM/BilingualLM.h"
-#include "SkeletonChangeInput.h"
#include "moses/TranslationModel/SkeletonPT.h"
#include "moses/Syntax/InputWeightFF.h"
#include "moses/Syntax/RuleTableFF.h"
@@ -268,7 +267,6 @@ FeatureRegistry::FeatureRegistry()
MOSES_FNAME(SkeletonStatelessFF);
MOSES_FNAME(SkeletonStatefulFF);
MOSES_FNAME(SkeletonLM);
- MOSES_FNAME(SkeletonChangeInput);
MOSES_FNAME(SkeletonTranslationOptionListFeature);
MOSES_FNAME(SkeletonPT);
diff --git a/moses/FF/FeatureFunction.cpp b/moses/FF/FeatureFunction.cpp
index 5eab202ae..08ad26db8 100644
--- a/moses/FF/FeatureFunction.cpp
+++ b/moses/FF/FeatureFunction.cpp
@@ -38,20 +38,6 @@ void FeatureFunction::Destroy()
RemoveAllInColl(s_staticColl);
}
-// The original declaration as
-// void FeatureFunction::CallChangeSource(InputType *&input)
-// had me a bit perplexed. Would you really want to allow
-// any feature function to replace the InputType behind the
-// back of the others? And change what the vector is pointing to?
-
-void FeatureFunction::CallChangeSource(InputType * const&input)
-{
- for (size_t i = 0; i < s_staticColl.size(); ++i) {
- const FeatureFunction &ff = *s_staticColl[i];
- ff.ChangeSource(input);
- }
-}
-
void FeatureFunction::SetupAll(TranslationTask const& ttask)
{
BOOST_FOREACH(FeatureFunction* ff, s_staticColl)
diff --git a/moses/FF/FeatureFunction.h b/moses/FF/FeatureFunction.h
index d3d6ab168..c95b5eb25 100644
--- a/moses/FF/FeatureFunction.h
+++ b/moses/FF/FeatureFunction.h
@@ -62,9 +62,6 @@ public:
static FeatureFunction &FindFeatureFunction(const std::string& name);
static void Destroy();
- static void CallChangeSource(InputType * const&input);
- // see my note in FeatureFunction.cpp --- UG
-
FeatureFunction(const std::string &line, bool initializeNow);
FeatureFunction(size_t numScoreComponents, const std::string &line);
virtual bool IsStateless() const = 0;
@@ -156,9 +153,6 @@ public:
ScoreComponentCollection& scoreBreakdown,
ScoreComponentCollection& estimatedFutureScore) const = 0;
- // override this method if you want to change the input before decoding
- virtual void ChangeSource(InputType * const&input) const { }
-
// for context-dependent processing
static void SetupAll(TranslationTask const& task);
virtual void Setup(TranslationTask const& task) const { };
diff --git a/moses/FF/SkeletonChangeInput.cpp b/moses/FF/SkeletonChangeInput.cpp
deleted file mode 100644
index 7937d7771..000000000
--- a/moses/FF/SkeletonChangeInput.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include <vector>
-#include "SkeletonChangeInput.h"
-#include "moses/ScoreComponentCollection.h"
-#include "moses/TargetPhrase.h"
-#include "moses/Sentence.h"
-#include "moses/FactorCollection.h"
-#include "util/exception.hh"
-
-using namespace std;
-
-namespace Moses
-{
-SkeletonChangeInput::SkeletonChangeInput(const std::string &line)
- :StatelessFeatureFunction(2, line)
-{
- ReadParameters();
-}
-
-void SkeletonChangeInput::EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedFutureScore) const
-{
- // dense scores
- vector<float> newScores(m_numScoreComponents);
- newScores[0] = 1.5;
- newScores[1] = 0.3;
- scoreBreakdown.PlusEquals(this, newScores);
-
- // sparse scores
- scoreBreakdown.PlusEquals(this, "sparse-name", 2.4);
-
-}
-
-void SkeletonChangeInput::EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedFutureScore) const
-{
- if (targetPhrase.GetNumNonTerminals()) {
- vector<float> newScores(m_numScoreComponents);
- newScores[0] = - std::numeric_limits<float>::infinity();
- scoreBreakdown.PlusEquals(this, newScores);
- }
-
-}
-
-void SkeletonChangeInput::EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const
-{}
-
-void SkeletonChangeInput::EvaluateWhenApplied(const Hypothesis& hypo,
- ScoreComponentCollection* accumulator) const
-{}
-
-void SkeletonChangeInput::EvaluateWhenApplied(const ChartHypothesis &hypo,
- ScoreComponentCollection* accumulator) const
-{}
-
-void SkeletonChangeInput::ChangeSource(InputType* const& input) const
-{
- // add factor[1] to each word. Created from first 4 letter of factor[0]
-
- Sentence *sentence = dynamic_cast<Sentence*>(input);
- UTIL_THROW_IF2(sentence == NULL, "Not a sentence input");
-
- FactorCollection &fc = FactorCollection::Instance();
-
- size_t size = sentence->GetSize();
- for (size_t i = 0; i < size; ++i) {
- Word &word = sentence->Phrase::GetWord(i);
- const Factor *factor0 = word[0];
-
- std::string str = factor0->GetString().as_string();
- if (str.length() > 4) {
- str = str.substr(0, 4);
- }
-
- const Factor *factor1 = fc.AddFactor(str);
- word.SetFactor(1, factor1);
- }
-}
-
-void SkeletonChangeInput::SetParameter(const std::string& key, const std::string& value)
-{
- if (key == "arg") {
- // set value here
- } else {
- StatelessFeatureFunction::SetParameter(key, value);
- }
-}
-
-}
-
diff --git a/moses/FF/SkeletonChangeInput.h b/moses/FF/SkeletonChangeInput.h
deleted file mode 100644
index f8d9010ce..000000000
--- a/moses/FF/SkeletonChangeInput.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#pragma once
-
-#include <string>
-#include "StatelessFeatureFunction.h"
-
-namespace Moses
-{
-
-class SkeletonChangeInput : public StatelessFeatureFunction
-{
-public:
- SkeletonChangeInput(const std::string &line);
-
- bool IsUseable(const FactorMask &mask) const {
- return true;
- }
-
- void EvaluateInIsolation(const Phrase &source
- , const TargetPhrase &targetPhrase
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection &estimatedFutureScore) const;
-
- void ChangeSource(InputType* const&input) const;
-
- void EvaluateWithSourceContext(const InputType &input
- , const InputPath &inputPath
- , const TargetPhrase &targetPhrase
- , const StackVec *stackVec
- , ScoreComponentCollection &scoreBreakdown
- , ScoreComponentCollection *estimatedFutureScore = NULL) const;
-
- void EvaluateTranslationOptionListWithSourceContext(const InputType &input
- , const TranslationOptionList &translationOptionList) const;
-
- void EvaluateWhenApplied(const Hypothesis& hypo,
- ScoreComponentCollection* accumulator) const;
- void EvaluateWhenApplied(const ChartHypothesis &hypo,
- ScoreComponentCollection* accumulator) const;
-
- void SetParameter(const std::string& key, const std::string& value);
-
-};
-
-}
-