FreeLing  3.0
Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
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 std::wstring &)
 Create a grammar loading it from a file.
int get_specificity (const std::wstring &) const
int get_priority (const std::wstring &) const
std::wstring get_start_symbol () const
 obtain the start symbol of the grammar
bool is_hidden (const std::wstring &) const
 Check whether a symbol must disappear of final tree.
bool is_flat (const std::wstring &) const
 Check whether a symbol must be flattened when recursive.
bool is_notop (const std::wstring &) const
 Check whether a symbol can not be used as a tree root.
bool is_onlytop (const std::wstring &) const
 Check whether a symbol is hidden unless when at tree root.
bool is_terminal (const std::wstring &) const
 Check whether a symbol is terminal or not.
std::list< ruleget_rules_right (const std::wstring &) const
 Get all rules with a right part beggining with the given category.
std::list< ruleget_rules_right_wildcard (const std::wstring &) const
 Get all rules with a right part beggining with a wilcarded category.
bool in_filemap (const std::wstring &, const std::wstring &) const
 search given wstring 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 std::wstring &, const std::list< std::wstring > &, bool, const int rgov)
 Create and store a new rule, indexed by 1st category in its right part.

Private Attributes

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

Detailed Description

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


Constructor & Destructor Documentation

grammar::grammar ( const std::wstring &  )

Create a grammar loading it from a file.


Member Function Documentation

int grammar::get_priority ( const std::wstring &  ) const
std::list<rule> grammar::get_rules_right ( const std::wstring &  ) const

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

std::list<rule> grammar::get_rules_right_wildcard ( const std::wstring &  ) const

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

int grammar::get_specificity ( const std::wstring &  ) const
std::wstring grammar::get_start_symbol ( ) const

obtain the start symbol of the grammar

bool grammar::in_filemap ( const std::wstring &  ,
const std::wstring &   
) const

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

bool grammar::is_flat ( const std::wstring &  ) const

Check whether a symbol must be flattened when recursive.

bool grammar::is_hidden ( const std::wstring &  ) const

Check whether a symbol must disappear of final tree.

bool grammar::is_notop ( const std::wstring &  ) const

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

bool grammar::is_onlytop ( const std::wstring &  ) const

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

bool grammar::is_terminal ( const std::wstring &  ) const

Check whether a symbol is terminal or not.

void grammar::new_rule ( const std::wstring &  ,
const std::list< std::wstring > &  ,
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]
std::multimap<std::wstring,std::wstring> grammar::filemap [private]

map to store files appearing in grammar rules

std::set<std::wstring> grammar::flat [private]

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

std::set<std::wstring> grammar::hidden [private]

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

unsigned int grammar::NOGOV [static]
std::set<std::wstring> grammar::nonterminal [private]

Non-terminal symbols in the grammar.

std::set<std::wstring> grammar::notop [private]

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

std::set<std::wstring> grammar::onlytop [private]

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

std::map<std::wstring,int> grammar::prior [private]

symbol priorities to build the tree

std::wstring grammar::start [private]

start symbol

std::multimap<std::wstring,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: