Package nltk_lite :: Package contrib :: Package mit :: Package six863 :: Package semantics :: Module featurechart :: Class FeatureTreeEdge
[hide private]
[frames] | no frames]

Class FeatureTreeEdge

source code

??-171 --+
         |
        FeatureTreeEdge

FIXME: out of date documentation

A modification of TreeEdge to handle nonterminals with features (known as Categories.

In addition to the span, left-hand side, right-hand side, and dot position (described at TreeEdge), a FeatureTreeEdge includes vars, a set of FeatureBindings saying which FeatureVariables are set to which values.

These values are applied when examining the lhs or rhs of a FeatureTreeEdge.

For more information about edges, see the EdgeI interface.

Instance Methods [hide private]
 
__init__(self, span, lhs, rhs, dot=0, vars=None)
Construct a new FeatureTreeEdge.
source code
VariableBindings
vars(self)
Returns: the VariableBindings mapping FeatureVariables to values.
source code
Category
lhs(self)
Returns: the value of the left-hand side with variables set.
source code
Category
orig_lhs(self)
Returns: the value of the left-hand side with no variables set.
source code
Category
rhs(self)
Returns: the value of the right-hand side with variables set.
source code
Category
orig_rhs(self)
Returns: the value of the right-hand side with no variables set.
source code
 
__str__(self) source code
Static Methods [hide private]
FeatureTreeEdge
from_production(production, index, bindings=None)
Returns: A new FeatureTreeEdge formed from the given production.
source code
Method Details [hide private]

__init__(self, span, lhs, rhs, dot=0, vars=None)
(Constructor)

source code 

Construct a new FeatureTreeEdge.

Parameters:
  • span ((int, int)) - A tuple (s,e), where subtokens[s:e] is the portion of the sentence that is consistent with the new edge's structure.
  • lhs (Category) - The new edge's left-hand side, specifying the hypothesized tree's node value.
  • rhs (list of (Category and string)) - The new edge's right-hand side, specifying the hypothesized tree's children.
  • dot (int) - The position of the new edge's dot. This position specifies what prefix of the production's right hand side is consistent with the text. In particular, if sentence is the list of subtokens in the sentence, then subtokens[span[0]:span[1]] can be spanned by the children specified by rhs[:dot].
  • vars (FeatureBindings) - The bindings specifying what values certain variables in this edge must have.

from_production(production, index, bindings=None)
Static Method

source code 
Returns: FeatureTreeEdge
A new FeatureTreeEdge formed from the given production. The new edge's left-hand side and right-hand side will be taken from production; its span will be (index, index); its dot position will be 0, and it may have specified variables set.

vars(self)

source code 
Returns: VariableBindings
the VariableBindings mapping FeatureVariables to values.

lhs(self)

source code 
Returns: Category
the value of the left-hand side with variables set.

orig_lhs(self)

source code 
Returns: Category
the value of the left-hand side with no variables set.

rhs(self)

source code 
Returns: Category
the value of the right-hand side with variables set.

orig_rhs(self)

source code 
Returns: Category
the value of the right-hand side with no variables set.