load hiero format for reading suffix arrays

This commit is contained in:
Hieu Hoang 2011-11-14 00:14:40 +07:00
parent 953f2200ff
commit 253f32a2e5
6 changed files with 16 additions and 9 deletions

View File

@ -129,6 +129,10 @@ IOWrapper::~IOWrapper()
delete m_singleBestOutputCollector;
}
void IOWrapper::ResetTranslationId() {
m_translationId = StaticData::Instance().GetStartTranslationId();
}
InputType*IOWrapper::GetInput(InputType* inputType)
{
if(inputType->Read(*m_inputStream, m_inputFactorOrder)) {

View File

@ -85,9 +85,7 @@ public:
void OutputDetailedTranslationReport(const Moses::ChartHypothesis *hypo, long translationId);
void Backtrack(const Moses::ChartHypothesis *hypo);
void ResetTranslationId() {
m_translationId = 0;
}
void ResetTranslationId();
Moses::OutputCollector *GetSearchGraphOutputCollector() {
return m_searchGraphOutputCollector;

View File

@ -334,7 +334,6 @@
"-ldstruct",
"-lz",
"-lirstlm",
"-lrandlm",
);
PREBINDING = NO;
PRODUCT_NAME = "moses-cmd";
@ -375,7 +374,6 @@
"-ldstruct",
"-lz",
"-lirstlm",
"-lrandlm",
);
PREBINDING = NO;
PRODUCT_NAME = "moses-cmd";
@ -408,7 +406,6 @@
"-ldstruct",
"-lz",
"-lirstlm",
"-lrandlm",
);
PREBINDING = NO;
PRODUCT_NAME = "moses-cmd";

View File

@ -146,6 +146,7 @@ Parameter::Parameter()
AddParam("show-weights", "print feature weights and exit");
AddParam("alignment-output-file", "print output word alignments into given file");
AddParam("sort-word-alignment", "Sort word alignments for more consistent display. 0=no sort (default), 1=target order");
AddParam("start-translation-id", "Id of 1st input. Default = 0");
}
Parameter::~Parameter()

View File

@ -431,6 +431,9 @@ bool StaticData::LoadData(Parameter *parameter)
}
}
m_startTranslationId = (m_parameter->GetParam("start-translation-id").size() > 0) ?
Scan<long>(m_parameter->GetParam("start-translation-id")[0]) : 0;
// Read in constraint decoding file, if provided
if(m_parameter->GetParam("constraint").size()) {
if (m_parameter->GetParam("search-algorithm").size() > 0
@ -443,8 +446,8 @@ bool StaticData::LoadData(Parameter *parameter)
InputFileStream constraintFile(m_constraintFileName);
std::string line;
long sentenceID = -1;
long sentenceID = GetStartTranslationId() - 1;
while (getline(constraintFile, line)) {
vector<string> vecStr = Tokenize(line, "\t");

View File

@ -210,7 +210,8 @@ protected:
WordAlignmentSort m_wordAlignmentSort;
int m_threadCount;
long m_startTranslationId;
StaticData();
void LoadPhraseBasedParameters();
@ -610,6 +611,9 @@ public:
int ThreadCount() const {
return m_threadCount;
}
long GetStartTranslationId() const
{ return m_startTranslationId; }
};
}