mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
debugged FF NieceTerminal
This commit is contained in:
parent
b60ac0321f
commit
401c4940cf
@ -541,6 +541,11 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/PDTAimp.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>PP</name>
|
||||
<type>2</type>
|
||||
<locationURI>virtual:/virtual</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>Parameter.cpp</name>
|
||||
<type>1</type>
|
||||
@ -1601,6 +1606,26 @@
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/LM/backward.arpa</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>PP/Factory.cpp</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/PP/Factory.cpp</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>PP/Factory.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/PP/Factory.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>PP/PhraseProperty.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/PP/PhraseProperty.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>PP/TreeStructurePhraseProperty.h</name>
|
||||
<type>1</type>
|
||||
<locationURI>PARENT-3-PROJECT_LOC/moses/PP/TreeStructurePhraseProperty.h</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>TranslationModel/BilingualDynSuffixArray.cpp</name>
|
||||
<type>1</type>
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "moses/ScoreComponentCollection.h"
|
||||
#include "moses/TargetPhrase.h"
|
||||
#include "moses/ChartCellLabel.h"
|
||||
#include "moses/InputType.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -30,7 +31,7 @@ void NieceTerminal::Evaluate(const InputType &input
|
||||
std::set<Word> terms;
|
||||
for (size_t i = 0; i < ruleSource->GetSize(); ++i) {
|
||||
const Word &word = ruleSource->GetWord(i);
|
||||
if (word.IsNonTerminal()) {
|
||||
if (!word.IsNonTerminal()) {
|
||||
terms.insert(word);
|
||||
}
|
||||
}
|
||||
@ -38,12 +39,16 @@ void NieceTerminal::Evaluate(const InputType &input
|
||||
size_t ntInd = 0;
|
||||
for (size_t i = 0; i < ruleSource->GetSize(); ++i) {
|
||||
const Word &word = ruleSource->GetWord(i);
|
||||
if (!word.IsNonTerminal()) {
|
||||
if (word.IsNonTerminal()) {
|
||||
const ChartCellLabel &cell = *stackVec->at(ntInd);
|
||||
const WordsRange &ntRange = cell.GetCoverage();
|
||||
bool containTerm = ContainTerm(ntRange, terms);
|
||||
bool containTerm = ContainTerm(input, ntRange, terms);
|
||||
|
||||
if (containTerm) {
|
||||
//cerr << "ruleSource=" << *ruleSource << " ";
|
||||
//cerr << "ntRange=" << ntRange << endl;
|
||||
|
||||
// non-term contains 1 of the terms in the rule.
|
||||
scoreBreakdown.PlusEquals(this, 1);
|
||||
return;
|
||||
}
|
||||
@ -61,13 +66,19 @@ void NieceTerminal::EvaluateChart(const ChartHypothesis &hypo,
|
||||
ScoreComponentCollection* accumulator) const
|
||||
{}
|
||||
|
||||
bool NieceTerminal::ContainTerm(const WordsRange &ntRange, const std::set<Word> &terms) const
|
||||
bool NieceTerminal::ContainTerm(const InputType &input,
|
||||
const WordsRange &ntRange,
|
||||
const std::set<Word> &terms) const
|
||||
{
|
||||
std::set<Word>::const_iterator iter;
|
||||
|
||||
for (size_t pos = ntRange.GetStartPos(); pos <= ntRange.GetEndPos(); ++pos) {
|
||||
const Word &word = input.GetWord(pos);
|
||||
iter = terms.find(word);
|
||||
|
||||
// iter = terms.find(ntRange);
|
||||
if (iter != terms.end()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -37,7 +37,9 @@ public:
|
||||
ScoreComponentCollection* accumulator) const;
|
||||
|
||||
protected:
|
||||
bool ContainTerm(const WordsRange &ntRange, const std::set<Word> &terms) const;
|
||||
bool ContainTerm(const InputType &input,
|
||||
const WordsRange &ntRange,
|
||||
const std::set<Word> &terms) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user