Database¶
This section describes the E-HowNet database.
One may download the database file manually from https://ckip.iis.sinica.edu.tw/CKIP/ehownet_reg/ .
- class EhnDb(*, db_file)
The E-HowNet database.
See also:
ehn.db.core.EhnDb
- Parameters
db_file (str) – The path to the SQLite3 database file.
- text2nid_concept: dict¶
A dictionary that maps concept label to its node ID.
- text2nid_word: dict¶
A dictionary that maps word label to its node ID.
- text2nid_partial: dict¶
A dictionary that maps any subtext of concept label to its node ID.
For example, both “entity” and “事物” maps to the node ID of the concept “entity|事物”.
- get_nids(text, *, concept=True, word=True, full_match=False)¶
Query node IDs.
- Parameters
text (str) – the query text.
concept (boolean) – returns concept node.
word (boolean) – returns word node.
full_match (boolean) – returns only the nodes that fully match their label.
- Returns
A list of node IDs.
- class EhnDbNode
The E-HowNet database node.
See also:
ehn.db.data.EhnDbNode
- nid: int¶
The node ID.
- label: str¶
The node label.
- data: ~ehn.db.data.EhnDbNodeData¶
The node data.
Note that one may access data attribute directly (e.g. obj.defn of this object obj returns obj.data.defn).
- class EhnDbNodeData
The E-HowNet database node data.
See also:
ehn.db.data.EhnDbNodeData
- defn: str¶
The node definition.
- type: ~ehn.db.data.EhnDbNodeType¶
The node type.
- words: List[~ehn.db.data.EhnDbWordData]¶
The list of attached words.
- definite: bool¶
Whether this node is an instance of is parent node of not.
- class EhnDbWordData
The E-HowNet database word data.
See also:
ehn.db.data.EhnDbWordData
- word: str¶
The word.
- sense_no: str¶
The sense number ID.
- class EhnDbNodeType
The enum class of E-HowNet database node type.
See also:
ehn.db.data.EhnDbNodeType
- C = 'C'¶
The concept type.
- W = 'W'¶
The word type.