Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

boss_transcription.h

Go to the documentation of this file.
00001 /* boss_transcription.h    $Revision: 1.3 $ $Date: 2005/12/10 20:33:54 $
00002    Copyright (C) 2000 University of Bonn.
00003    http://www.ikp.uni-bonn.de/boss
00004 
00005    This program is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU General Public License
00007    as published by the Free Software Foundation; either version 2
00008    of the License, or (at your option) any later version.
00009 
00010    This program is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013    GNU General Public License for more details.
00014 
00015    You should have received a copy of the GNU General Public License
00016    along with this program; if not, write to the Free Software
00017    Foundation, Inc., 59 Temple Place - Suite 330,
00018    Boston, MA  02111-1307, USA.
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 //using namespace xercesc;
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 // data type for the phone table
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 //      virtual void operator () (xercesc::DOMNode * sentence) = 0;
00120 };
00121  // end of boss_transcription group
00123 #endif

Generated on Tue Dec 20 23:14:38 2005 for BOSS by doxygen 1.3.6