00001 /* boss_g2pmatrix.h $Revision: 1.2 $ $Date: 2005/12/10 20:33:54 $ 00002 Copyright (C) 2001 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 00025 #ifndef BOSSG2PMATRIX_H 00026 #define BOSSG2PMATRIX_H 00027 00028 00029 00034 #include <iostream> 00035 #include <stdlib.h> 00036 #include <string> 00037 #include <vector> 00038 #include <map> 00039 #include <fstream> 00040 #include <sstream> 00041 #include "boss_utility/boss_utility.h" 00042 #include "tdsp/dsp_matrix.h" 00043 00044 typedef map< string, unsigned > t_GPTableMap; 00045 typedef pair< unsigned, double > t_UDPair; 00046 00047 class BOSS_g2pMatrix { 00048 public: 00049 BOSS_g2pMatrix(const BOSS::t_SVector & gv, const BOSS::t_SVector & pv); 00050 ~BOSS_g2pMatrix(); 00051 void add_value(const string & graph, const string & phon, const unsigned & value); 00052 void set_value(const string & graph, const string & phon, const double & value); 00053 void compute_prob(); 00054 t_UDPair get_value(const string & graph, const string & phon); 00055 BOSS::t_SVector get_graphemes(); 00056 BOSS::t_SVector get_phones(); 00057 BOSS::t_SVector get_matrix(); 00058 protected: 00059 t_GPTableMap gm; 00060 t_GPTableMap pm; 00061 dsp::matrix<t_UDPair> matrix; 00062 void t_SVectorToMap(const BOSS::t_SVector & v, t_GPTableMap & m); 00063 }; 00064 00065 00066 #endif