ModErn Text Analysis
META Enumerates Textual Applications
state_analyzer.h
Go to the documentation of this file.
1 
9 #ifndef META_PARSER_STATE_ANALYZER_H_
10 #define META_PARSER_STATE_ANALYZER_H_
11 
12 #include "parser/sr_parser.h"
13 #include "parser/state.h"
14 
15 namespace meta
16 {
17 namespace parser
18 {
19 
25 {
26  public:
30  feature_vector featurize(const state& state) const;
31 
32  private:
38  void unigram_featurize(const state& state, feature_vector& feats) const;
39 
45  void bigram_featurize(const state& state, feature_vector& feats) const;
46 
52  void trigram_featurize(const state& state, feature_vector& feats) const;
53 
59  void children_featurize(const state& state, feature_vector& feats) const;
60 
66  void dependents_featurize(const state& state, feature_vector& feats) const;
67 
74  void unigram_stack_feats(const node* n, std::string prefix,
75  feature_vector& feats) const;
76 
85  void bigram_features(const node* n1, std::string name1, const node* n2,
86  std::string name2, feature_vector& feats) const;
87 
96  void child_feats(const node* n, std::string prefix, feature_vector& feats,
97  bool doubs) const;
98 };
99 }
100 }
101 
102 #endif
void bigram_features(const node *n1, std::string name1, const node *n2, std::string name2, feature_vector &feats) const
Adds bigram features to the feature vector.
Definition: state_analyzer.cpp:105
A single node in a parse tree for a sentence.
Definition: node.h:24
void trigram_featurize(const state &state, feature_vector &feats) const
Adds trigram features.
Definition: state_analyzer.cpp:133
Analyzer responsible for converting a parser state to a feature_vector.
Definition: state_analyzer.h:24
Represents the current parser state of a shift-reduce parser.
Definition: state.h:36
void children_featurize(const state &state, feature_vector &feats) const
Adds children features.
Definition: state_analyzer.cpp:174
std::unordered_map< std::string, float > feature_vector
Sparse vector representation of a state's features.
Definition: sr_parser.h:150
void child_feats(const node *n, std::string prefix, feature_vector &feats, bool doubs) const
Adds child features to the feature vector.
Definition: state_analyzer.cpp:190
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
void bigram_featurize(const state &state, feature_vector &feats) const
Adds bigram features.
Definition: state_analyzer.cpp:120
void unigram_stack_feats(const node *n, std::string prefix, feature_vector &feats) const
Adds unigram features from the parser stack.
Definition: state_analyzer.cpp:92
void unigram_featurize(const state &state, feature_vector &feats) const
Adds unigram features.
Definition: state_analyzer.cpp:69
feature_vector featurize(const state &state) const
Maps a state to its feature vector representation.
Definition: state_analyzer.cpp:48
void dependents_featurize(const state &state, feature_vector &feats) const
Adds dependent features.
Definition: state_analyzer.cpp:281