KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Classes | Typedefs | Functions | Variables
semantics Namespace Reference

Namespaces

 Key_slots
 
 Step_code
 

Classes

class  Categorical_event
 look-up key class for contingency table More...
 
class  Categorical_event_base
 abstract base class for look-up keys More...
 
class  Cell
 
class  Marginal_cell_base
 
class  Context_cell_base
 
class  Prior_cell
 
class  Marginal_cell
 concrete class for contingency table cell More...
 
struct  Cell_traits
 
struct  Cell_traits< T, 1 >
 
class  Dependency_event
 
class  Elaboration_tree
 the main "Semantic tree" object More...
 
class  Event_db
 Database class to read and count parse tree events. More...
 
struct  View_traits
 
struct  View_traits< S1_event >
 
struct  View_traits< S2_event >
 
struct  View_traits< U_event >
 
struct  View_traits< D1_event >
 
struct  View_traits< D2_event >
 
struct  View_traits< PCC1_event >
 
struct  View_traits< PCC2_event >
 
struct  View_traits< Hsem_event >
 
struct  View_traits< Msem_event >
 
struct  Cell_traits< semantics::D2_view, 2 >
 
class  Event_view
 Template class to represent different "views" of syntactic events. More...
 
class  Head_semantic_event
 
class  Lexicon_db
 
class  Context_cell
 class containing conditioning context for marginal cells More...
 
class  Dummy_template_class
 
class  Alpha_sampler
 
class  Mod_semantic_event
 
class  Nonterminal_db
 
class  Null_semantic_event
 
class  Punctuation_event
 
class  Root_event
 
class  Semantic_db
 
class  Semantic_traits
 Traits class storing information specific to given elaboration types. More...
 
class  Semantic_data
 Concrete semantic data class for storing hash codes about nodes. More...
 
class  Terminal_elaboration
 Class representing semantic nodes at the leaves of trees. More...
 
class  Nonterminal_elaboration
 
class  Semantic_data_base
 Abstract base class of Semantic Data template. More...
 
class  Semantic_elaboration
 Base class for semantic elaborations. More...
 
class  Semantic_step_event
 
class  Semantic_step_proposal
 
struct  Semantic_traits< Null_primitive >
 
struct  Semantic_traits< Unary_relation_primitive >
 
struct  Semantic_traits< Binary_relation_primitive >
 
struct  Semantic_traits< Semantic_object >
 
struct  Semantic_traits< Category_primitive >
 
struct  Semantic_traits< Color_primitive >
 
struct  Semantic_traits< Size_primitive >
 
struct  Semantic_traits< Unary_predicate >
 
struct  Semantic_traits< Binary_predicate >
 
struct  Sentence_sem
 
class  Sem_lexer
 
class  Semspear_tree
 The main syntactic tree object for semantic parsing. More...
 
class  Semspear_tree_parser
 
class  Syntactic_event
 
class  Token_map
 
class  TOP_event
 
class  Tree_event
 
class  Unary_event
 

Typedefs

typedef View_traits< S1_event > S1_traits
 
typedef View_traits< S2_event > S2_traits
 
typedef View_traits< U_event > U_traits
 
typedef View_traits< D1_event > D1_traits
 
typedef View_traits< D2_event > D2_traits
 
typedef View_traits< PCC1_event > PCC1_traits
 
typedef View_traits< PCC2_event > PCC2_traits
 
typedef View_traits< Hsem_event > Hsem_traits
 
typedef View_traits< Msem_event > Msem_traits
 
typedef Event_view< S1_event > S1_view
 
typedef Event_view< S2_event > S2_view
 
typedef Event_view< U_event > U_view
 
typedef Event_view< D1_event > D1_view
 
typedef Event_view< D2_event > D2_view
 
typedef Event_view< PCC1_event > PCC1_view
 
typedef Event_view< PCC2_event > PCC2_view
 
