FreeLing
4.0
|
Class grammar implements a CFG, ready to be used from a chart parser. More...
#include <grammar.h>
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< rule > | get_rules_right (const std::wstring &) const |
Get all rules with a right part beggining with the given category. | |
std::list< rule > | get_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 const unsigned int | NOGOV |
static const 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, rule > | wild |
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 |
Class grammar implements a CFG, ready to be used from a chart parser.
freeling::grammar::grammar | ( | const std::wstring & | ) |
Create a grammar loading it from a file.
int freeling::grammar::get_priority | ( | const std::wstring & | ) | const |
std::list<rule> freeling::grammar::get_rules_right | ( | const std::wstring & | ) | const |
Get all rules with a right part beggining with the given category.
std::list<rule> freeling::grammar::get_rules_right_wildcard | ( | const std::wstring & | ) | const |
Get all rules with a right part beggining with a wilcarded category.
int freeling::grammar::get_specificity | ( | const std::wstring & | ) | const |
std::wstring freeling::grammar::get_start_symbol | ( | ) | const |
obtain the start symbol of the grammar
bool freeling::grammar::in_filemap | ( | const std::wstring & | , |
const std::wstring & | |||
) | const |
search given wstring in filemap, and check whether it maps to the second
bool freeling::grammar::is_flat | ( | const std::wstring & | ) | const |
Check whether a symbol must be flattened when recursive.
bool freeling::grammar::is_hidden | ( | const std::wstring & | ) | const |
Check whether a symbol must disappear of final tree.
bool freeling::grammar::is_notop | ( | const std::wstring & | ) | const |
Check whether a symbol can not be used as a tree root.
bool freeling::grammar::is_onlytop | ( | const std::wstring & | ) | const |
Check whether a symbol is hidden unless when at tree root.
bool freeling::grammar::is_terminal | ( | const std::wstring & | ) | const |
Check whether a symbol is terminal or not.
void freeling::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.
const unsigned int freeling::grammar::DEFGOV [static] |
std::multimap<std::wstring,std::wstring> freeling::grammar::filemap [private] |
map to store files appearing in grammar rules
std::set<std::wstring> freeling::grammar::flat [private] |
Non-terminal symbols that must be flattened in final tree when recursive.
std::set<std::wstring> freeling::grammar::hidden [private] |
Non-terminal symbols that must not be seen in the tree.
const unsigned int freeling::grammar::NOGOV [static] |
std::set<std::wstring> freeling::grammar::nonterminal [private] |
Non-terminal symbols in the grammar.
std::set<std::wstring> freeling::grammar::notop [private] |
Non-terminal symbols that must not be considered tree roots.
std::set<std::wstring> freeling::grammar::onlytop [private] |
Non-terminal symbols that are visible only when are at tree root.
std::map<std::wstring,int> freeling::grammar::prior [private] |
symbol priorities to build the tree
std::wstring freeling::grammar::start [private] |
start symbol
std::multimap<std::wstring,rule> freeling::grammar::wild [private] |
rules starting with a wildcarded token, indexed by first char in category.