class documentation
class FeatStructNonterminal(FeatDict, Nonterminal): (source)
Constructor: FeatStructNonterminal(features, **morefeatures)
A feature structure that's also a nonterminal. It acts as its own symbol, and automatically freezes itself when hashed.
Method | __hash__ |
If this feature structure is frozen, return its hash value; otherwise, raise TypeError. |
Method | symbol |
Return the node value corresponding to this Nonterminal. |
Inherited from FeatDict
:
Method | __contains__ |
Return true if a feature with the given name or path exists. |
Method | __deepcopy__ |
Undocumented |
Method | __delitem__ |
If the feature with the given name or path exists, delete its value; otherwise, raise KeyError. |
Method | __getitem__ |
If the feature with the given name or path exists, return its value; otherwise, raise KeyError. |
Method | __init__ |
Create a new feature dictionary, 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. |
Method | __str__ |
Display a multi-line representation of this feature dictionary as an FVM (feature value matrix). |
Method | get |
If the feature with the given name or path exists, return its value; otherwise, return default. |
Method | has |
Return true if a feature with the given name or path exists. |
Method | update |
Undocumented |
Class Variable | clear |
Undocumented |
Class Variable | pop |
Undocumented |
Class Variable | popitem |
Undocumented |
Class Variable | setdefault |
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 | _str |
No summary |
Method | _values |
Return an iterable of the feature values directly defined by this FeatStruct. |
Constant | _INDEX |
Undocumented |
Inherited from FeatStruct
(via FeatDict
):
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 | __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 |
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 |
Return the feature structure that is obtained by deleting any feature whose value is a Variable. |
Method | rename |
No summary |
Method | retract |
No summary |
Method | substitute |
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 |
Return a hash value for this feature structure. |
Method | _equal |
Return True iff self and other have equal values. |
Method | _find |
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 |
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 |
Inherited from Nonterminal
(via FeatDict
, FeatStruct
, SubstituteBindingsI
):
Method | __div__ |
Return a new nonterminal whose symbol is A/B, where A is the symbol for this nonterminal, and B is the symbol for rhs. |
Method | __truediv__ |
Return a new nonterminal whose symbol is A/B, where A is the symbol for this nonterminal, and B is the symbol for rhs. This function allows use of the slash / operator with the future import of division. |
Instance Variable | _symbol |
The node value corresponding to this Nonterminal. This value must be immutable and hashable. |
overrides
nltk.featstruct.FeatStruct.__hash__
If this feature structure is frozen, return its hash value; otherwise, raise TypeError.
overrides
nltk.grammar.Nonterminal.symbol
Return the node value corresponding to this Nonterminal.
Returns | |
(any) | Undocumented |