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_ChartRuleLookupManagerOnDisk_h 00022 #define moses_ChartRuleLookupManagerOnDisk_h 00023 00024 #include "OnDiskPt/OnDiskWrapper.h" 00025 00026 #include "ChartRuleLookupManagerCYKPlus.h" 00027 #include "DotChartOnDisk.h" 00028 #include "moses/TranslationModel/RuleTable/PhraseDictionaryOnDisk.h" 00029 #include "moses/ChartParserCallback.h" 00030 #include "moses/InputType.h" 00031 00032 namespace Moses 00033 { 00034 00036 class ChartRuleLookupManagerOnDisk : public ChartRuleLookupManagerCYKPlus 00037 { 00038 public: 00039 ChartRuleLookupManagerOnDisk(const ChartParser &parser, 00040 const ChartCellCollectionBase &cellColl, 00041 const PhraseDictionaryOnDisk &dictionary, 00042 OnDiskPt::OnDiskWrapper &dbWrapper, 00043 const std::vector<FactorType> &inputFactorsVec, 00044 const std::vector<FactorType> &outputFactorsVec); 00045 00046 ~ChartRuleLookupManagerOnDisk(); 00047 00048 virtual void GetChartRuleCollection(const InputPath &inputPath, 00049 size_t last, 00050 ChartParserCallback &outColl); 00051 00052 private: 00053 const PhraseDictionaryOnDisk &m_dictionary; 00054 OnDiskPt::OnDiskWrapper &m_dbWrapper; 00055 const std::vector<FactorType> &m_inputFactorsVec; 00056 const std::vector<FactorType> &m_outputFactorsVec; 00057 std::vector<DottedRuleStackOnDisk*> m_expandableDottedRuleListVec; 00058 std::map<uint64_t, TargetPhraseCollection::shared_ptr > m_cache; 00059 std::list<const OnDiskPt::PhraseNode*> m_sourcePhraseNode; 00060 Word m_input_default_nonterminal; 00061 }; 00062 00063 } // namespace Moses 00064 00065 #endif