reader Class Reference
[SimString SWIG interface]


Detailed Description

SimString database reader.


Public Member Functions

 reader (const char *filename)
 Opens a database for retrieving strings.
virtual ~reader ()
 Destructs the database reader.
std::vector< std::string > retrieve (const char *query)
 Retrieves strings that are similar to the query string.
void close ()
 Closes a database.

Data Fields

int measure
 Similarity measure.
double threshold
 Threshold for the similarity measure.


Constructor & Destructor Documentation

reader::reader ( const char *  filename  ) 

Opens a database for retrieving strings.

This function creates an instance of SimString database reader by opening an existing database. If this function failes to open the database, it throws SWIG_IOError.

Parameters:
filename The database filename.
Exceptions:
SWIG_IOError 

virtual reader::~reader (  )  [virtual]

Destructs the database reader.

Destructing the reader object automatically closes the database.


Member Function Documentation

std::vector<std::string> reader::retrieve ( const char *  query  ) 

Retrieves strings that are similar to the query string.

This function retrieves strings whose similarity with the query string are no smaller than a threshold. Before calling this function, set the similarity measure and threshold to measure and threshold attributes of the reader object.

Parameters:
query The query string. This argument must be a null-terminated byte stream. If the database was created with Unicode mode, this function assumes that the byte stream is encoded in UTF-8, and converts it into a wchar_t string.
Returns:
The array of strings retrieved for the query. If the database was created with Unicode mode, this function returns strings in UTF-8.
See also:
measure The similarity function used by this function.

threshold The similarity value used by this function.


Field Documentation

int reader::measure

Similarity measure.

Specify a similarity measure for approximate string retrieval used by retrieve() function.

See also:
exact, cosine, dice, jaccard, overlap

double reader::threshold

Threshold for the similarity measure.

Specify a threshold for approximate string retrieval used by retrieve() function.


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