Recipe catalog / paragraph-boundary
Recover a paragraph boundary
Do two adjacent extracted text fragments continue one paragraph or belong to separate blocks?
Extraction preserved reading order but lost the difference between a hard line wrap and a paragraph break.
Explore this recipe interactively ยท Source and implementation guide
Use paragraph-boundary in TypeScript
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { paragraphBoundary } from 'jev-recipes/paragraph-boundary';
const result = await paragraphBoundary({
"left": "To finish installing the package, run",
"right": "the command shown in the next example.",
"minConfidence": 0.8
});
console.log(result);
Input contract
| Field | Type | Needed |
|---|---|---|
| left | string | Required |
| right | string | Required |
| before | string | Optional |
| after | string | Optional |
| context | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"left": {
"type": "string"
},
"right": {
"type": "string"
},
"before": {
"type": "string"
},
"after": {
"type": "string"
},
"context": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"left",
"right"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"verdict": {
"type": "string",
"enum": [
"continue",
"separate",
"unclear"
]
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string",
"enum": [
"continue",
"separate",
"unclear"
]
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"required": [
"continue",
"separate",
"unclear"
]
}
},
"required": [
"model",
"usage",
"status",
"verdict",
"confidence",
"probabilities"
],
"additionalProperties": false
}
}Saved example result
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo paragraph-boundary.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"verdict": "continue",
"confidence": 0.96,
"probabilities": {
"continue": 0.96,
"separate": 0.02,
"unclear": 0.02
}
}
Evaluation evidence
typesafe-ai/jev / 2026-09-27 / 167 held-out cases
Scoring revision 1.
82 ready decisions, with 99% accuracy among those decisions.
95% case-level interval: 88% to 96%. Related synthetic cases are correlated.
Experimental: declared document acceptance policy not met
This measurement uses an earlier or unverified recipe or evaluator version. Rerun with the current recipe and evaluator before treating these numbers as current.
Use the evaluation guide to measure this decision on your own labeled cases.
Limitations
- Judges adjacent text only; it does not reconstruct reading order, perform OCR, dehyphenate, or merge text.
- Shared subject matter alone does not establish paragraph continuity. Preserve the boundary on review.
- Experimental until document-separated evaluation meets the published accepted-join precision criteria.
Related recipes
- passage-standalone: Use passage-standalone to judge unresolved references within a passage.
- topic-shift: Use topic-shift for conversational subject changes rather than text boundaries.
- text-block-role: Use text-block-role to classify an individual block before considering a join.