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 (like19.). -
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file furrow-0.1.1.tar.gz.
File metadata
- Download URL: furrow-0.1.1.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f288d16c5ecd9238ede73856ecf16e4e823c3eff66cf7b7ecf5cb516c6dce197
|
|
| MD5 |
d11114fe900493f3a0e14b3bf296c042
|
|
| BLAKE2b-256 |
1610eb62667c89b49f398c7489a7dbf6a19085282b1d5100618ae11c3dd17717
|
File details
Details for the file furrow-0.1.1-py3-none-any.whl.
File metadata
- Download URL: furrow-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a94587e9dffa467f15c3b7d31bc156a26f5248d20a210eb227053831ef6b2624
|
|
| MD5 |
00eb7bc8c4c7df31ad5bec2076dff649
|
|
| BLAKE2b-256 |
9fe8d6a971e61da7cd981e592a67bdc43ccbed766dfc46ea0e544295897a61d0
|