Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

FlatFileClusterDB.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2002 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010 */
00011 
00012 // Peter Amstutz
00013 // init: 12/17/2002
00014 #ifndef _FLATFILECLUSTERDB_HPP
00015 #define _FLATFILECLUSTERDB_HPP
00016 
00017 #include "ClusterDB.hpp"
00018 #include "IndexedReal.hpp"
00019 #include <string>
00024 class FlatFileClusterDB : public ClusterDB {
00025 
00026 public:
00028   FlatFileClusterDB(const Index *ind, 
00029                     const string &name,                    
00030                     double threshold = 0.25,
00031                     enum ClusterParam::simTypes simType = ClusterParam::COS,
00032                     enum ClusterParam::clusterTypes 
00033                       clusterType = ClusterParam::CENTROID,
00034                     enum ClusterParam::docModes docMode = ClusterParam::DMAX);
00035 
00037   virtual ~FlatFileClusterDB();
00038 
00040   virtual vector<Cluster*> getDocCluster(DOCID_T docId) const;
00041 
00043   virtual int countClusters() const {return clusterCount - 1;}
00044 
00046   virtual int maxID() const{return clusterIdCounter - 1;}
00047 
00049   virtual Cluster *getCluster(int clusterId) const;
00050 
00052   virtual vector<int> getDocClusterId(DOCID_T docId) const;
00053 
00055   virtual int addToCluster(DOCID_T docId, int clusterId, double score);
00056 
00058   virtual int addToCluster(DOCID_T docId, Cluster *cluster, double score);
00059 
00061   virtual int removeFromCluster(DOCID_T docId, int clusterID);
00062 
00064   virtual int deleteCluster(int clusterID);
00065 
00067   virtual int deleteCluster(Cluster * cluster);
00068 
00070   virtual vector<int> splitCluster(int cid, int num = 2);
00071 
00073   virtual int mergeClusters(int cid1, int cid2);
00074 
00075 protected:
00077   virtual Cluster * newCluster();
00078 
00079 private:
00080   int clusterCount;
00081   int clusterIdCounter;
00082   string clusterDB;
00084   int *doc2cluster;
00085   void readClusterDB();
00086   void writeClusterDB();
00087   void init(const string &name);
00088 };
00089 #endif

Generated on Wed Nov 3 12:58:55 2004 for Lemur Toolkit by doxygen1.2.18