Skip to content

Unit 1 · Introduction to Information Retrieval & Text Mining

3 h contact · 5 h self study Prerequisites: none CLO 1

1. Setting the scene

Scenario: The question nobody can answer

Lena works for the Berlin district office. Her manager asks:

"Which council decisions since 2019 affected cycling infrastructure in Friedrichshain, and what did citizens complain about afterwards?"

The answer exists somewhere in two million PDFs and a stream of citizen messages. The existing database can answer WHERE district = 'Friedrichshain', but it cannot answer "about cycling". Lena spends two days opening files by hand.

Guiding questions

  1. Why can't a relational database answer Lena's question?
  2. Is Lena looking for documents or for patterns? Does it matter?
  3. What does "relevant" mean, and who decides?

2. Intended learning outcomes

By the end of this unit you will be able to:

# Outcome Bloom CLO
ILO 1.1 Distinguish data, information and knowledge with examples. UNDERSTAND 1
ILO 1.2 Differentiate Information Retrieval, Text Mining, Data Mining and database querying. ANALYSE 1
ILO 1.3 Define Information Retrieval and identify the elements of an IR process. REMEMBER 1
ILO 1.4 Explain why text must be transformed into a mathematical representation, and why IR returns ranked results. UNDERSTAND 1

3. From data to knowledge

Before we retrieve anything, we need a shared vocabulary.

flowchart BT
    D["<b>Data</b><br/>raw facts, no inherent meaning<br/><i>42, 98, 13</i>"]
    I["<b>Information</b><br/>processed, contextualised data<br/><i>Berlin temperatures: 13°C, 18°C, 21°C</i>"]
    K["<b>Knowledge</b><br/>interpreted and applied information<br/><i>warm weather → higher crop yield</i>"]
    D -->|"add context"| I -->|"interpret and apply"| K

"Data is the new oil." (Clive Humby, 2006)

The analogy is useful precisely because crude oil is worthless until it is refined. Commonly cited estimates put global data creation in the hundreds of millions of terabytes per day and on the order of 180 zettabytes per year by 2025, yet almost all of it is irrelevant to a given person at a given moment unless it can be retrieved and organised effectively. That is the job of this course.

4. Search versus discovery

Two dimensions separate the fields we meet in this course: the type of data (structured vs. text) and the mode of use (a known need vs. open exploration).

Goal oriented search (known information need) Opportunistic discovery (unknown patterns)
Structured data Query processing (SQL) Data Mining
Text Information Retrieval Text Mining
flowchart LR
    Q["Known need<br/>'find documents about X'"] --> IR["Information Retrieval<br/>match · rank · return"]
    E["Open exploration<br/>'what is in here?'"] --> TM["Text Mining<br/>topics · sentiment · clusters · classes"]
    IR --> U["Useful knowledge"]
    TM --> U

Back to Lena

Lena's question has both parts: finding the council decisions is an IR task; summarising what citizens complained about is a text mining task. Modern systems such as search engines, recommender systems, chatbots and RAG pipelines combine the two.

Four ways to get value from data

quadrantChart
    title Where does a task belong?
    x-axis Structured data --> Unstructured text
    y-axis Opportunistic discovery --> Goal oriented search
    quadrant-1 Information Retrieval
    quadrant-2 Database querying
    quadrant-3 Data Mining
    quadrant-4 Text Mining
    Permits issued in May: [0.15, 0.85]
    Council decisions on cycling: [0.85, 0.85]
    Forecast of permit demand: [0.2, 0.2]
    Topics in citizen complaints: [0.85, 0.2]

5. Text Mining

Text Mining is the discovery of patterns and insights from text data.

flowchart LR
    T["Text data<br/>reviews, emails, reports"] --> P["Processing<br/>NLP · machine learning"] --> I["Insights<br/>meaning and patterns"]

Typical tasks: sentiment analysis of product reviews, topic discovery, clustering, classification, summarisation, information extraction.

The core problem

Machines cannot directly understand text, and machine learning algorithms require numerical input. So the central question of the entire course is:

How can we transform text into a mathematical representation that supports ranking, classification and clustering?

