Parse Nodes¶
There are five types of nodes in E-HowNet expression — Entity, Feature, Function, Restriction, and Root.
Major Nodes¶
-
class
EhnParseNode
The prototype of E-HowNet parsing nodes.
-
head
: str¶ The head of this node.
-
children
()¶ Yields all direct child nodes of this node.
-
descendant
()¶ Yields all descendant nodes (including self) of this node.
-
tree
() → treelib.Tree¶ Generates a tree representation of this node and all its descendant nodes.
-
Entity¶
-
class
EhnParseEntityBase
The base class of E-HowNet parsing entity nodes.
Subclasses:
EhnParseNormalEntity
A normal entity. Can be an anchor.EhnParseFunctionEntity
An entity with function head. Can be an anchor.EhnParseAnyEntity
A placeholder entity.EhnParseNameEntity
A name entity.EhnParseNumberEntity
A number entity.EhnParseTildeEntity
An entity refers to the parent entity.EhnParseCoindexEntity
An entity refers to an anchor entity.
Feature¶
-
class
EhnParseFeatureBase
The base class of E-HowNet parsing feature nodes.
Subclasses:
EhnParseNormalFeature
A normal feature.EhnParseFunctionFeature
An feature with function head.
-
property
value
¶ Can be either Entity or Restriction.
Function¶
-
class
EhnParseFunctionBase
The base class of E-HowNet parsing function nodes.
Subclasses:
-
property
arguments
¶ A list of Entities or Restriction
-
property
Restriction¶
-
class
EhnParseRestrictionBase
The base class of E-HowNet parsing function nodes.
Subclasses:
EhnParseRestriction
. Can be an anchor.