KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
semantics::Syntactic_event Class Referenceabstract

#include <Syntactic_event.h>

Inheritance diagram for semantics::Syntactic_event:
semantics::Tree_event semantics::Dependency_event semantics::Punctuation_event semantics::Root_event semantics::TOP_event semantics::Unary_event

Public Types

typedef boost::shared_ptr
< Syntactic_event
Event_ptr
 
typedef Event_ptr Self_ptr
 
typedef std::deque< Self_ptrEvent_ptr_container
 
- Public Types inherited from semantics::Tree_event
typedef boost::shared_ptr
< Tree_event
Self_ptr
 
typedef Token_map::Val_type Value_type
 
typedef Token_map::Key_type Key_type
 
typedef std::vector< Value_typeData_type
 
typedef Value_type Word_type
 
typedef Value_type Tag_type
 
typedef Value_type Label_type
 
typedef Value_type Distance_type
 
typedef boost::tuple
< Word_type, Label_type,
Label_type
Node_data
 
typedef
Semantic_data_base::Hash_pair 
Sem_hash_pair
 

Public Member Functions

int id () const
 return unique id More...
 
size_t head_pos () const
 return head position More...
 
void add_head_child (const Event_ptr head)
 add the first child More...
 
void add_dependency_child (const Event_ptr child, bool on_left=false)
 add a pointer to a new child which is not the head More...
 
virtual Event_ptr get_a_copy (bool learn=false) const =0
 return a pointer to a deep copy of this instance More...
 
virtual void update_semantics (const Sem_hash_pair &)
 replace semantic data with new data and update views More...
 
virtual void update_event_views ()
 update event views More...
 
virtual double subtree_log_probability () const
 get log probability of entire subtree More...
 
virtual void print_view_counts (std::ostream &) const =0
 pure virtual dummy — instantiated versions display count data More...
 
virtual void print_subtree_view_counts (std::ostream &, int indent_level=0) const
 show counts at each node, recursively descending More...
 
virtual void print (std::ostream &os) const
 display this node's data in human readable form More...
 
virtual void print_semantics (std::ostream &os) const
 display the semantic node associated with this node More...
 
virtual void print_with_links (std::ostream &) const
 virtual function, does nothing at base level More...
 
virtual void print_subtree (std::ostream &os, int indent_level=0) const
 recursively print full subtree More...
 
virtual void print_constituency_tree_with_head (std::ostream &os) const
 recursively print subtree as constituency tree with head info More...
 
void print_child_constituency_trees (std::ostream &os) const
 recursively print subtree as constituency tree with head info More...
 
- Public Member Functions inherited from semantics::Tree_event
virtual ~Tree_event ()
 virtual destructor More...
 
virtual double log_probability (const bool &collins=false) const =0
 compute log probability of this event More...
 
virtual void release_view_counts ()
 turn off learn_ and remove counts from database More...
 
virtual void reacquire_view_counts ()
 turn on learn_ and add counts to database More...
 
virtual void update_semantic_context (const Sem_hash_pair &, const Sem_hash_pair &)
 update semantic parent and head (if they exist) More...
 
virtual void resample_table_assignments ()=0
 resample CRP table assignments for all component event views More...
 

Static Public Attributes

static bool VERBOSE = false
 Static initialization. More...
 
- Static Public Attributes inherited from semantics::Tree_event
static bool VERBOSE = false
 
static const int WORD = 0
 
static const int TAG = 1
 
static const int LABEL = 2
 
static const int HEAD = 0
 
static const int ARGS = 1
 

Protected Member Functions

 Syntactic_event (int id, bool learn)
 construct an empty event with data to be filled at derived level More...
 
 Syntactic_event (const Data_type &data, int id, bool learn)
 construct an event with data prespecified More...
 
virtual ~Syntactic_event ()
 virtual destructor More...
 
virtual const Key_slots::Mapvar_map () const =0
 return reference to the map between variable names and positions More...
 
void print_child_trees (std::ostream &os, int indent_level) const
 print children subtrees in sequence More...
 
- Protected Member Functions inherited from semantics::Tree_event
 Tree_event (bool learn)
 construct an empty event with data to be filled at derived level More...
 
 Tree_event (const Data_type &data, bool learn)
 construct an event with data prespecified More...
 
const Key_typedata_as_word (const Key_type &variable) const
 look up data entry in position <variable> and return as word More...
 
const Key_typedata_as_nonterminal (const Key_type &variable) const
 look up data entry in position <variable> and return as nt More...
 
const Key_type data_as_semantic_step (const Key_type &variable) const
 look up data entry in position <variable> and return as step code More...
 
const Key_typedata_as_semantic_head (const Key_type &variable) const
 look up data entry in position <variable> and return as semhead More...
 
const Key_typedata_as_semantic_args (const Key_type &variable) const
 look up data entry in position <variable> and return as semargs More...
 
const Value_typedata_as_code (const Key_type &variable) const
 look up data entry in position <variable> and return as code More...
 
Value_typedata_in_slot (const Key_type &variable)
 return data in position as lvalue More...
 

Protected Attributes

int id_
 
size_t head_pos_
 