typedef Event_view< Hsem_event > Hsem_view
 
typedef Event_view< Msem_event > Msem_view
 
typedef Terminal_elaboration
< Null_primitive > 
Null_semantic_terminal
 
typedef
Semantic_step_proposal::Elab_ptr 
Elab_ptr
 Import typedefs from Semantic_step_propsal. More...
 
typedef
Semantic_step_proposal::Elab_ptr_const 
Elab_ptr_const
 
typedef
Semantic_step_proposal::Syn_event_ptr 
Syn_event_ptr
 
typedef
Semantic_step_proposal::Sem_event_ptr 
Sem_event_ptr
 
typedef
Semantic_step_proposal::Proposal 
Proposal
 
typedef
Semantic_step_proposal::Proposal_array 
Proposal_array
 
typedef
Semantic_step_proposal::Step_result 
Step_result
 
typedef
Semantic_step_proposal::Proposal_dist 
Proposal_dist
 
typedef std::vector< double > Probability_array
 
typedef Semantic_data
< Null_primitive > 
Null_data
 
typedef Semantic_data
< Category_primitive > 
Category_data
 
typedef Semantic_data
< Unary_relation_primitive > 
Unary_relation_data
 
typedef Semantic_data
< Binary_relation_primitive > 
Binary_relation_data
 
typedef Semantic_data
< Color_primitive > 
Color_data
 
typedef Semantic_data
< Size_primitive > 
Size_data
 
typedef Semantic_data
< Semantic_object > 
Object_data
 
typedef Semantic_data
< Unary_predicate > 
Unary_data
 
typedef Semantic_data
< Binary_predicate > 
Binary_data
 
typedef
Nonterminal_elaboration
< Semantic_object > 
Object_elaboration
 
typedef
Nonterminal_elaboration
< Unary_predicate > 
Unary_elaboration
 
typedef
Nonterminal_elaboration
< Binary_predicate > 
Binary_elaboration
 
typedef Step_code::Code Step_code_t
 
typedef Semspear_tree::Symbol_list Symbol_list
 
typedef
Semantic_step_proposal::Self_ptr 
Move_proposal_ptr
 

Functions

std::ostream & operator<< (std::ostream &, const Categorical_event_base &)
 display key in human readable form More...
 
template<size_t N>
Categorical_event< N-1 > smooth (const Categorical_event< N > &event, const size_t steps=1)
 marginalizes look-up key by <steps> from back (generalizes context) More...
 
template<size_t N>
Categorical_event< N > get_context (const Categorical_event< N > &event, const size_t steps=1)
 returns RHS of conditioning expression More...
 
Event_db process_event_file (std::string train_path, std::string lexicon_file, size_t max_events, std::string test_path)
 Free_function definitions. More...
 
template<class T >
Key_slots::Map initialize_map (boost::array< std::string, T::size > names)
 
void resample_all_event_alphas ()
 
template<class T , size_t N>
std::ostream & operator<< (std::ostream &, const typename Marginal_cell< T, N >::Map &)
 
template<class T >
std::ostream & operator<< (std::ostream &, const typename Marginal_cell< T, 1 >::Map &)
 
template<class T , size_t N>
std::ostream & operator<< (std::ostream &, const typename Context_cell< T, N >::Map &)
 
template<typename T , size_t N>
void set_contingency_table_verbosity (bool value)
 
void resample_semspear_trees (std::vector< Semspear_tree::Self_ptr > &trees, const size_t &iterations, std::ostream &results, const bool &output_diagnostics)
 
void resample_associations (std::vector< Semspear_tree::Self_ptr > &trees, std::ostream &results, const bool &output_diagnostics)
 
void resample_event_tables (std::vector< Semspear_tree::Self_ptr > &trees)
 
void initialize_global_semantic_maps ()
 
std::ostream & operator<< (std::ostream &os, Semantic_data_base::Hash_pair hash_pair)
 
