Introduction to Information Retrieval Introduction to Information Retrieval CS276: Information Retrieval and Web Search Christopher Manning, Pandu Nayak.

Slides:



Advertisements
Similar presentations
Improvements and extras Paul Thomas CSIRO. Overview of the lectures 1.Introduction to information retrieval (IR) 2.Ranked retrieval 3.Probabilistic retrieval.
Advertisements

Spelling Correction for Search Engine Queries Bruno Martins, Mario J. Silva In Proceedings of EsTAL-04, España for Natural Language Processing Presenter:
LING 438/538 Computational Linguistics Sandiway Fong Lecture 17: 10/25.
Language Models Naama Kraus (Modified by Amit Gross) Slides are based on Introduction to Information Retrieval Book by Manning, Raghavan and Schütze.
Spelling correction as an iterative process that exploits the collective knowledge of web users Silviu Cucerzan and Eric Brill July, 2004 Speaker: Mengzhe.
Helyesírás ellenőrzés. Kiselőadások elvárt formátuma Minden előadásról kell készüljön egy 5-7 slideos prezentáció (pl. ppt/pdf) – A prezentációt le kell.
Introduction to Information Retrieval Introduction to Information Retrieval Adapted from Christopher Manning and Prabhakar Raghavan Tolerant Retrieval.
Language Model based Information Retrieval: University of Saarland 1 A Hidden Markov Model Information Retrieval System Mahboob Alam Khalid.
A BAYESIAN APPROACH TO SPELLING CORRECTION. ‘Noisy channels’ In a number of tasks involving natural language, the problem can be viewed as recovering.
Bayes Rule How is this rule derived? Using Bayes rule for probabilistic inference: –P(Cause | Evidence): diagnostic probability –P(Evidence | Cause): causal.
6/9/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 4 Giuseppe Carenini.
6/9/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 4 Giuseppe Carenini.
N-gram model limitations Q: What do we do about N-grams which were not in our training corpus? A: We distribute some probability mass from seen N-grams.
Near Duplicate Detection
Gobalisation Week 8 Text processes part 2 Spelling dictionaries Noisy channel model Candidate strings Prior probability and likelihood Lab session: practising.
Computational Language Andrew Hippisley. Computational Language Computational language and AI Language engineering: applied computational language Case.
Spelling Checkers Daniel Jurafsky and James H. Martin, Prentice Hall, 2000.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 18: 10/26.
Metodi statistici nella linguistica computazionale The Bayesian approach to spelling correction.
CS246 Basic Information Retrieval. Today’s Topic  Basic Information Retrieval (IR)  Bag of words assumption  Boolean Model  Inverted index  Vector-space.
CS276 – Information Retrieval and Web Search Checking in. By the end of this week you need to have: Watched the online videos corresponding to the first.
1 Advanced Smoothing, Evaluation of Language Models.
8/27/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 5 Giuseppe Carenini.
Multi-Style Language Model for Web Scale Information Retrieval Kuansan Wang, Xiaolong Li and Jianfeng Gao SIGIR 2010 Min-Hsuan Lai Department of Computer.
BİL711 Natural Language Processing1 Statistical Language Processing In the solution of some problems in the natural language processing, statistical techniques.
Text Analysis Everything Data CompSci Spring 2014.
November 2005CSA3180: Statistics III1 CSA3202: Natural Language Processing Statistics 3 – Spelling Models Typing Errors Error Models Spellchecking Noisy.
Query Rewriting Using Monolingual Statistical Machine Translation Stefan Riezler Yi Liu Google 2010 Association for Computational Linguistics.
LING 438/538 Computational Linguistics
6. N-GRAMs 부산대학교 인공지능연구실 최성자. 2 Word prediction “I’d like to make a collect …” Call, telephone, or person-to-person -Spelling error detection -Augmentative.
Intro to NLP - J. Eisner1 Finite-State and the Noisy Channel.
Chapter 5. Probabilistic Models of Pronunciation and Spelling 2007 년 05 월 04 일 부산대학교 인공지능연구실 김민호 Text : Speech and Language Processing Page. 141 ~ 189.
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong. Administrivia Next Monday – guest lecture from Dr. Jerry Ball of the Air Force Research Labs to be continued.
Chapter 6: Statistical Inference: n-gram Models over Sparse Data
Statistical NLP: Lecture 8 Statistical Inference: n-gram Models over Sparse Data (Ch 6)
1 CSA4050: Advanced Topics in NLP Spelling Models.
Language Modeling Anytime a linguist leaves the group the recognition rate goes up. (Fred Jelinek)
CS276: Information Retrieval and Web Search
Spelling correction. Spell correction Two principal uses Correcting document(s) being indexed Correcting user queries to retrieve “right” answers Two.
9/22/1999 JHU CS /Jan Hajic 1 Introduction to Natural Language Processing ( ) LM Smoothing (The EM Algorithm) Dr. Jan Hajič CS Dept., Johns.
1 Introduction to Natural Language Processing ( ) LM Smoothing (The EM Algorithm) AI-lab
Chapter 23: Probabilistic Language Models April 13, 2004.
12/7/2015CPSC503 Winter CPSC 503 Computational Linguistics Lecture 4 Giuseppe Carenini.
Number Sense Disambiguation Stuart Moore Supervised by: Anna Korhonen (Computer Lab)‏ Sabine Buchholz (Toshiba CRL)‏
Introduction to Information Retrieval Introduction to Information Retrieval CS276 Information Retrieval and Web Search Chris Manning and Pandu Nayak Efficient.
Search Engines WS 2009 / 2010 Prof. Dr. Hannah Bast Chair of Algorithms and Data Structures Department of Computer Science University of Freiburg Lecture.
Autumn Web Information retrieval (Web IR) Handout #3:Dictionaries and tolerant retrieval Mohammad Sadegh Taherzadeh ECE Department, Yazd University.
2/29/2016CPSC503 Winter CPSC 503 Computational Linguistics Lecture 5 Giuseppe Carenini.
Using the Web for Language Independent Spellchecking and Auto correction Authors: C. Whitelaw, B. Hutchinson, G. Chung, and G. Ellis Google Inc. Published.
Chapter 6 Queries and Interfaces. Keyword Queries n Simple, natural language queries were designed to enable everyone to search n Current search engines.
January 2012Spelling Models1 Human Language Technology Spelling Models.
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong 1.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 15: Text Classification & Naive Bayes 1.
Language Modeling Again So are we smooth now? Courtesy of Chris Jordan.
Spell checking. Spelling Correction and Edit Distance Non-word error detection: – detecting “graffe” “ سوژن ”, “ مصواک ”, “ مداا ” Non-word error correction:
Tolerant Retrieval Some of these slides are based on Stanford IR Course slides at 1.
Spelling correction. Spell correction Two principal uses Correcting document(s) being indexed Retrieve matching documents when query contains a spelling.
Spelling Correction and the Noisy Channel Real-Word Spelling Correction.
Tolerant Retrieval Review Questions
Do-Gil Lee1*, Ilhwan Kim1 and Seok Kee Lee2
Basic Information Retrieval
CSA3180: Natural Language Processing
CPSC 503 Computational Linguistics
INFORMATION RETRIEVAL TECHNIQUES BY DR. ADNAN ABID
Presented by Wen-Hung Tsai Speech Lab, CSIE, NTNU 2005/07/13
CPSC 503 Computational Linguistics
CS276: Information Retrieval and Web Search
CS621/CS449 Artificial Intelligence Lecture Notes
INFORMATION RETRIEVAL TECHNIQUES BY DR. ADNAN ABID
INFORMATION RETRIEVAL TECHNIQUES BY DR. ADNAN ABID
Presentation transcript:

