seams 0.1.14

High-throughput sentence extractor for Project Gutenberg texts with dialog-aware detection
Documentation
# Python Benchmark Comparison with pysbd and spaCy

* **Task ID:** python-benchmark-comparison_69.stevejs.md
* **Reviewer:** stevejs
* **Area:** benchmarks
* **Motivation (WHY):**
  - PRD Section 13.1 requires performance leadership demonstration with validated benchmarks
  - Need apples-to-apples comparison with established Python sentence segmentation libraries
  - pysbd, nupunkt, and spaCy (with sentencizer) are widely used alternatives in the narrative analysis pipeline space
  - Benchmarks should be on same machine, same data, similar methodology for fair comparison
  - Results will be used in README.md and publication materials to demonstrate performance advantages
  - Moving targets over time - benchmarks need to be easily re-runnable as libraries evolve

* **Acceptance Criteria:**
  1. Python benchmark script that tests pysbd and spaCy sentencizer on same test data as seams
  2. Equivalent processing pipeline (file discovery, text processing, sentence segmentation)
  3. Comparable output format for validation of accuracy differences
  4. Performance metrics: throughput (chars/sec), latency, memory usage
  5. Same test corpus used across all tools for fair comparison
  6. Benchmarks easily re-runnable for future validation
  7. Results documented in README.md with methodology explanation
  8. Handle edge cases and error conditions consistently across tools

* **Deliverables:**
  - Python benchmark script using pysbd for sentence segmentation
  - Python benchmark script using nupunkt for sentence segmentation (zero runtime dependencies)
  - Python benchmark script using spaCy sentencizer for sentence segmentation  
  - Shared test corpus and methodology for consistent comparison
  - Performance comparison results with detailed metrics
  - Accuracy comparison on sample outputs (optional but valuable)
  - README.md section documenting benchmark methodology and current results
  - Documentation on how to re-run benchmarks for future validation

* **Implementation Notes:**
  - Use similar file discovery pattern (**/*-0.txt) 
  - Measure pure sentence segmentation time vs total pipeline time
  - Test on Project Gutenberg texts for realistic narrative analysis workload
  - Consider memory usage patterns (seams uses streaming, Python tools may load full files)
  - Document any preprocessing differences between tools
  - Handle UTF-8 encoding consistently across all tools
  - Use equivalent hardware/system configurations for fair comparison

* **Test Scenarios:**
  1. Small corpus (few files) for detailed accuracy comparison
  2. Medium corpus for representative performance measurement  
  3. Large corpus for scalability comparison
  4. Files with various narrative styles (dialog, description, etc.)
  5. Edge cases: very long sentences, unusual punctuation patterns

* **References:**
  - PRD Section 13.1: Performance Leadership and benchmarks validated on every checkin
  - PRD Section 13.5: Performance benchmarks with every-checkin validation
  - pysbd: https://github.com/nipunsadvilkar/pySBD
  - nupunkt: "next-generation implementation of the Punkt algorithm for sentence boundary detection with zero runtime dependencies"
  - spaCy sentencizer: https://spacy.io/api/sentencizer
  - Current seams benchmarks in benches/ directory

## Pre-commit checklist:
- [ ] All deliverables implemented
- [ ] Python benchmark scripts working correctly
- [ ] Tests passing (`cargo test`)
- [ ] Benchmark methodology documented
- [ ] Results added to README.md
- [ ] **ZERO WARNINGS**: `./scripts/validate_warning_free.sh` passes completely
- [ ] Benchmarks easily re-runnable for future validation
- [ ] Performance claims validated with actual measurements