Lexical Semantics and Word Senses
Explore lexical semantics, word senses, polysemy, WordNet, and word-sense disambiguation methods, with practical evaluation guidance for language AI systems.
Language AI HandbookAll chapters Lexical Semantics and Word SensesFull chapter · Sections in this chapter1 / 11 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Lexical Semantics and Word Senses
Consider the word bank. In "She deposited her paycheck at the bank," the intended reading is a financial institution. In "The fisherman sat on the bank of the river," it names the sloping ground beside water. In "The pilot had to bank the aircraft," the verb means to tilt the aircraft laterally. The spelling is identical. The meanings are not. The examples differ in grammar and context as well as interpretation.
Lexical semantics studies how word forms relate to meanings and how those meanings relate to one another. One form can carry several meanings, and different forms can express similar meanings. Metaphor, metonymy, and specialization provide some recurring ways to relate usages. The bank examples make the distinction concrete: recognizing the spelling alone leaves the contextual choice unresolved.
Word-sense disambiguation, or WSD, is the task of assigning the intended sense to a word in context. It is one of the oldest problems in natural language processing, and one of the most instructive. WSD forces us to confront questions that recur throughout language AI:
- What counts as a meaning, and who decides?
- How fine-grained should semantic distinctions be?
- How much can context resolve, and where does world knowledge take over?
- How do we evaluate a semantic decision when annotators themselves disagree?
- When does an explicit sense label help an application, and when is it an unnecessary intermediate step?
These questions connect directly to material you have already seen. The distributional hypothesis gives us a way to represent meaning through context, but it also shows why distributional similarity is not the same as synonymy. TF-IDF and word embeddings give us vector representations, but a static embedding lookup assigns the same vector to each occurrence of a word type, so the lookup alone does not distinguish its contextual senses. Subword tokenization, sequence labeling, and contextual transformers all become relevant when we try to build sense-aware systems. A word tokenizer segments text into word occurrences. A subword tokenizer may split an occurrence into several pieces, which must be aligned back to the target word for WSD. A sequence labeler shows how labels can be assigned to individual tokens. A contextual transformer shows how the representation of a token can depend on the whole sentence. Each of these ideas prepares us to ask a more precise question: when a token appears in context, which conventionalized meaning should we associate with it?
This chapter builds the conceptual and practical foundation for lexical semantics in language AI. We start with the basic units: word forms, lemmas, lexemes, and senses. We then examine polysemy, synonymy, and other lexical relations. Next we survey lexical resources, especially WordNet, and the design choices that make sense inventories both useful and contentious. We formalize WSD and study knowledge-based, supervised, and contextual approaches. A worked example and a small implementation show how the pieces fit together. We close with limitations and the practical role of lexical semantics in modern systems. The goal throughout is not only to define terms, but to show why each distinction matters when you build, evaluate, or interpret a language AI system.
Words, Senses, and Lexemes
Before we can disambiguate a word, we need to distinguish its spelling and pronunciation from its grammatical analysis, lexical entry, and meaning in context. In NLP these distinctions need explicit terms. This need for precision is not terminological fussiness. Every stage of a pipeline makes a commitment about which object it is manipulating. If a tokenizer emits the string banked and a lemmatizer maps it to bank, the system has moved from a word form to a lemma. If a sense inventory then offers five noun senses and three verb senses for bank, the system must decide which part of speech and which sense are relevant. Confusing these levels leads to evaluation errors, annotation errors, and misleading claims about model performance.
A word form is a specific surface realization of a word: the string of characters or the sequence of phonemes that appears in text or speech. Bank, banks, and banked are three different word forms.
A lexeme is an abstract unit of the lexicon. It has a lexical meaning or a grammatical function and is realized by one or more word forms. The verb lexeme BANK covers bank, banks, banked, and banking when those forms share the relevant lexical content; the noun has its own paradigm. A lexeme is what a dictionary headword usually represents.
A lemma is the canonical form used to index a lexeme. For the lexeme that includes running, runs, and ran, the lemma is run. Lemmatization maps word forms to lemmas.
A word sense is a conventionalized meaning associated with a lexical expression. WSD inventories can list distinct homonyms under the same lemma spelling: the financial and riverbank meanings of bank are separate candidates even when a linguistic analysis treats them as different lexemes. A sense is a lexical construct, not a natural object with a single correct boundary.
Keep these levels separate when you build or evaluate an NLP pipeline. A tokenizer produces tokens. A lemmatizer maps tokens to lemmas. A sense inventory maps lemmas to senses. A WSD system maps a token in context to one of those senses. If we confuse tokens with lemmas or lemmas with senses, our evaluation and our error analysis become muddled. For example, a system that reports "accuracy on the word bank" without saying whether it evaluated noun senses only, verb senses only, or all parts of speech has reported a number whose meaning is unclear. A system that evaluates on lemmas but claims to have evaluated word forms has misdescribed its task. A system that uses one version of WordNet but compares its score to a paper that used another version may be making an invalid comparison. Precision about lexical units is therefore a prerequisite for precision about results.
The word bank illustrates the point. The string bank is a word form. The lemma spelling bank can index several lexemes and their senses. The inventory supplies the candidates, and a part-of-speech tag can narrow the list. The token bank in a particular sentence is one occurrence. The notebook uses depository_financial_institution.n.01 to identify the financial reading. None of these is the same object. The token is an event in a text. The word form is a type of surface realization. The lemma is an index. The sense is a conventional meaning. Inventory-based WSD assigns a sense from the declared inventory to a word occurrence in context.
Polysemy
Polysemy is the association of one lexeme with multiple related senses. Some relationships recur across words: an institution and its building, a container and its contents, or an animal and its meat. Others are less regular. These patterns help describe how usages are related; the examples alone do not explain why particular common words acquired their present number of senses.
The wider family of related meanings of the form run spans verb and noun uses. These are related lexical uses, not one inflectional paradigm:
- to move quickly on foot ("she ran to the station")
- to operate or manage ("he runs a small company")
- to flow ("the river runs north")
- to function ("the engine runs smoothly")
- to stand as a candidate ("she is running for office")
- a continuous period ("a run of good luck")
- an unraveling of stitches in stockings ("a run in her tights")
- a baseball score ("the team scored two runs")
These uses can be related conceptually through motion, continued activity, or progress. The candidacy use fits a race metaphor, while a stocking run involves successive stitches coming undone. These are ways to interpret present-day relationships, not proof of a single historical development for every sense. Cross-category relations and uncertain historical pathways also show why a broad family of meanings should not be confused with one lexeme's inflectional forms.
Polysemy often follows regular patterns. These patterns are productive, and speakers apply them to new words without explicit instruction:
- Animal and meat: chicken, lamb, turkey
- Container and contents: bottle, can, glass
- Institution and building: school, bank, church
- Creator and work: Dickens in "I am reading Dickens"
- Count and mass: beer ("a beer" versus "some beer"), paper
- Physical object and information: book, magazine, DVD
Regular polysemy is a challenge for sense inventories because it produces an open-ended set of uses. A dictionary cannot list every possible metonymic extension. A WSD system trained on a fixed inventory may encounter a use that fits no listed sense, or it may be forced to choose between two senses that are really the same underlying concept. For example, if a newspaper reports that "the newspaper fired its editor," this occurrence of newspaper selects the publishing organization: an organization can fire an editor. Other sentences can select the publication or the physical copy. A fine-grained inventory might list these as separate senses. A coarse inventory might merge them. Interpreting the organization reading is different from naming its sense in a particular inventory. When a system's output contract requires a single inventory label, it must make that discrete choice. This mismatch between natural understanding and forced-choice labeling is one of the recurring tensions in WSD.
Polysemous uses need not always force an exclusive choice. In "The book is heavy but interesting," heavy describes the physical object while interesting describes its content. Both aspects are available in the same sentence. This is a different example from "The bank raised its rates," which selects the institution reading and does not by itself show simultaneous use of a building sense. A discrete WSD label can be useful while still leaving such related aspects implicit.
Several kinds of evidence can help distinguish homonymy from polysemy.
- Etymology: Different historical origins can support a homonymy analysis.
- Relatedness: Perceived relatedness can support a polysemy analysis.
- Zeugma: Forcing two readings into one coordination can sound odd. "The bank was steep and charged high fees" is zeugmatic, which suggests distinct senses.
- Translation: Different conventional translations can suggest a distinction useful for a bilingual task. Languages divide meaning differently, so translation alone does not establish a sense boundary.
- Distribution: Different collocational patterns can supply evidence for a sense distinction.
Zeugma is a useful intuition pump, but it is not a reliable linguistic test. Some polysemous senses also produce zeugmatic sentences, and some homonyms can be coerced into puns. Lexicographers can use different criteria to separate homonyms from polysemous senses. If you are building a WSD system, you should not assume that the inventory's decision matches a theoretical truth. You should ask instead whether the distinction is useful for your task and whether annotators can apply it consistently.
Homonymy
Homonymy is the association of one form with unrelated meanings. Bank in the financial sense and bank in the river sense are classic homonyms. Their immediate histories differ: the financial word came through Middle French banque or Old Italian banca, which literally meant bench. Merriam-Webster describes the river word as probably Scandinavian and akin to Old Norse bakki. These qualified histories should not be turned into a certain direct derivation or a claim that the forms have no more distant common ancestry. Bat (the animal) and bat (the club) are homonyms. Bass (the fish) and bass (the low sound) are homonyms, and they are also homographs, since they are spelled the same but pronounced differently. Homonymy can involve homographs, which share spelling, homophones, which share pronunciation, or both. Sea and see are homophones but not homographs. Bank financial and bank river are homographs and homophones in their shared spelling and pronunciation, while their meanings are conventionally treated as unrelated.
Judgments of semantic relatedness can be graded. Carston's (2021) review describes relatedness ratings ranging from low-relatedness homonyms to highly related metonymic senses. In a dictionary, homonyms usually get separate headwords, while polysemous senses are grouped under one headword. In WordNet, both are represented as separate synsets, so the distinction is not always visible from the resource alone. For WSD, the practical question is whether the senses are distinct enough that a context model should choose between them. Two senses may be historically unrelated but functionally close in a particular domain, or historically related but functionally distinct in a task. The inventory designer must decide which difference matters for the intended use.
The distinction matters for lexicon design and for evaluation. If two senses are historically unrelated but cognitively close in a particular domain, annotators may struggle to label them consistently. If two senses are historically related but functionally distinct in a task, a coarse inventory may merge them and lose information the application needs. A machine translation system, for example, may need to distinguish two related senses if they translate differently. A sentiment system may not need the distinction if both senses carry the same polarity. The right granularity should therefore be chosen for the task.
Synonymy and Near-Synonymy
Synonymy is equivalence of lexical meaning at a stated sense and granularity. Absolute synonyms would preserve meaning and communicative effect across the relevant contexts. Matching the referent in one sentence is not enough: the winner and my neighbor can denote the same person without being synonyms. Edmonds and Hirst (2002) describe absolute synonymy as rare. Near-synonyms can differ in register, connotation, collocation, or syntactic frame. The practical consequence is that a thesaurus entry is not a license to substitute freely. A substitution that preserves truth conditions may still change tone, imply a different social relationship, or sound unnatural. Natural language generation systems that ignore these differences produce text that is grammatically correct but pragmatically awkward.
Consider buy and purchase. Both describe acquiring something for money, but purchase is more formal and has documented commercial uses. "She purchased a used bicycle" sounds slightly stilted. "She bought a used bicycle" is neutral. Even idiomatic patterns need checking rather than absolute substitution rules: buy time is conventional, but purchase time can also be used figuratively. In the shared acquisition sense, replacing buy with purchase can make an ordinary sentence sound formal. A machine translation system that ignores the difference may choose a word that is too formal for the surrounding sentence.
Consider big and large. In "a big house" and "a large house," both adjectives can describe the house's physical size. "Big brother" can mean an older brother; "large brother" describes size instead. This does not mean that large lacks figurative or evaluative uses: a person can have a large influence. A generator that treats the two adjectives as interchangeable can produce unnatural text. These differences are not captured by a simple list of synonyms. They are captured by distributional patterns, collocations, and pragmatic knowledge about how speakers use the words in specific situations.
The distributional hypothesis explains why this is difficult. The hypothesis motivates giving similar representations to words used in similar contexts; the resulting vector similarities depend on the corpus, representation, training objective, and similarity measure. But similarity is not identity. Both hot and cold fit the frame “The water was ___,” even though they express opposite ends of the temperature scale. Grave’s 2014 thesis lists both buy and sell among the neighbors of purchase in its distributional thesaurus (Table 2.5). Such vector similarity can reflect relatedness without establishing synonymy. Synonymy requires an additional claim about meaning, and that claim is context-sensitive. Vector similarity can provide evidence of comparable usage environments when the representation and comparison preserve similarities in how words are used. It does not tell us that they are interchangeable in a particular sentence. For that, we need a theory of semantic equivalence, or at least a task-specific criterion for when a substitution is acceptable.
WordNet handles synonymy by fiat. A synset is a set of words that the lexicographers judged to be synonymous in at least one sense. The synset for the financial institution sense includes bank, depository financial institution, banking concern, and banking company. These are not interchangeable in every sentence, but they share a concept. The synset is a useful abstraction, not a claim of full substitutability. It groups words that can be used to express the same concept in some contexts, and it leaves the details of register and collocation to the user. This is a reasonable design choice for a lexical database, but it means that a synset should not be treated as a set of perfect synonyms.
Lexical overlap depends on the sense and context. In some medical services, a client is someone receiving care. A lawyer’s client is receiving legal services, which does not establish a medical role. Car and automobile overlap in everyday speech, but the Oxford Advanced Learner's Dictionary labels automobile North American English. A sense inventory must decide whether such differences are lexical senses or pragmatic nuances. If every register difference became a separate sense, the inventory would explode. If no register difference were represented, applications that need stylistic control would lose information. The design choice depends on the intended use of the inventory and on the level of granularity that annotators can apply reliably.
Other Lexical Relations
Synonymy and polysemy are only part of the lexical semantic network. Several other relations appear repeatedly in lexical resources and in downstream inference. These relations are useful because they turn a flat list of senses into a structured graph. The graph supports reasoning, query expansion, and constraint propagation. It also gives WSD systems additional evidence: if a word is used in a particular sense, its neighbors may be constrained by lexical relations. A system that knows dog is a hyponym of animal can infer that a sentence about a dog is also about an animal. A system that knows wheel is a meronym of car can infer that a sentence about a wheel may be relevant to a car. These inferences are not always valid, but they provide useful soft evidence.
- Hyponymy and hypernymy: A hyponym is a more specific term; a hypernym is a more general term. Dog is a hyponym of animal. Car is a hyponym of vehicle. Hyponymy is transitive and supports inheritance: if every dog is an animal, and every animal is an organism, then every dog is an organism.
- Meronymy and holonymy: A meronym is a part, member, or substance of a holonym. Wheel is a part meronym of car. Tree is a member meronym of forest. For a car body made of steel, steel is a substance meronym of that body. The relation is not transitive in the same way as hyponymy.
- Antonymy: Antonyms are opposites. Gradable antonyms like hot and cold admit intermediate degrees. Within the ordinary life-status classification of an organism, alive and dead are complementary alternatives at a given time. Relational antonyms like buy and sell describe the same situation from opposite perspectives.
- Troponymy: A troponym is a manner-specific verb related to a more general verb. Walk is a troponym of move. March is a troponym of walk. WordNet uses troponymy to organize its verb hierarchies.
- Entailment: One predicate may entail another under specified sense and argument mappings. In the ordinary sleep sense, someone who snores is sleeping. WordNet lists buy and pay as an example of lexical entailment. Entailment is a relation between propositions, sometimes encoded between verb senses.
- Causation: A verb can encode causing an event. In its literal life-and-death sense, x kills y means that x causes y to die. Causation links selected verb senses with their argument roles; merely supplying food to someone does not guarantee that they eat it.
These relations form a graph over senses. The graph supports query expansion, textual inference, and lexical simplification. It also gives WSD systems additional evidence: if a word is used in a particular sense, its neighbors may be constrained by lexical relations. The graph is not a complete semantic theory. It is a practical representation that captures many useful regularities while leaving others implicit. A WSD system can use the graph as a source of features, a source of constraints, or a source of background knowledge. The quality of the graph matters, because errors in the relations propagate to the inferences. A missing hypernym link can prevent an inference. A spurious link can produce an incorrect inference. Lexical resources are therefore not neutral background data. They are structured knowledge with their own design choices and limitations.
Sense Inventories and Lexical Resources
A sense inventory is the label space for WSD. It lists the senses of each lemma. A resource may also supply definitions, examples, part-of-speech information, and relations to other senses. To specify a correct inventory label, first state the inventory and the labeling protocol. A WSD result is always relative to a particular inventory and version. This relativity is easy to forget. A paper may report "85% accuracy on WSD" without saying which inventory was used. A system may be deployed with a different inventory than the one used in training. A downstream application may expect a coarse distinction while the WSD system produces a fine-grained label. In each case, the inventory is not a detail. It is part of the definition of the task.
A sense inventory is a structured collection of word senses. For each lemma, it specifies the available senses. Records can also include definitions, examples, sense identifiers, part-of-speech tags, and semantic relations. WordNet, OntoNotes, and BabelNet are different sense inventories, and their senses do not map to one another one-to-one.
Design Choices
Several choices shape a sense inventory:
- Granularity: Should bank have two senses, five senses, or ten? Fine-grained inventories distinguish subtle differences. Coarse-grained inventories merge related uses. Neither is universally correct.
- Part of speech: Are noun, verb, adjective, and adverb senses listed separately? WordNet does this. Check how another inventory groups its parts of speech before mapping its entries.
- Definitions and examples: Are senses defined by glosses, examples, relations, or all three? A short gloss may omit a word used in the target sentence. Adding an example gives a signature the vocabulary of that particular example.
- Relations: Does the inventory encode hypernymy, meronymy, antonymy, entailment, and domain information? Relations support inference and graph-based WSD.
- Identifiers: Are senses identified by names, offsets, keys, or URIs? Record the inventory version and the identifiers used so another reader can resolve the same senses.
- Language and domain: Is the inventory monolingual or multilingual? General-purpose or domain-specific? A biomedical inventory can distinguish senses that a general dictionary ignores.
The lumping versus splitting debate concerns which uses receive separate labels. A splitter inventory gives each nuance its own label. A lumper inventory groups related uses under a broader sense. Finer distinctions can serve applications such as lexicography and translation, but some distinctions are difficult to annotate consistently. Merging difficult distinctions improved agreement in the documented OntoNotes work; a new grouping still needs its own reliability check and may discard distinctions an application needs. Changing the label space changes which predictions count as errors. For the same targets and predictions, mapping both predicted and gold labels through the same deterministic fine-to-coarse map cannot lower raw accuracy: every previously correct label remains correct. Any gain produced by that mapping does not show that the model can recover the merged fine distinctions. Report the inventory when comparing results.
Inter-annotator agreement helps assess how consistently a particular inventory and guideline set can be applied. It is not a universal WSD constant. For example, the SemEval-2007 Task 17 report reports 72% agreement for verbs and 86% for nouns in its fine-grained All-Words annotation using WordNet 2.1 senses. These values belong to that annotation protocol. Disagreement can reflect ambiguous contexts, difficult distinctions, or annotation errors, so it is useful to inspect disputed cases. Agreement between annotators does not impose a mathematical upper bound on a model's accuracy against an adjudicated gold set: a system could match that gold set perfectly even when the annotators initially disagreed.
WordNet
Princeton WordNet is a lexical database of English. It was developed at Princeton University under George A. Miller in the 1980s, motivated by psycholinguistic theories of lexical memory. The core idea is simple: organize the lexicon by concepts rather than by word forms. Instead of listing words alphabetically and attaching definitions, WordNet groups words into synsets and links those synsets through semantic relations. The result is a graph that reflects conceptual organization. A synset represents a concept. A lemma name may occur in multiple synsets representing distinct readings; those memberships alone do not classify the readings as homonymous or polysemous. A synset may list several lemma names for lexical senses that express the same concept, which is how WordNet represents synonymy.
A WordNet synset is a set of synonymous words that express a distinct concept. Each synset has:
- a unique identifier within a release, such as the displayed synset name
bank.n.01 - a part of speech
- a gloss, or short definition
- optional usage examples
- a list of lemma names
- zero or more pointers to related synsets
The pointers encode lexical and semantic relations. For nouns, the most important are hypernymy and hyponymy, which form a hierarchy. For verbs, WordNet includes troponymy, entailment, and cause. For adjectives, the structure is less hierarchical: adjectives are organized into clusters linked by similarity and relatedness. For all parts of speech, WordNet includes antonymy and various domain and usage pointers. The pointers are not decoration. They are the structure that makes WordNet useful for inference. A hypernym link lets a system generalize from a specific concept to a more general one. An antonym link lets a system recognize opposition. A meronym link lets a system relate a part to a whole. These links are imperfect, but they provide a rich source of background knowledge.
The financial sense of bank has a gloss like "a financial institution that accepts deposits and channels the money into lending activities." The riverbank sense has a gloss like "sloping land (especially the slope beside a body of water)." The two glosses explicitly contrast a financial institution with sloping land beside water. They are also the raw material for knowledge-based WSD. A Lesk-style system can compare the words in the sentence with the words in the gloss. A gloss vector system can compare the sentence vector with the gloss vector. A neural system can treat the gloss as a definition and learn to match contexts to definitions. In each case, the gloss is a bridge between the lexical resource and the computational model.
WordNet organizes senses by part of speech and assigns sense numbers. Its ordering uses sparse evidence from semantically tagged text; senses without such evidence can be ordered arbitrarily. The official FAQ cautions against treating that order as a reliable frequency ranking for research. The first listed sense is still a reproducible baseline once the resource version and candidate order are fixed, but it is a proxy for a most-frequent-sense baseline. A true training-corpus MFS baseline counts the senses of each lemma in the specified training data. Neither order nor training frequency guarantees the dominant sense in a new domain.
This notebook uses Princeton WordNet 3.0. Its official statistics list 117,659 synsets, 147,278 distinct strings across parts of speech, and 206,941 word-sense pairs. WordNet 3.1 is a later version, announced on the official web interface in June 2011. The evaluator checks the installed resource version before scoring the fixed WordNet 3.0 gold labels. The version matters because synset identifiers can change, and the same word can have a different number of listed senses. A system evaluated on one version may not reproduce on another. A paper that reports a WordNet-based score should therefore state the version. This is not a minor bibliographic detail. It is part of the experimental setup.
WordNet has limitations that matter for language AI:
- Coverage: Check the fixed release against the vocabulary of the intended domain. A lexical database is not an exhaustive named-entity catalog, and it may lack the sense needed by an application.
- Granularity: Some fine-grained distinctions are difficult to apply consistently and may not match the distinctions needed by a particular application. Different lexicographers might draw the boundaries differently.
- Adjectives: WordNet uses antonymy/similarity clusters. Check the available relation types rather than applying noun-style hypernym navigation to every adjective entry.
- Frequency estimates: The standard WordNet 3.0 counts pool tagged semantic concordances. These pooled counts are not a measurement of a new target corpus. Measure sense frequencies in the domain, genre, and period relevant to the application.
- Language scope: Princeton WordNet is English. The Open Multilingual WordNet and BabelNet document their own language coverage; check that coverage for the application.
Despite these limitations, WordNet remains a standard reference point. The NLTK interface used below lets us inspect its sense records and relations. It is also a useful teaching tool because its structure is transparent. You can inspect a synset, read its gloss, follow its hypernym links, and see how the lexicon is organized. This transparency makes WordNet a good starting point for understanding lexical semantics, even when a modern application uses a different resource.
FrameNet
FrameNet is based on frame semantics, which describes word meanings against background situations. A frame is a schematic situation with participants and props, called frame elements. A lexical unit pairs a word or phrase in one of its senses with a frame. Different lexical units can present a related situation from different perspectives, foregrounding different participants.
The Commerce_buy frame, for example, involves a Buyer, a Seller, Goods, and Money. The verbs buy and purchase present the transaction from the buyer's perspective; words such as sell and pay express related commerce perspectives. Lexical units evoke frames, while their arguments fill frame elements. FrameNet describes how these words combine with their arguments and what roles those arguments play. A sentence like "She bought a bicycle from him for two hundred dollars" evokes the frame with the Buyer as subject, the Goods as object, the Seller as source, and the Money as price. The frame provides a structured interpretation that goes beyond the dictionary sense of buy. It tells us which participants are expected and how they are typically expressed.
FrameNet organizes sense-specific lexical units through frames and records the syntactic patterns that express frame elements. Its coverage should be checked for the lexical units an application needs. The bicycle example separates frame selection from identifying the argument fillers. We will return to these ideas in the chapter on semantic roles and argument structure. For now, the important point is that lexical meaning is not only a matter of synonymy and hyponymy. It is also a matter of the frames and roles that words bring into a sentence. A WSD system that only predicts a synset may miss the relational structure that FrameNet captures. A frame-based system may capture that structure without assigning a WordNet sense. The two resources answer different questions, and they are useful in different ways.
OntoNotes and Coarser Inventories
OntoNotes is a large multilingual corpus with annotations for syntax, predicates, coreference, and word senses. The documented English sense inventory is coarser than WordNet's. The OntoNotes project grouped English WordNet senses into broader sense groups, reducing the number of distinctions and improving inter-annotator agreement. The coarsening is not a retreat from semantic precision. It is a practical response to the difficulty of annotating fine-grained distinctions consistently. Unresolved disagreement over a fine distinction can leave the supervisory label uncertain. A coarser inventory may lose some information, but it can produce cleaner supervision and more reliable evaluation.
OntoNotes should not be confused with the inventories used in later multilingual SemEval tasks. SemEval-2013 Task 12 used BabelNet 1.1.1 and allowed WordNet 3.0 and Wikipedia projections; SemEval-2015 Task 13 used BabelNet 2.5.1. These are not OntoNotes evaluations. More generally, a higher score on a coarser label space does not by itself establish better fine-grained discrimination: merging labels changes which predictions count as errors.
For English OntoNotes, the documented grouping procedure merges several fine WordNet senses into broader groups. Such coarsening loses information: a prediction of the group alone cannot identify which member fine sense was intended. The grouping description does not establish a reverse split of a single WordNet sense into several groups for the same lemma. A comparison across resources must state the mapping and its direction; mapping a fine label to a group and recovering a fine label from that group are different tasks.
BabelNet, Wiktionary, and Domain Resources
BabelNet is a large multilingual encyclopedic dictionary and semantic network. It combines WordNet, Wikipedia, Wiktionary, and other resources into multilingual synsets called BabelSynsets. A BabelSynset groups the available lexicalizations for a concept or named entity. Those lexicalizations can span languages. BabelNet is useful for multilingual WSD, cross-lingual transfer, and entity linking, but its automatically constructed lexicalizations can be imperfect. The automatic integration of resources makes BabelNet broad, but it also means that the quality of individual entries can vary. BabelSynsets can group cross-language word senses that are semantically equivalent or nearly equivalent. When using its translations, select the sense that fits the occurrence. BabelNet is therefore a powerful resource that requires careful validation for high-stakes applications.
Wiktionary is a crowdsourced dictionary with broad coverage of languages, dialects, slang, and technical terms. Its entries can include examples and translations. Compare dated snapshots when assessing coverage or currency; collaborative editing alone does not establish that every entry is newer or better than a fixed WordNet release. Wiktionary specifies a standard entry layout and permits discussed variations. For low-resource languages and neologisms, Wiktionary can fill gaps that WordNet leaves open. It is also a useful source of usage examples and translations. An extraction pipeline still needs to account for allowed structural variation and language-specific conventions. Formatting can be handled during extraction or by an upstream extractor. If an application interprets definitions, check how it treats full definitions, translation glosses, and non-gloss definitions. For sense prediction or translations aligned to individual senses, state which source distinctions are preserved and how differing granularities are mapped. The crowdsourced nature of Wiktionary is both its strength and its weakness: it captures living language, but it does not guarantee uniform quality.
Domain-specific resources organize terminology for particular fields. UMLS and SNOMED CT cover biomedical concepts; MeSH supports biomedical literature indexing. Their concept identifiers and subject headings serve different purposes from a general-purpose word-sense label. For a domain application, check which distinctions and output identifiers the task requires. If the selected inventory already represents those distinctions, changing the model or its training data may be sufficient.
The Inventory Mismatch Problem
A recurring practical problem is that different resources carve meaning differently. WordNet may distinguish ten senses of a word, OntoNotes may distinguish three, and a domain ontology may distinguish five completely different ones. A WSD system trained on one inventory cannot be evaluated directly on another without a mapping, and the mapping need not be one-to-one. The mismatch is not only a matter of counting senses. It is a matter of where the boundaries are drawn and which distinctions are treated as central. Two inventories may agree that a word has multiple meanings, but disagree about which meanings should be grouped together. Two inventories may use the same label for different concepts, or different labels for the same concept. The result is a translation problem between label spaces.
This has consequences for reproducibility and for claims about state-of-the-art performance. A score on SemEval-2015 is not comparable to a score on a WordNet-based lexical sample task unless the inventories and evaluation conditions match. When you read a WSD result, always ask:
- Which sense inventory was used?
- Which version of the inventory?
- Was the task lexical sample or all-words?
- Which parts of speech were evaluated?
- What was the most-frequent-sense baseline?
- How were multiword expressions and named entities handled?
These questions are not bureaucratic. They determine what the number means. A score without an inventory is like a distance without a unit. It may be numerically precise, but it is semantically incomplete. A careful evaluation reports the inventory, the version, the task variant, the baseline, and the handling of edge cases. A careful reader asks for those details before comparing systems.
Word-Sense Disambiguation
We can now state the WSD problem precisely. Given a token (w_i) with lemma (w), a context (c) aligned to that occurrence, and a sense inventory (\mathcal{S}_w = {s_1, \dots, s_k}) for (w), choose the intended sense. For this derivation, assume each occurrence has one adjudicated reference sense. Under 0–1 loss, matching that sense costs zero and each other prediction costs one. A sense with the largest posterior probability therefore minimizes expected loss.
where:
- (\hat{s}): the sense the system predicts for this occurrence. If several senses maximize the posterior, a fixed tie rule can select one.
- (\mathcal{S}_w): the set of candidate senses available for lemma (w) in the inventory
- (P(s \mid w, c)): the posterior probability that sense (s) is intended, given the lemma (w) and the context (c)
Assume a defined fixed-lemma model: (P(c\mid s,w)) denotes a context distribution specified for every candidate sense, including senses with zero prior probability. For a fixed lemma and observed context with (P(c \mid w)>0), conditional Bayes' rule gives:
where:
- (P(c \mid s, w)): the likelihood of observing context (c) given sense (s) and lemma (w)
- (P(s \mid w)): the prior probability of sense (s) for lemma (w), before conditioning on this context
- (P(c \mid w)): the probability of the context given the lemma, equal to (\sum_{s\in\mathcal S_w}P(c\mid s,w)P(s\mid w)) when the candidate senses are mutually exclusive and exhaustive
Since (P(c \mid w)) is the same for every candidate sense, the decision rule becomes:
The term (P(s \mid w)) is the sense prior. It describes the sense distribution for that lemma before the particular context is observed. The term (P(c \mid s, w)) is the context likelihood. It captures how well the surrounding words, syntax, and topic fit the sense. The decomposition is useful because it separates two sources of evidence: the sense prior and the fit of the observed context to each sense. The prior tells us what to expect before reading the context. The likelihood tells us how the context changes that expectation. When the prior comes from labeled training counts, choosing the sense with the largest prior gives a most-frequent-sense baseline. A system that only uses the likelihood ignores the fact that some senses are much more common than others. In this probabilistic model the posterior combines both terms. A discriminative WSD system can instead estimate the posterior directly, without separately estimating a prior and likelihood.
The toy uses three noun readings of bank as its entire candidate inventory. The Aviation class is the flight-maneuver reading. The calculation uses fixed priors and relative likelihood weights, rather than literal probabilities constrained to the inclusive interval [0, 1]. As the riverbank weight grows while the other two remain one, normalization gives a three-sense posterior. Its riverbank component rises even though the financial sense keeps the larger prior.
PythonIn [3]Expand
import numpy as np
senses = ["financial", "riverbank", "aviation"]
prior = np.array([0.60, 0.30, 0.10])
context_strengths = np.linspace(0.0, 2.0, 41)
river_likelihood = 1.0 + context_strengths
denominator = prior[0] + prior[1] * river_likelihood + prior[2]
posterior_financial = prior[0] / denominator
posterior_riverbank = (prior[1] * river_likelihood) / denominator
posterior_aviation = prior[2] / denominatorVisualizationOut [4]Expand