Introduction to Information Retrieval Introduction to Information Retrieval CS276: Information Retrieval and Web Search Christopher Manning, Pandu Nayak and Prabhakar Raghavan Spelling Correction

Introduction to Information Retrieval Don’t forget … 5 queries for the Stanford intranet (read the piazza post) 2

Introduction to Information Retrieval Applications for spelling correction 3 Web search PhonesWord processing

Introduction to Information Retrieval Spelling Tasks  Spelling Error Detection  Spelling Error Correction:  Autocorrect  hte  the  Suggest a correction  Suggestion lists 4

Introduction to Information Retrieval Types of spelling errors  Non-word Errors  graffe  giraffe  Real-word Errors  Typographical errors  three  there  Cognitive Errors (homophones)  piece  peace,  too  two  your  you’re 5

Introduction to Information Retrieval Rates of spelling errors 26%:Web queries Wang et al %:Retyping, no backspace: Whitelaw et al. English&German 7%: Words corrected retyping on phone-sized organizer 2%: Words uncorrected on organizer Soukoreff &MacKenzie %: Retyping: Kane and Wobbrock 2007, Gruden et al Depending on the application, ~1- 20% error rates

Introduction to Information Retrieval Non-word spelling errors  Non-word spelling error detection:  Any word not in a dictionary is an error  The larger the dictionary the better  (The Web is full of mis-spellings, so the Web isn’t necessarily a great dictionary … but …)  Non-word spelling error correction:  Generate candidates: real words that are similar to error  Choose the one which is best:  Shortest weighted edit distance  Highest noisy channel probability 7

