Informa(on ¡Retrieval ¡
Introduc(on ¡
Debapriyo Majumdar Information Retrieval – Spring 2015 Indian Statistical Institute Kolkata
Informa(on Retrieval Introduc(on Debapriyo Majumdar Information - - PowerPoint PPT Presentation
Informa(on Retrieval Introduc(on Debapriyo Majumdar Information Retrieval Spring 2015 Indian Statistical Institute Kolkata Back in those days Once upon a time in the world, there were days without search engines
Debapriyo Majumdar Information Retrieval – Spring 2015 Indian Statistical Institute Kolkata
2 ¡
Once upon a time in the world, there were days without search engines We had access to much smaller amount of information Had to find information manually
3 ¡
User needs some information
Assumption: the required information is present somewhere
A search engine tries to bridge this gap
4 ¡
User needs some information
Assumption: the required information is present somewhere
A search engine tries to bridge this gap
– Also called corpus (a body of texts)
5 ¡
Titanic ¡ Ship ¡ ¡Rose ¡ ¡Jack ¡ ¡ Atlan(c ¡ ¡ ¡Ocean ¡ ¡ England ¡ ¡Sink ¡ The ¡curse ¡of ¡the ¡black ¡ pearl ¡ Ship ¡Jack ¡ ¡Sparrow ¡ ¡ ¡ Caribbean ¡ ¡Turner ¡ ¡ Elizabeth ¡ ¡Gun ¡Fight ¡ Finding ¡Nemo ¡ Ocean ¡ ¡Fish ¡ ¡Nemo ¡ ¡ Reef ¡ ¡Anima(on ¡ Tin8n ¡ Ocean ¡ ¡Anima(on ¡ ¡ Ship ¡ ¡Haddock ¡ ¡ Tin(n ¡ ¡ ¡ The ¡Dark ¡Knight ¡ Bruce ¡Wayne ¡Batman ¡ Joker ¡Harvey ¡Gordon ¡ Gun ¡Fight ¡Crime ¡ Skyfall ¡ 007 ¡ ¡James ¡ ¡Bond ¡ ¡ MI6 ¡ ¡Gun ¡Fight ¡ ¡ ¡ Silence ¡of ¡the ¡ Lambs ¡ Hannibal ¡Lector ¡ ¡ FBI ¡ ¡Crime ¡ ¡Gun ¡ ¡ Cannibal ¡ ¡ ¡ The ¡Ghost ¡Ship ¡ Ship ¡ ¡Ghost ¡Ocean ¡ Death ¡Horror ¡
6 ¡
Titanic ¡ Ship ¡ ¡Rose ¡ ¡Jack ¡ ¡ Atlan(c ¡ ¡ ¡Ocean ¡ ¡ England ¡ ¡Sink ¡ ¡ Captain ¡ The ¡curse ¡of ¡the ¡black ¡ pearl ¡ Ship ¡ ¡Captain ¡Jack ¡ ¡ Sparrow ¡ ¡ ¡Caribbean ¡ Elizabeth ¡ ¡Gun ¡Fight ¡ Finding ¡Nemo ¡ Ocean ¡ ¡Fish ¡ ¡Nemo ¡ ¡ Reef ¡ ¡Anima(on ¡ Tin8n ¡ Ocean ¡ ¡Anima(on ¡ ¡ Ship ¡ ¡ ¡Captain ¡ Haddock ¡ ¡Tin(n ¡ ¡ ¡ The ¡Dark ¡Knight ¡ Bruce ¡Wayne ¡Batman ¡ Joker ¡Harvey ¡Gordon ¡ Gun ¡Fight ¡Crime ¡ Skyfall ¡ 007 ¡ ¡James ¡ ¡Bond ¡ ¡ MI6 ¡ ¡Gun ¡Fight ¡ ¡ ¡ Silence ¡of ¡the ¡ Lambs ¡ Hannibal ¡Lector ¡ ¡ FBI ¡ ¡Crime ¡ ¡Gun ¡ ¡ Cannibal ¡ ¡ ¡ The ¡Ghost ¡Ship ¡ Ship ¡ ¡Ghost ¡Ocean ¡ Death ¡Horror ¡
7 ¡
Titanic ¡ Ship ¡ ¡Rose ¡ ¡Jack ¡ ¡ Atlan(c ¡ ¡ ¡Ocean ¡ ¡ England ¡ ¡Sink ¡ Captain ¡ The ¡curse ¡of ¡the ¡black ¡ pearl ¡ Ship ¡ ¡Captain ¡Jack ¡ Sparrow ¡ ¡ ¡Caribbean ¡ Elizabeth ¡ ¡Gun ¡Fight ¡ Finding ¡Nemo ¡ Ocean ¡ ¡Fish ¡ ¡Nemo ¡ ¡ Reef ¡ ¡Anima(on ¡ Tin8n ¡ Ocean ¡ ¡Anima(on ¡ ¡ Ship ¡ ¡ ¡Captain ¡ Haddock ¡ ¡Tin(n ¡ ¡ ¡ The ¡Dark ¡Knight ¡ Bruce ¡Wayne ¡Batman ¡ Joker ¡Harvey ¡Gordon ¡ Gun ¡Fight ¡Crime ¡ Skyfall ¡ 007 ¡ ¡James ¡ ¡Bond ¡ ¡ MI6 ¡ ¡Gun ¡Fight ¡ ¡ ¡ Silence ¡of ¡the ¡ Lambs ¡ Hannibal ¡Lector ¡ ¡ FBI ¡ ¡Crime ¡ ¡Gun ¡ ¡ Cannibal ¡ ¡ ¡ The ¡Ghost ¡Ship ¡ Ship ¡ ¡Ghost ¡Ocean ¡ Death ¡Horror ¡
§ The entry (w, d) = 1 if and only if the word w is present in document d § Terms are dimensions of this matrix (units of index; we will discuss later) § Commonly called term – document matrix § Term and word are not same, though often words are used as terms
8 ¡
Black ¡ pearl ¡ Finding ¡ Nemo ¡ Tin(n ¡ Titanic ¡ Dark ¡ Knight ¡ Skyfall ¡ Silence ¡
Ghost ¡ ship ¡ Ship ¡ 1 ¡ 0 ¡ 1 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ Jack ¡ 1 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ Bond ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ Gun ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡ Ocean ¡ 1 ¡ 1 ¡ 1 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ Captain ¡ 1 ¡ 0 ¡ 1 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ Batman ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 0 ¡ 0 ¡ Crime ¡ 0 ¡ 0 ¡ 0 ¡ 0 ¡ 1 ¡ 0 ¡ 1 ¡ 0 ¡
§ Query: Jack § Results: 10010000
9 ¡
Black ¡ pearl ¡ Finding ¡ Nemo ¡ Tin(n ¡ Titanic ¡ Dark ¡ Knight ¡ Skyfall ¡ Silence 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1 ¡ 1 ¡
§ Represent documents by document IDs
1 2 3 4 5 6 7 8
17 ¡
Black ¡ pearl ¡ Finding ¡ Nemo ¡ Tin(n ¡ Titanic ¡ Dark ¡ Knight ¡ Skyfall ¡ Silence ¡
Ghost ¡ ship ¡ Ship ¡ Jack ¡ Bond ¡ Gun ¡ Ocean ¡ Captain ¡ Batman ¡ Crime ¡ 1 2 3 4 5 6 7 8
18 ¡
Black ¡ pearl ¡ Finding ¡ Nemo ¡ Tin(n ¡ Titanic ¡ Dark ¡ Knight ¡ Skyfall ¡ Silence ¡
Ghost ¡ ship ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ Bond ¡ Gun ¡ Ocean ¡ Captain ¡ Batman ¡ Crime ¡ 1 2 3 4 5 6 7 8
19 ¡
Black ¡ pearl ¡ Finding ¡ Nemo ¡ Tin(n ¡ Titanic ¡ Dark ¡ Knight ¡ Skyfall ¡ Silence ¡
Ghost ¡ ship ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡ 1 2 3 4 5 6 7 8
Inverted Index
Pos(ng ¡lists ¡ Vocabulary ¡/ ¡Dic(onary ¡
20 ¡
Titanic ¡ Ship ¡ ¡Rose ¡ ¡Jack ¡ ¡Atlan(c ¡ ¡ ¡ Ocean ¡ ¡England ¡ ¡Sink ¡ ¡ Captain ¡ The ¡curse ¡of ¡the ¡black ¡pearl ¡ Ship ¡ ¡Captain ¡Jack ¡ ¡Sparrow ¡ ¡ ¡ Caribbean ¡Elizabeth ¡ ¡Gun ¡ Fight ¡ Finding ¡Nemo ¡ Ocean ¡ ¡Fish ¡ ¡ Nemo ¡ ¡Reef ¡ ¡ Anima(on ¡ Tin8n ¡ Ocean ¡ ¡Anima(on ¡ ¡ Ship ¡ ¡ ¡Captain ¡ Haddock ¡ ¡Tin(n ¡ ¡ ¡ The ¡Dark ¡Knight ¡ Bruce ¡Wayne ¡Batman ¡ Joker ¡Harvey ¡Gordon ¡Gun ¡ Fight ¡Crime ¡ Skyfall ¡ 007 ¡ ¡James ¡ ¡Bond ¡ ¡ MI6 ¡ ¡Gun ¡Fight ¡ ¡ ¡ Silence ¡of ¡the ¡Lambs ¡ Hannibal ¡Lector ¡ ¡FBI ¡ ¡ Crime ¡ ¡Gun ¡ ¡Cannibal ¡ ¡ ¡ The ¡Ghost ¡Ship ¡ Ship ¡ ¡Ghost ¡Ocean ¡Death ¡ Horror ¡
§ For each document, write out pairs (term, docid) § Sort by term, then group
Term docId Ship 1 Captain 1 Jack 1 … … Ship 3 Tintin 3 … … Jack 4 … …
1 2 3 4 5 6 7 8 Term docId docId docId Captain 1 … Jack 1 4 … Ship 1 3 … … …
Term docId … … Captain 1 … … Jack 1 Jack 4 … … Ship 1 Ship 3 … …
Sort ¡by ¡ term ¡
21 ¡
¡ ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡
Query: Gun OR Ocean
22 ¡
¡ ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡
Query: Gun OR Ocean Results: 1
23 ¡
¡ ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡
Query: Gun OR Ocean Results: 1 2
24 ¡
¡ ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡
Query: Gun OR Ocean Results: 1 2 3
25 ¡
¡ ¡ Ship ¡ 1 ¡ 3 ¡ 4 ¡ 8 ¡ Jack ¡ 1 ¡ 4 ¡ Bond ¡ 6 ¡ Gun ¡ 1 ¡ 5 ¡ 6 ¡ 7 ¡ Ocean ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 8 ¡ Captain ¡ 1 ¡ 3 ¡ 4 ¡ Batman ¡ 5 ¡ Crime ¡ 5 ¡ 7 ¡
Query: Gun OR Ocean Results: 1 2 3 4 5 6 7 8
26 ¡
27 ¡
Lists ¡ sorted ¡by ¡ doc ¡id ¡
Intersec(on ¡
28 ¡
– User wants all the terms to be present
Information
3 7 54 132 322 453 997 … …
Retrieval
2 453 765 798 876 981 … …
29 ¡
Information
3 7 54 132 322 453 997 … …
Retrieval
2 453 765 798 876 981 … …
30 ¡
– Start from the beginning, determine the smaller id (2 < 3) – Is the id following the skip pointer on list 2 also smaller than 3? – No, so move to 453 on list 2
Information
3 7 54 132 322 453 997 … …
Retrieval
2 453 765 798 876 981 … …
31 ¡
– Start from the beginning, determine the smaller id (2 < 3) – Is the id following the skip pointer on list 2 also smaller than 3? – No, so move to 453 on list 2 – Now 3 < 453, the next id 7 also may be < 453, may be even the next – Check: is the next id following the skip pointer (322) < 453? Yes! – Skip to 322, skipping some part of the list – Continue J
32 ¡
33 ¡
indian statistical
3 7 54 132 322 453 997 … …
statistical institute
2 453 765 798 876 981 … …
34 ¡
diwali:
d3:<1>
indian: d2:<4,8> d3:<7> d7:<1> institute:
d1:<2,9> d2:<10>
population: d7:<2> autumn: d4:<3> statistical:
d1:<1> d2:<9>
35 ¡
diwali:
d3:<1>
indian: d2:<4,8> d3:<7> d7:<1> institute:
d1:<2,9> d2:<10>
population: d7:<2> autumn: d4:<3> statistical:
d1:<1> d2:<9>
36 ¡