00001
00002
00003
00004
00005
00006
00007 #include "Parameter.h"
00008 #include "moses/Util.h"
00009 #include "util/exception.hh"
00010
00011 using namespace std;
00012
00013 Parameter::Parameter()
00014 :maxSpan(10)
00015 ,minSpan(0)
00016 ,maxNonTerm(2)
00017 ,maxHieroNonTerm(999)
00018 ,maxSymbolsTarget(999)
00019 ,maxSymbolsSource(5)
00020 ,minHoleSource(2)
00021 ,minHoleSourceSyntax(1)
00022 ,sentenceOffset(0)
00023 ,nonTermConsecSource(false)
00024 ,requireAlignedWord(true)
00025 ,fractionalCounting(true)
00026 ,gzOutput(false)
00027
00028 ,hieroNonTerm("[X]")
00029 ,sourceSyntax(false)
00030 ,targetSyntax(false)
00031
00032 ,mixedSyntaxType(0)
00033 ,multiLabel(0)
00034 ,nonTermConsecSourceMixed(true)
00035 ,hieroSourceLHS(false)
00036 ,maxSpanFreeNonTermSource(0)
00037 ,nieceTerminal(true)
00038 ,maxScope(UNDEFINED)
00039 ,minScope(0)
00040
00041 ,spanLength(false)
00042 ,ruleLength(false)
00043 ,nonTermContext(false)
00044 ,nonTermContextTarget(false)
00045 ,nonTermContextFactor(0)
00046
00047 ,numSourceFactors(1)
00048 ,numTargetFactors(1)
00049
00050 ,nonTermConsecSourceMixedSyntax(1)
00051 {}
00052
00053 Parameter::~Parameter()
00054 {
00055
00056 }
00057
00058 void Parameter::SetScopeSpan(const std::string &str)
00059 {
00060 scopeSpanStr = str;
00061 vector<string> toks1;
00062 Moses::Tokenize(toks1, str, ":");
00063
00064 for (size_t i = 0; i < toks1.size(); ++i) {
00065 const string &tok1 = toks1[i];
00066
00067 vector<int> toks2;
00068 Moses::Tokenize<int>(toks2, tok1, ",");
00069 UTIL_THROW_IF2(toks2.size() != 2, "Format is min,max:min,max... String is " << tok1);
00070
00071 std::pair<int,int> values(toks2[0], toks2[1]);
00072 scopeSpan.push_back(values);
00073 }
00074 }