mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
beautify
This commit is contained in:
parent
52215fdf79
commit
6759af3821
@ -146,7 +146,7 @@ ChartParser::ChartParser(InputType const &source, ChartCellCollectionBase &cells
|
||||
const PhraseDictionary *dict = *p;
|
||||
PhraseDictionary *nonConstDict = const_cast<PhraseDictionary*>(dict);
|
||||
|
||||
ChartRuleLookupManager *lookupMgr = nonConstDict->CreateRuleLookupManager(*this, cells);
|
||||
ChartRuleLookupManager *lookupMgr = nonConstDict->CreateRuleLookupManager(*this, cells);
|
||||
|
||||
m_ruleLookupManagers.push_back(lookupMgr);
|
||||
}
|
||||
|
@ -72,11 +72,13 @@ public:
|
||||
}
|
||||
|
||||
//! distance to next node in input lattice. For sentences and confusion networks, this should be 1 (default)
|
||||
size_t GetNextNode() const
|
||||
{ return m_nextNode; }
|
||||
size_t GetNextNode() const {
|
||||
return m_nextNode;
|
||||
}
|
||||
|
||||
void SetNextNode(size_t nextNode)
|
||||
{ m_nextNode = nextNode; }
|
||||
void SetNextNode(size_t nextNode) {
|
||||
m_nextNode = nextNode;
|
||||
}
|
||||
|
||||
void SetTargetPhrases(const PhraseDictionary &phraseDictionary
|
||||
, const TargetPhraseCollection *targetPhrases
|
||||
|
@ -1073,7 +1073,7 @@ void StaticData::CheckLEGACYPT()
|
||||
for (size_t i = 0; i < m_phraseDictionary.size(); ++i) {
|
||||
const PhraseDictionary *phraseDictionary = m_phraseDictionary[i];
|
||||
if (dynamic_cast<const PhraseDictionaryTreeAdaptor*>(phraseDictionary) != NULL) {
|
||||
m_useLegacyPT = true;
|
||||
m_useLegacyPT = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -749,8 +749,9 @@ public:
|
||||
** eventually, we'll stop support the binary phrase-table and delete this legacy code
|
||||
**/
|
||||
void CheckLEGACYPT();
|
||||
bool GetUseLegacyPT() const
|
||||
{ return m_useLegacyPT; }
|
||||
bool GetUseLegacyPT() const {
|
||||
return m_useLegacyPT;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
@ -43,7 +43,7 @@ ChartRuleLookupManagerSkeleton::ChartRuleLookupManagerSkeleton(
|
||||
: ChartRuleLookupManager(parser, cellColl)
|
||||
, m_skeletonPT(skeletonPt)
|
||||
{
|
||||
cerr << "starting ChartRuleLookupManagerSkeleton" << endl;
|
||||
cerr << "starting ChartRuleLookupManagerSkeleton" << endl;
|
||||
}
|
||||
|
||||
ChartRuleLookupManagerSkeleton::~ChartRuleLookupManagerSkeleton()
|
||||
@ -61,10 +61,10 @@ void ChartRuleLookupManagerSkeleton::GetChartRuleCollection(
|
||||
m_tpColl.push_back(tpColl);
|
||||
|
||||
if (range.GetNumWordsCovered() == 1) {
|
||||
const ChartCellLabel &sourceWordLabel = GetSourceAt(range.GetStartPos());
|
||||
const Word &sourceWord = sourceWordLabel.GetLabel();
|
||||
TargetPhrase *tp = CreateTargetPhrase(sourceWord);
|
||||
tpColl->Add(tp);
|
||||
const ChartCellLabel &sourceWordLabel = GetSourceAt(range.GetStartPos());
|
||||
const Word &sourceWord = sourceWordLabel.GetLabel();
|
||||
TargetPhrase *tp = CreateTargetPhrase(sourceWord);
|
||||
tpColl->Add(tp);
|
||||
}
|
||||
|
||||
outColl.Add(*tpColl, m_stackVec, range);
|
||||
|
@ -27,7 +27,7 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
|
||||
const WordLattice *lattice = dynamic_cast<const WordLattice*>(&input);
|
||||
if (lattice) {
|
||||
cerr << *lattice << endl;
|
||||
cerr << *lattice << endl;
|
||||
}
|
||||
|
||||
size_t size = input.GetSize();
|
||||
@ -58,7 +58,7 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
|
||||
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
|
||||
if (nextNodes) {
|
||||
size_t nextNode = nextNodes->at(i);
|
||||
size_t nextNode = nextNodes->at(i);
|
||||
path->SetNextNode(nextNode);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
|
||||
const WordLattice *lattice = dynamic_cast<const WordLattice*>(&input);
|
||||
if (lattice) {
|
||||
cerr << *lattice << endl;
|
||||
cerr << *lattice << endl;
|
||||
}
|
||||
|
||||
size_t size = input.GetSize();
|
||||
@ -58,7 +58,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
|
||||
|
||||
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
|
||||
if (nextNodes) {
|
||||
size_t nextNode = nextNodes->at(i);
|
||||
size_t nextNode = nextNodes->at(i);
|
||||
path->SetNextNode(nextNode);
|
||||
}
|
||||
|
||||
|
@ -218,26 +218,26 @@ WordLattice::CreateTranslationOptionCollection() const
|
||||
|
||||
std::ostream& operator<<(std::ostream &out, const WordLattice &obj)
|
||||
{
|
||||
out << "next_nodes=";
|
||||
for (size_t i = 0; i < obj.next_nodes.size(); ++i) {
|
||||
out << i << ":";
|
||||
out << "next_nodes=";
|
||||
for (size_t i = 0; i < obj.next_nodes.size(); ++i) {
|
||||
out << i << ":";
|
||||
|
||||
const std::vector<size_t> &inner = obj.next_nodes[i];
|
||||
for (size_t j = 0; j < inner.size(); ++j) {
|
||||
out << inner[j] << " ";
|
||||
}
|
||||
}
|
||||
const std::vector<size_t> &inner = obj.next_nodes[i];
|
||||
for (size_t j = 0; j < inner.size(); ++j) {
|
||||
out << inner[j] << " ";
|
||||
}
|
||||
}
|
||||
|
||||
out << "distances=";
|
||||
for (size_t i = 0; i < obj.distances.size(); ++i) {
|
||||
out << i << ":";
|
||||
out << "distances=";
|
||||
for (size_t i = 0; i < obj.distances.size(); ++i) {
|
||||
out << i << ":";
|
||||
|
||||
const std::vector<int> &inner = obj.distances[i];
|
||||
for (size_t j = 0; j < inner.size(); ++j) {
|
||||
out << inner[j] << " ";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
const std::vector<int> &inner = obj.distances[i];
|
||||
for (size_t j = 0; j < inner.size(); ++j) {
|
||||
out << inner[j] << " ";
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -42,8 +42,9 @@ public:
|
||||
*/
|
||||
void GetAsEdgeMatrix(std::vector<std::vector<bool> >& edges) const;
|
||||
|
||||
const std::vector<size_t> &GetNextNodes(size_t pos) const
|
||||
{ return next_nodes[pos]; }
|
||||
const std::vector<size_t> &GetNextNodes(size_t pos) const {
|
||||
return next_nodes[pos];
|
||||
}
|
||||
|
||||
TranslationOptionCollection *CreateTranslationOptionCollection() const;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user