Presentation is loading. Please wait.

Presentation is loading. Please wait.

Indexing LBSC 708A/CMSC 838L Session 7, October 23, 2001 Philip Resnik.

Similar presentations


Presentation on theme: "Indexing LBSC 708A/CMSC 838L Session 7, October 23, 2001 Philip Resnik."— Presentation transcript:

1 Indexing LBSC 708A/CMSC 838L Session 7, October 23, 2001 Philip Resnik

2 Agenda Questions Finish up evaluation from last time Computational complexity Inverted indexes Question answering and predictive annotation Two minute paper

3 Supporting the Search Process Source Selection Search Query Selection Ranked List Examination Document Delivery Document Query Formulation IR System Indexing Index Acquisition Collection

4 Some Questions for Today How long will it take to find a document? –Is there any work we can do in advance? If so, how long will that take? How big a computer will I need? –How much disk space? How much RAM? What if more documents arrive? –How much of the advance work must be repeated? –Will searching become slower? –How much more disk space will be needed?

5 A Cautionary Tale Searching is easy - just ask Microsoft! –“Find” can search my 1 GB disk in 30 seconds Well, actually it only looks at the file names... How long do you think find would take for –A 100 GB disk? –For the World Wide Web? Computers are getting faster, but… –How does AltaVista give answers in 5 seconds?

6 Find “complex” in the dictionary marsupial belligerent complex marsupial belligerent complex arcade astronomical mastiff relatively relaxation resplendent

7 Computational Complexity One question: how long does stuff take? Another: how much space do you need? Things you need to know: –What is the size of the input? (usu. n) What aspects of the input are we paying attention to? –How is the input represented? –How is the output represented? –What are the internal data structures? –What is the algorithm?

8 Worst Case Complexity

9 10n: O(n) 100n: O(n) 100n+25263: O(n) n 2 : O(n 2 ) n 2 +45662: O(n 2 )

10 Hierarchy of Complexity Constant, i.e. O(1) n doesn’t matter Sublinear, e.g. O(log n) n = 65536  log n = 16 Linear, i.e. O(n) n = 65536  n = 65536 Polynomial, e.g. O(n 3 ) n = 65536  n 3 = 281,474,976,710,656 Exponential, e.g. O(2 n ) n = 65536  beyond astronomical

11 Example: matching URLs http://goodstuff.com/eng/menu-en.htm http://goodstuff.com/eng/prods.htm http://goodstuff.com/eng/help.htm … http://goodstuff.com/fra/menu-fr.htm http://goodstuff.com/fra/prods.htm http://goodstuff.com/fra/help.htm … P patterns M URLs enfr enfra engfr engfre …… N URLs

12 Generate alternatives and look them up –Store French URLs in a hash table, takes O(M) time –For each English URL, substitute all possible patterns… http://goodstuff.com/eng/menu-en.htm http://goodstuff.com/fra/menu-en.htm http://goodstuff.com/fra/mfru-en.htm http://goodstuff.com/fra/menu-fr.htm http://goodstuff.com/fra/mfru-fr.htm … Example, cont’d Exponential! O(N * 2 k )

13 Example, cont’d Alternative: use clever string matching –Can compare a URL e to URL f in O(L 2 ) time, where L is length of URLs in characters (small!) Requires O(N*M) comparisons of URLs –Too slow! (Sometimes N and M are 1000’s…) Speculation: O(M+N) algorithm if you store URLs in a trie?

14 One Good Trie? menu-fr2 mercredi merci m e n u - f r r c r e di 2 i menu-en2 en, eng Looks promising, but the obvious solution still leads to an exponential algorithm.

15 Agenda Questions Computational complexity Inverted indexes Question answering and predictive annotation Two minute paper

16 The “Inverted File” Trick Organize the bag of words matrix by terms –You know the terms that you are looking for Look up terms like you search dictionaries –For each letter, jump directly to the right spot For terms of reasonable length, this is very fast –For each term, store the document identifiers For every document that contains that term At query time, use the document identifiers –Consult a “postings file”

