| Trees | Indices | Help |
|
|---|
|
|
object --+
|
PcfgModel
A trainable model used by a pcfg parser.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
MODEL_TYPE = Nonehash(x) |
|||
TRAINING_OPTIONS =
|
|||
LEX_INPUT_TYPES =
|
|||
|
|||
| _filename | |||
|
options Instead of processing training options when instantiating (which makes it impossible to have required options, since we're not always training when instantiating), we process the training options the first time they're needed. |
|||
| description | |||
|
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.
|
Verifies and processes the training option values. Access them in self.options. |
Instead of processing training options when instantiating (which makes it impossible to have required options, since we're not always training when instantiating), we process the training options the first time they're needed. If you want to do this ahead of time to verify the validity of the values, call process_training_options. |
Removes all the model's data. It is assumed that the tagger will not be used at all after this has been called. |
Don't override this. You can add your own information into the descriptive text (per subclass, for example) by calling __init__ with the description kwarg, or by setting the model_description attribute. You might, for example, want to do this at training time. |
Generate a surface form from the PCFG model. A pcfg model might not provide an implementation of this, in which case it will always return None. |
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. |
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. |
Probability of a (non-leaf) subtree, computed from the probability of its expansions and the inner probabilities already associated with its components. The result is the inside probability of the subtree. There are several different cases. It may be a unary expansion, in
which case
|
Outside probability of a subtree. This is approximated in these models as the prior probability of the parent of the tree.
|
|
|||
_filename
|
optionsInstead of processing training options when instantiating (which makes it impossible to have required options, since we're not always training when instantiating), we process the training options the first time they're needed. If you want to do this ahead of time to verify the validity of the values, call process_training_options.
|
description
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Nov 26 16:04:57 2012 | http://epydoc.sourceforge.net |