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 #include "text/strings.h"
00026 #include "conf/conf_bool.h"
00027
00028
00029 #include <iostream>
00030
00031
00032 #include "SstEventStream.h"
00033
00034 using namespace std;
00035 using namespace Tanl::Classifier;
00036
00037 namespace Tanl {
00038 namespace SST {
00039
00041 IXE::conf<bool> dumpEvents("DumpEvents", false);
00042
00043 SstEventStream::SstEventStream(Resources& resources) :
00044 featureExtractor(resources)
00045 { }
00046
00047 bool SstEventStream::hasNext()
00048 {
00049 return position < sentence->size();
00050 }
00051
00055 Event* SstEventStream::next()
00056 {
00057 Token* token = (*sentence)[position];
00058 char const* word = token->form.c_str();
00059 char const* ssTag = token->get("SSTAG")->c_str();
00060
00061
00062 Event* event = new Event(ssTag);
00063 featureExtractor.extract(event->features, position);
00064
00065
00066 featureExtractor.classified(position, ssTag);
00067
00068 if (dumpEvents)
00069 cerr << *event << endl;
00070 position++;
00071 return event;
00072 }
00073
00074 void SstEventStream::predicted(char const* ssTag, int pos)
00075 {
00076 if (pos < 0)
00077 pos = position-1;
00078 featureExtractor.classified(pos, ssTag);
00079 }
00080
00081 }
00082 }