Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

DocumentVector.hpp

Go to the documentation of this file.
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/Index.hpp"
00027 namespace indri 
00028 {
00030   namespace api 
00031   {
00032 
00033     class DocumentVector {
00034     public:
00035       struct Field {
00036         std::string name;
00037         int begin;
00038         int end;
00039         INT64 number;
00040         int ordinal;
00041         int parentOrdinal;
00042 
00043         Field() { }
00044         Field(const indri::index::FieldExtent &f) {
00045           begin=f.begin;
00046           end=f.end;
00047           number=f.number;
00048           ordinal=f.ordinal;
00049           parentOrdinal=f.parentOrdinal;
00050         }
00051       };
00052 
00053     private:
00054       std::vector<std::string> _stems;
00055       std::vector<int> _positions;
00056       std::vector<Field> _fields;
00057 
00058       void _init( indri::index::Index* index, const class indri::index::TermList* termList, std::map<int,std::string>* termStringMap );
00059 
00060     public:
00061       DocumentVector();
00062       DocumentVector( indri::index::Index* index, const class indri::index::TermList* termList );
00063       DocumentVector( indri::index::Index* index, const class indri::index::TermList* termList, std::map<int,std::string>& termStringMap );
00064 
00065       std::vector<std::string>& stems();
00066       const std::vector<std::string>& stems() const;
00067 
00068       std::vector<int>& positions();
00069       const std::vector<int>& positions() const;
00070 
00071       std::vector<Field>& fields();
00072       const std::vector<Field>& fields() const;
00073     };
00074   }
00075 }
00076 
00077 #endif // INDRI_DOCUMENTVECTOR_HPP
00078 
00079 

Generated on Tue Jun 15 11:02:53 2010 for Lemur by doxygen 1.3.4