mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
add docid and texttype to InputType and add texttype parameter
This commit is contained in:
parent
b00e4b3115
commit
2b0c1d36a9
@ -45,9 +45,11 @@ class InputType
|
||||
{
|
||||
protected:
|
||||
long m_translationId; //< contiguous Id
|
||||
long m_documentId;
|
||||
bool m_hasMetaData;
|
||||
long m_segId;
|
||||
ReorderingConstraint m_reorderingConstraint; /**< limits on reordering specified either by "-mp" switch or xml tags */
|
||||
std::string m_textType;
|
||||
|
||||
public:
|
||||
|
||||
@ -68,6 +70,18 @@ public:
|
||||
void SetTranslationId(long translationId) {
|
||||
m_translationId = translationId;
|
||||
}
|
||||
long GetDocumentId() const {
|
||||
return m_documentId;
|
||||
}
|
||||
void SetDocumentId(long documentId) {
|
||||
m_documentId = documentId;
|
||||
}
|
||||
std::string GetTextType() const {
|
||||
return m_textType;
|
||||
}
|
||||
void SetTextType(std::string type) {
|
||||
m_textType = type;
|
||||
}
|
||||
//! returns the number of words moved
|
||||
virtual int ComputeDistortionDistance(const WordsRange& prev, const WordsRange& current) const;
|
||||
|
||||
|
@ -181,6 +181,7 @@ Parameter::Parameter()
|
||||
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");
|
||||
AddParam("text-type", "should be one of dev/devtest/test, used for domain adaptation features");
|
||||
}
|
||||
|
||||
Parameter::~Parameter()
|
||||
|
@ -92,6 +92,9 @@ int Sentence::Read(std::istream& in,const std::vector<FactorType>& factorOrder)
|
||||
if (meta.find("id") != meta.end()) {
|
||||
this->SetTranslationId(atol(meta["id"].c_str()));
|
||||
}
|
||||
if (meta.find("docid") != meta.end()) {
|
||||
this->SetDocumentId(atol(meta["docid"].c_str()));
|
||||
}
|
||||
|
||||
// parse XML markup in translation line
|
||||
//const StaticData &staticData = StaticData::Instance();
|
||||
@ -180,7 +183,7 @@ Sentence::CreateTranslationOptionCollection(const TranslationSystem* system) con
|
||||
}
|
||||
void Sentence::Print(std::ostream& out) const
|
||||
{
|
||||
out<<*static_cast<Phrase const*>(this)<<"\n";
|
||||
out<<*static_cast<Phrase const*>(this);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user