The floors

Where a context stops naming the letter before

A sort of rotations by their first k characters matters only where those k characters fail to decide the character before them, and that share of positions can be counted in one pass with no sorting. It was proposed as a replacement for sweeping k. Counted as proposed, it misses by a factor of four: on a stream of independent words 37% of positions are still ambiguous at four characters, where the sweep has already gone flat. Counted only where the context sits inside a word that goes on past it — the one place more context can still help — it lands within a step of the sweep on four sources of five.

The Burrows–Wheeler transform sorts every rotation of a text and outputs the character before each, in sorted order. The transform that emits nothing showed why that helps a coder: rotations that begin alike are usually preceded by the same character, so the output comes in runs, and a move-to-front pass turns runs into small numbers that the bits a coder emits could price. What a reordering costs to undo showed that the transform’s sort is what makes it invertible, which is why a sort by only kk characters needs its tie rule to be one a decoder can repeat. The order inside a tie sorted rotations only by their first kk characters, breaking ties by position, and asked how much of the transform’s benefit survives. A result the size of its own noise swept kk over sixteen streams of two word sources and found that the short sort’s win at four characters had been one stream’s noise. It also found something sharper. From four characters up, every run break either tie rule made was at a word boundary, and nothing above four characters decided anything at all.

Its closing section turned that into a quantity. A tie rule can reorder the output only among rotations whose first kk characters are the same, and it can change a run only where those rotations are preceded by different characters. So for each kk, the share of positions whose kk-character context is preceded, somewhere in the text, by more than one distinct character is the tie rule’s whole reach. That share can be computed in one pass, with a hash of each context and no sorting and no coder. The section predicted that the kk at which this share falls under a threshold would predict the kk at which the sweep’s curve flattens, which would make the sweep over kk unnecessary. It predicted that on word sources the share would fall off a cliff at the mean word length, and that on a text with a broad spread of word lengths both the share and the curve would decay smoothly.

The share can be computed exactly and quickly. As proposed, it predicts the flattening badly. The way it fails says which part of it to count, and counted that way it predicts well.

The share as proposed

The measurement uses five sources, eight streams of 8,192 characters each. Two are the earlier pages’ word sources: words from a short fixed list drawn independently, and a chain in which the next word depends on the last letter of the one before. The third draws words independently from the whole vocabulary of the collection’s fixed corpus of essays, 2,424 distinct words of three letters and more, the broad spread of lengths the prediction asked for — a mean word of 7.1 letters against the short lists’ 4.2. The last two are slices of the two fixed corpora themselves, lower-cased to letters and single spaces — the twelve essays and the eight source modules a corpus that was not generated introduced as the collection’s text that no model wrote. They are the sources the proposal’s claim is really about, since a rule read off a text is worth having only if it holds on text nobody designed. For every stream and every kk the share is computed cyclically, with the transform’s own sentinel.

