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 slice, group, and format messy text streams (like raw handwriting recognition outputs, chaotic OCR blocks, or unformatted LLM dumps) into separate lines without losing any of your data.

Installation

pip install furrow

How to Use It

To format your text cleanly, you need to call the engine's methods sequentially:

from furrow import Plow

# 1. Feed it your raw, smashed-together text block
messy_text = "was1 . i was a girl19.There i with her 500 grapes .7. Amazing!"
engine = Plow(messy_text)

# 2. Run the character boundary scanner (Crucial step!)
engine.run()

# 3. Pull your questions out as a clean list of data blocks
print(engine.collect())
# Output: [{'question_number': '19', 'text': '.There i with her 500 grapes .'}, ...]

# 4. Generate the final text string with line breaks perfectly injected
print(engine.render())
# Output:
# was
# 1. i was a girl
# 19.There i with her 500 grapes .
# 7. Amazing!

The Processing Sequence

Furrow processes your text strings in three distinct, lightweight steps:

  • Step 1: engine.run() (The Tokenizer) – Steps through your text character by character to find numbers. It maps out their exact start and end coordinates in the string.
  • Step 2: engine.collect() (The Filter) – Checks the distance between the numbers it found and trailing periods. This allows it to figure out the difference between inline data (like 500 grapes) and actual question markers (like 19.).
  • Step 3: engine.render() (The Serializer) – Uses the coordinate maps from the previous steps to slice into the original string and drop a clean newline (\n) right before your valid question indices.

Everything that isn't a question (like titles, headers, or instructions) is kept completely safe, unmutated, and untouched.

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.3.tar.gz (3.5 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.3-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: furrow-0.1.3.tar.gz
  • Upload date:
  • Size: 3.5 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.3.tar.gz
Algorithm Hash digest
SHA256 b6152069b30e9bf2ab6936d3836bf520b1d3d7d73b0d995057d9c4712459d2fa
MD5 24ad47ab81e21bbff0e73dfd2490a7bf
BLAKE2b-256 daf1f69f1b9d682188fdab5033723caa7b4a77d74ba5ade58dc37abb95eb7c9a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: furrow-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.0 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ab88d7bc865e658aeb533c8a52fcbff0a367019c4e73169d63bbb6be55b0ff52
MD5 7868e72154fd11c24d22f166b646497b
BLAKE2b-256 97a29d33c280faae77662ea3ecc02723cc22a845531a21e0fc3ad130c0676ae1

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