00001 #include <iostream>
00002 #include <fstream>
00003 #include <cassert>
00004 #include <cstdlib>
00005 #include <string>
00006 #include <queue>
00007 #include <map>
00008 #include <cmath>
00009
00010 #include "ScoreFeature.h"
00011 #include "extract-ghkm/Node.h"
00012
00013 namespace MosesTraining
00014 {
00015
00016
00017 class InternalStructFeature : public ScoreFeature
00018 {
00019 public:
00020 InternalStructFeature() : m_type(0) {};
00022 void add(const ScoreFeatureContext& context,
00023 std::vector<float>& denseValues,
00024 std::map<std::string,float>& sparseValues) const;
00025
00026
00027 protected:
00029 virtual void add(const std::string *treeFragment,
00030 float count,
00031 std::vector<float>& denseValues,
00032 std::map<std::string,float>& sparseValues) const = 0;
00033 int m_type;
00034 };
00035
00036 class InternalStructFeatureDense : public InternalStructFeature
00037 {
00038 public:
00039 InternalStructFeatureDense()
00040 :InternalStructFeature() {
00041 m_type=1;
00042 }
00043 protected:
00044 virtual void add(const std::string *treeFragment,
00045 float count,
00046 std::vector<float>& denseValues,
00047 std::map<std::string,float>& sparseValues) const;
00048 };
00049
00050 class InternalStructFeatureSparse : public InternalStructFeature
00051 {
00052 public:
00053 InternalStructFeatureSparse()
00054 :InternalStructFeature() {
00055 m_type=2;
00056 }
00057 protected:
00058 virtual void add(const std::string *treeFragment,
00059 float count,
00060 std::vector<float>& denseValues,
00061 std::map<std::string,float>& sparseValues) const;
00062 };
00063
00064 }