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

boss_node.h

Go to the documentation of this file.
00001 /* boss_node.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 
00027 #ifndef BOSS_NODE_H
00028 #define BOSS_NODE_H
00029 
00030 using namespace std;
00031 
00032 #include <string>
00033 #include <vector>
00034 #include "xercesc/dom/DOM.hpp"
00035 #include "tdsp/dsp_vector.h"
00036 #include "boss_utility/dom_userdata.h"
00037 #include "boss_utility/dom_tools.h" // included for getAttrByName in the constructor ($p)
00038 #include "boss_utility/boss_config.h"
00039 
00048 class BOSS_Node {
00049   
00050   friend ostream & operator << (ostream & out, const BOSS_Node & n);
00051 
00052  public:
00053   enum Node_Type {
00054     UNKNOWN  = 0,
00055     WORD     = 1,
00056     MORPHEME = 2,
00057     SYLLABLE = 3,
00058     PHONE  = 4,
00059     HALFPHONE = 5,
00060     INITIAL  = 6,
00061     FINAL    = 7
00062   };
00063   
00064  protected:
00065   BOSS::Config & cl;
00066   const xercesc::DOMNode * unit_node;
00067   DOM_UserData * user_data;
00068   Node_Type type;
00069   unsigned pos;
00070   double cost;
00071   BOSS_Node *pred;
00072   
00073   // Cost function speedup
00074   unsigned Num;
00075   string tkey;
00076   string treal;                                 
00077   string cleft;
00078   string cright;
00079   string pmode;
00080   int pint;
00081   unsigned first;
00082   unsigned last;
00083   unsigned stress;
00084   float lf0;
00085   float rf0;
00086   float avgf0;
00087   float rms;
00088   dsp::vector< float > lmel;
00089   dsp::vector< float > rmel;
00090   vector< float > makeVector(string tmp) const;
00091 
00092  public:
00093   BOSS_Node(BOSS::Config & cl);
00094   BOSS_Node(const BOSS_Node & b);
00095   BOSS_Node(BOSS::Config & cl, const Node_Type & t);
00096   BOSS_Node(BOSS::Config & cl, const xercesc::DOMNode * node, const Node_Type & t, const unsigned & p);
00097   virtual ~BOSS_Node();
00098   BOSS_Node & operator = (const BOSS_Node & b);
00099   string getResult(const string & q) const { return user_data->getResult(pos, q); }
00100   DOM_UserData * getUserData() const { return user_data; }
00101   inline Node_Type getNodeType() const { return type; }
00102   inline bool BOSS_Node::realNode() const
00103     {
00104       switch(type) {
00105       case INITIAL:
00106       case FINAL:
00107         return false;
00108         break;
00109       default:
00110         return true;
00111         break;
00112       }
00113       return true;
00114     }
00115   bool virtualNode() const { return !realNode(); }
00116   inline double getCost() const { return cost; }
00117   inline void setCost(double c) { cost = c; }
00118   inline void setPredecessor(BOSS_Node * predecessor) { pred = predecessor; }
00119   inline BOSS_Node * getPredecessor() const { return pred; }
00120   inline unsigned getPosition() const { return pos; }
00121   
00122 };
00123 
00124 
00128 typedef vector< BOSS_Node* > UNIT_Graph_Column;
00132 typedef vector< UNIT_Graph_Column > UNIT_Graph;
00133 
00134 ostream & operator << (ostream & out, const BOSS_Node::Node_Type & t);
00135 ostream & operator << (ostream & out, const UNIT_Graph_Column & c);
00136 ostream & operator << (ostream & out, const UNIT_Graph & g);
00137  //end of boss_unitselection group
00139 
00140 #endif
00141 

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