SLIDE 1IS 202 – FALL 2002 Prof. Ray Larson & Prof. Marc Davis UC Berkeley SIMS Tuesday and Thursday 10:30 am - 12:00 pm Fall SIMS 202: Information Organization and Retrieval Lecture 17: Statistical Properties of Text
SLIDE 2IS 202 – FALL 2002 Lecture Overview Review –Central Concepts in IR –Boolean Logic Content Analysis Statistical Properties of Text –Zipf distribution –Statistical dependence Indexing and Inverted Files Credit for some of the slides in this lecture goes to Marti Hearst
SLIDE 3IS 202 – FALL 2002 Central Concepts in IR Documents Queries Collections Evaluation Relevance
SLIDE 4IS 202 – FALL 2002 Relevance (introduction) In what ways can a document be relevant to a query? –Answer precise question precisely –Who is buried in grant’s tomb? Grant –Partially answer question –Where is Danville? Near Walnut Creek –Suggest a source for more information –What is lymphodema? Look in this Medical Dictionary… –Give background information –Remind the user of other knowledge –Others...
SLIDE 5IS 202 – FALL 2002 Relevance “Intuitively, we understand quite well what relevance means. It is a primitive ‘y’ know’ concept, as is information for which we hardly need a definition. … if and when any productive contact [in communication] is desired, consciously or not, we involve and use this intuitive notion or relevance.” »Saracevic, 1975 p. 324
SLIDE 6IS 202 – FALL 2002 Janes’ View Topicality Pertinence Relevance Utility Satisfaction
SLIDE 7IS 202 – FALL 2002 Boolean Queries Cat Cat OR Dog Cat AND Dog (Cat AND Dog) (Cat AND Dog) OR Collar (Cat AND Dog) OR (Collar AND Leash) (Cat OR Dog) AND (Collar OR Leash)
SLIDE 8IS 202 – FALL 2002 Boolean Logic A B
SLIDE 9IS 202 – FALL 2002 Boolean Logic 3t33t3 1t11t1 2t22t2 1D11D1 2D22D2 3D33D3 4D44D4 5D55D5 6D66D6 8D88D8 7D77D7 9D99D9 10 D D 11 m1m1 m2m2 m3m3 m5m5 m4m4 m7m7 m8m8 m6m6 m 2 = t 1 t 2 t 3 m 1 = t 1 t 2 t 3 m 4 = t 1 t 2 t 3 m 3 = t 1 t 2 t 3 m 6 = t 1 t 2 t 3 m 5 = t 1 t 2 t 3 m 8 = t 1 t 2 t 3 m 7 = t 1 t 2 t 3
SLIDE 10IS 202 – FALL 2002 Boolean Systems Most of the commercial database search systems that pre-date the WWW are based on Boolean search –Dialog, Lexis-Nexis, etc. Most Online Library Catalogs are Boolean systems –E.g. MELVYL Database systems use Boolean logic for searching Many of the search engines sold for intranet search of web sites are Boolean
SLIDE 11IS 202 – FALL 2002 Content Analysis Automated Transformation of raw text into a form that represents some aspect(s) of its meaning Including, but not limited to: –Automated Thesaurus Generation –Phrase Detection –Categorization –Clustering –Summarization
SLIDE 12IS 202 – FALL 2002 Techniques for Content Analysis Statistical –Single Document –Full Collection Linguistic –Syntactic –Semantic –Pragmatic Knowledge-Based (Artificial Intelligence) Hybrid (Combinations)
SLIDE 13IS 202 – FALL 2002 Text Processing Standard Steps: –Recognize document structure titles, sections, paragraphs, etc. –Break into tokens usually space and punctuation delineated special issues with Asian languages –Stemming/morphological analysis –Store in inverted index (to be discussed later)
SLIDE 14IS 202 – FALL 2002 Content Analysis Areas How is the text processed? Information need Index Pre-process Parse Collections Rank Query text input How is the query constructed ?
SLIDE 15 Document Processing Steps From “Modern IR” textbook
SLIDE 16IS 202 – FALL 2002 Stemming and Morphological Analysis Goal: “normalize” similar words Morphology (“form” of words) –Inflectional Morphology E.g,. inflect verb endings and noun number Never change grammatical class –dog, dogs –tengo, tienes, tiene, tenemos, tienen –Derivational Morphology Derive one word from another, Often change grammatical class –build, building; health, healthy
SLIDE 17IS 202 – FALL 2002 Automated Methods Powerful multilingual tools exist for morphological analysis –PCKimmo, Xerox Lexical technology –Require a grammar and dictionary –Use “two-level” automata Stemmers: –Very dumb rules work well (for English) –Porter Stemmer: Iteratively remove suffixes –Improvement: pass results through a lexicon
SLIDE 18IS 202 – FALL 2002 Errors Generated by Porter Stemmer From Krovetz ‘93
SLIDE 19IS 202 – FALL 2002 Statistical Properties of Text Token occurrences in text are not uniformly distributed They are also not normally distributed They do exhibit a Zipf distribution
SLIDE 20IS 202 – FALL 2002 Plotting Word Frequency by Rank Main idea: –Count how many times tokens occur in the text Sum over all of the texts in the collection Now order these tokens according to how often they occur (highest to lowest) This is called the rank
SLIDE 21IS 202 – FALL 2002 A Typical Collection 8164 the 4771 of 4005 to 2834 a 2827 and 2802 in 1592 The 1370 for 1326 is 1324 s 1194 that 973 by 969 on 915 FT 883 Mr 860 was 855 be 849 Pounds 798 TEXT 798 PUB 798 PROFILE 798 PAGE 798 HEADLINE 798 DOCNO 1 ABC 1 ABFT 1 ABOUT 1 ACFT 1 ACI 1 ACQUI 1 ACQUISITIONS 1 ACSIS 1 ADFT 1 ADVISERS 1 AE Government documents, tokens, unique
SLIDE 22IS 202 – FALL 2002 A Small Collection (Stems) Rank Freq Term 1 37 system 2 32 knowledg 3 24 base 4 20 problem 5 18 abstract 6 15 model 7 15 languag 8 15 implem 9 13 reason inform expert analysi rule program oper evalu comput case 19 9 gener 20 9 form enhanc energi emphasi detect desir date critic content consider concern compon compar commerci clause aspect area aim affect
SLIDE 23IS 202 – FALL 2002 The Corresponding Zipf Curve Rank Freq 1 37 system 2 32 knowledg 3 24 base 4 20 problem 5 18 abstract 6 15 model 7 15 languag 8 15 implem 9 13 reason inform expert analysi rule program oper evalu comput case 19 9 gener 20 9 form
SLIDE 24IS 202 – FALL 2002 Zoom in on the Knee of the Curve 43 6 approach 44 5 work 45 5 variabl 46 5 theori 47 5 specif 48 5 softwar 49 5 requir 50 5 potenti 51 5 method 52 5 mean 53 5 inher 54 5 data 55 5 commit 56 5 applic 57 4 tool 58 4 technolog 59 4 techniqu
SLIDE 25IS 202 – FALL 2002 Zipf Distribution The Important Points: –a few elements occur very frequently –a medium number of elements have medium frequency –many elements occur very infrequently
SLIDE 26IS 202 – FALL 2002 The product of the frequency of words (f) and their rank (r) is approximately constant –Rank = order of words’ frequency of occurrence Another way to state this is with an approximately correct rule of thumb: –Say the most common term occurs C times –The second most common occurs C/2 times –The third most common occurs C/3 times Zipf Distribution
SLIDE 27 Zipf Distribution Linear ScaleLogarithmic Scale
SLIDE 28IS 202 – FALL 2002 What has a Zipf Distribution? Words in a text collection –Virtually any use of natural language Library book checkout patterns Incoming Web Page Requests (Nielsen) Outgoing Web Page Requests (Cunha & Crovella) Document Size on Web (Cunha & Crovella)
SLIDE 29IS 202 – FALL 2002 Related Distributions/”Laws” Bradford’s Law of Scattering Lotka’s Law of Productivity De Solla Price’s Urn Model for “Cumulative Advantage Processes” ½ = 50%2/3 = 66%¾ = 75%Pick Replace +1
SLIDE 30IS 202 – FALL 2002 Very frequent word stems From the Cha-Cha Web Index for the Berkeley.EDU domain
SLIDE 31IS 202 – FALL 2002 Frequent words on the WWW the a to of and in s for on this is by with or at all are from e you be that not an as home it i have if new t your page about com information will can more has no other one c d m was copyright us (see
SLIDE 32IS 202 – FALL 2002 Words that occur few times From the Cha-Cha Web Index for the Berkeley.EDU domain
SLIDE 33IS 202 – FALL 2002 Consequences of Zipf There are always a few very frequent tokens that are not good discriminators. –Called “stop words” in IR –Usually correspond to linguistic notion of “closed- class” words English examples: to, from, on, and, the,... Grammatical classes that don’t take on new members. There are always a large number of tokens that occur once (and can have unexpected consequences with some IR algorithms) Medium frequency words most descriptive
SLIDE 34IS 202 – FALL 2002 Word Frequency vs. Resolving Power The most frequent words are not the most descriptive. (from van Rijsbergen 79)
SLIDE 35IS 202 – FALL 2002 How likely is a red car to drive by given we’ve seen a black one? How likely is the word “ambulence” to appear, given that we’ve seen “car accident”? Color of cars driving by are independent (although more frequent colors are more likely) Words in text are not independent (although again more frequent words are more likely) Statistical Independence vs. Dependence
SLIDE 36IS 202 – FALL 2002 Statistical Independence Two events x and y are statistically independent if the product of the probabilities of their happening individually equals the probability of their happening together
SLIDE 37IS 202 – FALL 2002 Statistical Independence and Dependence What are examples of things that are statistically independent? What are examples of things that are statistically dependent?
SLIDE 38IS 202 – FALL 2002 Lexical Associations Subjects write first word that comes to mind –doctor/nurse; black/white (Palermo & Jenkins 64) Text Corpora can yield similar associations One measure: Mutual Information (Church and Hanks 89) If word occurrences were independent, the numerator and denominator would be equal (if measured across a large collection)
SLIDE 39IS 202 – FALL 2002 Statistical Independence Compute for a window of words w1w11 w21 a b c d e f g h i j k l m n o p
SLIDE 40IS 202 – FALL 2002 Interesting Associations with “Doctor” AP Corpus, N=15 million, Church & Hanks 89
SLIDE 41IS 202 – FALL 2002 These associations were likely to happen because the non-doctor words shown here are very common and therefore likely to co-occur with any noun. Un-Interesting Associations with “Doctor” AP Corpus, N=15 million, Church & Hanks 89
SLIDE 42IS 202 – FALL 2002 Document Vectors Documents are represented as “bags of words” Represented as vectors when used computationally –A vector is like an array of floating point –Has direction and magnitude –Each vector holds a place for every term in the collection –Therefore, most vectors are sparse
SLIDE 43IS 202 – FALL 2002 Document Vectors “Nova” occurs 10 times in text A “Galaxy” occurs 5 times in text A “Heat” occurs 3 times in text A (Blank means 0 occurrences.)
SLIDE 44IS 202 – FALL 2002 Document Vectors “Hollywood” occurs 7 times in text I “Film” occurs 5 times in text I “Diet” occurs 1 time in text I “Fur” occurs 3 times in text I
SLIDE 45IS 202 – FALL 2002 Document Vectors
SLIDE 46IS 202 – FALL 2002 We Can Plot the Vectors Star Diet Doc about astronomy Doc about movie stars Doc about mammal behavior
SLIDE 47 Documents in 3D Space
SLIDE 48IS 202 – FALL 2002 Content Analysis Summary Content Analysis: transforming raw text into more computationally useful forms Words in text collections exhibit interesting statistical properties –Word frequencies have a Zipf distribution –Word co-occurrences exhibit dependencies Text documents are transformed to vectors –Pre-processing includes tokenization, stemming, collocations/phrases –Documents occupy multi-dimensional space
SLIDE 49IS 202 – FALL 2002 Inverted Index This is the primary data structure for text indexes Main Idea: –Invert documents into a big index Basic steps: –Make a “dictionary” of all the tokens in the collection –For each token, list all the docs it occurs in. –Do a few things to reduce redundancy in the data structure
SLIDE 50IS 202 – FALL 2002 Information need Index Pre-process Parse Collections Rank Query text input How is the index constructed?
SLIDE 51IS 202 – FALL 2002 Inverted Indexes We have seen “Vector files” conceptually –An Inverted File is a vector file “inverted” so that rows become columns and columns become rows
SLIDE 52IS 202 – FALL 2002 How Inverted Files Are Created Documents are parsed to extract tokens. These are saved with the Document ID. Now is the time for all good men to come to the aid of their country Doc 1 It was a dark and stormy night in the country manor. The time was past midnight Doc 2
SLIDE 53IS 202 – FALL 2002 How Inverted Files are Created After all documents have been parsed the inverted file is sorted alphabetically.
SLIDE 54IS 202 – FALL 2002 How Inverted Files are Created Multiple term entries for a single document are merged. Within-document term frequency information is compiled.
SLIDE 55IS 202 – FALL 2002 How Inverted Files are Created Then the file can be split into –A Dictionary file – and –A Postings file
SLIDE 56IS 202 – FALL 2002 How Inverted Files are Created Dictionary Postings
SLIDE 57IS 202 – FALL 2002 Inverted indexes Permit fast search for individual terms For each term, you get a list consisting of: –document ID –frequency of term in doc (optional) –position of term in doc (optional) These lists can be used to solve Boolean queries: country -> d1, d2 manor -> d2 country AND manor -> d2 Also used for statistical ranking algorithms
SLIDE 58IS 202 – FALL 2002 How Inverted Files are Used Dictionary Postings Query on “time” AND “dark” 2 docs with “time” in dictionary -> IDs 1 and 2 from posting file 1 doc with “dark” in dictionary -> ID 2 from posting file Therefore, only doc 2 satisfied the query.
SLIDE 59IS 202 – FALL 2002 Next Time More on Vector Representation The Vector Model of IR Term weighting Statistical ranking methods