The share of positions whose context of k characters is preceded by more than one character somewhere in the text — where a tie rule can reorder the transform: on words drawn independently it is 37.0% at four characters and does not fall under 5% until sixteenFor five sources, eight streams of 8,192 characters each, the mean share of positions whose k-character context is preceded, somewhere in the cyclic text, by more than one distinct character. Words drawn independently: k 1 95.9%, k 2 60.4%, k 3 45.7%, k 4 37.0%, k 5 36.2%, k 6 34.0%, k 8 27.1%, k 10 18.2%, k 12 11.2%, k 16 3.0%, k 24 0.1%, k 32 0.0%. Words from the whole vocabulary: k 1 100.0%, k 2 97.5%, k 3 77.1%, k 4 45.7%, k 5 25.9%, k 6 14.2%, k 8 5.4%, k 10 2.4%, k 12 0.9%, k 16 0.1%, k 24 0.0%, k 32 0.0%. The corpus of essays: k 1 99.9%, k 2 96.3%, k 3 73.2%, k 4 46.5%, k 5 31.4%, k 6 22.9%, k 8 11.0%, k 10 6.1%, k 12 3.0%, k 16 0.9%, k 24 0.1%, k 32 0.0%. The corpus of technical writing: k 1 99.9%, k 2 94.7%, k 3 70.3%, k 4 43.7%, k 5 28.7%, k 6 20.5%, k 8 10.8%, k 10 5.7%, k 12 3.5%, k 16 1.5%, k 24 0.4%, k 32 0.2%. The horizontal axis is logarithmic.12481632context length k, characterspositions whose context is ambiguous0%25%50%75%100%words drawn independentlywords from the whole vocabularythe corpus of essaysthe corpus of technical writingeight streams a sourceone pass, no sorting
Fig. 1 The mean share of positions whose context of k characters is preceded by more than one distinct character somewhere in the text, against k. Words drawn independently: 60.1% at two characters, 37.0% at four, 27.0% at eight, 3.1% at sixteen. Words from the whole vocabulary: 97.4%, 45.7%, 5.0%, 0.1%. The corpus of essays: 96.1%, 46.6%, 11.3%, 1.0%. The corpus of technical writing: 94.8%, 44.3%, 10.6%, 1.7%.

On words drawn independently, 37% of positions are still ambiguous at four characters, and the share does not fall under 5% until sixteen. The earlier page found nothing above four characters decided anything on the same source. So by the proposed measure the tie rule has a large reach for another twelve characters, and the sweep says the reach is worth nothing. The share falls smoothly on every source, with no cliff at the mean word length, even on the synthetic ones.

The reason is in what the ambiguous positions are. At four characters on a word source, a typical ambiguous context is a word’s last letters and the space after it, or a space and the first letters of the next word. The character before it is the letter before those last letters, or the last letter of the previous word. Different occurrences of the context are preceded by different characters, so the context is ambiguous. But nothing that follows the context says which character that was. After the space comes the next word, and on this source the next word is drawn independently of the one before. A longer context adds characters from a word that carries no information about the ambiguity. The tie rule can reorder those positions freely, and every order it can choose is as good as every other.

So the share measures where a tie rule could reorder the output, and the sweep measures where reordering changes the output’s runs. On text whose words are independent they part ways at every word boundary.

The part that more context can resolve

The ambiguity that a longer context can resolve is ambiguity inside a word that goes on past the context. If the context is the middle of a word, the rest of the word follows it, and different words sharing that middle continue differently and are preceded by different letters. “ati” is preceded by n in nation and r in ratio, and the character after “ati” — o in both, then n against a space — eventually tells them apart. That is the only kind of position where sorting by more characters can put equal predecessors next to each other.

Counted only where the context lies inside a word that goes on past it — the one place a longer context could still say which character came before — the share falls under 1% at four characters on words drawn independently, at five on the corpus of essays, and at six on the broad vocabulary and the technical corpusFor five sources, eight streams each, the mean share of positions whose k-character context is ambiguous, contains no space, and is followed by a letter of the same word. Words drawn independently: k 1 57.91%, k 2 17.71%, k 3 3.81%, k 4 0.00%, k 5 0.00%, k 6 0.00%, k 8 0.00%, k 10 0.00%, k 12 0.00%. Words from the whole vocabulary: k 1 75.31%, k 2 61.33%, k 3 34.36%, k 4 10.86%, k 5 3.15%, k 6 0.94%, k 8 0.09%, k 10 0.01%, k 12 0.00%. The corpus of essays: k 1 62.48%, k 2 42.67%, k 3 15.38%, k 4 3.10%, k 5 0.64%, k 6 0.23%, k 8 0.01%, k 10 0.00%, k 12 0.00%. The corpus of technical writing: k 1 61.32%, k 2 41.72%, k 3 15.55%, k 4 4.20%, k 5 1.39%, k 6 0.43%, k 8 0.16%, k 10 0.04%, k 12 0.01%. The horizontal axis is logarithmic.12481632context length k, charactersambiguous inside a word that continues0%25%50%75%100%words drawn independentlywords from the whole vocabularythe corpus of essaysthe corpus of technical writingeight streams a sourceno space in the context, a letter after it
Fig. 2 The mean share of positions whose context is ambiguous, contains no space, and is followed by another letter of the same word, against k. Words drawn independently: 17.7% at two characters, 3.8% at three, 0.00% at four. Words from the whole vocabulary: 61.3%, 34.4%, 10.9% at four, 3.2% at five, 0.9% at six. The corpus of essays: 42.7%, 15.4%, 3.1%, 0.6%, 0.2%. The corpus of technical writing: 41.7%, 15.6%, 4.2%, 1.4%, 0.4%.

