A feature structure that acts like a Python dictionary. I.e., a
mapping from feature identifiers to feature values, where feature
identifiers can be strings or Features; and
feature values can be either basic values (such as a string or an
integer), or nested feature structures. Feature identifiers for
FeatDict
s are sometimes called feature
names.
Two feature dicts are considered equal if they assign the same values
to all features, and have the same reentrances.
new empty dictionary
|
__init__(self,
features=None,
**morefeatures)
Create a new feature dictionary, with the specified features. |
source code
|
|
Inherited from dict :
__cmp__ ,
__ge__ ,
__getattribute__ ,
__gt__ ,
__iter__ ,
__le__ ,
__len__ ,
__lt__ ,
fromkeys ,
items ,
iteritems ,
iterkeys ,
itervalues ,
keys ,
values
Inherited from object :
__delattr__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__
|
|
__getitem__(self,
name_or_path)
If the feature with the given name or path exists, return its value;
otherwise, raise KeyError . |
source code
|
|
D[k] if k in D, else d
|
get(self,
name_or_path,
default=None)
If the feature with the given name or path exists, return its value;
otherwise, return default . |
source code
|
|
True if D has a key k, else False
|
|
True if D has a key k, else False
|
has_key(self,
name_or_path)
Return true if a feature with the given name or path exists. |
source code
|
|
|
__delitem__(self,
name_or_path)
If the feature with the given name or path exists, delete its value;
otherwise, raise KeyError . |
source code
|
|
|
__setitem__(self,
name_or_path,
value)
Set the value for the feature with the given name or path to
value . |
source code
|
|
None
|
|
v, remove specified key and return the corresponding value
|
pop(D,
k,
d=...)
If key is not found, d is returned if given, otherwise KeyError is
raised If self is frozen, raise ValueError. |
source code
|
|
(k, v), remove and return some (key, value) pair as a
|
popitem(D)
2-tuple; but raise KeyError if D is empty If self is frozen, raise
ValueError. |
source code
|
|
D.get(k,d), also set D[k]=d if k not in D
|
|
None
|
update(self,
features=None,
**morefeatures)
Update D from E and F: for k in E: D[k] = E[k] (if E has keys else:
for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k] |
source code
|
|
|
|
Inherited from FeatStruct :
copy
|
|
_keys(self)
Return an iterable of the feature identifiers used by this
FeatStruct. |
source code
|
|
|
_values(self)
Return an iterable of the feature values directly defined by this
FeatStruct. |
source code
|
|
|
_items(self)
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. |
source code
|
|
|
__str__(self)
Display a multi-line representation of this feature dictionary as an
FVM (feature value matrix). |
source code
|
|
|
_repr(self,
reentrances,
reentrance_ids)
Returns:
A string representation of this feature structure. |
source code
|
|
|
_str(self,
reentrances,
reentrance_ids)
Returns:
A list of lines composing a string representation of this feature
dictionary. |
source code
|
|
Inherited from FeatStruct :
__repr__
|
Inherited from FeatStruct :
__eq__ ,
__hash__ ,
__ne__ ,
equal_values
|
Inherited from FeatStruct :
freeze ,
frozen
|
Inherited from FeatStruct :
cyclic ,
reentrances ,
walk
|
Inherited from FeatStruct :
remove_variables ,
rename_variables ,
retract_bindings ,
substitute_bindings ,
variables
|
Inherited from FeatStruct :
subsumes ,
unify
|