00001 /*========================================================================== 00002 * Copyright (c) 2003-2004 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // KrovetzStemmerTransformation.hpp 00015 // 00016 // 13 May 2004 -- tds 00017 // 00018 00019 #ifndef INDRI_KROVETZSTEMMERTRANSFORMATION_HPP 00020 #define INDRI_KROVETZSTEMMERTRANSFORMATION_HPP 00021 00022 #include "indri/Transformation.hpp" 00023 #include "indri/Parameters.hpp" 00024 00025 class KrovetzStemmerTransformation : public Transformation { 00026 private: 00027 char* _stemBuffer; 00028 int _stemBufferSize; 00029 ObjectHandler<ParsedDocument>* _handler; 00030 00031 char* _getBuffer( size_t length ); 00032 const char* _getBufferEnd() const; 00033 ParsedDocument* _restart( ParsedDocument* document, size_t lastIndex, char* endOfStemming ); 00034 ParsedDocument* _processTerms( ParsedDocument* document, size_t start, char* stem, const char* end ); 00035 char* KrovetzStemmerTransformation::_growBuffer( size_t length, char* oldEnd ); 00036 00037 public: 00038 KrovetzStemmerTransformation( Parameters& parameters ); 00039 ~KrovetzStemmerTransformation(); 00040 00041 ParsedDocument* transform( ParsedDocument* document ); 00042 00043 void setHandler( ObjectHandler<ParsedDocument>& handler ); 00044 void handle( ParsedDocument* document ); 00045 }; 00046 00047 #endif // INDRI_KROVETZSTEMMERTRANSFORMATION_HPP 00048