17 An Example quick brown fox over lazy dog back now time all good men come jump aid their party 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 Term Doc 1Doc 2 0 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 Doc 3 Doc 4 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 Doc 5Doc 6 0 0 1 1 0 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 1 0 0 0 Doc 7Doc 8 A B C F D G J L M N O P Q T AI AL BA BR TH TI 4, 8 2, 4, 6 1, 3, 7 1, 3, 5, 7 2, 4, 6, 8 3, 5 3, 5, 7 2, 4, 6, 8 3 1, 3, 5, 7 2, 4, 8 2, 6, 8 1, 3, 5, 7, 8 6, 8 1, 3 1, 5, 7 2, 4, 6 Postings Inverted File

18 The Finished Product quick brown fox over lazy dog back now time all good men come jump aid their party Term A B C F D G J L M N O P Q T AI AL BA BR TH TI 4, 8 2, 4, 6 1, 3, 7 1, 3, 5, 7 2, 4, 6, 8 3, 5 3, 5, 7 2, 4, 6, 8 3 1, 3, 5, 7 2, 4, 8 2, 6, 8 1, 3, 5, 7, 8 6, 8 1, 3 1, 5, 7 2, 4, 6 PostingsInverted File

19 What Goes in a Postings File? Boolean retrieval –Just the document number Ranked Retrieval –Document number and term weight (TF*IDF,...) Proximity operators –Word offsets for each occurrence of the term Example: Doc 3 (t17, t36), Doc 13 (t3, t45)

20 How Big Is the Postings File? Very compact for Boolean retrieval –About 10% of the size of the documents If an aggressive stopword list is used! Not much larger for ranked retrieval –Perhaps 20% Enormous for proximity operators –Sometimes larger than the documents! But access is fast - you know where to look

21 Building an Inverted Index Simplest solution is a single sorted array –Fast lookup using binary search –But sorting large files on disk is very slow –And adding one document means starting over Tree structures allow easy insertion –But the worst case lookup time is linear Balanced trees provide the best of both –Fast lookup and easy insertion –But they require 45% more disk space

22 Starting a B+ Tree Inverted File nowtimegoodall aaaaanow Now is the time for all good …

23 Adding a New Term nowtimegoodall aaaaanow Now is the time for all good men … aaaaamen

24 How Big is the Inverted Index? Typically smaller than the postings file –Depends on number of terms, not documents Eventually almost all terms will be indexed –But the postings file will continue to grow Postings dominate asymptotic space complexity –Linear in the number of documents Assuming that the documents remain about the same size

25 Some Facts About Disks It takes a long time to get the first byte –A Pentium can do 1,000,000 operations in 10 ms But you can get 1,000 bytes just about as fast –40 MB/sec transfer rates are typical So it pays to put related stuff in each “block” –M-ary trees B+ are better than binary B+ trees Time complexity is measured in disk blocks read –Since computing time is negligible by comparison

26 Indexing and Searching Indexing –Walk the inverted file, splitting if needed –Insert into the postings file in sorted order –Hours or days for large collections Query processing –Walk the inverted file –Read the postings file –Manipulate postings based on query –Seconds, even for enormous collections

27 Agenda Questions Computational complexity Inverted indexes Question answering and predictive annotation Two minute paper

28 Question Answering “In what year did Edison patent the light bulb?” –Is the user really looking for a list of documents? Better answer: excerpt containing the answer … after Edison’s patenting of the light bulb in 1879… Question words become very important! –“How much money did Clinton earn in 1999?”

29 QA and Predictive Annotation Predictive annotation (Prager et al.): –Infer possible question types within documents –Index them along with the terms –At search time, map question words to question types and include them in the query Requires –Identification of entities and their categories –Indexing multiple items at one location –Analysis of queries to derive question types Works pretty well!

30 Predictive Annotation, cont’d In reality, at the time of Edison’s 1879 patent, the light bulb had been in existence for some five decades …. TIMEPERSON Who patented the light bulb? When was the light bulb patented? What did Thomas Edison patent? patent light bulb PERSON patent light bulb TIME ??? In what year was the light bulb patented?

31 Summary Slow indexing yields fast query processing We use extra disk space to save query time –Index space is in addition to document space –Time and space complexity must be balanced Disk block reads are the critical resource –Fast disks are more useful than fast computers

32 One Minute Paper Suppose insertions of new documents are more common than getting new queries. For example, imagine filtering news stories as they arrive, based on a small set of queries that describe long-standing topics of interest. What kind of an index should you build? What was the muddiest point in today’s lecture?


Download ppt "Indexing LBSC 708A/CMSC 838L Session 7, October 23, 2001 Philip Resnik."

Similar presentations


Ads by Google