diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 21:25:54 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-03-26 21:25:54 +0300 |
commit | 9dc75bfd8ad3092f08f7a6d2a6492323b7803e56 (patch) | |
tree | f13405e11bce5001e6718ae0089fdcf85d961c98 /moses-cmd | |
parent | 4410e9225a5bd495fc6d097b206290beb59f4839 (diff) |
Managers and feature functions now have access to the entire TranslationTask, not just the InputType.
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/LatticeMBRGrid.cpp | 10 | ||||
-rw-r--r-- | moses-cmd/MainVW.cpp | 4 |
2 files changed, 9 insertions, 5 deletions
diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index edb4176c7..f842b1136 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -53,6 +53,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "util/exception.hh" #include <boost/foreach.hpp> +#include "moses/TranslationTask.h" using namespace std; using namespace Moses; @@ -175,10 +176,13 @@ int main(int argc, char* argv[]) const vector<float>& prune_grid = grid.getGrid(lmbr_prune); const vector<float>& scale_grid = grid.getGrid(lmbr_scale); - for (boost::shared_ptr<InputType> source = ioWrapper->ReadInput(); - source != NULL; source = ioWrapper->ReadInput()) + boost::shared_ptr<InputType> source; + while((source = ioWrapper->ReadInput()) != NULL) { - Manager manager(*source); + // 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); diff --git a/moses-cmd/MainVW.cpp b/moses-cmd/MainVW.cpp index 00df3df80..c55b0fe2c 100644 --- a/moses-cmd/MainVW.cpp +++ b/moses-cmd/MainVW.cpp @@ -153,8 +153,8 @@ int main(int argc, char** argv) FeatureFunction::CallChangeSource(foo); // set up task of training one sentence - boost::shared_ptr<TrainingTask> - task(new TrainingTask(source.get(), *ioWrapper)); + boost::shared_ptr<TrainingTask> task; + task = TrainingTask::create(source, ioWrapper); // execute task #ifdef WITH_THREADS |