bug fix domain features

This commit is contained in:
phikoehn 2012-09-25 01:22:09 +01:00
parent 106bad253c
commit 28e8832a15
2 changed files with 7 additions and 3 deletions

View File

@ -30,7 +30,7 @@ protected:
public:
float pcfgSum;
float count;
size_t sentenceId;
int sentenceId;
std::string domain;
std::vector< std::set<size_t> > alignedToT;

View File

@ -272,12 +272,16 @@ int main(int argc, char* argv[])
lastPcfgSum = phrasePair.pcfgSum;
// only differs in count? just add count
if (lastPhrasePair != NULL && lastPhrasePair->equals( phrasePair )) {
if (lastPhrasePair != NULL
&& lastPhrasePair->equals( phrasePair )
&& (!domainFlag
|| domain->getDomainOfSentence( lastPhrasePair->sentenceId )
== domain->getDomainOfSentence( phrasePair.sentenceId ) )) {
lastPhrasePair->count += phrasePair.count;
lastPhrasePair->pcfgSum += phrasePair.pcfgSum;
continue;
}
// if new source phrase, process last batch
if (lastPhrasePair != NULL &&
lastPhrasePair->GetSource() != phrasePair.GetSource()) {