00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. 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 00013 #ifndef _DOCUMENTREP_HPP 00014 #define _DOCUMENTREP_HPP 00015 00016 #include "DocInfoList.hpp" 00017 00018 namespace lemur 00019 { 00020 namespace api 00021 { 00022 00023 //------------------------------------------------------------ 00024 // Abstract Interface for Document Representation 00025 //------------------------------------------------------------ 00026 00028 00029 class DocumentRep { 00030 public: 00031 DocumentRep(DOCID_T docID, int dl = 1) : id(docID), docLength(dl) {} 00032 virtual ~DocumentRep() {} 00033 00035 virtual double termWeight(TERMID_T termID, const DocInfo *info) const = 0; 00036 00038 virtual double scoreConstant() const = 0 ; 00041 void setDocLength(int len) { docLength = len;} 00042 00045 int getDocLength() const { return docLength;} 00048 DOCID_T getID() const { return id;} 00049 00050 protected: 00051 DOCID_T id; 00052 int docLength; 00053 }; 00054 } 00055 } 00056 00057 #endif /* _DOCUMENTREP_HPP */