00001
00002 #pragma once
00003 #include <vector>
00004 #include <string>
00005
00006 #include "moses/Hypothesis.h"
00007 #include "moses/ScoreComponentCollection.h"
00008 #include "moses/Range.h"
00009 #include "moses/Bitmap.h"
00010 #include "moses/TranslationOption.h"
00011 #include "moses/FF/FFState.h"
00012 #include "LRModel.h"
00013
00014 namespace Moses
00015 {
00016
00018 class LRState : public FFState
00019 {
00020 public:
00021
00022 typedef LRModel::ReorderingType ReorderingType;
00023
00024 virtual
00025 LRState*
00026 Expand(const TranslationOption& hypo, const InputType& input,
00027 ScoreComponentCollection* scores) const = 0;
00028
00029 static
00030 LRState*
00031 CreateLRState(const std::vector<std::string>& config,
00032 LRModel::Direction dir,
00033 const InputType &input);
00034
00035 protected:
00036
00037 const LRModel& m_configuration;
00038
00039
00040
00041 LRModel::Direction m_direction;
00042 size_t m_offset;
00043
00044 const TranslationOption *m_prevOption;
00045
00046 inline
00047 LRState(const LRState *prev,
00048 const TranslationOption &topt)
00049 : m_configuration(prev->m_configuration)
00050 , m_direction(prev->m_direction)
00051 , m_offset(prev->m_offset)
00052 , m_prevOption(&topt)
00053 { }
00054
00055 inline
00056 LRState(const LRModel &config,
00057 LRModel::Direction dir,
00058 size_t offset)
00059 : m_configuration(config)
00060 , m_direction(dir)
00061 , m_offset(offset)
00062 , m_prevOption(NULL)
00063 { }
00064
00065
00066
00067 void
00068 CopyScores(ScoreComponentCollection* scores,
00069 const TranslationOption& topt,
00070 const InputType& input, ReorderingType reoType) const;
00071
00072 int
00073 ComparePrevScores(const TranslationOption *other) const;
00074 };
00075
00076
00077
00078
00079
00080 }
00081