Parse Nodes¶
There are five types of nodes in E-HowNet expression — Entity, Reference, Placeholder, Feature, Function, and Subject.


Node Prototype¶
- class EhnParseNode
The prototype of E-HowNet parsing nodes.
See also:
ehn.parse.node.base.EhnParseNode- head: str¶
The head of this node.
- get_features(key=None)¶
Get the features (or
[]if not exists).If key is set, returns only the features with feature.head==key.
- get_arguments()¶
Get the arguments (or
[]if not exists).
- get_value()¶
Get the value (or
Noneif not exists).
- get_function()¶
Get the function (or
Noneif not exists).
- get_anchor()¶
Get the anchor (or
Noneif not exists).
- get_coindex()¶
Get the coindex key (the head of the anchor, the head of reference nodes, or
Noneotherwise).
- children()¶
Yields all direct child nodes of this node.
- descendant()¶
Yields all descendant nodes (including self) of this node.
- dumps()¶
Converts to text representation.
- tree() ehn.parse.node.base.EhnParseTree¶
Generates a tree representation of this node and all its descendant nodes.
One may use
node.tree().show()to show a pretty tree representation.
Entity-Like Nodes¶
Entity¶
- class EhnParseEntityBase
The base class of E-HowNet parsing entity nodes.
See also:
ehn.parse.node.base.EhnParseEntityBaseSubclasses:
EhnParseNormalEntityA normal entity. Can be an anchor.EhnParseFunctionEntityAn entity with function head. Can be an anchor.EhnParseNameEntityA name entity.EhnParseNumberEntityA number entity.
Reference¶
- class EhnParseReferenceBase
The base class of E-HowNet parsing reference nodes.
See also:
ehn.parse.node.base.EhnParseReferenceBaseSubclasses:
EhnParseCoindexReferenceAn entity refers to an anchor entity.EhnParseSubjectReferenceAn entity refers to the unmentioned subject entity (EhnParseSubjectin feature-based expressions.)EhnParseTildeReferenceAn entity refers to the root entity.
Placeholder¶
- class EhnParsePlaceholderBase
The base class of E-HowNet parsing restriction nodes.
See also:
ehn.parse.node.base.EhnParsePlaceholderBaseSubclasses:
EhnParseRestrictionPlaceholder. Can be an anchor.EhnParseAnyPlaceholderA placeholder without restriction.
- property value¶
Must be an Entity (for
EhnParseRestrictionPlaceholder) orNone(forEhnParseAnyPlaceholder).
Non-Entity-Like Nodes¶
Feature¶
- class EhnParseFeatureBase
The base class of E-HowNet parsing feature nodes.
See also:
ehn.parse.node.base.EhnParseFeatureBaseSubclasses:
EhnParseNormalFeatureA normal feature.EhnParseFunctionFeatureAn feature with function head.
- property value¶
Can be a Entity-Like Node.
Function¶
- class EhnParseFunctionBase
The base class of E-HowNet parsing function nodes.
See also:
ehn.parse.node.base.EhnParseFunctionBaseSubclasses:
EhnParseFunction.
- property arguments¶
A list of Entity-Like Nodes.
Subject¶
- class EhnParseSubjectBase
The base class of E-HowNet parsing unmentioned subject nodes. Works similar to entities but is not an entity. Used only in feature-based expressions.
See also:
ehn.parse.node.base.EhnParseSubjectBaseSubclasses:
EhnParseSubject. Always an anchor ofx?.
Partial Nodes¶
Function Head¶
- class EhnParseFunctionHead
The base class of nodes with a function as its head.
Note that the attribute obj.head of this object obj returns obj.function.head.
See also:
ehn.parse.node.base.EhnParseFunctionHeadSubclasses:
Anchor Body¶
- class EhnParseAnchorBody
The base class of anchor nodes.
See also:
ehn.parse.node.base.EhnParseAnchorBodySubclasses:
Anchor¶
- class EhnParseAnchor
The coindex target.
See also:
ehn.parse.node.base.EhnParseAnchor- head: str¶
The coindex of this anchor.