mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
delete sourcePhrase variable in TargetPhrase class
This commit is contained in:
parent
5104740d1a
commit
036ea4ee29
@ -21,7 +21,7 @@ void PhraseLengthFeature::Evaluate(const Phrase &source
|
||||
{
|
||||
// get length of source and target phrase
|
||||
size_t targetLength = targetPhrase.GetSize();
|
||||
size_t sourceLength = targetPhrase.GetSourcePhrase().GetSize();
|
||||
size_t sourceLength = source.GetSize();
|
||||
|
||||
// create feature names
|
||||
stringstream nameSource;
|
||||
|
@ -82,7 +82,7 @@ void SourceWordDeletionFeature::ComputeFeatures(const Phrase &source,
|
||||
{
|
||||
// handle special case: unknown words (they have no word alignment)
|
||||
size_t targetLength = targetPhrase.GetSize();
|
||||
size_t sourceLength = targetPhrase.GetSourcePhrase().GetSize();
|
||||
size_t sourceLength = source.GetSize();
|
||||
if (targetLength == 1 && sourceLength == 1 && !alignmentInfo.GetSize()) return;
|
||||
|
||||
// flag aligned words
|
||||
@ -96,7 +96,7 @@ void SourceWordDeletionFeature::ComputeFeatures(const Phrase &source,
|
||||
// process unaligned source words
|
||||
for(size_t i=0; i<sourceLength; i++) {
|
||||
if (!aligned[i]) {
|
||||
Word w = targetPhrase.GetSourcePhrase().GetWord(i);
|
||||
const Word &w = source.GetWord(i);
|
||||
if (!w.IsNonTerminal()) {
|
||||
const StringPiece word = w.GetFactor(m_factorType)->GetString();
|
||||
if (word != "<s>" && word != "</s>") {
|
||||
|
@ -82,7 +82,7 @@ void TargetWordInsertionFeature::ComputeFeatures(const Phrase &source,
|
||||
{
|
||||
// handle special case: unknown words (they have no word alignment)
|
||||
size_t targetLength = targetPhrase.GetSize();
|
||||
size_t sourceLength = targetPhrase.GetSourcePhrase().GetSize();
|
||||
size_t sourceLength = source.GetSize();
|
||||
if (targetLength == 1 && sourceLength == 1 && !alignmentInfo.GetSize()) return;
|
||||
|
||||
// flag aligned words
|
||||
|
@ -246,7 +246,7 @@ bool RuleTableLoaderStandard::Load(FormatType format
|
||||
targetPhrase->GetScoreBreakdown().Assign(&ruleTable, scoreVector);
|
||||
targetPhrase->Evaluate(sourcePhrase);
|
||||
|
||||
TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, targetPhrase->GetSourcePhrase(), *targetPhrase, sourceLHS);
|
||||
TargetPhraseCollection &phraseColl = GetOrCreateTargetPhraseCollection(ruleTable, sourcePhrase, *targetPhrase, sourceLHS);
|
||||
phraseColl.Add(targetPhrase);
|
||||
|
||||
count++;
|
||||
|
Loading…
Reference in New Issue
Block a user