00001 /* boss_unitselection.h $Revision: 1.2 $ $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 00029 #ifndef BOSS_UNITSELECTION_H 00030 #define BOSS_UNITSELECTION_H 00031 00032 using namespace std; 00033 00034 #include <string> 00035 #include "xercesc/dom/DOM.hpp" 00036 #include "boss_utility/boss_module.h" 00037 #include "boss_utility/boss_config.h" 00038 #include "boss_mysql/boss_mysql_handler.h" 00039 #include "unit_level.h" 00040 #include "boss_node.h" 00041 #include "cost.h" 00042 #include "factory.h" 00043 00055 class BOSS_Unitselection : public BOSS::Module { 00056 00057 UnitLevel * word; 00058 UnitLevel * syllable; 00059 UnitLevel * phone; 00060 UnitLevel * halfphone; 00061 00062 UnitSelectionFactory * factory; 00063 Cost * unit_cost; 00064 00065 string lang; 00066 00067 // preselection functions 00068 bool rejectUnit (xercesc::DOMNode* node, 00069 const MySQL_Result & query_result, const unsigned &pos) const; 00070 void unitSelect(xercesc::DOMNode * sub_tree, UnitLevel * level); 00071 void PreSelection(UnitLevel * level, 00072 const xercesc::DOMNode* unit, 00073 MySQL_Result & query_result) const; 00074 00075 // graph functions 00076 void createUnitGraph(const xercesc::DOMNode * node, UNIT_Graph & unit_graph); 00077 void shortpath(UNIT_Graph & unit_graph); 00078 00079 00080 public: 00081 00082 BOSS_Unitselection(BOSS::Config & _cl, MySQL_Handler * _db); 00083 ~BOSS_Unitselection(); 00084 void operator () (xercesc::DOMNode * sentence); 00085 virtual string getDescription(); 00086 00087 }; 00088 00089 00090 00094 extern "C" BOSS::Module * create(BOSS::Config & _cl, MySQL_Handler * _db) { 00095 return new BOSS_Unitselection(_cl, _db); 00096 } 00097 00101 extern "C" void destroy(BOSS_Unitselection * cm) { 00102 delete cm; 00103 } 00104 //end of boss_unitselection group 00106 00107 #endif 00108