nipunsadvilkar / pySBD

🐍💯pySBD (Python Sentence Boundary Disambiguation) is a rule-based sentence boundary detection that works out-of-the-box.
MIT License
802 stars 83 forks source link

🏎 ⚡️ 💯 Benchmark across Segmentation Tools, Libraries and Algorithms #69

Closed DeNeutoy closed 4 years ago

DeNeutoy commented 4 years ago

Benchmarking using timeit had some issues, because some things in the script were slow. This script reduces the time for the benchmarks by ~25%. Also, I think the way you had it it was measuring the total time for 100 runs, rather than the average. I changed it to average, so we get the average speed for a single run across the golden rule set.

I also added comparisons for the genia benchmark for all of the tokenizers:

GRS

blingfire_tokenize
GRS score: 75.00%
Speed(Avg over 100 runs):       0.37 ms

nltk_tokenize
GRS score: 56.25%
Speed(Avg over 100 runs):       2.94 ms

pysbd_tokenize
GRS score: 97.92%
Speed(Avg over 100 runs):      19.36 ms

spacy_tokenize
GRS score: 52.08%
Speed(Avg over 100 runs):       2.65 ms

spacy_dep_tokenize
GRS score: 54.17%
Speed(Avg over 100 runs):     202.96 ms

stanza_tokenize
GRS score: 72.92%
Speed(Avg over 100 runs):     979.95 ms

syntok_tokenize
GRS score: 68.75%
Speed(Avg over 100 runs):       7.49 ms

Genia

blingfire_tokenize
GENIA abstract acc: 86.99%

nltk_tokenize
GENIA abstract acc: 87.99%

pysbd_tokenize
GENIA abstract acc: 97.05%

spacy_tokenize
GENIA abstract acc: 76.84%

spacy_dep_tokenize
GENIA abstract acc: 39.22%

stanza_tokenize
GENIA abstract acc: 63.43%

syntok_tokenize
GENIA abstract acc: 80.94%
codecov-commenter commented 4 years ago

Codecov Report

Merging #69 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #69   +/-   ##
=======================================
  Coverage   98.30%   98.30%           
=======================================
  Files          37       37           
  Lines        1063     1063           
=======================================
  Hits         1045     1045           
  Misses         18       18           
Flag Coverage Δ
#unittests 98.30% <ø> (ø)
Impacted Files Coverage Δ
pysbd/lists_item_replacer.py 98.49% <ø> (ø)
pysbd/utils.py 73.33% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4652f40...65240ff. Read the comment docs.