The decomposition also explains a frequency baseline. When every candidate has the same positive context likelihood, choosing a largest prior is the MAP decision. The actual accuracy of an MFS baseline is the fraction of test targets carrying the senses selected from the stated training data; it is not a fixed percentage. Report it on the same targets, parts of speech, and inventory as the evaluated system. A context-sensitive model can have lower aggregate accuracy yet help on a costly rare sense, so baseline comparisons should also reflect the application's error costs and sense-frequency groups.
WSD comes in several task variants:
- Lexical sample: The evaluation focuses on a fixed set of target words. The protocol specifies whether sense-tagged training data is supplied; a supervised system may use word-specific classifiers.
- All-words: Disambiguate the eligible annotated targets throughout a text, rather than a predefined lexical sample. The protocol determines the target parts of speech, inventory coverage, and any excluded uses.
- Domain-specific: The data, the sense inventory, or both focus on a domain such as biomedicine or law. A domain-text evaluation can still use a general-purpose inventory.
- Multilingual: The system disambiguates words across languages, for example using parallel corpora or multilingual encoders.
- Coarse-grained: The inventory merges fine distinctions. This reduces the label distinctions required, but annotation reliability and system performance still need measurement.
Lexical sample tasks are useful for controlled experiments. They allow researchers to focus on a small set of words with enough training data to support supervised learning. All-words evaluation samples eligible targets across documents and can expose words or senses absent from a lexical-sample training set. Whether it matches an application depends on the documents and target protocol. A system that performs well on lexical sample may struggle on all-words because it has not learned to handle the long tail. Domain-specific tasks are important because sense distributions vary by domain. A multilingual task can test cross-language transfer by training in one language and evaluating in another. Coarse-grained tasks are useful when fine-grained distinctions are unstable. Each variant answers a different question, and results from one variant should not be generalized to another without care.
Why WSD Is Hard
WSD is hard for several reasons, and they interact.
Sense-tagged corpora can have strongly imbalanced word and sense counts. MetricWSD (Chen et al., 2021), for example, studies both kinds of imbalance in SemCor training data. Such skew can leave little supervision for rare senses. The observed distribution depends on genre, domain, sampling, and annotation policy; it is not a law that every corpus must have the same pattern. Measure the frequency distribution in the data used for the experiment.
Context is sparse. The words that disambiguate a sense may not appear in a short window. In "The bank was steep," steep can suggest a riverbank, but it can also describe another slope. "She walked toward the bank" permits a financial-institution reading or a river-edge reading until more context is supplied. Duan and Yates (2010) motivate their WSD approach with the need for world knowledge. Disambiguating cues can also lie beyond the local window. A sentence may mention a bank early and reveal that it is a riverbank much later. Leacock, Chodorow, and Miller (1998) found that adding topical features to local context helped on some of their evaluated words, but not all. A model that only looks at a small window may miss the evidence.
Some sense distinctions are easier to apply than others. The financial-versus-river distinction for bank differs from separating two closely related financial uses. Check whether the annotation guidelines let annotators apply the intended distinction consistently. A model can fit noisy labels, so training accuracy alone does not establish that it has learned the intended semantic distinction. This is a reason to inspect disputed cases and held-out errors, rather than assume every finer label is useful supervision.
Sense annotation requires guidelines, annotator preparation, and quality control; professional lexicographers are not a universal prerequisite. SemCor pairs Brown Corpus passages with WordNet senses. The processed SemCor training set used by Blevins and Zettlemoyer (2020) contains 226,036 annotated examples. That count describes their preprocessing and target selection, rather than every release or possible annotation policy. When planning a new corpus, budget the annotation work for the target distinctions and measure agreement on trial examples.
Domain changes can reduce a WSD model's accuracy. A word's dominant sense in newswire may differ from its dominant sense in clinical notes or social media. A model trained on one domain may confidently predict the wrong sense in another. Changes in sense priors can contribute to transfer errors. A sense that is rare in general English may be common in a specialized domain. A model that relies on the general prior may systematically choose the wrong sense. For domain adaptation, measure how sense distributions and errors change. Depending on the inventory and data, fine-tuning, prior adjustment, or another intervention may be appropriate.
The inventory may not fit the data. A word use may be metaphorical, metonymic, or novel. It may fall between two senses or combine them. A forced-choice WSD system must still pick a label, which can produce misleading evaluations. If the inventory lacks a sense for a common use, the model is forced to choose an available label. If annotators assign a fallback label from the inventory, a semantically reasonable prediction can still disagree with that label. If the protocol excludes the use from scoring, report it separately as a gap in inventory coverage. If the inventory splits a single use into two senses, the model may be penalized for choosing the other split. The inventory and annotation guidelines can leave a use uncovered or its reference label ambiguous. For cases that enter scoring, the model’s prediction and the accepted reference labels determine whether a disagreement is counted.
A frequency-only classifier can score highly when its training-selected senses also dominate the evaluated targets. Its accuracy is the fraction of those targets carrying those labels. The BEM comparison below gives one measured example; it does not establish that improvements over MFS are generally small. Compare both overall and rare-sense outcomes on the stated inventory and target set.
Evaluation
WSD evaluation uses several metrics and protocols.
For a fixed set of (N>0) annotated targets, submit at most one response per target. Let (A) be the number attempted and (C) the number assigned a correct sense, with (0\le C\le A\le N).
Accuracy when all targets are attempted is (C/N). Under this fixed-target abstention protocol, precision is (C/A) for (A>0), and recall is (C/N).
When (C>0), their harmonic mean simplifies to (F1=2C/(A+N)). We extend this count formula to (C=0), giving F1 of zero.
With no attempts, precision remains undefined while recall and this F1 convention give zero. If every target is attempted, precision, recall, F1, and accuracy therefore coincide, including the all-wrong case.
With the other predictions and target count fixed, abstaining on an incorrect answer leaves recall unchanged; abstaining on a correct answer lowers recall. Recompute precision from the remaining attempted answers; it is undefined if no attempts remain.
The gold protocol supplies the targets; this is not a free decision to label arbitrary words. Disclose zero-case conventions and how multiple acceptable labels are handled, and report per-part-of-speech results when they matter.
Include a most-frequent-sense comparison when evaluating whether context improves over training-set frequency. Compute each lemma's baseline from the specified training data, state the fallback for unseen lemmas, and use the same gold targets as the model. If the implementation instead uses the first WordNet sense, identify it as that proxy. A lower aggregate score warrants investigation, but usefulness also depends on rare senses, error costs, coverage, and the downstream task.
Standard datasets include:
- Senseval: Early evaluations with edition-specific protocols. Senseval-1 was a lexical-sample exercise; Senseval-2 included both lexical-sample and all-words tasks. The BEM evaluation discussed below uses the later Senseval-2 and Senseval-3 English all-words datasets.
- SemEval-2007 Task 17: English lexical-sample, semantic-role-labeling, and all-words subtasks.
- SemEval-2013 Task 12: Multilingual noun sense disambiguation using BabelNet 1.1.1 or its WordNet/Wikipedia projections. The annotated targets included eligible multiword expressions and named entities.
- SemEval-2015 Task 13: Multilingual all-words word-sense and entity disambiguation using BabelNet 2.5.1. Unlike the fixed-target example above, participating systems were not given the fragments to disambiguate. When counting true positives, the scorer gave equal weight to multiple answers submitted by a system for one instance. It ignored predicted fragments absent from the gold standard.
- SemCor: A sense-tagged subset of the Brown Corpus, widely used for WSD training. It has also served as an evaluation corpus in published WSD studies.
- OntoNotes: A multilingual corpus whose documented English inventory groups fine-grained WordNet senses.
- Word-in-Context (WiC): A binary task that asks whether a word has the same sense in two sentences. It avoids fine-grained sense labels but still tests contextual sense discrimination.
WiC deserves special attention. It reformulates WSD as a comparison problem: given two sentences containing the same target word, decide whether the word is used in the same sense. The model outputs a binary judgment rather than a sense ID. The original WiC dataset nevertheless used WordNet, VerbNet, and Wiktionary examples and pruned subtle distinctions using resource relations. One way to implement this binary comparison is to compare contextual representations of the two target occurrences. However, WiC does not tell you which sense is used, only whether two uses match. It is a complementary evaluation, not a replacement for inventory-based WSD. A model that excels at WiC may still fail at assigning a specific sense label. A model that assigns labels may still fail at comparing two uses. With one adjudicated label per occurrence in a shared, aligned inventory, comparing two correct WSD labels settles a pair task defined by label equality. If the protocol accepts several labels per occurrence, specify how the pair task compares the accepted sets. For example, with accepted sets ({a,b}) and ({b,c}), predictions (a) and (c) are both accepted even though they differ and the sets share (b). A binary judgment alone leaves the sense identity undetermined. Across different inventories or granularities, success on one task does not guarantee success on the other.
Benchmark contamination is a serious concern for modern LLMs. WiC and SemEval examples may appear in pretraining data. A model that scores well on WiC may have memorized the benchmark rather than learned to discriminate senses. Check whether the evaluation data was filtered from pretraining when training data or documentation allow it. If you cannot verify filtering, say so. Prefer hidden or newly constructed test sets when making strong claims. Contamination is especially difficult to detect because LLMs are trained on massive web corpora. A public benchmark example may appear in a blog post, a paper, a tutorial, or a code repository. Even if the exact example is not present, paraphrases or discussions of the example may be present. A high score on a contaminated benchmark alone does not establish generalization to unseen sense-disambiguation contexts.
Approaches to Word-Sense Disambiguation
WSD methods fall into three broad families: knowledge-based, supervised, and contextual neural methods. The boundaries are not rigid. A modern system may combine a lexical knowledge base with a pretrained encoder and a small supervised classifier. The families differ mainly in where the evidence comes from. Knowledge-based methods use dictionaries and lexical relations. Supervised methods use sense-tagged training data. Contextual neural methods use pretrained representations that encode context. Each family has strengths and weaknesses, and the best choice depends on the inventory, the domain, the amount of labeled data, and the evaluation goal.
Knowledge-Based Methods
Knowledge-based WSD uses lexical-resource definitions or relations without requiring a task-specific sense-tagged training corpus. For a gloss method, the resource must supply usable candidate definitions or examples in a language the method can compare with the context. For a graph method, relevant relations and coverage are also necessary. Curated lexical resources already embody human semantic decisions; absence of a sense-tagged training corpus does not mean absence of human annotation. A resource's availability alone does not guarantee transfer to an arbitrary language or domain.
The Lesk Algorithm
Michael Lesk's 1986 paper introduced a dictionary-based approach to sense disambiguation. Lesk-style methods use lexical overlap as evidence. Here we study a simplified context-to-gloss variant: compare a candidate's definition with the words surrounding the target and choose the highest score. This implementation should not be read as a reproduction of every step in the original algorithm. Gloss-to-gloss comparisons and related-synset extensions are other variants; the exact text compared must be specified.
The simplified version is easy to describe. The scoring heuristic favors candidates whose signatures share vocabulary with the context. Whether that ranking selects the intended sense depends on the available words and candidate definitions. For a target word (w) in context (c), and a candidate sense (s) with gloss (g_s), compute:
where:
- (\text{score}(s, c)): the overlap score for candidate sense (s) given context (c)
- (c): the set of distinct preprocessed content words in the context window
- (t): one distinct content word in that set
- (g_s): the set of content words in the gloss (definition) of sense (s)
- (\mathbb{1}[\cdot]): the indicator function, equal to 1 when its argument is true and 0 otherwise
In words, count how many context words appear in the gloss. Choose the sense with the highest count. The formula is simple, but it hides several design choices. Which words count as content words? How large is the context window? Are words stemmed or lemmatized? Are stopwords removed? Are multiword expressions treated as units? Each choice can affect the score. With preprocessing and signatures fixed, enlarging the context word set cannot lower any candidate's raw intersection count. It can add matches for incorrect candidates as well as the intended one. Stemming can reconcile inflections and can collapse distinct words. A stopword policy also removes potential matches, so check which cues the task needs. The Lesk algorithm is therefore not a single algorithm. It is a family of algorithms defined by these preprocessing choices.
A version with a larger lexical signature uses examples as well as the definition:
where:
- (c): the set of content words in the context window
- (g_s): the set of content words in the gloss of sense (s)
- (e_s): the set of content words in the example sentences for sense (s)
- (|\cdot|): the cardinality (number of elements) of a set
You can also include the glosses of related senses, which gives extended Lesk. The extended signature can supply words missing from the target sense's own short gloss. If the gloss for a sense is "a financial institution," the words are few. Adding the glosses of hypernyms or related concepts can supply additional vocabulary and matches. The tradeoff is that related senses may introduce vocabulary that is not specific to the target sense. A larger signature can create extra overlaps for correct and incorrect candidates. Whether those changes improve WSD precision or recall must be measured on a stated task.
Raw overlap counts do not include a penalty for signature length. If one signature contains every type in another and adds more types, its intersection count cannot decrease; that does not guarantee a better sense ranking. Jaccard normalization divides the intersection size by the union size, so adding unmatched types can lower its score:
where:
- (c \cap g_s): the set of content words shared by the context and the gloss
- (c \cup g_s): the set of all content words appearing in either the context or the gloss
This is the Jaccard similarity when the union is nonempty. If preprocessing leaves both sets empty, the displayed fraction is undefined; an implementation must state a fallback, such as returning zero evidence. Another option is cosine similarity over TF-IDF vectors, which we implement later. For two nonzero vectors, cosine is their dot product divided by the product of their lengths: it compares direction after length normalization. A zero vector has no direction; the scikit-learn function used below returns zero similarities for a zero-vector row. TF-IDF supplies the term weighting, while cosine supplies the normalized comparison. Their effect on WSD must be measured for the chosen glosses and preprocessing.
For a short illustration, hold the context size fixed and let three candidate glosses grow in length while their intersections grow more slowly. Raw overlap rewards the longest gloss, but the Jaccard score reverses that advantage.
PythonIn [5]Expand
gloss_lengths = [4, 10, 20]
intersections = [2, 3, 4]
context_size = 6
raw_overlap_scores = intersections
jaccard_scores = [
inter / (context_size + length - inter)
for length, inter in zip(gloss_lengths, intersections)
]VisualizationOut [6]Expand