Counted only inside continuing words, the share falls under 1% at four characters on independent words, at five on the corpus of essays, and at six on the broad vocabulary and the technical corpus. On the synthetic word sources it reaches exactly zero at four, because no word in their short list has an ambiguous four-letter stretch that continues. On the corpora it falls fast and smoothly, by a factor of three to five a character from three characters on.

This is the quantity the proposal was reaching for. It needs the same single pass as the share it refines, plus one character of look-ahead to see whether the word continues past each context, and it is a property of the text read directly.

The sweep it has to predict

The comparison needs the sweep itself: for each source and kk, the bits a symbol after move-to-front of the context sort’s output, less those of the full transform’s.

The sweep the share was meant to replace: the context sort's excess over the full transform falls under a hundredth of a bit a symbol by four or five characters on four sources, and on the technical corpus it is still 0.013 at six, with a spread across slices of 0.026Bits a symbol after move-to-front for the sort by the first k characters of each rotation, ties broken by position, less the full transform's, averaged over eight streams, with the standard deviation across streams. Words drawn independently (full transform 1.789 bits a symbol): k 1 +1.1345 ± 0.0152, k 2 +0.3055 ± 0.0165, k 3 +0.0976 ± 0.0144, k 4 −0.0044 ± 0.0141, k 5 −0.0029 ± 0.0157, k 6 −0.0035 ± 0.0153, k 8 −0.0030 ± 0.0094, k 10 +0.0010 ± 0.0078, k 12 +0.0020 ± 0.0047, k 16 +0.0003 ± 0.0037, k 24 +0.0001 ± 0.0004, k 32 +0.0000 ± 0.0000. Words from the whole vocabulary (full transform 3.392 bits a symbol): k 1 +0.6396 ± 0.0173, k 2 +0.3004 ± 0.0050, k 3 +0.0724 ± 0.0068, k 4 +0.0100 ± 0.0041, k 5 +0.0005 ± 0.0014, k 6 −0.0001 ± 0.0018, k 8 −0.0003 ± 0.0018, k 10 −0.0004 ± 0.0010, k 12 −0.0003 ± 0.0011, k 16 −0.0000 ± 0.0003, k 24 +0.0000 ± 0.0000, k 32 +0.0000 ± 0.0000. The corpus of essays (full transform 2.894 bits a symbol): k 1 +0.8880 ± 0.0530, k 2 +0.3590 ± 0.0389, k 3 +0.0804 ± 0.0180, k 4 +0.0148 ± 0.0089, k 5 +0.0024 ± 0.0056, k 6 +0.0024 ± 0.0043, k 8 +0.0001 ± 0.0029, k 10 −0.0003 ± 0.0021, k 12 −0.0011 ± 0.0023, k 16 +0.0001 ± 0.0009, k 24 +0.0001 ± 0.0002, k 32 +0.0001 ± 0.0001. The corpus of technical writing (full transform 2.792 bits a symbol): k 1 +0.8878 ± 0.1065, k 2 +0.3294 ± 0.0970, k 3 +0.0812 ± 0.0680, k 4 +0.0322 ± 0.0434, k 5 +0.0204 ± 0.0349, k 6 +0.0133 ± 0.0262, k 8 +0.0103 ± 0.0148, k 10 +0.0058 ± 0.0094, k 12 +0.0047 ± 0.0071, k 16 +0.0011 ± 0.0031, k 24 −0.0001 ± 0.0006, k 32 +0.0000 ± 0.0003. Values above 0.16 are drawn at the top edge. The horizontal axis is logarithmic.12481632context length k, charactersbits a symbol over the full transform0.000.050.100.15words drawn independentlywords from the whole vocabularythe corpus of essaysthe corpus of technical writingeight streams a sourceties broken by position
Fig. 3 The context sort’s bits a symbol after move-to-front, less the full transform’s, against k, the mean of eight streams. Words drawn independently: +0.307 at two characters, +0.098 at three, −0.004 at four, ±0.014 across streams. Words from the whole vocabulary: +0.300, +0.072, +0.010 at four, +0.001 at five. The corpus of essays: +0.359, +0.080, +0.015 at four, +0.002 at five. The corpus of technical writing: +0.329, +0.081, +0.032, +0.020, +0.013 at six, +0.010 at eight, with spreads across slices of 0.03 to 0.10.

