0% found this document useful (0 votes)
12 views10 pages

C1 Intro

Uploaded by

Dihia Raab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views10 pages

C1 Intro

Uploaded by

Dihia Raab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

11/25/2015

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

Introducing Information Retrieval – These days we frequently think first of web search,
but there are many other cases:
and Web Search • E-mail search
• Searching your laptop
• Corporate knowledge bases
• Legal information retrieval

IR vs. databases:
Unstructured (text) vs. structured (database)
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

Typically allows numerical range and exact match


(for text) queries, e.g.,
Salary < 60000 AND Manager = Smith.
3 4

Unstructured data Semi-structured data


• Typically refers to free text • In fact almost no data is “unstructured”
• Allows • E.g., this slide has distinctly identified zones such
as the Title and Bullets
– Keyword queries including operators • … to say nothing of linguistic structure
– More sophisticated “concept” queries e.g., • Facilitates “semi-structured” search such as
• find all web pages dealing with drug abuse – Title contains data AND Bullets contain search
• Classic model for searching text documents • Or even
– Title is about Object Oriented Programming AND
Author something like stro*rup
– where * is the wild-card operator

5 6

1
11/25/2015

Sec. 1.1

Basic assumptions of Information Retrieval The classic search model


Get rid of mice in a
• Collection: A set of documents User task
politically correct way
– Assume it is a static collection for the moment Misconception?

Info need
Info about removing mice
without killing them
• Goal: Retrieve documents with information Misformulation?
that is relevant to the user’s information need
Query
and helps the user complete a task how trap mice alive Search

Search
engine

Query Results
Collection
7 refinement

Sec. 1.1

How good are the retrieved docs?


 Precision : Fraction of retrieved docs that are
relevant to the user’s information need Introduction to
 Recall : Fraction of relevant docs in collection Information Retrieval
that are retrieved
Term-document incidence matrices
 More precise definitions and measurements to
follow later

Sec. 1.1 Sec. 1.1

Unstructured data in 1620 Term-document incidence matrices


• Which plays of Shakespeare contain the words
Brutus AND Caesar but NOT Calpurnia?
• One could grep all of Shakespeare’s plays for Antony and Cleopatra Julius Caesar The Tempest Hamlet Othello Macbeth

Brutus and Caesar, then strip out lines containing Antony


Brutus
1
1
1
1
0
0
0
1
0
0
1
0
Calpurnia? Caesar
Calpurnia
1
0
1
1
0
0
1
0
1
0
1
0
• Why is that not the answer? Cleopatra
mercy
1
1
0
0
0
1
0
1
0
1
0
1
– Slow (for large corpora) worser 1 0 1 1 1 0

– NOT Calpurnia is non-trivial


– Other operations (e.g., find the word Romans near
countrymen) not feasible
– Ranked retrieval (best documents to return) 1 if play contains
Brutus AND Caesar BUT NOT
• Later lectures Calpurnia word, 0 otherwise
11

2
11/25/2015

Sec. 1.1 Sec. 1.1

Incidence vectors Answers to query


• So we have a 0/1 vector for each term. • Antony and Cleopatra, Act III, Scene ii
• To answer query: take the vectors for Brutus, Agrippa [Aside to DOMITIUS ENOBARBUS]: Why, Enobarbus,
When Antony found Julius Caesar dead,
Caesar and Calpurnia (complemented)  He cried almost to roaring; and he wept
bitwise AND. When at Philippi he found Brutus slain.

– 110100 AND Antony and Cleopatra Julius Caesar The Tempest Hamlet Othello Macbeth

– 110111 AND
Antony
Brutus
1
1
1
1
0
0
0
1
0
0
1
0
• Hamlet, Act III, Scene ii
Caesar 1 1 0 1 1 1 Lord Polonius: I did enact Julius Caesar I was killed i’ the
– 101111 = Calpurnia
Cleopatra
0
1
1
0
0
0
0
0
0
0
0
0
Capitol; Brutus killed me.
– 100100 mercy
worser
1
1
0
0
1
1
1
1
1
1
1
0