The classic answer is the Vector Space Model (Salton, Wong & Yang, 1975), which we develop in Unit 7; modern answers include dense embeddings (Unit 9).

6. Information Retrieval

Definition (Manning, Raghavan & Schütze, 2008)

Information Retrieval (IR) is finding material (usually documents) of an unstructured nature (usually text) that satisfies an information need from within large collections (usually stored on computers).

Read the definition word by word, because each word is a design decision:

Word Meaning in practice
finding Not storing or browsing: actively locating
material A document, page, email, section or passage (what counts as a "document" is a design choice: see Unit 3)
unstructured No fixed schema; language is ambiguous
information need What the user wants, which is not always what they type
large collections Too much to scan manually or sequentially

Elements of an IR process

flowchart TB
    U(("User")) -->|"has"| N["Information need<br/><i>conscious or unconscious</i>"]
    N -->|"expressed as"| Q["Query<br/><i>'Olympics in London'</i>"]
    R["Information resources<br/><i>text, images, audio, video</i>"] --> M
    Q --> M["Retrieval model<br/>scores relevance"]
    M --> L["Ranked list<br/>d3 (0.94) · d1 (0.89) · d7 (0.83)"]
    L -.->|"feedback"| U
  • Information need: an individual's or group's desire to obtain information to satisfy a requirement. In text retrieval it is expressed as words or phrases; in image retrieval, the query can itself be an image.
  • Information resources: typically unstructured content such as text, images, video and audio.
  • Retrieval model: the method that identifies resources relevant to the need, usually from a very large collection.
sequenceDiagram
    actor L as Lena
    participant QP as Query processing
    participant IX as Index
    participant RK as Ranking
    L->>QP: cycling Friedrichshain
    QP->>QP: tokenise, normalise (U3)
    QP->>IX: look up cycl, friedrichshain
    IX-->>RK: candidates (U4 to U6)
    RK->>RK: score (U7, U8)
    RK-->>L: top 10 results
    L->>RK: opens result 3 (feedback)

Every later unit of this course improves one lifeline of this diagram.

Search → ranking → retrieval

Level Question it answers Example
Search Where does the keyword occur? grep cycling
Ranking In which order should results be shown? sort by a relevance score
Retrieval What matters most for this need? combine words, meaning, quality

Relevance scores

Most retrieval models compute a relevance score instead of a yes/no match. A score of 0.9 means the document matches the query more closely than a document with 0.3. Documents are sorted from most to least relevant. Because language is ambiguous, these scores always carry uncertainty (the starting point of Unit 8).

Worked example

Query: "inflation unemployment" → match words and meaning → ranked output:

  1. Inflation and jobs: 0.94
  2. Monetary policy: 0.89
  3. Labor market trends: 0.83

Notice that result 3 may not contain either query word. Retrieval goes beyond keyword search.

Measuring success: precision and recall

How do we know whether a result list is good? We compare the retrieved set with the relevant set (judged by humans).

flowchart LR
    subgraph C["Collection"]
      direction LR
      A["Relevant,<br/>not retrieved<br/>(missed)"]
      B["Relevant AND<br/>retrieved<br/>(hits)"]
      D["Retrieved,<br/>not relevant<br/>(noise)"]
    end
    A --- B --- D
\[ \text{Precision} = \frac{|\text{Rel} \cap \text{Ret}|}{|\text{Ret}|}, \qquad \text{Recall} = \frac{|\text{Rel} \cap \text{Ret}|}{|\text{Rel}|}, \qquad F_1 = \frac{2 \cdot P \cdot R}{P + R} \]

Worked example: Lena's first query

The archive contains 8 documents that really answer Lena's question. The system returns 10 results; these are relevant at ranks 1, 3, 4, 7 and 10.

\[ P = \frac{5}{10} = 0.5, \qquad R = \frac{5}{8} = 0.625, \qquad F_1 = \frac{2 \cdot 0.5 \cdot 0.625}{1.125} \approx 0.56 \]

Because users read from the top, we also measure precision at rank \(k\) and recall at rank \(k\) as the list grows:

