00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #ifndef _RGF
00045 #define _RGF
00046
00047 #include <string>
00048 #include <vector>
00049 #include <set>
00050 #include "language.h"
00051 #include "sensor.h"
00052
00053 using namespace std;
00054
00055 struct RGF;
00056
00057 typedef enum {EXTRACT_LABEL, EXTRACT_CONJ, EXTRACT_DISJ, EXTRACT_COLOC,
00058 EXTRACT_SCOLOC, EXTRACT_LINK, EXTRACT_SENSOR,
00059 EXTRACT_NOT, EXTRACT_CONJUNCT } ExtractMode;
00060
00061 typedef enum {TARGET_NULL = -2, TARGET_ALL = -1} TargetConstants;
00062 const int RANGE_ALL = 1000000;
00063
00064 typedef vector<RGF> SubRGF;
00065
00066 struct RGF
00067 {
00068 public:
00069
00070 RGF();
00071 RGF(char* sensorName, char* p1, char* p2, char* p3, char* dpath);
00072
00073
00074 RGF(char* sensorName);
00075
00076
00077 RGF( SubRGF& subR );
00078
00079
00080 ~RGF();
00081
00082
00083
00084 bool operator==( const RGF& rhs ) const;
00085 bool operator<=( const RGF& rhs ) const;
00086 bool operator<( const RGF& rhs ) const;
00087 bool operator>( const RGF& rhs ) const;
00088 bool operator>=( const RGF& rhs ) const;
00089
00090 set<string> Extract( const sentence& sent, int targIndex );
00091
00092
00093 set<string> Extract( const sentence& sent, int targIndex, int targLength );
00094
00095
00096
00097
00098 int TargetIndex() { return targetIndex; }
00099 void Target(char* targ);
00100 const char* Target() const { return target; }
00101 void IncludeLocation(bool val);
00102 void LocationOffset(int val);
00103 int LocationOffset() const { return locationOffset; }
00104 void LeftOffset(int val) { leftOffset = val; }
00105 int LeftOffset() const { return leftOffset; }
00106 void RightOffset(int val);
00107 int RightOffset() const { return rightOffset; }
00108 void IncludeTarget(bool val);
00109 bool IncludeTarget() const { return includeTarget; }
00110 void IncludeMark(bool val);
00111 bool IncludeMark() const { return includeMark; }
00112 void Mode(ExtractMode mode);
00113 ExtractMode Mode() { return extractMode; }
00114 void Mask(char* val) { mask = val; }
00115 char* Mask() { return mask; }
00116 void Param(char* val);
00117 const char* Param() {return optParam;}
00118 void GenFeature(bool val) { genFeature = val; }
00119 void Insert(RGF rel) { subRGFs.push_back(rel); }
00120
00121
00122 void Show();
00123
00124 protected:
00125 SubRGF subRGFs;
00126 char* optParam;
00127 bool includeTarget;
00128 bool includeMark;
00129 int targetIndex;
00130 int leftOffset;
00131 int rightOffset;
00132 int locationOffset;
00133 ExtractMode extractMode;
00134 char* target;
00135 char* mask;
00136 bool genFeature;
00137 Sensor *pSensor;
00138
00139
00140 set<string> Process( const sentence& sent,
00141 int rec,
00142 int targIndex,
00143 int start,
00144 int end);
00145
00146 };
00147
00148 #endif
00149