Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

grammar Class Reference

Class grammar implements a CFG, ready to be used from a chart parser. More...

#include <grammar.h>

Inheritance diagram for grammar:

Inheritance graph
[legend]
Collaboration diagram for grammar:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 grammar (const string &)
 Create a grammar loading it from a file.
int get_specificity (const string &) const
int get_priority (const string &) const
string get_start_symbol () const
 obtain the start symbol of the grammar
bool is_hidden (const string &) const
 Check whether a symbol must disappear of final tree.
bool is_flat (const string &) const
 Check whether a symbol must be flattened when recursive.
bool is_notop (const string &) const
 Check whether a symbol can not be used as a tree root.
bool is_onlytop (const string &) const
 Check whether a symbol is hidden unless when at tree root.
bool is_terminal (const string &) const
 Check whether a symbol is terminal or not.
list< ruleget_rules_right (const string &) const
 Get all rules with a right part beggining with the given category.
list< ruleget_rules_right_wildcard (const string &) const
 Get all rules with a right part beggining with a wilcarded category.
bool in_filemap (const string &, const string &) const
 search given string in filemap, and check whether it maps to the second

Static Public Attributes

static unsigned int NOGOV
static unsigned int DEFGOV

Private Member Functions

void new_rule (const string &, const list< string > &, bool, const int rgov)
 Create and store a new rule, indexed by 1st category in its right part.

Private Attributes

set< string > nonterminal
 Non-terminal symbols in the grammar.
multimap< string, rulewild
 rules starting with a wildcarded token, indexed by first char in category.
multimap< string, string > filemap
 map to store files appearing in grammar rules
map< string, int > prior
 symbol priorities to build the tree
set< string > hidden
 Non-terminal symbols that must not be seen in the tree.
set< string > flat
 Non-terminal symbols that must be flattened in final tree when recursive.
set< string > notop
 Non-terminal symbols that must not be considered tree roots.
set< string > onlytop
 Non-terminal symbols that are visible only when are at tree root.
string start
 start symbol

Detailed Description

Class grammar implements a CFG, ready to be used from a chart parser.


Constructor & Destructor Documentation

grammar::grammar const string &   ) 
 

Create a grammar loading it from a file.


Member Function Documentation

int grammar::get_priority const string &   )  const
 

list<rule> grammar::get_rules_right const string &   )  const
 

Get all rules with a right part beggining with the given category.

list<rule> grammar::get_rules_right_wildcard const string &   )  const
 

Get all rules with a right part beggining with a wilcarded category.

int grammar::get_specificity const string &   )  const
 

string grammar::get_start_symbol  )  const
 

obtain the start symbol of the grammar

bool grammar::in_filemap const string &  ,
const string & 
const
 

search given string in filemap, and check whether it maps to the second

bool grammar::is_flat const string &   )  const
 

Check whether a symbol must be flattened when recursive.

bool grammar::is_hidden const string &   )  const
 

Check whether a symbol must disappear of final tree.

bool grammar::is_notop const string &   )  const
 

Check whether a symbol can not be used as a tree root.

bool grammar::is_onlytop const string &   )  const
 

Check whether a symbol is hidden unless when at tree root.

bool grammar::is_terminal const string &   )  const
 

Check whether a symbol is terminal or not.

void grammar::new_rule const string &  ,
const list< string > &  ,
bool  ,
const int  rgov
[private]
 

Create and store a new rule, indexed by 1st category in its right part.


Member Data Documentation

unsigned int grammar::DEFGOV [static]
 

multimap<string,string> grammar::filemap [private]
 

map to store files appearing in grammar rules

set<string> grammar::flat [private]
 

Non-terminal symbols that must be flattened in final tree when recursive.

set<string> grammar::hidden [private]
 

Non-terminal symbols that must not be seen in the tree.

unsigned int grammar::NOGOV [static]
 

set<string> grammar::nonterminal [private]
 

Non-terminal symbols in the grammar.

set<string> grammar::notop [private]
 

Non-terminal symbols that must not be considered tree roots.

set<string> grammar::onlytop [private]
 

Non-terminal symbols that are visible only when are at tree root.

map<string,int> grammar::prior [private]
 

symbol priorities to build the tree

string grammar::start [private]
 

start symbol

multimap<string,rule> grammar::wild [private]
 

rules starting with a wildcarded token, indexed by first char in category.


The documentation for this class was generated from the following file:
Generated on Wed Apr 26 12:58:12 2006 for FreeLing by  doxygen 1.4.4