00001 /*********************************************************************** 00002 Moses - factored phrase-based language decoder 00003 Copyright (C) 2011 University of Edinburgh 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ***********************************************************************/ 00019 00020 #pragma once 00021 #ifndef moses_ChartRuleLookupManager_h 00022 #define moses_ChartRuleLookupManager_h 00023 00024 #include "ChartCellCollection.h" 00025 #include "InputType.h" 00026 00027 namespace Moses 00028 { 00029 class ChartParser; 00030 class ChartParserCallback; 00031 class Range; 00032 class Sentence; 00033 00040 class ChartRuleLookupManager 00041 { 00042 public: 00043 ChartRuleLookupManager(const ChartParser &parser, 00044 const ChartCellCollectionBase &cellColl) 00045 : m_parser(parser) 00046 , m_cellCollection(cellColl) {} 00047 00048 virtual ~ChartRuleLookupManager(); 00049 00050 const ChartCellLabelSet &GetTargetLabelSet(size_t begin, size_t end) const { 00051 return m_cellCollection.GetBase(Range(begin, end)).GetTargetLabelSet(); 00052 } 00053 00054 const ChartParser &GetParser() const { 00055 return m_parser; 00056 } 00057 //const Sentence &GetSentence() const; 00058 00059 const ChartCellLabel &GetSourceAt(size_t at) const { 00060 return m_cellCollection.GetSourceWordLabel(at); 00061 } 00062 00067 virtual void GetChartRuleCollection( 00068 const InputPath &inputPath, 00069 size_t lastPos, // last position to consider if using lookahead 00070 ChartParserCallback &outColl) = 0; 00071 00072 private: 00074 ChartRuleLookupManager(const ChartRuleLookupManager &); 00076 ChartRuleLookupManager &operator=(const ChartRuleLookupManager &); 00077 00078 const ChartParser &m_parser; 00079 const ChartCellCollectionBase &m_cellCollection; 00080 }; 00081 00082 } // namespace Moses 00083 00084 #endif