Initial import into git.
[galago.git] / cpp / galago / include / Stopper.hpp
blobca8531151143466abb2cbd566b56bab0d9a851cb
2 //
3 // Stopper
4 //
5 // 11 January 2007 -- tds
6 //
8 #ifndef GALAGO_STOPPER_HPP
9 #define GALAGO_STOPPER_HPP
11 #include <set>
13 class Stopper {
14 private:
15 std::set<std::string> _terms;
17 public:
18 Stopper( indri::api::Parameters& parameters ) {
19 indri::api::Parameters stopwords = parameters["stopper"]["word"];
21 for( size_t i=0; i<stopwords.size(); i++ ) {
22 _terms.insert( (std::string) stopwords[i] );
26 bool isStopword( const std::string& word ) {
27 return _terms.find(word) != _terms.end();
30 void process( std::string& word ) {
31 if( isStopword(word) ) {
32 word = "";
37 #endif // GALAGO_STOPPER_HPP