ModErn Text Analysis
META Enumerates Textual Applications
alpha_filter.h
Go to the documentation of this file.
1 
9 #ifndef META_ALPHA_FILTER_H_
10 #define META_ALPHA_FILTER_H_
11 
12 #include "analyzers/token_stream.h"
13 #include "util/clonable.h"
14 #include "util/optional.h"
15 
16 namespace meta
17 {
18 namespace analyzers
19 {
20 namespace filters
21 {
22 
27 class alpha_filter : public util::clonable<token_stream, alpha_filter>
28 {
29  public:
34  alpha_filter(std::unique_ptr<token_stream> source);
35 
40  alpha_filter(const alpha_filter& other);
41 
46  void set_content(const std::string& content) override;
47 
51  std::string next() override;
52 
56  operator bool() const override;
57 
59  const static std::string id;
60 
61  private:
65  void next_token();
66 
68  std::unique_ptr<token_stream> source_;
69 
72 };
73 }
74 }
75 }
76 #endif
Filter that removes "non-letter" characters from tokens.
Definition: alpha_filter.h:27
alpha_filter(std::unique_ptr< token_stream > source)
Constructs an alpha filter reading tokens from the given source.
Definition: alpha_filter.cpp:19
static const std::string id
Identifier for this filter.
Definition: alpha_filter.h:59
util::optional< std::string > token_
The buffered token.
Definition: alpha_filter.h:71
void set_content(const std::string &content) override
Sets the content for the beginning of the filter chain.
Definition: alpha_filter.cpp:31
Template class to facilitate polymorphic cloning.
Definition: clonable.h:28
std::unique_ptr< token_stream > source_
The source to read tokens from.
Definition: alpha_filter.h:68
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retreival, data mining, and other applications of text processing.
Definition: analyzer.h:24
std::string next() override
Obtains the next token in the sequence.
Definition: alpha_filter.cpp:37
void next_token()
Finds the next valid token for this filter.
Definition: alpha_filter.cpp:44