add support for --MinPhraseLength

This commit is contained in:
Hieu Hoang 2014-01-06 18:03:38 +00:00
parent 35faa887e8
commit 584af0d015
2 changed files with 11 additions and 7 deletions

View File

@ -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),

View File

@ -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
/*