MNLP-L03: Morphology and Word Formation

In short

Word-level models learn meaning from context (embeddings, CBOW), but store move and moved as unrelated row numbers and have nothing for an unseen word such as hammered. So: where do words come from, and what is inside them?

Where words come from: Chinese, Japanese or Thai do not mark word boundaries, so they must be computed: greedily, by maximum matching against a dictionary, or statistically, by tagging each character Begin, Middle, End or Single with an HMM decoded by Viterbi.

What is inside them: morphemes, combined by inflection, derivation and compounding, and packaged in four ways: isolating, agglutinative, fusional, polysynthetic. In rich languages one lemma has thousands of forms, so a fixed word vocabulary explodes or maps much of the language to <unk>. The practical fix is subword tokenization (next lecture).

The sample exam has no question on this lecture; expect statements on maximum matching, BMES tagging with HMMs, inflection against derivation, and the four morphological types.

Vocabularies, lexicons and dictionaries

Assume for now that words are given: separated by white space (after splitting off punctuation), or produced by word segmentation (also called tokenization) for languages that do not mark word boundaries (Chinese, Thai). Collect every word in a tokenized corpus and you have a vocabulary.

Vocabulary, lexicon, dictionary

  • A vocabulary is the inventory of words in a language (or a corpus, or known to a person): a list of forms.
  • A lexicon stores the meanings and functions of words.
  • A dictionary is a written (published or digital) version of a lexicon.

Should an NLP vocabulary contain typos, rare words, all variants (book, books, booking, booked) or just book? Be language-specific, or limited in size? There is no clean answer, and these are mostly questions about morphology (how words are built from smaller meaningful parts).

Word meaning from context: embeddings and CBOW

Word meaning is classically defined through relations: synonyms (purchase :: acquire), hyponyms (car :: vehicle, is-a), meronyms (wheel :: car, part-whole), antonyms (small :: large). These need hand-crafted resources such as WordNet, which are expensive, incomplete and language-specific. The alternative is to learn relations automatically and quantify them: .

Word embeddings

Distributed representations of words as vectors that are

  • low dimensional (e.g. 512, against a vocabulary size in the hundreds of thousands),
  • dense (no zeros, unlike a one-hot vector),
  • continuous (, where is the vector for word and its dimension),
  • learned by performing a task (a prediction task).

The best-known older method is Word2Vec, with two variants: Continuous Bag of Words (CBOW), described here, and Skip-Gram, which does the reverse (predicts each context word from the centre word; see L05).

The CBOW task

Given a position in a sentence, the words to its left and the words to its right , predict the word at position : the man X the road, with X = ?

With this would be an ordinary language model: predict the next word from the words before it. CBOW also sees the words after the gap, because it is not trying to be a language model; prediction is only the means of learning embeddings. Hence a simple feed-forward network with three layers: the input layer takes the context words, the projection layer looks up each word’s embedding and sums them (the formula in MNLP-L05 - Static Embeddings divides the sum by the number of context words, so it is the average; either way, word order is lost), and the output layer (a softmax over the vocabulary) predicts the centre word. There is no non-linear hidden layer: the embedding layer sits right next to the output, so the embeddings do most of the work. Typically , with .

A sum ignores order, so the man X the road and road the X man the give the same projection: the context is a bag of words, hence the name.

The fixed vocabulary and the <unk> token

In neural models every weight matrix has a fixed size, including the input embeddings and the output layer, and the output layer (one row per vocabulary word, a softmax over at every position) contributes much of the memory footprint. Realistic vocabularies are large: a Russian one is about five times the size of an English one, because Russian inflects far more, for example marking case (the noun’s role in the sentence: subject, object, instrument) on every noun.

Short-list

The quick fix: ignore rare words and keep only the most frequent words. Every rare word is mapped to one special token, <unk>. Typical sizes run from about ten thousand to a couple of hundred thousand words.

The disadvantage: all rare words receive equal probability in a given context, because they are the same token: in She ___ the nail, hammered and doomscrolled are both <unk>.

What context cannot give you

From She moved the desk into her office and He moved the table into the office, embedding models learn that desk and table occur in similar contexts, though internally both are just indices. But move (2863) and moved (87542) are also unrelated indices, so each such pair must be learned separately from data, and an unseen word such as hammered gets nothing.

Why morphology matters for unseen words

