ehn.parse.node.base module

Please refer the tutorial “Parse Nodes”.

class ehn.parse.node.base.EhnParseNode[source]

Bases: object

E-HowNet Parsing: Base Node

class ehn.parse.node.base.EhnParseTree(tree=None, deep=False, node_class=None, identifier=None)[source]

Bases: treelib.tree.Tree

show(*args, data_property='_tree_label', **kwargs)[source]

Print the tree structure in hierarchy style.

You have three ways to output your tree data, i.e., stdout with show(), plain text file with save2file(), and json string with to_json(). The former two use the same backend to generate a string of tree structure in a text graph.

  • Version >= 1.2.7a*: you can also specify the line_type parameter, such as ‘ascii’ (default), ‘ascii-ex’, ‘ascii-exr’, ‘ascii-em’, ‘ascii-emv’, ‘ascii-emh’) to the change graphical form.

Parameters
  • nid – the reference node to start expanding.

  • level – the node level in the tree (root as level 0).

  • idhidden – whether hiding the node ID when printing.

  • filter – the function of one variable to act on the Node object. When this parameter is specified, the traversing will not continue to following children of node whose condition does not pass the filter.

  • key – the key param for sorting Node objects in the same level.

  • reverse – the reverse param for sorting Node objects in the same level.

  • line_type

  • data_property – the property on the node data object to be printed.

Returns

None

class ehn.parse.node.base.EhnParseEntityBase[source]

Bases: ehn.parse.node.base.EhnParseNode

E-HowNet Parsing: Base Entity Node

class ehn.parse.node.base.EhnParseFeatureBase[source]

Bases: ehn.parse.node.base.EhnParseNode

E-HowNet Parsing: Base Feature Node

class ehn.parse.node.base.EhnParseFunctionBase[source]

Bases: ehn.parse.node.base.EhnParseNode

E-HowNet Parsing: Base Function Node

class ehn.parse.node.base.EhnParseRestrictionBase[source]

Bases: ehn.parse.node.base.EhnParseNode

E-HowNet Parsing: Base Function Node

class ehn.parse.node.base.EhnParseRootBase[source]

Bases: ehn.parse.node.base.EhnParseNode

E-HowNet Parsing: Base Root Node

class ehn.parse.node.base.EhnParseAnchor(head=None)[source]

Bases: object

E-HowNet Parsing: Node Anchor

class ehn.parse.node.base.EhnParseStrHead(head)[source]

Bases: object

E-HowNet Parsing: Base Node with String Head

class ehn.parse.node.base.EhnParseFunctionHead(function)[source]

Bases: object

E-HowNet Parsing: Base Node with Function Head

class ehn.parse.node.base.EhnParseValueBody(value)[source]

Bases: object

E-HowNet Parsing: Base Node with Value

class ehn.parse.node.base.EhnParseFeatureBody(*features)[source]

Bases: object

E-HowNet Parsing: Base Node with Feature

class ehn.parse.node.base.EhnParseArgumentBody(*arguments)[source]

Bases: object

E-HowNet Parsing: Base Node with Argument

class ehn.parse.node.base.EhnParseAnchorBody(anchor=None)[source]

Bases: object

E-HowNet Parsing: Base Node with Anchor