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

Module featurestructure

source code

Basic data classes for representing feature structures. A feature structure is a mapping from feature names to feature values, where:

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.


To Do: more test cases

Classes [hide private]
  SubstituteBindingsI
An interface for classes that can perform substitutions for feature variables.
    Feature Structures
  FeatureStructure
A structured set of features.
    Variables
  FeatureVariable
A variable that can stand for a single feature value in a feature structure.
  AliasedFeatureVariable
A set of variables that are constrained to be equal.
  FeatureBindings
A partial mapping from feature variables to values.
    Unit Tests
  FeatureStructureTestCase
Unit testing for FeatureStructure
Functions [hide private]
 
testsuite() source code
 
test(verbosity) source code
 
display_unification(fs1, fs2, indent=' ') source code
 
demo(trace=True) source code