Web Search and Mining: Lecture 2: Boolean Retrieval
Web Search and Mining: Lecture 2: Boolean Retrieval
Information Retrieval
2
Boolean Retrieval Unstructured Data
3
Boolean Retrieval Unstructured Data
4
Boolean Retrieval Unstructured Data
Term-document incidence
Antony and Cleopatra Julius Caesar The Tempest Hamlet Othello Macbeth
Antony 1 1 0 0 0 1
Brutus 1 1 0 1 0 0
Caesar 1 1 0 1 1 1
Calpurnia 0 1 0 0 0 0
Cleopatra 1 0 0 0 0 0
mercy 1 0 1 1 1 1
worser 1 0 1 1 1 0
Incidence vectors
So we have a 0/1 vector for each term.
To answer query:
take the vectors for Brutus, Caesar and Calpurnia
(complemented) bitwise AND.
7
Boolean Retrieval Unstructured Data
Answers to query
Antony and Cleopatra, Act III, Scene ii
Agrippa [Aside to DOMITIUS ENOBARBUS]: Why, Enobarbus,
When Antony found Julius Caesar dead,
He cried almost to roaring; and he wept
When at Philippi he found Brutus slain.
8
Boolean Retrieval
Goal:
Retrieve documents with information that is relevant
to the users information need and helps the user
complete a task
9
Boolean Retrieval
SEARCH
ENGINE
Query Results
Corpus
Refinement
Boolean Retrieval
11
Boolean Retrieval Inverted Index
Bigger collections
Consider N = 1 million documents, each with about
1000 words.
12
Boolean Retrieval Inverted Index
13
Boolean Retrieval Inverted Index
Inverted index
For each term t, we must store a list of all documents
that contain t.
Identify each by a docID, a document serial number
Can we used fixed-size arrays for this?
Inverted index
We need variable-size postings lists
On disk, a continuous run of postings is normal and best
In memory, can use linked lists or variable length arrays
Some tradeoffs in size/ease of insertion Posting
Dictionary Postings
Sorted by docID (more later on why).
15
Boolean Retrieval Inverted Index
Tokenizer
Token stream. Friends Romans Countrymen
More on Linguistic
these later. modules
Modified tokens. friend roman countryman
Indexer friend 2 4
roman 1 2
Inverted index.
countryman 13 16
Boolean Retrieval Inverted Index
Doc 1 Doc 2
Why frequency?
Will discuss later.
Boolean Retrieval Inverted Index
Terms
and
counts Later in the
course:
How do we
index
efficiently?
How much
storage do we
Pointers need?
20
Boolean Retrieval Query Processing
21
Boolean Retrieval Query Processing
2 4 8 16 32 64 128 Brutus
1 2 3 5 8 13 21 34 Caesar
22
Boolean Retrieval Query Processing
The merge
Walk through the two postings simultaneously, in
time linear in the total number of postings entries
2 4 8 16 32 64 128 Brutus
2 8
1 2 3 5 8 13 21 34 Caesar
24
Boolean Retrieval Query Processing
25
Boolean Retrieval Query Processing
28
Boolean Retrieval Query Optimization
Merging
What about an arbitrary Boolean formula?
(Brutus OR Caesar) AND NOT
(Antony OR Cleopatra)
Can we always merge in linear time?
Linear in what?
Can we do better?
29
Boolean Retrieval Query Optimization
Query optimization
Brutus 2 4 8 16 32 64 128
Caesar 1 2 3 5 8 16 21 34
Calpurnia 13 16
Brutus 2 4 8 16 32 64 128
Caesar 1 2 3 5 8 16 21 34
Calpurnia 13 16
32
Boolean Retrieval Query Optimization
Exercise
Recommend a query
processing order for
Term Freq
(tangerine OR trees) AND eyes 213312
(marmalade OR skies) AND kaleidoscope 87009
(kaleidoscope OR eyes) marmalade 107913
skies 271658
tangerine 46653
trees 316812
33
Boolean Retrieval Query Optimization
Proximity:
Find Gates NEAR Microsoft.
Need index to capture position information in docs.
Zones in documents:
Find documents with (author = Ullman) AND (text
contains automata).
35
Boolean Retrieval Beyond Term Search
Evidence accumulation
1 vs. 0 occurrence of a search term
2 vs. 1 occurrence
3 vs. 2 occurrences, etc.
Usually more seems better
36
Boolean Retrieval Beyond Term Search
37
Boolean Retrieval Unstructured Data
IR vs. databases:
Structured vs unstructured data
Structured data tends to refer to information in
tables
Employee Manager Salary
Smith Jones 50000
Chang Smith 60000
Ivy Smith 50000
Unstructured data
Typically refers to free text
Allows
Keyword queries including operators
More sophisticated concept queries e.g.,
find all web pages dealing with drug abuse
39
Boolean Retrieval Unstructured Data
Semi-structured data
In fact almost no data is unstructured
40
Boolean Retrieval
Issues:
how do you process about?
how do you rank results?
42
Boolean Retrieval
Question answering
Summarization
Text mining
44
Boolean Retrieval
Question?
45