mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
daily automatic beautifier
This commit is contained in:
parent
d21f62b8a8
commit
b0d8c397bb
@ -299,8 +299,8 @@ OutputSearchGraphAsHypergraph(std::ostream& out) const
|
||||
|
||||
void ChartManager::OutputSearchGraphMoses(std::ostream &outputSearchGraphStream) const
|
||||
{
|
||||
ChartSearchGraphWriterMoses writer(options(), &outputSearchGraphStream,
|
||||
m_source.GetTranslationId());
|
||||
ChartSearchGraphWriterMoses writer(options(), &outputSearchGraphStream,
|
||||
m_source.GetTranslationId());
|
||||
WriteSearchGraph(writer);
|
||||
}
|
||||
|
||||
|
@ -158,8 +158,8 @@ void ChartTranslationOptionList::ApplyThreshold(float const threshold)
|
||||
scoreThreshold += threshold; // StaticData::Instance().GetTranslationOptionThreshold();
|
||||
|
||||
CollType::iterator bound = std::partition(m_collection.begin(),
|
||||
m_collection.begin()+m_size,
|
||||
ScoreThresholdPred(scoreThreshold));
|
||||
m_collection.begin()+m_size,
|
||||
ScoreThresholdPred(scoreThreshold));
|
||||
|
||||
m_size = std::distance(m_collection.begin(), bound);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ CreateTranslationOptionCollection(ttasksptr const& ttask) const
|
||||
// float translationOptionThreshold
|
||||
// = ttask->options()->search.trans_opt_threshold;
|
||||
TranslationOptionCollection *rv
|
||||
= new TranslationOptionCollectionConfusionNet(ttask, *this);
|
||||
= new TranslationOptionCollectionConfusionNet(ttask, *this);
|
||||
//, maxNoTransOptPerCoverage, translationOptionThreshold);
|
||||
assert(rv);
|
||||
return rv;
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
return m_avg_input_length;
|
||||
}
|
||||
|
||||
void Load(AllOptions::ptr const& opts);
|
||||
void Load(AllOptions::ptr const& opts);
|
||||
|
||||
private:
|
||||
static std::vector<BleuScoreFeature*> s_staticColl;
|
||||
|
@ -56,7 +56,7 @@ void ConstrainedDecoding::Load(AllOptions::ptr const& opts)
|
||||
for(size_t i = 0; i < m_paths.size(); ++i) {
|
||||
InputFileStream constraintFile(m_paths[i]);
|
||||
std::string line;
|
||||
long sentenceID = opts->output.start_translation_id - 1 ;
|
||||
long sentenceID = opts->output.start_translation_id - 1 ;
|
||||
while (getline(constraintFile, line)) {
|
||||
vector<string> vecStr = Tokenize(line, "\t");
|
||||
|
||||
|
@ -49,16 +49,16 @@ const FFState* DistortionScoreProducer::EmptyHypothesisState(const InputType &in
|
||||
NOT_FOUND);
|
||||
}
|
||||
|
||||
float
|
||||
float
|
||||
DistortionScoreProducer::
|
||||
CalculateDistortionScore(const Hypothesis& hypo,
|
||||
const Range &prev, const Range &curr, const int FirstGap)
|
||||
const Range &prev, const Range &curr, const int FirstGap)
|
||||
{
|
||||
// if(!StaticData::Instance().UseEarlyDistortionCost()) {
|
||||
if(!hypo.GetManager().options()->reordering.use_early_distortion_cost) {
|
||||
return - (float) hypo.GetInput().ComputeDistortionDistance(prev, curr);
|
||||
} // else {
|
||||
|
||||
|
||||
/* Pay distortion score as soon as possible, from Moore and Quirk MT Summit 2007
|
||||
Definitions:
|
||||
S : current source range
|
||||
|
@ -73,8 +73,8 @@ public:
|
||||
class ChartSearchGraphWriterMoses : public virtual ChartSearchGraphWriter
|
||||
{
|
||||
public:
|
||||
ChartSearchGraphWriterMoses(AllOptions::ptr const& opts,
|
||||
std::ostream* out, size_t lineNumber)
|
||||
ChartSearchGraphWriterMoses(AllOptions::ptr const& opts,
|
||||
std::ostream* out, size_t lineNumber)
|
||||
: ChartSearchGraphWriter(opts), m_out(out), m_lineNumber(lineNumber) {}
|
||||
virtual void WriteHeader(size_t, size_t) const {
|
||||
/* do nothing */
|
||||
@ -91,7 +91,7 @@ private:
|
||||
class ChartSearchGraphWriterHypergraph : public virtual ChartSearchGraphWriter
|
||||
{
|
||||
public:
|
||||
ChartSearchGraphWriterHypergraph(AllOptions::ptr const& opts, std::ostream* out)
|
||||
ChartSearchGraphWriterHypergraph(AllOptions::ptr const& opts, std::ostream* out)
|
||||
: ChartSearchGraphWriter(opts), m_out(out), m_nodeId(0) { }
|
||||
virtual void WriteHeader(size_t winners, size_t losers) const;
|
||||
virtual void WriteHypos(const ChartHypothesisCollection& hypos,
|
||||
|
@ -257,7 +257,7 @@ Sentence::
|
||||
CreateTranslationOptionCollection(ttasksptr const& ttask) const
|
||||
{
|
||||
TranslationOptionCollection *rv
|
||||
= new TranslationOptionCollectionText(ttask, *this);
|
||||
= new TranslationOptionCollectionText(ttask, *this);
|
||||
assert(rv);
|
||||
return rv;
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ LoadDecodeGraphsOld(const vector<string> &mappingVector,
|
||||
UTIL_THROW_IF2(decodeStep == NULL, "Null decode step");
|
||||
if (m_decodeGraphs.size() < decodeGraphInd + 1) {
|
||||
DecodeGraph *decodeGraph;
|
||||
if (is_syntax(m_options->search.algo)) {
|
||||
if (is_syntax(m_options->search.algo)) {
|
||||
size_t maxChartSpan = (decodeGraphInd < maxChartSpans.size()) ? maxChartSpans[decodeGraphInd] : DEFAULT_MAX_CHART_SPAN;
|
||||
VERBOSE(1,"max-chart-span: " << maxChartSpans[decodeGraphInd] << endl);
|
||||
decodeGraph = new DecodeGraph(m_decodeGraphs.size(), maxChartSpan);
|
||||
@ -508,7 +508,7 @@ void StaticData::LoadDecodeGraphsNew(const std::vector<std::string> &mappingVect
|
||||
UTIL_THROW_IF2(decodeStep == NULL, "Null decode step");
|
||||
if (m_decodeGraphs.size() < decodeGraphInd + 1) {
|
||||
DecodeGraph *decodeGraph;
|
||||
if (is_syntax(m_options->search.algo)) {
|
||||
if (is_syntax(m_options->search.algo)) {
|
||||
size_t maxChartSpan = (decodeGraphInd < maxChartSpans.size()) ? maxChartSpans[decodeGraphInd] : DEFAULT_MAX_CHART_SPAN;
|
||||
VERBOSE(1,"max-chart-span: " << maxChartSpans[decodeGraphInd] << endl);
|
||||
decodeGraph = new DecodeGraph(m_decodeGraphs.size(), maxChartSpan);
|
||||
|
@ -84,9 +84,9 @@ public:
|
||||
void
|
||||
Load(std::string filePath);
|
||||
|
||||
static void
|
||||
static void
|
||||
SetStaticDefaultParameters(Parameter const& param);
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ void PhraseDictionaryCompact::Load(AllOptions::ptr const& opts)
|
||||
if (!FileExists(tFilePath))
|
||||
throw runtime_error("Error: File " + tFilePath + " does not exist.");
|
||||
|
||||
m_phraseDecoder
|
||||
= new PhraseDecoder(*this, &m_input, &m_output, m_numScoreComponents);
|
||||
m_phraseDecoder
|
||||
= new PhraseDecoder(*this, &m_input, &m_output, m_numScoreComponents);
|
||||
|
||||
std::FILE* pFile = std::fopen(tFilePath.c_str() , "r");
|
||||
|
||||
@ -155,7 +155,7 @@ PhraseDictionaryCompact::
|
||||
delete m_phraseDecoder;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
PhraseDictionaryCompact::
|
||||
CacheForCleanup(TargetPhraseCollection::shared_ptr tpc)
|
||||
{
|
||||
@ -164,12 +164,12 @@ CacheForCleanup(TargetPhraseCollection::shared_ptr tpc)
|
||||
m_sentenceCache->push_back(tpc);
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
PhraseDictionaryCompact::
|
||||
AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)
|
||||
AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase)
|
||||
{ }
|
||||
|
||||
void
|
||||
void
|
||||
PhraseDictionaryCompact::
|
||||
CleanUpAfterSentenceProcessing(const InputType &source)
|
||||
{
|
||||
|
@ -20,11 +20,11 @@ namespace Moses
|
||||
|
||||
/** constructor; just initialize the base class */
|
||||
TranslationOptionCollectionConfusionNet::
|
||||
TranslationOptionCollectionConfusionNet(ttasksptr const& ttask,
|
||||
TranslationOptionCollectionConfusionNet(ttasksptr const& ttask,
|
||||
const ConfusionNet &input)
|
||||
// , size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
// , size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
: TranslationOptionCollection(ttask,input)//
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
{
|
||||
size_t maxNoTransOptPerCoverage = ttask->options()->search.max_trans_opt_per_cov;
|
||||
float translationOptionThreshold = ttask->options()->search.trans_opt_threshold;
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
|
||||
public:
|
||||
TranslationOptionCollectionConfusionNet
|
||||
(ttasksptr const& ttask, const ConfusionNet &source);
|
||||
(ttasksptr const& ttask, const ConfusionNet &source);
|
||||
// , size_t maxNoTransOptPerCoverage, float translationOptionThreshold);
|
||||
|
||||
void ProcessUnknownWord(size_t sourcePos);
|
||||
|
@ -22,9 +22,9 @@ namespace Moses
|
||||
TranslationOptionCollectionLattice
|
||||
::TranslationOptionCollectionLattice
|
||||
( ttasksptr const& ttask, const WordLattice &input)
|
||||
// , size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
// , size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
: TranslationOptionCollection(ttask, input)//
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
{
|
||||
UTIL_THROW_IF2(StaticData::Instance().GetUseLegacyPT(),
|
||||
"Not for models using the legqacy binary phrase table");
|
||||
|
@ -35,14 +35,14 @@ namespace Moses
|
||||
/** constructor; just initialize the base class */
|
||||
TranslationOptionCollectionText::
|
||||
TranslationOptionCollectionText(ttasksptr const& ttask, Sentence const &input)
|
||||
//, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
//, size_t maxNoTransOptPerCoverage, float translationOptionThreshold)
|
||||
: TranslationOptionCollection(ttask,input)
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
// , maxNoTransOptPerCoverage, translationOptionThreshold)
|
||||
{
|
||||
size_t maxNoTransOptPerCoverage
|
||||
= ttask->options()->search.max_trans_opt_per_cov;
|
||||
= ttask->options()->search.max_trans_opt_per_cov;
|
||||
float translationOptionThreshold
|
||||
= ttask->options()->search.trans_opt_threshold;
|
||||
= ttask->options()->search.trans_opt_threshold;
|
||||
size_t size = input.GetSize();
|
||||
m_inputPathMatrix.resize(size);
|
||||
for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user