mosesdecoder/phrase-extract/extract-mixed-syntax/Parameter.cpp

75 lines
1.5 KiB
C++
Raw Normal View History

/*
* Parameter.cpp
*
* Created on: 17 Feb 2014
* Author: hieu
*/
#include "Parameter.h"
#include "moses/Util.h"
#include "util/exception.hh"
using namespace std;
Parameter::Parameter()
2015-01-15 14:18:39 +03:00
:maxSpan(10)
,minSpan(0)
,maxNonTerm(2)
,maxHieroNonTerm(999)
,maxSymbolsTarget(999)
,maxSymbolsSource(5)
,minHoleSource(2)
,minHoleSourceSyntax(1)
,sentenceOffset(0)
,nonTermConsecSource(false)
,requireAlignedWord(true)
,fractionalCounting(true)
,gzOutput(false)
2015-01-15 14:18:39 +03:00
,hieroNonTerm("[X]")
,sourceSyntax(false)
,targetSyntax(false)
2015-01-15 14:18:39 +03:00
,mixedSyntaxType(0)
,multiLabel(0)
,nonTermConsecSourceMixed(true)
,hieroSourceLHS(false)
,maxSpanFreeNonTermSource(0)
,nieceTerminal(true)
,maxScope(UNDEFINED)
,minScope(0)
2015-01-15 14:18:39 +03:00
,spanLength(false)
,ruleLength(false)
,nonTermContext(false)
,nonTermContextTarget(false)
,nonTermContextFactor(0)
2015-01-15 14:18:39 +03:00
,numSourceFactors(1)
,numTargetFactors(1)
2015-01-15 14:18:39 +03:00
,nonTermConsecSourceMixedSyntax(1)
{}
2015-01-15 14:18:39 +03:00
Parameter::~Parameter()
{
// TODO Auto-generated destructor stub
}
void Parameter::SetScopeSpan(const std::string &str)
{
2015-01-15 14:18:39 +03:00
scopeSpanStr = str;
vector<string> toks1;
Moses::Tokenize(toks1, str, ":");
2015-01-15 14:18:39 +03:00
for (size_t i = 0; i < toks1.size(); ++i) {
const string &tok1 = toks1[i];
2015-01-15 14:18:39 +03:00
vector<int> toks2;
Moses::Tokenize<int>(toks2, tok1, ",");
UTIL_THROW_IF2(toks2.size() != 2, "Format is min,max:min,max... String is " << tok1);
2015-01-15 14:18:39 +03:00
std::pair<int,int> values(toks2[0], toks2[1]);
scopeSpan.push_back(values);
}
}