diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-02 21:24:36 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-08-02 21:24:36 +0400 |
commit | d39573763934d8f6bbede0d346ab497b1488cc07 (patch) | |
tree | 71e641353c281946e8037be404c6b3f756002e0a | |
parent | ae2e2c6d834a8d9ec00895bc282b8f6fd886ddde (diff) |
minor cleanup
-rw-r--r-- | moses/ChartParser.cpp | 14 | ||||
-rw-r--r-- | moses/ChartParser.h | 6 | ||||
-rw-r--r-- | moses/TranslationOptionCollectionConfusionNet.cpp | 10 | ||||
-rw-r--r-- | moses/TranslationOptionCollectionConfusionNet.h | 4 | ||||
-rw-r--r-- | moses/TranslationOptionCollectionText.cpp | 8 | ||||
-rw-r--r-- | moses/TranslationOptionCollectionText.h | 4 |
6 files changed, 22 insertions, 24 deletions
diff --git a/moses/ChartParser.cpp b/moses/ChartParser.cpp index e6eea57d9..fd83d3d73 100644 --- a/moses/ChartParser.cpp +++ b/moses/ChartParser.cpp @@ -183,11 +183,11 @@ void ChartParser::Create(const WordsRange &wordsRange, ChartParserCallback &to) void ChartParser::CreateInputPaths(const InputType &input) { size_t size = input.GetSize(); - m_targetPhrasesfromPt.resize(size); + m_inputPathMatrix.resize(size); for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) { for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) { size_t endPos = startPos + phaseSize -1; - vector<InputPath*> &vec = m_targetPhrasesfromPt[startPos]; + vector<InputPath*> &vec = m_inputPathMatrix[startPos]; WordsRange range(startPos, endPos); Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos))); @@ -203,7 +203,7 @@ void ChartParser::CreateInputPaths(const InputType &input) vec.push_back(node); } - m_phraseDictionaryQueue.push_back(node); + //m_phraseDictionaryQueue.push_back(node); } } } @@ -211,15 +211,15 @@ void ChartParser::CreateInputPaths(const InputType &input) const InputPath &ChartParser::GetInputPath(size_t startPos, size_t endPos) const { size_t offset = endPos - startPos; - CHECK(offset < m_targetPhrasesfromPt[startPos].size()); - return *m_targetPhrasesfromPt[startPos][offset]; + CHECK(offset < m_inputPathMatrix[startPos].size()); + return *m_inputPathMatrix[startPos][offset]; } InputPath &ChartParser::GetInputPath(size_t startPos, size_t endPos) { size_t offset = endPos - startPos; - CHECK(offset < m_targetPhrasesfromPt[startPos].size()); - return *m_targetPhrasesfromPt[startPos][offset]; + CHECK(offset < m_inputPathMatrix[startPos].size()); + return *m_inputPathMatrix[startPos][offset]; } /* const Sentence &ChartParser::GetSentence() const { diff --git a/moses/ChartParser.h b/moses/ChartParser.h index dde0c1e49..d80296771 100644 --- a/moses/ChartParser.h +++ b/moses/ChartParser.h @@ -73,10 +73,8 @@ private: std::vector<ChartRuleLookupManager*> m_ruleLookupManagers; InputType const& m_source; /**< source sentence to be translated */ - InputPathList m_phraseDictionaryQueue; - - typedef std::vector< std::vector<InputPath*> > TargetPhraseMatrix; - TargetPhraseMatrix m_targetPhrasesfromPt; /*< contains translation options */ + typedef std::vector< std::vector<InputPath*> > InputPathMatrix; + InputPathMatrix m_inputPathMatrix; void CreateInputPaths(const InputType &input); InputPath &GetInputPath(size_t startPos, size_t endPos); diff --git a/moses/TranslationOptionCollectionConfusionNet.cpp b/moses/TranslationOptionCollectionConfusionNet.cpp index 5d15ea67a..8e21e2f1a 100644 --- a/moses/TranslationOptionCollectionConfusionNet.cpp +++ b/moses/TranslationOptionCollectionConfusionNet.cpp @@ -24,11 +24,11 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet CHECK(inputFeature); size_t size = input.GetSize(); - m_targetPhrasesfromPt.resize(size); + m_inputPathMatrix.resize(size); // 1-word phrases for (size_t startPos = 0; startPos < size; ++startPos) { - vector<InputPathList> &vec = m_targetPhrasesfromPt[startPos]; + vector<InputPathList> &vec = m_inputPathMatrix[startPos]; vec.push_back(InputPathList()); InputPathList &list = vec.back(); @@ -60,7 +60,7 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet WordsRange range(startPos, endPos); const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos); - vector<InputPathList> &vec = m_targetPhrasesfromPt[startPos]; + vector<InputPathList> &vec = m_inputPathMatrix[startPos]; vec.push_back(InputPathList()); InputPathList &list = vec.back(); @@ -109,8 +109,8 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet InputPathList &TranslationOptionCollectionConfusionNet::GetInputPathList(size_t startPos, size_t endPos) { size_t offset = endPos - startPos; - CHECK(offset < m_targetPhrasesfromPt[startPos].size()); - return m_targetPhrasesfromPt[startPos][offset]; + CHECK(offset < m_inputPathMatrix[startPos].size()); + return m_inputPathMatrix[startPos][offset]; } /* forcibly create translation option for a particular source word. diff --git a/moses/TranslationOptionCollectionConfusionNet.h b/moses/TranslationOptionCollectionConfusionNet.h index b8197bca4..0a5c8eb6f 100644 --- a/moses/TranslationOptionCollectionConfusionNet.h +++ b/moses/TranslationOptionCollectionConfusionNet.h @@ -16,12 +16,12 @@ class ConfusionNet; class TranslationOptionCollectionConfusionNet : public TranslationOptionCollection { public: - typedef std::vector< std::vector<InputPathList> > TargetPhraseMatrix; + typedef std::vector< std::vector<InputPathList> > InputPathMatrix; protected: bool m_useLegacy; - TargetPhraseMatrix m_targetPhrasesfromPt; /*< contains translation options */ + InputPathMatrix m_inputPathMatrix; /*< contains translation options */ InputPathList &GetInputPathList(size_t startPos, size_t endPos); void CheckLegacy(); diff --git a/moses/TranslationOptionCollectionText.cpp b/moses/TranslationOptionCollectionText.cpp index c0803a777..e90ff5fe5 100644 --- a/moses/TranslationOptionCollectionText.cpp +++ b/moses/TranslationOptionCollectionText.cpp @@ -36,11 +36,11 @@ TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const : TranslationOptionCollection(input, maxNoTransOptPerCoverage, translationOptionThreshold) { size_t size = input.GetSize(); - m_targetPhrasesfromPt.resize(size); + m_inputPathMatrix.resize(size); for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) { for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) { size_t endPos = startPos + phaseSize -1; - vector<InputPath*> &vec = m_targetPhrasesfromPt[startPos]; + vector<InputPath*> &vec = m_inputPathMatrix[startPos]; WordsRange range(startPos, endPos); Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos))); @@ -100,8 +100,8 @@ void TranslationOptionCollectionText::CreateXmlOptionsForRange(size_t startPosit InputPath &TranslationOptionCollectionText::GetInputPath(size_t startPos, size_t endPos) { size_t offset = endPos - startPos; - CHECK(offset < m_targetPhrasesfromPt[startPos].size()); - return *m_targetPhrasesfromPt[startPos][offset]; + CHECK(offset < m_inputPathMatrix[startPos].size()); + return *m_inputPathMatrix[startPos][offset]; } void TranslationOptionCollectionText::CreateTranslationOptions() diff --git a/moses/TranslationOptionCollectionText.h b/moses/TranslationOptionCollectionText.h index 930368c6f..6f5f46424 100644 --- a/moses/TranslationOptionCollectionText.h +++ b/moses/TranslationOptionCollectionText.h @@ -38,10 +38,10 @@ class Sentence; class TranslationOptionCollectionText : public TranslationOptionCollection { public: - typedef std::vector< std::vector<InputPath*> > TargetPhraseMatrix; + typedef std::vector< std::vector<InputPath*> > InputPathMatrix; protected: - TargetPhraseMatrix m_targetPhrasesfromPt; /*< contains translation options */ + InputPathMatrix m_inputPathMatrix; /*< contains translation options */ InputPath &GetInputPath(size_t startPos, size_t endPos); |