GOTO 
index
worddocmatrix<Str, T, Row, Container>
Defined in header file:  worddocmatrix.hh

Description

A worddocmatrix is a matrix where each column is associated with a word, also called a token. Each row in the matrix represents a document.

Public base classes

matrix

Template parameters

Parameter Description Default
Str The type of a string.  
T The value_type of the matrix, i.e. the type of the stored elements.  
Row The type of a row. unbounded_vector<T>
Container The associative container to store the words and their columns in the matrix. [4] STRMAP <Str, typename matrix<T, Row>::size_type>

Constructors

Constructor Description
worddocmatrix() Creates an empty word/document matrix.
worddocmatrix(const worddocmatrix& m) Copy constructor.

Members

Types Description
value_type The type (T) of the objects stored in the matrix.
pointer_type Pointer to T.
reference Reference to T.
const_reference Const reference to T.
size_type An unsigned integral type.
difference_type A signed integral type.
container_type The type (Container) of the container to store the string to column mapping.
row_type The type (Row) of a row.
string_type The string type of the tokens.
decoder A decoder to decode columns into tokens. [3]
const_decoder A const decoder to decode columns into tokens. [3]
iterator An iterator to iterate through the rows.
const_iterator Const iterator.
reverse_iterator An iterator to iterate backwards through the rows.
const_reverse_iterator Const backward iterator.
word_iterator Iterator to iterate through the words.
const_word_iterator Const iterator to iterate through the words.
Methods
template<typename InputIterator>
void  insert(InputIterator beg, InputIterator end)
Inserts a range of words.
size_type  insert(const Str& w) Inserts a single word and returns its column in the matrix.
template<typename InputIterator>
void  push_back(InputIterator beg, InputIterator end)
Inserts a new document at the end of the word/document matrix. [1]
template<typename InputIterator, typename Func>
void  push_back(InputIterator beg, InputIterator end, Func op)
Inserts a new document at the end of the word/document matrix. [1]
proxy  operator[](size_type n) Returns a proxy representing a row of the matrix. [2]
const_proxy  operator[](size_type n)   const Returns a const proxy. [2]
size_type  column(const Str& token)   const Returns the column of the given word or (size_type) -1 if it does not exist.
const string_type&  token(size_type n)   const Returns the token at the given column.
decoder  column_decoder(size_type offset = 0) Returns a column decoder which decodes a column number into its token. [3]
const_decoder  column_decoder(size_type offset = 0)   const Returns a const column decoder which decodes a column number into its token. [3]
size_type  words()   const Returns the number of words.
word_iterator  wbegin() Returns an iterator pointing to the first word.
word_iterator  wend() Returns an iterator pointing to the end.
const_word_iterator  wbegin()   const Returns a const iterator pointing to the first word.
const_word_iterator  wend()   const Returns a const iterator pointing to the end.

Notes

[1] XXX

[2] A proxy for a worddocmatrix is an helper class which allows access to columns of a row by the usage of tokens directly. Thus, an access like w[2]["xyz"] is possible which returns a reference to the element in the third row at the column which is associated with the token "xyz". A proxy can be directly assigned to a row_type since this operator is defined.

[3] XXX

[4] The default template argument for the string container depends on the compiler flags that are used. The container std::map is used for STRMAP if USE_CXX is defined (e.g. by giving the parameter -DUSE_CXX for GCC), otherwise __gnu_cxx::hash_map is used which is not part of the C++ standard template library.

index

Copyright © 2005-2006 Retrieval Solutions. All rights reserved.