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-05-02 13:45:24 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-05-02 13:45:24 +0300
commitcc8c6b7b10abd8118014635609f7658f6a7a1857 (patch)
treecab374bcbf73ff97782e9131380e4f32dbeb1e67 /moses-cmd
parenta4a7c14593766ab188e1d6ae1c29e67ed201d412 (diff)
beautify
Diffstat (limited to 'moses-cmd')
-rw-r--r--moses-cmd/LatticeMBRGrid.cpp63
-rw-r--r--moses-cmd/MainVW.cpp27
2 files changed, 43 insertions, 47 deletions
diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp
index f842b1136..0447a16fa 100644
--- a/moses-cmd/LatticeMBRGrid.cpp
+++ b/moses-cmd/LatticeMBRGrid.cpp
@@ -177,39 +177,34 @@ int main(int argc, char* argv[])
const vector<float>& scale_grid = grid.getGrid(lmbr_scale);
boost::shared_ptr<InputType> source;
- while((source = ioWrapper->ReadInput()) != NULL)
- {
- // set up task of translating one sentence
- boost::shared_ptr<TranslationTask> ttask;
- ttask = TranslationTask::create(source, ioWrapper);
- Manager manager(ttask);
- manager.Decode();
- TrellisPathList nBestList;
- manager.CalcNBest(nBestSize, nBestList,true);
- //grid search
- BOOST_FOREACH(float const& p, pgrid)
- {
- SD.SetLatticeMBRPrecision(p);
- BOOST_FOREACH(float const& r, rgrid)
- {
- SD.SetLatticeMBRPRatio(r);
- BOOST_FOREACH(size_t const prune_i, prune_grid)
- {
- SD.SetLatticeMBRPruningFactor(size_t(prune_i));
- BOOST_FOREACH(float const& scale_i, scale_grid)
- {
- SD.SetMBRScale(scale_i);
- size_t lineCount = source->GetTranslationId();
- cout << lineCount << " ||| " << p << " "
- << r << " " << size_t(prune_i) << " " << scale_i
- << " ||| ";
- vector<Word> mbrBestHypo = doLatticeMBR(manager,nBestList);
- manager.OutputBestHypo(mbrBestHypo, lineCount,
- SD.GetReportSegmentation(),
- SD.GetReportAllFactors(),cout);
- }
- }
- }
- }
+ while((source = ioWrapper->ReadInput()) != NULL) {
+ // set up task of translating one sentence
+ boost::shared_ptr<TranslationTask> ttask;
+ ttask = TranslationTask::create(source, ioWrapper);
+ Manager manager(ttask);
+ manager.Decode();
+ TrellisPathList nBestList;
+ manager.CalcNBest(nBestSize, nBestList,true);
+ //grid search
+ BOOST_FOREACH(float const& p, pgrid) {
+ SD.SetLatticeMBRPrecision(p);
+ BOOST_FOREACH(float const& r, rgrid) {
+ SD.SetLatticeMBRPRatio(r);
+ BOOST_FOREACH(size_t const prune_i, prune_grid) {
+ SD.SetLatticeMBRPruningFactor(size_t(prune_i));
+ BOOST_FOREACH(float const& scale_i, scale_grid) {
+ SD.SetMBRScale(scale_i);
+ size_t lineCount = source->GetTranslationId();
+ cout << lineCount << " ||| " << p << " "
+ << r << " " << size_t(prune_i) << " " << scale_i
+ << " ||| ";
+ vector<Word> mbrBestHypo = doLatticeMBR(manager,nBestList);
+ manager.OutputBestHypo(mbrBestHypo, lineCount,
+ SD.GetReportSegmentation(),
+ SD.GetReportAllFactors(),cout);
+ }
+ }
+ }
}
+ }
}
diff --git a/moses-cmd/MainVW.cpp b/moses-cmd/MainVW.cpp
index 302866733..ac54c1ed6 100644
--- a/moses-cmd/MainVW.cpp
+++ b/moses-cmd/MainVW.cpp
@@ -144,26 +144,27 @@ int main(int argc, char** argv)
#endif
// main loop over set of input sentences
-
+
boost::shared_ptr<InputType> source;
- while ((source = ioWrapper->ReadInput()) != NULL)
- {
- IFVERBOSE(1) { ResetUserTime(); }
+ while ((source = ioWrapper->ReadInput()) != NULL) {
+ IFVERBOSE(1) {
+ ResetUserTime();
+ }
- InputType* foo = source.get();
- FeatureFunction::CallChangeSource(foo);
+ InputType* foo = source.get();
+ FeatureFunction::CallChangeSource(foo);
- // set up task of training one sentence
- boost::shared_ptr<TrainingTask> task;
- task = TrainingTask::create(source, ioWrapper);
+ // set up task of training one sentence
+ boost::shared_ptr<TrainingTask> task;
+ task = TrainingTask::create(source, ioWrapper);
- // execute task
+ // execute task
#ifdef WITH_THREADS
- pool.Submit(task);
+ pool.Submit(task);
#else
- task->Run();
+ task->Run();
#endif
- }
+ }
// we are done, finishing up
#ifdef WITH_THREADS