Advertisement
Data Processing

Token Scatter: One Boolean Column, Twelve Ways to Say It

Ask a spreadsheet, a form, a legacy export, and an API what counts as true, and you will get more answers than you expected. This test built a single...

Ask a spreadsheet, a form, a legacy export, and an API what counts as true, and you will get more answers than you expected. This test built a single boolean column the way real imports actually arrive: not with two tidy values, but with a scatter of tokens that different writers all meant as yes, no, or nothing. A strict parser then read the column, and most of it fell away.

The point is not that the strict parser is badly written. The point is that agreement about tokens is a data contract, and most files never signed one.

What Token Scatter means

Token Scatter is the spread of distinct literal tokens used to express a small set of intended meanings in one column. A boolean column has two intended meanings, plus empty, yet the file can contain many more than three literals. Each extra literal is a bet that the reader shares the writer's convention. When the reader does not, the cell is rejected, misread, or quietly treated as a string instead of a value.

Scatter is measured in two ways in this test: how many distinct tokens appear, and how a defined strict reader responds to them. That pairing matters. A column can have modest scatter and still fail badly if the common tokens are the nonstandard ones, or high scatter with little damage if the reader was built for it. Counting tokens alone does not tell you the cost; testing a reader against them does.

How this was measured

A script built the data for this test: synthetic dirty data, generated with the random seed fixed at 42 so the run can be reproduced exactly. Parsing followed the script's own deterministic logic throughout, centred on a strict parser defined as accepting only true and false, case-insensitive. Nothing here measures a commercial product, and no vendor parser was tested. The volumes are declared as constructed volumes: token counts per group were set evenly by design, something real files rarely do, which means the acceptance rates describe this construction under this parser definition rather than a universal rate for boolean columns in general.

Token Scatter: One Boolean Column, Twelve Ways to Say It

What the test found

The file held 1,200 cells (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). The boolean part used 12 tokens, each appearing 75 times, for 900 cells: true, false, True, FALSE, 1, 0, yes, no, Y, N, t, and f (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). The empty part used six representations, each appearing 50 times, for 300 cells: an empty string, NULL, null, N/A, a hyphen, and none (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Across the whole file there were 18 distinct tokens (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON).

The strict parser accepted 300 cells (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). That is a strict acceptance rate of 25.0% of all cells (derived/computed: 300/1200) and 33.33% of the boolean cells (derived/computed: 300/900). In other words, a parser that recognises the two canonical words, in any letter case, still turned away two thirds of the cells that were meant to be boolean, and three quarters of the file as a whole. The rejected cells were not malformed. Most were ordinary conventions from other systems: numbers, words, and single letters that many tools write and many humans read without hesitation.

Ambiguity is the second problem, separate from rejection. Eight distinct tokens, covering 600 cells, were classed as ambiguous because their truth value depends on the reader's convention (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Those tokens were 1, 0, yes, no, Y, N, t, and f (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Among them, the token 0 accounted for 75 cells and the token f accounted for 75 cells (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Ambiguity is more dangerous than rejection in one specific way: different readers can accept the same token and assign it opposite meanings. A system that treats any non-empty string as true will read 0 very differently from a system that reads it numerically. The file does not say which convention applies. The token alone cannot tell you.

The empty representations carry the same risk in miniature. Six different literals all meant nothing here (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON), and a reader that only treats a truly empty cell as empty will carry NULL, N/A, or none forward as if they were values. In a boolean column that can create a phantom third category in counts and filters.

For cleaning work, the order of operations follows from this. Inventory the distinct tokens first, decide a written mapping for each one, including the ambiguous set and the empty set, and only then parse. Parsing first and inspecting the rejects later reverses that order and hides the ambiguous cells, because those are the ones that may not appear in the reject list at all. A token inventory of a real column is cheap: it is one distinct-value count. In this constructed file that count was 18 (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON), a number small enough to review by eye and large enough to break a strict reader.

Questions, answered

Is a strict parser the wrong choice for boolean columns? Not necessarily. Strictness is safe when the input contract is enforced upstream. It failed here because the file used 12 boolean tokens while the parser accepted only the true and false family (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). The mismatch between contract and file is the defect, wherever it is fixed: constrain the writers, or widen the reader with an explicit mapping.

Which tokens are the riskiest? The ambiguous ones. Eight tokens covering 600 cells depended on reader convention (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Rejected tokens announce themselves; ambiguous tokens can be silently read two ways by two systems, so the same file can produce different counts in different tools with no error anywhere.

How many cells did the strict parser accept? It accepted 300 cells (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON), which is 25.0% of all 1,200 cells (derived/computed: 300/1200) and 33.33% of the 900 boolean cells (derived/computed: 300/900). Those accepted cells are the true and false spellings in mixed case, which make up four of the twelve boolean tokens in the construction.

Should empty values be mapped before or after boolean values? Together, in one mapping pass. This file used six empty representations across 300 cells (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON), and any of them left unmapped becomes a literal value downstream. A single token inventory that covers boolean and empty tokens at once prevents a cleaned boolean column from still containing string placeholders.

Summary

One constructed column of 1,200 cells used 18 distinct tokens to say true, false, or nothing (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). A strict parser accepted 300 cells, 25.0% of the file (derived/computed: 300/1200), and 600 cells sat in an ambiguous set whose meaning depends on the reader (Source: SmartDataAI import test T2, run 2026-11-23; evidence pack for this batch holds the script and the result JSON). Token Scatter is fixable, but only in the open: inventory the tokens, write the mapping down, and parse against the mapping rather than against hope.

Sources

Know someone who needs this? Share it.

Advertisement