Cambridge SMT System
ucam::hifst::NonTerminalHierarchy Class Reference

This is a functor with additional methods to include relevant rules (i.e. identify SCFG rules, S -> X X, X -> V V ) and determine the hierarchy of non-terminals within the grammar. More...

#include <task.grammar.nonterminalhierarchy.hpp>

Public Member Functions

 NonTerminalHierarchy ()
 Constructor. More...
 
void insertIdentityRule (const std::string &identityrule)
 Method to store identity rules, i.e. S -> X X , etc. More...
 
void insertLHS (const std::string &nt)
 
bool operator() (std::string &ntlist)
 Determines hierarchical list of non-terminals and flags whether there has been a cycle or not Example: For a SCFG rule S -> X X, hierarchy is S,X. If we add X -> S S, then we have a cycle. For more examples see unit test. More...
 

Detailed Description

This is a functor with additional methods to include relevant rules (i.e. identify SCFG rules, S -> X X, X -> V V ) and determine the hierarchy of non-terminals within the grammar.

Definition at line 33 of file task.grammar.nonterminalhierarchy.hpp.

Constructor & Destructor Documentation

ucam::hifst::NonTerminalHierarchy::NonTerminalHierarchy ( )
inline

Constructor.

Definition at line 45 of file task.grammar.nonterminalhierarchy.hpp.

Member Function Documentation

void ucam::hifst::NonTerminalHierarchy::insertIdentityRule ( const std::string &  identityrule)
inline

Method to store identity rules, i.e. S -> X X , etc.

Definition at line 47 of file task.grammar.nonterminalhierarchy.hpp.

Here is the caller graph for this function:

void ucam::hifst::NonTerminalHierarchy::insertLHS ( const std::string &  nt)
inline

Insert LHS non-terminals. Use this method to make sure that all non-terminals (even those that are not used in identity rules) are considered.

Definition at line 53 of file task.grammar.nonterminalhierarchy.hpp.

Here is the caller graph for this function:

bool ucam::hifst::NonTerminalHierarchy::operator() ( std::string &  ntlist)
inline

Determines hierarchical list of non-terminals and flags whether there has been a cycle or not Example: For a SCFG rule S -> X X, hierarchy is S,X. If we add X -> S S, then we have a cycle. For more examples see unit test.

Parameters
ntlistOn completion, it will store the actual list of hierachically sorted non-terminals

Definition at line 64 of file task.grammar.nonterminalhierarchy.hpp.

Here is the call graph for this function:


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