The implemented overlap scorer requires no sense-tagged training corpus. It does require candidate definitions or examples, compatible context/resource text, and preprocessing suited to that text. The code below uses an English resource and ASCII alphabetic token extraction, so transferring it requires checking those assumptions. Its diagnostic output makes the shared words inspectable. A per-candidate classifier could also take the numeric overlap score as one input feature alongside other representations; whether that hybrid improves predictions requires evaluation.
It also has clear weaknesses. Exact word overlap can be sparse. Inflection can hide a match: deposited and deposits are different strings. Synonyms such as car and automobile do not match as strings. A short gloss can omit cues to the intended use. The method is sensitive to window size and stopword handling. It has no way to learn which context words are actually diagnostic. A word like the may overlap with many glosses but provide no evidence. A rare word may be highly diagnostic but appear in only one gloss. Lesk treats all overlaps as equal unless weighting is added. This is why more sophisticated knowledge-based methods use graph structure, selectional preferences, or learned weights.
Graph-Based Methods
Graph-based WSD represents senses and semantic relations as a graph. Candidate senses are nodes; resource relations or other declared associations provide edges. A method can use connections among the candidate senses of different context words as a coherence heuristic. It then ranks candidates with a stated rule, such as a PageRank-like score. The connections are evidence used by the model, rather than a test that identifies every correct sense.
Graph-based methods use relation evidence beyond exact string overlap. Candidate construction, selected relations, and the ranking rule determine what that evidence can contribute. Missing links can remove useful connections, while unrelated links can add competing associations. Inspect those edges and the resulting rankings when diagnosing errors. A performance comparison with Lesk needs a stated inventory, corpus, and preprocessing policy.
Selectional Preferences
Selectional preferences capture the idea that predicates prefer certain kinds of arguments. Eat prefers food objects. In its written-language sense, read prefers text objects. In its theft sense, rob can take the person or place robbed as its object; the stolen property need not be money. If a verb strongly selects for a particular semantic class, that preference can disambiguate its arguments. For example, "The bank was robbed" favors a banking-related reading over the riverbank reading. The cue alone leaves both the institution and its premises as possible readings. "The bank was muddy" strongly suggests the riverbank sense because financial institutions are not usually muddy. Selectional preferences can be learned from corpus data (McCarthy, 2009). They are a useful source of evidence, but they are not sufficient on their own because many predicates are flexible and many nouns are polysemous. The visual and cognitive senses of see allow different kinds of objects, so the sense and construction matter. A noun like bank can be the object of many verbs. Selectional preferences provide soft constraints, not deterministic rules. Selectional preferences can complement local context, lexical relations, and other evidence; evaluate the combination on the intended task.
Supervised WSD
Supervised WSD treats sense selection as a classification problem. The training examples pair an annotated word in context with its sense label. The system learns a classifier that maps a context representation to a sense label. Supervised WSD can be very effective when enough labeled data is available. It can learn subtle cues that are not present in glosses. It can learn domain-specific patterns and collocations. The classifier can use word-form and syntactic features, or representations learned by a neural encoder, when the relevant cues are present in its training data. The main limitation is the cost of annotation and the sparsity of labeled data for rare senses.
Classical supervised systems have used local words, POS, and document-topical context (McCarthy, 2009). For a particular classifier, select and evaluate input features such as:
- Local context: words within a window around the target, represented as unordered counts or as position-sensitive lexical features.
- Part of speech: the POS of the target and its neighbors.
- Collocations: frequent word pairs or triples that co-occur with a sense.
- Syntax: dependency relations, subject/object positions, and phrase structure.
- Semantic information: selectional-preference scores or domain indicators when available.
- Discourse: the "one sense per discourse" heuristic, which says a word tends to keep the same sense throughout a coherent text.
- Topic: document-level lexical or topical information, such as a bag of words from the wider text.
Classifiers include Naive Bayes, decision trees, support vector machines, logistic regression, and conditional random fields. The 2017 unified evaluation compared conventional local-feature classifiers alongside neural approaches, so this was not a complete replacement of manual features. Both formulations predict a sense label from a context representation. The features are still useful for understanding what evidence matters. Local context captures collocations. Syntax captures argument structure. Semantic information captures selectional preferences. Discourse captures consistency. Topic captures domain effects. A neural model may learn these patterns implicitly, but it still depends on the data containing the relevant signals.
A classifier needs a policy for labels with sparse or absent training examples. Frequency fallback, gloss scoring, and shared representations are alternatives. Whether an all-words test contains those cases depends on its documents, inventory, target exclusions, and training split. Report the relevant training frequencies and evaluate the selected policy on the same target set.
The "one sense per discourse" heuristic is a useful constraint. If a word is used in one sense in a document, it is likely to keep that sense throughout. A model can add this as a preference while allowing multiple senses when the context warrants them. The related "one sense per collocation" heuristic says that a strong collocation tends to select a consistent sense. These heuristics reflect regularities in language use. They are not laws, but they provide useful priors. A supervised system can incorporate them as features or as post-processing constraints.
Performance numbers belong to a specified experiment. In Blevins and Zettlemoyer (2020), the gloss-informed bi-encoder reports 79.0% F1 on the paper's aggregate ALL English all-words set, compared with 65.5% for its training-data MFS baseline. ALL concatenates the listed datasets and includes the SE07 development set, so it is not a single wholly held-out test score. This historical result illustrates the reporting details needed for comparison; it is not a current performance range for all WSD systems.
Contextual Embeddings and Neural WSD
Static word embeddings assign one vector per word type. Looking up bank returns the same vector in the paycheck sentence and the river sentence. The lookup alone therefore cannot distinguish those occurrences. As discussed in Part IV, the type vector represents distributional information; it is not a specified mathematical mixture of separate sense vectors. A WSD system can still use static embeddings together with surrounding-word features, or learn separate sense representations. The limitation belongs to the context-independent lookup, not to every system that uses it as an input.
ELMo and BERT construct token representations using context, so the two bank sentences can receive different target vectors. ELMo's analysis also found information about syntax and word senses in different internal layers. Such features are not dedicated inventory sense vectors: a WSD system still needs a classifier, prototype comparison, gloss score, or another decision rule. The amount of sense-tagged supervision required depends on that method and its evaluation, rather than following from contextuality alone.
There are several ways to turn contextual vectors into sense decisions:
- Supervised sense classification: Train a classifier on top of contextual vectors to predict a sense label. The prediction head can be a linear layer or a small MLP. The encoder may also be fine-tuned for WSD.
- Sense embeddings: Represent each sense by a vector, either learned from sense-tagged data or derived from glosses. At test time, compare the contextual vector to the sense vectors and choose the nearest.
- Contextual sense prototypes: Represent each sense by the average contextual vector of its training examples. At test time, compare the target token's vector to each sense centroid. This nearest-centroid procedure differs from instance-level nearest neighbors, which retain individual training-example vectors.
- Gloss-based sentence pair classification: Treat the context and the sense gloss as a sentence pair and train a model to predict whether the gloss fits the context. GlossBERT is a well-known example of this approach.
- End-to-end sense labeling: Treat WSD as a sequence labeling problem, where each eligible target word receives a sense label constrained to its candidate inventory. Check training coverage for the candidate labels and say how the model scores senses with no labeled training examples.
Layer choice is an experimental decision. In the ELMo study, higher LSTM states captured sense-related information while lower states captured more syntactic information; the model combined internal layers for downstream tasks. This does not imply that a particular middle layer is best for every encoder or WSD dataset. Compare layers or layer combinations on development data and keep the test set separate from that choice.
Word-in-Context predicts whether two usages share a meaning rather than returning a particular sense identifier. A binary comparison can leave the label identity undetermined. For a pair task defined by label equality, two correct labels settle the comparison when each occurrence has one adjudicated label in the same aligned inventory. Different inventories or granularities can break a direct comparison, so WiC and inventory-label WSD should be reported with their respective definitions and protocols.
LLMs and Prompt-Based WSD
Large language models offer a new interface to WSD. Instead of training a classifier, you can prompt the model with the target sentence and a list of sense definitions, and ask it to choose the best sense. A typical prompt might look like this:
Target word: bank Sentence: She deposited her paycheck at the bank before noon. Candidate senses:
- sloping land beside a body of water
- a financial institution that accepts deposits
- a flight maneuver in which an aircraft tips laterally
Which sense is intended? Answer with the number.
This approach is flexible and requires no task-specific training. A prompt can request a sense identifier, candidate ranking, or explanation; the chosen output still needs validation. It also has serious limitations. The flexibility is attractive because it allows rapid prototyping and adaptation to new inventories. A prompt can include definitions, examples, and instructions. A model can be asked to choose a label, rank candidates, or explain its reasoning. This makes prompt-based WSD a useful tool for exploration. However, the same flexibility makes evaluation difficult. The prompt is part of the model's input, and small changes to the prompt can change the output. The model's behavior is not fixed by training on a specific inventory. It is conditioned by the prompt and the pretraining data.
First, LLMs may not adhere to the sense inventory. They may invent a sense, merge two senses, or choose a definition that is plausible but not in the inventory. Multiple-choice formatting can present the candidates as options. Constrained decoding can enforce valid identifiers, and a validator can reject answers outside the inventory. Even with constraints, the model may choose a label for the wrong reason. It may rely on superficial cues in the prompt, or it may be influenced by the order of the candidates. The output may be valid but not reliable.
Second, prompted WSD predictions can change with option order or wording. Swapping the order of definitions can change the answer. Changing the candidate set also changes the decision problem, so its size and contents belong in the evaluation protocol. Option-order effects have been demonstrated in particular model and dataset studies, including RoDEval (2025); their magnitude should be measured for the system being tested. If the answer depends on the order of the options, the evaluation is measuring prompt sensitivity as well as semantic ability. A robust evaluation should randomize order, vary wording, and report the variance across prompts. It should also compare against a baseline that uses the same prompt format. A single prompt result is not enough to establish robust WSD performance.
Third, LLMs may have seen the benchmark data during pretraining. WiC and SemEval examples are public and may be memorized. A high public-benchmark score alone does not establish robust WSD, especially when contamination has not been assessed. One approach is to use newly constructed test sets that are not publicly available. Another approach is to filter the pretraining data, if that is possible. Another approach is to test on examples that are paraphrased or perturbed in ways that preserve the sense but change the surface form. A drop under paraphrase is a robustness finding. It is not by itself proof of memorization: paraphrasing can change difficulty, pragmatic cues, or the intended sense unless these are checked.
Fourth, distinguish label selection from the quality of generated explanations. A valid label can still be wrong, and a fluent explanation can still misstate a sense. Empirical capability depends on the model and protocol: Meconi et al. (2025) report that leading evaluated LLMs matched specialized WSD systems, whereas RoDEval (2025) found option biases and overconfidence in its tested settings. Neither result establishes a universal coarse-versus-fine ranking. Measure the distinctions needed by the application, and use expert error analysis when fixed-label scores leave important questions unresolved.
The practical lesson is that LLMs are not automatically WSD systems. The cited studies demonstrate strong WSD performance by some of the tested models. An LLM-based WSD application needs an inventory interface, an output policy, and an evaluation protocol that assesses contamination and prompt sensitivity. A prompt-based system can be useful, but it should be treated as a system with its own design choices. The prompt is a kind of interface specification. Include the definitions, demonstration examples, and requested output format when reporting the prompt. The evaluation should therefore report the prompt, the inventory, the decoding constraints, and the baseline.
Multilingual WSD
Multilingual WSD adds challenges in sense-inventory coverage and translation alignment; cross-lingual evidence can also help disambiguation. A word may have different senses in different languages, and the translations may not align. The same concept may be lexicalized differently, and a single translated word may cover multiple source senses. For example, English bank translates to French banque in the financial sense and rive in the river sense. French banque can also translate bank in the storage sense, as in data bank. And river bank can be translated as rive or berge. One target expression can cover several source senses, and one source sense can have several target expressions. This makes multilingual WSD both a challenge and an opportunity. The challenge is that sense inventories and translations do not align cleanly. The opportunity is that translations provide additional evidence about sense distinctions.
Parallel corpora can supply evidence for translation-based WSD. A reliably aligned translation can help distinguish source-word senses when the target language expresses them differently. For example, English bank translates to French banque in the financial sense and rive in the river sense. A parallel corpus can then provide indirect supervision without explicit sense annotation. Word alignment can fail, translations can be idiomatic, and a single translation may cover multiple senses. Validate automatically projected labels for their sense mappings and quality on the task before using them for training or evaluation.
Cross-lingual projection transfers sense annotations from a resource-rich language to a resource-poor one. The projection is noisy because word alignment is imperfect and senses do not map one-to-one. Multilingual encoders such as mBERT and XLM-R provide contextual representations across languages and have been used for zero-shot WSD. For an illustrative one-shot classifier with a finite, nonempty candidate set, take one labeled support context per sense. Encode the marked target in each support context and in a new occurrence with the same encoder and vector extraction rule. Use finite vectors of equal dimension, Euclidean distance, and a fixed rule for ties; return the sense of the nearest support vector. This construction supplies a prediction, not a measured accuracy or cross-language transfer result. BabelNet provides multilingual sense inventories and translations. These resources make multilingual WSD possible, but they do not make it easy. The XL-WSD experiments demonstrate variation across evaluated languages in a general-domain setting. A good result for one language pair does not establish performance on another, and a general-domain benchmark does not establish performance on clinical text. Domain transfer needs its own evaluation.
Translation can also supply disambiguation evidence. Kang, Blevins, and Zettlemoyer (2024) prompt a model to translate the target word in context, then use the overlap between source-word and translated-word sense sets to form WSD predictions. They evaluate the approach on 18 languages from XL-WSD. The translation language and sense mapping are part of this procedure; report them and examine alignment or mapping errors when interpreting its results.
Worked Example: Disambiguating Bank
Let's work through a small example by hand before implementing anything. Consider the sentence:
The fisherman sat on the bank of the river and watched the current.
We remove stopwords and stem the remaining content words. The context contains something like:
fisherman, sat, bank, river, watch, current
We remove the stem of the target bank from the context set. Now we compare the context with the glosses and examples of the candidate senses. A target self-match can be weak evidence when the target happens to occur in a signature. WordNet definitions and examples are shared among synset synonyms, so not every signature contains the queried word. The goal is to measure the evidence from the surrounding words, not from the target itself.
For the riverbank sense, WordNet's gloss is "sloping land (especially the slope beside a body of water)." The examples include "they pulled the canoe up on the bank" and "he sat on the bank of the river and watched the currents". The overlap with our context includes sat, river, watch, and current. The score is 4. The overlap is meaningful because these words describe the scene. The unchanged Porter stem sat matches the action in the sentence. River matches the location. Watch matches the action. Current matches the object being watched.
For the financial sense, the gloss is "a financial institution that accepts deposits and channels the money into lending activities." The examples include "he cashed a check at the bank" and "that bank holds the mortgage on my home". The overlap with our context is empty. The score is 0. The financial gloss contains words like financial, institution, deposits, money, lending, but none of these words appear in the fisherman sentence. This signature contributes no positive overlap evidence for the financial reading.
For the flight maneuver sense, the gloss mentions aircraft and lateral tipping. The overlap is empty. The score is 0. The sentence has no aviation context. This signature contributes no positive overlap evidence for the flight reading.
The riverbank sense wins clearly. Our sentence closely follows the second WordNet example, which supplies all four matching stems. Use independently sampled contexts to test whether that benefit carries over. The gloss alone might not contain sat, watch, or current. The examples provide additional vocabulary that matches the sentence. Related-sense glosses can extend the signature further.
Now consider the financial sentence:
She deposited her paycheck at the bank before noon.
After removing bank, the context contains the stems deposit, paycheck, befor, and noon. The financial gloss contains deposits, which has the same stem as deposited. The score is 1. The riverbank signature shares none of these stems. Among these three selected noun candidates, the financial sense has the largest overlap. The example shows how stemming helps. If you compare the words as written, deposited and deposits do not match. The score might be 0, and the tie-break might choose the wrong sense. Stemming is a crude form of morphological normalization; here it connects the inflected forms in the sentence and gloss.
The lexical evidence remains limited. Changing paycheck to salary alone leaves the shared deposit stem intact. In the shorter sentence "She walked toward the bank," approaching a financial institution and approaching a river edge are both compatible with the words supplied. A later mention of a teller or of the water can clarify the intended reading. An overlap method may still lack a matching cue in the available window, so inspect its actual shared words and candidate scores.
The lesson is that lexical overlap is a useful signal, but it is not a semantic model. It captures surface similarity between the context words and the signature. Systems intended to handle a wide range of WSD cases need to handle morphology, synonymy, syntax, and world knowledge. The overlap demonstration tests one source of evidence; those broader capabilities need their own evaluation. A knowledge-based method like Lesk is a good starting point because it makes the evidence visible. It shows which words support which sense. But it is not a complete solution. A supervised or contextual model can learn patterns that are not present in the gloss. A hybrid system can combine the interpretability of Lesk with the flexibility of neural representations.
Implementing Word-Sense Disambiguation
We can now build a small WSD pipeline with NLTK and scikit-learn. The goal is to illustrate the mechanics, not to produce a state-of-the-art system. We will inspect WordNet, implement simplified Lesk, build a gloss vector baseline, and compare against the first-WordNet-sense proxy on a tiny hand-built test set. The code is intentionally simple so that each step is visible. Before production use, evaluate on a larger representative target-domain set and choose the preprocessing and model according to the measured requirements. The teaching value comes from seeing how the pieces fit together.
Use the book's Python 3.11 environment for the notebook kernel. Run the notebook with its kernel working directory in the repository checkout so the setup cell can find the shared plotting helper. Install the required WordNet data before running the notebook if it is missing. The commented download calls show one way to fetch resources over the network. The hidden setup cell at the start of the chapter loads the shared plotting helper and sets the seed.
PythonIn [7]Expand
import re
from collections import Counter
import nltk
# nltk.download("wordnet", quiet=True) # Run once locally, then comment out
# nltk.download("omw-1.4", quiet=True) # Run once locally, then comment out
from nltk.corpus import wordnet as wn
from nltk.stem import PorterStemmerThe examples below require WordNet 3.0. The first lookup checks the installed release before inspecting the noun senses of bank. The first listed noun synset is bank.n.01, the riverbank sense. We use the resource order for the first-WordNet-sense baseline. The sense numbers alone give no reliable estimate of corpus frequencies. The glosses show how WordNet separates the financial, river, and other meanings.
PythonIn [8]Expand
if wn.get_version() != "3.0":
raise ValueError("These examples require WordNet 3.0")
bank_synsets = wn.synsets("bank", pos=wn.NOUN)ConsoleOut [9]Expand
Number of noun synsets for 'bank': 10 bank.n.01 sloping land (especially the slope beside a body of water) depository_financial_institution.n.01 a financial institution that accepts deposits and channels the money into lending activities bank.n.03 a long ridge or pile bank.n.04 an arrangement of similar objects in a row or in tiers bank.n.05 a supply or stock held in reserve for future use (especially in emergencies) bank.n.06 the funds held by a gambling house or the dealer in some gambling games bank.n.07 a slope in the turn of a road or track; the outside is higher than the inside in order to reduce the effects of centrifugal force savings_bank.n.02 a container (usually with a slot in the top) for keeping money at home bank.n.09 a building in which the business of banking transacted bank.n.10 a flight maneuver; aircraft tips laterally about its longitudinal axis (especially in turning)
The output lists each synset name and its definition. You can see that WordNet distinguishes the sloping land sense, the financial institution sense, the building sense, the flight maneuver sense, and several others. This is exactly the kind of fine-grained inventory that makes WSD both informative and difficult. The number of senses is not a property of the word in isolation. It is a property of the word relative to the inventory. A different inventory might list fewer or more senses. The output therefore shows both the richness of WordNet and the challenge of choosing among its categories.
We can also inspect the lexical structure of a synset: its lemma names, examples, and hypernyms.
ConsoleOut [10]Expand
Synset: bank.n.01 Lemmas: bank Examples: ['they pulled the canoe up on the bank', 'he sat on the bank of the river and watched the currents'] Hypernyms: ['slope.n.01'] Synset: depository_financial_institution.n.01 Lemmas: depository_financial_institution, bank, banking_concern, banking_company Examples: ['he cashed a check at the bank', 'that bank holds the mortgage on my home'] Hypernyms: ['financial_institution.n.01'] Synset: bank.n.03 Lemmas: bank Examples: ['a huge bank of earth'] Hypernyms: ['ridge.n.01']
The lemma names show the synonyms that WordNet groups under the concept. The examples provide usage contexts. The hypernyms place the sense in a hierarchy. For the financial sense, the direct hypernym is financial_institution.n.01, whose lemmas include financial organization. For the riverbank sense, the direct hypernym is slope.n.01. The hypernyms are useful because they provide additional vocabulary and because they place the sense in a broader semantic network. A Lesk system can use hypernym glosses as extra evidence. A graph-based system can use hypernym links to connect senses. A human reader can use the hierarchy to understand how WordNet organizes the lexicon.
We can count candidate synsets for selected word forms in the installed inventory. The ten forms below were chosen to illustrate variation, so their counts do not estimate the distribution across the vocabulary. Counts also combine parts of speech and depend on resource granularity. To study a population-level relationship between usage frequency and sense count, define a sampling frame and collect those quantities separately.
PythonIn [11]Expand
words = [
"bank",
"run",
"light",
"plant",
"bass",
"spring",
"head",
"line",
"charge",
"table",
]
polysemy = {w: len(wn.synsets(w)) for w in words}
polysemy_sorted = sorted(polysemy.items(), key=lambda item: -item[1])ConsoleOut [12]Expand
run 57 synsets light 47 synsets head 42 synsets charge 40 synsets line 36 synsets bank 18 synsets spring 11 synsets plant 10 synsets bass 9 synsets table 8 synsets
The counts vary among these selected forms. Run has dozens of candidate synsets across nouns and verbs; bass has fewer, including the fish and low-sound meanings. Candidate count is not sense frequency. A form can have many inventory senses while one dominates a corpus, or few senses with balanced frequencies. These ten chosen forms therefore do not establish the vocabulary-wide ambiguity distribution or predict an MFS baseline's accuracy.
Before implementing Lesk, we need a tokenizer and a stemmer. We use a simple regex tokenizer and the Porter stemmer. The stopword list is deliberately small and general. For the intended domain and language, check which cues the stopword policy removes and change it when those checks show a need. A larger stopword list can reduce spurious matches but may remove words that are useful for disambiguation. A domain-specific stopword list might remove words that are common in the domain but uninformative. The tokenizer also matters. A regex tokenizer that extracts alphabetic sequences is simple, but it ignores punctuation and multiword expressions. A richer preprocessing pipeline can preserve relevant hyphens, handle contractions, and identify named-entity spans. For a teaching example, the simple tokenizer is sufficient.
PythonIn [13]Expand
STOPWORDS = set(
"""
a an the and or but if while of to in on at by for with from as is are was were be been being
this that these those it its he she they them his her their you your we our i my me
not no nor so than then there here when where who whom which what how why
""".split()
)
stemmer = PorterStemmer()
def content_words(text):
tokens = re.findall(r"[a-z]+", text.lower())
return [stemmer.stem(t) for t in tokens if t not in STOPWORDS]The content_words function lowercases the text, extracts ASCII alphabetic strings, removes its stopword set, and applies Porter stemming. This matches some inflections but may conflate distinct words or return a string that is not a conventional lemma. In the installed NLTK example, both universe and university stem to univers. Lemmatization instead aims at a lexicographic base form; methods can use lexical entries, morphology, part of speech, or context. Compare the actual normalization errors and runtime on the intended data before choosing a method.
Now we implement simplified Lesk. For each candidate synset, we build a gloss document from its definition, examples, and optionally its hypernym definitions. We compute the overlap with the context and sort the candidates by score. The function discards the target’s stem from the context set. Any other token with the same stem loses its feature too. If universe appears in the sentence and university is the target, discarding univers removes their shared feature. This suppresses a self-match when a candidate signature contains the target stem. The function returns the matching stems as well as the count, which makes the result interpretable. A human can inspect the evidence and see why a sense was chosen.
PythonIn [14]Expand
def lesk_scores(word, sentence, use_hypernyms=True):
context = set(content_words(sentence))
context.discard(stemmer.stem(word.lower()))
scores = []
for syn in wn.synsets(word):
gloss_text = syn.definition() + " " + " ".join(syn.examples())
if use_hypernyms:
for hypernym in syn.hypernyms():
gloss_text += " " + hypernym.definition()
gloss = set(content_words(gloss_text))
overlap = context & gloss
scores.append((syn, len(overlap), sorted(overlap)))
return sorted(scores, key=lambda item: (-item[1], item[0].name()))The function returns a list of tuples containing the synset, the overlap count, and the overlapping words. It sorts by descending score, then orders tied senses by synset name. The simplified_lesk wrapper takes the first ranked sense. Ordering ties by name makes the example reproducible without adding semantic evidence. If candidates are available and every overlap is zero, the wrapper still returns the first candidate by name. A system could use a prior or another source of evidence to break ties.
The helper has no target index or span: it returns one ranking for a word form in the supplied sentence. If that sentence contains two uses of the same form with different intended readings, the interface cannot label them separately. The six cases below each contain one target use. Occurrence-level prediction needs a target-alignment policy, such as marked spans or token-aligned outputs.
Let's apply the function to two sentences, one financial and one riverbank.
PythonIn [15]Expand
example_sentences = [
"She deposited her paycheck at the bank before noon.",
"The fisherman sat on the bank of the river and watched the current.",
]
lesk_examples = [
(sentence, lesk_scores("bank", sentence)[:3])
for sentence in example_sentences
]ConsoleOut [16]Expand
She deposited her paycheck at the bank before noon. deposit.v.02 score=2 overlap=['deposit', 'paycheck'] bank.n.09 score=1 overlap=['deposit'] depository_financial_institution.n.01 score=1 overlap=['deposit'] The fisherman sat on the bank of the river and watched the current. bank.n.01 score=4 overlap=['current', 'river', 'sat', 'watch'] bank.n.03 score=0 overlap=[] bank.n.04 score=0 overlap=[]
In the locked WordNet 3.0 example, the first sentence ranks the verb sense deposit.v.02 highest, with overlaps deposit and paycheck. Both matches come from the verb’s WordNet usage example, which closely resembles the input sentence. The second ranks the noun sense bank.n.01 highest, with sat, river, watch, and current. The first result exposes the cost of admitting all parts of speech when the target occurrence is a noun. Keeping only nouns with the same scoring rule would leave bank.n.09 and depository_financial_institution.n.01 tied at 1. The name-based tie-break would pick the building sense, bank.n.09. In the river sentence, the correct noun leads. In the financial sentence, the wrong verb also leads, so a score gap alone cannot establish that the top sense is correct. When the available cues are weak, several candidates can have similar scores. The shared words show what counted. Check them against the sentence and the candidate definition to see whether they support the intended reading.
We can wrap the ranking in a simple classifier that returns the top sense.
PythonIn [17]Expand
def simplified_lesk(word, sentence):
ranked = lesk_scores(word, sentence)
if not ranked:
raise ValueError(f"No WordNet candidates for {word!r}")
return ranked[0][0]This small knowledge-based WSD system requires no sense-tagged training data and estimates no probabilistic model. It still has configuration choices: preprocessing, signature expansion, candidate scope, and tie-breaking. It is a useful baseline and a transparent teaching tool. The score counts shared stems without modeling syntax or word order. Direct hypernym links can still affect which definitions enter the signature. It depends on the quality of the glosses and the preprocessing. But it illustrates the core idea: compare the context with the sense definitions and choose the best match.
Next, we build a gloss vector baseline. Instead of counting exact overlaps, we represent each gloss as a TF-IDF vector and compare it with the context vector using cosine similarity. This weights exact vocabulary matches and normalizes their vector lengths. It does not match unseen synonyms or reconcile inflections unless we add suitable preprocessing. With term frequency held fixed, the default inverse-document-frequency factor is larger for a term occurring in fewer gloss documents. The vectorizer then normalizes each row, so document frequency alone does not determine every final feature weight. The configured English stopword filter removes words such as the and of before weighting. For a retained token such as river, TF-IDF supplies a corpus-dependent weight; that weight alone does not establish semantic relevance. Cosine similarity compares the direction of the two sparse vectors, but shared vector features still require matching tokens with the vectorizer used here.
PythonIn [18]Expand
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
def gloss_documents(word):
docs = []
synsets = []
for syn in wn.synsets(word):
docs.append(syn.definition() + " " + " ".join(syn.examples()))
synsets.append(syn)
return docs, synsets
docs, synsets = gloss_documents("bank")
vectorizer = TfidfVectorizer(stop_words="english")
gloss_matrix = vectorizer.fit_transform(docs)
query = "She deposited her paycheck at the bank before noon."
query_vector = vectorizer.transform([query])
similarities = cosine_similarity(query_vector, gloss_matrix).ravel()
order = similarities.argsort()[::-1]ConsoleOut [19]Expand
deposit.v.02 similarity=0.558 put into a bank account bank.v.03 similarity=0.211 do business with a bank or keep an account at a bank bank.v.02 similarity=0.168 enclose with a bank
The vector method ranks senses by cosine similarity between the context and the gloss. It is still a knowledge-based method, but it uses weighted sparse vectors whose nonzero similarity still depends on matching token features. The similarity scores are not probabilities, and they are not calibrated. They are ranking scores. A score of 0.3 does not mean a 30% chance that the sense is correct. It means that the context and the gloss have a certain cosine similarity in the TF-IDF space. This example sends the full query, including bank, to the vectorizer and builds candidate documents from definitions and examples without hypernyms. Only bank and paycheck survive the projection into the fitted vocabulary. The two other displayed verbs share only bank with the query, which gives both positive cosine scores. The wrong verb deposit.v.02 ranks first, with a displayed cosine of 0.558. An isolated comparison of the scoring rules would keep the inputs fixed. The method can still fail if the gloss does not contain the relevant words or if the context is too short. It can also be sensitive to the vectorizer's tokenization and stopword settings.
Now we need an evaluation with a fixed denominator. We pin this demonstration to WordNet 3.0 and list explicit gold synset names. In the installed WordNet 3.0 data, searching bank definitions for the string bank matches several candidate entries. Such a search does not identify one gold sense, and a missing match must not silently remove a test case. Before scoring a case, the evaluator resolves its gold synset name and checks that the synset is a candidate for the target word.
PythonIn [20]Expand
def first_wordnet_sense(word, sentence=None):
candidates = wn.synsets(word)
if not candidates:
raise ValueError(f"No WordNet candidates for {word!r}")
return candidates[0]
def evaluate(method, test_cases):
if wn.get_version() != "3.0":
raise ValueError("This fixed gold set requires WordNet 3.0")
if not test_cases:
raise ValueError("The test set must not be empty")
correct = 0
rows = []
for word, sentence, gold_name in test_cases:
gold = wn.synset(
gold_name
) # Missing identifiers raise an explicit error.
if gold not in wn.synsets(word):
raise ValueError(
f"Gold {gold_name!r} is not a candidate for {word!r}"
)
pred = method(word, sentence)
is_correct = pred == gold
correct += int(is_correct)
rows.append((word, sentence, gold.name(), pred.name(), is_correct))
return correct, len(test_cases), rowsThe evaluator now either scores every supplied case or raises an error. The predictor should return a synset from the installed WordNet 3.0 reader. Both demonstration predictors select from the target’s candidate list. The evaluator checks gold membership. If another predictor returns a valid WordNet synset outside the target’s candidates, it counts as an incorrect prediction. Synset-name strings are unsupported. The evaluator compares the prediction with the resolved gold synset before calling the prediction’s name() method for the result row. It returns the correct count, the intended test-set size, and row details for error analysis. Synset names are useful identifiers within this pinned resource; they are not a guarantee that an identifier has identical meaning across WordNet releases.
We define six test cases covering the financial, riverbank, and flight maneuver senses of bank, and the industrial and biological senses of plant. These hand-built examples illustrate the evaluation procedure. Their intended gold readings are stated explicitly, while the all-POS candidate list still lets the scorer choose an inappropriate verb. A representative evaluation would need a sampling protocol covering the words, parts of speech, and usage conditions relevant to the application. Here we compare only these six cases with the first-WordNet-sense proxy.
PythonIn [21]Expand
test_cases = [
(
"bank",
"She deposited her paycheck at the bank before noon.",
"depository_financial_institution.n.01",
),
(
"bank",
"The fisherman sat on the bank of the river and watched the current.",
"bank.n.01",
),
(
"bank",
"The pilot felt the bank of the aircraft as it turned.",
"bank.n.10",
),
(
"plant",
"The plant manufactures electric cars on three assembly lines.",
"plant.n.01",
),
(
"plant",
"Biologists classify the plant as a living organism that absorbs sunlight.",
"plant.n.02",
),
(
"plant",
"Water the plant every morning and keep it near the window.",
"plant.n.02",
),
]
lesk_correct, lesk_total, lesk_rows = evaluate(simplified_lesk, test_cases)
first_sense_correct, first_sense_total, first_sense_rows = evaluate(
first_wordnet_sense, test_cases
)
lesk_accuracy = lesk_correct / lesk_total
first_sense_accuracy = first_sense_correct / first_sense_totalConsoleOut [22]Expand
Simplified Lesk: 4/6 = 0.667 First WordNet sense: 2/6 = 0.333 ERR word=bank gold=depository_financial_institution.n.01 pred=deposit.v.02 OK word=bank gold=bank.n.01 pred=bank.n.01 OK word=bank gold=bank.n.10 pred=bank.n.10 OK word=plant gold=plant.n.01 pred=plant.n.01 OK word=plant gold=plant.n.02 pred=plant.n.02 ERR word=plant gold=plant.n.02 pred=establish.v.02
In WordNet 3.0 this implementation gets four of the six cases correct; the first-WordNet-sense baseline gets two correct. Both use the same six gold labels and admit all parts of speech. The financial bank sentence is a Lesk error: a verb sense wins despite the noun target. The set was selected for illustration, so these fractions describe these examples only. They do not estimate performance on a representative WSD benchmark.
In the last plant case, Lesk selects establish.v.02. The gold label is the biological sense plant.n.02. To investigate the error, inspect the candidate scores and shared words for that sentence. A model that has seen many examples of plant in gardening contexts can learn that water and window are associated with the biological sense, even if the gloss does not mention them. The example shows the limits of gloss-based knowledge. Glosses are compact and may not include the words that are most diagnostic in real usage. Supervised data can fill that gap. A classifier that uses contextual token representations can also draw on words in the sentence that are absent from the gloss.
Let's visualize the Lesk scores for the financial sentence. The figure shows which of the five displayed candidates receive lexical support. A bar chart is useful here because the scores are discrete counts. The length of each bar shows how many content words overlap between the sentence and the candidate signature, which here combines its definition, examples, and direct hypernym definitions. The figure makes the sparse nature of Lesk evidence visible. In the full candidate list, many senses have zero overlap. A few senses have some overlap. For this sentence the highest-scoring candidate is the incorrect verb deposit.v.02, so a high overlap score alone does not establish a correct sense.
PythonIn [23]Expand
score_sentence = "She deposited her paycheck at the bank before noon."
ranked_plot_scores = lesk_scores("bank", score_sentence)[:5]
score_labels = [syn.name() for syn, _, _ in ranked_plot_scores][::-1]
score_values = [score for _, score, _ in ranked_plot_scores][::-1]
score_colors = ["primary"] * (len(score_labels) - 1) + ["teal"]
score_ticks = list(range(max(score_values) + 1))VisualizationOut [24]Expand

