This commit is contained in:
Hieu Hoang 2015-12-11 22:29:24 +00:00
parent d17fa2ea80
commit 4604cc96ba
5 changed files with 50 additions and 143 deletions

View File

@ -61,6 +61,21 @@
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/OutputFileStream.h</locationURI>
</link>
<link>
<name>PhraseExtractionOptions.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseExtractionOptions.h</locationURI>
</link>
<link>
<name>PhraseOrientation.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.cpp</locationURI>
</link>
<link>
<name>PhraseOrientation.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.h</locationURI>
</link>
<link>
<name>SentenceAlignment.cpp</name>
<type>1</type>

View File

@ -60,6 +60,21 @@
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/OutputFileStream.h</locationURI>
</link>
<link>
<name>PhraseExtractionOptions.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseExtractionOptions.h</locationURI>
</link>
<link>
<name>PhraseOrientation.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.cpp</locationURI>
</link>
<link>
<name>PhraseOrientation.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.h</locationURI>
</link>
<link>
<name>SentenceAlignment.cpp</name>
<type>1</type>

View File

@ -710,6 +710,16 @@
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/Phrase.h</locationURI>
</link>
<link>
<name>PhraseOrientation.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.cpp</locationURI>
</link>
<link>
<name>PhraseOrientation.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/phrase-extract/PhraseOrientation.h</locationURI>
</link>
<link>
<name>PrefixTree.h</name>
<type>1</type>
@ -2465,6 +2475,16 @@
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/parameters/ServerOptions.h</locationURI>
</link>
<link>
<name>parameters/SyntaxOptions.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/parameters/SyntaxOptions.cpp</locationURI>
</link>
<link>
<name>parameters/SyntaxOptions.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/parameters/SyntaxOptions.h</locationURI>
</link>
<link>
<name>FF/LexicalReordering/LexicalReordering.cpp</name>
<type>1</type>

View File

@ -1,105 +0,0 @@
// -*- mode: c++; indent-tabs-mode: nil; tab-width: 2 -*-
#include "InputOptions.h"
#include <vector>
#include <iostream>
#include "moses/StaticData.h"
#include "moses/TypeDef.h"
namespace Moses {
InputOptions::
InputOptions()
{
xml_brackets.first = "<";
xml_brackets.second = ">";
input_type = SentenceInput;
}
bool
InputOptions::
init(Parameter const& param)
{
param.SetParameter(input_type, "inputtype", SentenceInput);
if (input_type == SentenceInput)
{ VERBOSE(2, "input type is: text input"); }
else if (input_type == ConfusionNetworkInput)
{ VERBOSE(2, "input type is: confusion net"); }
else if (input_type == WordLatticeInput)
{ VERBOSE(2, "input type is: word lattice"); }
else if (input_type == TreeInputType)
{ VERBOSE(2, "input type is: tree"); }
else if (input_type == TabbedSentenceInput)
{ VERBOSE(2, "input type is: tabbed sentence"); }
else if (input_type == ForestInputType)
{ VERBOSE(2, "input type is: forest"); }
param.SetParameter(continue_partial_translation,
"continue-partial-translation", false);
param.SetParameter(default_non_term_only_for_empty_range,
"default-non-term-for-empty-range-only", false);
param.SetParameter<XmlInputType>(xml_policy, "xml-input", XmlPassThrough);
// specify XML tags opening and closing brackets for XML option
// Do we really want this to be configurable???? UG
const PARAM_VEC *pspec;
pspec = param.GetParam("xml-brackets");
if (pspec && pspec->size())
{
std::vector<std::string> brackets = Tokenize(pspec->at(0));
if(brackets.size()!=2)
{
std::cerr << "invalid xml-brackets value, "
<< "must specify exactly 2 blank-delimited strings "
<<<<<<< HEAD
<< "for XML tags opening and closing brackets" << std::endl;
exit(1);
}
xml_brackets.first= brackets[0];
xml_brackets.second=brackets[1];
=======
<< "for XML tags opening and closing brackets"
<< std::endl;
exit(1);
}
xml_brackets.first= brackets[0];
xml_brackets.second=brackets[1];
>>>>>>> b733804fdcf20a5a9e822861471248c8fdbc0e2d
VERBOSE(1,"XML tags opening and closing brackets for XML input are: "
<< xml_brackets.first << " and "
<< xml_brackets.second << std::endl);
}
<<<<<<< HEAD
param.SetParameter(placeholder_factor, "placeholder-factor", NOT_FOUND);
return true;
}
#ifdef HAVE_XMLRPC_C
bool
InputOptions::
update(std::map<std::string,xmlrpc_c::value>const& param)
{
typedef std::map<std::string, xmlrpc_c::value> params_t;
params_t::const_iterator si = param.find("xml-input");
if (si != param.end())
xml_policy = Scan<XmlInputType>(xmlrpc_c::value_string(si->second));
return true;
}
#endif
=======
pspec = param.GetParam("input-factors");
if (pspec) factor_order = Scan<FactorType>(*pspec);
if (factor_order.empty()) factor_order.assign(1,0);
return true;
}
>>>>>>> b733804fdcf20a5a9e822861471248c8fdbc0e2d
}

View File

@ -1,38 +0,0 @@
// -*- mode: c++; indent-tabs-mode: nil; tab-width: 2 -*-
#pragma once
#include <string>
#include "moses/Parameter.h"
#include <string>
#include "OptionsBaseClass.h"
namespace Moses
{
struct
InputOptions : public OptionsBaseClass
{
bool continue_partial_translation;
bool default_non_term_only_for_empty_range; // whatever that means
InputTypeEnum input_type;
XmlInputType xml_policy; // pass through, ignore, exclusive, inclusive
<<<<<<< HEAD
FactorType placeholder_factor; // where to store original text for placeholders
=======
std::vector<FactorType> factor_order; // input factor order
>>>>>>> b733804fdcf20a5a9e822861471248c8fdbc0e2d
std::pair<std::string,std::string> xml_brackets;
// strings to use as XML tags' opening and closing brackets.
// Default are "<" and ">"
InputOptions();
bool init(Parameter const& param);
bool update(std::map<std::string,xmlrpc_c::value>const& param);
};
}