00001 /*********************************************************************** 00002 Moses - factored phrase-based language decoder 00003 Copyright (C) 2010 Hieu Hoang 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 00022 #include "StackVec.h" 00023 #include "TargetPhrase.h" 00024 #include "TargetPhraseCollection.h" 00025 #include "Range.h" 00026 00027 #include <vector> 00028 #include <boost/shared_ptr.hpp> 00029 #include "ChartTranslationOption.h" 00030 00031 namespace Moses 00032 { 00033 class ChartTranslationOption; 00034 class InputPath; 00035 class InputType; 00036 00040 class ChartTranslationOptions 00041 { 00042 friend std::ostream& operator<<(std::ostream&, const ChartTranslationOptions&); 00043 00044 public: 00045 typedef std::vector<boost::shared_ptr<ChartTranslationOption> > CollType; 00046 00053 ChartTranslationOptions(const TargetPhraseCollection &targetPhraseColl, 00054 const StackVec &stackVec, 00055 const Range &range, 00056 float score); 00057 ~ChartTranslationOptions(); 00058 00059 static float CalcEstimateOfBestScore(const TargetPhraseCollection &, 00060 const StackVec &); 00061 00062 size_t GetSize() const { 00063 return m_collection.size(); 00064 } 00065 00067 const StackVec &GetStackVec() const { 00068 return m_stackVec; 00069 } 00070 00072 const CollType &GetTargetPhrases() const { 00073 return m_collection; 00074 } 00075 00077 const Range &GetSourceWordsRange() const { 00078 return *m_wordsRange; 00079 } 00080 00085 inline float GetEstimateOfBestScore() const { 00086 return m_estimateOfBestScore; 00087 } 00088 00089 void EvaluateWithSourceContext(const InputType &input, const InputPath &inputPath); 00090 00091 void SetInputPath(const InputPath *inputPath); 00092 00093 void CreateSourceRuleFromInputPath(); 00094 00095 private: 00096 00097 StackVec m_stackVec; 00098 CollType m_collection; 00099 00100 const Range *m_wordsRange; 00101 float m_estimateOfBestScore; 00102 }; 00103 00104 }