daily automatic beautifier

This commit is contained in:
MosesAdmin 2015-12-09 00:00:35 +00:00
parent 2da95fe74a
commit 59365f2bd3
41 changed files with 146 additions and 145 deletions

View File

@ -130,8 +130,8 @@ void ChartManager::Decode()
*/
void ChartManager::AddXmlChartOptions()
{
const std::vector <ChartTranslationOptions*> xmlChartOptionsList
= m_source.GetXmlChartTranslationOptions();
const std::vector <ChartTranslationOptions*> xmlChartOptionsList
= m_source.GetXmlChartTranslationOptions();
IFVERBOSE(2) {
cerr << "AddXmlChartOptions " << xmlChartOptionsList.size() << endl;
}

View File

@ -91,8 +91,8 @@ void ChartParserUnknown::Process(const Word &sourceWord, const Range &range, Cha
//const Word &sourceLHS = staticData.GetInputDefaultNonTerminal();
Word *targetLHS = new Word(true);
targetLHS->CreateFromString(Output, staticData.options().output.factor_order,
targetLHSStr, true);
targetLHS->CreateFromString(Output, staticData.options().output.factor_order,
targetLHSStr, true);
UTIL_THROW_IF2(targetLHS->GetFactor(0) == NULL, "Null factor for target LHS");
// add to dictionary
@ -133,8 +133,8 @@ void ChartParserUnknown::Process(const Word &sourceWord, const Range &range, Cha
//float prob = iterLHS->second;
Word *targetLHS = new Word(true);
targetLHS->CreateFromString(Output, staticData.options().output.factor_order,
targetLHSStr, true);
targetLHS->CreateFromString(Output, staticData.options().output.factor_order,
targetLHSStr, true);
UTIL_THROW_IF2(targetLHS->GetFactor(0) == NULL, "Null factor for target LHS");
targetPhrase->GetScoreBreakdown().Assign(&unknownWordPenaltyProducer, unknownScore);
@ -210,12 +210,12 @@ void ChartParser::Create(const Range &range, ChartParserCallback &to)
ruleLookupManager.GetChartRuleCollection(inputPath, last, to);
}
}
if (range.GetNumWordsCovered() == 1
&& range.GetStartPos() != 0
if (range.GetNumWordsCovered() == 1
&& range.GetStartPos() != 0
&& range.GetStartPos() != m_source.GetSize()-1) {
bool always = m_ttask.lock()->options().unk.always_create_direct_transopt;
// bool alwaysCreateDirectTranslationOption
bool always = m_ttask.lock()->options().unk.always_create_direct_transopt;
// bool alwaysCreateDirectTranslationOption
// = StaticData::Instance().IsAlwaysCreateDirectTranslationOption();
if (to.Empty() || always) {
// create unknown words for 1 word coverage where we don't have any trans options

View File

@ -282,10 +282,10 @@ ConfusionNet::
CreateTranslationOptionCollection(ttasksptr const& ttask) const
{
size_t maxNoTransOptPerCoverage
= ttask->options().search.max_trans_opt_per_cov;
= ttask->options().search.max_trans_opt_per_cov;
// StaticData::Instance().GetMaxNoTransOptPerCoverage();
float translationOptionThreshold
= ttask->options().search.trans_opt_threshold;
= ttask->options().search.trans_opt_threshold;
// StaticData::Instance().GetTranslationOptionThreshold();
TranslationOptionCollection *rv
= new TranslationOptionCollectionConfusionNet

View File

@ -141,18 +141,16 @@ void SimpleTranslationInterface::DestroyFeatureFunctionStatic()
Parameter params;
void
void
signal_handler(int signum)
{
if (signum == SIGALRM) {
exit(0); // that's what we expected from the child process after forking
}
else if (signum == SIGTERM || signum == SIGKILL) {
} else if (signum == SIGTERM || signum == SIGKILL) {
exit(0);
}
else {
} else {
std::cerr << "Unexpected signal " << signum << std::endl;
exit(signum);
exit(signum);
}
}
@ -161,7 +159,7 @@ int
run_as_server()
{
#ifdef HAVE_XMLRPC_C
kill(getppid(),SIGALRM);
kill(getppid(),SIGALRM);
MosesServer::Server server(params);
return server.run(); // actually: don't return. see Server::run()
#else
@ -344,7 +342,10 @@ int decoder_main(int argc, char const** argv)
pid_t pid;
if (params.GetParam("daemon")) {
pid = fork();
if (pid) { pause(); exit(0); } // parent process
if (pid) {
pause(); // parent process
exit(0);
}
}
#endif
// setting "-show-weights" -> just dump out weights and exit
@ -356,7 +357,7 @@ int decoder_main(int argc, char const** argv)
if (params.GetParam("server")) {
std::cerr << "RUN SERVER at pid " << pid << std::endl;
return run_as_server();
} else
} else
return batch_run();
}
#ifdef NDEBUG

View File

@ -50,8 +50,8 @@ void ConstrainedDecoding::Load(AllOptions const& opts)
{
const StaticData &staticData = StaticData::Instance();
bool addBeginEndWord
= ((opts.search.algo == CYKPlus) || (opts.search.algo == ChartIncremental));
= ((opts.search.algo == CYKPlus) || (opts.search.algo == ChartIncremental));
for(size_t i = 0; i < m_paths.size(); ++i) {
InputFileStream constraintFile(m_paths[i]);
std::string line;

View File

@ -7,11 +7,11 @@ namespace Moses
InternalTree::InternalTree(const std::string & line, size_t start, size_t len, const bool nonterminal)
{
std::vector<FactorType> const& oFactors
= StaticData::Instance().options().output.factor_order;
std::vector<FactorType> const& oFactors
= StaticData::Instance().options().output.factor_order;
if (len > 0) {
m_value.CreateFromString(Output, oFactors, StringPiece(line).substr(start, len),
nonterminal);
m_value.CreateFromString(Output, oFactors, StringPiece(line).substr(start, len),
nonterminal);
}
}
@ -21,9 +21,9 @@ InternalTree::InternalTree(const std::string & line, const bool nonterminal)
size_t found = line.find_first_of("[] ");
if (found == line.npos) {
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
line, nonterminal);
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
line, nonterminal);
} else {
AddSubTree(line, 0);
}
@ -49,18 +49,18 @@ size_t InternalTree::AddSubTree(const std::string & line, size_t pos)
pos = m_children.back()->AddSubTree(line, pos+1);
} else {
if (len > 0) {
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
StringPiece(line).substr(oldpos, len), false);
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
StringPiece(line).substr(oldpos, len), false);
has_value = true;
}
pos = AddSubTree(line, pos+1);
}
} else if (token == ' ' || token == ']') {
if (len > 0 && !has_value) {
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
StringPiece(line).substr(oldpos, len), true);
m_value.CreateFromString(Output,
StaticData::Instance().options().output.factor_order,
StringPiece(line).substr(oldpos, len), true);
has_value = true;
} else if (len > 0) {
m_children.push_back(boost::make_shared<InternalTree>(line, oldpos, len, false));

View File

@ -124,8 +124,8 @@ const std::string& SoftMatchingFeature::GetOrSetFeatureName(const Word& RHS, con
boost::unique_lock<boost::shared_mutex> lock(m_accessLock);
#endif
std::string &name = m_nameCache[RHS[0]->GetId()][LHS[0]->GetId()];
const std::vector<FactorType> & oFactors
= StaticData::Instance().options().output.factor_order;
const std::vector<FactorType> & oFactors
= StaticData::Instance().options().output.factor_order;
std::string LHS_string = LHS.GetString(oFactors, false);
std::string RHS_string = RHS.GetString(oFactors, false);
name = LHS_string + "->" + RHS_string;

View File

@ -342,11 +342,11 @@ OutputAlignment(std::ostream &out, bool recursive=true) const
// call with head recursion to output things in the right order
size_t trg_off = recursive && m_prevHypo ? m_prevHypo->OutputAlignment(out) : 0;
size_t src_off = GetCurrSourceWordsRange().GetStartPos();
typedef std::pair<size_t,size_t> const* entry;
std::vector<entry> alnvec = tp.GetAlignTerm().GetSortedAlignments(waso);
BOOST_FOREACH(entry e, alnvec)
out << e->first + src_off << "-" << e->second + trg_off << " ";
out << e->first + src_off << "-" << e->second + trg_off << " ";
return trg_off + tp.GetSize();
}

View File

@ -88,7 +88,7 @@ IOWrapper::IOWrapper()
m_currentLine = staticData.GetStartTranslationId();
m_inputFactorOrder = &staticData.options().input.factor_order;
size_t nBestSize = staticData.options().nbest.nbest_size;
string nBestFilePath = staticData.options().nbest.output_file_path;

View File

@ -329,7 +329,7 @@ OutputNBestList(OutputCollector *collector,
{
const StaticData &staticData = StaticData::Instance();
const std::vector<Moses::FactorType> &outputFactorOrder
= options().output.factor_order;
= options().output.factor_order;
std::ostringstream out;
// wtf? copied from the original OutputNBestList

View File

@ -561,7 +561,7 @@ void Manager::OutputWordGraph(std::ostream &outputWordGraphStream, const Hypothe
}
// output both source and target phrases in the word graph
outputWordGraphStream << "\tw=" << hypo->GetSourcePhraseStringRep()
outputWordGraphStream << "\tw=" << hypo->GetSourcePhraseStringRep()
<< "|" << hypo->GetCurrTargetPhrase();
outputWordGraphStream << endl;
@ -821,9 +821,9 @@ size_t Manager::OutputFeatureWeightsForSLF(size_t index, const FeatureFunction*
}
}
size_t
size_t
Manager::
OutputFeatureValuesForSLF(size_t index, bool zeros, const Hypothesis* hypo,
OutputFeatureValuesForSLF(size_t index, bool zeros, const Hypothesis* hypo,
const FeatureFunction* ff, std::ostream &out) const
{
const ScoreComponentCollection& scoreCollection = hypo->GetScoreBreakdown();
@ -836,7 +836,7 @@ OutputFeatureValuesForSLF(size_t index, bool zeros, const Hypothesis* hypo,
}
/**! Output search graph in hypergraph format of Kenneth Heafield's lazy hypergraph decoder */
void
void
Manager::
OutputSearchGraphAsHypergraph(std::ostream &outputSearchGraphStream) const
{
@ -1112,7 +1112,7 @@ OutputSearchNode(AllOptions const& opts, long translationId,
<< " back=" << prevHypo->GetId()
<< " score=" << searchNode.hypo->GetScore()
<< " transition=" << (searchNode.hypo->GetScore() - prevHypo->GetScore());
if (searchNode.recombinationHypo != NULL)
out << " recombined=" << searchNode.recombinationHypo->GetId();
@ -1132,7 +1132,7 @@ OutputSearchNode(AllOptions const& opts, long translationId,
if (searchNode.recombinationHypo != NULL)
out << " recombined=" << searchNode.recombinationHypo->GetId();
out << " forward=" << searchNode.forward << " fscore=" << searchNode.fscore
<< " covered=" << searchNode.hypo->GetCurrSourceWordsRange().GetStartPos()
<< "-" << searchNode.hypo->GetCurrSourceWordsRange().GetEndPos();
@ -1141,7 +1141,7 @@ OutputSearchNode(AllOptions const& opts, long translationId,
ScoreComponentCollection scoreBreakdown = searchNode.hypo->GetScoreBreakdown();
scoreBreakdown.MinusEquals( prevHypo->GetScoreBreakdown() );
out << " scores=\"" << scoreBreakdown << "\""
<< " out=\"" << searchNode.hypo->GetSourcePhraseStringRep()
<< " out=\"" << searchNode.hypo->GetSourcePhraseStringRep()
<< "|" << searchNode.hypo->GetCurrTargetPhrase().GetStringRep(outputFactorOrder) << "\"" << endl;
}
@ -1153,8 +1153,8 @@ void Manager::GetConnectedGraph(
std::vector< const Hypothesis *>& connectedList = *pConnectedList;
// start with the ones in the final stack
const std::vector < HypothesisStack* > &hypoStackColl
= m_search->GetHypothesisStacks();
const std::vector < HypothesisStack* > &hypoStackColl
= m_search->GetHypothesisStacks();
const HypothesisStack &finalStack = *hypoStackColl.back();
HypothesisStack::const_iterator iterHypo;
for (iterHypo = finalStack.begin() ; iterHypo != finalStack.end() ; ++iterHypo) {
@ -1620,7 +1620,7 @@ OutputNBest(std::ostream& out, Moses::TrellisPathList const& nBestList) const
out << m_source.GetTranslationId() << " ||| ";
for (int currEdge = (int)edges.size() - 1 ; currEdge >= 0 ; currEdge--) {
const Hypothesis &edge = *edges[currEdge];
OutputSurface(out, edge);
OutputSurface(out, edge);
}
out << " |||";
@ -1853,11 +1853,11 @@ void Manager::OutputAlignment(OutputCollector *collector) const
}
out << std::endl; // Used by --alignment-output-file so requires endl
collector->Write(m_source.GetTranslationId(), out.str());
}
}
void
void
Manager::
OutputDetailedTranslationReport(OutputCollector *collector) const
{
@ -1870,7 +1870,7 @@ OutputDetailedTranslationReport(OutputCollector *collector) const
}
void
void
Manager::
OutputUnknowns(OutputCollector *collector) const
{
@ -1887,7 +1887,7 @@ OutputUnknowns(OutputCollector *collector) const
}
void
void
Manager::
OutputWordGraph(OutputCollector *collector) const
{
@ -1900,7 +1900,7 @@ OutputWordGraph(OutputCollector *collector) const
}
}
void
void
Manager::
OutputSearchGraph(OutputCollector *collector) const
{
@ -1976,7 +1976,7 @@ void Manager::OutputLatticeMBRNBest(std::ostream& out, const vector<LatticeMBRSo
}
}
void
void
Manager::
OutputBestHypo(const std::vector<Word>& mbrBestHypo, ostream& out) const
{
@ -2008,7 +2008,7 @@ OutputAlignment(std::ostringstream &out, const TrellisPath &path) const
{
WordAlignmentSort waso = options().output.WA_SortOrder;
BOOST_REVERSE_FOREACH(Hypothesis const* e, path.GetEdges())
e->OutputAlignment(out, false);
e->OutputAlignment(out, false);
// Hypothesis::OutputAlignment(out, path.GetEdges(), waso);
// Used by --alignment-output-file so requires endl
out << std::endl;

View File

@ -133,16 +133,16 @@ protected:
mutable std::ostringstream m_alignmentOut;
public:
void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList) const;
void OutputSurface(std::ostream &out,
Hypothesis const& edge,
bool const recursive=false) const;
void OutputSurface(std::ostream &out,
Hypothesis const& edge,
bool const recursive=false) const;
void OutputAlignment(std::ostream &out, const AlignmentInfo &ai, size_t sourceOffset, size_t targetOffset) const;
void OutputInput(std::ostream& os, const Hypothesis* hypo) const;
void OutputInput(std::vector<const Phrase*>& map, const Hypothesis* hypo) const;
void OutputPassthroughInformation(std::ostream& os, const Hypothesis* hypo) const;
std::map<size_t, const Factor*>
std::map<size_t, const Factor*>
GetPlaceholders(const Hypothesis &hypo, FactorType placeholderFactor) const;
void OutputWordGraph(std::ostream &outputWordGraphStream, const Hypothesis *hypo, size_t &linkId) const;
@ -192,11 +192,11 @@ public:
/***
*For Lattice MBR
*/
void
void
GetForwardBackwardSearchGraph
( std::map< int, bool >* pConnected,
std::vector< const Hypothesis* >* pConnectedList,
std::map < const Hypothesis*, std::set < const Hypothesis* > >* pOutgoingHyps,
std::vector< const Hypothesis* >* pConnectedList,
std::map < const Hypothesis*, std::set < const Hypothesis* > >* pOutgoingHyps,
std::vector< float>* pFwdBwdScores) const;
// outputs

View File

@ -65,7 +65,7 @@ public:
}
PartialTranslOptColl(size_t const maxSize);
/** destructor, cleans out list */
~PartialTranslOptColl() {
RemoveAllInColl( m_list );

View File

@ -271,9 +271,9 @@ CreateTranslationOptionCollection(ttasksptr const& ttask) const
float transOptThreshold = ttask->options().search.trans_opt_threshold;
// StaticData::Instance().GetTranslationOptionThreshold();
TranslationOptionCollection *rv
= new TranslationOptionCollectionText(ttask, *this,
maxNoTransOptPerCoverage,
transOptThreshold);
= new TranslationOptionCollectionText(ttask, *this,
maxNoTransOptPerCoverage,
transOptThreshold);
assert(rv);
return rv;
}

View File

@ -63,7 +63,7 @@ StaticData StaticData::s_instance;
StaticData::StaticData()
: m_sourceStartPosMattersForRecombination(false)
, m_requireSortingAfterSourceContext(false)
// , m_isAlwaysCreateDirectTranslationOption(false)
// , m_isAlwaysCreateDirectTranslationOption(false)
, m_currentWeightSetting("default")
, m_treeStructure(NULL)
{

View File

@ -229,63 +229,63 @@ public:
return m_options;
}
inline bool
inline bool
GetSourceStartPosMattersForRecombination() const {
return m_sourceStartPosMattersForRecombination;
}
bool
bool
IsWordDeletionEnabled() const {
// return m_wordDeletionEnabled;
return m_options.unk.word_deletion_enabled;
}
int
int
GetMaxDistortion() const {
return m_options.reordering.max_distortion;
}
bool
bool
UseReorderingConstraint() const {
return m_reorderingConstraint;
}
bool
bool
UseEarlyDiscarding() const {
return m_options.search.early_discarding_threshold
!= -std::numeric_limits<float>::infinity();
!= -std::numeric_limits<float>::infinity();
}
bool
bool
UseEarlyDistortionCost() const {
return m_options.reordering.use_early_distortion_cost;
}
float
float
GetTranslationOptionThreshold() const {
return m_options.search.trans_opt_threshold;
}
size_t
size_t
GetVerboseLevel() const {
return m_verboseLevel;
}
void
void
SetVerboseLevel(int x) const {
m_verboseLevel = x;
}
bool
bool
UseMinphrInMemory() const {
return m_minphrMemory;
}
bool
bool
UseMinlexrInMemory() const {
return m_minlexrMemory;
}
bool IsSyntax(SearchAlgorithm algo = DefaultSearchAlgorithm) const {
if (algo == DefaultSearchAlgorithm)
algo = m_options.search.algo;

View File

@ -40,7 +40,7 @@ namespace F2S
{
bool HyperTreeLoader::Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &ff,

View File

@ -24,7 +24,7 @@ class HyperTreeLoader : public HyperTreeCreator
{
public:
bool Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &,

View File

@ -74,9 +74,9 @@ void Manager<RuleMatcher>::Decode()
RuleMatcherCallback callback(m_stackMap, ruleLimit);
// Create a glue rule synthesizer.
GlueRuleSynthesizer glueRuleSynthesizer(*m_glueRuleTrie,
options().input.factor_order);
GlueRuleSynthesizer glueRuleSynthesizer(*m_glueRuleTrie,
options().input.factor_order);
// Sort the input forest's vertices into bottom-up topological order.
std::vector<const Forest::Vertex *> sortedVertices;
TopologicalSorter sorter;

View File

@ -37,7 +37,7 @@ namespace S2T
{
bool RuleTrieLoader::Load(Moses::AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &ff,

View File

@ -22,7 +22,7 @@ class RuleTrieLoader : public RuleTrieCreator
{
public:
bool Load(Moses::AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &,

View File

@ -36,7 +36,7 @@ namespace T2S
{
bool RuleTrieLoader::Load(Moses::AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &ff,

View File

@ -21,7 +21,7 @@ class RuleTrieLoader : public RuleTrieCreator
{
public:
bool Load(Moses::AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
const RuleTableFF &,

View File

@ -336,8 +336,8 @@ void PhraseDictionaryDynamicCacheBased::ClearEntries(std::string sourcePhraseStr
//target
targetPhrase.Clear();
VERBOSE(3, "targetPhraseString:|" << targetPhraseString << "|" << std::endl);
targetPhrase.CreateFromString(Output, staticData.options().output.factor_order,
targetPhraseString, /*factorDelimiter,*/ NULL);
targetPhrase.CreateFromString(Output, staticData.options().output.factor_order,
targetPhraseString, /*factorDelimiter,*/ NULL);
VERBOSE(2, "targetPhrase:|" << targetPhrase << "|" << std::endl);
//TODO: Would be better to reuse source phrases, but ownership has to be
@ -345,7 +345,7 @@ void PhraseDictionaryDynamicCacheBased::ClearEntries(std::string sourcePhraseStr
sourcePhrase.Clear();
VERBOSE(3, "sourcePhraseString:|" << sourcePhraseString << "|" << std::endl);
sourcePhrase.CreateFromString(Input, staticData.options().input.factor_order,
sourcePhraseString, /*factorDelimiter,*/ NULL);
sourcePhraseString, /*factorDelimiter,*/ NULL);
VERBOSE(3, "sourcePhrase:|" << sourcePhrase << "|" << std::endl);
ClearEntries(sourcePhrase, targetPhrase);
@ -435,8 +435,8 @@ void PhraseDictionaryDynamicCacheBased::ClearSource(std::vector<std::string> ent
sourcePhrase.Clear();
VERBOSE(3, "sourcePhraseString:|" << (*it) << "|" << std::endl);
sourcePhrase.CreateFromString(Input, staticData.options().input.factor_order,
*it, /*factorDelimiter,*/ NULL);
sourcePhrase.CreateFromString(Input, staticData.options().input.factor_order,
*it, /*factorDelimiter,*/ NULL);
VERBOSE(3, "sourcePhrase:|" << sourcePhrase << "|" << std::endl);
ClearSource(sourcePhrase);
@ -529,10 +529,10 @@ void PhraseDictionaryDynamicCacheBased::Update(std::string sourcePhraseString, s
//target
targetPhrase.Clear();
VERBOSE(3, "targetPhraseString:|" << targetPhraseString << "|" << std::endl);
targetPhrase.CreateFromString(Output, staticData.options().output.factor_order,
targetPhraseString, /*factorDelimiter,*/ NULL);
targetPhrase.CreateFromString(Output, staticData.options().output.factor_order,
targetPhraseString, /*factorDelimiter,*/ NULL);
VERBOSE(3, "targetPhrase:|" << targetPhrase << "|" << std::endl);
//TODO: Would be better to reuse source phrases, but ownership has to be
//consistent across phrase table implementations
sourcePhrase.Clear();

View File

@ -37,7 +37,7 @@ public:
virtual ~RuleTableLoader() {}
virtual bool Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t tableLimit,

View File

@ -32,8 +32,8 @@
namespace Moses
{
bool RuleTableLoaderCompact::Load(AllOptions const& opts,
const std::vector<FactorType> &input,
bool RuleTableLoaderCompact::Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t /* tableLimit */,

View File

@ -37,7 +37,7 @@ class RuleTableLoaderCompact : public RuleTableLoader
{
public:
bool Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t tableLimit,

View File

@ -35,7 +35,7 @@ namespace Moses
// Determines the rule table type by peeking inside the file then creates
// a suitable RuleTableLoader object.
std::auto_ptr<RuleTableLoader>
std::auto_ptr<RuleTableLoader>
RuleTableLoaderFactory::
Create(const std::string &path)
{

View File

@ -15,7 +15,7 @@ namespace Moses
{
bool RuleTableLoaderHiero::Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t tableLimit,

View File

@ -19,7 +19,7 @@ class RuleTableLoaderHiero : public RuleTableLoaderStandard
{
public:
bool Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t tableLimit,

View File

@ -47,8 +47,8 @@ using namespace boost::algorithm;
namespace Moses
{
bool
bool
RuleTableLoaderStandard::
Load(AllOptions const& opts
, const std::vector<FactorType> &input

View File

@ -30,7 +30,7 @@ class RuleTableLoaderStandard : public RuleTableLoader
protected:
bool Load(AllOptions const& opts,
FormatType format,
FormatType format,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
@ -38,7 +38,7 @@ protected:
RuleTableTrie &);
public:
bool Load(AllOptions const& opts,
const std::vector<FactorType> &input,
const std::vector<FactorType> &input,
const std::vector<FactorType> &output,
const std::string &inFile,
size_t tableLimit,

View File

@ -50,8 +50,8 @@ void PhraseDictionaryALSuffixArray::InitializeForInput(ttasksptr const& ttask)
AllOptions const& opts = ttask->options();
bool ret = loader->Load(opts, m_input, m_output, grammarFile, m_tableLimit, *this);
UTIL_THROW_IF2(!ret, "Rules not successfully loaded for sentence id "
<< translationId);
UTIL_THROW_IF2(!ret, "Rules not successfully loaded for sentence id "
<< translationId);
}
void PhraseDictionaryALSuffixArray::CleanUpAfterSentenceProcessing(const InputType &source)

View File

@ -218,13 +218,13 @@ CreateTranslationOptionsForRangeNew
bool
TranslationOptionCollectionConfusionNet::
CreateTranslationOptionsForRangeLEGACY(const DecodeGraph &decodeGraph,
size_t startPos, size_t endPos,
CreateTranslationOptionsForRangeLEGACY(const DecodeGraph &decodeGraph,
size_t startPos, size_t endPos,
bool adhereTableLimit, size_t graphInd)
{
bool retval = true;
size_t const max_phrase_length
= StaticData::Instance().options().search.max_phrase_length;
size_t const max_phrase_length
= StaticData::Instance().options().search.max_phrase_length;
XmlInputType intype = m_ttask.lock()->options().input.xml_policy;
if ((intype != XmlExclusive) || !HasXmlOptionsOverlappingRange(startPos,endPos)) {
InputPathList &inputPathList = GetInputPathList(startPos, endPos);

View File

@ -70,14 +70,14 @@ TranslationOptionCollectionLattice
// recursive
Extend(*path, input, ttask->options().search.max_phrase_length);
}
}
}
void
void
TranslationOptionCollectionLattice::
Extend(const InputPath &prevPath, const WordLattice &input,
Extend(const InputPath &prevPath, const WordLattice &input,
size_t const maxPhraseLength)
{
size_t nextPos = prevPath.GetWordsRange().GetEndPos() + 1;

View File

@ -33,7 +33,7 @@ public:
protected:
void Extend(const InputPath &prevPath, const WordLattice &input,
size_t const maxPhraseLength);
size_t const maxPhraseLength);
};

View File

@ -169,15 +169,15 @@ TrellisPath::
GetScoreBreakdown() const
{
if (!m_scoreBreakdown) {
float totalScore = m_path[0]->GetWinningHypo()->GetFutureScore();
float totalScore = m_path[0]->GetWinningHypo()->GetFutureScore();
// calculated for sanity check only
m_scoreBreakdown.reset(new ScoreComponentCollection());
m_scoreBreakdown->PlusEquals(m_path[0]->GetWinningHypo()->GetScoreBreakdown());
// adjust score
// I assume things are done this way on the assumption that most hypothesis edges
// are shared with the winning path, so that score adjustments are cheaper than
// are shared with the winning path, so that score adjustments are cheaper than
// recomputing the score from scratch. UG
size_t sizePath = m_path.size();
for (size_t pos = 0 ; pos < sizePath ; pos++) {

View File

@ -163,8 +163,8 @@ Read(std::istream& in,
}
PCN::CN cn = PCN::parsePCN(line);
return InitializeFromPCNDataType(cn, opts.search.max_phrase_length,
factorOrder, line);
return InitializeFromPCNDataType(cn, opts.search.max_phrase_length,
factorOrder, line);
}
void WordLattice::GetAsEdgeMatrix(std::vector<std::vector<bool> >& edges) const
@ -231,10 +231,10 @@ WordLattice
// size_t maxNoTransOptPerCoverage = StaticData::Instance().GetMaxNoTransOptPerCoverage();
// float translationOptionThreshold = StaticData::Instance().GetTranslationOptionThreshold();
size_t maxNoTransOptPerCoverage = ttask->options().search.max_trans_opt_per_cov;
size_t maxNoTransOptPerCoverage = ttask->options().search.max_trans_opt_per_cov;
// StaticData::Instance().GetMaxNoTransOptPerCoverage();
float translationOptionThreshold = ttask->options().search.trans_opt_threshold;
// StaticData::Instance().GetTranslationOptionThreshold();
// StaticData::Instance().GetTranslationOptionThreshold();
TranslationOptionCollection *rv = NULL;

View File

@ -40,9 +40,9 @@ public:
/** Given a lattice represented using the PCN::CN data type (topologically sorted agency list
* representation), initialize the WordLattice object
*/
int InitializeFromPCNDataType(const PCN::CN& cn, size_t const maxPhraseLength,
const std::vector<FactorType>& factorOrder,
const std::string& debug_line = "");
int InitializeFromPCNDataType(const PCN::CN& cn, size_t const maxPhraseLength,
const std::vector<FactorType>& factorOrder,
const std::string& debug_line = "");
/** Read from PLF format (1 lattice per line)
*/
int Read(std::istream& in,

View File

@ -119,7 +119,7 @@ const TrellisPath doMBR(const TrellisPathList& nBestList, AllOptions const& opts
// get words in translation
vector<const Factor*> translation;
GetOutputFactors(path, oFactors[0], translation);
// collect n-gram counts
map < vector < const Factor *>, int > counts;
extract_ngrams(translation,counts);
@ -158,9 +158,9 @@ const TrellisPath doMBR(const TrellisPathList& nBestList, AllOptions const& opts
//return translations[minMBRLossIdx];
}
void
void
GetOutputFactors(const TrellisPath &path, FactorType const oFactor,
vector <const Factor*> &translation)
vector <const Factor*> &translation)
{
const std::vector<const Hypothesis *> &edges = path.GetEdges();

View File

@ -26,14 +26,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Moses::TrellisPath const
doMBR(Moses::TrellisPathList const& nBestList, Moses::AllOptions const& opts);
void
GetOutputFactors(const Moses::TrellisPath &path, Moses::FactorType const f,
std::vector <const Moses::Factor*> &translation);
void
GetOutputFactors(const Moses::TrellisPath &path, Moses::FactorType const f,
std::vector <const Moses::Factor*> &translation);
float
calculate_score(const std::vector< std::vector<const Moses::Factor*> > & sents,
int ref, int hyp,
std::vector<std::map<std::vector<const Moses::Factor*>,int> > &
ngram_stats );
float
calculate_score(const std::vector< std::vector<const Moses::Factor*> > & sents,
int ref, int hyp,
std::vector<std::map<std::vector<const Moses::Factor*>,int> > &
ngram_stats );
#endif