diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2013-05-11 17:13:26 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2013-05-11 17:13:26 +0400 |
commit | 981351758a394ea06ea22cdd810d0735a9af3c9b (patch) | |
tree | 5a6f98e9146e11c2b957500626b54ffb2059bf6a /moses-cmd | |
parent | b75d19483341828c51a370eeff4ff89f807a6b42 (diff) |
delete class TranslationSystem
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/IOWrapper.cpp | 8 | ||||
-rw-r--r-- | moses-cmd/IOWrapper.h | 5 | ||||
-rw-r--r-- | moses-cmd/LatticeMBRGrid.cpp | 3 | ||||
-rw-r--r-- | moses-cmd/Main.cpp | 12 | ||||
-rw-r--r-- | moses-cmd/TranslationAnalysis.cpp | 2 | ||||
-rw-r--r-- | moses-cmd/TranslationAnalysis.h | 3 |
6 files changed, 11 insertions, 22 deletions
diff --git a/moses-cmd/IOWrapper.cpp b/moses-cmd/IOWrapper.cpp index e3e93aa7c..12ac697cb 100644 --- a/moses-cmd/IOWrapper.cpp +++ b/moses-cmd/IOWrapper.cpp @@ -380,7 +380,6 @@ void IOWrapper::OutputBestHypo(const Hypothesis *hypo, long /*translationId*/, b void OutputNBest(std::ostream& out , const Moses::TrellisPathList &nBestList , const std::vector<Moses::FactorType>& outputFactorOrder - , const TranslationSystem &system , long translationId , bool reportSegmentation) { @@ -404,7 +403,7 @@ void OutputNBest(std::ostream& out out << " |||"; // print scores with feature names - OutputAllFeatureScores( system, path.GetScoreBreakdown(), out ); + OutputAllFeatureScores(path.GetScoreBreakdown(), out ); // total out << " ||| " << path.GetTotalScore(); @@ -453,9 +452,8 @@ void OutputNBest(std::ostream& out out << std::flush; } -void OutputAllFeatureScores(const Moses::TranslationSystem &system - , const Moses::ScoreComponentCollection &features - , std::ostream &out) +void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features + , std::ostream &out) { std::string lastName = ""; const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); diff --git a/moses-cmd/IOWrapper.h b/moses-cmd/IOWrapper.h index 79bf3b401..fac9ca307 100644 --- a/moses-cmd/IOWrapper.h +++ b/moses-cmd/IOWrapper.h @@ -55,7 +55,6 @@ POSSIBILITY OF SUCH DAMAGE. namespace Moses { -class TranslationSystem; class ScoreComponentCollection; } @@ -145,11 +144,9 @@ void OutputAlignment(std::ostream &out, const Moses::Hypothesis *hypo); void OutputNBest(std::ostream& out , const Moses::TrellisPathList &nBestList , const std::vector<Moses::FactorType>& outputFactorOrder - , const Moses::TranslationSystem &system , long translationId , bool reportSegmentation); -void OutputAllFeatureScores(const Moses::TranslationSystem &system - , const Moses::ScoreComponentCollection &features +void OutputAllFeatureScores(const Moses::ScoreComponentCollection &features , std::ostream &out); void OutputFeatureScores( std::ostream& out , const Moses::ScoreComponentCollection &features diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index fe1bbca07..c6de2ae74 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -179,8 +179,7 @@ int main(int argc, char* argv[]) while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) { ++lineCount; Sentence sentence; - const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT); - Manager manager(lineCount, *source, staticData.GetSearchAlgorithm(), &system); + Manager manager(lineCount, *source, staticData.GetSearchAlgorithm()); manager.ProcessSentence(); TrellisPathList nBestList; manager.CalcNBest(nBestSize, nBestList,true); diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index 8f177389c..8c5c18a9c 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -118,13 +118,11 @@ public: const StaticData &staticData = StaticData::Instance(); // input sentence Sentence sentence(); - // set translation system - const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT); // execute the translation // note: this executes the search, resulting in a search graph // we still need to apply the decision rule (MAP, MBR, ...) - Manager manager(m_lineNumber, *m_source,staticData.GetSearchAlgorithm(), &system); + Manager manager(m_lineNumber, *m_source,staticData.GetSearchAlgorithm()); manager.ProcessSentence(); // output word graph @@ -381,7 +379,7 @@ public: TrellisPathList nBestList; ostringstream out; manager.CalcNBest(staticData.GetNBestSize(), nBestList,staticData.GetDistinctNBest()); - OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), *manager.GetTranslationSystem(), m_lineNumber, + OutputNBest(out, nBestList, staticData.GetOutputFactorOrder(), m_lineNumber, staticData.GetReportSegmentation()); m_nbestCollector->Write(m_lineNumber, out.str()); } @@ -391,7 +389,7 @@ public: TrellisPathList latticeSamples; ostringstream out; manager.CalcLatticeSamples(staticData.GetLatticeSamplesSize(), latticeSamples); - OutputNBest(out,latticeSamples, staticData.GetOutputFactorOrder(), *manager.GetTranslationSystem(), m_lineNumber, + OutputNBest(out,latticeSamples, staticData.GetOutputFactorOrder(), m_lineNumber, staticData.GetReportSegmentation()); m_latticeSamplesCollector->Write(m_lineNumber, out.str()); } @@ -400,7 +398,7 @@ public: if (m_detailedTranslationCollector) { ostringstream out; fix(out,PRECISION); - TranslationAnalysis::PrintTranslationAnalysis(manager.GetTranslationSystem(), out, manager.GetBestHypothesis()); + TranslationAnalysis::PrintTranslationAnalysis(out, manager.GetBestHypothesis()); m_detailedTranslationCollector->Write(m_lineNumber,out.str()); } @@ -470,7 +468,6 @@ static void ShowWeights() //TODO: Find a way of ensuring this order is synced with the nbest fix(cout,6); const StaticData& staticData = StaticData::Instance(); - const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT); const vector<const StatelessFeatureFunction*>& slf = StatelessFeatureFunction::GetStatelessFeatureFunctions(); const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); @@ -517,7 +514,6 @@ void OutputFeatureWeightsForHypergraph(std::ostream &outputSearchGraphStream) outputSearchGraphStream.precision(6); const StaticData& staticData = StaticData::Instance(); - const TranslationSystem& system = staticData.GetTranslationSystem(TranslationSystem::DEFAULT); const vector<const StatelessFeatureFunction*>& slf =StatelessFeatureFunction::GetStatelessFeatureFunctions(); const vector<const StatefulFeatureFunction*>& sff = StatefulFeatureFunction::GetStatefulFeatureFunctions(); size_t featureIndex = 1; diff --git a/moses-cmd/TranslationAnalysis.cpp b/moses-cmd/TranslationAnalysis.cpp index 4f9164f5b..186378ca5 100644 --- a/moses-cmd/TranslationAnalysis.cpp +++ b/moses-cmd/TranslationAnalysis.cpp @@ -12,7 +12,7 @@ using namespace Moses; namespace TranslationAnalysis { -void PrintTranslationAnalysis(const TranslationSystem* system, std::ostream &os, const Hypothesis* hypo) +void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo) { os << std::endl << "TRANSLATION HYPOTHESIS DETAILS:" << std::endl; std::vector<const Hypothesis*> translationPath; diff --git a/moses-cmd/TranslationAnalysis.h b/moses-cmd/TranslationAnalysis.h index 1ba737eec..348cfe512 100644 --- a/moses-cmd/TranslationAnalysis.h +++ b/moses-cmd/TranslationAnalysis.h @@ -9,7 +9,6 @@ #include <iostream> #include "moses/Hypothesis.h" -#include "moses/TranslationSystem.h" namespace TranslationAnalysis { @@ -18,7 +17,7 @@ namespace TranslationAnalysis * print details about the translation represented in hypothesis to * os. Included information: phrase alignment, words dropped, scores */ -void PrintTranslationAnalysis(const Moses::TranslationSystem* system, std::ostream &os, const Moses::Hypothesis* hypo); +void PrintTranslationAnalysis(std::ostream &os, const Moses::Hypothesis* hypo); } |