DeSR Dependency Parser |
00001 /* 00002 ** DeSR 00003 ** src/EventStream.h 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2005 Giuseppe Attardi (attardi@di.unipi.it). 00006 ** ---------------------------------------------------------------------- 00007 ** 00008 ** This file is part of DeSR. 00009 ** 00010 ** DeSR is free software; you can redistribute it and/or modify it 00011 ** under the terms of the GNU General Public License, version 3, 00012 ** as published by the Free Software Foundation. 00013 ** 00014 ** DeSR is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 ** ---------------------------------------------------------------------- 00022 */ 00023 00024 #ifndef DeSR_EventStream_H 00025 #define DeSR_EventStream_H 00026 00027 // local 00028 #include "Corpus.h" 00029 #include "State.h" 00030 00031 namespace Parser { 00032 00036 class EventStream : public Tanl::Classifier::EventStream, public Iterator<Tanl::Classifier::Event*> 00037 { 00038 public: 00039 00046 EventStream(SentenceReader* reader, GlobalInfo* info, 00047 int sentenceCutoff = INT_MAX) : 00048 reader(reader), 00049 info(info), 00050 sentenceCutoff(sentenceCutoff), 00051 sentenceCount(0) 00052 { } 00053 00057 bool hasNext(); 00058 00062 Tanl::Classifier::Event* next(); 00063 00067 void reset() { 00068 reader->reset(); 00069 sentenceCount = 0; 00070 } 00071 00073 bool EoS() { return !state->hasNext(); } 00074 00075 SentenceReader* reader; 00076 TrainState* state; 00077 GlobalInfo* info; 00078 00080 std::string& splitFeature() { return state->splitFeature; } 00081 00083 int sentenceCutoff; 00085 int sentenceCount; 00086 }; 00087 00088 } // namespace Parser 00089 00090 #endif // DeSR_EventStream_H