The chart exposes a candidate-selection problem: the code admits verb senses, so a verb can outrank the noun intended in this sentence. Other candidates have zero overlap. The figure makes the sparse, discrete nature of Lesk evidence visible. TF-IDF can produce fractional scores, but it can also produce exact zeros when the vectors share no token features. Both methods expose lexical support; neither represents synonymy automatically. The choice between them depends on the task and the resource.
We can also visualize the candidate counts for our ten selected forms. Their all-POS synset counts vary, and noun and verb senses are counted together. This deliberately ambiguous sample shows differences among the selected forms. It cannot establish a vocabulary-wide distribution, a sense-frequency prior, or the accuracy of an MFS baseline; those require different measurements.
PythonIn [25]Expand
polysemy_items = sorted(polysemy.items(), key=lambda item: item[1])
words_sorted = [word for word, _ in polysemy_items]
counts_sorted = [count for _, count in polysemy_items]VisualizationOut [26]Expand

Finally, we compare the accuracy of simplified Lesk and the first-WordNet-sense proxy on the tiny test set. The comparison is not a real benchmark. The set is small and selected for illustration, so it cannot estimate representative benchmark performance. But the comparison illustrates the evaluation logic. For a study of context against training-set frequency, include a training-data MFS baseline as described above. Always report the inventory, the test set, and the evaluation conditions. A lower aggregate score does not establish an accuracy gain over the evaluated baseline; other benefits require separate evidence. A system that beats a proxy on a tiny set may still fail on a larger set. The comparison is a starting point, not a conclusion.
PythonIn [27]Expand
method_names = ["First WordNet sense", "Simplified Lesk"]
toy_accuracies = [first_sense_accuracy, lesk_accuracy]
accuracy_labels = [f"{value:.1%}" for value in toy_accuracies]VisualizationOut [28]Expand

