00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef Tanl_NER_FeatureSpecs_H
00025 #define Tanl_NER_FeatureSpecs_H
00026
00027
00028 #include <set>
00029
00030
00031 #include "conf/conf.h"
00032 #include "text/RegExp.h"
00033
00034
00035
00036 namespace Tanl {
00037 namespace NER {
00038
00045 struct FeatureSpec {
00046 FeatureSpec(std::string const& name, std::string const& pattern, char const* line);
00047
00048 std::string const name;
00049 Text::RegExp::Pattern pattern;
00050 std::vector<int> tokens;
00051 };
00052
00053 typedef std::set<FeatureSpec*> FeatureSpecs;
00054
00055 std::ostream& operator <<(std::ostream& os, FeatureSpecs& specs);
00056
00063 class conf_feature : public IXE::Var<FeatureSpecs>
00064 {
00065 public:
00066
00067 conf_feature(char const* name) : IXE::Var<FeatureSpecs>(name) { }
00068
00069 conf_feature(char const* name, char const* value) : IXE::Var<FeatureSpecs>(name) {
00070 parseValue(value);
00071 }
00072
00073 ~conf_feature() { reset(); }
00074
00078 void serialize(std::ostream& os) {
00079
00080 }
00081
00082 protected:
00089 virtual void parseValue(char const*& line);
00090
00091 virtual void reset() {
00092 for (std::set<FeatureSpec*>::iterator pit = value.begin();
00093 pit != value.end(); ++pit)
00094 delete *pit;
00095 }
00096 };
00097
00098 extern conf_feature featureSpecs;
00099 extern conf_feature morphFeatureSpecs;
00100
00101 }
00102 }
00103
00104 #endif