Introduction to Information Retrieval Real word spelling errors  For each word w, generate candidate set:  Find candidate words with similar pronunciations  Find candidate words with similar spellings  Include w in candidate set  Choose best candidate  Noisy Channel view of spell errors  Context-sensitive – so have to consider whether the surrounding words “make sense”  Flying form Heathrow to LAX  Flying from Heathrow to LAX 8

Introduction to Information Retrieval Terminology  These are character bigrams:  st, pr, an …  These are word bigrams:  palo alto, flying from, road repairs  In today’s class, we will generally deal with word bigrams  In the accompanying Coursera lecture, we mostly deal with character bigrams (because we cover stuff complementary to what we’re discussing here) 9 Similarly trigrams, k-grams etc Similarly trigrams, k-grams etc

Spelling Correction and the Noisy Channel The Noisy Channel Model of Spelling

Introduction to Information Retrieval Noisy Channel Intuition 11

Introduction to Information Retrieval Noisy Channel + Bayes’ Rule  We see an observation x of a misspelled word  Find the correct word ŵ 12 Bayes

Introduction to Information Retrieval History: Noisy channel for spelling proposed around 1990  IBM  Mays, Eric, Fred J. Damerau and Robert L. Mercer Context based spelling correction. Information Processing and Management, 23(5), 517–522  AT&T Bell Labs  Kernighan, Mark D., Kenneth W. Church, and William A. Gale A spelling correction program based on a noisy channel model. Proceedings of COLING 1990, A spelling correction program based on a noisy channel model

Introduction to Information Retrieval Non-word spelling error example acress 14

Introduction to Information Retrieval Candidate generation  Words with similar spelling  Small edit distance to error  Words with similar pronunciation  Small distance of pronunciation to error  In this class lecture we mostly won’t dwell on efficient candidate generation  A lot more about candidate generation in the accompanying Coursera material 15

Introduction to Information Retrieval Damerau-Levenshtein edit distance  Minimal edit distance between two strings, where edits are:  Insertion  Deletion  Substitution  Transposition of two adjacent letters  See IIR sec for edit distance 16

Introduction to Information Retrieval Words within 1 of acress ErrorCandidate Correction Correct Letter Error Letter Type acressactresst- deletion acresscress-a insertion acresscaresscaac transposition acressaccesscr substitution acressacrossoe substitution acressacres-s insertion acressacres-s insertion 17

Introduction to Information Retrieval Candidate generation  80% of errors are within edit distance 1  Almost all errors within edit distance 2  Also allow insertion of space or hyphen  thisidea  this idea  inlaw  in-law 18

Introduction to Information Retrieval Wait, how do you generate the candidates? 1.Run through dictionary, check edit distance with each word 2.Generate all words within edit distance ≤ k (e.g., k = 1 or 2) and then intersect them with dictionary 3.Use a character k-gram index and find dictionary words that share “most” k-grams with word (e.g., by Jaccard coefficient)  see IIR sec Compute them fast with a Levenshtein finite state transducer 5.Have a precomputed map of words to possible corrections 19

Introduction to Information Retrieval A paradigm …  We want the best spell corrections  Instead of finding the very best, we  Find a subset of pretty good corrections  (say, edit distance at most 2)  Find the best amongst them  These may not be the actual best  This is a recurring paradigm in IR including finding the best docs for a query, best answers, best ads …  Find a good candidate set  Find the top K amongst them and return them as the best 20

