A python library for named entity recognition evaluation
Project description
miNER
A python library for NER (Named Entity Recognition) evaluation
We can evaluate the performance of NER by distinguishing between known entities and unknown entities using this library.
Support
- Tagging Scheme
- IOB2
- BIOES
- metrics
- precision
- recall
- f1
Requirements
- python3
Installation
pip install mi-ner
Usage
Sample
>>> from miner import Miner
>>> answers = [
'B-PSN O O B-LOC O O O O'.split(' '),
'B-PSN I-PSN O O B-LOC I-LOC O O O O'.split(' '),
'S-PSN O O S-PSN O O B-LOC I-LOC E-LOC O O O O'.split(' ')
]
>>> predicts = [
'B-PSN O O B-LOC O O O O'.split(' '),
'B-PSN B-PSN O O B-LOC I-LOC O O O O'.split(' '),
'S-PSN O O O O O B-LOC I-LOC E-LOC O O O O'.split(' ')
]
>>> sentences = [
'花子 さん は 東京 に 行き まし た'.split(' '),
'山田 太郎 君 は 東京 駅 に 向かい まし た'.split(' '),
'花子 さん と ボブ くん は 東京 スカイ ツリー に 行き まし た'.split(' '),
]
>>> knowns = {'PSN': ['花子'], 'LOC': ['東京']} # known words (words included in training data)
>>> m = Miner(answers, predicts, sentences, knowns)
>>> m.default_report(True)
precision recall f1_score num
PSN 0.500 0.500 0.500 4
LOC 1.000 1.000 1.000 3
{'PSN': {'precision': 0.5, 'recall': 0.5, 'f1_score': 0.5, 'num': 4}, 'LOC': {'precision': 1.0, 'recall': 1.0, 'f1_score': 1.0, 'num': 3}}
>>> m.return_predict_named_entities()
{'known': {'PSN': ['花子'], 'LOC': ['東京']}, 'unknown': {'PSN': ['太郎', '山田'], 'LOC': ['東京駅', '東京スカイツリー']}}
Methods
method | description |
---|---|
default_report(print_) | return result of named entity recognition. if print_=True, showing result |
known_only_report(print_) | return result of known named entity recognition. |
unknown_only_report(print_) | return result of unknown named entity recognition. |
return_predict_named_entities() | return named entities along predicted label(predicts). |
return_answer_named_entities() | return named entities along answer label(answer). |
return_miss_labelings() | return miss labeling sentences. |
License
MIT
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
mi-ner-0.1.0.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file mi-ner-0.1.0.tar.gz
.
File metadata
- Download URL: mi-ner-0.1.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21e6cb5f5b40fbacb87acc955323671fb4e51ff7aa55820622da40d24a01c0e6 |
|
MD5 | 9443331047dc7f3b1f9309e99e5b68c6 |
|
BLAKE2b-256 | 01317cd9ee35a3d249185a0824ace5523df090840241cf510ffecb3473d0919a |
File details
Details for the file mi_ner-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mi_ner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47c49177e5aef0091aa8ce7d6e38983e94c8e19d895079d0a0e0e4dd4aad523b |
|
MD5 | 1b73d5556ec54545549da32cfcc38d22 |
|
BLAKE2b-256 | 30187565b1617bb0df3228a1d0c6ce948ab54e1566665a77e5ee41f6209e9861 |