00001 /* boss_morphtree.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 00026 #ifndef BOSS_MORPHTREE_H 00027 #define BOSS_MORPHTREE_H 00028 00029 using namespace std; 00030 00031 #include <list> 00032 #include "boss_transcription_de.h" 00033 00039 struct c_MorphNode { 00040 t_SubStringEntry inf; 00041 vector< c_MorphNode > nodes; 00042 c_MorphNode() {} 00043 c_MorphNode(const t_SubStringEntry & e) : inf(e) {} 00044 }; 00045 typedef list< const c_MorphNode * > t_MorphNodeList; 00046 typedef list< t_MorphNodeList > t_MorphNodeDList; 00047 inline bool operator < (const t_MorphNodeList & a, const t_MorphNodeList & b) 00048 { return a.size() < b.size(); } 00049 00050 inline ostream& operator << (ostream & out, const c_MorphNode & m) { 00051 return out << *m.inf.morph; 00052 } 00053 00057 class c_MorphTree { 00058 00059 private: 00060 c_MorphNode root; 00061 vector<vector<c_MorphNode> > res; 00062 void append(c_MorphNode & node, const t_SubStringEntryVector & entries); 00063 void _shortpath(const c_MorphNode & node, t_MorphNodeList & nlist, t_MorphNodeDList & res); 00064 void _print_tree(const c_MorphNode & node, vector<c_MorphNode>& cur); 00065 00066 public: 00067 c_MorphTree(const t_SubStringEntryVector & entries); 00068 ~c_MorphTree(); 00069 void shortpath(t_SubStringEntryDList & reslist); 00070 void print_tree(); 00071 }; 00072 // end of boss_transcription group 00074 #endif