#ifndef _MRS_H_ #define _MRS_H_ #include #include #include #include #include #include enum RelType {REAL, QUANT}; typedef std::string VarType; //e, x, h, handle, ref-ind typedef std::string VarID; //numeric bit of Var typedef std::pair Var; typedef std::string Feature; //SF, TENSE, PERS typedef std::string Value; // UNTENSED, SG, 3 typedef std::string Role; //ARG0, ARG1, RESTR, BODY, R-INDEX etc typedef std::map Props; typedef std::map Roles; typedef std::pair > ATriple; typedef std::pair > PTriple; struct Rel { std::string name; std::string span; std::string carg; RelType type; Var lbl; Var arg0; Roles *roles; }; class Unmatched { public: std::string dir; std::string name1; std::string span1; std::string pred; std::string name2; std::string span2; Unmatched(std::string d, std::string n1, std::string s1, std::string p, std::string n2, std::string s2) : dir(d), name1(n1), span1(s1), pred(p), name2(n2), span2(s2) {} Unmatched(std::string d, std::string n1, std::string s1, std::string p, std::string n2) : dir(d), name1(n1), span1(s1), pred(p), name2(n2) {} ~Unmatched() {} bool operator>(const Unmatched &other) const {return span1 < other.span1 || (span1 == other.span1 && name1 < other.name1) || (span1 == other.span1 && name1 == other.name1 && pred < other.pred); } }; struct unmatched_cmp { bool operator()(const Unmatched &t1, const Unmatched &t2) { return t1.span1 < t2.span1 || (t1.span1 == t2.span1 && t1.name1 < t2.name1) || (t1.span1 == t2.span1 && t1.name1 == t2.name1 && t1.pred < t2.pred); } }; class tMRS { bool debug; std::vector rels; std::map hcons; std::map arg0s; std::map arg0ToRel; //real rels, not quants std::map lblToArg0; std::vector argtriples; std::vector proptriples; std::map > spanToRel; std::map > spanToATriple; std::map > spanToPTriple; std::map counts; Var index; Var ltop; void parseChar(char, std::string &); void parseID(const std::string, std::string &); Var parseVar(std::string &); Props *parseProps(std::string &); void parseRel(std::string &); bool parseHCONS(std::string &); std::string readFeature(std::string &); std::pair parseName(std::string &); std::string parseString(std::string &); public: tMRS(std::string input, bool db=false); ~tMRS(); std::map &getCounts() {return counts;}; void printTriples(); void printCounts(); std::pair, std::vector > compareTriples(tMRS &test); }; #endif