daily automatic beautifier

This commit is contained in:
MosesAdmin 2015-11-12 00:00:40 +00:00
parent 858a509d53
commit dad1bd6127
21 changed files with 68 additions and 68 deletions

View File

@ -110,11 +110,11 @@ int main(int argc, char** argv)
std::cerr << "Caching for f\n";
table->InitializeForInputPhrase(f);
}
std::cerr << "Querying: "
<< "f='" << f.GetStringRep(f_mask) <<"' "
<< "e='" << e.GetStringRep(e_mask) << "' "
<< "c='" << c.GetStringRep(c_mask) << "'\n";
<< "f='" << f.GetStringRep(f_mask) <<"' "
<< "e='" << e.GetStringRep(e_mask) << "' "
<< "c='" << c.GetStringRep(c_mask) << "'\n";
std::cerr << table->GetScore(f,e,c) << "\n";
//table->DbgDump(&std::cerr);
delete table;

View File

@ -115,7 +115,7 @@ public:
if (!consumed) {
// newargv[newargc] = new char[strlen(argv[i]) + 1];
// strcpy(newargv[newargc],argv[i]);
newargv[newargc] = argv[i];
newargv[newargc] = argv[i];
++newargc;
}
}

View File

@ -103,7 +103,7 @@ ChartHypothesis::~ChartHypothesis()
void ChartHypothesis::GetOutputPhrase(Phrase &outPhrase) const
{
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
for (size_t pos = 0; pos < GetCurrTargetPhrase().GetSize(); ++pos) {
const Word &word = GetCurrTargetPhrase().GetWord(pos);
if (word.IsNonTerminal()) {

View File

@ -853,8 +853,8 @@ void ChartManager::OutputBestHypo(OutputCollector *collector, const ChartHypothe
outPhrase.RemoveWord(0);
outPhrase.RemoveWord(outPhrase.GetSize() - 1);
const std::vector<FactorType> outputFactorOrder
= StaticData::Instance().GetOutputFactorOrder();
const std::vector<FactorType> outputFactorOrder
= StaticData::Instance().GetOutputFactorOrder();
string output = outPhrase.GetStringRep(outputFactorOrder);
out << output << endl;
} else {

View File

@ -71,7 +71,7 @@ void ChartTranslationOptions::EvaluateWithSourceContext(const InputType &input,
if (inputPath.ttask.lock()->options().input.placeholder_factor != NOT_FOUND) {
CreateSourceRuleFromInputPath();
}
CollType::iterator iter;
for (iter = m_collection.begin(); iter != m_collection.end(); ++iter) {
ChartTranslationOption &transOpt = **iter;

View File

@ -347,8 +347,8 @@ std::string
Hypothesis::
GetTargetPhraseStringRep(const vector<FactorType> factorsToPrint) const
{
return (m_prevHypo
? GetCurrTargetPhrase().GetStringRep(factorsToPrint)
return (m_prevHypo
? GetCurrTargetPhrase().GetStringRep(factorsToPrint)
: "");
}
@ -471,14 +471,14 @@ OutputSurface(std::ostream &out, const Hypothesis &edge,
UTIL_THROW_IF2(outputFactorOrder.size() == 0,
"Must specific at least 1 output factor");
const TargetPhrase& phrase = edge.GetCurrTargetPhrase();
bool markUnknown = GetManager().options().unk.mark;
bool markUnknown = GetManager().options().unk.mark;
// = StaticData::Instance().GetMarkUnknown();
if (reportAllFactors == true) {
out << phrase;
} else {
FactorType placeholderFactor
= StaticData::Instance().options().input.placeholder_factor;
FactorType placeholderFactor
= StaticData::Instance().options().input.placeholder_factor;
std::map<size_t, const Factor*> placeholders;
if (placeholderFactor != NOT_FOUND) {
// creates map of target position -> factor for placeholders

View File

@ -218,16 +218,16 @@ Parameter::Parameter()
AddParam(server_opts,"server-log", "Log destination for moses server");
AddParam(server_opts,"serial", "Run server in serial mode, processing only one request at a time.");
AddParam(server_opts,"server-maxconn",
"Max. No of simultaneous HTTP transactions allowed by the server.");
AddParam(server_opts,"server-maxconn",
"Max. No of simultaneous HTTP transactions allowed by the server.");
AddParam(server_opts,"server-maxconn-backlog",
"Max. No. of requests the OS will queue if the server is busy.");
AddParam(server_opts,"server-keepalive-maxconn",
"Max. No. of requests the server will accept on a single TCP connection.");
AddParam(server_opts,"server-keepalive-timeout",
"Max. number of seconds the server will keep a persistent connection alive.");
AddParam(server_opts,"server-timeout",
"Max. number of seconds the server will wait for a client to submit a request once a connection has been established.");
"Max. No. of requests the OS will queue if the server is busy.");
AddParam(server_opts,"server-keepalive-maxconn",
"Max. No. of requests the server will accept on a single TCP connection.");
AddParam(server_opts,"server-keepalive-timeout",
"Max. number of seconds the server will keep a persistent connection alive.");
AddParam(server_opts,"server-timeout",
"Max. number of seconds the server will wait for a client to submit a request once a connection has been established.");
// session timeout and session cache size are for moses translation session handling
// they have nothing to do with the abyss server (but relate to the moses server)
@ -1352,8 +1352,8 @@ FindParam(const string &paramSwitch, int argc, char const* argv[])
* \param argv values of paramters on command line */
void
Parameter::
OverwriteParam(const string &paramSwitch, const string &paramName,
int argc, char const* argv[])
OverwriteParam(const string &paramSwitch, const string &paramName,
int argc, char const* argv[])
{
int startPos = -1;
for (int i = 0 ; i < argc ; i++) {

View File

@ -58,8 +58,8 @@ protected:
std::map<std::string, std::vector<float> > m_weights;
std::string FindParam(const std::string &paramSwitch, int argc, char const* argv[]);
void OverwriteParam(const std::string &paramSwitch, const std::string &paramName,
int argc, char const* argv[]);
void OverwriteParam(const std::string &paramSwitch, const std::string &paramName,
int argc, char const* argv[]);
bool ReadConfigFile(const std::string &filePath );
bool FilesExist(const std::string &paramName, int fieldNo, std::vector<std::string> const& fileExtension=std::vector<std::string>(1,""));
bool isOption(const char* token);

View File

@ -114,9 +114,9 @@ Phrase Phrase::GetSubString(const Range &range, FactorType factorType) const
return retPhrase;
}
std::string
std::string
Phrase::
GetStringRep(vector<FactorType> const& factorsToPrint,
GetStringRep(vector<FactorType> const& factorsToPrint,
AllOptions const* opts) const
{
if (!opts) opts = &StaticData::Instance().options();
@ -133,7 +133,7 @@ GetStringRep(vector<FactorType> const& factorsToPrint,
}
return strme.str();
}
Word &Phrase::AddWord()
{
m_words.push_back(Word());

View File

@ -201,12 +201,12 @@ public:
Phrase GetSubString(const Range &range) const;
Phrase GetSubString(const Range &range, FactorType factorType) const;
//! return a string rep of the phrase;
// w/ factors delimited by FactorDelimiter
std::string
GetStringRep(std::vector<FactorType> const& factorsToPrint,
//! return a string rep of the phrase;
// w/ factors delimited by FactorDelimiter
std::string
GetStringRep(std::vector<FactorType> const& factorsToPrint,
AllOptions const* opts=NULL) const;
TO_STRING();

View File

@ -320,7 +320,7 @@ void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list,
}
}
std::vector <ChartTranslationOptions*>
std::vector <ChartTranslationOptions*>
Sentence::
GetXmlChartTranslationOptions(AllOptions const& opts) const
{

View File

@ -160,9 +160,9 @@ protected:
//! load decoding steps
void LoadDecodeGraphs();
void LoadDecodeGraphsOld(const std::vector<std::string> &mappingVector,
void LoadDecodeGraphsOld(const std::vector<std::string> &mappingVector,
const std::vector<size_t> &maxChartSpans);
void LoadDecodeGraphsNew(const std::vector<std::string> &mappingVector,
void LoadDecodeGraphsNew(const std::vector<std::string> &mappingVector,
const std::vector<size_t> &maxChartSpans);
void NoCache();
@ -245,11 +245,11 @@ public:
const std::vector<FactorType> &GetInputFactorOrder() const {
return m_options.input.factor_order;
}
const std::vector<FactorType> &GetOutputFactorOrder() const {
return m_options.output.factor_order;
}
inline bool GetSourceStartPosMattersForRecombination() const {
return m_sourceStartPosMattersForRecombination;
}

View File

@ -75,7 +75,7 @@ void KBestExtractor::Extract(
Phrase KBestExtractor::GetOutputPhrase(const Derivation &d)
{
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
Phrase ret(ARRAY_SIZE_INCR);
const TargetPhrase &phrase = *(d.edge->shyperedge.label.translation);

View File

@ -12,7 +12,7 @@ namespace Syntax
Phrase GetOneBestTargetYield(const SHyperedge &h)
{
FactorType placeholderFactor = StaticData::Instance().options().input.placeholder_factor;
Phrase ret(ARRAY_SIZE_INCR);
const AlignmentInfo::NonTermIndexMap &targetToSourceMap =

View File

@ -447,8 +447,8 @@ CreateTranslationOptionsForRange
vector<TranslationOption*>::const_iterator c;
for (c = partTransOptList.begin() ; c != partTransOptList.end() ; ++c) {
TranslationOption *transOpt = *c;
if (xml_policy != XmlConstraint ||
!ViolatesXmlOptionsConstraint(sPos,ePos,transOpt)) {
if (xml_policy != XmlConstraint ||
!ViolatesXmlOptionsConstraint(sPos,ePos,transOpt)) {
Add(transOpt);
}
}

View File

@ -22,11 +22,11 @@ namespace Moses
* \param reorderingConstraint reordering constraint zones specified by xml
* \param walls reordering constraint walls specified by xml
*/
bool
bool
TreeInput::
ProcessAndStripXMLTags(AllOptions const& opts, string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &xmlOptions)
ProcessAndStripXMLTags(AllOptions const& opts, string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &xmlOptions)
{
//parse XML markup in translation line

View File

@ -43,10 +43,10 @@ protected:
return m_sourceChart[startPos][endPos - startPos];
}
bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &res);
bool ProcessAndStripXMLTags(AllOptions const& opts, std::string &line,
std::vector<XMLParseOutput> &sourceLabels,
std::vector<XmlOption*> &res);
public:
TreeInput() : Sentence() { }

View File

@ -208,8 +208,8 @@ Phrase TrellisPath::GetTargetPhrase() const
Phrase TrellisPath::GetSurfacePhrase() const
{
const std::vector<FactorType> &outputFactor
= manager().options().output.factor_order;
const std::vector<FactorType> &outputFactor
= manager().options().output.factor_order;
// = StaticData::Instance().GetOutputFactorOrder();
Phrase targetPhrase = GetTargetPhrase();
Phrase ret(targetPhrase.GetSize());

View File

@ -47,7 +47,7 @@ class TrellisPath
protected:
std::vector<const Hypothesis *> m_path; //< list of hypotheses/arcs
size_t m_prevEdgeChanged;
size_t m_prevEdgeChanged;
/**< the last node that was wiggled to create this path
, or NOT_FOUND if this path is the best trans so consist of only hypos
*/
@ -60,7 +60,7 @@ protected:
void InitTotalScore();
Manager const& manager() const {
Manager const& manager() const {
UTIL_THROW_IF2(m_path.size() == 0, "zero-length trellis path");
return m_path[0]->GetManager();
}

View File

@ -158,13 +158,13 @@ vector<string> TokenizeXml(const string& str, const std::string& lbrackStr, cons
* \param lbrackStr xml tag's left bracket string, typically "<"
* \param rbrackStr xml tag's right bracket string, typically ">"
*/
bool
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption*> &res,
ReorderingConstraint &reorderingConstraint,
vector< size_t > &walls,
std::vector< std::pair<size_t, std::string> > &placeholders,
int offset, const std::string& lbrackStr,
const std::string& rbrackStr)
bool
ProcessAndStripXMLTags(AllOptions const& opts, string &line, vector<XmlOption*> &res,
ReorderingConstraint &reorderingConstraint,
vector< size_t > &walls,
std::vector< std::pair<size_t, std::string> > &placeholders,
int offset, const std::string& lbrackStr,
const std::string& rbrackStr)
{
//parse XML markup in translation line

View File

@ -29,10 +29,10 @@ std::string ParseXmlTagAttribute(const std::string& tag,const std::string& attri
std::string TrimXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">") ;
bool isXmlTag(const std::string& tag, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
std::vector<std::string> TokenizeXml(const std::string& str, const std::string& lbrackStr="<", const std::string& rbrackStr=">");
bool ProcessAndStripXMLTags(AllOptions const& opts,
std::string &line, std::vector<XmlOption*> &res,
ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
bool ProcessAndStripXMLTags(AllOptions const& opts,
std::string &line, std::vector<XmlOption*> &res,
ReorderingConstraint &reorderingConstraint, std::vector< size_t > &walls,
std::vector< std::pair<size_t, std::string> > &placeholders,
int offset,
const std::string& lbrackStr="<", const std::string& rbrackStr=">");