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:
authorHieu Hoang <hieuhoang@gmail.com>2014-01-06 22:03:38 +0400
committerHieu Hoang <hieuhoang@gmail.com>2014-01-06 22:03:38 +0400
commit584af0d0152d8115d4ede495ef8eabca1f997aff (patch)
tree3eea7418c53992e89b14ce528c71dfe87ab17e52 /phrase-extract
parent35faa887e879db7c0e05457370dec02cc28ca204 (diff)
add support for --MinPhraseLength
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/PhraseExtractionOptions.h2
-rw-r--r--phrase-extract/extract-ordering-main.cpp16
2 files changed, 11 insertions, 7 deletions
diff --git a/phrase-extract/PhraseExtractionOptions.h b/phrase-extract/PhraseExtractionOptions.h
index 8c277b7c6..87712d6d3 100644
--- a/phrase-extract/PhraseExtractionOptions.h
+++ b/phrase-extract/PhraseExtractionOptions.h
@@ -35,6 +35,7 @@ class PhraseExtractionOptions
public:
int maxPhraseLength;
int minPhraseLength;
+ std::string separator;
private:
bool allModelsOutputFlag;
@@ -59,6 +60,7 @@ public:
PhraseExtractionOptions(const int initmaxPhraseLength):
maxPhraseLength(initmaxPhraseLength),
minPhraseLength(3),
+ separator("|||"),
allModelsOutputFlag(false),
wordModel(false),
wordType(REO_MSD),
diff --git a/phrase-extract/extract-ordering-main.cpp b/phrase-extract/extract-ordering-main.cpp
index bff7fbb65..104457b01 100644
--- a/phrase-extract/extract-ordering-main.cpp
+++ b/phrase-extract/extract-ordering-main.cpp
@@ -154,6 +154,8 @@ int main(int argc, char* argv[])
options.debug = true;
} else if (strcmp(argv[i], "--MinPhraseLength") == 0) {
options.minPhraseLength = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "--Separator") == 0) {
+ options.separator = argv[++i];
} else if(strcmp(argv[i],"--model") == 0) {
if (i+1 >= argc) {
cerr << "extract: syntax error, no model's information provided to the option --model " << endl;
@@ -622,24 +624,26 @@ void ExtractTask::addPhrase( SentenceAlignment &sentence, int startE, int endE,
return;
}
- m_extractFileOrientation << sentence.sentenceID << " ||| ";
- m_extractFileOrientation << getClass(orientationInfo) << " ||| ";
+ const string &sep = m_options.separator;
+
+ m_extractFileOrientation << sentence.sentenceID << " " << sep << " ";
+ m_extractFileOrientation << getClass(orientationInfo) << " " << sep << " ";
// position
- m_extractFileOrientation << startF << " " << endF << " ||| ";
+ m_extractFileOrientation << startF << " " << endF << " " << sep << " ";
// start
m_extractFileOrientation << "<s> ";
for(int fi=0; fi<startF; fi++) {
m_extractFileOrientation << sentence.source[fi] << " ";
}
- m_extractFileOrientation << "||| ";
+ m_extractFileOrientation << sep << " ";
// middle
for(int fi=startF; fi<=endF; fi++) {
m_extractFileOrientation << sentence.source[fi] << " ";
}
- m_extractFileOrientation << "||| ";
+ m_extractFileOrientation << sep << " ";
// end
for(int fi=endF+1; fi<sentence.source.size(); fi++) {
@@ -647,8 +651,6 @@ void ExtractTask::addPhrase( SentenceAlignment &sentence, int startE, int endE,
}
m_extractFileOrientation << "</s> ";
- m_extractFileOrientation << "||| ";
-
// target
/*