ModErn Text Analysis
META Enumerates Textual Applications
evalb.h
Go to the documentation of this file.
1 
9 #ifndef META_PARSER_EVALB_H_
10 #define META_PARSER_EVALB_H_
11 
13 
14 namespace meta
15 {
16 namespace parser
17 {
18 
25 class evalb
26 {
27  public:
31  uint64_t matched() const
32  {
33  return proposed_correct_;
34  }
35 
39  uint64_t proposed_total() const
40  {
41  return proposed_total_;
42  }
43 
47  uint64_t gold_total() const
48  {
49  return gold_total_;
50  }
51 
55  double labeled_precision() const
56  {
57  return static_cast<double>(matched()) / proposed_total() * 100;
58  }
59 
63  double labeled_recall() const
64  {
65  return static_cast<double>(matched()) / gold_total() * 100;
66  }
67 
71  double labeled_f1() const
72  {
73  return 2 * (labeled_precision() * labeled_recall())
75  }
76 
81  double perfect() const
82  {
83  return static_cast<double>(perfect_) / total_trees_ * 100;
84  }
85 
89  double average_crossing() const
90  {
91  return static_cast<double>(crossed_) / total_trees_;
92  }
93 
97  double zero_crossing() const
98  {
99  return static_cast<double>(zero_crossing_) / total_trees_ * 100;
100  }
101 
106  void add_tree(parse_tree proposed, parse_tree gold);
107 
108  private:
112  uint64_t proposed_correct_ = 0;
113 
117  uint64_t proposed_total_ = 0;
118 
122  uint64_t gold_total_ = 0;
123 
127  uint64_t perfect_ = 0;
128 
132  uint64_t crossed_ = 0;
133 
137  uint64_t zero_crossing_ = 0;
138 
142  uint64_t total_trees_ = 0;
143 };
144 }
145 }
146 #endif
uint64_t perfect_
The number of parse trees that were perfect matches with gold trees.
Definition: evalb.h:127
uint64_t matched() const
Definition: evalb.h:31
double labeled_recall() const
Definition: evalb.h:63
Represents the parse tree for a sentence.
Definition: parse_tree.h:32
uint64_t proposed_total() const
Definition: evalb.h:39
double labeled_f1() const
Definition: evalb.h:71
void add_tree(parse_tree proposed, parse_tree gold)
Definition: evalb.cpp:130
uint64_t zero_crossing_
The total number of proposed trees that had no crossings.
Definition: evalb.h:137
uint64_t proposed_correct_
The number of correct constituents in proposed parse trees.
Definition: evalb.h:112
uint64_t proposed_total_
The number of total constituents in proposed parse trees.
Definition: evalb.h:117
double average_crossing() const
Definition: evalb.h:89
double labeled_precision() const
Definition: evalb.h:55
uint64_t gold_total() const
Definition: evalb.h:47
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
double zero_crossing() const
Definition: evalb.h:97
uint64_t gold_total_
The number of total constituents in gold parse trees.
Definition: evalb.h:122
double perfect() const
Definition: evalb.h:81
uint64_t crossed_
The total number of crossings in proposed trees.
Definition: evalb.h:132
A re-implementation of (some of) the evalb metrics.
Definition: evalb.h:25
uint64_t total_trees_
The total number of parse trees.
Definition: evalb.h:142