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:
authoralex_const <alex_const@1f5c12ca-751b-0410-a591-d2e778427230>2006-07-15 01:51:05 +0400
committeralex_const <alex_const@1f5c12ca-751b-0410-a591-d2e778427230>2006-07-15 01:51:05 +0400
commit2c0bfddfc28eba1b3254119bbb25953cd65e10a2 (patch)
treeb7aec4ae9d8ee34dcaecfacad9ac72beea4eb524 /moses-cmd
parent035ce30f0a7a89c600783996b7e8446f998c78f0 (diff)
Added hypothesis backtracking for the best hypothesis for verbose option 3.
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@123 1f5c12ca-751b-0410-a591-d2e778427230
Diffstat (limited to 'moses-cmd')
-rwxr-xr-xmoses-cmd/src/IOCommandLine.cpp11
-rwxr-xr-xmoses-cmd/src/IOCommandLine.h1
-rw-r--r--moses-cmd/src/Main.cpp12
3 files changed, 20 insertions, 4 deletions
diff --git a/moses-cmd/src/IOCommandLine.cpp b/moses-cmd/src/IOCommandLine.cpp
index 585eb4860..8546a3f7e 100755
--- a/moses-cmd/src/IOCommandLine.cpp
+++ b/moses-cmd/src/IOCommandLine.cpp
@@ -91,11 +91,22 @@ void OutputSurface(std::ostream &out, const Hypothesis *hypo)
}
}
+
+void IOCommandLine::Backtrack(const Hypothesis *hypo){
+
+ if (hypo->m_id != 0) {
+ TRACE_ERR("["<< hypo ->m_id<<" => "<<hypo->GetPrevHypo()->m_id<<"]" <<endl);
+ Backtrack(hypo->GetPrevHypo());
+ }
+}
+
void IOCommandLine::SetOutput(const Hypothesis *hypo, long translationId)
{
if (hypo != NULL)
{
TRACE_ERR("BEST HYPO: " << *hypo << endl);
+ Backtrack(hypo);
+
OutputSurface(cout, hypo);
}
else
diff --git a/moses-cmd/src/IOCommandLine.h b/moses-cmd/src/IOCommandLine.h
index 691e35c37..67ed0321d 100755
--- a/moses-cmd/src/IOCommandLine.h
+++ b/moses-cmd/src/IOCommandLine.h
@@ -61,6 +61,7 @@ public:
Sentence *GetInput();
void SetOutput(const Hypothesis *hypo, long translationId);
void SetNBest(const LatticePathList &nBestList, long translationId);
+ void Backtrack(const Hypothesis *hypo);
};
// help fn
diff --git a/moses-cmd/src/Main.cpp b/moses-cmd/src/Main.cpp
index 73b3187ed..7d5558f16 100644
--- a/moses-cmd/src/Main.cpp
+++ b/moses-cmd/src/Main.cpp
@@ -81,14 +81,16 @@ int main(int argc, char* argv[])
boost::shared_ptr<UnknownWordHandler> unknownWordHandler(new UnknownWordHandler);
staticData.SetUnknownWordHandler(unknownWordHandler);
- if (staticData.GetVerboseLevel() >= 0)
- {
+
+ if (staticData.GetVerboseLevel() > 0)
+ {
+
#if N_BEST
std::cerr << "N_BEST=enabled\n";
#else
std::cerr << "N_BEST=disabled\n";
#endif
- }
+ }
// set up read/writing class
InputOutput *inputOutput = GetInputOutput(staticData);
@@ -101,10 +103,10 @@ int main(int argc, char* argv[])
while( (sentence = inputOutput->GetInput()) != NULL)
{
TRACE_ERR(*sentence << endl);
-
Manager manager(*sentence, staticData);
manager.ProcessSentence();
inputOutput->SetOutput(manager.GetBestHypothesis(), sentence->GetTranslationId());
+
// n-best
size_t nBestSize = staticData.GetNBestSize();
@@ -119,10 +121,12 @@ int main(int argc, char* argv[])
// delete sentence
inputOutput->Release(sentence);
+
}
delete inputOutput;
+
timer.check("End.");
return EXIT_SUCCESS;
}