From 99b8f65fb18e5cc39aa57a866e8eb4af9bd73794 Mon Sep 17 00:00:00 2001 From: Matthias Huck Date: Fri, 6 Mar 2015 16:47:44 +0000 Subject: [PATCH] GHKM: POS factor in glue rules: target side only --- phrase-extract/extract-ghkm/ExtractGHKM.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/phrase-extract/extract-ghkm/ExtractGHKM.cpp b/phrase-extract/extract-ghkm/ExtractGHKM.cpp index b64dc7aec..e205cdbfc 100644 --- a/phrase-extract/extract-ghkm/ExtractGHKM.cpp +++ b/phrase-extract/extract-ghkm/ExtractGHKM.cpp @@ -674,15 +674,17 @@ void ExtractGHKM::WriteGlueGrammar( const size_t sourceLabelSentenceEnd = 3; const size_t partOfSpeechSentenceStart = 0; const size_t partOfSpeechSentenceEnd = 1; - std::string sentenceStart = ""; - std::string sentenceEnd = ""; + std::string sentenceStartSource = ""; + std::string sentenceEndSource = ""; + std::string sentenceStartTarget = ""; + std::string sentenceEndTarget = ""; if (options.partsOfSpeech) { - sentenceStart = sentenceStart + "|" + sentenceStart; - sentenceEnd = sentenceEnd + "|" + sentenceEnd; + sentenceStartTarget = sentenceStartTarget + "|" + sentenceStartTarget; + sentenceEndTarget = sentenceEndTarget + "|" + sentenceEndTarget; } // basic rules - out << sentenceStart << " [X] ||| " << sentenceStart << " [" << topLabel << "] ||| 1 ||| 0-0 ||| ||| |||"; + out << sentenceStartSource << " [X] ||| " << sentenceStartTarget << " [" << topLabel << "] ||| 1 ||| 0-0 ||| ||| |||"; if (options.treeFragments) { out << " {{Tree [" << topLabel << " [SSTART ]]}}"; } @@ -697,7 +699,7 @@ void ExtractGHKM::WriteGlueGrammar( } out << std::endl; - out << "[X][" << topLabel << "] " << sentenceEnd << " [X] ||| [X][" << topLabel << "] " << sentenceEnd << " [" << topLabel << "] ||| 1 ||| 0-0 1-1 ||| ||| |||"; + out << "[X][" << topLabel << "] " << sentenceEndSource << " [X] ||| [X][" << topLabel << "] " << sentenceEndTarget << " [" << topLabel << "] ||| 1 ||| 0-0 1-1 ||| ||| |||"; if (options.treeFragments) { out << " {{Tree [" << topLabel << " [" << topLabel << "] [SEND ]]}}"; } @@ -715,7 +717,7 @@ void ExtractGHKM::WriteGlueGrammar( // top rules for (std::map::const_iterator i = topLabelSet.begin(); i != topLabelSet.end(); ++i) { - out << sentenceStart << " [X][" << i->first << "] " << sentenceEnd << " [X] ||| " << sentenceStart << " [X][" << i->first << "] " << sentenceEnd << " [" << topLabel << "] ||| 1 ||| 0-0 1-1 2-2 ||| ||| |||"; + out << sentenceStartSource << " [X][" << i->first << "] " << sentenceEndSource << " [X] ||| " << sentenceStartTarget << " [X][" << i->first << "] " << sentenceEndTarget << " [" << topLabel << "] ||| 1 ||| 0-0 1-1 2-2 ||| ||| |||"; if (options.treeFragments) { out << " {{Tree [" << topLabel << " [SSTART ] [" << i->first << "] [SEND ]]}}"; }