These heights come from the six examples scored with WordNet 3.0. The evaluator rejects other releases, so this run cannot compare versions. The methodological point is to name the baseline actually evaluated, include a training-data MFS comparison when testing the value of context, and report the inventory, the test set, and the evaluation conditions. A figure with two bars is not evidence of state-of-the-art performance. It is evidence that the pipeline runs and that the comparison is possible. The real value of the implementation is the transparency. You can inspect the synsets, the glosses, the overlap words, and the scores. You can see where the method succeeds and where it fails. That transparency is useful for learning and for debugging.
Key Parameters
The key parameters for this Word-Sense Disambiguation implementation are:
- use_hypernyms: Whether to extend each sense gloss with its hypernym definitions. Including hypernyms broadens the evidence for a sense but can introduce noise from related concepts.
- Gloss source (definition, examples, hypernyms): Which parts of a synset are concatenated into the gloss document. Adding examples adds their preprocessed word types to the signature; whether new types or matches appear depends on the existing signature and context.
- STOPWORDS: The stopword set applied before stemming. Changing this set changes which overlap cues survive; evaluate the choice on the intended domain.
- Stemmer: The morphological normalizer (Porter stemmer here). Stemming reconciles inflections but can collapse distinct lexemes.
- TfidfVectorizer(stop_words="english"): The vectorizer configuration for the gloss vector baseline. The stop-word setting and tokenization affect cosine similarities.
- This Lesk implementation sorts by descending overlap count, then by synset name. The TF-IDF example reverses the similarity index order returned by
argsort.
Each parameter is a design choice with tradeoffs. The use_hypernyms flag controls whether the system looks beyond the immediate gloss. Including hypernyms can help when the gloss is short. It can also introduce evidence that is too general. The gloss source determines how much text is available for matching. Definitions are concise. Examples are closer to natural usage. Hypernyms provide broader context. The stopword list controls which words are ignored. A large list can reduce noise but may remove useful words. The stemmer controls morphological normalization. Stemming helps with inflections but can conflate words that should remain distinct. The vectorizer settings control tokenization, weighting, and stopword removal. The tie-breaking order controls what happens when scores are equal. None of these choices is universally correct. They should be tuned for the inventory, the domain, and the evaluation goal.
Limitations and Impact
The first limitation is conceptual. Word senses are not natural kinds with crisp boundaries. They are lexicographic constructs designed to serve dictionary users, translators, and computational systems. Different inventories draw the boundaries differently, and even trained annotators disagree. A model's "error" may sometimes reflect a defensible alternative analysis, but annotator disagreement does not itself impose an upper bound below 100% on agreement with a fixed adjudicated gold set. When you report WSD accuracy, you are reporting agreement with a particular inventory and annotation guideline, not agreement with semantic truth. This distinction is important for interpreting results. A model that disagrees with the gold label may still have made a defensible semantic choice. A model that agrees with the gold label may have chosen it for the wrong reason. Evaluation measures agreement, not understanding.
The second limitation is practical. An explicit WSD module adds decisions about the inventory, integration, and evaluation. New or maintained sense annotation may also be needed, depending on the method and the available resources. Its value should be tested in the intended application. A translation model can choose a contextual translation without emitting a WordNet label; a classifier can predict sentiment directly from a phrase. Explicit labels remain useful when an application needs inspectable lexical decisions or links to a lexical resource. Benchmark improvements and downstream improvements are separate measurements, so a historical benchmark score alone cannot decide which architecture to use.
The third limitation is evaluation. Public WSD benchmark examples may overlap LLM pretraining data. Option order and wording can affect prompted WSD results. A candidate-choice prompt and free-form generation have different output interfaces. Report the label matching and scoring rules for the interface you use. If the task requires an inventory identifier, constrain decoding or validate the returned identifier. Report the inventory and your contamination checks. Choose a baseline that tests the claimed improvement. You should also consider human evaluation for cases where the inventory is ambiguous or the model's explanation is plausible but the label is wrong. Evaluation is not a single number. It is a protocol with assumptions. The assumptions should be stated and checked.
The fourth limitation is coverage. A fixed inventory may lack an entry or a distinction required in a target domain. Check the selected release against actual vocabulary and usages; English Princeton WordNet coverage does not establish the coverage of a multilingual derivative. Target-domain evaluation can reveal changes in context, sense priors, or inventory coverage. Adapt the model, priors, data, or inventory when those checks show a need. In multilingual settings, word alignment and label mappings can also introduce errors. A large entry count alone does not show that the resource represents the distinctions an application needs.
Three applications show why a sense distinction can matter. A translation system must choose an appropriate target-language expression for the context; the bank examples contrast banque and rive. A retrieval system can use typed lexical relations for query expansion, with precision/recall effects measured on its queries. A sentiment resource can associate different scores with different senses, as SentiWordNet does at synset level. These uses do not all require a separate WSD module. Evaluate the output the application needs, whether it is a translation, a ranked document list, a sentiment decision, or an explicit sense identifier.
The following chapters examine sentence meaning, semantic roles, relation extraction, and entity linking. Keep each task's output contract explicit. This chapter assigned inventory senses; the later tasks introduce their own targets and output definitions.
For practitioners, a few guidelines are worth keeping:
- Define the inventory before you build the system. A WSD result is meaningless without a clear label space and version.
- Report a training-data MFS baseline or clearly label a first-WordNet-sense proxy. Add other baselines that test the particular claimed improvement.
- Report results by part of speech and frequency band when those groups matter to the task. Aggregate accuracy can hide poor performance on rare senses.
- Consider coarse-grained evaluation when fine distinctions are unstable, disclose the merged distinctions, and measure reliability and application usefulness.
- Control for contamination and prompt sensitivity when using LLMs. A public benchmark score is not enough.
- Consider whether explicit WSD is necessary. Sometimes a sense-aware representation helps; sometimes an end-to-end model is better.
These guidelines are not a checklist for every project. They are a set of questions to ask before making claims. The most important question is the first one: what is the inventory? Without a clear answer, the rest of the evaluation is unreliable. The second most important question is whether the system beats the baseline. If it does not, investigate the tradeoff and test whether a different benefit, such as rare-sense accuracy, justifies the complexity. The third is whether the evaluation measures what the application needs. A system that performs well on a general benchmark may fail on a specialized domain. A system that performs well on common senses may fail on rare senses. A system that performs well on a public benchmark may fail on a new test set. These questions help connect lexical semantics to practical language AI.
Summary
Lexical semantics studies how words carry meaning, how senses relate, and how context selects among them. The core units are word forms, lemmas, lexemes, and senses. Polysemy is the association of one lexeme with multiple related senses. Homonymy is the association of one form with unrelated meanings. Synonymy concerns sameness of meaning at the chosen granularity. Near-synonyms can differ in register, collocation, or connotation. These distinctions matter because they determine what a computational system is representing. A token is not a lemma. A lemma is not a sense. An inventory sense label is a representation, distinct from the entity or situation a particular use refers to. Each level has its own role in the pipeline.
Sense inventories provide the label space for WSD. WordNet organizes words into synsets. Semantic relations such as hypernymy and meronymy connect synsets, and lexical relations such as antonymy connect words in particular senses. FrameNet describes frames and frame elements. The documented English OntoNotes inventory groups finer WordNet distinctions. BabelNet, Wiktionary, and domain resources fill other coverage needs. Inventory mismatch is a first-class problem: results are not comparable across inventories without explicit mapping. The choice of inventory affects the difficulty of the task, the meaning of an accuracy score, and the usefulness of the result for downstream applications.
WSD is the task of choosing the intended sense of a word in context. In the presented Bayesian formulation, the decision rule combines a sense prior with a context likelihood. A discriminative classifier can estimate the posterior directly. The MFS baseline measures how often the senses selected from training counts match the gold labels on the evaluated targets. Knowledge-based methods such as Lesk use gloss overlap. Supervised methods learn classifiers from sense-tagged data. Contextual embeddings and neural models represent each token in context, enabling sense classification, sense embedding comparison, and Word-in-Context evaluation. LLMs offer prompt-based WSD; validate their output identifiers, disclose prompt and candidate choices, and investigate contamination when interpreting benchmark scores. Each approach has strengths and weaknesses. The best choice depends on the inventory, the domain, the data, and the task.
The hand-worked three-noun example showed how gloss overlap can select the riverbank sense. The executed all-POS implementation also exposed an error: the deposit sentence selected deposit.v.02 instead of the financial noun sense. The implementation demonstrated WordNet access, stemming, Lesk scoring, gloss vectors, and a tiny evaluation against an explicitly identified first-WordNet-sense proxy. The results illustrate the procedure and highlight both the power and the fragility of lexical overlap. Shared words can provide useful sense evidence, as the riverbank example shows. Exact overlap can be sparse. Inflections and synonyms can use different token strings. Those strings match only if preprocessing maps them to the same retained token. Supervised and contextual methods address some of these limitations, but they introduce their own challenges.
The practical choices are the inventory, candidate scope, evidence, and evaluation protocol. The code made one error visible: all-POS overlap selected a verb for the financial noun sentence. Use such inspected errors alongside aggregate scores when deciding which distinctions and interfaces an application needs. Next we move to sentence meaning and natural language inference.
Quiz
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about lexical semantics and word senses.
Lexical Semantics and Word Senses
Join the discussionAsk a question or share what you learned.
Keep exploring
Reference
Citation details
Cite or share this article.


Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!