Introduction¶
Author¶
- Mu Yang <emfomy@gmail.com>
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¶
See http://ehownet.readthedocs.io/src/grammar.html for E-HowNet grammar.
CLI¶
# Usage
ehn-parser <text> [<text> ...]
# Example
ehn-parser \
"{MusicTool|樂器_x:predication={own|有:possession={按鈕|PushingButton:whole={x}}}}" \
"{InstitutePlace|場所:telic={or({experiment|實驗:location={~}},{research|研究:location={~}})}}" \
"TimePoint={},manner={urgent|急}"
Output:
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: