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 <hieu@hoang.co.uk>2013-06-28 21:05:49 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-06-28 21:05:49 +0400
commitbddbdeec0448eabd260bb034262d53990846482e (patch)
treed390d6ee843806e4e99fa10cac102f42e306ecfa /moses/DecodeStepTranslation.cpp
parentd2e37b701b1c2753860b4a4c7adf46b7eadfba4c (diff)
find all target phrases before search
Diffstat (limited to 'moses/DecodeStepTranslation.cpp')
-rw-r--r--moses/DecodeStepTranslation.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/moses/DecodeStepTranslation.cpp b/moses/DecodeStepTranslation.cpp
index 8a11c7f22..2938a850a 100644
--- a/moses/DecodeStepTranslation.cpp
+++ b/moses/DecodeStepTranslation.cpp
@@ -135,6 +135,40 @@ void DecodeStepTranslation::ProcessInitialTranslation(
}
}
+void DecodeStepTranslation::ProcessInitialTranslation(
+ const InputType &source
+ ,PartialTranslOptColl &outputPartialTranslOptColl
+ , size_t startPos, size_t endPos, bool adhereTableLimit
+ , const TargetPhraseCollection *phraseColl) const
+{
+ const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature();
+ const size_t tableLimit = phraseDictionary->GetTableLimit();
+
+ const WordsRange wordsRange(startPos, endPos);
+
+ if (phraseColl != NULL) {
+ IFVERBOSE(3) {
+ if(StaticData::Instance().GetInputType() == SentenceInput)
+ TRACE_ERR("[" << source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n");
+ else
+ TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
+ }
+
+ TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
+ iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;
+
+ for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != iterEnd ; ++iterTargetPhrase) {
+ const TargetPhrase &targetPhrase = **iterTargetPhrase;
+ TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
+
+ outputPartialTranslOptColl.Add (transOpt);
+
+ VERBOSE(3,"\t" << targetPhrase << "\n");
+ }
+ VERBOSE(3,std::endl);
+ }
+}
+
}