Metadata-Version: 2.1
Name: seqmetric
Version: 0.0.7
Summary: seq is a seq eval package
Home-page: https://github.com/ssbuild
Author: ssbuild
Author-email: 9727464@qq.com
License: Apache 2.0
Keywords: seqmetric,seq metric,seq,ner metric,metric,ner
Platform: win32_AMD64
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: C++
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3, <4
Description-Content-Type: text/markdown

seq is a seq eval package

```py
# -*- coding: utf-8 -*-
import sys
import numpy as np
sys.path.append('..')
from seqmetric.scheme import IOBS,IOBES,IOB2
from seqmetric.metrics import classification_report,f1_score

#场景1
mode = 2
trues = [['O', 'O', 'B-MISC', 'I-MISC', 'B-MISC', 'O', 'O'], ['B-PER', 'I-PER', 'O']]
preds = [['O', 'O', 'B-MISC', 'I-MISC', 'B-MISC', 'I-MISC', 'O'], ['B-PER', 'I-PER', 'O']]

if mode == 0:
    scheme = IOBES
elif mode == 1:
    scheme = IOBS
else:
    scheme = IOB2
f1 = f1_score(trues, preds, average='weighted',scheme=scheme)
report = classification_report(trues, preds, scheme=scheme,digits=4)
print(f1)
print(report)

from seqmetric.metrics import pt_class_report,pt_class_report_by_triple_list
#from seqmetric.metrics import pt_single_class_report as pt_class_report_pretty  兼容旧版本
# 场景2

label_list = ['0','1']
#label_id 0 , 1
trues = [[(0 , 10,20 ),], [(0 , 10,20)]] # label_id ,start ,end

preds = [[(0 , 10,20 ),],[]]

report ,f1 = pt_class_report_by_triple_list(trues,preds,label_list)
print(report ,f1)


print()

preds = {
    '0': [[(0 , 10,20 ),], [(0 , 10,20)]],
    '1': [
        [],
        []
    ]
}

trues = {
    '0': [[(0 , 10,20 )], [(0 , 10,20)]],
    '1': [[(0 , 10,20 )], [(0 , 10,20)]]
}



report ,f1 = pt_class_report(trues,preds,average='micro')
print(report ,f1)
```


