Natural Language Processing · TEE · mocks

Q7B · Corpora and Jaccard similarity

Timed practice · Solved final paper · December 2025

TEE · actual previous paper · 100 marks · 180 minutes

Question. i. Differentiate between a flat text corpus and an annotated corpus, and discuss how each can be applied in various NLP tasks with suitable examples.
ii. Explain a real-world scenario where the Jaccard Similarity measure is more appropriate than Euclidean or Manhattan distance, and justify why Jaccard is the best choice in that case. [10 marks]

Answer

i. Flat and annotated corpora

A corpus is a collection of language data. A flat text corpus stores text without the linguistic labels needed by a particular task. An annotated corpus adds labels or structure such as POS tags, entity spans, parse trees or sentence sentiment.

BasisFlat text corpusAnnotated corpus
ExampleA collection of plain news articlesThe same articles with PERSON/ORG spans marked
InformationThe original text and possibly simple metadataText plus explicit task-related linguistic labels
ApplicationsWord frequency, collocations and unsupervised language-model trainingSupervised POS tagging, NER or parser training and evaluation
PreparationRelatively inexpensive to gather, but still needs cleaningRequires annotation guidelines, labour and quality checks

“Flat” describes the lack of the annotations being discussed, not an absence of all file organization. Both corpus types may still have document boundaries and metadata.

ii. Jaccard in a set-based application

Consider recommending articles using their topic-tag sets. Article A has {AI, NLP, ethics}; article B has {AI, NLP, healthcare}. We care about overlap among present tags, not how many irrelevant tags are absent from both.

Given

A = {AI, NLP, ethics}; B = {AI, NLP, healthcare}.

To find

The fraction of distinct present tags shared by the articles.

Formula and why

J(A,B)=\frac{|A\cap B|}{|A\cup B|}LaTeX: J(A,B)=\frac{|A\cap B|}{|A\cup B|}

The intersection counts common items; the union counts all distinct items present in either set.

Step 1. Find common tags

A ∩ B = {AI, NLP}, so the intersection size is 2.

Step 2. Find all distinct present tags

A ∪ B = {AI, NLP, ethics, healthcare}, so the union size is 4.

Step 3. Divide

J(A,B)=\frac24=0.5LaTeX: J(A,B)=\frac24=0.5

Jaccard directly measures proportional overlap and ignores joint absences. Euclidean or Manhattan distance on binary tag vectors counts mismatches but does not by itself normalize by the union size. If frequency or magnitude were meaningful, those distance measures could be more appropriate. Here, membership-only tags and sparse sets make Jaccard a suitable choice.

Yaad rakho: Jaccard: common present items / total distinct present items.