Event_ptr_container children_
 
- Protected Attributes inherited from semantics::Tree_event
Data_type data_
 
bool learn_
 

Friends

std::ostream & operator<< (std::ostream &os, const Syntactic_event &e)
 display this node in tree context More...
 
std::ostream & operator<< (std::ostream &os, const Syntactic_event *e)
 
std::ostream & operator<< (std::ostream &os, const Event_ptr e)
 

Additional Inherited Members

- Static Public Member Functions inherited from semantics::Tree_event
static Lexicon_dblexicon ()
 
static Nonterminal_dbnt_lexicon ()
 

Member Typedef Documentation

Constructor & Destructor Documentation

semantics::Syntactic_event::Syntactic_event ( int  id,
bool  learn 
)
protected

construct an empty event with data to be filled at derived level

Member function implementation.

semantics::Syntactic_event::Syntactic_event ( const Data_type data,
int  id,
bool  learn 
)
protected

construct an event with data prespecified

virtual semantics::Syntactic_event::~Syntactic_event ( )
inlineprotectedvirtual

virtual destructor

Member Function Documentation

void semantics::Syntactic_event::add_dependency_child ( const Event_ptr  child,
bool  on_left = false 
)
inline

add a pointer to a new child which is not the head

Parameters
childpointer to the child to be "adopted"
on_leftboolean determining whether child is left of head
void semantics::Syntactic_event::add_head_child ( const Event_ptr  head)
inline

add the first child

virtual Event_ptr semantics::Syntactic_event::get_a_copy ( bool  learn = false) const
pure virtual

return a pointer to a deep copy of this instance

Implemented in semantics::Dependency_event, semantics::Root_event, semantics::Unary_event, semantics::Punctuation_event, and semantics::TOP_event.

size_t semantics::Syntactic_event::head_pos ( ) const
inline

return head position

int semantics::Syntactic_event::id ( ) const
inline

return unique id

void semantics::Syntactic_event::print ( std::ostream &  os) const
virtual

display this node's data in human readable form

Implements semantics::Tree_event.

Reimplemented in semantics::Unary_event, semantics::TOP_event, semantics::Punctuation_event, and semantics::Root_event.

void semantics::Syntactic_event::print_child_constituency_trees ( std::ostream &  os) const

recursively print subtree as constituency tree with head info

void semantics::Syntactic_event::print_child_trees ( std::ostream &  os,
int  indent_level 
) const
protected

print children subtrees in sequence

void semantics::Syntactic_event::print_constituency_tree_with_head ( std::ostream &  os) const
virtual

recursively print subtree as constituency tree with head info

Reimplemented in semantics::TOP_event, and semantics::Punctuation_event.

void semantics::Syntactic_event::print_semantics ( std::ostream &  os) const
virtual

display the semantic node associated with this node

Reimplemented in semantics::TOP_event, and semantics::Punctuation_event.

void semantics::Syntactic_event::print_subtree ( std::ostream &  os,
int  indent_level = 0 
) const
virtual

recursively print full subtree

Reimplemented in semantics::TOP_event.

void semantics::Syntactic_event::print_subtree_view_counts ( std::ostream &  os,
int  indent_level = 0 
) const
virtual

show counts at each node, recursively descending

virtual void semantics::Syntactic_event::print_view_counts ( std::ostream &  ) const
pure virtual

pure virtual dummy — instantiated versions display count data

Implements semantics::Tree_event.

Implemented in semantics::Dependency_event, semantics::Unary_event, semantics::TOP_event, semantics::Punctuation_event, and semantics::Root_event.

virtual void semantics::Syntactic_event::print_with_links ( std::ostream &  ) const
inlinevirtual

virtual function, does nothing at base level

Reimplemented from semantics::Tree_event.

Reimplemented in semantics::Dependency_event, semantics::TOP_event, semantics::Unary_event, semantics::Punctuation_event, and semantics::Root_event.

double semantics::Syntactic_event::subtree_log_probability ( ) const
virtual

get log probability of entire subtree

Reimplemented in semantics::TOP_event.

virtual void semantics::Syntactic_event::update_event_views ( )
inlinevirtual

update event views

Implements semantics::Tree_event.

void semantics::Syntactic_event::update_semantics ( const Sem_hash_pair vals)
virtual

replace semantic data with new data and update views

Reimplemented in semantics::TOP_event, and semantics::Punctuation_event.

virtual const Key_slots::Map& semantics::Syntactic_event::var_map ( ) const
protectedpure virtual

return reference to the map between variable names and positions

Implements semantics::Tree_event.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Syntactic_event e 
)
friend

display this node in tree context

std::ostream& operator<< ( std::ostream &  os,
const Syntactic_event e 
)
friend
std::ostream& operator<< ( std::ostream &  os,
const Event_ptr  e 
)
friend

Member Data Documentation

Event_ptr_container semantics::Syntactic_event::children_
protected
size_t semantics::Syntactic_event::head_pos_
protected
int semantics::Syntactic_event::id_
protected
bool semantics::Syntactic_event::VERBOSE = false
static

Static initialization.


The documentation for this class was generated from the following files: