00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef DOM_USERDATA_H
00022 #define DOM_USERDATA_H
00023
00024 using namespace std;
00025
00026 #include "boss_mysql/boss_mysql_handler.h"
00027 #include <xercesc/dom/DOM.hpp>
00028 #include "boss_utility/dom_tools.h"
00029 #include <vector>
00030 #include <sstream>
00031 #include "tdsp/dsp_vector.h"
00032
00038 typedef dsp::vector<short> t_Signal;
00039
00040 class DOM_UserData {
00041 public:
00042
00043 enum Node_Type {
00044 WORD = 1,
00045 MORPHEME = 2,
00046 SYLLABLE = 3,
00047 PHONE = 4,
00048 HALFPHONE = 5,
00049 };
00050
00051 private:
00052
00053 MySQL_Result data_base_query;
00054 unsigned pos;
00055 Node_Type type;
00056 unsigned signal_size;
00057 t_Signal signal;
00058
00059 public:
00060
00061 static const unsigned npos = static_cast<unsigned>(-1);
00062
00063 DOM_UserData()
00064 : pos(npos), signal_size(0) {}
00065 DOM_UserData(const MySQL_Result & dbq, const Node_Type & t)
00066 : data_base_query(dbq), pos(npos), type(t), signal_size(0) {}
00067 ~DOM_UserData();
00068
00069 ostream & printQueryItems(ostream & out);
00070 ostream & printSelectedRow(ostream & out);
00071 const MySQL_Result & getResult() const
00072 { return data_base_query; }
00073 string getResult(const unsigned & p, const string & r) const
00074 { return data_base_query(p, r); }
00075 string getResult(const string & r) const
00076 { return data_base_query(pos, r); }
00077 Node_Type getType() const
00078 { return type; }
00079 unsigned getPos() const
00080 { return pos; }
00081 void setPos(const unsigned & p)
00082 { pos = p; }
00083 void setSignalSize(const unsigned & s)
00084 { signal_size=s; }
00085 unsigned getSignalSize()
00086 { return signal_size; }
00087 void setSignal(const t_Signal & s)
00088 { signal=s; }
00089 t_Signal & getSignal() {
00090 return signal;
00091 }
00092 };
00093
00094 namespace BOSS
00095 {
00096 void writeLabels(const xercesc::DOMNode * sentence, const string & fname);
00097 void getLabels(const xercesc::DOMNode * node, vector< vector< string > > & file, unsigned & last);
00098 }
00099
00100 #endif