Skip to main content

A sleek state-machine parser to segment, extract, and format structured question chains from smashed-together text streams (OCR, handwriting text dumps, transcripts, and LLM outputs).

Project description

Furrow

A lightweight, zero-dependency Python package to extract, segment, and format structured question chains from unformatted, smashed-together text blocks (OCR, handwriting text dumps, unformatted LLM outputs, or transcripts) without data loss.

Installation

pip install furrow

Usage

from furrow import Plow

# 1. Initialize with your raw string
messy_text = "was1 . i was a girl19.There i with her 500 grapes .7. Amazing!"
engine = Plow(messy_text)

# 2. Get questions as a list of dictionaries
print(engine.collect())
# [{'question_number': '19', 'text': '.There i with her 500 grapes .'}, ...]

# 3. Get the text layout with newlines safely injected
print(engine.render())
# Output:
# was
# 1. i was a girl
# 19.There i with her 500 grapes .
# 7. Amazing!

How It Works

Furrow uses a single-pass state machine to parse and structure text layout:

  • State Tracking: Steps through the text character by character to map the exact indices where number blocks start and end.

  • Noise Filtering: Measures the distance between identified numbers and trailing periods. This allows it to separate inline data variables (like 500 grapes) from actual question indices (like 19.).

  • Data Safety: Injects newline characters (\n) via string slicing. This ensures 100% data preservation of non-question text (headers, footers, intro text).

API Reference

  • engine.collect(): Compiles and returns a list of question data nodes for databases or JSON storage.
  • engine.render(): Returns the full original text formatted with clean line breaks for UI display.

Note: You do not need to call the internal parsing loops manually. Calling either .collect() or .render() triggers .run() automatically if it has not executed yet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

furrow-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

furrow-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file furrow-0.1.0.tar.gz.

File metadata

  • Download URL: furrow-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for furrow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77015b4071811453c2d8e062aa8585cf07d3dcdb8d978db9282a8139725ddce0
MD5 187a39cbdc6c884fbf0783385df246a6
BLAKE2b-256 c481301997011b9a10cadd6de6d01389f0d1e1059877f2c340e36e757e378781

See more details on using hashes here.

File details

Details for the file furrow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: furrow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for furrow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3977737bed1c0296e85aad5ef0fee6defd6d40cac99a4a9f9062a03977cde9d9
MD5 f2962fcfa270b8fa06bf910bd29a2df9
BLAKE2b-256 433320ae81b05c665308388b40d640151916c9777df27dc7a6fd68e5c8c4b6c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page