In file ../include/EST_SCFG.h:

## class EST_SCFG

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

## Inheritance:

### Public Methods

  | Constructor and initialisation functions
  | EST_SCFG (LISP rules) Initialize from a set of rules
  | utility functions
  void | set_rules (LISP rules) Set (or reset) rules from external source after construction
  LISP | get_rules () Return rules as LISP list
  SCFGRuleList | rules The rules themselves
  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
  EST_String | nonterminal (int p) const Convert nonterminal index to string form
  EST_String | terminal (int m) const Convert terminal index to string form
  int | nonterminal (const EST_String &p) const Convert nonterminal string to index
  int | terminal (const EST_String &m) const Convert terminal string to index
  int | num_nonterminals () const Number of nonterminals
  int | num_terminals () const Number of terminals
  double | prob_B (int p, int q, int r) const The rule probability of given binary rule
  double | prob_U (int p, int m) const The rule probability of given unary rule
  void | set_rule_prob_cache () (re-)set rule probability caches
  | file i/o functions
  EST_read_status | load (const EST_String &filename) Load grammar from named file
  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.

`Constructor and initialisation functions`

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

`utility functions`

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

`LISP get_rules()`
  Return rules as LISP list

`SCFGRuleList rules`
  The rules themselves

`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

`EST_String nonterminal(int p) const`
  Convert nonterminal index to string form

`EST_String terminal(int m) const`
  Convert terminal index to string form

`int nonterminal(const EST_String &p) const`
  Convert nonterminal string to index

`int terminal(const EST_String &m) const`
  Convert terminal string to index

`int num_nonterminals() const`
  Number of nonterminals

`int num_terminals() const`
  Number of terminals

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

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

`void set_rule_prob_cache()`
  (re-)set rule probability caches

`file i/o functions`

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

`EST_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