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 Author: dmf 11/2002 00013 */ 00014 00015 #ifndef _COSSIM_HPP 00016 #define _COSSIM_HPP 00017 #include "SimilarityMethod.hpp" 00018 #include "Index.hpp" 00019 namespace lemur 00020 { 00021 namespace cluster 00022 { 00024 class CosSim : public SimilarityMethod { 00025 public: 00027 CosSim(const lemur::api::Index &dbIndex); 00029 virtual ~CosSim(); 00031 void weigh(ClusterRep *rep) const {rep->weigh(idfV);} 00033 double similarity(const ClusterRep *vec1, const ClusterRep *vec2) const; 00035 const double *idfValues() const {return idfV;} 00036 00037 protected: 00038 const lemur::api::Index &ind; 00039 double *idfV; 00040 int numDocs, numTerms; 00041 }; 00042 } 00043 } 00044 00045 #endif /* _COSSIM_HPP */