Class FeatureVariable
source code
SubstituteBindingsI --+
|
FeatureVariable
- Known Subclasses:
-
AliasedFeatureVariable
A variable that can stand for a single feature value in a feature
structure. Each variable is defined by a unique identifier, which can be
either a case-sensitive string (for named
variables) or an integer (for numbered
variables).
Named variables are created by calling the
FeatureVariable
constructor with a string identifier. If
multiple named variables objects are created with the same identifier,
then they represent the same variable. Numbered variables are created by
calling the FeatureVariable
constructor with no arguments; a
new identifier will be automatically generated. Each new numbered
variable object is guaranteed to have a unique identifier.
Variables do not directly contain values; instead, the mapping from
variables to values is encoded externally as a set of bindings, using FeatureBindings. If a set of bindings assigns a value
to a variable, then that variable is said to be bound with respect to
those bindings; otherwise, it is said to be unbound.
|
parse(s)
Given a string that encodes a feature variable, return that variable. |
source code
|
|
__init__(self,
identifier=None)
(Constructor)
| source code
|
Construct a new feature structure variable.
- Parameters:
identifier (string ) - A unique identifier for this variable. Any two
FeatureVariable objects with the same identifier are
treated as the same variable.
|
- Returns:
string
- This variable's unique identifier.
|
- Returns:
- A string representation of this feature structure variable. A
feature structure variable with identifier
x
is represented as '?x' .
|
Given a string that encodes a feature variable, return that variable.
This method can be used to parse both FeatureVariables and
AliasedFeatureVariables . However, this method can not be
used to parse numbered variables, since doing so could violate the
guarantee that each numbered variable object has a unique identifier.
|