Generative Output Numeric Cleaning
SkillAI & modelsClean noisy numeric strings from generative model output by removing invalid characters, fixing malformed floats, and handling multiple decimal points
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Generative Output Numeric Cleaning skill
What this skill tells your AI
The instructions your AI receives, as published by wenmin-wu/ds-skills in skills/cv/generative-output-numeric-cleaning/SKILL.md and read by ahel’s review.
Overview
Generative vision-language models (Donut, Pix2Struct, Florence) often produce noisy numeric strings — extra spaces, stray characters, multiple decimal points, or malformed scientific notation. A robust cleaning pipeline strips invalid characters, fixes structural issues (multiple dots, multiple signs), and falls back to zero for unparseable values, preventing downstream errors.
Quick Start
import re
def clean_numeric(str_list):
result = []
for s in str_list:
s = re.sub(r"\s", "", s)
dtype = float if "." in s else int
try:
result.append(dtype(s))
continue
except ValueError:
pass
s = re.sub(r"[^0-9.\-eE]", "", s)
if not s:
result.append(0)
continue
if s.count(".") > 1:
parts = s.split(".")
s = parts[0] + "." + "".join(parts[1:])
if s.count("-") > 1:
s = "-" + s.replace("-", "")
try:
result.append(dtype(s))
except ValueError:
result.append(0)
return result
raw = ["12.5", "1,234.5", " -3..2 ", "abc", "1.2e3"]
clean_numeric(raw) # [12.5, 1234.5, -3.2, 0, 1200.0]
Workflow
- Strip whitespace from each string
- Attempt direct
int()orfloat()parse — fast path for clean values - Remove all non-numeric characters (keep digits,
.,-,e,E) - Fix multiple decimal points by merging after first dot
- Fix multiple negative signs by keeping only one at the start
- Return 0 as fallback for unparseable values
Key Decisions
- Zero fallback: safer than NaN for downstream aggregation; adjust per use case
- Comma handling:
re.subremoves commas naturally in the stripping step - Scientific notation: preserve
e/Echaracters for values like1.2e3 - Type detection: use
.presence to choose int vs float
References
Signals
- GitHub stars
- 60
- Forks
- 4
- Last commit
- Apr 2026
Advanced
- Catalog kind
- skill
- Gateway key
cv-generative-output-numeric-cleaning- Source
- github.com/wenmin-wu/ds-skills