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 DesR_ReviseEventStream_H
00025 #define DesR_ReviseEventStream_H
00026
00027
00028 #include "Classifier.h"
00029
00030
00031 #include "SentenceReader.h"
00032
00033 using namespace Tanl;
00034
00035 namespace Parser {
00036
00037 class ReviseStream
00038 {
00039 public:
00040 ReviseStream() { }
00041
00042 virtual ~ReviseStream() { delete sentence; }
00043
00047 std::vector<std::string> actions;
00048
00049 protected:
00050
00051 ReviseStream(SentenceReader* reader);
00052
00053 void clear();
00054 void predicates(Tanl::Classifier::Features& preds);
00055 void childFeatures(TreeToken* tok, char const* tag,
00056 Tanl::Classifier::Features& preds);
00057
00061 SentenceReader* reader;
00062
00063 Sentence* sentence;
00064
00065 public:
00066 int cur;
00067
00068 };
00069
00070 class ReviseEventStream : public ReviseStream
00071 {
00072 ReviseEventStream() { }
00073 };
00074
00075 class ReviseContextStream : public ReviseStream, public Tanl::Classifier::ContextStream
00076 {
00077 public:
00083 ReviseContextStream(SentenceReader* reader, WordIndex& predIndex) :
00084 ReviseStream(reader),
00085 predIndex(predIndex)
00086 { }
00087
00088 bool hasNext();
00089 Tanl::Classifier::Context* next();
00090 char const* Outcome();
00091
00095 void revise();
00096
00097 private:
00098 int performAction(TreeToken* to, int from, char const* action);
00099
00100 WordIndex& predIndex;
00101 Tanl::Classifier::Context context;
00102 };
00103
00104 }
00105
00106 #endif // DesR_ReviseEventStream_H