00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00028 #ifndef BOSS_TRANSCRIPTION_H
00029 #define BOSS_TRANSCRIPTION_H
00030
00031 #include <string>
00032 #include "xercesc/dom/DOM.hpp"
00033 #include "boss_utility/boss_fsa.h"
00034 #include "boss_utility/boss_module.h"
00035 #include "boss_context/boss_context.h"
00036 #include "boss_utility/boss_config.h"
00037 #ifndef BONT
00038 #include "boss_mysql/boss_mysql_handler.h"
00039 #include "boss_mysql/boss_mysql_result.h"
00040 #endif
00041
00042 using namespace std;
00043
00044
00045
00051 #ifdef BONT
00052 struct p_line {
00053 string phon;
00054 string p_class;
00055 string voicing;
00056 p_line() {;}
00057 p_line(string p, string c, string v) : phon(p), p_class(c), voicing(v) {;}
00058 };
00059
00060
00061 typedef vector<struct p_line> p_Vector;
00062 typedef map< string, string > t_SSMap;
00063
00065 inline istream & operator >> (istream & in, p_line & p) {
00066 return in >> p.phon >> p.p_class >> p.voicing;
00067 }
00068
00069 inline ostream & operator << (ostream & out, const p_line & p) {
00070 return out << p.phon << " " << p.p_class << " " << p.voicing;
00071 }
00072
00074 inline istream & operator >> (istream & in, p_Vector & v) {
00075 copy(istream_iterator< p_line >(in), istream_iterator< p_line >(), back_inserter(v));
00076 return in;
00077 }
00078
00079 inline ostream & operator << (ostream & out, const p_Vector & v) {
00080 copy(v.begin(), v.end(), ostream_iterator< p_line >(out, "\n"));
00081 return out;
00082 }
00083 #endif
00084
00085
00086
00090 class BOSS_Transcription : public BOSS::Module {
00091
00092 protected:
00093 unsigned type_flag;
00094 #ifdef BONT
00095 t_SSMap e_table;
00096 #endif
00097 BOSS::FSA * pfsa;
00098 BOSS_context * cclass;
00099 #ifdef BONT
00100 virtual string queryExceptionLexicon(const string & item) const;
00101 #else
00102 virtual MySQL_Result queryExceptionLexicon(const string & table_name, const string & item) const;
00103 #endif
00104 virtual string delMorphBound(string & s) const;
00105 #ifndef BONT
00106 virtual void stringToDOM(const string & trans, xercesc::DOMNode * word) const;
00107 virtual void addPhonemeContext(xercesc::DOMNode * sentence) const;
00108 virtual void addPhrases(xercesc::DOMNode * sentence) const;
00109 virtual void addPhonemeNumber(xercesc::DOMNode * sentence) const;
00110 virtual void addHalfphones(xercesc::DOMNode * sentence) const;
00111 #endif
00112
00113 public:
00114
00115 BOSS_Transcription(BOSS::Config & c, MySQL_Handler * db);
00116 virtual ~BOSS_Transcription();
00117 virtual void setFlag(const unsigned &);
00118 virtual string getModuleType() {return "transcription"; }
00119
00120 };
00121
00123 #endif