ModErn Text Analysis
META Enumerates Textual Applications
transition.h
Go to the documentation of this file.
1 
9 #ifndef META_PARSER_TRANSITION_H_
10 #define META_PARSER_TRANSITION_H_
11 
12 #include "meta.h"
13 #include "util/optional.h"
14 #include "util/comparable.h"
15 
16 namespace meta
17 {
18 namespace parser
19 {
20 
21 MAKE_NUMERIC_IDENTIFIER(trans_id, uint16_t)
22 
23 
27 class transition : public util::comparable<transition>
28 {
29  public:
33  enum class type_t
34  {
35  SHIFT = 0,
36  REDUCE_L,
37  REDUCE_R,
38  UNARY,
39  FINALIZE,
40  IDLE
41  };
42 
49  transition(type_t t);
50 
58  transition(type_t t, class_label lbl);
59 
63  type_t type() const;
64 
68  const class_label& label() const;
69 
75  bool operator<(const transition& rhs) const;
76 
80  class exception : public std::runtime_error
81  {
82  public:
83  using std::runtime_error::runtime_error;
84  };
85 
86  private:
91 
96 };
97 
104 std::ostream& operator<<(std::ostream& os, const transition& trans);
105 
112 std::ostream& operator<<(std::ostream& os, const transition::type_t type);
113 
114 }
115 }
116 
117 #endif
Contains top-level namespace documentation for the META toolkit.
std::ostream & operator<<(std::ostream &os, const transition &trans)
Prints a transition to the stream.
Definition: transition.cpp:105
type_t type_
The type of this transition.
Definition: transition.h:90
class_label label(const std::string &text)
Extracts a class_label from a string in libsvm format.
Definition: libsvm_parser.cpp:18
Represents a transition taken by the parser.
Definition: transition.h:27
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
util::optional< class_label > label_
The label of this transition, if it exists.
Definition: transition.h:95
Exception thrown during interactions with transitions.
Definition: transition.h:80
type_t
The transition types.
Definition: transition.h:33