mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
daily automatic beautifier
This commit is contained in:
parent
8b2f1ba529
commit
dfcdb43c28
@ -237,8 +237,8 @@ void ChartParser::CreateInputPaths(const InputType &input)
|
|||||||
m_inputPathMatrix.resize(size);
|
m_inputPathMatrix.resize(size);
|
||||||
|
|
||||||
UTIL_THROW_IF2(input.GetType() != SentenceInput && input.GetType() != TreeInputType,
|
UTIL_THROW_IF2(input.GetType() != SentenceInput && input.GetType() != TreeInputType,
|
||||||
"Input must be a sentence or a tree, " <<
|
"Input must be a sentence or a tree, " <<
|
||||||
"not lattice or confusion networks");
|
"not lattice or confusion networks");
|
||||||
|
|
||||||
TranslationTask const* ttask = m_ttask.lock().get();
|
TranslationTask const* ttask = m_ttask.lock().get();
|
||||||
for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) {
|
for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) {
|
||||||
|
@ -55,8 +55,8 @@ void GlobalLexicalModel::Load(AllOptions::ptr const& opts)
|
|||||||
{
|
{
|
||||||
m_options = opts;
|
m_options = opts;
|
||||||
FactorCollection &factorCollection = FactorCollection::Instance();
|
FactorCollection &factorCollection = FactorCollection::Instance();
|
||||||
const std::string& oFactorDelimiter = opts->output.factor_delimiter;
|
const std::string& oFactorDelimiter = opts->output.factor_delimiter;
|
||||||
const std::string& iFactorDelimiter = opts->input.factor_delimiter;
|
const std::string& iFactorDelimiter = opts->input.factor_delimiter;
|
||||||
|
|
||||||
|
|
||||||
VERBOSE(2, "Loading global lexical model from file " << m_filePath << endl);
|
VERBOSE(2, "Loading global lexical model from file " << m_filePath << endl);
|
||||||
@ -82,8 +82,8 @@ void GlobalLexicalModel::Load(AllOptions::ptr const& opts)
|
|||||||
for (size_t i=0 ; i < m_outputFactorsVec.size() ; i++) {
|
for (size_t i=0 ; i < m_outputFactorsVec.size() ; i++) {
|
||||||
const FactorDirection& direction = Output;
|
const FactorDirection& direction = Output;
|
||||||
const FactorType& factorType = m_outputFactorsVec[i];
|
const FactorType& factorType = m_outputFactorsVec[i];
|
||||||
const Factor* factor
|
const Factor* factor
|
||||||
= factorCollection.AddFactor( direction, factorType, factorString[i] );
|
= factorCollection.AddFactor( direction, factorType, factorString[i] );
|
||||||
outWord->SetFactor( factorType, factor );
|
outWord->SetFactor( factorType, factor );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ void GlobalLexicalModel::Load(AllOptions::ptr const& opts)
|
|||||||
for (size_t i=0 ; i < m_inputFactorsVec.size() ; i++) {
|
for (size_t i=0 ; i < m_inputFactorsVec.size() ; i++) {
|
||||||
const FactorDirection& direction = Input;
|
const FactorDirection& direction = Input;
|
||||||
const FactorType& factorType = m_inputFactorsVec[i];
|
const FactorType& factorType = m_inputFactorsVec[i];
|
||||||
const Factor* factor
|
const Factor* factor
|
||||||
= factorCollection.AddFactor( direction, factorType, factorString[i] );
|
= factorCollection.AddFactor( direction, factorType, factorString[i] );
|
||||||
inWord->SetFactor( factorType, factor );
|
inWord->SetFactor( factorType, factor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// ttaskwptr const ttask;
|
// ttaskwptr const ttask;
|
||||||
TranslationTask const* ttask;
|
TranslationTask const* ttask;
|
||||||
protected:
|
protected:
|
||||||
const InputPath *m_prevPath;
|
const InputPath *m_prevPath;
|
||||||
Phrase m_phrase;
|
Phrase m_phrase;
|
||||||
|
@ -135,8 +135,8 @@ PDTAimp::GetTargetPhraseCollection(Phrase const &src) const
|
|||||||
targetPhrase.GetScoreBreakdown().Assign(m_obj, *cands[i].fnames[j], cands[i].fvalues[j]);
|
targetPhrase.GetScoreBreakdown().Assign(m_obj, *cands[i].fnames[j], cands[i].fvalues[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateTargetPhrase(targetPhrase,factorStrings, fd, scoreVector, Scores(0),
|
CreateTargetPhrase(targetPhrase,factorStrings, fd, scoreVector, Scores(0),
|
||||||
&wacands[i], &src);
|
&wacands[i], &src);
|
||||||
|
|
||||||
costs.push_back(std::make_pair(-targetPhrase.GetFutureScore(),tCands.size()));
|
costs.push_back(std::make_pair(-targetPhrase.GetFutureScore(),tCands.size()));
|
||||||
tCands.push_back(targetPhrase);
|
tCands.push_back(targetPhrase);
|
||||||
@ -377,7 +377,7 @@ void PDTAimp::CacheSource(ConfusionNet const& src)
|
|||||||
TargetPhrase targetPhrase(m_obj);
|
TargetPhrase targetPhrase(m_obj);
|
||||||
CreateTargetPhrase(targetPhrase
|
CreateTargetPhrase(targetPhrase
|
||||||
, j ->first
|
, j ->first
|
||||||
, m_obj->options()->output.factor_delimiter
|
, m_obj->options()->output.factor_delimiter
|
||||||
, scores.transScore
|
, scores.transScore
|
||||||
, scores.inputScores
|
, scores.inputScores
|
||||||
, NULL
|
, NULL
|
||||||
@ -406,7 +406,7 @@ void PDTAimp::CacheSource(ConfusionNet const& src)
|
|||||||
|
|
||||||
void PDTAimp::CreateTargetPhrase(TargetPhrase& targetPhrase,
|
void PDTAimp::CreateTargetPhrase(TargetPhrase& targetPhrase,
|
||||||
StringTgtCand::Tokens const& factorStrings,
|
StringTgtCand::Tokens const& factorStrings,
|
||||||
std::string const& factorDelimiter,
|
std::string const& factorDelimiter,
|
||||||
Scores const& transVector,
|
Scores const& transVector,
|
||||||
Scores const& inputVector,
|
Scores const& inputVector,
|
||||||
const std::string *alignmentString,
|
const std::string *alignmentString,
|
||||||
@ -415,8 +415,8 @@ void PDTAimp::CreateTargetPhrase(TargetPhrase& targetPhrase,
|
|||||||
FactorCollection &factorCollection = FactorCollection::Instance();
|
FactorCollection &factorCollection = FactorCollection::Instance();
|
||||||
|
|
||||||
for(size_t k=0; k<factorStrings.size(); ++k) {
|
for(size_t k=0; k<factorStrings.size(); ++k) {
|
||||||
util::TokenIter<util::MultiCharacter, false>
|
util::TokenIter<util::MultiCharacter, false>
|
||||||
word(*factorStrings[k], factorDelimiter);
|
word(*factorStrings[k], factorDelimiter);
|
||||||
Word& w=targetPhrase.AddWord();
|
Word& w=targetPhrase.AddWord();
|
||||||
for(size_t l=0; l<m_output.size(); ++l, ++word) {
|
for(size_t l=0; l<m_output.size(); ++l, ++word) {
|
||||||
w[m_output[l]]= factorCollection.AddFactor(*word);
|
w[m_output[l]]= factorCollection.AddFactor(*word);
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
void CreateTargetPhrase(TargetPhrase& targetPhrase,
|
void CreateTargetPhrase(TargetPhrase& targetPhrase,
|
||||||
StringTgtCand::Tokens const& factorStrings,
|
StringTgtCand::Tokens const& factorStrings,
|
||||||
std::string const& factorDelimiter,
|
std::string const& factorDelimiter,
|
||||||
Scores const& transVector,
|
Scores const& transVector,
|
||||||
Scores const& inputVector,
|
Scores const& inputVector,
|
||||||
const std::string *alignmentString,
|
const std::string *alignmentString,
|
||||||
|
@ -27,7 +27,7 @@ using namespace std;
|
|||||||
namespace Moses
|
namespace Moses
|
||||||
{
|
{
|
||||||
|
|
||||||
CompletedRuleCollection::CompletedRuleCollection(size_t rule_limit)
|
CompletedRuleCollection::CompletedRuleCollection(size_t rule_limit)
|
||||||
: m_ruleLimit(rule_limit)
|
: m_ruleLimit(rule_limit)
|
||||||
{
|
{
|
||||||
m_scoreThreshold = numeric_limits<float>::infinity();
|
m_scoreThreshold = numeric_limits<float>::infinity();
|
||||||
|
@ -144,10 +144,10 @@ TargetPhraseCollection::shared_ptr PhraseDictionaryMultiModelCounts::GetTargetPh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PhraseDictionaryMultiModelCounts::
|
PhraseDictionaryMultiModelCounts::
|
||||||
CollectSufficientStats(const Phrase& src, vector<float> &fs,
|
CollectSufficientStats(const Phrase& src, vector<float> &fs,
|
||||||
map<string,multiModelCountsStats*>* allStats) const
|
map<string,multiModelCountsStats*>* allStats) const
|
||||||
//fill fs and allStats with statistics from models
|
//fill fs and allStats with statistics from models
|
||||||
{
|
{
|
||||||
for(size_t i = 0; i < m_numModels; ++i) {
|
for(size_t i = 0; i < m_numModels; ++i) {
|
||||||
|
@ -63,10 +63,10 @@ TranslationOptionCollectionConfusionNet(ttasksptr const& ttask,
|
|||||||
const ScorePair &scores = col[i].second;
|
const ScorePair &scores = col[i].second;
|
||||||
ScorePair *inputScore = new ScorePair(scores);
|
ScorePair *inputScore = new ScorePair(scores);
|
||||||
|
|
||||||
InputPath* path = new InputPath(ttask.get(), subphrase, labels,
|
InputPath* path = new InputPath(ttask.get(), subphrase, labels,
|
||||||
range, NULL, inputScore);
|
range, NULL, inputScore);
|
||||||
list.push_back(path);
|
list.push_back(path);
|
||||||
|
|
||||||
m_inputPathQueue.push_back(path);
|
m_inputPathQueue.push_back(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ TranslationOptionCollectionConfusionNet(ttasksptr const& ttask,
|
|||||||
ScorePair *inputScore = new ScorePair(*prevInputScore);
|
ScorePair *inputScore = new ScorePair(*prevInputScore);
|
||||||
inputScore->PlusEquals(scores);
|
inputScore->PlusEquals(scores);
|
||||||
|
|
||||||
InputPath *path = new InputPath(ttask.get(), subphrase, labels, range,
|
InputPath *path = new InputPath(ttask.get(), subphrase, labels, range,
|
||||||
&prevPath, inputScore);
|
&prevPath, inputScore);
|
||||||
list.push_back(path);
|
list.push_back(path);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ TranslationOptionCollectionLattice
|
|||||||
ScorePair *inputScore = new ScorePair(scores);
|
ScorePair *inputScore = new ScorePair(scores);
|
||||||
|
|
||||||
InputPath *path
|
InputPath *path
|
||||||
= new InputPath(ttask.get(), subphrase, labels, range, NULL, inputScore);
|
= new InputPath(ttask.get(), subphrase, labels, range, NULL, inputScore);
|
||||||
|
|
||||||
path->SetNextNode(nextNode);
|
path->SetNextNode(nextNode);
|
||||||
m_inputPathQueue.push_back(path);
|
m_inputPathQueue.push_back(path);
|
||||||
|
@ -213,8 +213,8 @@ TO_STRING_BODY(Word);
|
|||||||
ostream& operator<<(ostream& out, const Word& word)
|
ostream& operator<<(ostream& out, const Word& word)
|
||||||
{
|
{
|
||||||
util::StringStream strme;
|
util::StringStream strme;
|
||||||
const std::string& factorDelimiter
|
const std::string& factorDelimiter
|
||||||
= StaticData::Instance().options()->output.factor_delimiter;
|
= StaticData::Instance().options()->output.factor_delimiter;
|
||||||
bool firstPass = true;
|
bool firstPass = true;
|
||||||
unsigned int stop = max_fax();
|
unsigned int stop = max_fax();
|
||||||
for (unsigned int currFactor = 0 ; currFactor < stop; currFactor++) {
|
for (unsigned int currFactor = 0 ; currFactor < stop; currFactor++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user