Skip to main content

E-HowNet Utilities

Project description

CKIP E-HowNet Tools

Git

https://github.com/emfomy/ehownet

GitHub Version GitHub Release GitHub Issues

PyPI

https://pypi.org/project/ehownet

PyPI Version PyPI License PyPI Downloads PyPI Python PyPI Implementation PyPI Status

Documentation

https://ehownet.readthedocs.io/

ReadTheDocs Home

Author

Requirements

Installation

pip install -U ehownet

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={~}})}}" \
   "TimePoint={},manner={urgent|急}"

Output:

 #1
 [Entity $x] MusicTool|樂器
 └── [Feature] predication
     └── [Entity] own|有
         └── [Feature] possession
             └── [Entity] 按鈕|PushingButton
                 └── [Feature] whole
                     └── $x

 #2
 [Entity] InstitutePlace|場所
 └── [Feature] telic
     └── [FunctionEntity]
         └── [Function] or
             ├── [Entity] experiment|實驗
             │   └── [Feature] location
             │       └── [TildeEntity]
             └── [Entity] research|研究
                 └── [Feature] location
                     └── [TildeEntity]

 #3
[Root]
├── [Feature] TimePoint
│   └── [AnyEntity]
└── [Feature] manner
    └── [Entity] urgent|急

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:
   res.tree().show()

Output:

[Entity $x] MusicTool|樂器
└── [Feature] predication
    └── [Entity] own|有
        └── [Feature] possession
            └── [Entity] 按鈕|PushingButton
                └── [Feature] whole
                    └── $x

License

CC BY-NC-SA 4.0

Copyright (c) 2018-2020 CKIP Lab under the CC BY-NC-SA 4.0 License.

Project details


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.5.2.tar.gz (12.6 kB view hashes)

Uploaded Source

Built Distribution

ehownet-0.5.2-py3-none-any.whl (15.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page