13 14

Sec. 1.1 Sec. 1.1

Bigger collections Can’t build the matrix


• Consider N = 1 million documents, each with • 500K x 1M matrix has half-a-trillion 0’s and 1’s.
about 1000 words.
• Avg 6 bytes/word including • But it has no more than one billion 1’s. Why?

spaces/punctuation – matrix is extremely sparse.


– 6GB of data in the documents.
• Say there are M = 500K distinct terms among • What’s a better representation?
these. – We only record the 1 positions.

15 16

Sec. 1.2

Inverted index
• For each term t, we must store a list of all documents
that contain t.
Introduction to – Identify each doc by a docID, a document serial number
Information Retrieval • Can we used fixed-size arrays for this?

The Inverted Index Brutus 1 2 4 11 31 45 173 174


The key data structure underlying Caesar 1 2 4 5 6 16 57 132
modern IR Calpurnia 2 31 54 101
What happens if the word Caesar
is added to document 14?
18

3
11/25/2015

Sec. 1.2 Sec. 1.2

Inverted index Inverted index construction


• We need variable-size postings lists Documents to Friends, Romans, countrymen.
be indexed
– On disk, a continuous run of postings is normal and best
– In memory, can use linked lists or variable length arrays
Token stream Tokenizer Friends Romans Countrymen
• Some tradeoffs in size/ease of insertion Posting

Brutus 1 2 4 11 31 45 173 174 Modified tokens Linguistic modules friend roman countryman
Caesar 1 2 4 5 6 16 57 132
Calpurnia 2 31 54 101
Indexer friend 2 4

Dictionary Postings roman 1 2


Inverted index
Sorted by docID (more later on why). 19 countryman 13 16

Sec. 1.2

Initial stages of text processing Indexer steps: Token sequence


• Tokenization • Sequence of (Modified token, Document ID) pairs.
– Cut character sequence into word tokens
• Deal with “John’s”, a state-of-the-art solution
• Normalization
– Map text and query term to same form
• You want U.S.A. and USA to match
• Stemming Doc 1 Doc 2
– We may wish different forms of a root to match
• authorize, authorization I did enact Julius So let it be with
• Stop words Caesar I was killed Caesar. The noble
i’ the Capitol; Brutus hath told you
– We may omit very common words (or not) Brutus killed me. Caesar was ambitious
• the, a, to, of

Sec. 1.2 Sec. 1.2

Indexer steps: Sort Indexer steps: Dictionary & Postings


• Sort by terms • Multiple term entries
– And then docID in a single document
are merged.
• Split into Dictionary
and Postings
• Doc. frequency
Core indexing step information is added.

Why frequency?
Will discuss later.

4
11/25/2015

Sec. 1.2

Where do we pay in storage?

Lists of
docIDs Introduction to
Terms Information Retrieval
and
counts
IR system
implementation Query processing with an inverted index
• How do we
index efficiently?
• How much
storage do we
need?
Pointers 25

Sec. 1.3 Sec. 1.3

The index we just built Query processing: AND


• How do we process a query? Our focus • Consider processing the query:
– Later - what kinds of queries can we process? Brutus AND Caesar
– Locate Brutus in the Dictionary;
• Retrieve its postings.
– Locate Caesar in the Dictionary;
• Retrieve its postings.
– “Merge” the two postings (intersect the document
sets):
2 4 8 16 32 64 128 Brutus
1 2 3 5 8 13 21 34 Caesar
27 28

Sec. 1.3

Intersecting two postings lists


The merge
(a “merge” algorithm)
• Walk through the two postings
simultaneously, in time linear in the total
number of postings entries
2 4 8 16 32 64 128 Brutus
1 2 3 5 8 13 21 34 Caesar

