diff options
author | phikoehn <pkoehn@inf.ed.ac.uk> | 2012-09-25 04:22:09 +0400 |
---|---|---|
committer | phikoehn <pkoehn@inf.ed.ac.uk> | 2012-09-25 04:22:09 +0400 |
commit | 28e8832a15c57ea978df5a78bb71ba92e290f540 (patch) | |
tree | 5494cafb013ebfd2c1e945b2f7d33096a8436c29 /phrase-extract | |
parent | 106bad253cd150117032655143f331c1b8f6e766 (diff) |
bug fix domain features
Diffstat (limited to 'phrase-extract')
-rw-r--r-- | phrase-extract/PhraseAlignment.h | 2 | ||||
-rw-r--r-- | phrase-extract/score.cpp | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/phrase-extract/PhraseAlignment.h b/phrase-extract/PhraseAlignment.h index ce8562a5c..35afb314b 100644 --- a/phrase-extract/PhraseAlignment.h +++ b/phrase-extract/PhraseAlignment.h @@ -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; diff --git a/phrase-extract/score.cpp b/phrase-extract/score.cpp index 4de7acc0f..71661b618 100644 --- a/phrase-extract/score.cpp +++ b/phrase-extract/score.cpp @@ -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()) { |