delete sourcePhrase variable in TargetPhrase class

This commit is contained in:
Hieu Hoang 2013-05-28 11:38:18 +01:00
parent 5104740d1a
commit 036ea4ee29
4 changed files with 5 additions and 5 deletions

View File

@ -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;

View File

@ -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>") {

View File

@ -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

View File

@ -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++;