Introduction to Information Retrieval Let’s say we’ve generated candidates: Now back to Bayes’ Rule  We see an observation x of a misspelled word  Find the correct word ŵ 21 What’s P(w)?

Introduction to Information Retrieval Language Model  Take a big supply of words (your document collection with T tokens); let C(w) = # occurrences of w  In other applications – you can take the supply to be typed queries (suitably filtered) – when a static dictionary is inadequate 22

Introduction to Information Retrieval Unigram Prior probability wordFrequency of word P(w) actress 9, cress caress access 37, across 120, acres 12, Counts from 404,253,213 words in Corpus of Contemporary English (COCA)

Introduction to Information Retrieval Channel model probability  Error model probability, Edit probability  Kernighan, Church, Gale 1990  Misspelled word x = x 1, x 2, x 3 … x m  Correct word w = w 1, w 2, w 3,…, w n  P(x|w) = probability of the edit  (deletion/insertion/substitution/transposition) 24

Introduction to Information Retrieval Computing error probability: confusion “matrix” del[x,y]: count(xy typed as x) ins[x,y]: count(x typed as xy) sub[x,y]: count(y typed as x) trans[x,y]: count(xy typed as yx) Insertion and deletion conditioned on previous character 25

Introduction to Information Retrieval Confusion matrix for substitution

Introduction to Information Retrieval Nearby keys

Introduction to Information Retrieval Generating the confusion matrix  Peter Norvig’s list of errors Peter Norvig’s list of errors  Peter Norvig’s list of counts of single-edit errors Peter Norvig’s list of counts of single-edit errors  All Peter Norvig’s ngrams data links: 28

Introduction to Information Retrieval Channel model 29 Kernighan, Church, Gale 1990

Introduction to Information Retrieval Smoothing probabilities: Add-1 smoothing  But if we use the confusion matrix example, unseen errors are impossible!  They’ll make the overall probability 0. That seems too harsh  e.g., in Kernighan’s chart q  a and a  q are both 0, even though they’re adjacent on the keyboard!  A simple solution is to add 1 to all counts and then if there is a |A| character alphabet, to normalize appropriately: 30

Introduction to Information Retrieval Channel model for acress Candidate Correction Correct Letter Error Letter x|w P(x|w) actresst-c|ct cress-aa|# caresscaacac|ca accesscrr|c acrossoee|o acres-ses|e acres-sss|s

Introduction to Information Retrieval Noisy channel probability for acress Candidate Correction Correct Letter Error Letter x|w P(x|w)P(w)10 9 * P(x|w)* P(w) actresst-c|ct cress-aa|# caresscaacac|ca accesscrr|c acrossoee|o acres-ses|e acres-sss|s

Introduction to Information Retrieval Noisy channel probability for acress Candidate Correction Correct Letter Error Letter x|w P(x|w)P(w)10 9 * P(x|w)P( w) actresst-c|ct cress-aa|# caresscaacac|c a accesscrr|c acrossoee|o acres-ses|e acres-sss|s

Introduction to Information Retrieval Incorporating context words: Context-sensitive spelling correction  Determining whether actress or across is appropriate will require looking at the context of use  We can do this with a better language model  You learned/can learn a lot about language models in CS124 or CS224N  Here we present just enough to be dangerous/do the assignment  A bigram language model conditions the probability of a word on (just) the previous word P(w 1 …w n ) = P(w 1 )P(w 2 |w 1 )…P(w n |w n−1 ) 34

Introduction to Information Retrieval Incorporating context words  For unigram counts, P(w) is always non-zero  if our dictionary is derived from the document collection  This won’t be true of P(w k |w k−1 ). We need to smooth  We could use add-1 smoothing on this conditional distribution  But here’s a better way – interpolate a unigram and a bigram: P li (w k |w k−1 ) = λP uni (w 1 ) + (1−λ)P bi (w k |w k−1 )  P bi (w k |w k−1 ) = C(w k |w k−1 ) / C(w k−1 ) 35

Introduction to Information Retrieval All the important fine points  Note that we have several probability distributions for words  Keep them straight!  You might want/need to work with log probabilities:  log P(w 1 …w n ) = log P(w 1 ) + log P(w 2 |w 1 ) + … + log P(w n |w n−1 )  Otherwise, be very careful about floating point underflow  Our query may be words anywhere in a document  We’ll start the bigram estimate of a sequence with a unigram estimate  Often, people instead condition on a start-of-sequence symbol, but not good here  Because of this, the unigram and bigram counts have different totals. Not a problem 36

