diff options
author | Phil Williams <philip.williams@mac.com> | 2012-10-03 23:04:09 +0400 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2012-10-03 23:04:09 +0400 |
commit | 0851a4d1136a345b2ac4472da087c1114a77f255 (patch) | |
tree | 8c52deb2807de8d97fadac9dd422f83555134e93 /phrase-extract | |
parent | 289a9ea54f01080f8605a74620bfb64116a7008a (diff) |
extract-ghkm: add --SentenceOffset option
This should behave the same as the --SentenceOffset option for
extract-rules. The extract-parallel.perl script expects the rule
extractor to have this option.
Diffstat (limited to 'phrase-extract')
-rw-r--r-- | phrase-extract/extract-ghkm/ExtractGHKM.cpp | 5 | ||||
-rw-r--r-- | phrase-extract/extract-ghkm/Options.h | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/phrase-extract/extract-ghkm/ExtractGHKM.cpp b/phrase-extract/extract-ghkm/ExtractGHKM.cpp index dae876116..94e565085 100644 --- a/phrase-extract/extract-ghkm/ExtractGHKM.cpp +++ b/phrase-extract/extract-ghkm/ExtractGHKM.cpp @@ -90,7 +90,7 @@ int ExtractGHKM::Main(int argc, char *argv[]) std::string alignmentLine; XmlTreeParser xmlTreeParser(labelSet, topLabelSet); ScfgRuleWriter writer(fwdExtractStream, invExtractStream, options); - size_t lineNum = 0; + size_t lineNum = options.sentenceOffset; while (true) { std::getline(targetStream, targetLine); std::getline(sourceStream, sourceLine); @@ -289,6 +289,9 @@ void ExtractGHKM::ProcessOptions(int argc, char *argv[], "extract minimal rules only") ("PCFG", "include score based on PCFG scores in target corpus") + ("SentenceOffset", + po::value(&options.sentenceOffset)->default_value(options.sentenceOffset), + "set sentence number offset if processing split corpus") ("UnknownWordLabel", po::value(&options.unknownWordFile), "write unknown word labels to named file") diff --git a/phrase-extract/extract-ghkm/Options.h b/phrase-extract/extract-ghkm/Options.h index 362fc95d2..acad2040c 100644 --- a/phrase-extract/extract-ghkm/Options.h +++ b/phrase-extract/extract-ghkm/Options.h @@ -38,6 +38,7 @@ struct Options { , maxScope(3) , minimal(false) , pcfg(false) + , sentenceOffset(0) , unpairedExtractFormat(false) {} // Positional options @@ -57,6 +58,7 @@ struct Options { int maxScope; bool minimal; bool pcfg; + int sentenceOffset; bool unpairedExtractFormat; std::string unknownWordFile; }; |