2014-09-16 08:09:27 -04:00
|
|
|
/**
|
|
|
|
* @file
|
2013-08-25 10:33:48 -04:00
|
|
|
* Copyright 2013 (c) Anna Schumaker.
|
|
|
|
*/
|
2014-06-21 09:37:47 -04:00
|
|
|
#ifndef OCARINA_CORE_FILTER_H
|
|
|
|
#define OCARINA_CORE_FILTER_H
|
2013-08-25 10:33:48 -04:00
|
|
|
|
2014-03-12 20:23:34 -04:00
|
|
|
#include <set>
|
2013-08-25 10:33:48 -04:00
|
|
|
#include <string>
|
|
|
|
|
2014-09-16 08:09:27 -04:00
|
|
|
/**
|
|
|
|
* Namespace for searching the tag database.
|
|
|
|
*/
|
2013-08-25 10:33:48 -04:00
|
|
|
namespace filter {
|
|
|
|
|
2014-09-16 08:09:27 -04:00
|
|
|
/**
|
|
|
|
* Break a string into words and add each word to an index.
|
|
|
|
*
|
|
|
|
* @param text The text to parse.
|
|
|
|
* @param id An identifier paired with the text.
|
|
|
|
* @return The lowercase form of the input text.
|
|
|
|
*/
|
2014-03-15 20:44:07 -04:00
|
|
|
std::string add(const std::string &, unsigned int);
|
2014-09-16 08:09:27 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Search the entire index for identifiers paired with the input text.
|
|
|
|
*
|
|
|
|
* @param text The text to search for.
|
|
|
|
* @param res The results set will be filled in with the ids found.
|
|
|
|
*/
|
2013-08-25 10:33:48 -04:00
|
|
|
void search(const std::string &, std::set<unsigned int> &);
|
2014-09-16 08:09:27 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the lowercase version of the input text.
|
|
|
|
*
|
|
|
|
* @param text The text to be converted into lowercase.
|
|
|
|
*/
|
2014-03-15 20:44:07 -04:00
|
|
|
std::string lowercase(const std::string &);
|
2013-08-25 10:33:48 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2014-06-21 09:37:47 -04:00
|
|
|
#endif /* OCARINA_CORE_FILTER_H */
|