00001 // $Id$ 00002 00003 /*********************************************************************** 00004 Moses - factored phrase-based language decoder 00005 Copyright (C) 2006 University of Edinburgh 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Lesser General Public 00009 License as published by the Free Software Foundation; either 00010 version 2.1 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public 00018 License along with this library; if not, write to the Free Software 00019 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00020 ***********************************************************************/ 00021 00022 #ifndef moses_DecodeStep_h 00023 #define moses_DecodeStep_h 00024 00025 #include "TypeDef.h" 00026 #include "FactorTypeSet.h" 00027 #include "Phrase.h" 00028 00029 namespace Moses 00030 { 00031 00032 class DecodeFeature; 00033 class PhraseDictionary; 00034 class GenerationDictionary; 00035 class TranslationOption; 00036 class TranslationOptionCollection; 00037 class PartialTranslOptColl; 00038 class FactorCollection; 00039 class InputType; 00040 class FeatureFunction; 00041 class DecodeGraph; 00042 00049 class DecodeStep 00050 { 00051 protected: 00052 FactorMask m_outputFactors; 00053 std::vector<FactorType> m_conflictFactors; 00054 std::vector<FactorType> m_newOutputFactors; 00055 const DecodeFeature* m_decodeFeature; 00056 const DecodeGraph *m_container; 00057 00058 std::vector<FeatureFunction*> m_featuresToApply, m_featuresRemaining; 00059 public: 00060 DecodeStep(); 00061 DecodeStep(DecodeFeature *featurePtr, 00062 const DecodeStep* prevDecodeStep, 00063 const std::vector<FeatureFunction*> &features); 00064 virtual ~DecodeStep(); 00065 00067 const FactorMask& GetOutputFactorMask() const { 00068 return m_outputFactors; 00069 } 00070 00072 bool IsFilteringStep() const { 00073 return !m_conflictFactors.empty(); 00074 } 00075 00077 bool IsFactorProducingStep() const { 00078 return !m_newOutputFactors.empty(); 00079 } 00080 00081 const std::vector<FeatureFunction*> &GetFeaturesRemaining() const { 00082 return m_featuresRemaining; 00083 } 00084 00089 const std::vector<FactorType>& GetNewOutputFactors() const { 00090 return m_newOutputFactors; 00091 } 00092 00096 const std::vector<FactorType>& GetConflictFactors() const { 00097 return m_conflictFactors; 00098 } 00099 00101 const PhraseDictionary* GetPhraseDictionaryFeature() const; 00102 00104 const GenerationDictionary* GetGenerationDictionaryFeature() const; 00105 00106 void RemoveFeature(const FeatureFunction *ff); 00107 00108 void SetContainer(const DecodeGraph *container) { 00109 m_container = container; 00110 } 00111 const DecodeGraph *GetContainer() const { 00112 return m_container; 00113 } 00114 00115 }; 00116 00117 } 00118 #endif