Tanl Linguistic Pipeline |
00001 /* 00002 ** Tanl 00003 ** text/Suffixes.h 00004 ** ---------------------------------------------------------------------- 00005 ** Copyright (c) 2003 Giuseppe Attardi (attardi@di.unipi.it). 00006 ** ---------------------------------------------------------------------- 00007 ** 00008 ** This file is part of Tanl. 00009 ** 00010 ** Tanl is free software; you can redistribute it and/or modify it 00011 ** under the terms of the GNU General Public License, version 3, 00012 ** as published by the Free Software Foundation. 00013 ** 00014 ** Tanl is distributed in the hope that it will be useful, 00015 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 ** GNU General Public License for more details. 00018 ** 00019 ** You should have received a copy of the GNU General Public License 00020 ** along with this program. If not, see <http://www.gnu.org/licenses/>. 00021 ** ---------------------------------------------------------------------- 00022 */ 00023 00024 #ifndef Tanl_Text_Suffixes_H 00025 #define Tanl_Text_Suffixes_H 00026 00027 #include <fstream> 00028 #include <string> 00029 #include <vector> 00030 00031 namespace Tanl { 00032 namespace Text { 00033 00037 class Suffixes : public std::vector<const char*> 00038 { 00039 public: 00040 Suffixes() { } 00041 00045 Suffixes(char const* file); 00046 00047 Suffixes(std::string& file); 00048 00049 ~Suffixes(); 00050 00057 char const* match(char const* word); 00058 00065 char const* match(std::string const& word) { return match(word.c_str()); } 00066 00067 void insert(char const* suff); 00068 00072 void store(char const* file); 00073 00077 void load(char const* file); 00078 00079 private: 00080 void load(std::ifstream& ifs); 00081 }; 00082 00083 } // Text 00084 } // Tanl 00085 00086 #endif // Tanl_Text_Suffixes_H