Word-internal structure (morphology) can help induce meaning for unseen words: knowing hammered = hammer + -ed, a model could build a representation from a known stem and suffix. A word-level index throws that structure away.

Before looking inside words, there is a prior question: where the words are.

Word boundaries and subword units

For languages with spaces around words, splitting text into words is easy, with exceptions (Mr. Smith should not become Mr . Smith). Two different problems remain:

  • No word boundaries in the script (Chinese, Japanese, Thai, Burmese): boundaries must be established before any further processing. This is word segmentation or tokenization, covered below.
  • Morphologically rich languages blow up fixed vocabularies with huge numbers of inflected forms. Splitting already delimited words into smaller units is sub-word segmentation.

Word segmentation must happen before part-of-speech (POS) tagging, parsing or anything else, and is a task in its own right (benchmarked in the SIGHAN bake-offs). It is not trivial, because one string often has more than one valid segmentation:

One string, two readings

研究生活动

  • 研究生 | 活动: “graduate-student activities”
  • 研究 | 生活 | 动: “research on life activities”

A string of characters has gaps, each a boundary or not, so the space of segmentations is huge:

Only a few are valid, and checking all is out of the question. Approaches are rule-based or data-driven (statistical).

Rule-based segmentation: maximum matching

Given a pre-compiled vocabulary of known words, walk through the string and at each position take the longest known word. Greedy, simple and a surprisingly strong baseline, still used for preprocessing or as a fast fallback. It runs in either direction, Forward Maximum Matching (FMM, left to right) or Backward Maximum Matching (BMM, right to left), and the two often disagree on ambiguous strings.

Forward Maximum Matching (FMM)
────────────────────────────────────
Input:  string S, vocabulary V,
        max word length L
Output: list of words
 
i ← 0
output ← []
while i < length(S):
    // longest candidate first
    for l ← min(L, length(S) − i) down to 1:
        w ← S[i : i+l]
        // one char is always accepted
        if w ∈ V or l == 1:
            append w to output
            i ← i + l
            break
return output

The inner loop counts down, so the first hit is the longest match. The or l == 1 clause accepts a single character even if it is not in , so the scan always terminates; it is also where unknown words end up, chopped into single characters. Cost: dictionary lookups.

Backward Maximum Matching (BMM)
────────────────────────────────────
Input:  string S, vocabulary V,
        max word length L
Output: list of words
 
i ← length(S)
output ← []
while i > 0:
    for l ← min(L, i) down to 1:
        // substring ending at i
        w ← S[i−l : i]
        if w ∈ V or l == 1:
            // prepend keeps reading order
            prepend w to output
            i ← i − l
            break
return output

BMM mirrors FMM: start at the end, take the substring ending at , prepend each word.

FMM and BMM on 研究生活, with = {研究, 研究生, 生活, 生, 活} and

FMM. At : 研究生活 is not in ; 研究生 (3 characters) is, so emit it. At : 活 is in . Result: 研究生 | 活.

BMM. At : 研究生活 and 究生活 are not in ; 生活 (2 characters) is, so prepend it. At : 研究 is in . Result: 研究 | 生活.

Same string, same dictionary, different answers: the string is ambiguous, and each greedy scan commits to one reading.

Bidirectional matching runs both. If they agree, accept the result with high confidence. If they disagree, apply a tie-breaking heuristic; two common choices, each used on its own, are fewer total words and fewer single-character words (proxies for less fragmentation). On the example the fewer-words rule cannot decide (two words each); the fewer-single-characters rule picks BMM’s 研究 | 生活 (none) over FMM’s 研究生 | 活 (one).

Limits of maximum matching (bidirectional included)

  • It assumes a precompiled vocabulary, which is labour-intensive to compile with good coverage. Genuinely new words (names, typos) cannot be matched at all, and they break silently: chopped into single characters or greedily mismatched, with nothing in the output to flag it.
  • No mechanism to exploit data: more text does not make it better. This motivates statistical methods.
  • The ambiguity is in the language itself: some strings have several correct segmentations depending on meaning and context, so no direction-based rule is right in general.

Statistical segmentation: tagging characters with BMES

The statistical move: instead of asking where to cut, ask what role each character plays in its word.

BMES tags

  • B (Begin): first character of a multi-character word
  • M (Middle): interior character of a word with 3 or more characters
  • E (End): last character of a multi-character word
  • S (Single): a character that is a complete one-character word by itself

Once every character has a label, the segmentation falls out: insert a word boundary after every E and every S.

