Module featurestructure
source code
Basic data classes for representing feature structures. A feature
structure is a mapping from feature names to feature values,
where:
-
Each feature
name is a case sensitive string.
-
Each feature
value can be a base value (such as a string), a variable, or a
nested feature structure.
Feature structures are typically used to represent partial information
about objects. A feature name that is not mapped to a value stands for a
feature whose value is unknown (not a feature without a value).
Two feature structures that represent (potentially overlapping)
information about the same object can be combined by unification. When
two inconsistant feature structures are unified, the unification fails
and returns None.
Features are usually specified using feature paths, or
tuples of feature names that specify path through the nested feature
structures to a value.
Feature structures may contain reentrant feature values. A reentrant
feature value is a single feature value that can be accessed via
multiple feature paths. Unification preserves the reentrance relations
imposed by both of the unified feature structures. After unification,
any extensions to a reentrant feature value will be visible using any of
its feature paths.
Feature structure variables are encoded using the FeatureVariable class. Feature structure variables are
essentially just names; they do not directly contain values. Instead,
the mapping from variables to values is encoded externally to the
variable, as a set of bindings. These bindings are stored using the FeatureBindings class.