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:15:12 +0400
committerHieu Hoang <hieu@hoang.co.uk>2013-06-28 21:15:12 +0400
commit3fde63c7b1456733a3dbfcf09d081ba9fc196908 (patch)
tree7c1c97a0015dd670643cb1facb54d6ac8081f71b /moses/DecodeStepTranslation.cpp
parent600a188a4e49e176d469848123d0b0b3f00f368b (diff)
find all target phrases before search
Diffstat (limited to 'moses/DecodeStepTranslation.cpp')
-rw-r--r--moses/DecodeStepTranslation.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/moses/DecodeStepTranslation.cpp b/moses/DecodeStepTranslation.cpp
index 98c877656..7151c681c 100644
--- a/moses/DecodeStepTranslation.cpp
+++ b/moses/DecodeStepTranslation.cpp
@@ -100,6 +100,61 @@ void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslO
}
}
+void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslOpt
+ , const DecodeStep &decodeStep
+ , PartialTranslOptColl &outputPartialTranslOptColl
+ , TranslationOptionCollection *toc
+ , bool adhereTableLimit
+ , const Phrase &src
+ , const TargetPhraseCollection *phraseColl) const
+{
+ if (inputPartialTranslOpt.GetTargetPhrase().GetSize() == 0) {
+ // word deletion
+ outputPartialTranslOptColl.Add(new TranslationOption(inputPartialTranslOpt));
+ return;
+ }
+
+ // normal trans step
+ const WordsRange &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange();
+ const PhraseDictionary* phraseDictionary =
+ decodeStep.GetPhraseDictionaryFeature();
+ const TargetPhrase &inPhrase = inputPartialTranslOpt.GetTargetPhrase();
+ const size_t currSize = inPhrase.GetSize();
+ const size_t tableLimit = phraseDictionary->GetTableLimit();
+
+ if (phraseColl != NULL) {
+ 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;
+ const ScoreComponentCollection &transScores = targetPhrase.GetScoreBreakdown();
+ // skip if the
+ if (targetPhrase.GetSize() != currSize) continue;
+
+ TargetPhrase outPhrase(inPhrase);
+
+ if (IsFilteringStep()) {
+ if (!inputPartialTranslOpt.IsCompatible(targetPhrase, m_conflictFactors))
+ continue;
+ }
+
+ outPhrase.Merge(targetPhrase, m_newOutputFactors);
+ outPhrase.Evaluate(src, m_featuresToApply); // need to do this as all non-transcores would be screwed up
+
+
+ TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase);
+ assert(newTransOpt != NULL);
+
+ outputPartialTranslOptColl.Add(newTransOpt );
+
+ }
+ } else if (sourceWordsRange.GetNumWordsCovered() == 1) {
+ // unknown handler
+ //toc->ProcessUnknownWord(sourceWordsRange.GetStartPos(), factorCollection);
+ }
+}
+
void DecodeStepTranslation::ProcessInitialTranslation(
const InputType &source