Learning Boundaries From Examples
If people have already marked word boundaries in example text, we can use those labels to teach a model. The surrounding characters provide clues it can use when deciding where to split new text.
13 sections · 10 questions · 4 coding challenges
The arrow keys move between sections too.
Could Labelled Sentences Teach Us Where to Split?
BOTIE
Xue's 2003 work framed Chinese word segmentation as supervised character tagging, learning from manually annotated data. This shifted attention from choosing only among known whole words to predicting structural labels from the surrounding evidence.
The lesson's boundary classifier uses a simpler question at each gap: split here or continue? We extract local features, learn their relationship with labelled boundaries, and apply the same representation to new text. This makes individual decisions easy to inspect, but independent gap decisions do not enforce all the constraints of a whole-sequence tagger. The annotation convention also matters, because it defines the answers being learned.
Sources for this history
Ask Each Gap Whether a Word Ends Here
We can phrase segmentation as a question at every gap: does a word end here? Labeled examples can teach a classifier which local evidence makes a boundary likely.
This approach makes each boundary decision inspectable, while giving up some of the whole-sequence constraints used by a hidden-state model.
Put the prediction at a gap
The target belongs between neighbouring characters. A label says whether that gap is a word boundary in the training example.
Context
- last character of one word
- Highlighted: GAP
- first character of another
The prediction unit changes from a word to a gap
The detailed example shows the selected features, learned boundary scores, and the decisions they produce.
It compares local inspectability with the constraints and context a whole-path model can use.
Explore the full example
Select a gap and examine the neighbouring characters used to classify it. Compare individual boundary decisions with the resulting complete segmentation.
Answer every gap on its own, then ask one of them why
Pick the marked-up sentences, type anything, and every gap between two neighbouring characters is given its own yes or no. Click a bar to see what pushed that one gap either way. The whole-sequence method of the previous page is fitted on exactly the same sentences and answers underneath.
…
Part 1. One Answer That Cannot Be Taken Apart
1. What scoring a whole sentence at once buys, and where it leaves you
The previous page gave every character of a text one of four places in its word, and chose the whole run of places at once by adding up a score along it and taking the largest total. That is a real advantage and it is worth naming before we give it up. A word cannot be left half open, a boundary in one spot can be paid for by what it forces two characters later, and the answer that comes back is the best reading of the sentence under one account of what sentences look like.
Now ask a narrow question of such an answer. The sentence we carry through this section is Dr. Alvarez didn’t expect the low-cost re-analysis, and with its spaces taken out it is forty-five characters with forty-four gaps between them. Point at the gap between the full stop of Dr. and the A of Alvarez and ask what decided it.
There is no answer, and the reason is structural rather than a shortcoming of any implementation. The score being maximised is a sum over the whole run, so the boundary at that gap was settled by a comparison between two complete readings of forty-five characters, one of which cut there and one of which did not, and the difference between those two totals includes terms drawn from every character in the sentence.
Changing the answer at that gap alone is not something the method can be asked to do.
The same holds for correcting it. If a reader sees one gap answered wrongly there is no weight to reach for, because the quantity that decided it was assembled out of counts about places and steps that every other gap in the sentence also leaned on. And the annotation has the same shape from the other direction, which is the third section.
Keep in mind
2. One question at every gap, answered on its own
Between any two neighbouring characters of a text there either is a word boundary or there is not. That is a question with two answers, it has one at every gap of every text, and nothing in it mentions any other gap. So take it as the whole method. Ask it forty-four times of our sentence, cut wherever the answer is yes, and read off the pieces.
a text of n characters → n − 1 questions, each answered on its ownHere is that done, on eight short sentences somebody has marked up by hand. Each bar is one gap, drawn upward when the answer was to cut and downward when it was to keep going, and the height is how strongly. Nothing joins the bars, because nothing in the calculation joins them.
…
Forty-one of the forty-four gaps agree with the reading a person gives, and the three that do not are the three drawn in red, all of them inside the surname. What matters for now is not the score but the shape of the answer, since every one of those bars was arrived at without consulting any other bar, and the three wrong ones can be pointed at individually in a way the previous method offers no vocabulary for.
Keep in mind
3. A corpus that can be marked one gap at a time
This is the argument the method was invented for, and it is about who has to do the work rather than about accuracy. Imagine somebody going through text marking boundaries and stopping wherever they are unsure. Whether a compound noun is one word or two is genuinely arguable, so a careful annotator leaves such gaps alone and marks the ones they are certain of.
To a gap-at-a-time learner that corpus is simply fewer examples, since a marked gap is one instance and needs no neighbour. To a method that works in places inside a word it is much worse than that, because the place a character occupies is known only when the gaps on both sides of it have been settled, so an unmarked gap spoils the two characters it sits between. Two hundred sentences of a generated language, with a share of the gaps marked at random, say how much worse.
…
With two fifths of the gaps marked, the gap learner keeps 39.49% of its training material and the sequence learner keeps 19.61% of its own, a little over half as much, which is what you would expect from needing two independent events rather than one. At a fifth marked it is 20.41% against 7.79%, so the gap between them widens as the annotation gets sparser.
›Why the second share is not simply the first one squared
A gap is usable when the annotator marked it, which here happens two times in five. A character in the middle of a sentence has a gap on each side and needs both of them marked. A character at either end of a sentence has only one gap and needs only that one.
a gap, usable 0.4
a character inside a sentence 0.4 × 0.4 = 0.16
a character at the end of a sentence 0.4
(1,461 × 0.16 + 400 × 0.4) / 1,861 ≈ 0.21The two hundred sentences hold 1,861 characters, and 400 of them stand at one end or the other, so about 21% of the places are expected to survive where 40% of the gaps do. The 19.61% and the 39.49% above are one drawing of the marks counted, which is why they sit near those figures and not on them. A language with longer sentences has fewer end characters for its length, and its share falls closer to the 16%.
In a model
The implementation this page runs on is handed sentences that are marked all the way through, because that is the form every other segmenter in the family reads, and the numbers above are counted rather than fitted. Nothing in the learning rule would change for a partly marked corpus, since it never looks at more than one gap at a time, and that is precisely the claim the method rests on.
Keep in mind
Part 2. What a Gap Is Asked
4. The characters either side, and how far to look
A gap has to be answered from something, and the only thing available is the text around it. Number the characters so that the one immediately before the gap is at offset minus one and the one immediately after is at offset zero, and then decide how far to look in each direction. That distance is the one number the whole design turns on, and we will call it the reach.
… c[−3] c[−2] c[−1] | c[0] c[1] c[2] … with the gap at the barWithin the reach, each single character is one thing the gap is asked about, and each neighbouring pair of them is another. The pairs matter because a boundary is often a fact about a juxtaposition rather than about either character alone. In our sentence a punctuation mark sits immediately to the left of four gaps, one of which is a boundary and three of which are not, so a question about punctuation on its own is being asked to answer two different things at once, where a question about which characters sit either side of the gap is not.
Worked example
At a reach of one, the gap in the two characters a and b is asked seven things. Whether it is a gap at all, which contributes the same number everywhere. Which character sits on the left, and which on the right. What kind each of those is. Which pair they make, and what pair of kinds that is. Seven questions, and the next two sections are about the kinds and about where seven comes from.
Keep in mind
5. What kind of character, as well as which one
Asking which character sits at an offset is exact and it is useless the first time an unfamiliar character turns up. So each offset is asked a second, coarser question, which is what kind of character that is. Seven kinds are enough for this purpose, namely a Han character, a hiragana, a katakana, any other letter, a digit, a punctuation mark, and everything else.
What that buys is a rule learned once instead of once per pair. A boundary between a run of one script and a run of another is a single thing to learn, rather than something that must be learned separately for every one of the thousands of character pairs that could sit astride it. And it never goes silent.
Counted over every gap of two hundred held-out sentences of a generated language, 31,566 questions in all, the ones naming particular characters carry a weight 79.33% of the time and the ones naming kinds carry one every time.
Our own sentence needs both halves, and it is worth being exact about which does what. The full stop that ends Dr. is followed by a boundary; the apostrophe inside didn’t and the hyphen inside low-cost are not. All three are a letter next to a punctuation mark, so the kinds alone cannot separate them, and which character it is has to settle it. Meanwhile in a name nobody has written down, the kinds are all there is.
…
Those two texts are read by a fit that has met eight sentences in which a foreign name keeps its own script. Ortiz is a name those sentences never held and the three characters after it never appeared in them at all, and the answer is still right, while the whole-sequence method taught the identical eight sentences answers Ortiz漢 and 字文 and gets neither of them.
Keep in mind
6. How many questions one gap answers
Count them, since the number is exact and it is the only cost a wider reach carries. A reach of w covers 2w offsets, minus w to w minus one, and each of those contributes a question about the character and a question about its kind. The neighbouring pairs inside that stretch number 2w minus one, and each contributes the same two. One more for the fact of being a gap at all.
questions at a gap = 1 + 2 × 2w + 2 × (2w − 1) = 8w − 1| reach | offsets read | pairs read | questions at a gap in the middle of a run |
|---|---|---|---|
| 1 | 2 | 1 | 7 |
| 2 | 4 | 3 | 15 |
| 3 | 6 | 5 | 23 |
| 4 | 8 | 7 | 31 |
Counted by listing the questions of one gap at each reach rather than by evaluating the formula. A gap near either end of a run asks fewer, since an offset that falls off the end contributes nothing at all.
Three is the reach used everywhere on this page, so a gap in the middle of a run answers twenty-three questions. That is small, it does not grow with the length of the text, and it does not grow with the amount of marked-up text the answers were learned from, which is what makes the cost of reading a text the dull half of this method.
Keep in mind
Part 3. Learning the Answers From Marked Gaps
7. A score that is a sum of weights
Each of the questions at a gap gets a number, and the answer at that gap is the sum of the numbers of the questions it asked. Positive means cut and anything else means keep going. That is the whole scoring rule, and its plainness is the property the eleventh section trades on, since a sum can be listed term by term where a maximum over readings cannot.
score at a gap = Σ over the questions this gap asks of weight(question)A question the marked-up sentences never raised has a weight of zero and therefore contributes nothing, which is the right behaviour and not a special case. There is no threshold to choose either, because the constant question every gap asks can absorb any base rate on its own.
Worked example
Take one sentence of two characters, a and b, marked as two words, and a reach of one. Every weight starts at zero, so the gap scores zero, which is right for neither answer and counts as a mistake. Add one to each of the seven weights the gap asked about. Now that same gap scores exactly 7.0 and the text comes back as a and b. Mark the sentence as the single word ab instead and every weight becomes minus one, the gap scores −7.0, and the text comes back whole.
Keep in mind
8. Correcting only the gaps it gets wrong
Walk through the marked gaps one at a time. Score the gap with the weights as they currently stand. If the sign agrees with what the annotator marked, change nothing at all and move on. If it does not, add one to every weight the gap asked about when the annotator said cut, and subtract one when they said keep going. That is the whole learning rule, and it is worth noticing that it never looks at a gap it is already right about.
on a mistake: weight(question) ← weight(question) + label, with label = +1 to cut and −1 to joinA score of exactly zero counts as a mistake while learning, since zero is right for neither answer, and at reading time it is not a cut, because leaving text whole is the more conservative of the two errors. Our eight marked-up sentences hold 189 gaps between them, 34 of which carry a boundary, and here is what the corrections do over twenty passes.
…
Forty-five corrections on the first pass, then ten, five, nine, seven, three, and from the seventh pass onwards none at all, which means every one of the 189 gaps is now answered the way the annotator marked it. That is a stopping condition rather than a convergence in any deeper sense, and the ninth and tenth sections are about the two things it does not settle.
Keep in mind
9. The average of every set of weights, not the last one
There is a repair worth making before the weights are used, and it costs almost nothing. The walk of the previous section passes through one set of weights after every correction, and the last of those has no special claim on being the best. It is simply the one that happened to be current when the passes ran out, and it carries the full imprint of whatever gap was corrected most recently.
So answer with the mean of every set of weights the walk passed through, counting each one once for every step it survived. That is the averaged form Freund and Schapire analysed, and it generalises considerably better than the final set on data the walk has not seen.
averaged weight = ( Σ over steps of the weight at that step ) / number of stepsA walk of two steps, averaged
Take one sentence of three characters, a, b and c, marked as the two words ab and c, with a reach of one and a single pass that visits the first gap first. The two gaps ask seven questions each, and four of the seven are the same four at both, namely whether this is a gap at all and the three about kinds, since every character here is a letter.
| weight of | after step 1 | after step 2 | averaged |
|---|---|---|---|
| the four questions both gaps ask | −1 | 0 | −0.5 |
| the three naming a and b | −1 | −1 | −1 |
| the three naming b and c | 0 | +1 | +0.5 |
Step 1 meets a score of zero at the gap marked as a join and subtracts one from its seven weights. Step 2 scores the other gap at −4 from the four shared weights, which is wrong for a gap marked as a cut, and adds one to its seven.
The four shared weights finish the walk at zero, as though nothing had been learned about them, and the average remembers that they spent half the walk at minus one. That is where a weight of one half comes from. It also shows what one pass is worth, since the averaged weights score the two gaps at −5.0 and −0.5 and the text comes back as the single piece abc, with the second gap still wrong.
›Why this works
Written that way it looks expensive, since it seems to need every set of weights kept. It does not. A weight only changes on a correction, so between two corrections it contributes its own value once per step, and the running total can be charged that whole stretch at the moment it next changes. Each weight therefore needs one extra number recording when it last moved, and nothing at all is stored per step. That is why the averaged form is used rather than merely admired.
It also explains the fractions in the twelfth section. Every correction adds or subtracts exactly one, so whole numbers are what the weights would be if the answer were the state the walk finished in, and a weight of one half belongs to a question that spent half the walk at one value and half at another.
Keep in mind
10. The order the corrections arrive in
The rule repairs the gap it is currently looking at, so which gap it looks at first changes which weights move first, which changes what it is wrong about next. Two runs over the same marked-up sentences in two different orders therefore end up with different weights, and the widget in the eighth section shows what that is worth on our own sentence.
Eight orders over the same eight sentences give five different readings of the same forty-five characters, and none of the eight reproduces the reading a person gives. Every one of them runs out of corrections within seven passes, so all eight are equally right about the 189 gaps they were shown and disagree only about the gaps they were not. The disagreement is concentrated in the surname, which is the one stretch of the sentence made of characters those sentences never carried.
In a model
That is worth stating flatly rather than as a caveat. A segmentation quoted from this method is a segmentation from one order of one corpus, and the order is a free choice that nothing in the method makes for you. Fixing it makes two runs agree with each other; it does not make either of them the right one. The averaging of the ninth section reduces the spread and, on eight sentences, does not remove it.
Keep in mind
Check yourself
Questions on Parts 1 to 3
Question 1 of 5
When the whole-sequence method answers one gap wrongly, a reader can point at the weight that decided that gap and change it.
Part 4. Our Own Sentence, Gap by Gap
11. Forty-four gaps and three of them wrong
Now the whole thing on our own sentence, with the marked-up sentences chosen so that the exercise is not rigged. Eight sentences carry the shapes the sentence needs, which are an abbreviation whose full stop ends it, a contraction, a hyphenated compound and a prefix. Four of the seven words a reader answers with are absent from those eight sentences altogether, namely Alvarez, expect, low-cost and re-analysis with its full stop.
…
Three of the forty-four gaps come out against the reading a person gives, and all three are inside the surname. The method cuts after the v and after the a, leaving a single letter standing as a word of its own, and then fails to cut between the z and the d that begins didn’t, so what comes back is Alv, then a, then rezdidn’t. Everywhere else it is right, and three of the four words the sentences never held come back exactly, which is the thing to take from the widget.
Set against it is the whole-sequence method taught the identical eight sentences. It recovers Alvarez whole, which is precisely where this method fails, and it loses didn’t and expect, which is precisely where this method succeeds. The sixteenth section comes back to the surname, where the difference between the two is a consequence of how each answer is put together rather than an accident.
Keep in mind
12. One gap opened up
A score that is a sum can be listed. Pick a gap, write down every question it asked and the weight that question carries, and the list adds to the number that decided it. Nothing is approximated and nothing is attributed, since the sum is what the calculation actually did.
…
The first of those is the gap between the full stop of Dr. and the A of Alvarez, and it comes to +7.1283. Every question about the characters after the gap carries a weight of zero, so the whole of the positive case is made from behind it, and two of those questions could never have carried a weight at all, since those eight sentences contain no capital A and no v anywhere.
The single largest contribution is +3.6304, for the full stop sitting immediately to the left, and the questions about kinds contribute −0.3188 between them, which is to say almost nothing.
Now the second and third, which are a letter followed by a punctuation mark inside didn’t and inside low-cost. Both are kept together, at −17.5093 and −19.7016, and in both the questions about kinds contribute −12.0563, the same figure to the last digit, since those two gaps ask exactly the same questions about kinds. That is the generalisation working, and it is also why the offsets have to be kept apart, since the full stop of Dr. carries its punctuation on the other side of the gap, asks a different set of questions about kinds, and gets −0.3188 out of them rather than −12.0563.
The fourth gap is the opposite case, a change of script where only one of the eleven questions about which characters these are carries any weight, and the cut is made at +0.0367.
The four gaps, each added up by kind of question
A gap in the middle of a run asks twenty-three questions at this reach. One is whether it is a gap at all, eleven name particular characters and eleven name kinds, and the score is the three subtotals added together.
| the gap | being a gap at all | which characters | what kinds | score |
|---|---|---|---|---|
| after the full stop of Dr. | −3.0455 | +10.4926 | −0.3188 | +7.1283 |
| before the apostrophe of didn’t | −3.0455 | −2.4074 | −12.0563 | −17.5093 |
| before the hyphen of low-cost | −3.0455 | −4.5997 | −12.0563 | −19.7016 |
| the change of script | −1.0683 | +1.0000 | +0.1050 | +0.0367 |
Each row adds across to its score, to within the rounding of the figures shown. The last row comes from the fit on the eight sentences that mix two scripts, which is why its first column differs.
Read down the columns. The first is the same number for every gap of one fit, and it is negative because most gaps are not boundaries, 155 of the 189 marked ones here. The third is what the two punctuation marks inside a word have in common. The second is the only place the full stop of Dr. gets its cut from, and it is also the only column that tells the apostrophe from the hyphen.
›Why this works
It is worth being exact about what this is and is not. This is a decomposition of the score, so it says what the arithmetic did. It does not say what caused the boundary in the language, and a different order of the corrections produces a different set of weights, as the tenth section showed. Reading it as evidence about English rather than about this fit would be reading it for more than it holds.
What it does support is a repair. A gap answered wrongly names the questions that got it wrong, and marking more text in which those questions arise moves exactly those weights. That is a loop an annotator can be put in, and it is the second half of the argument the method was invented for.
Keep in mind
13. The gaps nobody is asked about
A text handed to a segmenter is not always one unbroken run. Chinese quoting an English name, Japanese with line breaks in it, two sentences with a space between them, all contain whitespace, and whitespace is already a boundary. A gap that spans a space is therefore never asked about at all, and the runs on either side of it are answered separately.
…
Eight characters here with a space in the middle, so there are two runs of four and six gaps rather than seven. The boundary at the space is free, in the sense that it costs no question and cannot be got wrong, and the six that remain are all answered correctly. The other thing being kept is that the pieces coming back report where they sit in the original text rather than in their own run, so the third word starts at position five rather than at zero.
There is a mild consequence for the reach. A gap near the start of a run has fewer characters behind it than the reach asks for, and the questions about those offsets simply do not arise rather than being answered with anything. So the first gap of a run answers fewer questions than a gap in the middle, which is why the sixth section’s count is stated for a gap in the middle.
Keep in mind
Part 5. Set Against the Whole-Sequence Method
14. Where each of them wins, on the same marked sentences
The comparison has to be made on the same evidence or it says nothing, so both methods are handed the identical marked-up sentences at every size, and both are scored on the same two hundred held-out sentences, with a word counting as recovered only when both of its ends land where the sentence put them. Two generated languages are used, one of seventy words spelled out of forty characters and one of ordinary English words with the spaces taken out.
…
On the character language the whole-sequence method is ahead for a long time. At thirty sentences it scores 0.8659 against 0.7974, and the lead does not turn over until somewhere between eighty and a hundred and sixty sentences, after which it turns over decisively, 0.9650 against 0.9178 at a hundred and sixty and 0.9799 against 0.9223 at three hundred and twenty.
On the English words the picture is not the same picture shifted along, it is a different picture. The gap method passes the other one by twenty sentences and then keeps climbing, reaching 0.9057 at 1,280 sentences, while the whole-sequence method peaks at 0.6087 and then falls back to 0.5186 as more text is added.
The previous page measured why that happens to it, which is that a single letter of an alphabet says very little about where in its word it sits and says less as the vocabulary widens. A gap method never asks a character where it sits; it asks a window of six characters and five pairs whether a boundary is between the middle two, and that question keeps its answer.
In a model
I went into this expecting the two methods to be close on the alphabet, and 0.9057 against 0.5186 is not close. The honest reading is that these two are not variants of one approach with a knob between them. One of them is built on a claim about individual characters and the other on a claim about windows of them, and on a writing system where an individual character carries little the first claim fails while the second does not.
Keep in mind
15. Where it is plainly the worse of the two
Two places, and both are worth stating without softening.
The first is words the marked-up sentences never held, which is the very thing the previous page’s method was built to reach. Splitting the same recall by whether the word had been seen, on the character language at thirty sentences, the gap method recovers 0.2640 of the unfamiliar words and the whole-sequence method recovers 0.6560 of them, two and a half times as many. The table under the widget above carries that split at every size, and the gap method is behind on unfamiliar words at every size up to forty sentences. At eighty only nineteen unfamiliar words are left among the held-out sentences, and the gap method recovers six of them to the other method’s five, which is too few to rank the two on.
The second is small corpora of a script whose characters are strongly positional. Four sentences whose every word is exactly two characters long are enough to teach the whole-sequence method that words come in twos, since that fact lives directly in its table of steps from one place to the next. The gap method has nowhere to put it.
…
Handed 生命起源, which is two of the three words those sentences contain, the gap method answers one four-character piece and the whole-sequence method answers the two words. On the surname text underneath it, the ranking reverses again, with five pieces against seven where a reader answers four, so neither of these is a general result about either method.
Keep in mind
16. An answer that maximises nothing
Here is the cost of independence stated exactly. The whole-sequence method returns the reading with the largest total score, so its answer is the best reading under one account of the sentence, and changing any single boundary in it lowers that total. An answer assembled out of independent decisions has no such property, because there is no quantity anywhere in the method that mentions the whole run.
That is checkable rather than merely arguable. Take the reading the gap method gives our sentence and score it with the whole-sequence method’s own tables, learned from the same eight sentences.
| reading | pieces | what the whole-sequence score makes of it |
|---|---|---|
| one answer per gap | 8 | −155.7756 |
| the best whole sequence | 9 | −151.0253 |
| what a reader answers | 7 | −153.9847 |
All three readings of the same forty-five characters, scored by the same tables. The middle row is the largest by construction, since it is what that method returns; the top row is a reading it considered and rejected, and the bottom row is the right answer, which it also rejected.
Read the bottom row before the top one. The reading a person gives scores lower than the reading the whole-sequence method chose, so being the maximum of that score is not the same as being right, and the consistency the method buys is consistency with its own account of sentences rather than with the language. The top row then says what independence costs in those terms, a gap of 4.7503 between an answer that maximises that score and one that maximises nothing.
the best whole sequence, less one answer per gap −151.0253 − (−155.7756) = 4.7503
the best whole sequence, less what a reader answers −151.0253 − (−153.9847) = 2.9594Both differences are in the units of that score, which are logarithms of probabilities, so a larger difference marks a reading the tables find less likely. The reader’s reading sits between the other two, nearer the maximum than the gap method’s answer is and still short of it.
What that looks like in the answer is the single letter a standing as a word inside a surname. Cutting after the v is defensible on its own and cutting after the a is defensible on its own, and nothing in the method ever puts the two decisions in the same sentence. It is tempting to say the whole-sequence method could not have produced such a thing, and that is not true, which is the subject of the twentieth section.
Keep in mind
17. What it costs
Two costs, and the honest one is not the time. Reading a text is 8w minus 1 additions per gap at a reach of w, so twenty-three per gap at the reach used here, against the whole-sequence method’s eight comparisons per character. Both are linear in the length of the text and neither grows with the amount of marked-up text behind them, so on a sentence of forty-five characters the difference is a few hundred additions and is not a consideration.
The cost that matters is marked gaps. Our eight sentences hold 189 of them and produce 631 weights, so there are more weights than examples, which is the ordinary situation for this kind of model and is the reason the tenth section’s eight orders disagree. On the generated character language, the gap method needs a hundred and sixty sentences, 1,361 marked gaps, before it passes a whole-sequence method that was already ahead at thirty sentences and 265 gaps.
| marked-up sentences | marked gaps | weights learned | one answer per gap | the best whole sequence |
|---|---|---|---|---|
| 10 | 89 | 487 | 0.6244 | 0.7811 |
| 30 | 265 | 1,048 | 0.7974 | 0.8659 |
| 80 | 690 | 1,686 | 0.8795 | 0.9060 |
| 160 | 1,361 | 2,314 | 0.9650 | 0.9178 |
| 320 | 2,675 | 2,996 | 0.9799 | 0.9223 |
The character language, both methods on the same sentences, scored on the same two hundred held-out ones. The count of weights is what the marked gaps raised between them, so it grows with the corpus and never stops growing.
Set that beside the third section and the trade is visible from both ends. This method needs more marked gaps than the other one to reach the same score, and it can be handed marked gaps that the other one cannot use at all. Which of those dominates is a question about how the annotation was produced rather than about either method.
Keep in mind
Part 6. Where the Method Stops Being Defined
18. A dependency wider than the window
A gap reads offsets minus w to w minus one and nothing else, so a character further away than that is not part of the question being asked. This is not a matter of the evidence being weak or the corpus being small. The quantity simply has no place in the question, and more text cannot supply one.
That can be measured rather than asserted, by building a language in which the boundary between two characters is decided by a character a known distance away and nothing else. Every run is either p followed by some padding and then ab and cd as two words, or q followed by the same padding and then abcd as one word. Everything between the deciding character and the gap is identical in the two cases, so the gap can only be settled by reading that far back.
…
| the deciding character sits at | what each reach can do with it |
|---|---|
| offset −3 | reaches of 1 and 2 answer one of the two texts and get the other wrong; a reach of 3 answers both. Three is the first reach whose window contains that offset. |
| offset −4 | a reach of 3 now fails, and 4 answers both. Nothing has changed about the language except how far away the evidence sits. |
| offset −5 | reaches up to 4 fail and 5 answers both, so the smallest reach that works is exactly the distance to the deciding character every time. |
| offset −6 | no reach up to 5 answers both texts. The evidence is outside every window tried, and the two runs are, to the question being asked, the same run. |
So the reach is not a tuning parameter in the usual sense of trading accuracy against cost. It is a statement about which dependencies can be written down at all, made before any text is read, and a dependency outside it is invisible rather than poorly estimated. Widening the reach is not free either, since each step raises eight more questions per gap and every one of them needs marked gaps to answer.
Keep in mind
19. The features are a design decision, not a learned one
Every question a gap is asked was chosen by a person. Somebody decided that single characters and neighbouring pairs are asked about and that triples are not, that seven kinds of character are told apart and not seventy, and that the offsets are treated separately rather than as a bag. Those choices fix what the method can express, and the learning then only settles how much each of the chosen questions counts.
What follows is a ceiling that no amount of text raises. A boundary whose evidence is a triple of characters, or a distinction the seven kinds do not draw, has no question to attach itself to, so the weights cannot represent it however many marked gaps arrive. It is the same shape of limit as the window and it is easier to miss, because widening the questions is a change to the design where widening the reach is a change to a number.
Two things follow that are worth separating. Adding questions widens what can be represented and at the same time thins the evidence behind each one, since every new question needs marked gaps to settle it and our eight sentences already raise 631 of them on 189 gaps. And a ceiling set by hand is one that can be raised by hand, which is exactly what the neural descendants of this idea do, replacing the chosen questions with a function that learns what to read.
Keep in mind
20. Independence is false about language
The assumption underneath every answer on this page is that the boundary at one gap can be settled without knowing the boundary at any other. That assumption is false, and it is worth saying as a fact rather than as a caveat. The gaps of a text are the boundaries of the same words, so the answer at one gap and the answer at the next describe two ends of one object.
What is tempting here is to conclude that the answers can therefore contradict each other in ways a whole-sequence method could not produce, and that turns out to be wrong. Any set of cuts is a segmentation, so there is no arrangement of independent answers that the other method is incapable of returning. I checked it on the case where the argument should be strongest, four marked-up sentences whose every word is exactly two characters long, over all 1,296 four-character texts spellable from their alphabet.
| method | texts answered with a piece of odd length | out of |
|---|---|---|
| one answer per gap | 32 | 1,296 |
| the best whole sequence | 45 | 1,296 |
A corpus in which every word is two characters long, so a piece of odd length is a word shape the corpus never showed. The whole-sequence method produces one more often, not less, which is the opposite of what the argument from independence predicts.
So the difference is not that one method forbids incoherent answers. Both produce them, and here the one with a model of the sentence produces them more often, since it has never seen a one-character word either and what decides those cases for it is the amount added to every count it never saw. The real difference is the one the sixteenth section measured, which is that only one of the two answers is the maximum of anything, and the practical consequence, which the fifteenth section already showed, is that a fact about word shapes has nowhere to be recorded here.
In a model
I had this section written the other way round before I counted, with the corpus of two-character words as the case where independent answers invent a word length the language does not have. They do, thirty-two times, and so does the method that supposedly cannot. The claim that survives is narrower than the one I set out to make and it is the one the numbers support.
Keep in mind
21. Where the method has nothing to say
Gathered in one place, these are the inputs and questions on which the method stops being defined rather than becoming approximate, with what has to be decided in each case and what turns on the decision. The decisions are the ones worth a reader’s attention, since nothing in the method makes them and each of them changes what comes back.
| the case | what the method says |
|---|---|
| a gap scoring exactly zero | right for neither answer, so something has to be decided. Counting it as a mistake while learning and as no cut while reading is one choice, and the other choices are to cut, which makes an unfamiliar text fall apart, or to refuse and leave the gap for something else. Nothing in the arithmetic prefers any of the three. |
| a run of one character | has no gap, so there is no question and no answer. The run is one word by default rather than by decision, and that is the only case in which this method returns something without having been asked anything. |
| a question the marked gaps never raised | carries no weight, so it contributes nothing rather than contributing an estimate. At a change of script into unfamiliar characters, one of the eleven questions about which characters these are carried any weight at all, and the gap was decided at +0.0367. |
| the order the marked gaps are visited in | undetermined by the method and it changes the answer. Eight orders over the same eight sentences give five different readings of the same forty-five characters, all of them right about every one of the 189 gaps they were shown. |
| evidence outside the window | not weakly represented but unrepresentable. The smallest reach that answers a language whose boundary depends on a character k back is exactly k, and at a distance of six no reach up to five answers it at all. |
| a dependency between two gaps | has nowhere to be recorded, since every question a gap asks reads characters and never another gap’s answer. The consequence is not contradiction, which both methods produce, but that a fact needing two gaps to state cannot be stated. |
| which questions a gap is asked | assumed answered, and answered by a person. That list fixes the ceiling, and no quantity of marked-up text raises it; more text can only settle the questions already on the list, of which our eight sentences raise 631 on 189 gaps. |
| whether an answer is right | outside the method, as it was on the dictionary pages and the hidden-model one. Even the whole-sequence score disagrees with a reader here, ranking its own nine-piece answer at −151.0253 above the reader’s seven-piece one at −153.9847, so an accuracy figure is always a figure against one person’s cutting. |
Keep in mind
Check yourself
Questions on Parts 4 to 6
Question 1 of 5
The gap inside didn’t scores minus 17.5093 and the gap inside low-cost scores minus 19.7016, yet the questions about kinds contribute minus 12.0563 to both, to the last digit. Why?
Try it with Botie
Build with Botie
Write and run Python