If the list lengths are x and y, the merge takes O(x+y)


operations.
Crucial: postings sorted by docID.
29 30

5
11/25/2015

Sec. 1.3

Boolean queries: Exact match


• The Boolean retrieval model is being able to ask a
Introduction to query that is a Boolean expression:
Information Retrieval – Boolean Queries are queries using AND, OR and NOT
to join query terms
• Views each document as a set of words
The Boolean Retrieval Model • Is precise: document matches condition or not.

& Extended Boolean Models – Perhaps the simplest model to build an IR system on
• Primary commercial retrieval tool for 3 decades.
• Many search systems you still use are Boolean:
– Email, library catalog, Mac OS X Spotlight
32

Sec. 1.4 Sec. 1.4

Example: WestLaw http://www.westlaw.com/ Example: WestLaw http://www.westlaw.com/

• Largest commercial (paying subscribers) • Another example query:


legal search service (started 1975; ranking – Requirements for disabled people to be able to
added 1992; new federated search added access a workplace
2010) – disabl! /p access! /s work-site work-place
• Tens of terabytes of data; ~700,000 users (employment /3 place
• Majority of users still use boolean queries • Note that SPACE is disjunction, not conjunction!
• Example query: • Long, precise queries; proximity operators;
– What is the statute of limitations in cases
incrementally developed; not like web search
involving the federal tort claims act? • Many professional searchers still like Boolean
– LIMIT! /3 STATUTE ACTION /S FEDERAL /2 search
TORT /3 CLAIM – You know exactly what you are getting
• /3 = within 3 words, /S = in same sentence • But that doesn’t mean it actually works better….
33

Sec. 1.3 Sec. 1.3

Query optimization Query optimization example


• Process in order of increasing freq:
• What is the best order for query processing?
– start with smallest set, then keep cutting further.
• Consider a query that is an AND of n terms.
• For each of the n terms, get its postings, then This is why we kept
AND them together. document freq. in dictionary

Brutus 2 4 8 16 32 64 128 Brutus 2 4 8 16 32 64 128


Caesar 1 2 3 5 8 16 21 34 Caesar 1 2 3 5 8 16 21 34
Calpurnia 13 16 Calpurnia 13 16

Query: Brutus AND Calpurnia AND Caesar Execute the query as (Calpurnia AND Brutus) AND Caesar.
35
36

6
11/25/2015

Sec. 1.3

More general optimization


• e.g., (madding OR crowd) AND (ignoble OR
strife) Introduction to
• Get doc. freq.’s for all terms.
Information Retrieval
• Estimate the size of each OR by the sum of its
doc. freq.’s (conservative).
Phrase queries and positional indexes
• Process in increasing order of OR sizes.

37

Sec. 2.4 Sec. 2.4.1

Phrase queries A first attempt: Biword indexes


• We want to be able to answer queries such as • Index every consecutive pair of terms in the text
“stanford university” – as a phrase as a phrase
• Thus the sentence “I went to university at • For example the text “Friends, Romans,
Stanford” is not a match. Countrymen” would generate the biwords
– The concept of phrase queries has proven easily
understood by users; one of the few “advanced – friends romans
search” ideas that works – romans countrymen
– Many more queries are implicit phrase queries • Each of these biwords is now a dictionary term
• For this, it no longer suffices to store only • Two-word phrase query-processing is now
<term : docs> entries immediate.

Sec. 2.4.1 Sec. 2.4.1

Longer phrase queries Issues for biword indexes


• Longer phrases can be processed by breaking • False positives, as noted before
them down
• stanford university palo alto can be broken into • Index blowup due to bigger dictionary
the Boolean query on biwords: – Infeasible for more than biwords, big even for
stanford university AND university palo AND palo them
alto

Without the docs, we cannot verify that the docs


• Biword indexes are not the standard solution
matching the above Boolean query do contain (for all biwords) but can be part of a
the phrase. compound strategy
Can have false positives!

7
11/25/2015

Sec. 2.4.2 Sec. 2.4.2

Solution 2: Positional indexes Positional index example


• In the postings, store, for each term the
<be: 993427;
position(s) in which tokens of it appear:
1: 7, 18, 33, 72, 86, 231;
Which of docs 1,2,4,5
2: 3, 149; could contain “to be
4: 17, 191, 291, 430, 434; or not to be”?
<term, number of docs containing term;
doc1: position1, position2 … ; 5: 363, 367, …>
doc2: position1, position2 … ;
• For phrase queries, we use a merge
etc.> algorithm recursively at the document level
• But we now need to deal with more than
just equality

Sec. 2.4.2 Sec. 2.4.2

Processing a phrase query Proximity queries


• Extract inverted index entries for each distinct • LIMIT! /3 STATUTE /3 FEDERAL /2 TORT
term: to, be, or, not. – Again, here, /k means “within k words of”.
• Merge their doc:position lists to enumerate all • Clearly, positional indexes can be used for
positions with “to be or not to be”.
such queries; biword indexes cannot.
– to:
• Exercise: Adapt the linear merge of postings to
• 2:1,17,74,222,551; 4:8,16,190,429,433; 7:13,23,191; ... handle proximity queries. Can you make it
– be: work for any value of k?
• 1:17,19; 4:17,191,291,430,434; 5:14,19,101; ... – This is a little tricky to do correctly and efficiently
• Same general method for proximity searches – See Figure 2.12 of IIR

Sec. 2.4.2 Sec. 2.4.2

Positional index size Positional index size


• A positional index expands postings storage • Need an entry for each occurrence, not just
substantially once per document
– Even though indices can be compressed • Index size depends on average document sizeWhy?
• Nevertheless, a positional index is now – Average web page has <1000 terms
standardly used because of the power and – SEC filings, books, even some epic poems … easily
usefulness of phrase and proximity queries … 100,000 terms
whether used explicitly or implicitly in a • Consider a term with frequency 0.1%
Document size Postings Positional postings
ranking retrieval system.
1000 1 1
100,000 1 100

8
11/25/2015

Sec. 2.4.2 Sec. 2.4.3

Rules of thumb Combination schemes


• A positional index is 2–4 as large as a non- • These two approaches can be profitably
combined
positional index – For particular phrases (“Michael Jackson”, “Britney
Spears”) it is inefficient to keep on merging positional
postings lists
• Positional index size 35–50% of volume of • Even more so for phrases like “The Who”
original text • Williams et al. (2004) evaluate a more
sophisticated mixed indexing scheme
– A typical web query mixture was executed in ¼ of the
– Caveat: all of this holds for “English-like” time of using just a positional index
languages – It required 26% more space than having a positional
index alone

Exercices
• Soit la collection suivante :

• Ecrire la matrice d’incidence terme-document (term-


document incidence matrix)
• Ecrire l’indexe inversé (inverted index)
• Que retourne les requêtes :
– Schizophrenia AND drug
– For AND NOT (drug OR approach)

Exercise Exercices
• For a collection of 500000 • Soit un « biword index ». Donnez un exemple de document
Term Freq
documents recommend a query retourné pour la requête « bibliothèque scientifique
eyes 213312
processing order for d’Evry » qui est en fait un faux positif.
kaleidoscope 87009
(tangerine OR trees) AND marmalade 107913
(marmalade OR skies) AND skies 271658
• Ecrire le « biword index » de la collection précédente
(kaleidoscope OR eyes) tangerine 46653
trees 316812

• Which two terms should we process


first?

• If the query is eyes AND skies


AND (NOT trees), how could we
use the freq of trees ? 53

9
11/25/2015

Exercices
• Soit le « positional index » suivant :

• Quels documents sont retournés par les phrases


de recherche suivante :
– « fools rush in »
– « fools rush in » AND « angels fear to tread »

10

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy