In file ../include/EST_SCFG.h:

class EST_SCFG

A class representing a stochastic context free grammar (SCFG).

Inheritance:


Public Methods

[more] Constructor and initialisation functions

[more] EST_SCFG (LISP rules)
Initialize from a set of rules

[more] utility functions

[more]void set_rules (LISP rules)
Set (or reset) rules from external source after construction
[more]LISP get_rules ()
Return rules as LISP list
[more]SCFGRuleList rules
The rules themselves
[more]void find_terms_nonterms (EST_StrList &nt, EST_StrList &t, LISP rules)
Find the terminals and nonterminals in the given grammar, adding them to the appropriate given string lists
[more]EST_String nonterminal (int p) const
Convert nonterminal index to string form
[more]EST_String terminal (int m) const
Convert terminal index to string form
[more]int nonterminal (const EST_String &p) const
Convert nonterminal string to index
[more]int terminal (const EST_String &m) const
Convert terminal string to index
[more]int num_nonterminals () const
Number of nonterminals
[more]int num_terminals () const
Number of terminals
[more]double prob_B (int p, int q, int r) const
The rule probability of given binary rule
[more]double prob_U (int p, int m) const
The rule probability of given unary rule
[more]void set_rule_prob_cache ()
(re-)set rule probability caches

[more] file i/o functions

[more]EST_read_status load (const EST_String &filename)
Load grammar from named file
[more]EST_write_status save (const EST_String &filename)
Save current grammar to named file


Documentation

A class representing a stochastic context free grammar (SCFG).

This class includes the representation of the grammar itself and methods for training and testing it against some corpus.

At presnet of grammars in Chomsky Normal Form are supported. That is rules may be binary or unary. If binary the mother an two daughters are nonterminals, if unary the mother must be nonterminal and daughter a terminal symbol.

The terminals and nonterminals symbol sets are derived automatically from the LISP representation of the rules at initialization time and are represented as EST_Discretes. The distinguished symbol is assumed to be the first mother of the first rule in the given grammar.

o Constructor and initialisation functions

o EST_SCFG(LISP rules)
Initialize from a set of rules

o utility functions

ovoid set_rules(LISP rules)
Set (or reset) rules from external source after construction

oLISP get_rules()
Return rules as LISP list

oSCFGRuleList rules
The rules themselves

ovoid find_terms_nonterms(EST_StrList &nt, EST_StrList &t, LISP rules)
Find the terminals and nonterminals in the given grammar, adding them to the appropriate given string lists

oEST_String nonterminal(int p) const
Convert nonterminal index to string form

oEST_String terminal(int m) const
Convert terminal index to string form

oint nonterminal(const EST_String &p) const
Convert nonterminal string to index

oint terminal(const EST_String &m) const
Convert terminal string to index

oint num_nonterminals() const
Number of nonterminals

oint num_terminals() const
Number of terminals

odouble prob_B(int p, int q, int r) const
The rule probability of given binary rule

odouble prob_U(int p, int m) const
The rule probability of given unary rule

ovoid set_rule_prob_cache()
(re-)set rule probability caches

o file i/o functions

oEST_read_status load(const EST_String &filename)
Load grammar from named file

oEST_write_status save(const EST_String &filename)
Save current grammar to named file


Direct child classes:
EST_SCFG_traintest

Alphabetic index HTML hierarchy of classes or Java


This page is part of the Edinburgh Speech Tools Library documentation
Copyright University of Edinburgh 1997
Contact: speech_tools@cstr.ed.ac.uk