00001 /*========================================================================== 00002 * Copyright (c) 2004 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 00013 // 00014 // DocumentVector 00015 // 00016 // An independent representation of a document term list, 00017 // suitable for network transmission. 00018 // 00019 00020 #ifndef INDRI_DOCUMENTVECTOR_HPP 00021 #define INDRI_DOCUMENTVECTOR_HPP 00022 00023 #include <string> 00024 #include <map> 00025 #include <vector> 00026 #include "indri/TermListBuilder.hpp" 00027 00028 class DocumentVector { 00029 public: 00030 struct Field { 00031 std::string name; 00032 int begin; 00033 int end; 00034 UINT64 number; 00035 }; 00036 00037 private: 00038 std::vector<std::string> _stems; 00039 std::vector<int> _positions; 00040 std::vector<Field> _fields; 00041 00042 void _init( class IndriIndex* index, const class indri::index::TermListBuilder* termList, std::map<int,std::string>* termStringMap ); 00043 00044 public: 00045 DocumentVector(); 00046 DocumentVector( class IndriIndex* index, const class indri::index::TermListBuilder* termList ); 00047 DocumentVector( class IndriIndex* index, const class indri::index::TermListBuilder* termList, std::map<int,std::string>& termStringMap ); 00048 00049 std::vector<std::string>& stems(); 00050 const std::vector<std::string>& stems() const; 00051 00052 std::vector<int>& positions(); 00053 const std::vector<int>& positions() const; 00054 00055 std::vector<Field>& fields(); 00056 const std::vector<Field>& fields() const; 00057 }; 00058 00059 #endif // INDRI_DOCUMENTVECTOR_HPP 00060 00061