00001 00002 /*========================================================================== 00003 * Copyright (c) 2001 Carnegie Mellon University. All Rights Reserved. 00004 * 00005 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00006 * is subject to the terms of the software license set forth in the LICENSE 00007 * file included with this software, and also available at 00008 * http://www.lemurproject.org/license.html 00009 * 00010 *========================================================================== 00011 */ 00012 00013 00014 #ifndef _SCOREFUNCTION_HPP 00015 #define _SCOREFUNCTION_HPP 00016 00017 #include "TextQueryRep.hpp" 00018 #include "DocumentRep.hpp" 00019 00020 namespace lemur 00021 { 00022 namespace api 00023 { 00024 00025 //------------------------------------------------------------ 00026 // Abstract Interface for Inverted index based Retrieval Function 00027 //------------------------------------------------------------ 00028 00030 00039 class ScoreFunction { 00040 public: 00042 virtual double matchedTermWeight(const QueryTerm *qTerm, const TextQueryRep *qRep, const DocInfo *info, const DocumentRep *dRep) const { 00043 return (qTerm->weight()*dRep->termWeight(qTerm->id(),info)); 00044 } 00045 00047 virtual double adjustedScore(double origScore, const TextQueryRep *qRep, const DocumentRep *dRep) const { 00048 return origScore; 00049 } 00050 }; 00051 } 00052 } 00053 #endif /* _SCOREFUNCTION_HPP */ 00054 00055