On four sources the curve behaves as the earlier page found for its two. The excess falls by a factor of three or four a character up to four or five, and then sits within a hundredth of a bit of zero, inside its own spread across streams. On the corpus of essays it is +0.015 at four characters and +0.002 at five. On the broad vocabulary it is +0.010 at four and +0.001 at five. On both word sources it reaches the noise at four.

The technical corpus is different in two ways. Its excess declines slowly, +0.032 at four and +0.010 at eight, and its spread across slices is huge — 0.035 at five characters, larger than the mean. In some slices a context reaching into the next word evidently does say something about the letter before it, and in others it does not; the slices differ from each other far more than any two streams of a synthetic source. Averaged over eight slices, the curve cannot place its flattening more precisely than somewhere between five and twelve characters.

Where each measure crosses

Where each measure says a longer context stops mattering: the sweep flattens at 4, 4, 4, 5, 10 characters on the five sources; the share of ambiguity inside continuing words falls under 1% at 4, 4, 6, 5, 6; the share of all ambiguity falls under 5% at 16, 24, 10, 12, 12For each source, the smallest context length k at which: the context sort's excess over the full transform is within a hundredth of a bit a symbol and stays there; the share of ambiguous positions inside a word that continues past the context is under 1%; and the share of all ambiguous positions is under 5%. Words drawn independently (mean word 4.2 letters): 4, 4, 16; Next word set by the last letter (mean word 4.0 letters): 4, 4, 24; Words from the whole vocabulary (mean word 7.1 letters): 4, 6, 10; The corpus of essays (mean word 4.3 letters): 5, 5, 12; The corpus of technical writing (mean word 4.2 letters): 10, 6, 12.123456810121624context length k, characterswords drawn independentlynext word set by the last letterwords from the whole vocabularythe corpus of essaysthe corpus of technical writingthe sweep flattensopen ambiguity under 1%all ambiguity under 5%eight streams a sourcethresholds: 0.01 bits, 1%, 5%
Fig. 4 For each source, the smallest k at which the sweep’s excess stays within a hundredth of a bit a symbol, at which the share of ambiguity inside continuing words falls under 1%, and at which the share of all ambiguity falls under 5%. Words drawn independently: 4, 4 and 16. Next word set by the last letter: 4, 4 and 24. Words from the whole vocabulary: 4, 6 and 10. The corpus of essays: 5, 5 and 12. The corpus of technical writing: 10, 6 and 12.

Counted inside continuing words, the share crosses within one step of where the sweep flattens on four of the five sources; the share as proposed crosses three to six steps late on every one. On the two word sources both the refined share and the sweep say four. On the corpus of essays both say five. On the broad vocabulary the sweep says four, sitting at exactly a hundredth of a bit there, and the refined share says six, the curve’s value at five being a thousandth. The technical corpus is the exception, and the direction of the exception is informative. There the refined share says six and the sweep says about ten: on that text the next word carries some information about the previous one, and ambiguity spanning a word boundary can be resolved by a longer context too.

