ModErn Text Analysis
META Enumerates Textual Applications
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
meta::index::disk_index Class Reference

Holds generic data structures and functions that inverted_index and forward_index both use. More...

#include <disk_index.h>

Inheritance diagram for meta::index::disk_index:
meta::index::forward_index meta::index::inverted_index

Classes

class  disk_index_impl
 The implementation of a disk_index. More...
 

Public Member Functions

virtual ~disk_index ()=default
 Default destructor.
 
std::string index_name () const
 
uint64_t num_docs () const
 
std::string doc_name (doc_id d_id) const
 
std::string doc_path (doc_id d_id) const
 
std::vector< doc_id > docs () const
 
uint64_t doc_size (doc_id d_id) const
 
class_label label (doc_id d_id) const
 
label_id lbl_id (doc_id d_id) const
 
label_id id (class_label label) const
 
class_label class_label_from_id (label_id l_id) const
 
uint64_t num_labels () const
 
std::vector< class_label > class_labels () const
 
corpus::metadata metadata (doc_id d_id) const
 
template<class T >
util::optional< T > metadata (doc_id d_id, const std::string &name) const
 
virtual uint64_t unique_terms (doc_id d_id) const
 
virtual uint64_t unique_terms () const
 
term_id get_term_id (const std::string &term)
 
std::string term_text (term_id t_id) const
 
 disk_index (disk_index &&)=default
 Move constructs a disk_index.
 
disk_indexoperator= (disk_index &&)=default
 Move assigns a disk_index.
 

Protected Member Functions

 disk_index (const cpptoml::table &config, const std::string &name)
 Constructor. More...
 
 disk_index (const disk_index &)=delete
 disk_index may not be copy-constructed.
 
disk_indexoperator= (const disk_index &)=delete
 disk_index may not be copy-assigned.
 

Protected Attributes

util::pimpl< disk_index_implimpl_
 Implementation of this disk_index.
 

Detailed Description

Holds generic data structures and functions that inverted_index and forward_index both use.

Provides common interface for both and is implemented using the pointer-to-implementation method.

Constructor & Destructor Documentation

§ disk_index()

meta::index::disk_index::disk_index ( const cpptoml::table &  config,
const std::string &  name 
)
protected

Constructor.

Parameters
configThe config settings used to create this index
nameThe name of this disk_index

Member Function Documentation

§ index_name()

std::string meta::index::disk_index::index_name ( ) const
Returns
the name of this index

§ num_docs()

uint64_t meta::index::disk_index::num_docs ( ) const
Returns
the number of documents in this index

§ doc_name()

std::string meta::index::disk_index::doc_name ( doc_id  d_id) const
Parameters
d_id
Returns
the actual name of this document

§ doc_path()

std::string meta::index::disk_index::doc_path ( doc_id  d_id) const
Parameters
d_id
Returns
the path to the file containing this document

§ docs()

std::vector< doc_id > meta::index::disk_index::docs ( ) const
Returns
a vector of doc_ids that are contained in this index

§ doc_size()

uint64_t meta::index::disk_index::doc_size ( doc_id  d_id) const
Parameters
d_idThe document to search for
Returns
the size of the given document (the total number of terms occurring)

§ label()

class_label meta::index::disk_index::label ( doc_id  d_id) const
Parameters
d_idThe doc id to find the class label for
Returns
the label of the class that the document belongs to, or an empty string if a label was not assigned

§ lbl_id()

label_id meta::index::disk_index::lbl_id ( doc_id  d_id) const
Parameters
d_idThe doc id to find the label_id for
Returns
the label_id of the class that to document belongs to

§ id()

label_id meta::index::disk_index::id ( class_label  label) const
Parameters
labelThe class label
Returns
the label_id for the given class label

§ class_label_from_id()

class_label meta::index::disk_index::class_label_from_id ( label_id  l_id) const
Parameters
l_idThe id of the class label in question
Returns
the integer label id of a document

§ num_labels()

uint64_t meta::index::disk_index::num_labels ( ) const
Returns
the number of labels in this index

§ class_labels()

std::vector< class_label > meta::index::disk_index::class_labels ( ) const
Returns
the distinct class labels possible for documents in this index

§ metadata() [1/2]

corpus::metadata meta::index::disk_index::metadata ( doc_id  d_id) const
Parameters
d_idThe document id to fetch metadata for
Returns
the metadata associated with this document id

§ metadata() [2/2]

template<class T >
util::optional<T> meta::index::disk_index::metadata ( doc_id  d_id,
const std::string &  name 
) const
inline
Parameters
d_idThe document to fetch the metadata field for
nameThe name of the metadata field to be returned
Returns
the metadata field value, if it exists

§ unique_terms() [1/2]

uint64_t meta::index::disk_index::unique_terms ( doc_id  d_id) const
virtual
Parameters
d_id
Returns
the number of unique terms in d_id

§ unique_terms() [2/2]

uint64_t meta::index::disk_index::unique_terms ( ) const
virtual
Returns
the number of unique terms in the index

Reimplemented in meta::index::forward_index.

§ get_term_id()

term_id meta::index::disk_index::get_term_id ( const std::string &  term)
Parameters
term
Returns
the term_id associated with the parameter

§ term_text()

std::string meta::index::disk_index::term_text ( term_id  t_id) const
Parameters
t_idThe term_id to get the original text for
Returns
the string representation of the term

The documentation for this class was generated from the following files: