Repository navigation
0.4.1: CSV patterns, BR/US locales, public-data vocabulary, 60% benchmark floors - #3
Merged
Merged
Conversation
Compute detected_pattern (CPF, CNPJ, e-mail, phone, CEP, UUID) from sampled values so sensitivity rules apply to CSV. Detect , ; tab and | delimiters (or take --delimiter), default to utf-8-sig, explain decode errors, and name each column in the report.
Read CSV by position so repeated headers no longer merge into one column, and count rows whose field count differs from the header. Both appear in the report warnings.
… names Add profiling.py to detect Boolean/Integer/Decimal/Date/Text (Brazilian and US number and date formats) and fill minimum, skewness, monotonic and decimal-place statistics. Sample CSV rows with seeded reservoir sampling by default (head sampling stays available). infer_table now raises on a missing column_name instead of inferring a column called None. Legacy Portuguese data_type names are still accepted. The fixed-length identifier signature now needs 20 distinct values.
Add results.py with TypedDicts (InferenceResult, Sensitivity, Hypothesis, CsvReport, CsvColumnResult) and use them as return types of infer_column, infer_table, infer_csv, and assess_sensitivity. Runtime output is unchanged.
infer_column and infer_table now use one evidence/override path and validate columns once. detected_pattern accepts English keys (cpf, cnpj, uuid, email, phone, postal_code); the legacy names E-mail, Telefone, and CEP still work. Name the default profile with DEFAULT_PROFILE and document that profiles only affect column-name vocabulary.
…on set Turn on mypy strict, cover vocabulary loading and error paths (coverage 94%, floor 90%), and add benchmarks/validation.json: 52 hand-written Brazilian and US cases kept separate from the calibration fixture. First measurement: 71% semantic accuracy; CI guards against regressions below 70%.
…terns Value detection now recognizes phone numbers (BR mobile/landline/toll-free with DDD validation, US NANP), postal codes (CEP, ZIP+4), street addresses (BR and US, PO boxes, highways), CPF, CNPJ, SSN, and EIN. Results carry a pattern object with locale, variant, format, coverage, validated flag, and a message that also becomes the classification evidence. Sensitivity covers SSN, addresses, EIN, and postal codes. Add English vocabulary, multi-word terms (phone_number, zip_code), and a US state gazetteer. A strong content domain now beats a weak structural role from an uninformative name. Add holdout-v2.json; accuracy on the two hand-written sets went from 71%/57% to 92%/92%, which is optimistic because validation.json failures informed the vocabulary.
Analysis of Dependabot PR #2: the one-line change is safe and fixes a latent bug. With setuptools 68.2.2 and 76.1.0 the build fails ('project.license must be valid exactly by one definition') because license = "MIT" is a PEP 639 expression that needs setuptools 77+. 77.0.3 and 84.2.1 build the wheel and sdist, and twine check --strict passes. 84.2.1 was published 2026-10-20, so it satisfies the 14-day cooldown. The only cost is that offline builds without isolation need a recent setuptools; pip's isolated build env fetches it automatically. Applying it here makes Dependabot PR #2 redundant.
Collect column names from about 4,500 US Socrata datasets and 500 Brazilian CKAN resources, find frequent unmapped words, and classify them by hand: ~190 new terms, four new domains (real estate, energy, legal, health), Spanish basics, and split of fused names such as issueddate. Add gazetteers from IBGE (municipalities, countries, first names), SSA first names, and world-cities (US cities, countries), with a minimum-distinct guard and first-token matching for names. Free-form Text becomes a structural role. Add the public-us-socrata and public-br-es benchmarks and regression floors. Bump the version to 0.4.0. Held-out US sample: 47.7% -> 63.1%; full test half: 64.5% -> 77.2%.
Changelog for 0.4.0 with the breaking changes, README section on vocabulary sources, and benchmark history with the before/after numbers and which sets are clean held-outs.
Add label_accuracy to benchmark reports and profile benchmark values like CSV values. Recognize ISO and US timestamps, Y/N T/F S/N booleans, WKT geometry, coordinate pairs and address-plus-coordinates text, question-style names, more predicate words for flags, flag suffixes, and compounds such as total_price and num_items. Strong geometry now decides the domain over a weak name-derived role, and the whole-name fuzzy match ignores much shorter words. Replace the US public benchmark with one that carries real sample values (street lines redacted) and keep the names-only version; every set and every label with 10+ cases must reach 60%, except flags judged by name alone (40%, guarded against regression). Version 0.4.1.
Benchmark README gets the per-label table, why Checkbox columns cannot be recognized from names alone, and the label audit (0 of 60 wrong). Changelog entry for 0.4.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
infer_csv; delimiter detection (, ; tab |),utf-8-sigdefault with clear decode errors, typed column profiles, seeded reservoir sampling, duplicate-header and malformed-row warnings, named columns in the report.patternwith locale, variant, format, coverage, and a message.issueddate), and gazetteers (IBGE municipalities, countries, first names; SSA names; US cities). Sources and licenses insrc/colsemantics/data/SOURCES.md.setuptools>=84.2.1(the old floor could not build the project; supersedes chore(deps-dev): update setuptools requirement from >=68 to >=84.2.1 #2).Breaking changes
Python 3.10 dropped;
infer_csvsamples uniformly by default; results gainpattern;Free-form Textis a structural role;normalizar/tokenizardeprecated. Details inCHANGELOG.md.Known limit
Checkbox columns judged by name alone stay near 40% (names such as
DomesticorSafetycarry no signal). With values they are recognized 100% of the time. The names-only floor is a documented regression guard, seebenchmarks/README.md.Test plan
twine checkon Python 3.11, 3.12, 3.14 and lowest dependencies