So the prediction’s structure was right and its quantity was one step too coarse. A one-pass count of a text does predict where a sort by context stops needing more context, but only the part of the count where more context can be informative. The prediction’s second half fails outright. On a broad spread of word lengths the refined share does decay smoothly, a factor of three a character, but the curve does not: on the broad vocabulary it has fallen to a thousandth of a bit by five characters, as sharply as on the short word lists.

What the one pass saves

The point of the proposal was economy, and the refined share keeps it. The sweep behind the curve plate sorts the rotations of every stream at twelve context lengths, runs move-to-front on each output and measures its entropy: for five sources and eight streams, 480 sorts of 8,192 rotations. The shares come from one pass per stream and context length, hashing each context and remembering the first character seen before it. The refined share adds a look at the character after each context. On a slice of the corpus of essays at eight characters, the pass takes about a quarter of the time of one context sort, 0.8 milliseconds against 3.5, and the sweep also needs a move-to-front pass and an entropy for every sort. The share needs no coder and no inverse.

It also answers a question the sweep answers only indirectly. The sweep says at what kk the bits stop falling. The share says why: at that kk the contexts inside words have become unique, and what ambiguity remains spans word boundaries, where it is resolved only if the next word is predictable. That is an account of the text, not of the transform. The model is the compressor found one stream with five correct entropies at five model orders, and the refined share is a way of reading off a text which model order its letters stop needing. Its words’ internal structure is exhausted within about one word length, and whatever is left is the structure between words.

The technical corpus has more of that between-word structure than the other sources, and the obvious explanation for it does not survive a count. Repeated phrases would do it: a phrase that recurs is a context crossing a word boundary that is always preceded by the same letter. But the essays repeat word pairs more than the technical corpus does. Of the essays’ word pairs, 31.5% belong to pairs that occur five times or more, and of the technical corpus’s, 27.4%. The technical corpus is writing about programs, and its most frequent pairs include fragments of code — throw new, new error, export function — alongside the ordinary is the and and the. Whether it is those fragments, or longer repeats that a count of pairs cannot see, is not established here. The dictionary that builds itself measures the other obvious candidate, a coder whose whole model is whether a stretch of text has been seen before, and a comparison of what such a coder finds in the two corpora is the natural way to settle it.

Where the ambiguity is

At 5 characters, where each source's ambiguity lies: almost all of it spans a word boundary — 36.2%, 37.3%, 20.2%, 29.9%, 26.1% of positions — and the part inside a word that goes on is 0.0%, 0.0%, 3.2%, 0.6%, 1.4%; the context sort's excess at the same length is −0.0029, +0.0036, +0.0005, +0.0024, +0.0204 bits a symbolFor each source at k = 5, the share of positions whose context is ambiguous, split three ways: inside a word that continues past the context (dark), inside a word that ends with it (mid), and spanning a word boundary (light). Words drawn independently: 0.0%, 0.0%, 36.2%; excess −0.0029 ± 0.0157. Next word set by the last letter: 0.0%, 0.0%, 37.3%; excess +0.0036 ± 0.0094. Words from the whole vocabulary: 3.2%, 2.6%, 20.2%; excess +0.0005 ± 0.0014. The corpus of essays: 0.6%, 0.8%, 29.9%; excess +0.0024 ± 0.0056. The corpus of technical writing: 1.4%, 1.2%, 26.1%; excess +0.0204 ± 0.0349.0%10%20%30%40%50%words drawn independently−0.0029 bitsnext word set by the last letter+0.0036 bitswords from the whole vocabulary+0.0005 bitsthe corpus of essays+0.0024 bitsthe corpus of technical writing+0.0204 bitsword continuesword endsspans a boundaryk = 5, eight streamslabels: the sweep's excess
Fig. 5 At five characters, the share of positions with an ambiguous context split three ways: inside a word that goes on past the context, inside a word that ends with it, and spanning a word boundary. Words drawn independently: 0.0%, 0.0%, 36.2%. Next word set by the last letter: 0.0%, 0.0%, 37.3%. Words from the whole vocabulary: 3.2%, 2.6%, 20.2%. The corpus of essays: 0.6%, 0.8%, 29.9%. The corpus of technical writing: 1.4%, 1.2%, 26.1%. The sweep’s excess at five characters is written beside each.

