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:
How to Use It
To format your text cleanly, choose your detectors and call the engine's methods sequentially:
-
NumberDetector: Finds numbered items like1.or20.while safely ignoring normal numbers inside sentences (like500 grapes). -
MultipleChoiceDetector: Finds letter choicesAthroughD(handlesA.,A), or even glued text chunks likeBTemple).
from furrow import Plow
from furrow.detectors import NumberDetector, MultipleChoiceDetector
# 1. Feed it your raw, smashed-together text block
messy_text = "1. hi there, A) testing BTemple 3 things. 100. dont do this!"
engine = Plow(messy_text, detectors=[NumberDetector, MultipleChoiceDetector])
# 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: [{'marker': '1', 'marker_type': 'number', 'text': '. hi there, '}, {'marker': 'A', 'marker_type': 'multiple choice', 'text': ' test '}, ...]
# 4. Generate the final text string with line breaks perfectly injected
print(engine.render())
# Output:
# 1. hi there,
# A) testing
# BTemple 3 things.
# 100. dont do this!
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 using detectors to find numbers and alphanumeric choices. It maps out their exact start, end, and lookahead coordinates in the string. -
Step 2:
engine.collect()(The Filter) – Filters and clusters tokens based on text layouts. For numbers, it verifies the distance to trailing punctuation to ignore normal quantities (like3 things). For choices, it isolates un-spaced markers (likeBTemple) and injects missing formatting periods. -
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 list boundaries.
Everything that isn't identified as a marker (like instructions, title headings, or random words) stays completely safe, untouched, and unmutated.
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.4.tar.gz.
File metadata
- Download URL: furrow-0.1.4.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1cbc1ae9bf61b6eab876edbfb170330e681a54aec73ae4b327d33564c18ae8f
|
|
| MD5 |
4e146d60ef5b05a8c9b4d46f2c992af7
|
|
| BLAKE2b-256 |
3e367df3b328501a357688a47411b7bba9e3ccbae09cac65e8ef164e56e5c0ad
|
File details
Details for the file furrow-0.1.4-py3-none-any.whl.
File metadata
- Download URL: furrow-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.9 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 |
f051d7fb989b89b39a9612c75f0d6c09694602eea11cbee4c19c01da5ed2dd69
|
|
| MD5 |
35002f7f75db3f236d9357191cd69c63
|
|
| BLAKE2b-256 |
e8ce1468c4a71f2854ed0ffc95639a16f1713148cfd55a90679f3bbb0046228b
|