Detection definition¶
A DetectorDefinition orchestrates scanning notebook content for phenomena. It references one or more PromptDefinition identities but is not equivalent to a saved prompt.
Identity¶
Field |
Required |
Notes |
|---|---|---|
|
yes |
Built-in ( |
|
yes |
Bump on logic/schema/threshold changes |
|
yes |
Catalogue label |
|
no |
Human-readable summary |
|
when |
|
|
no |
|
|
yes |
|
|
yes |
|
|
yes |
v1: |
|
when window scope |
Default 3 for adjacent-page detection |
|
when window scope |
Default 1 |
|
yes |
Post-validation filter (0–1) |
|
yes |
Stable label namespace ( |
|
yes |
|
|
no |
May override prompt defaults |
|
no |
Engine-specific (e.g. |
Built-in vs custom¶
Built-in detectors ship in code registry (
transcribe.detection.registry):poetry,todo_lists,lists,quotations,beer_labels, lexical countersfirst_personandswear_words, andnames(people from NER).Custom detectors are declarative user definitions compiled to DetectorDefinition + constrained prompt. No arbitrary Python plugins in v1.
Lexical count detectors (
engine=lexical_count) match OCR text deterministically (no LLM). The published output is a per-pagepage_countsseries (including zeros). They also emit one finding per page when the count is at or abovemin_count, withdetector_data.count/samples(used for auto-tag).Names / people (
engine=ner_people) reads spaCyPERSONentities from published NER. If NER is missing or stale, the detector runs theneranalysis module (publishing it as a side effect). One finding per distinct name per page;detector_dataholdsname,tag_slug,count,samples. No LLM. Requires the spaCy extra; otherwiseskipped_not_applicable/unavailable_extra.
CustomDetectorDefinition (user-facing, declarative)¶
Approximate fields:
Field |
Notes |
|---|---|
|
Display name |
|
Phenomenon description (compiled into prompt data slot wrapper) |
|
|
|
bool |
|
|
|
float |
Compiled to detector_id = custom/<slug> with fixed response schema custom_finding_v1.
Non-goals¶
Detectors must not add boolean flags to
PageIndex(e.g.contains_poem).Detectors must not be implemented solely as analysis modules when page/window scanning and cross-page spans are required.
Auto-tag (opt-in) may union tags onto
PageIndex.tagsfor pages in a finding span. Default isnormalize_slug(finding_type). The names detector unions each detected person name (detector_data.tag_slug) instead. That uses the existing tags list — it is not a boolean flag. Auto-tag is not part ofcache_config/ cache identity. See tag-catalog.md.