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" 00020 class CosSim : public SimilarityMethod { 00021 public: 00023 CosSim(const Index &dbIndex); 00025 virtual ~CosSim(); 00027 void weigh(ClusterRep *rep) const {rep->weigh(idfV);} 00029 double similarity(const ClusterRep *vec1, const ClusterRep *vec2) const; 00031 const double *idfValues() const {return idfV;} 00032 00033 protected: 00034 const Index &ind; 00035 double *idfV; 00036 int numDocs, numTerms; 00037 }; 00038 00039 #endif /* _COSSIM_HPP */