std::ostream & operator<< (std::ostream &os, Semantic_elaboration::Self_ptr elab)
 
template<class T , class Traits >
std::ostream & operator<< (std::ostream &, Semantic_data< T, Traits >)
 
const boost::shared_ptr
< Null_semantic_terminal > & 
null_semantic_terminal ()
 creates a new "null" terminal node (w/ no semantic content) More...
 
template<typename T , size_t D>
std::ostream & operator<< (std::ostream &os, const boost::array< T, D > &arr)
 
Proposal propose_a_step (const Elab_ptr_const semantic_parent, const Sem_event_ptr old_sem_event, const Syn_event_ptr old_syn_event, const Step_code_t step)
 
double calculate_proposal_probability (const Proposal &proposal, const bool &collins)
 
boost::tuple< Proposal_array,
Proposal_dist
generate_all_proposals (const Elab_ptr_const semantic_parent, const Sem_event_ptr sem_event, const Syn_event_ptr syn_event, const Step_code_t &curr_step, const bool &tree_is_altered, const bool &collins)
 
boost::shared_ptr
< Object_elaboration
make_plain_semantic_object (const Object_data::Val_type &category, const Semantic_elaboration::Referent_code &referent_code=Semantic_elaboration::NULL_REFERENT)
 create an object semantic node of category category, no attributes More...
 
void initialize_semantic_maps ()
 read in mappings from files, default config path More...
 
void initialize_semantic_maps (const std::string config_file_path)
 read in mappings from files, config file path specified More...
 
void initialize_semantic_maps (const std::map< std::string, std::string > &config_file_path_map)
 read in mappings from files, map with specified data type config paths More...
 
std::vector< Step_code::Weightsstep_code_priors_by_elaboration_type ()
 
const std::vector
< Step_code::Weights > & 
step_code_priors ()
 
Sentence_sem build_semantic_tree (size_t index)
 
std::vector< Sentence_semcollect_semantic_trees ()
 
template<>
string enum_to_string< Step_code_t > (Step_code_t value)
 
template<typename Enum_type >
std::string enum_to_string (Enum_type)
 
template<typename Enum_type >
Enum_type string_to_enum (std::string)
 
template<>
std::string enum_to_string< Step_code_t > (Step_code_t)
 
const Symbol_list punctuation (punc.begin(), punc.end())
 
const Symbol_list base_np_labels (base_np.begin(), base_np.end())
 
const Symbol_list coordination (coord.begin(), coord.end())
 
const Symbol_list accepts_any_coord (acc_any.begin(), acc_any.end())
 
const Symbol_listunnecessary_nodes ()
 
boost::tuple
< Semspear_tree::Self_ptr,
kjb::Vector
propose_new_tree (const Semspear_tree::Self_ptr source)
 
void resample_event_tables (Semspear_tree::Self_ptr &source)
 
void initialize_special_symbols ()
 
std::ostream & operator<< (std::ostream &os, Token_map &map)
 
template<class T >
void multi_encode (Token_map &map, const T &keys)
 
template<class T , class U , class M >
multi_map_encode (M maps, U keys)
 
template<class U , class T , class M >
multi_map_decode (M maps, T vals)
 
template<class T >
void set_verbosity (bool verbose)
 
template<class T >
std::ostream & operator<< (std::ostream &os, const std::vector< T > &c)
 

Variables

boost::array< size_t,
S1_traits::context_levels
tmp_s1 = {{1}}
 
boost::array< size_t,
S2_traits::context_levels
tmp_s2 = {{1,2}}
 
boost::array< size_t,
U_traits::context_levels
tmp_u = {{1,1,1}}
 
boost::array< size_t,
D1_traits::context_levels
tmp_d1 = {{3,1,1}}
 
boost::array< size_t,
D2_traits::context_levels
tmp_d2 = {{1,7,1}}
 
boost::array< size_t,
PCC1_traits::context_levels
tmp_pcc1 = {{1,5,2}}
 
