class documentation

A list of feature values, where each feature value is either a basic value (such as a string or an integer), or a nested feature structure.

Feature lists may contain reentrant feature values. A "reentrant feature value" is a single feature value that can be accessed via multiple feature paths. Feature lists may also be cyclic.

Two feature lists are considered equal if they assign the same values to all features, and have the same reentrances.

See Also
FeatStruct for information about feature paths, reentrance, cyclic feature structures, mutability, freezing, and hashing.
Method __deepcopy__ Undocumented
Method __delitem__ If the feature with the given name or path exists, delete its value; otherwise, raise KeyError.
Method __getitem__ Undocumented
Method __init__ Create a new feature list, with the specified features.
Method __setitem__ Set the value for the feature with the given name or path to value. If name_or_path is an invalid path, raise KeyError.
Class Variable __iadd__ Undocumented
Class Variable __imul__ Undocumented
Class Variable append Undocumented
Class Variable extend Undocumented
Class Variable insert Undocumented
Class Variable pop Undocumented
Class Variable remove Undocumented
Class Variable reverse Undocumented
Class Variable sort Undocumented
Method _items Return an iterable of (fid,fval) pairs, where fid is a feature identifier and fval is the corresponding feature value, for all features defined by this FeatStruct.
Method _keys Return an iterable of the feature identifiers used by this FeatStruct.
Method _repr Return a string representation of this feature structure.
Method _values Return an iterable of the feature values directly defined by this FeatStruct.
Constant _INDEX_ERROR Undocumented

Inherited from FeatStruct:

Method __eq__ Return true if self and other are both feature structures, assign the same values to all features, and contain the same reentrances. I.e., return self.equal_values(other, check_reentrance=True).
Method __hash__ If this feature structure is frozen, return its hash value; otherwise, raise TypeError.
Method __lt__ Undocumented
Method __ne__ Undocumented
Method __new__ Construct and return a new feature structure. If this constructor is called directly, then the returned feature structure will be an instance of either the FeatDict class or the FeatList class.
Method __repr__ Display a single-line representation of this feature structure, suitable for embedding in other representations.
Method copy Return a new copy of self. The new copy will not be frozen.
Method cyclic Return True if this feature structure contains itself.
Method equal_values Return True if self and other assign the same value to to every feature. In particular, return true if self[p]==other[p] for every feature path p such that self[p] or other[p] is a base value (i.e., not a nested feature structure).
Method freeze Make this feature structure, and any feature structures it contains, immutable. Note: this method does not attempt to 'freeze' any feature value that is not a FeatStruct; it is recommended that you use only immutable feature values.
Method frozen Return True if this feature structure is immutable. Feature structures can be made immutable with the freeze() method. Immutable feature structures may not be made mutable again, but new mutable copies can be produced with the ...
Method remove_variables Return the feature structure that is obtained by deleting any feature whose value is a Variable.
Method rename_variables No summary
Method retract_bindings No summary
Method substitute_bindings No summary
Method subsumes Return True if self subsumes other. I.e., return true If unifying self with other would result in a feature structure equal to other.
Method unify Undocumented
Method variables No summary
Method walk Return an iterator that generates this feature structure, and each feature structure it contains. Each feature structure will be generated exactly once.
Method _calculate_hashvalue Return a hash value for this feature structure.
Method _equal Return True iff self and other have equal values.
Method _find_reentrances Return a dictionary that maps from the id of each feature structure contained in self (including self) to a boolean value, indicating whether it is reentrant or not.
Method _freeze Make this feature structure, and any feature structure it contains, immutable.
Method _walk Undocumented
Constant _FROZEN_ERROR Undocumented
Instance Variable _frozen frozen or not. Once this flag is set, it should never be un-set; and no further modification should be made to this feature structue.
Instance Variable _hash Undocumented
def __deepcopy__(self, memo): (source)
def __delitem__(self, name_or_path): (source)

If the feature with the given name or path exists, delete its value; otherwise, raise KeyError.

def __getitem__(self, name_or_path): (source)

Undocumented

def __init__(self, features=()): (source)

Create a new feature list, with the specified features.

Parameters
featuresThe initial list of features for this feature list. If features is a string, then it is paresd using FeatStructReader. Otherwise, it should be a sequence of basic values and nested feature structures.
def __setitem__(self, name_or_path, value): (source)

Set the value for the feature with the given name or path to value. If name_or_path is an invalid path, raise KeyError.

__iadd__ = (source)

Undocumented

__imul__ = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

def _items(self): (source)

Return an iterable of (fid,fval) pairs, where fid is a feature identifier and fval is the corresponding feature value, for all features defined by this FeatStruct.

def _keys(self): (source)

Return an iterable of the feature identifiers used by this FeatStruct.

def _repr(self, reentrances, reentrance_ids): (source)

Return a string representation of this feature structure.

Parameters
reentrancesA dictionary that maps from the id of each feature value in self, indicating whether that value is reentrant or not.
reentrance_idsA dictionary mapping from each id of a feature value to a unique identifier. This is modified by repr: the first time a reentrant feature value is displayed, an identifier is added to reentrance_ids for it.
def _values(self): (source)

Return an iterable of the feature values directly defined by this FeatStruct.

_INDEX_ERROR: str = (source)

Undocumented

Value
'Expected int or feature path.  Got %r.'