For illustration, 研/B 究/E 生/S 活/S gives 研究 | 生 | 活, and 研/B 究/E 生/B 活/E gives BMM’s 研究 | 生活. Segmentation is now ordinary sequence labelling, solvable by any sequence labelling method.

The HMM

A hidden Markov model (HMM) assumes that a hidden sequence of tags (B/M/E/S) generated the observed sequence of characters. Its parameters:

  • Transition probabilities : how likely one tag follows another (tag bigrams).
  • Emission probabilities : how likely a tag “produces” a given character, the character given the tag. For example, is much larger than , since 究 usually closes 研究. (“究 is usually tagged E” would be the reverse, .)

The tag definitions rule out half of the 16 possible transitions, and training on segmented text learns these zeros from the counts. After B or M you are inside a word, so only M or E can follow (B is never followed by B or S). After E or S a word has just ended, so only B or S can follow. (Outside the course material, by the same logic: the first tag can only be B or S, the last only E or S.)

The best tag sequence for characters is

where is the -th character, its tag, a sentence-start symbol, a transition and an emission probability.

Training ideally uses labelled data, a segmented corpus, and estimates the probabilities from counts (simple maximum likelihood estimates):

where counts occurrences in the tagged corpus. Inference: given an unsegmented string, find the most probable tag sequence.

Viterbi decoding

Scoring every labelling is intractable: with tags there are sequences. The Viterbi algorithm uses dynamic programming (storing intermediate results instead of recomputing them). Cell holds the probability of the best path that ends at position with tag :

where ranges over the tags at position . The best path to passes through some tag at , and only the best path into that tag can be part of it, so each cell compares just four candidates. Backpointers record which won, so the path is recovered at the end without recomputing it.

