Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

WordSet.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2001 Carnegie Mellon University.  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 #ifndef _WORDSET_HPP
00013 #define _WORDSET_HPP
00014 #include "Exception.hpp"
00015 #include <set>
00016 #include<cstring>
00017 #include "common_headers.hpp"
00018 namespace lemur 
00019 {
00020   namespace utility 
00021   {
00022 
00023 #ifndef _LT_STR
00024 #define _LT_STR
00025 
00026     /* for the set */
00027     struct lt_str
00028     {
00029       bool operator()(const char* s1, const char* s2) const
00030       {
00031         return strcmp(s1, s2) < 0;
00032       }
00033     };
00034 #endif
00035 
00036 
00038 
00045     class WordSet {
00046 
00047     public:
00048       WordSet();
00050       WordSet(const string &filename);
00051       ~WordSet();
00052 
00054       void load(const string &filename);
00056       void add(const char * word);
00058       bool contains(const char * word) const;
00059 
00061       void clear();
00062 
00063 
00064     protected:
00065   
00068       set<char *, lt_str> words;
00069       string lastfile;
00070 
00071     };
00072   }
00073 }
00074 
00075 #endif

Generated on Tue Jun 15 11:02:56 2010 for Lemur by doxygen 1.3.4