| Trees | Indices | Help |
|
|---|
|
|
object --+
|
parsers.pcfg.model.PcfgModel --+
|
HalfspanPcfgModel
A simple implementation of the PcfgModel interface. The model just uses counts to compute the probabilities, with only very simple smoothing.
By default, unary expansions are fobidden, since our grammar doesn't
use them. If you want to allow them, set
unary_expansions=True.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
|||
|
|||
|
|||
MODEL_TYPE = hash(x) |
|||
TRAINING_OPTIONS = PcfgModel.TRAINING_OPTIONS+ [ModuleOption('
|
|||
LEX_INPUT_TYPES =
|
|||
|
|||
|
Inherited from Inherited from Inherited from |
|||
|
|||
Creates an empty, untrained model. To load a previously stored model, use from_file(). Optionally stores some custom descriptive text. This will be included in the descriptive text that gets stored along with the model.
|
Returns the string observation counted for a given chord. Note that the chord should already have been made relative to its parent. |
Subclasses should implement this method to return the raw data of the model in a form that can be pickled and written out to a file. A default implementation to complement the implementation of _load_model is provided.
|
Subclasses should implement this method to load up the model data given in the argument data. They should return an instance of themselves. The data will be in the form of a dictionary, as returned by the class' _get_model_data(). A default implementation that just uses simple pickling is provided.
|
Probability of a (non-leaf) subtree, computed from the probability of its expansions. This doesn't include the probabilities of the subtrees of the daughters. To get the full inside probability, multiply the returned value with the daughters' insider probabilities. |
Outer probability of a subtree. This is approximated in these models as the prior probability of the parent of the tree. Prior probability P(parent) is used to approximate the outside probability. |
|
Trains a new model using the data in the list of sequences.
|
Generate a chord sequence from the model.
|
|
|||
TRAINING_OPTIONS
|
LEX_INPUT_TYPES
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Nov 26 16:04:57 2012 | http://epydoc.sourceforge.net |