KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TOP_event.h
Go to the documentation of this file.
1 #ifndef TOP_EVENT_H_
2 #define TOP_EVENT_H_
3 
12 #include "semantics/Lexicon_db.h"
14 
15 namespace semantics
16 {
17 
18 class TOP_event : public Syntactic_event
19 {
20 public:
21 
22  /*------------------------------------------------------------
23  * CONSTRUCTORS AND DESTRUCTOR
24  *------------------------------------------------------------*/
25 
28  TOP_event(int id)
29  : Syntactic_event(id, false)
30  {}
31 
32  /*------------------------------------------------------------
33  * ACCESSORS
34  *------------------------------------------------------------*/
35 
39  const Token_map::Key_type&
40  ) const
41  {
42  return Nonterminal_db::root_key();
43  }
44 
48  const Token_map::Key_type&
49  ) const
50  {
51  return Nonterminal_db::root_key();
52  }
53 
54  /*------------------------------------------------------------
55  * COMPUTATION
56  *------------------------------------------------------------*/
57 
60  double log_probability(const bool&) const {return 0.0;};
61 
64  double subtree_log_probability() const
65  {
67  }
68 
71  Event_ptr get_a_copy(bool) const {return Event_ptr(new TOP_event(0));}
72 
73  /*------------------------------------------------------------
74  * MANIPULATORS
75  *------------------------------------------------------------*/
76 
80 
84 
85  /*------------------------------------------------------------
86  * DSIPLAY
87  *------------------------------------------------------------*/
88 
91  void print(std::ostream& os) const {os << Nonterminal_db::root_key();}
92 
95  void print_semantics(std::ostream&) const {}
96 
99  void print_subtree(std::ostream& os, int indent_level) const
100  {
101  print_child_trees(os, indent_level);
102  }
103 
106  void print_constituency_tree_with_head(std::ostream& os) const
107  {
108  os << "(" << Nonterminal_db::root_key() << " ";
110  os << head_pos_-1 << ")";
111  }
112 
115  void print_view_counts(std::ostream&) const {}
116 
119  void print_with_links(std::ostream&) const {}
120 private:
121  const Key_slots::Map& var_map() const
122  {
124  }
125 
126  void update_event_views(){}
127 };
128 
129 };
130 
131 #endif
static const Key_type & root_key()
Definition: Nonterminal_db.cpp:28
void update_semantics(const Sem_hash_pair &)
update semantic feature associated with this event (no-op)
Definition: TOP_event.h:79
boost::shared_ptr< Syntactic_event > Event_ptr
Definition: Syntactic_event.h:27
void print_child_trees(std::ostream &os, int indent_level) const
print children subtrees in sequence
Definition: Syntactic_event.cpp:128
Definition: Syntactic_event.h:20
Event_ptr get_a_copy(bool) const
get a deep copy of this
Definition: TOP_event.h:71
void print_subtree(std::ostream &os, int indent_level) const
override Syntactic_event::print_subtree
Definition: TOP_event.h:99
void print_semantics(std::ostream &) const
override print_semantics function to do nothing
Definition: TOP_event.h:95
static const Key_slots::Map variable_map
Definition: Event_traits.h:103
std::string Key_type
Definition: Token_map.h:23
void print_with_links(std::ostream &) const
print with links
Definition: TOP_event.h:119
void resample_table_assignments()
resample CRP table assignments for all component event views (no-op)
Definition: TOP_event.h:83
size_t head_pos_
Definition: Syntactic_event.h:193
Semantic_data_base::Hash_pair Sem_hash_pair
Definition: Tree_event.h:42
double log_probability(const bool &) const
compute smoothed probability of this event
Definition: TOP_event.h:60
void print_view_counts(std::ostream &) const
print view counts (does nothing, in this case)
Definition: TOP_event.h:115
TOP_event(int id)
standard constructor, one argument per piece of data
Definition: TOP_event.h:28
const Token_map::Key_type & data_as_word(const Token_map::Key_type &) const
override function from Syntactic_event class
Definition: TOP_event.h:38
double subtree_log_probability() const
get log probability of entire subtree
Definition: TOP_event.h:64
void print(std::ostream &os) const
override print function from Syntactic_event class
Definition: TOP_event.h:91
virtual double subtree_log_probability() const
get log probability of entire subtree
Definition: Syntactic_event.cpp:34
void print_child_constituency_trees(std::ostream &os) const
recursively print subtree as constituency tree with head info
Definition: Syntactic_event.cpp:103
const Token_map::Key_type & data_as_nonterminal(const Token_map::Key_type &) const
override function from Syntactic_event class
Definition: TOP_event.h:47
boost::bimap< int, std::string > Map
Definition: Event_traits.h:34
void print_constituency_tree_with_head(std::ostream &os) const
override Syntactic_event::print_constituency_tree_with_head
Definition: TOP_event.h:106
Definition: TOP_event.h:18