Finite-State Morphology
A word's spelling can reflect a stem, an ending, and a rule that changes how they join. Finite-state morphology describes those relationships explicitly so we can analyse forms and generate them from their components.
14 sections · 15 questions · 3 coding challenges
The arrow keys move between sections too.
How Do We Connect a Written Word to Its Grammatical Parts?
BOTIE
Koskenniemi's 1983 two-level morphology work developed a computational model for both recognising and producing word forms. It related lexical and surface representations through constraints that could be implemented with finite-state machinery, addressing the interaction between word formation and spelling.
A lexicon supplies known stems and permitted continuations. Rules account for how those combinations appear in writing. A path through the system can connect a surface word with one or more analyses. This makes the reasoning inspectable, while also making coverage explicit: a missing path may indicate a missing stem or rule, rather than an impossible word.
Write Down How the Word Is Built
Splitting a word into frequent pieces does not tell us what its parts do. A grammatical analyzer may need to identify a stem, an ending, and a spelling change.
A finite-state morphology system connects written forms with analyses through explicit lexical and grammatical rules.
Distinguish a written form from an analysis
Cats is a surface spelling. Cat plus a plural label is an analysis of its structure. The analyzer's job is to connect the two under its rules.
Surface form
- cats
Analysis
- cat
- plural
The grammar makes the analysis inspectable
The detailed example follows states and transitions through the small grammar implemented here.
Explicit rules provide clear reasoning about accepted forms, while also making missing coverage a central limitation.
Explore the full example
Trace a word through the allowed stems and endings. Compare a recognised form, an unfamiliar form, and a form with more than one possible analysis.
Add a line to the grammar, which is the only way anything new becomes readable
…
Part 1. Where the Pieces Have Come From Until Now
1. Every piece so far was found by counting
Byte pair encoding merges the pair of symbols that occurs most often. The unigram model starts from a large set of pieces and drops whichever is least missed. The method that searches for the set of pieces describing a corpus in the fewest bits is measuring the corpus too, and so is the one that picks the pieces covering the most text.
Every one of them arrives at a vocabulary by asking a body of text a question and reading the answer off, which means every one of them inherits whatever that body of text happened to contain.
That is not a criticism, and it is the reason those methods work on languages nobody on the team speaks. It is a commitment, though, and it is worth being precise about what is being committed to. The pieces are wherever the counts fall. Nothing in any of those methods knows that re is a prefix, that ed makes a past tense, or that bake and bak are the same word spelled two ways, and if the counts put a boundary in the middle of a suffix then the middle of a suffix is where the boundary is.
Keep in mind
2. Where the counts put the cut
I wanted a fair look at this and not a rigged one, so instead of fitting a vocabulary on a scrap of text I gave it the friendliest corpus I could construct. The grammar this page builds later accepts 1,074 different words; I put every one of those words in a corpus exactly once and fitted a vocabulary of 178 pieces on it, which is the same number of lines the grammar takes to write. Nothing was held back, nothing was rare, and the words were all inflections of one another.
On three of the six words I looked at the two answers agree. On the other three they part company in a specific way. recovers comes back from the counting as recov and ers, and bakes comes back as bak and es. Both cuts fall one character to the left of where the word is jointed, because ers and es are frequent endings of written words and the counts have no opinion about which characters belong to the stem. measured misses in the other direction, as measure and d, where the grammar says measur and ed because the stem drops its final e.
The other half of it is that the answer moves when the budget moves. At 178 pieces, measured is cut as measure and d; at 356 it is one piece and is not cut at all, and unnamed goes from three pieces to two by absorbing the prefix into the stem. A written grammar answers the same thing at every size, since nothing in it was chosen by counting.
…
The widget above is used again in section 15 for the numbers down its left-hand side. For now the column worth looking at is the right-hand one, which does not change when the button changes.
Keep in mind
3. The other way to get the pieces
The alternative is old and it is not complicated. Somebody who knows the language writes down its stems, writes down its endings, and writes down which endings may follow which stems. A word is then read by finding a way of spelling it out of those pieces in an order the writer allowed, and what comes back is not only where the word divides but what each division is doing.
Our sentence has a word of exactly this shape.
Dr. Alvarez didn't expect the low-cost re-analysis.A reader who knows English sees re-analysis as re in front of analysis, and would say without hesitating that the prefix means again. That reading does not depend on having seen the word before, which is the whole point, and it is the thing a person can write down and a count cannot discover. What follows is what happens when somebody does write it down.
Keep in mind
Part 2. A Grammar Is a Machine
4. States, and steps that read something
Writing the pieces down is one thing and writing down the order they may come in is another, and the second is what turns a list into a machine. Think of reading a word as standing somewhere, taking some characters, and arriving somewhere else. Where you are standing is not a position in the word; it is a summary of what may legitimately come next, which is why there are only a handful of places to stand however long the word is.
A place to stand is a state. A step out of a state carries four things, and every step reads at least one character.
a step = ( state, spelling, label, next state )One state is where every word starts. One more is the end, and it is not a place with steps out of it; it is the condition that the word has finished exactly here. So reading a word means finding a run of steps that begins at the start, spells the word out with nothing left over, and stops at the end.
a reading = steps s₁ … sₖ with spelling(s₁) + … + spelling(sₖ) = the word›Why this works
The requirement that every step reads at least one character is the reason the search finishes. Each step moves strictly to the right in the word, so no run of steps can be longer than the word is, and a state that leads back to itself cannot be visited forever. Machines of this kind normally allow a step that reads nothing, and then a loop of such steps has to be detected and removed before anything can be walked.
Forbidding them costs one thing, which section 8 is about, and buys termination with no check at all.
Keep in mind
5. The whole grammar, written out
Here is a grammar small enough to print completely. It has three verbs in it, one of which is also a noun, and their endings. It is 16 lines and 5 states, and I am showing it whole because everything on the rest of this page is this object made larger.
…
Read one line of the table as a sentence. Standing in the start state, read the characters walk, call them the verb walk, and go to the verb ending state. Standing in the verb ending state, read ed, call it a past tense, and the word ends here. That is two steps and it is the whole of reading walked.
Two things in the table are worth noticing now because they are the subjects of sections 8 and 13. Every stem appears twice, once going to an ending and once going straight to the end. And bake appears a third time spelled bak, going to a state of its own.
Keep in mind
6. Walking a word through it
Now take walked and walk it. The machine begins in the start state at the first character. It looks for a line whose spelling begins there, finds walk, takes it, and is now in the verb ending state at the fifth character. It looks again, finds ed, takes it, and that line says the word ends here, which it does.
The widget below shows that as two rows. The first is each character of the word with the state it was read in written underneath, so the machine stops being an abstraction and becomes something running along the word. The first four characters are read in the start state and the last two in the verb ending state, and the place where the label changes is the place the word divides.
…
Worked example
Five lines are tried to read walked and two of them lead anywhere. The three that do not are the other lines whose spelling is also walk, since the start state holds four of those, one going to the verb ending, one going to the noun ending, and two saying the word could end after the stem. All three of those are perfectly good steps and none of them can be completed, because there is an ed still to account for and neither the noun ending nor the end of the word can account for it.
Keep in mind
7. The search backs out of dead ends
Press bakes in the widget above and the search does something more interesting. Four lines are tried. The first takes bake into the state of endings beginning with a consonant, finds s there, and finishes. The second takes bake as a whole word and cannot, since there is an s left. The third takes bak into the state of endings beginning with a vowel, and nothing in that state spells es, so the search backs out.
That third branch is the one worth watching, because it is the machine considering a reading a reader would never entertain and rejecting it for a reason written into the grammar rather than guessed at. Backing out costs nothing here and the section on ambiguity is about the case where it costs a great deal.
In a model
A real analyser does not search. Its lexicons are compiled into one machine and then minimised, so that reading a word is a single pass through it taking time proportional to the number of characters rather than to the number of lines. That compilation is exactly what makes this method usable on a lexicon of a quarter of a million stems. Walking the lines directly, as here, answers the same question and is the same grammar; it is slower by whatever the search costs, and it shows the reasoning, which a compiled machine cannot.
Keep in mind
8. Why a bare stem is written twice
In the printed grammar, walk appears once going to the verb ending state and once going straight to the end. That looks like a redundancy and it is not, and the reason is the rule that every step reads at least one character.
English marks the present tense of most verbs with nothing at all, so the natural way to write it is a step that reads no characters and calls them a present tense. Allowing steps like that means allowing a run of them, which means a machine can go round a loop forever without moving along the word, and every walk then needs a check for that. Writing the stem a second time with the end as its next state says the same thing and cannot loop.
›Why this works
The two are the same claim. A step reading nothing from the verb ending state to the end says a word may finish after the stem; a second copy of the stem line going to the end says a word may finish after the stem. What is lost is that the second version cannot label the absence, so a bare walk comes back as the verb walk rather than as the verb walk in the present tense. Where that label matters, the usual repair is a step that reads some character the surrounding system agrees is invisible, which is trading one awkwardness for another.
Keep in mind
9. What a grammar accepts is a list you could print
Because every step reads a character and none of these states can be reached from itself, the set of words a grammar accepts is finite, and it can be worked out with no word in hand at all by walking every path from the start to the end. The small grammar accepts twelve words, which the widget in section 5 lists in full.
Doing the same to those twelve paths turns up something else. There are fourteen paths and twelve words, so two of the words are spelled by two different paths each. Those two are walk and walks, and they are the subject of section 20.
| grammar | states | lines | words accepted | readings |
|---|---|---|---|---|
| three verbs and their endings | 5 | 16 | 12 | 14 |
| the same, before the spelling change | 3 | 12 | 12 | 14 |
| thirty-six verbs, forty nouns, three prefixes | 6 | 178 | 1074 | 1184 |
Every path from the start state to the end, counted for the three grammars this page uses. Two of the small grammar’s twelve words have two readings each, and 108 of the larger grammar’s have more than one.
Keep in mind
Part 3. An Analysis Says What Each Piece Is
10. The labels are the answer
Every method earlier in this section answers with places. Here is a word, here is where it divides, get on with it. This method answers with places and with names, because every line of the grammar carries a label and a reading is a run of lines, so the labels come out with the pieces at no extra cost.
Set the two side by side on walked. A learned vocabulary says the word is walk followed by ed. The grammar says the word is the verb walk in the past tense, and that the past tense is spelled with the second piece. Those are different kinds of answer, and the second is the one a system doing anything grammatical downstream actually wants.
walked → walk+V +PASTThe notation is the one this tradition has used since the Xerox tools, a stem with a part of speech on it followed by the features the endings contributed. It is a string and not a structure because that is what analysers in this family report, and because it sorts, which section 12 needs.
Keep in mind
11. Several words read
Four words, read by the grammars on this page, with what every piece was identified as underneath it. The last of them, reopeners, is read by the larger grammar of Part 4 and not by the small one, because the small one has no prefixes in it.
…
The fourth is the one to look at. It has four pieces and each of them carries a different kind of claim, since a prefix meaning again, a verb, an ending that turns the verb into the person who does it and a plural on the result are four different sorts of thing to know. Nothing about that reading needed the word to have been seen, and reopeners is not a word I would expect to find in a corpus of any size.
Keep in mind
12. Cutting a word by its reading, and which reading is taken
A tokenizer downstream wants pieces and not labels, so the analyser has to be able to hand a word on as a cut. When a word has one reading that is unambiguous. When it has several, one of them has to be chosen, and nothing in the grammar chooses.
So a rule is imported from outside. The reading with the fewest pieces wins; if several tie, the one whose label string sorts first wins; if several still tie, the one whose pieces sort first wins. On walks, both readings have two pieces, and walk+N +PL sorts before walk+V +3SG because the letter N comes before V, so the plural noun is what is handed on.
Worked example
That is arbitrary and it is written down, which are the two things that matter about it. It is arbitrary because there is no sense in which the plural noun is the better reading of walks in isolation, and there is no context here to settle it. It is written down because the alternative is a rule that depends on which line of the grammar happened to be tried first, and then reordering two lines that say the same thing would change what a word is cut into.
Keep in mind
13. Spelling changes have to be written out
bake plus ed is bakeed, and English writes baked. A grammar that lists the stem, lists the ending and lets them join has just accepted a word that does not exist and refused one that does, and that is not a small failure since it happens to every verb in the language whose stem ends in an e.
I built the smaller grammar both ways to see it. Before the repair it has 3 states and 12 lines, and it reads bakeed as the past tense of bake while returning nothing whatever for baked. After the repair it has 5 states and 16 lines and does exactly the reverse.
| word | before the repair | after the repair |
|---|---|---|
| baked | no reading at all | bake+V +PAST, cut as bak and ed |
| bakeed | bake+V +PAST | no reading at all |
| bakes | bake+V +3SG | bake+V +3SG, unchanged |
| walked | walk+V +PAST | walk+V +PAST, unchanged |
The same four words under the two versions of the small grammar. The repair reverses the first two rows and leaves the regular stems exactly as they were.
The repair is four lines. A second spelling of the stem, bak, labelled as the verb bake, going to a new state holding only the endings that begin with a vowel; and the full stem redirected to a state holding only the endings that begin with a consonant. What comes back is still bake+V +PAST, so the analysis is right even though the piece on the page is bak.
In a model
This is where the real tools do something I have not built. Koskenniemi’s two-level rules, and the rule compilers that came after them, let you write the alternation once as a constraint saying a stem-final e disappears before a vowel-initial ending, compile that into a machine, and compose it onto the lexicon. The result is a machine in which the bak step exists although nobody typed it. Here there is no rule compiler, so the alternation is written as it would come out of one, one extra spelling at a time. The analyses are identical; the cost is that a language with many alternations needs many lines where a rule would need one, and it is a cost that falls on the person writing rather than on the machine.
Keep in mind
Check yourself
Questions on Parts 1 to 3
Question 1 of 5
A vocabulary of 178 pieces was fitted on a corpus holding every one of the grammar’s 1,074 words exactly once. How did it cut recovers and bakes?
Part 4. What a Hundred and Seventy-Eight Lines Buy
14. Lines against forms
The small grammar is too small to say anything about cost, so I wrote a larger one. Twenty-four verbs whose stem never changes, twelve more that drop a final e, forty nouns, three prefixes, and the endings. Thirteen of the words are both a noun and a verb, which is ordinary English and not a device. That is 178 lines across 6 states.
Those 178 lines accept 1,074 different words, by 1,184 distinct readings. The ratio is the whole argument for the method, and it is not a coincidence or a property of the numbers I chose; it is what composition does. Every verb reaches every ending, every prefix reaches every stem, and the count of accepted words is therefore roughly a product where the count of lines is a sum.
178 lines, 6 states → 1074 words, 1184 readingsIt is worth saying where the 178 comes from, because the machine actually has 342 steps in it. The stems are written once and named, and a prefix has to lead somewhere, so the stem list appears in two states instead of one. In a real toolchain you write it once and the compiler makes the copy, and a step reading nothing would remove the duplication entirely; here it is a consequence of the rule from section 4.
Keep in mind
15. The same budget spent on counting
So 178 lines is what the grammar costs. The fair question is what 178 pieces of a learned vocabulary buy on the same words, and the fairest possible setting for that comparison is the one from section 2, where the corpus is the grammar’s own language with every word in it once.
The grammar reads those 1,074 words in a mean of 2.648 pieces, and never in more than 4. A learned vocabulary of 178 pieces spells them in a mean of 2.943, and holds none of them whole. Those two numbers are close, and their closeness is the finding worth taking away, because it means the sequence length a model downstream would pay is about the same either way. What differs is that every piece in the first number has a label on it and none of the pieces in the second does.
…
The numbers to read this time are the four along the top, which describe the grammar, against the two underneath the buttons, which describe whichever learned vocabulary is selected.
Keep in mind
16. Where counting wins
Double the learned budget and the comparison turns over. At 356 pieces the mean falls to 2.071, which is shorter than the grammar’s 2.648, and 37 of the 1,074 words are held whole. Buying that from the grammar is not possible, because the grammar’s pieces are the morphemes and there are as many of them as the words have.
This is the honest place where the method is worse than the obvious alternative, and it is worth stating plainly instead of burying it. If what you want is short sequences, a learned vocabulary gets them by spending memory, and spending memory is easy. A grammar cannot be made to produce a shorter cut without making it describe the language differently, which is not a setting anybody can turn.
| method | size | pieces per word | words held whole |
|---|---|---|---|
| written grammar | 178 lines | 2.648 | n/a, the pieces are morphemes |
| learned by counting | 178 pieces | 2.943 | 0 of 1074 |
| learned by counting | 356 pieces | 2.071 | 37 of 1074 |
Measured on the 1,074 words the grammar accepts, with the learned vocabularies fitted on exactly those words. At the same size the grammar is slightly shorter; at twice the size the learned vocabulary is shorter than the grammar can be made.
Keep in mind
Part 5. The Two Ways It Fails
17. A word outside the grammar produces nothing at all
Hand the larger grammar busiest and it returns nothing. Not a poor cut, not a cut with a piece marked unknown, not a low score. There is no path through the grammar that spells those seven characters, so the set of readings is empty, and the word is handed on whole because there is nothing else to do with it.
…
This is a different failure from every other method on this site, and the difference is worth being sharp about. A learned vocabulary always answers, because it can always fall back on the characters, so its failures are quiet and look like successes. This one is loud. A word it has not been told about produces an empty answer, and an empty answer is trivially detectable, which means a system built on this can count exactly how often it is failing.
Whether that is better depends entirely on what happens next. If something downstream can fall back on another method, an empty answer is a gift, since it says precisely where the fallback is needed. If nothing can, an empty answer is worse than a rough guess, because a rough guess is at least a sequence a model can read.
Keep in mind
18. How much of our sentence it reads
Our sentence has seven words in it by the simplest reckoning, and the grammar reads one of them. That one is expect, and it reads it correctly, as the verb expect with nothing after it.
…
Changing how the words are found does not help. Handing the sentence to the annotation rules for English instead of to a rule about spaces gives nine pieces instead of seven, since it separates the contraction and the final stop, and the count of readable pieces is still one. That is because what is stopping the grammar is not the boundaries. It is that Alvarez is a name, Dr. is an abbreviation, the is a word with no parts, and analysis is a stem I did not write down.
Take the punctuation off, lower-case everything and treat a hyphen as a join, and the sentence becomes nine ordinary words of which the grammar reads two, since cost is in the noun list. Every one of those three operations is a decision made outside the grammar and every one of them changes the number, which is worth knowing before quoting any coverage figure at all.
Keep in mind
19. How much of ordinary prose it reads, and what fifty lines buy
One sentence is too short to measure, so I wrote a paragraph of seventy-six words of plain English about an ordinary subject, wrote it before measuring anything, and did not touch it afterwards. Of the 76 words the grammar reads 7, which is 9.2%; of the 57 different words it reads 7, which is 12.3%.
coverage = words the grammar reads ÷ words in the textThat number is worse than it sounds, and the reason is instructive. The commonest words in English carry no morphology at all. There is nothing in the to analyse, nothing in and, nothing in of, and a grammar of stems and endings has no way to say anything about them except by listing them one at a time. So I listed fifty of them, which is fifty more lines and no more structure, and measured again.
…
Coverage by occurrence goes from 9.2% to 60.5%, and coverage by distinct word from 12.3% to 47.4%. Fifty lines that say nothing interesting bought more than the 178 lines that say something did, on this text, because those fifty words are the ones a text repeats. And 30 different words are still left over, among them busiest, thinned, gone and stallholder, and each of them needs a line, or a spelling rule, or both.
Keep in mind
20. A word it reads more than one way
The other failure runs in the opposite direction. Hand the larger grammar recovers and it returns three readings. It is the verb recover with a third person ending; it is the prefix meaning again in front of the verb cover with a third person ending; it is the same prefix in front of the noun cover with a plural ending.
…
All three are real English and I can put each in a sentence. Nothing in the six characters chooses between them, so this is not a defect in the grammar and adding lines will not fix it; more lines produce more readings, not fewer. Across the whole language the larger grammar accepts, 108 of the 1,074 words are read more than one way, which is 10.1%, and that is a grammar with three prefixes and no derivational depth to speak of.
How fast it can grow is easiest to see on a grammar of four lines, a piece of one character and a piece of two, each of which may be followed by another. A word of six characters has 13 readings, of ten has 89, and of twelve has 233. The counts are the Fibonacci numbers, for the reason the widget gives.
readings(n) = readings(n − 1) + readings(n − 2)Keep in mind
Check yourself
Questions on Parts 4 and 5
Question 1 of 5
178 lines accept 1,074 words because every verb reaches every ending and every prefix reaches every stem, so the count of words is roughly a product where the count of lines is a sum.
Part 6. Where the Method Stops Being Defined
21. There is no fact the grammar can be checked against
Every method earlier in this section has an objective. Byte pair encoding maximises a merge count, the unigram model maximises a likelihood, the description-length method minimises a number of bits. Two people running any of those on the same corpus get the same answer, and if they do not, one of them has a bug.
This method has no objective at all. A grammar is a claim about a language, and the question of whether a claim about a language is correct is a question in linguistics rather than in arithmetic. Two competent people will write different grammars for English, and their disagreements will be real disagreements about the language and not differences of tuning. Is recover one morpheme or two? Both answers are defensible, and the grammar on this page holds both at once, which is why it reads the word three ways.
So there is nothing to optimise and nothing to converge to. What can be measured is coverage on a text, and coverage measures the grammar against a text rather than against the language, so a grammar can gain coverage by listing words while getting worse at describing how the language works.
Keep in mind
22. Outside the grammar is not the same as wrong about
The set of words this method can return an answer for is exactly the set its lines spell. That is a definition rather than a limitation discovered by testing, and it has a consequence that is easy to state and easy to forget. For a word outside that set, the method is not approximately right and it is not wrong. It is undefined, in the way a function is undefined outside its domain.
Every other method on this site is total. Handed anything at all, a learned vocabulary returns pieces, because character pieces are always available underneath. That totality is what lets those methods be scored, since a score needs an answer to score. Here there is nothing to score on busiest, and a system built on this has to decide what an empty answer means before it meets one.
There is a genuine decision attached and it is worth naming. Either the analyser is the whole answer, in which case an unreadable word stops the pipeline and the grammar has to grow until it does not; or the analyser is one of two methods and something else takes over where it returns nothing, in which case what reaches the model downstream is a mixture of labelled and unlabelled pieces, and whatever consumes it has to be built to cope with both.
Keep in mind
23. Ambiguity has no bound the method can supply
The other end is undefined in a different way. When a word has several readings, the method is complete and correct and has nothing to say about which of them is meant, because meaning which reading is a fact about the sentence and the grammar never sees a sentence.
Two things follow, and only the second is usually noticed. The first is that a system needing one answer has to import a rule from outside, and the tie rule in section 12 is such a rule and has no argument behind it. The second is that the number of readings is not bounded by anything in the method.
It is bounded by the grammar, and a grammar with a stem that is also a prefix plus another stem multiplies rather than adds; the four-line grammar reaching 233 readings on twelve characters is the extreme case of exactly that shape.
Where the choice matters, the answer is not more lines. It is a model of what words are likely in context, which is a probability and therefore something learned from a corpus, and so the grammar and the counting turn out to be complements rather than rivals. That is what the systems in this tradition do; they produce every reading and rank them with something trained.
Keep in mind
24. A language moves and a grammar does not
A grammar is written once, by a person, for one language. Three separate costs follow from that sentence, and they are the ones that decide whether anybody uses this method instead of the ones earlier in this section.
It does not transfer. The 178 lines here describe English and say nothing at all about any other language, and the work of writing them again for Finnish or Arabic or Swahili is the same work, done by somebody who knows that language. A learned method is retrained by pointing it at a different corpus, which is an afternoon.
Nor does it fill itself in. Coverage is bought a line at a time, as section 19 measured, and no amount of writing reaches a point where the rest follows. Fifty lines took coverage on one paragraph from 9.2% to 60.5%, and the 30 words still left over need 30 more decisions about English, each made by somebody able to make them.
And it goes stale where nothing has been edited. New words arrive in a language continuously, old ones acquire new senses and new parts of speech, and a grammar written five years ago returns nothing for every one of them while reporting no error and looking exactly as correct as it did the day it was written. A learned vocabulary goes stale too, but the repair is to refit it, and here the repair is to find the person again.
Keep in mind
25. 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 ones worth a reader’s attention are the decisions, since those are what anybody writing a grammar has to make and nothing in the method makes them.
| the case | what the method says |
|---|---|
| a word no path spells | undefined rather than wrong. The set of readings is empty and there is nothing to score, since the method returns readings and there are none. Measured on a paragraph of ordinary prose, that is 69 of 76 words at 178 lines and 30 of 76 once fifty structureless words are listed. What has to be decided is what an empty answer means downstream, and the two answers are that the grammar must grow until it does not happen, or that a second method takes over and the pieces reaching the model are then a mixture of labelled and unlabelled. |
| a word several paths spell | every reading, and no ranking. The grammar is complete and correct here and simply does not contain the information a choice would need, since which reading is meant depends on the sentence and the grammar never sees one. 108 of the 1,074 words the larger grammar accepts are read more than once, and recovers is read three ways, all three of them real English. |
| which of several readings to hand on | a convention imported from outside. Fewest pieces, then the label string in alphabetical order, then the pieces in alphabetical order. On walks that makes the plural noun beat the third person verb because the letter N precedes V, which is not an argument, and the reason it is written down rather than left to the order of the lines is that reordering two lines saying the same thing would otherwise change what a word is cut into. |
| whether the grammar is correct | outside the method, and outside arithmetic. There is no objective to optimise and no answer two people are guaranteed to agree on, because whether recover is one morpheme or two is a question about English rather than about the procedure. Coverage can be measured, but coverage compares a grammar against a text and a grammar can gain it by listing words while describing the language worse. |
| a spelling change between a stem and an ending | not handled by the grammar at all, and the decision is where to handle it. Either it is written out as extra spellings of the stem, which is four lines for one English alternation here and many more for a language with several, or a rule compiler states it once and composes the result onto the lexicon. Both give the same analyses; only the second stays readable when there are thirty alternations instead of one. |
| a piece that is spelled with nothing | not expressible, once every step is required to read a character. A present tense marked by nothing has to be written as a second copy of the stem going straight to the end, which says the same thing and cannot carry the label. Allowing steps that read nothing recovers the label and costs the guarantee that a walk terminates without a check for loops. |
| what counts as a word before the grammar is reached | settled elsewhere, and every choice moves the coverage figure. Our sentence is seven pieces by whitespace and nine by the annotation rules for English, and both leave exactly one piece the grammar can read; taking the punctuation off, lower-casing and splitting on the hyphen makes it nine ordinary words of which two are readable. None of those three operations is part of the method and all of them change the number. |
| a word that entered the language yesterday | the same empty answer as any other unknown word, with nothing marking it as a new kind of failure. A grammar has no notion of its own age and reports no drift, so coverage falls as the language moves and nothing in the method observes it falling. The repair is a person, which is the one input this method needs that no amount of compute substitutes for. |
Keep in mind
Check yourself
Questions on Part 6
Question 1 of 5
Two competent people writing a grammar for English converge on the same one, as two people running byte pair encoding on one corpus do.
Try it with Botie
Build with Botie
Write and run Python