Package nltk_lite :: Module featurestructure :: Class AliasedFeatureVariable
[hide private]
[frames] | no frames]

Class AliasedFeatureVariable

source code

SubstituteBindingsI --+    
                      |    
        FeatureVariable --+
                          |
                         AliasedFeatureVariable

A set of variables that are constrained to be equal. An aliased variable can be used in place of a simple variable. In particular, an aliased variable stands for a single feature value, and requires that each its aliases are bound to that same value. Aliased variables can be categorized according to their values in a set of bindings:

Instance Methods [hide private]
 
__init__(self, *aliases)
Construct a new feature structure variable that contains the given aliases.
source code
string
identifier(self)
Raise ValueError, since aliased variables do not have a single identifier.
source code
 
aliases(self)
Returns: A list of the variables that are constrained to be equal by this aliased variable.
source code
 
__repr__(self)
Returns: A string representation of this feature structure variable.
source code
 
__cmp__(self) source code
 
__hash__(self) source code

Inherited from FeatureVariable: alias, substitute_bindings

Static Methods [hide private]

Inherited from FeatureVariable: parse

Class Variables [hide private]

Inherited from FeatureVariable (private): _next_numbered_id

Instance Variables [hide private]
  _aliases
The set of aliases contained by this aliased variable.
Method Details [hide private]

__init__(self, *aliases)
(Constructor)

source code 

Construct a new feature structure variable that contains the given aliases. If aliases contains aliased variables, then they are replaced by their lists of aliases.

Raises:
  • ValueError - If no aliases are specified.
Overrides: FeatureVariable.__init__

identifier(self)

source code 

Raise ValueError, since aliased variables do not have a single identifier.

Returns: string
This variable's unique identifier.
Overrides: FeatureVariable.identifier

aliases(self)

source code 
Returns:
A list of the variables that are constrained to be equal by this aliased variable.

__repr__(self)
(Representation operator)

source code 
Returns:
A string representation of this feature structure variable. A feature structure variable with identifiers X1, X2, ..., Xn is represented as '?<X1=X2=...=Xn>'.
Overrides: FeatureVariable.__repr__

__cmp__(self)
(Comparison operator)

source code 
Overrides: FeatureVariable.__cmp__

__hash__(self)
(Hashing function)

source code 
Overrides: FeatureVariable.__hash__

Instance Variable Details [hide private]

_aliases

The set of aliases contained by this aliased variable. This set is encoded as a dictionary whose keys are variables.