xychart-beta
    title "Precision and recall down the result list"
    x-axis "Rank k" [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    y-axis "Value" 0 --> 1
    line [1.0, 0.5, 0.67, 0.75, 0.6, 0.5, 0.57, 0.5, 0.44, 0.5]
    line [0.12, 0.12, 0.25, 0.38, 0.38, 0.38, 0.5, 0.5, 0.5, 0.62]

Upper line at the start: precision; rising line: recall. Recall can only grow with \(k\); precision usually falls.

Two single number summaries reward systems that put relevant documents early:

\[ \text{AP} = \frac{1}{|\text{Rel}|} \sum_{k:\,\text{doc}_k \text{ relevant}} P@k, \qquad \text{nDCG}@k = \frac{\sum_{i=1}^{k} \dfrac{rel_i}{\log_2(i+1)}}{\text{IDCG}@k} \]

Worked example, continued

\(\text{AP} = \frac{1}{8}\left(1 + \frac{2}{3} + \frac{3}{4} + \frac{4}{7} + \frac{5}{10}\right) = \frac{3.49}{8} \approx 0.44\).

\(\text{DCG}@10 = 1 + 0.5 + 0.431 + 0.333 + 0.289 = 2.55\); the ideal list (8 relevant documents first) gives \(\text{IDCG}@10 = 3.95\), so \(\text{nDCG}@10 \approx 0.65\).

We use these measures in every ranking unit and in the project evaluation.

Why text IR matters

Unstructured information is growing in every domain: companies (manuals, contracts), governments (regulations, legal texts), science (papers), personal (email, notes) and the web, which is the largest and most diverse collection of all. The challenge is always the same: find relevant information efficiently at large scale.

7. Classwork

Classify the task (10 min, pairs)

For each task decide: Database query, Data Mining, Information Retrieval or Text Mining? Justify in one sentence.

  1. List all citizen messages received on 3 May 2026.
  2. Find the three regulations most relevant to "e scooter parking".
  3. Discover the main themes in 50,000 citizen complaints.
  4. Predict next month's number of pothole reports from past monthly counts.
  5. Decide whether a new message is about Traffic or Environment.
  6. Find the one council decision that introduced the Friedrichshain bike lane.
Model answers
  1. Database query: exact condition on a structured field (date).
  2. IR: known need, ranked text results.
  3. Text Mining: open exploration of patterns (topic modelling / clustering).
  4. Data Mining: patterns in structured numeric data (forecasting).
  5. Text Mining (text classification, Unit 9).
  6. IR: a known item search.

8. Check your understanding

Why is 'data is the new oil' a useful but incomplete analogy for this course?

Like crude oil, raw data has little value until refined. But unlike oil, data is not consumed when used, can be copied at no cost, and its value depends on retrieval and context: the same document can be highly relevant to one user and useless to another.

Give one reason why SQL cannot answer 'documents about cycling'.

SQL matches exact field values; "about cycling" is a vague information need expressed in natural language, with synonyms (bike, Radweg, bicycle lane) and graded relevance. IR ranks by degree of relevance rather than filtering by an exact condition.

Why do IR systems return ranked lists instead of sets?

Relevance is gradual and uncertain. Collections are large, so users need the most useful documents first; a set of 200,000 unordered matches is as unhelpful as zero matches.

9. Key takeaways

  • IR finds relevant text for a known need; Text Mining discovers patterns in text. Real systems combine both.
  • An IR process has three elements: an information need (expressed as a query), resources, and a retrieval model.
  • Text must be turned into numbers before machines can rank, classify or cluster it.
  • IR produces ranked results with uncertain relevance scores.

This unit prepares the problem statement section of your final project: Who is the user, what is the information need, and why does it matter? Start a one paragraph problem statement in your repository's README.md this week.

Further reading

  • Manning, Raghavan & Schütze, Introduction to Information Retrieval, ch. 1.
  • Allahyari et al. (2017), A brief survey of text mining: classification, clustering and extraction techniques, arXiv:1707.02919.
  • Salton, Wong & Yang (1975), A vector space model for automatic indexing, CACM 18(11).