Cambridge SMT System
|
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... | |
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.
|
inline |
Constructor.
Definition at line 45 of file task.grammar.nonterminalhierarchy.hpp.
|
inline |
Method to store identity rules, i.e. S -> X X , etc.
Definition at line 47 of file task.grammar.nonterminalhierarchy.hpp.
|
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.
|
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.
ntlist | On completion, it will store the actual list of hierachically sorted non-terminals |
Definition at line 64 of file task.grammar.nonterminalhierarchy.hpp.