Introduction to Information Retrieval Using a bigram language model  “a stellar and versatile acress whose combination of sass and glamour…”  Counts from the Corpus of Contemporary American English with add-1 smoothing  P(actress|versatile)= P(whose|actress) =.0010  P(across|versatile) = P(whose|across) =  P(“ versatile actress whose ”) = *.0010 = 210 x  P(“ versatile across whose ”) = * = 1 x

Introduction to Information Retrieval Using a bigram language model  “a stellar and versatile acress whose combination of sass and glamour…”  Counts from the Corpus of Contemporary American English with add-1 smoothing  P(actress|versatile)= P(whose|actress) =.0010  P(across|versatile) = P(whose|across) =  P(“ versatile actress whose ”) = *.0010 = 210 x  P(“ versatile across whose ”) = * = 1 x

Introduction to Information Retrieval Evaluation  Some spelling error test sets  Wikipedia’s list of common English misspelling Wikipedia’s list of common English misspelling  Aspell filtered version of that list Aspell filtered version of that list  Birkbeck spelling error corpus Birkbeck spelling error corpus  Peter Norvig’s list of errors (includes Wikipedia and Birkbeck, for training or testing) Peter Norvig’s list of errors (includes Wikipedia and Birkbeck, for training or testing) 39

Spelling Correction and the Noisy Channel Real-Word Spelling Correction

Introduction to Information Retrieval Real-word spelling errors  …leaving in about fifteen minuets to go to her house.  The design an construction of the system…  Can they lave him my messages?  The study was conducted mainly be John Black.  25-40% of spelling errors are real words Kukich

Introduction to Information Retrieval Solving real-word spelling errors  For each word in sentence (phrase, query …)  Generate candidate set  the word itself  all single-letter edits that are English words  words that are homophones  (all of this can be pre-computed!)  Choose best candidates  Noisy channel model 42

Introduction to Information Retrieval Noisy channel for real-word spell correction  Given a sentence w 1,w 2,w 3,…,w n  Generate a set of candidates for each word w i  Candidate(w 1 ) = {w 1, w’ 1, w’’ 1, w’’’ 1,…}  Candidate(w 2 ) = {w 2, w’ 2, w’’ 2, w’’’ 2,…}  Candidate(w n ) = {w n, w’ n, w’’ n, w’’’ n,…}  Choose the sequence W that maximizes P(W)

Introduction to Information Retrieval Noisy channel for real-word spell correction 44

Introduction to Information Retrieval Noisy channel for real-word spell correction 45

Introduction to Information Retrieval Simplification: One error per sentence  Out of all possible sentences with one word replaced  w 1, w’’ 2,w 3,w 4 two off thew  w 1,w 2,w’ 3,w 4 two of the  w’’’ 1,w 2,w 3,w 4 too of thew  …  Choose the sequence W that maximizes P(W)

Introduction to Information Retrieval Where to get the probabilities  Language model  Unigram  Bigram  etc.  Channel model  Same as for non-word spelling correction  Plus need probability for no error, P(w|w) 47

Introduction to Information Retrieval Probability of no error  What is the channel probability for a correctly typed word?  P(“the”|“the”)  If you have a big corpus, you can estimate this percent correct  But this value depends strongly on the application .90 (1 error in 10 words) .95 (1 error in 20 words) .99 (1 error in 100 words) 48

Introduction to Information Retrieval Peter Norvig’s “thew” example 49 xwx|wP(x|w)P(w) 10 9 P(x|w)P(w) thewtheew|e thew thewthawe|a thewthrewh|hr thewthwe ew|w e

Introduction to Information Retrieval State of the art noisy channel  We never just multiply the prior and the error model  Independence assumptions  probabilities not commensurate  Instead: Weight them  Learn λ from a development test set 50

Introduction to Information Retrieval Improvements to channel model  Allow richer edits (Brill and Moore 2000)  ent  ant  ph  f  le  al  Incorporate pronunciation into channel (Toutanova and Moore 2002)  Incorporate device into channel  Not all Android phones need have the same error model  But spell correction may be done at the system level 51