Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

Lexical semantics and WordNet

Lexical semantics studies word meanings and relations (synonymy, antonymy, hypernymy, meronymy, polysemy) and WordNet is a widely used lexical database that organises meanings into synsets and semantic relations for use in NLP tasks like word-sense disambiguation and semantic similarity.

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

Two or three sentences: where an engineer uses this.

Lexical semantics gives engineers methods to represent and compare word meanings. WordNet is a practical resource used in word-sense disambiguation (WSD), semantic similarity, query expansion, and many NLP pipelines (search, information extraction, chatbots). Engineers use these ideas when designing features or rules that depend on meaning rather than raw words.

Key ideas

Build from first principles; define every term in bold when first used.

  • Lexical semantics: the study of how words represent meaning and how meanings of words relate to each other. Assumes meanings can be represented as labelled classes or relations usable by algorithms.

  • Sense: one distinct meaning of a word. A single word form can have multiple senses.

  • Polysemy: when a single word form has multiple related senses (example: "mouth" of a river and "mouth" of a person are related).

  • Homonymy: when a single word form has two or more unrelated senses (example: "bank" as financial institution and "bank" as river edge are often treated as homonyms if unrelated historically).

  • Synonymy: two words that can share at least one identical sense (example: "big" and "large" in many contexts). Synonymy is rarely perfect — context matters.

  • Antonymy: words with opposite meanings; often categorized as gradable (e.g., "hot"/"cold"), complementary (e.g., "alive"/"dead"), or relational/converse (e.g., "buy"/"sell").

  • Hypernym / Hyponym: a hypernym is a more general concept (superclass); a hyponym is a more specific concept (subclass). Exact statements: For concepts A and B, A is a hypernym of B if every instance of B is also an instance of A (B ⊆ A). This is an IS-A taxonomic relation.

  • Meronym / Holonym: meronymy is a part–whole relation (wheel is a meronym of car); holonym is the whole (car is holonym of wheel). In WordNet, meronymy is typed as part, member, or substance.

  • Troponymy: a verb-level relation where one verb is a manner-specific subtype of another ("to sprint" is a troponym of "to run").

  • Synset: in WordNet, a synset (short for synonym set) is a set of word senses that express a single concept; each synset has a gloss (short definition) and possibly example sentences.

  • Distributional hypothesis: words that appear in similar contexts have similar meanings. This provides a statistical foundation for many similarity measures.

  • Information content (IC): a measure of specificity of a concept derived from corpus probabilities. Exact definition: IC(c) = -log P(c), where P(c) is the probability of encountering concept c in a corpus (including occurrences of its hyponyms if using corpus-annotated synsets). IC assumes probabilities > 0.

  • WordNet structure: WordNet organises words into synsets linked by relations: hypernym/hyponym, antonym, meronym/holonym, troponym, verb frames, adjective satellites, etc. Nouns form a largely hierarchical IS-A DAG (not a single tree) with multiple inheritance, rooted under unique beginners such as "entity". Verbs form networks with troponymy and entailment. Similarity measures like path-based ones are typically defined within the same part of speech (e.g., noun–noun), and the lowest common subsumer (LCS) may not be unique in a DAG; measures usually pick the deepest/highest-IC subsumer.

  • Semantic similarity methods: two main families — path-based (use graph distances in WordNet) and information-based (use IC from corpus counts). Common path-based measures: shortest path length, Leacock–Chodorow (LCH), Wu–Palmer (WUP). Common IC-based measures: Resnik, Lin, Jiang–Conrath.

  • Assumptions behind measures: path-based assume graph distance correlates with semantic difference; IC-based assume corpus frequencies estimate specificity reliably.

  • When to use WordNet: best for English lexical relations and when sense inventories and explicit relations help (WSD, symbolic features). Not a substitute for distributional embeddings but often used together.

Diagram to draw (for exams): draw a rooted tree for nouns with root labelled "entity" at top. Below it branch to "physical entity" and "abstraction". Under "physical entity" draw "object" -> "vehicle" -> "car" -> synset containing lemmas "car, auto, automobile" with a gloss. Label edges "is-a" (hypernym). Draw a meronym arrow from "car" to "wheel" labelled "has-part".

Formulas

Each formula on its own line followed by symbol meanings and when it applies.

P(w) = freq(w) / N — P(w) is the probability of word (or synset) w; freq(w) is its corpus frequency; N is total token count of the corpus. Applies when estimating probabilities from a corpus.

IC(c) = -log P(c) — IC(c) is information content of concept c; log base may be 2 or e depending on convention (verify). No SI unit. Applies when P(c)>0 and P(c) is estimated from a corpus.

PMI(x,y) = log ( P(x,y) / (P(x)·P(y)) ) — pointwise mutual information between words x and y; P(x,y) is joint probability (co-occurrence). Log base 2 or e by convention. Higher PMI means stronger association.

shortest_path_sim = 1 / (1 + length) — a simple inverse relation: length is shortest path length between synsets in the IS-A graph. Applies for path-based intuition; not standard scoring but used in simple baselines.

LCH(x,y) = -log ( shortest_path_length(x,y) / (2·D) ) — Leacock–Chodorow similarity, where D is the maximum depth of taxonomy. Uses natural log commonly.

WUP(x,y) = 2·depth(LCS) / ( depth(x) + depth(y) ) — Wu–Palmer similarity; depth measured in edges from root; LCS is lowest common subsumer (deepest common hypernym).

Resnik(x,y) = IC( LCS(x,y) ) — Resnik similarity equals information content of lowest common subsumer.

Lin(x,y) = 2·IC(LCS) / ( IC(x) + IC(y) ) — Lin similarity; normalized, ranges 0..1 if IC values consistent.