boost::array< size_t,
PCC2_traits::context_levels
tmp_pcc2 = {{2,6,1}}
 
boost::array< size_t,
Hsem_traits::context_levels+1 > 
tmp_hsem = {{1,2,2,1}}
 
boost::array< size_t,
Msem_traits::context_levels+1 > 
tmp_msem = {{1,2,1,2,3,1}}
 
const Lexicon_db::Key_type stop_key = "#STOP#"
 
const Lexicon_db::Key_type lf_key = "+UNK+"
 
const Lexicon_db::Val_type stop_code = 0
 
const Nonterminal_db::Key_type low_freq_key = "+UNK+"
 
const Nonterminal_db::Key_type root_key = "TOP"
 
const Nonterminal_db::Val_type root_code = 2
 
const Semantic_db::Key_type null_key = "NULL"
 
const Semantic_db::Key_type unknown_key = "<UNK>"
 
const int STEP_CODE = 0
 Meaning of positions in Proposal tuple. More...
 
const int ELABORATION = 1
 
const int SEM_EVENT = 2
 
const int SYN_EVENT = 3
 
const boost::array
< Token_map::Key_type, 2 > 
punc = {{",", ":"}}
 
const boost::array
< Token_map::Key_type, 1 > 
base_np = {{"NPB"}}
 
const boost::array
< Token_map::Key_type, 3 > 
unnec = {{".", "''", "``"}}
 
const boost::array
< Token_map::Key_type, 1 > 
coord = {{"CC"}}
 
const boost::array
< Token_map::Key_type, 2 > 
acc_any = {{"UCP", "QP"}}
 

Typedef Documentation

typedef Semantic_data<Binary_predicate> semantics::Binary_data
typedef Semantic_data<Binary_relation_primitive> semantics::Binary_relation_data
typedef Semantic_data<Category_primitive> semantics::Category_data
typedef Semantic_data<Color_primitive> semantics::Color_data
typedef View_traits<D1_event> semantics::D1_traits
typedef Event_view<D1_event> semantics::D1_view
typedef View_traits<D2_event> semantics::D2_traits
typedef Event_view<D2_event> semantics::D2_view

Import typedefs from Semantic_step_propsal.

typedef View_traits<Hsem_event> semantics::Hsem_traits
typedef Event_view<Hsem_event> semantics::Hsem_view
typedef View_traits<Msem_event> semantics::Msem_traits
typedef Event_view<Msem_event> semantics::Msem_view
typedef Semantic_data<Null_primitive> semantics::Null_data
typedef Semantic_data<Semantic_object> semantics::Object_data
typedef View_traits<PCC1_event> semantics::PCC1_traits
typedef Event_view<PCC1_event> semantics::PCC1_view
typedef View_traits<PCC2_event> semantics::PCC2_traits
typedef Event_view<PCC2_event> semantics::PCC2_view
typedef std::vector<double> semantics::Probability_array
typedef View_traits<S1_event> semantics::S1_traits
typedef Event_view<S1_event> semantics::S1_view
typedef View_traits<S2_event> semantics::S2_traits
typedef Event_view<S2_event> semantics::S2_view
typedef Semantic_data<Size_primitive> semantics::Size_data
typedef View_traits<U_event> semantics::U_traits
typedef Event_view<U_event> semantics::U_view
typedef Semantic_data<Unary_predicate> semantics::Unary_data
typedef Semantic_data<Unary_relation_primitive> semantics::Unary_relation_data

Function Documentation

