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.2.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.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: furrow-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 b6e8a009b53127aebf303aa7cd37d7fe833ffb10110b58c62399571c1b4568f5
MD5 5df55685c8fc8a295618edca57166aa8
BLAKE2b-256 c5c6036f430dc03e95f029604b3e222ee750111af70f6e615165df5056b4f834

See more details on using hashes here.

File details

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

File metadata

  • Download URL: furrow-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e27983359e3022634f42039dbcc0e4f6cfe7b62617f605f5b847115cc82465d3
MD5 4fa06cf21af4b019969701b1d087dd31
BLAKE2b-256 fcf1e184ebd2ac4a60fa8809b357c516a281d08fa5f30d345912696febe055b6

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