ModErn Text Analysis
META Enumerates Textual Applications
leaf_node_finder.h
Go to the documentation of this file.
1 
9 #ifndef META_PARSER_LEAF_NODE_FINDER_H_
10 #define META_PARSER_LEAF_NODE_FINDER_H_
11 
12 #include <memory>
13 #include <vector>
14 
15 #include "parser/trees/visitors/visitor.h"
16 
17 namespace meta
18 {
19 namespace parser
20 {
21 
29 class leaf_node_finder : public const_visitor<void>
30 {
31  public:
32  void operator()(const leaf_node&) override;
33  void operator()(const internal_node&) override;
34 
41  std::vector<std::unique_ptr<leaf_node>> leaves();
42 
43  private:
45  std::vector<std::unique_ptr<leaf_node>> leaves_;
46 };
47 
48 
49 }
50 }
51 
52 #endif
void operator()(const leaf_node &) override
Definition: leaf_node_finder.cpp:16
An internal node in a parse tree.
Definition: internal_node.h:28
std::vector< std::unique_ptr< leaf_node > > leaves()
Returns the leaf nodes found by the visitor.
Definition: leaf_node_finder.cpp:29
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
Abstract base class for visitors over parse trees that do not modify the underlying tree...
Definition: visitor.h:25
This is a visitor that finds all of the leaf nodes in a parse tree.
Definition: leaf_node_finder.h:29
std::vector< std::unique_ptr< leaf_node > > leaves_
The storage for the leaf nodes found so far.
Definition: leaf_node_finder.h:45
A leaf node (pre-terminal) in a parse tree.
Definition: leaf_node.h:24