const Symbol_list semantics::accepts_any_coord ( acc_any.  begin(),
acc_any.  end() 
)
const Symbol_list semantics::base_np_labels ( base_np.  begin(),
base_np.  end() 
)
Sentence_sem semantics::build_semantic_tree ( size_t  index)
inline
double semantics::calculate_proposal_probability ( const Proposal &  proposal,
const bool &  collins 
)
std::vector<Sentence_sem> semantics::collect_semantic_trees ( )
inline
const Symbol_list semantics::coordination ( coord.  begin(),
coord.  end() 
)
template<typename Enum_type >
std::string semantics::enum_to_string ( Enum_type  )
template<>
string semantics::enum_to_string< Step_code_t > ( Step_code_t  value)
template<>
std::string semantics::enum_to_string< Step_code_t > ( Step_code_t  )
boost::tuple<Proposal_array, Proposal_dist> semantics::generate_all_proposals ( const Elab_ptr_const  semantic_parent,
const Sem_event_ptr  sem_event,
const Syn_event_ptr  syn_event,
const Step_code_t &  curr_step,
const bool &  tree_is_altered,
const bool &  collins 
)
template<size_t N>
Categorical_event< N > semantics::get_context ( const Categorical_event< N > &  event,
const size_t  steps = 1 
)

returns RHS of conditioning expression

get RHS of conditioning context

void semantics::initialize_global_semantic_maps ( )
template<class T >
Key_slots::Map semantics::initialize_map ( boost::array< std::string, T::size >  names)
void semantics::initialize_semantic_maps ( )

read in mappings from files, default config path

void semantics::initialize_semantic_maps ( std::string  config_file_path)

read in mappings from files, config file path specified

void semantics::initialize_semantic_maps ( const std::map< std::string, std::string > &  config_file_path_map)

read in mappings from files, map with specified data type config paths

void semantics::initialize_special_symbols ( )
boost::shared_ptr< Object_elaboration > semantics::make_plain_semantic_object ( const Object_data::Val_type &  category,
const Semantic_elaboration::Referent_code &  referent_code 
)

create an object semantic node of category category, no attributes

template<class T >
void semantics::multi_encode ( Token_map &  map,
const T &  keys 
)
template<class U , class T , class M >
U semantics::multi_map_decode ( maps,
vals 
)
template<class T , class U , class M >
T semantics::multi_map_encode ( maps,
keys 
)
const boost::shared_ptr< Null_semantic_terminal > & semantics::null_semantic_terminal ( )

creates a new "null" terminal node (w/ no semantic content)

make a null semantic terminal

std::ostream & semantics::operator<< ( std::ostream &  os,
const Categorical_event_base &  e 
)

display key in human readable form

template<typename T , size_t D>
std::ostream& semantics::operator<< ( std::ostream &  os,
const boost::array< T, D > &  arr 
)
std::ostream & semantics::operator<< ( std::ostream &  os,
Semantic_data_base::Hash_pair  hash_pair 
)
std::ostream & semantics::operator<< ( std::ostream &  os,
Semantic_elaboration::Self_ptr  elab 
)
std::ostream& semantics::operator<< ( std::ostream &  os,
Token_map &  map 
)
template<class T , class Traits >
std::ostream & semantics::operator<< ( std::ostream &  os,
Semantic_data< T, Traits >  d 
)
template<class T , size_t N>
std::ostream & semantics::operator<< ( std::ostream &  os,
const typename Marginal_cell< T, N >::Map &  map 
)
template<class T >
std::ostream & semantics::operator<< ( std::ostream &  os,
const typename Marginal_cell< T, 1 >::Map &  map 
)
template<class T , size_t N>
std::ostream & semantics::operator<< ( std::ostream &  os,
const typename Context_cell< T, N >::Map &  map 
)
template<class T >
std::ostream& semantics::operator<< ( std::ostream &  os,
const std::vector< T > &  c 
)
Event_db semantics::process_event_file ( std::string  train_path,
std::string  lexicon_file,
size_t  max_events,
std::string  test_path 
)

Free_function definitions.

Free functions.

