EHowNet Utilities
Project description
Official E-HowNet Utilities
Introduction
Git
PyPI
Requirements
Python 3.5+
PLY (Python Lex-Yacc) 3.11+
TreeLib 1.5.5+
wcwidth 0.1.7+
Installation
pip install ehownet -U
Usage
E-HowNet Parser
CLI
# Usage
ehn-parser <text> [<text> ...]
# Example
ehn-parser \
"{MusicTool|樂器_x:predication={own|有:possession={按鈕|PushingButton:whole={x}}}}" \
"{InstitutePlace|場所:telic={or({experiment|實驗:location={~}},{research|研究:location={~}})}}"
Output:
#1
[Entity $x] MusicTool|樂器
└── [Feature] predication
└── [Entity] own|有
└── [Feature] possession
└── [Entity] 按鈕|PushingButton
└── [Feature] whole
└── $x
#2
[Entity] InstitutePlace|場所
└── [Feature] telic
└── [Entity]
└── [Function] or
├── [Entity] experiment|實驗
│ └── [Feature] location
│ └── [TildeEntity]
└── [Entity] research|研究
└── [Feature] location
└── [TildeEntity]
Python API
from ehn.parse import EhnParser
text = '{MusicTool|樂器_x:predication={own|有:possession={按鈕|PushingButton:whole={x}}}}'
parser = EhnParser()
ress = parser(text, debug=False)
for res in ress:
print(res)
Output:
[Entity $x] MusicTool|樂器
└── [Feature] predication
└── [Entity] own|有
└── [Feature] possession
└── [Entity] 按鈕|PushingButton
└── [Feature] whole
└── $x
License
Copyright (c) 2019 Mu Yang under the CC-BY-NC-SA 4.0 License. All rights reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ehownet-0.2.0.post1.tar.gz
(7.1 kB
view hashes)