mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 05:55:02 +03:00
add support for --MinPhraseLength
This commit is contained in:
parent
35faa887e8
commit
584af0d015
@ -35,6 +35,7 @@ class PhraseExtractionOptions
|
|||||||
public:
|
public:
|
||||||
int maxPhraseLength;
|
int maxPhraseLength;
|
||||||
int minPhraseLength;
|
int minPhraseLength;
|
||||||
|
std::string separator;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool allModelsOutputFlag;
|
bool allModelsOutputFlag;
|
||||||
@ -59,6 +60,7 @@ public:
|
|||||||
PhraseExtractionOptions(const int initmaxPhraseLength):
|
PhraseExtractionOptions(const int initmaxPhraseLength):
|
||||||
maxPhraseLength(initmaxPhraseLength),
|
maxPhraseLength(initmaxPhraseLength),
|
||||||
minPhraseLength(3),
|
minPhraseLength(3),
|
||||||
|
separator("|||"),
|
||||||
allModelsOutputFlag(false),
|
allModelsOutputFlag(false),
|
||||||
wordModel(false),
|
wordModel(false),
|
||||||
wordType(REO_MSD),
|
wordType(REO_MSD),
|
||||||
|
@ -154,6 +154,8 @@ int main(int argc, char* argv[])
|
|||||||
options.debug = true;
|
options.debug = true;
|
||||||
} else if (strcmp(argv[i], "--MinPhraseLength") == 0) {
|
} else if (strcmp(argv[i], "--MinPhraseLength") == 0) {
|
||||||
options.minPhraseLength = atoi(argv[++i]);
|
options.minPhraseLength = atoi(argv[++i]);
|
||||||
|
} else if (strcmp(argv[i], "--Separator") == 0) {
|
||||||
|
options.separator = argv[++i];
|
||||||
} else if(strcmp(argv[i],"--model") == 0) {
|
} else if(strcmp(argv[i],"--model") == 0) {
|
||||||
if (i+1 >= argc) {
|
if (i+1 >= argc) {
|
||||||
cerr << "extract: syntax error, no model's information provided to the option --model " << endl;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_extractFileOrientation << sentence.sentenceID << " ||| ";
|
const string &sep = m_options.separator;
|
||||||
m_extractFileOrientation << getClass(orientationInfo) << " ||| ";
|
|
||||||
|
m_extractFileOrientation << sentence.sentenceID << " " << sep << " ";
|
||||||
|
m_extractFileOrientation << getClass(orientationInfo) << " " << sep << " ";
|
||||||
|
|
||||||
// position
|
// position
|
||||||
m_extractFileOrientation << startF << " " << endF << " ||| ";
|
m_extractFileOrientation << startF << " " << endF << " " << sep << " ";
|
||||||
|
|
||||||
// start
|
// start
|
||||||
m_extractFileOrientation << "<s> ";
|
m_extractFileOrientation << "<s> ";
|
||||||
for(int fi=0; fi<startF; fi++) {
|
for(int fi=0; fi<startF; fi++) {
|
||||||
m_extractFileOrientation << sentence.source[fi] << " ";
|
m_extractFileOrientation << sentence.source[fi] << " ";
|
||||||
}
|
}
|
||||||
m_extractFileOrientation << "||| ";
|
m_extractFileOrientation << sep << " ";
|
||||||
|
|
||||||
// middle
|
// middle
|
||||||
for(int fi=startF; fi<=endF; fi++) {
|
for(int fi=startF; fi<=endF; fi++) {
|
||||||
m_extractFileOrientation << sentence.source[fi] << " ";
|
m_extractFileOrientation << sentence.source[fi] << " ";
|
||||||
}
|
}
|
||||||
m_extractFileOrientation << "||| ";
|
m_extractFileOrientation << sep << " ";
|
||||||
|
|
||||||
// end
|
// end
|
||||||
for(int fi=endF+1; fi<sentence.source.size(); fi++) {
|
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 << "</s> ";
|
||||||
|
|
||||||
m_extractFileOrientation << "||| ";
|
|
||||||
|
|
||||||
|
|
||||||
// target
|
// target
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user