Proposal semantics::propose_a_step ( const Elab_ptr_const  semantic_parent,
const Sem_event_ptr  old_sem_event,
const Syn_event_ptr  old_syn_event,
const Step_code_t  step 
)
boost::tuple< Semspear_tree::Self_ptr, kjb::Vector > semantics::propose_new_tree ( const Semspear_tree::Self_ptr  source)
const Symbol_list semantics::punctuation ( punc.  begin(),
punc.  end() 
)
void semantics::resample_all_event_alphas ( )
void semantics::resample_associations ( std::vector< Semspear_tree::Self_ptr > &  trees,
std::ostream &  results,
const bool &  output_diagnostics 
)
void semantics::resample_event_tables ( Semspear_tree::Self_ptr &  source)
void semantics::resample_event_tables ( std::vector< Semspear_tree::Self_ptr > &  trees)
void semantics::resample_semspear_trees ( std::vector< Semspear_tree::Self_ptr > &  trees,
const size_t &  iterations,
std::ostream &  results,
const bool &  output_diagnostics 
)
template<typename T , size_t N>
void semantics::set_contingency_table_verbosity ( bool  value)
template<class T >
void semantics::set_verbosity ( bool  verbose)
template<size_t N>
Categorical_event< N-1 > semantics::smooth ( const Categorical_event< N > &  event,
const size_t  steps = 1 
)

marginalizes look-up key by <steps> from back (generalizes context)

get smoothed key (context simplified by one level)

const std::vector< Step_code::Weights > & semantics::step_code_priors ( )
std::vector<Step_code::Weights> semantics::step_code_priors_by_elaboration_type ( )
template<typename Enum_type >
Enum_type semantics::string_to_enum ( std::string  )
const Symbol_list& semantics::unnecessary_nodes ( )

Variable Documentation

const boost::array<Token_map::Key_type, 2> semantics::acc_any = {{"UCP", "QP"}}
const boost::array<Token_map::Key_type, 1> semantics::base_np = {{"NPB"}}
const boost::array<Token_map::Key_type, 1> semantics::coord = {{"CC"}}
const int semantics::ELABORATION = 1
const Lexicon_db::Key_type semantics::lf_key = "+UNK+"
const Nonterminal_db::Key_type semantics::low_freq_key = "+UNK+"
const Semantic_db::Key_type semantics::null_key = "NULL"
const boost::array<Token_map::Key_type, 2> semantics::punc = {{",", ":"}}
const Nonterminal_db::Val_type semantics::root_code = 2
const Nonterminal_db::Key_type semantics::root_key = "TOP"
const int semantics::SEM_EVENT = 2
const int semantics::STEP_CODE = 0

Meaning of positions in Proposal tuple.

const Lexicon_db::Val_type semantics::stop_code = 0
const Nonterminal_db::Key_type semantics::stop_key = "#STOP#"
const int semantics::SYN_EVENT = 3
boost::array<size_t, D1_traits::context_levels> semantics::tmp_d1 = {{3,1,1}}
boost::array<size_t, D2_traits::context_levels> semantics::tmp_d2 = {{1,7,1}}
boost::array<size_t, Hsem_traits::context_levels + 1> semantics::tmp_hsem = {{1,2,2,1}}
boost::array<size_t, Msem_traits::context_levels + 1> semantics::tmp_msem = {{1,2,1,2,3,1}}
boost::array<size_t, PCC1_traits::context_levels> semantics::tmp_pcc1 = {{1,5,2}}
boost::array<size_t, PCC2_traits::context_levels> semantics::tmp_pcc2 = {{2,6,1}}
boost::array<size_t, S1_traits::context_levels> semantics::tmp_s1 = {{1}}
boost::array<size_t, S2_traits::context_levels> semantics::tmp_s2 = {{1,2}}
boost::array<size_t, U_traits::context_levels> semantics::tmp_u = {{1,1,1}}
const Semantic_db::Key_type semantics::unknown_key = "<UNK>"
const boost::array<Token_map::Key_type, 3> semantics::unnec = {{".", "''", "``"}}