class nltk.FeatDict(features=None, **morefeatures)[source]

A feature structure that acts like a Python dictionary. I.e., a mapping from feature identifiers to feature values, where a feature identifier can be a string or a Feature; and where a feature value can be either a basic value (such as a string or an integer), or a nested feature structure. A feature identifiers for a FeatDict is sometimes called a “feature name”.

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

See:FeatStruct for information about feature paths, reentrance, cyclic feature structures, mutability, freezing, and hashing.


__init__([features]) Create a new feature dictionary, with the specified features.
clear(() -> None.  Remove all items from D.) If self is frozen, raise ValueError.
copy([deep]) Return a new copy of self.
cyclic() Return True if this feature structure contains itself.
equal_values(other[, check_reentrance]) Return True if self and other assign the same value to to every feature.
freeze() Make this feature structure, and any feature structures it contains, immutable.
fromkeys(...) v defaults to None.
frozen() Return True if this feature structure is immutable.
get(name_or_path[, default]) If the feature with the given name or path exists, return its value; otherwise, return default.
has_key(name_or_path) Return true if a feature with the given name or path exists.
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
keys(() -> list of D’s keys)
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised If self is frozen, raise ValueError.
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
remove_variables() Return the feature structure that is obtained by deleting any feature whose value is a Variable.
rename_variables([vars, used_vars, new_vars])
setdefault((k[,d]) -> D.get(k,d), ...) If self is frozen, raise ValueError.
subsumes(other) Return True if self subsumes other.
unicode_repr() Display a single-line representation of this feature structure, suitable for embedding in other representations.
unify(other[, bindings, trace, fail, ...])
values(() -> list of D’s values)
walk() Return an iterator that generates this feature structure, and each feature structure it contains.