#ifndef _RESULTREADER_H_ #define _RESULTREADER_H_ #include #include #include "grammar.h" #include "tToken.h" template class ResultReader { Grammar _g; Data &_d; // called on internal node when the node values are read // arguments are node name, node ancestors, edge number, score, start, end void (*_start_int_node_funct)(std::string, std::vector &, int, double, int, int, Data &); // called on internal node once all subtrees are parsed // arguments are names of direct child(ren), node ancestors void (*_end_int_node_funct)(std::vector &, std::vector &, Data &); // called when a leaf node is parsed // arguments are surface string, node ancestors void (*_leaf_funct)(std::string, std::vector &, Data &); // recursive functions for reading the tree std::string subtreepair(std::string const &, int, std::vector &); std::string const subtree(std::string const &, int, std::vector &); public: // constructer requires function pointers ResultReader(Grammar const &g, Data &d, void (*start_int_node)(std::string, std::vector &, int, double, int, int, Data &)=NULL, void (*end_int_node)(std::vector &, std::vector &, Data &)=NULL, void (*leaf)(std::string, std::vector &, Data &)=NULL); ~ResultReader(); void readResult(std::string); }; #endif