At five characters almost all the ambiguity on every source spans a word boundary: 20% to 37% of positions, against at most 3% inside a continuing word. The sweep’s excess beside each bar is near zero for every source but the technical corpus, whose boundary-spanning ambiguity is no larger than the others’ and whose excess is ten times theirs. The size of the ambiguity across a boundary says nothing about its cost. What decides the cost is whether the next word carries information about the previous one, and that is a property of the text’s word sequence, not of its letters.

The chained word source is the check. Its next word is chosen from a third of the vocabulary set by the previous word’s last letter. That is exactly the kind of cross-boundary dependence that should make boundary-spanning ambiguity matter. Its excess at five to ten characters is +0.004, +0.004, +0.002 and +0.002 bits a symbol, with spreads across streams of 0.01. The dependence is real and the resolution it buys is below what eight streams can see: the next word says only which third of the vocabulary the previous word’s last letter selects, and the move-to-front coder spends little on that.

What was measured and what was not

Eight streams of 8,192 characters a source. The earlier page used sixteen streams of its two sources; this one uses eight of five. On the synthetic sources the spreads match the earlier page’s, about 0.01 to 0.015 bits a symbol at four characters. On the corpora the slices are more varied than any stream of a synthetic source, and the technical corpus’s crossing is correspondingly uncertain.

Thresholds chosen, not fitted. The crossings use a hundredth of a bit a symbol for the sweep, 1% for the refined share and 5% for the share as proposed. They were set before the curves were read, and the comparison is between where each falls rather than whether a particular threshold matches. A threshold of 5% on the refined share would cross a step earlier everywhere, and one of 1% on the full share would cross a step or two later.

Lower-cased letters and spaces. The corpora are reduced to the word sources’ alphabet so the five sources are comparable. Real text keeps punctuation and case, which add ambiguity at word boundaries and, through capitals after full stops, a little information across them.

The word boundary is taken from the text. “Inside a continuing word” uses the space character. That is exact for these sources. For text without spaces — code with identifiers joined by underscores, or languages written without them — the refined share needs some other notion of where a context stops being informative.

Still open: the information across a boundary, counted

The refined share failed on the one source where the next word depends on the previous one, and the chained source showed the same dependence at a size too small to measure. What the refined share leaves out is not ambiguity but information: how much a context that crosses a word boundary says about the letter before it. That too is a property of the text, and it can be estimated from counts.

For each kk, the conditional entropy of the preceding character given the context can be estimated from the same single pass that counts the contexts. Its fall from kk to k+1k+1 is the information the extra character adds. Its fall across boundary-spanning contexts alone is the information the next word carries about the previous one. The measurement that follows computes that fall on the five sources, with a correction for the estimate’s downward bias in contexts seen only a few times. It asks whether adding the boundary-spanning information to the refined share moves the technical corpus’s predicted crossing from six towards the sweep’s ten, without moving the others. The prediction is that it does, because whatever makes the technical corpus’s boundary-spanning contexts informative must show up as contexts seen many times with the same predecessor, which is what the conditional entropy counts. It could fail by bias: the plug-in estimate of a conditional entropy falls towards zero as contexts become unique, which is the same over-reading of long contexts that made the proposed share cross late, now in a different quantity.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

The objects this essay names

Each one links to every other essay that touches it.

Bits per symbolBurrows-wheeler transformContext modelCorpusEntropyHonest limitMeasurement designModel orderMove to frontPrediction