JCN_dist(x,y) = IC(x) + IC(y) - 2·IC(LCS) — Jiang–Conrath distance; smaller means more similar. Sometimes converted to similarity by inverse transformation.

Symbols: P = probability (dimensionless), freq = token counts (unit: tokens), N = number of tokens (tokens), IC = information content (unit: bits if log base 2, nats if e), depth/length = integer counts of edges.

Worked examples

Two or three exam-standard worked examples.

Example 1 — numerical: compute PMI for co-occurrence

Data: corpus size N = 1,000,000 tokens. freq("doctor") = 5,000; freq("nurse") = 3,000; co-occurrence freq("doctor","nurse") in a sliding window = 800, counted over W = 1,000,000 windows.

Step 1: compute probabilities.

P(doctor) = 5000 / 1000000 = 0.005

P(nurse) = 3000 / 1000000 = 0.003

P(doctor,nurse) = 800 / W = 0.0008 (with W = 1,000,000 windows, matching N in this example)

Step 2: formula and calculation (use log base 2 here). PMI = log2( P(doctor,nurse) / (P(doctor)·P(nurse)) )

Compute denominator: P(doctor)·P(nurse) = 0.005·0.003 = 0.000015

Ratio = 0.0008 / 0.000015 = 53.333333...

PMI = log2(53.3333) ≈ 5.737 bits

Final answer: PMI(doctor,nurse) ≈ 5.74 bits (high association).

Example 2 — IC-based similarity (Resnik, Lin, Jiang–Conrath)

Given IC values (from a corpus) for two noun synsets s1 and s2 and their LCS:

IC(s1) = 5.2 (bits), IC(s2) = 4.6 (bits), IC(LCS) = 3.8 (bits).

Resnik similarity: Resnik = IC(LCS) = 3.8 (bits). Answer: 3.8.

Lin similarity: Lin = 2·IC(LCS) / (IC(s1) + IC(s2)) = 2·3.8 / (5.2 + 4.6) = 7.6 / 9.8 ≈ 0.7755. Answer: 0.776 (unitless, between 0 and 1).

Jiang–Conrath distance: JCN_dist = IC(s1) + IC(s2) - 2·IC(LCS) = 5.2 + 4.6 - 2·3.8 = 9.8 - 7.6 = 2.2 (bits). Smaller distance = more similar. Answer: 2.2.

Interpretation: Resnik gives the common information (3.8 bits); Lin normalises against specificities; JCN gives a distance.

Example 3 — theory model answer: Using WordNet for WSD (short exam-style answer)

Question: Describe how WordNet can be used to perform supervised or knowledge-based WSD for the word "bank" in the sentence "I sat on the bank and watched the water flow." Provide steps.

Model answer (step-by-step):

  1. Identify the target word "bank" and retrieve its possible synsets in WordNet, e.g. synset_b1 = bank (financial institution), synset_b2 = bank (sloping land beside a body of water), synset_b3 = bank (pile of objects), etc., each with glosses.
  2. Build context vector: collect local context words (sat, watched, water, flow). Optionally include POS tags (bank is noun here).
  3. For each candidate synset, form a gloss + example word set (gloss words for synset_b2 include "sloping", "river", "edge", etc.).
  4. Use Lesk-like overlap: compute overlap between context words and synset gloss words — the synset with highest overlap wins. Here synset_b2 overlaps with "water" and "flow", so select synset_b2.
  5. Optionally, use semantic similarity features: compute similarity between context words (e.g. "water") and candidate synsets using Resnik/WUP; choose synset with highest aggregated similarity.
  6. For supervised WSD, prepare labeled examples using WordNet synset IDs as labels and train a classifier using context features.

Conclusion: WordNet provides senses, glosses and relations that allow knowledge-based disambiguation (gloss overlap) and features for supervised learning.

Common mistakes

  • Using raw frequencies instead of probabilities when computing IC (IC needs a probability estimate P(c)).
  • Forgetting to include hyponym counts when computing P(c) for a synset (many IC calculations sum counts of hyponyms into the higher concept).
  • Mixing up path length and depth: path length is number of edges between two nodes; depth is number of edges from root to a node.
  • Assuming path-based distance scales linearly with semantic difference — tree shape biases distances; normalization matters (use LCH or WUP when needed).
  • Using PMI without a smoothing strategy: rare events produce high PMI; thresholding or positive PMI (PPMI) sometimes used.

For your exam

Kinds of questions and what full-marks answers include:

  • Definitions: define lexical-semantic terms (synset, hypernym, hyponym, meronym, IC, PMI). Full marks: clear definition and short example.
  • Short notes: explain WordNet structure or distributional hypothesis. Full marks: name components (synsets, gloss, relations) and give usage examples.
  • Derivations: derive PMI from joint/independent probability and show interpretation. Full marks: show formula, manipulate probabilities, explain sign and limits.
  • Numericals: compute PMI or Resnik/Lin/JCN given frequencies or ICs. Full marks: show stepwise calculations, intermediate probabilities, and units (bits or nats).
  • Diagrams: draw a small WordNet-like taxonomy (root, branches, synsets) and label hypernym/meronym edges. Full marks: correct structure and labelled relations.
  • Programs (rare here): you may be asked to write a short script that looks up WordNet senses using NLTK. Full marks: correct library calls, correct synset IDs.

Quick check

Three short questions:

  1. What is a synset? 2. Write the PMI formula. 3. What is a hypernym?

Answers: 1. A synset is a set of word senses expressing one concept (with a gloss). 2. PMI(x,y) = log( P(x,y) / (P(x)·P(y)) ). 3. A hypernym is a more general concept (superclass) such that the hyponym's instances are included in it.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?