Viterbi decoding for BMES tags
────────────────────────────────────
Input:  characters c_1..c_n
        tags T = {B, M, E, S}
        transitions P(t | t')
        emissions P(c | t)
        start symbol <s>
Output: best tags t_1..t_n
 
for each tag t in T:
    score[1][t] ← P(t|<s>) × P(c_1|t)
for i ← 2 to n:
    for each tag t in T:
        score[i][t] ← max over t' of
            score[i−1][t'] × P(t|t')
              × P(c_i|t)
        // backpointer
        back[i][t] ← the best t'
// a word must be closed at the end
t_n ← argmax over t in {E, S}
          of score[n][t]
// backtrace
for i ← n down to 2:
    t_{i−1} ← back[i][t_i]
return t_1..t_n

(Restricting the final tag to E or S is from outside the course material; without it the path could end mid-word.)

Complexity: : at each of positions, each of tags compares predecessors. With four tags that is 16 per character, linear in sentence length, against for brute force.

What the HMM gains, and what it still lacks

Advantages over FMM and BMM:

  • No fixed dictionary of possible words is required: the model works on characters, so an unseen word is just a character sequence with a plausible tag path.
  • Ambiguity is resolved with probabilistic evidence instead of tie-breaking heuristics.
  • Trainable directly from any segmented corpus, even one from a different domain.

Shortcomings:

  • Narrow Markov assumption. In a first-order HMM each tag is generated from the preceding tag alone, and each character from its own tag. Put the other way round, as the course does: a tag depends only on the immediately preceding tag and the current character. Higher orders are possible but more involved (outside the course material: transition parameters grow as for order ).
  • No longer-range context, such as the word two positions back or a whole phrase. This motivates conditional random fields (CRFs), which can condition on features of the whole input, and beyond them any neural sequence labeller (LSTM, Transformer).
  • Unsupervised training costs quality. HMMs can be trained fully unsupervised with Baum-Welch (an instance of EM), but quality drops.

What happens inside a word: inflection, derivation, compounding

A word’s core meaning sits in its stem, root or lemma, which this course treats as one idea. Strictly (outside the course material), the root is the core morpheme, the stem is what inflections attach to, and the lemma is the dictionary form standing for all inflected forms (see for saw, seen). Three processes build words.

Inflection makes another form of the same word: see, saw (tense), book, books (number). Derivation makes a new word: happy → happiness (noun), happily (adverb) changes the POS, while function → disfunction (standard spelling dysfunction) and perfect → imperfect change only the meaning. Compounding joins words, and not only nouns: German Tisch + Bein = Tischbein (noun + noun, table leg), sicher + gehen = sichergehen (adjective + verb, sure + go, “make sure”).

The three processes

  • Inflection: retains the POS, but changes features such as number and tense.
  • Derivation: changes the POS and/or the meaning.
  • Compounding: combines several words into one word.

These processes are very productive: they apply iteratively and in new combinations, which leads to a large increase in vocabulary size. doomscrolling, doomscrolled, doomscrolls, doomscroller is a recent compound already carrying inflection (-ing, -ed, -s) and derivation (-er), so no fixed vocabulary is ever complete.

Inflection in English and elsewhere

English inflects little. A verb has five forms: present (see), simple past (saw), past participle (seen), present participle (seeing) and 3rd person singular (sees). Regular verbs use one form for both the simple past and the past participle (called). Nouns inflect only for number (book, books); case survives only on pronouns (he, him, his, them, their).

Many languages inflect far more. Russian has more cases and marks them on all nouns. German marks mood (fact, hypothetical or command): kommt (indicative), käme (subjunctive), komm (imperative). Slavic languages (Russian, Czech, Polish) mark aspect: Russian sdelat’ (perfective, completed) against delat’ (imperfective, ongoing). Features are independent slots, so forms per word multiply (number times case times possessive marking such as Turkish -iniz “your”): that is how one lemma reaches thousands of forms.

Derivation in English

By what the affix does:

  • Nominalization (makes a noun): derive + -ation, kill + -er, happy + -ness.
  • Adjectivization (makes an adjective): account + -able, colony + -al = colonial, office + -al = official.
  • Negation (changes meaning, keeps POS): un- (unseen), mis- (misjudge), dis- (disfunctional), im- (implausible), in- (indifferent).

colonial and official show that spelling can change where morphemes meet.

Morphemes and affixes

Morpheme

The smallest meaning-carrying parts of words.

disproportionally = dis + proportion + al + ly = prefix + stem + suffix + suffix

  • A root is a free morpheme (it can stand alone as a word) that determines the basic meaning of a word: proportion. (The course’s definition; it fits English, but the Arabic root k-t-b below never stands alone.)
  • An affix is a bound morpheme (it cannot stand alone) attached to change meaning or grammatical function: dis-, -al, -ly.

Affixes by position:

  • Prefix: attaches to the front. English words mostly have only one.
  • Suffix: attaches to the end. There can be more than one (-al, -ly).
  • Infix: inserted in the middle: passerby → passersby. More common in other languages.
  • Circumfix: attaches to front and back simultaneously: German ge-seh-en (past participle of sehen, “see”). ge- and -en are one morpheme, so neither half can be stripped on its own.

All of these are concatenative: the word is a sequence of morphemes. Non-concatenative morphology changes the root itself, as in apophony, a vowel change in the stem: German Buch → Bücher (book, books), Haus → Häuser. No cut in Bücher separates “book” from “plural”. Any method that cuts strings into contiguous pieces, from maximum matching to subword tokenization, can only fully capture the concatenative case.

Morphological types: how languages package morphemes

Morphological typology

  • Isolating (Chinese, Vietnamese): words tend not to change form at all; grammatical relations come from word order; particles express additional modification.
  • Agglutinative (Turkish, Finnish): words are built by stringing morphemes together (potentially with character modifications); each morpheme contributes one clear piece of meaning.
  • Fusional (Russian, Spanish, Arabic): a single suffix simultaneously encodes several grammatical features that often cannot be cleanly separated.
  • Polysynthetic (Inuktitut, Mohawk): multiple grammatical roles (verb, subject, object) and various modifiers (negation, tense, mood, instrument, location) are fused or agglutinated into a single word.

Isolating. Chinese 我 昨天 看 了 一 本 书, “I read a book yesterday” (I, yesterday, read, PFV, one, CL, book): the verb 看 (kàn) never changes form; pastness comes from 昨天 “yesterday” and the perfective particle 了 (PFV, completed action); 本 is a classifier (CL). Word order is plain SVO (subject, verb, object). Vietnamese Tôi đã đi học, “I went to study”: đi (go) and học (study) do not change; đã is a past (completed-action) particle.

Agglutinative. Turkish evlerinizden, “from your houses” = ev-ler-iniz-den = house + plural + your + from. Finnish taloissamme, “in our houses” = talo-i-ssa-mme = house + plural + inessive + our. The inessive is a locative case (“in”). Each suffix is clearly separable and reusable across many other nouns. A suffix may change its spelling to fit the stem, but the meanings still split cleanly even when the characters at the join vary.

Fusional. Russian knigami, “with books” = knig-ami, glossed book + instrumental.plural.feminine: one suffix fuses case, number and gender into a single unsegmentable morpheme. This is the course’s gloss; answer by it. (Outside the course material: -ami is used for all three genders, so strictly it fuses only case and number.)

Spanish hablé, “I spoke” = habl-é: the single vowel -é fuses person (1st), number (singular), tense (preterite, past) and aspect (preterite, completed).

Arabic yaktubu, “he writes”: the consonant root k-t-b (C1 C2 C3, “write”) is poured into the pattern ya-C1C2-u-C3-u, which fuses person (3rd), gender (masculine) and aspect (not completed). The vowels are not written in regular Arabic, so part of the grammar is missing from the string; and since root and pattern interleave, the word is non-concatenative.

Polysynthetic. Inuktitut Qangatasuukkuvimmuuriaqalaaqtunga, “I will have to go to the airport” = qangata- (fly) + -suukkuvik (-suu- “habitually” + -kkuvik “place”: the place of habitual flying, the airport) + -mut (to, allative case) + -uq- (go to) + -riaqaq- (have to) + -laaq- (future) + -tunga (1st person singular). One word holds a whole English sentence: verb, subject, object (here the destination), tense and modal meaning, all fused together. The morphemes also change shape where they meet (-k-mut-uq becomes -mmuu-), so cutting the string cannot recover them. (Outside the course material: they stay in sequence, so this is concatenative morphology with blurred joins.)

typemorphemes per wordone feature per affix?examples
Isolatingabout onenothing to splitChinese, Vietnamese
Agglutinativemanyyes, separableTurkish, Finnish
Fusionalfewno, fusedRussian, Spanish, Arabic
Polysyntheticvery manyfused or agglutinatedInuktitut, Mohawk

(Outside the course material: isolating and polysynthetic are the two ends of a scale of how much meaning one word carries.)

Agglutinative against fusional

Both put several features into one word through affixes. The defining difference is separability: Turkish -ler is plural and nothing else; Spanish -é is person, number, tense and aspect at once, with no part meaning any one of them. Agglutinative words do tend to have more morphemes per word (ev-ler-iniz-den has four, knig-ami two), because each feature gets its own morpheme; that follows from separability, which is the definition.

Why word-level vocabularies break

Morphology is common to most languages, and rich morphology encodes inside one word what English spreads over separate words and word order: Turkish evlerinizden and “from your houses” carry the same information.

Word-level vocabularies blow up or become extremely restrictive. A single lemma can surface as thousands of word forms (surface forms). Keep them all and , with the embedding matrix and output softmax, explodes. Keep a fixed vocabulary sized for English and other languages get massive out-of-vocabulary (OOV) rates, every unknown form becoming <unk>. A vocabulary shared across languages spreads its fixed budget thinner, and the rich languages, with the most forms, suffer most.

These problems are the main motivation for morphological analysers (tools that split words into morphemes). But morphological analysis is highly language dependent, so each language needs its own, built with linguistic expertise. Modern approaches build on data-driven methods, and the practical compromise is subword tokenization: statistically useful pieces learned from data, language-independently, instead of linguistically correct morphemes. Falling back to single characters leaves very few words out of vocabulary, though not zero: a character never seen in training stays unknown, and only byte-level vocabularies remove that. Rich languages still get split into many more pieces per word than English, and the pieces only sometimes line up with morphemes (they cannot capture Bücher or Arabic root-and-pattern words). That is L04.

What to be able to answer

  • The four properties of word embeddings; CBOW’s task, layers and why it is a “bag”.
  • What a short-list does, and why all rare words then get equal probability.
  • Word segmentation against subword segmentation, and which languages need which.
  • FMM and BMM by hand; the two tie-breaking heuristics; the limits of maximum matching.
  • BMES tags and impossible transitions; emission direction ; the Viterbi recursion, backpointers and ; what HMMs gain and lack.
  • Inflection, derivation, compounding; productivity; free and bound morphemes; affix types; apophony.
  • The four morphological types with example languages and words; agglutinative against fusional (separability defines it; more morphemes per word follows).
  • Why fixed word vocabularies fail for rich languages, and why subword tokenization is the compromise (very low OOV, not zero).

Model answers are in the exam questions below.

Exam questions

Flashcards