From 433186ae255ec2e446e067530bee26a8ec11afcd Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Tue, 7 Oct 2014 19:16:30 +0100 Subject: delete lineNumber variable from Manager and TranslationTask. It should always be carried by the input sentence itself --- moses-cmd/LatticeMBRGrid.cpp | 7 ++++--- moses-cmd/Main.cpp | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'moses-cmd') diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index 3573d0697..677adb791 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -159,7 +159,7 @@ int main(int argc, char* argv[]) StaticData& staticData = const_cast(StaticData::Instance()); staticData.SetUseLatticeMBR(true); - IOWrapper* ioWrapper = GetIOWrapper(staticData); + IOWrapper* ioWrapper = IOWrapper::GetIOWrapper(staticData); if (!ioWrapper) { throw runtime_error("Failed to initialise IOWrapper"); @@ -180,8 +180,9 @@ int main(int argc, char* argv[]) while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) { ++lineCount; - Sentence sentence; - Manager manager(lineCount, *source, staticData.GetSearchAlgorithm()); + source->SetTranslationId(lineCount); + + Manager manager(*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 994837d4a..513c3a187 100644 --- a/moses-cmd/Main.cpp +++ b/moses-cmd/Main.cpp @@ -142,6 +142,7 @@ int main(int argc, char** argv) InputType* source = NULL; size_t lineCount = staticData.GetStartTranslationId(); while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) { + source->SetTranslationId(lineCount); IFVERBOSE(1) { ResetUserTime(); } @@ -150,7 +151,7 @@ int main(int argc, char** argv) // set up task of translating one sentence TranslationTask* task = - new TranslationTask(lineCount,source, *ioWrapper, + new TranslationTask(source, *ioWrapper, staticData.GetOutputSearchGraphSLF(), hypergraphOutput); // execute task -- cgit v1.2.3