00001 /* boss_cartreader.h $Revision: 1.3 $ $Date: 2005/12/10 20:33:53 $ 00002 Copyright (C) 2005 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 using namespace std; 00027 00028 #ifndef BOSS_CARTREADER_H 00029 #define BOSS_CARTREADER_H 00030 00031 #include <iostream> 00032 #include <fstream> 00033 #include <sstream> 00034 #include <map> 00035 #include <string> 00036 00041 typedef map<string, string> FMap; 00042 00044 struct CART_node { 00045 string question; 00046 CART_node* up; 00047 CART_node* left; 00048 CART_node* right; 00049 CART_node() : question(""), up(NULL), left(NULL), right(NULL) {}; 00050 }; 00051 00052 00056 class BOSS_CartReader{ 00057 public: 00058 00059 //BOSS_CartReader(); 00060 BOSS_CartReader(string file); 00061 CART_node* Classify(FMap & features) const; 00062 ~BOSS_CartReader(); 00063 00064 private: 00065 00066 CART_node* root; 00067 CART_node* LoadTree(ifstream & source); 00068 void DelTree(CART_node* cur); 00069 void PrintTree(CART_node* cur) const; 00070 }; 00071 // end of boss_cartreader group 00073 00074 #endif // BOSS_CARTREADER_H