diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2014-09-29 20:16:11 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2014-09-29 20:16:11 +0400 |
commit | 08d6f77cea935179c5d7d8361efa54cf8a6c07bd (patch) | |
tree | 2eee9e769f6dca29735a48afa6ba1c92cebefa3e | |
parent | 84ad576750999d0383996d28a92360f42c7caf10 (diff) |
move TranslationAnalysis for both moses-cmd and moses-char-cmd into moses/
-rw-r--r-- | contrib/other-builds/moses-cmd/.project | 10 | ||||
-rw-r--r-- | contrib/other-builds/moses/.project | 10 | ||||
-rw-r--r-- | moses-chart-cmd/Jamfile | 2 | ||||
-rw-r--r-- | moses-chart-cmd/TranslationAnalysis.cpp | 52 | ||||
-rw-r--r-- | moses-chart-cmd/TranslationAnalysis.h | 24 | ||||
-rw-r--r-- | moses-cmd/Jamfile | 2 | ||||
-rw-r--r-- | moses-cmd/Main.cpp | 2 | ||||
-rw-r--r-- | moses/TranslationAnalysis.cpp (renamed from moses-cmd/TranslationAnalysis.cpp) | 30 | ||||
-rw-r--r-- | moses/TranslationAnalysis.h (renamed from moses-cmd/TranslationAnalysis.h) | 12 |
9 files changed, 50 insertions, 94 deletions
diff --git a/contrib/other-builds/moses-cmd/.project b/contrib/other-builds/moses-cmd/.project index 541d60b6f..accd6b902 100644 --- a/contrib/other-builds/moses-cmd/.project +++ b/contrib/other-builds/moses-cmd/.project @@ -127,16 +127,6 @@ <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/Main.h</locationURI> </link> <link> - <name>TranslationAnalysis.cpp</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/TranslationAnalysis.cpp</locationURI> - </link> - <link> - <name>TranslationAnalysis.h</name> - <type>1</type> - <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/TranslationAnalysis.h</locationURI> - </link> - <link> <name>mbr.cpp</name> <type>1</type> <locationURI>PARENT-3-PROJECT_LOC/moses-cmd/mbr.cpp</locationURI> diff --git a/contrib/other-builds/moses/.project b/contrib/other-builds/moses/.project index 3425524da..9c1eebd4b 100644 --- a/contrib/other-builds/moses/.project +++ b/contrib/other-builds/moses/.project @@ -812,6 +812,16 @@ <locationURI>PARENT-3-PROJECT_LOC/moses/Timer.h</locationURI> </link> <link> + <name>TranslationAnalysis.cpp</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/TranslationAnalysis.cpp</locationURI> + </link> + <link> + <name>TranslationAnalysis.h</name> + <type>1</type> + <locationURI>PARENT-3-PROJECT_LOC/moses/TranslationAnalysis.h</locationURI> + </link> + <link> <name>TranslationModel</name> <type>2</type> <locationURI>virtual:/virtual</locationURI> diff --git a/moses-chart-cmd/Jamfile b/moses-chart-cmd/Jamfile index cab15ede1..47a1bf885 100644 --- a/moses-chart-cmd/Jamfile +++ b/moses-chart-cmd/Jamfile @@ -1,2 +1,2 @@ -exe moses_chart : Main.cpp mbr.cpp IOWrapper.cpp TranslationAnalysis.cpp ../moses//moses $(TOP)//boost_iostreams ..//boost_filesystem ..//z ; +exe moses_chart : Main.cpp mbr.cpp IOWrapper.cpp ../moses//moses $(TOP)//boost_iostreams ..//boost_filesystem ..//z ; diff --git a/moses-chart-cmd/TranslationAnalysis.cpp b/moses-chart-cmd/TranslationAnalysis.cpp deleted file mode 100644 index 964050fad..000000000 --- a/moses-chart-cmd/TranslationAnalysis.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// $Id$ - -#include <iostream> -#include <sstream> -#include <algorithm> - -#include "TranslationAnalysis.h" - -#include "moses/StaticData.h" -#include "moses/TranslationOption.h" -#include "moses/DecodeStepTranslation.h" -#include "moses/FF/StatefulFeatureFunction.h" -#include "moses/FF/StatelessFeatureFunction.h" -#include "moses/LM/Base.h" - -using namespace std; -using namespace Moses; - -namespace TranslationAnalysis -{ - -void PrintTranslationAnalysis(ostream & /* os */, const Hypothesis* /* hypo */) -{ - /* - os << endl << "TRANSLATION HYPOTHESIS DETAILS:" << endl; - queue<const Hypothesis*> translationPath; - while (hypo) - { - translationPath.push(hypo); - hypo = hypo->GetPrevHypo(); - } - - while (!translationPath.empty()) - { - hypo = translationPath.front(); - translationPath.pop(); - const TranslationOption *transOpt = hypo->GetTranslationOption(); - if (transOpt != NULL) - { - os << hypo->GetCurrSourceWordsRange() << " "; - for (size_t decodeStepId = 0; decodeStepId < DecodeStepTranslation::GetNumTransStep(); ++decodeStepId) - os << decodeStepId << "=" << transOpt->GetSubRangeCount(decodeStepId) << ","; - os << *transOpt << endl; - } - } - - os << "END TRANSLATION" << endl; - */ -} - -} - diff --git a/moses-chart-cmd/TranslationAnalysis.h b/moses-chart-cmd/TranslationAnalysis.h deleted file mode 100644 index 7c8f1d545..000000000 --- a/moses-chart-cmd/TranslationAnalysis.h +++ /dev/null @@ -1,24 +0,0 @@ -// $Id$ - -/* - * also see moses/SentenceStats - */ - -#ifndef _TRANSLATION_ANALYSIS_H_ -#define _TRANSLATION_ANALYSIS_H_ - -#include <iostream> -#include "moses/ChartHypothesis.h" - -namespace TranslationAnalysis -{ - -/** - * print details about the translation represented in hypothesis to - * os. Included information: phrase alignment, words dropped, scores - */ -void PrintTranslationAnalysis(std::ostream &os, const Moses::Hypothesis* hypo); - -} - -#endif diff --git a/moses-cmd/Jamfile b/moses-cmd/Jamfile index 79af196e9..4f7e0e773 100644 --- a/moses-cmd/Jamfile +++ b/moses-cmd/Jamfile @@ -1,4 +1,4 @@ -alias deps : IOWrapper.cpp mbr.cpp LatticeMBR.cpp TranslationAnalysis.cpp ..//z ..//boost_iostreams ..//boost_filesystem ../moses//moses ; +alias deps : IOWrapper.cpp mbr.cpp LatticeMBR.cpp ..//z ..//boost_iostreams ..//boost_filesystem ../moses//moses ; exe moses : Main.cpp deps ; exe lmbrgrid : LatticeMBRGrid.cpp deps ; diff --git a/moses-cmd/Main.cpp b/moses-cmd/Main.cpp index a8b50db17..713ded2e3 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //#include <vld.h> #endif -#include "TranslationAnalysis.h" +#include "moses/TranslationAnalysis.h" #include "IOWrapper.h" #include "mbr.h" diff --git a/moses-cmd/TranslationAnalysis.cpp b/moses/TranslationAnalysis.cpp index e77486162..ed948f6b6 100644 --- a/moses-cmd/TranslationAnalysis.cpp +++ b/moses/TranslationAnalysis.cpp @@ -5,6 +5,7 @@ #include <algorithm> #include "moses/StaticData.h" #include "moses/Hypothesis.h" +#include "moses/ChartHypothesis.h" #include "TranslationAnalysis.h" #include "moses/FF/StatefulFeatureFunction.h" #include "moses/FF/StatelessFeatureFunction.h" @@ -134,4 +135,33 @@ void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo) os << std::endl; } +void PrintTranslationAnalysis(std::ostream &os, const Moses::ChartHypothesis* hypo) +{ + /* + os << endl << "TRANSLATION HYPOTHESIS DETAILS:" << endl; + queue<const Hypothesis*> translationPath; + while (hypo) + { + translationPath.push(hypo); + hypo = hypo->GetPrevHypo(); + } + + while (!translationPath.empty()) + { + hypo = translationPath.front(); + translationPath.pop(); + const TranslationOption *transOpt = hypo->GetTranslationOption(); + if (transOpt != NULL) + { + os << hypo->GetCurrSourceWordsRange() << " "; + for (size_t decodeStepId = 0; decodeStepId < DecodeStepTranslation::GetNumTransStep(); ++decodeStepId) + os << decodeStepId << "=" << transOpt->GetSubRangeCount(decodeStepId) << ","; + os << *transOpt << endl; + } + } + + os << "END TRANSLATION" << endl; + */ +} + } diff --git a/moses-cmd/TranslationAnalysis.h b/moses/TranslationAnalysis.h index 348cfe512..ccb21f041 100644 --- a/moses-cmd/TranslationAnalysis.h +++ b/moses/TranslationAnalysis.h @@ -1,14 +1,16 @@ +#pragma once // $Id$ /* * also see moses/SentenceStats */ -#ifndef moses_cmd_TranslationAnalysis_h -#define moses_cmd_TranslationAnalysis_h - #include <iostream> -#include "moses/Hypothesis.h" + +namespace Moses { + class Hypothesis; + class ChartHypothesis; +} namespace TranslationAnalysis { @@ -18,7 +20,7 @@ namespace TranslationAnalysis * os. Included information: phrase alignment, words dropped, scores */ void PrintTranslationAnalysis(std::ostream &os, const Moses::Hypothesis* hypo); +void PrintTranslationAnalysis(std::ostream &os, const Moses::ChartHypothesis* hypo); } -#endif |