Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphikoehn <pkoehn@inf.ed.ac.uk>2012-09-25 04:22:09 +0400
committerphikoehn <pkoehn@inf.ed.ac.uk>2012-09-25 04:22:09 +0400
commit28e8832a15c57ea978df5a78bb71ba92e290f540 (patch)
tree5494cafb013ebfd2c1e945b2f7d33096a8436c29 /phrase-extract
parent106bad253cd150117032655143f331c1b8f6e766 (diff)
bug fix domain features
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/PhraseAlignment.h2
-rw-r--r--phrase-extract/score.cpp8
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()) {