mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
minor rename of variables
This commit is contained in:
parent
ea23629598
commit
bb511af0ee
@ -14,11 +14,12 @@ InputPath::
|
||||
InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms,
|
||||
const WordsRange &range, const InputPath *prevNode,
|
||||
const ScorePair *inputScore)
|
||||
:m_prevNode(prevNode)
|
||||
:m_prevPath(prevNode)
|
||||
,m_phrase(phrase)
|
||||
,m_range(range)
|
||||
,m_inputScore(inputScore)
|
||||
,m_sourceNonTerms(sourceNonTerms)
|
||||
,m_nextNode(1)
|
||||
{
|
||||
//cerr << "phrase=" << phrase << " m_inputScore=" << *m_inputScore << endl;
|
||||
|
||||
@ -67,7 +68,7 @@ const Word &InputPath::GetLastWord() const
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const InputPath& obj)
|
||||
{
|
||||
out << &obj << " " << obj.GetWordsRange() << " " << obj.GetPrevNode() << " " << obj.GetPhrase();
|
||||
out << &obj << " " << obj.GetWordsRange() << " " << obj.GetPrevPath() << " " << obj.GetPhrase();
|
||||
|
||||
out << "pt: ";
|
||||
std::map<const PhraseDictionary*, std::pair<const TargetPhraseCollection*, const void*> >::const_iterator iter;
|
||||
|
@ -30,10 +30,11 @@ class InputPath
|
||||
friend std::ostream& operator<<(std::ostream& out, const InputPath &obj);
|
||||
|
||||
protected:
|
||||
const InputPath *m_prevNode;
|
||||
const InputPath *m_prevPath;
|
||||
Phrase m_phrase;
|
||||
WordsRange m_range;
|
||||
const ScorePair *m_inputScore;
|
||||
size_t m_nextNode; // distance to next node. For lattices
|
||||
|
||||
// for phrase-based model only
|
||||
std::map<const PhraseDictionary*, std::pair<const TargetPhraseCollection*, const void*> > m_targetPhrases;
|
||||
@ -43,13 +44,13 @@ protected:
|
||||
const NonTerminalSet m_sourceNonTerms;
|
||||
|
||||
|
||||
bool SetPlaceholders(TargetPhrase *targetPhrase) const;
|
||||
public:
|
||||
explicit InputPath()
|
||||
: m_prevNode(NULL)
|
||||
: m_prevPath(NULL)
|
||||
, m_range(NOT_FOUND, NOT_FOUND)
|
||||
, m_inputScore(NULL) {
|
||||
}
|
||||
, m_inputScore(NULL)
|
||||
, m_nextNode(NOT_FOUND)
|
||||
{}
|
||||
|
||||
InputPath(const Phrase &phrase, const NonTerminalSet &sourceNonTerms, const WordsRange &range, const InputPath *prevNode
|
||||
,const ScorePair *inputScore);
|
||||
@ -66,10 +67,17 @@ public:
|
||||
}
|
||||
const Word &GetLastWord() const;
|
||||
|
||||
const InputPath *GetPrevNode() const {
|
||||
return m_prevNode;
|
||||
const InputPath *GetPrevPath() const {
|
||||
return m_prevPath;
|
||||
}
|
||||
|
||||
//! distance to next node in input lattice. For sentences and confusion networks, this should be 1 (default)
|
||||
size_t GetNextNode() const
|
||||
{ return m_nextNode; }
|
||||
|
||||
void SetNextNode(size_t nextNode)
|
||||
{ m_nextNode = nextNode; }
|
||||
|
||||
void SetTargetPhrases(const PhraseDictionary &phraseDictionary
|
||||
, const TargetPhraseCollection *targetPhrases
|
||||
, const void *ptNode);
|
||||
|
@ -141,12 +141,12 @@ GetTargetPhraseCollectionBatch(const InputPathList &phraseDictionaryQueue) const
|
||||
for (iter = phraseDictionaryQueue.begin(); iter != phraseDictionaryQueue.end(); ++iter) {
|
||||
InputPath &node = **iter;
|
||||
const Phrase &phrase = node.GetPhrase();
|
||||
const InputPath *prevNode = node.GetPrevNode();
|
||||
const InputPath *prevPath = node.GetPrevPath();
|
||||
|
||||
const PhraseDictionaryNodeMemory *prevPtNode = NULL;
|
||||
|
||||
if (prevNode) {
|
||||
prevPtNode = static_cast<const PhraseDictionaryNodeMemory*>(prevNode->GetPtNode(*this));
|
||||
if (prevPath) {
|
||||
prevPtNode = static_cast<const PhraseDictionaryNodeMemory*>(prevPath->GetPtNode(*this));
|
||||
} else {
|
||||
// Starting subphrase.
|
||||
assert(phrase.GetSize() == 1);
|
||||
|
@ -106,7 +106,7 @@ void PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(InputPath &inputPath
|
||||
{
|
||||
OnDiskPt::OnDiskWrapper &wrapper = const_cast<OnDiskPt::OnDiskWrapper&>(GetImplementation());
|
||||
const Phrase &phrase = inputPath.GetPhrase();
|
||||
const InputPath *prevInputPath = inputPath.GetPrevNode();
|
||||
const InputPath *prevInputPath = inputPath.GetPrevPath();
|
||||
|
||||
const OnDiskPt::PhraseNode *prevPtNode = NULL;
|
||||
|
||||
|
@ -45,10 +45,10 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
const ScorePair &scores = col[i].second;
|
||||
ScorePair *inputScore = new ScorePair(scores);
|
||||
|
||||
InputPath *node = new InputPath(subphrase, labels, range, NULL, inputScore);
|
||||
list.push_back(node);
|
||||
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
|
||||
list.push_back(path);
|
||||
|
||||
m_phraseDictionaryQueue.push_back(node);
|
||||
m_phraseDictionaryQueue.push_back(path);
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,17 +65,17 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
InputPathList &list = vec.back();
|
||||
|
||||
// loop thru every previous path
|
||||
const InputPathList &prevNodes = GetInputPathList(startPos, endPos - 1);
|
||||
const InputPathList &prevPaths = GetInputPathList(startPos, endPos - 1);
|
||||
|
||||
int prevNodesInd = 0;
|
||||
InputPathList::const_iterator iterPath;
|
||||
for (iterPath = prevNodes.begin(); iterPath != prevNodes.end(); ++iterPath) {
|
||||
//for (size_t pathInd = 0; pathInd < prevNodes.size(); ++pathInd) {
|
||||
const InputPath &prevNode = **iterPath;
|
||||
//const InputPath &prevNode = *prevNodes[pathInd];
|
||||
for (iterPath = prevPaths.begin(); iterPath != prevPaths.end(); ++iterPath) {
|
||||
//for (size_t pathInd = 0; pathInd < prevPaths.size(); ++pathInd) {
|
||||
const InputPath &prevPath = **iterPath;
|
||||
//const InputPath &prevPath = *prevPaths[pathInd];
|
||||
|
||||
const Phrase &prevPhrase = prevNode.GetPhrase();
|
||||
const ScorePair *prevInputScore = prevNode.GetInputScore();
|
||||
const Phrase &prevPhrase = prevPath.GetPhrase();
|
||||
const ScorePair *prevInputScore = prevPath.GetInputScore();
|
||||
CHECK(prevInputScore);
|
||||
|
||||
// loop thru every word at this position
|
||||
@ -90,14 +90,14 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
|
||||
ScorePair *inputScore = new ScorePair(*prevInputScore);
|
||||
inputScore->PlusEquals(scores);
|
||||
|
||||
InputPath *node = new InputPath(subphrase, labels, range, &prevNode, inputScore);
|
||||
list.push_back(node);
|
||||
InputPath *path = new InputPath(subphrase, labels, range, &prevPath, inputScore);
|
||||
list.push_back(path);
|
||||
|
||||
m_phraseDictionaryQueue.push_back(node);
|
||||
m_phraseDictionaryQueue.push_back(path);
|
||||
} // for (size_t i = 0; i < col.size(); ++i) {
|
||||
|
||||
++prevNodesInd;
|
||||
} // for (iterPath = prevNodes.begin(); iterPath != prevNodes.end(); ++iterPath) {
|
||||
} // for (iterPath = prevPaths.begin(); iterPath != prevPaths.end(); ++iterPath) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,17 +46,17 @@ TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const
|
||||
Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos)));
|
||||
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
|
||||
|
||||
InputPath *node;
|
||||
InputPath *path;
|
||||
if (range.GetNumWordsCovered() == 1) {
|
||||
node = new InputPath(subphrase, labels, range, NULL, NULL);
|
||||
vec.push_back(node);
|
||||
path = new InputPath(subphrase, labels, range, NULL, NULL);
|
||||
vec.push_back(path);
|
||||
} else {
|
||||
const InputPath &prevNode = GetInputPath(startPos, endPos - 1);
|
||||
node = new InputPath(subphrase, labels, range, &prevNode, NULL);
|
||||
vec.push_back(node);
|
||||
const InputPath &prevPath = GetInputPath(startPos, endPos - 1);
|
||||
path = new InputPath(subphrase, labels, range, &prevPath, NULL);
|
||||
vec.push_back(path);
|
||||
}
|
||||
|
||||
m_phraseDictionaryQueue.push_back(node);
|
||||
m_phraseDictionaryQueue.push_back(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user