simstring::reader Class Reference

Inheritance diagram for simstring::reader:

simstring::ngramdb_reader_base< uint32_t >

Detailed Description

A SimString database reader.

This template class retrieves string from a SimString database.

Inheriting the base class ngramdb_reader_base that retrieves string IDs from a query feature set, this class manages the master string table, which maintains associations between strings and string IDs.


Public Types

typedef ngram_generator ngram_generator_type
 The type of an n-gram generator.
typedef ngramdb_reader_base<
uint32_t > 
base_type
 The type of the base class.

Public Member Functions

 reader ()
 Constructs an object.
virtual ~reader ()
 Destructs an object.
bool open (const std::string &name)
 Opens a SimString database.
void close ()
 Closes the database.
template<class string_type, class insert_iterator>
void retrieve (const string_type &query, int measure, double alpha, insert_iterator ins)
 Retrieves strings that are similar to the query.
template<class measure_type, class string_type, class insert_iterator>
void retrieve (const string_type &query, double alpha, insert_iterator ins)
 Retrieves strings that are similar to the query.

Protected Attributes

std::vector< char > m_strings
 The content of the master file.


Member Function Documentation

bool simstring::reader::open ( const std::string &  name  )  [inline]

Opens a SimString database.

Parameters:
name The name of the SimString database.
Returns:
bool true if the database is successfully opened, false otherwise.

template<class string_type, class insert_iterator>
void simstring::reader::retrieve ( const string_type &  query,
int  measure,
double  alpha,
insert_iterator  ins 
) [inline]

Retrieves strings that are similar to the query.

Parameters:
query The query string.
measure The similarity measure.
alpha The threshold for approximate string matching.
ins The insert iterator that receives retrieved strings.
See also:
simstring::exact, simstring::dice, simstring::cosine, simstring::jaccard, simstring::overlap

template<class measure_type, class string_type, class insert_iterator>
void simstring::reader::retrieve ( const string_type &  query,
double  alpha,
insert_iterator  ins 
) [inline]

Retrieves strings that are similar to the query.

Parameters:
measure_type The similarity measure.
query The query string.
alpha The threshold for approximate string matching.
ins The insert iterator that receives retrieved strings.
See also:
simstring::measure::exact, simstring::measure::dice, simstring::measure::cosine, simstring::measure::jaccard, simstring::measure::overlap


Copyright (c) 2002-2010 by Naoaki Okazaki
Sun Mar 7 18:17:17 2010