CS 6320 Natural Language Processing

Similar documents
Information Retrieval. (M&S Ch 15)

In = number of words appearing exactly n times N = number of words in the collection of words A = a constant. For example, if N=100 and the most

Information Retrieval and Web Search

Information Retrieval. Information Retrieval and Web Search

Information Retrieval CS Lecture 06. Razvan C. Bunescu School of Electrical Engineering and Computer Science

Information Retrieval and Search Engine

Information Retrieval CS Lecture 01. Razvan C. Bunescu School of Electrical Engineering and Computer Science

Chapter 6: Information Retrieval and Web Search. An introduction

Multimedia Information Systems

Introduction to Information Retrieval

Basic Tokenizing, Indexing, and Implementation of Vector-Space Retrieval

CS473: Course Review CS-473. Luo Si Department of Computer Science Purdue University

Chapter 27 Introduction to Information Retrieval and Web Search

Information Retrieval

Information Retrieval (IR) Introduction to Information Retrieval. Lecture Overview. Why do we need IR? Basics of an IR system.

Introduction to Information Retrieval

Instructor: Stefan Savev

CS54701: Information Retrieval

10/10/13. Traditional database system. Information Retrieval. Information Retrieval. Information retrieval system? Information Retrieval Issues

Boolean Model. Hongning Wang

Introduction to Information Retrieval

Information Retrieval on the Internet (Volume III, Part 3, 213)

Natural Language Processing Basics. Yingyu Liang University of Wisconsin-Madison

Information Retrieval. CS630 Representing and Accessing Digital Information. What is a Retrieval Model? Basic IR Processes

CS377: Database Systems Text data and information. Li Xiong Department of Mathematics and Computer Science Emory University

Information Retrieval

James Mayfield! The Johns Hopkins University Applied Physics Laboratory The Human Language Technology Center of Excellence!

Information Retrieval and Web Search

Text Analytics (Text Mining)

Information Retrieval. hussein suleman uct cs

Basic techniques. Text processing; term weighting; vector space model; inverted index; Web Search

Session 10: Information Retrieval

Similarity search in multimedia databases

modern database systems lecture 4 : information retrieval

Information Retrieval: Retrieval Models

Text Analytics (Text Mining)

Overview of Information Retrieval and Organization. CSC 575 Intelligent Information Retrieval

Knowledge Retrieval. Franz J. Kurfess. Computer Science Department California Polytechnic State University San Luis Obispo, CA, U.S.A.

Web Information Retrieval using WordNet

Outline. Possible solutions. The basic problem. How? How? Relevance Feedback, Query Expansion, and Inputs to Ranking Beyond Similarity

Department of Electronic Engineering FINAL YEAR PROJECT REPORT

Tag-based Social Interest Discovery

Midterm Exam Search Engines ( / ) October 20, 2015

Chapter 3 - Text. Management and Retrieval

Concept-Based Document Similarity Based on Suffix Tree Document

SYSTEMS FOR NON STRUCTURED INFORMATION MANAGEMENT

This lecture: IIR Sections Ranked retrieval Scoring documents Term frequency Collection statistics Weighting schemes Vector space scoring

Chapter 2. Architecture of a Search Engine

Reading group on Ontologies and NLP:

Suresha M Department of Computer Science, Kuvempu University, India

Optimal Query. Assume that the relevant set of documents C r. 1 N C r d j. d j. Where N is the total number of documents.

Influence of Word Normalization on Text Classification

Boolean Queries. Keywords combined with Boolean operators:

Feature selection. LING 572 Fei Xia

Digital Libraries: Language Technologies

Information Retrieval

Text Analytics. Index-Structures for Information Retrieval. Ulf Leser

Social Media Computing

Information Retrieval

Natural Language Processing

60-538: Information Retrieval

A Survey Of Different Text Mining Techniques Varsha C. Pande 1 and Dr. A.S. Khandelwal 2

Information Retrieval (Part 1)

Multimedia Information Extraction and Retrieval Term Frequency Inverse Document Frequency

Relevance Feedback and Query Reformulation. Lecture 10 CS 510 Information Retrieval on the Internet Thanks to Susan Price. Outline

Designing and Building an Automatic Information Retrieval System for Handling the Arabic Data

Sense-based Information Retrieval System by using Jaccard Coefficient Based WSD Algorithm

Mining Web Data. Lijun Zhang

Chrome based Keyword Visualizer (under sparse text constraint) SANGHO SUH MOONSHIK KANG HOONHEE CHO

COMP6237 Data Mining Searching and Ranking

VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK VII SEMESTER

vector space retrieval many slides courtesy James Amherst

Introduction to Information Retrieval

Vannevar Bush. Information Retrieval. Prophetic: Hypertext. Historic Vision 2/8/17

Fall CS646: Information Retrieval. Lecture 2 - Introduction to Search Result Ranking. Jiepu Jiang University of Massachusetts Amherst 2016/09/12

CHAPTER 3 INFORMATION RETRIEVAL BASED ON QUERY EXPANSION AND LATENT SEMANTIC INDEXING

Informa/on Retrieval. Text Search. CISC437/637, Lecture #23 Ben CartereAe. Consider a database consis/ng of long textual informa/on fields

Text Analytics. Index-Structures for Information Retrieval. Ulf Leser

Chapter 4. Processing Text

How Does a Search Engine Work? Part 1

Information Retrieval. Chap 7. Text Operations

Representation/Indexing (fig 1.2) IR models - overview (fig 2.1) IR models - vector space. Weighting TF*IDF. U s e r. T a s k s

Document Clustering: Comparison of Similarity Measures

Balancing Manual and Automatic Indexing for Retrieval of Paper Abstracts

Mining Web Data. Lijun Zhang

Design and Implementation of Search Engine Using Vector Space Model for Personalized Search

Semantic Search in s

Information Retrieval

Query Languages. Berlin Chen Reference: 1. Modern Information Retrieval, chapter 4

Shrey Patel B.E. Computer Engineering, Gujarat Technological University, Ahmedabad, Gujarat, India

Knowledge Discovery and Data Mining 1 (VO) ( )

A Deep Relevance Matching Model for Ad-hoc Retrieval

Query Refinement and Search Result Presentation

ΕΠΛ660. Ανάκτηση µε το µοντέλο διανυσµατικού χώρου

TERM BASED WEIGHT MEASURE FOR INFORMATION FILTERING IN SEARCH ENGINES

Information Retrieval

Web Search Engine Question Answering

Automatic Document; Retrieval Systems. The conventional library classifies documents by numeric subject codes which are assigned manually (Dewey

Introduction to Information Retrieval (Manning, Raghavan, Schutze)

Authoritative K-Means for Clustering of Web Search Results

Transcription:

CS 6320 Natural Language Processing Information Retrieval Yang Liu Slides modified from Ray Mooney s (http://www.cs.utexas.edu/users/mooney/ir-course/slides/) 1 Introduction of IR System components, basic models Evaluation Web search Yang Liu: CS6320 NLP 2 1

Information Retrieval The indexing and retrieval of textual documents. Searching for pages on the World Wide Web is the most recent killer app. Concerned firstly with retrieving relevant documents to a query. Concerned secondly with retrieving from large sets of documents efficiently. Yang Liu: CS6320 NLP 3 Typical IR Task Given: Find: A corpus of textual natural-language documents. A user query in the form of a textual string. A ranked set of documents that are relevant to the query. Yang Liu: CS6320 NLP 4 2

IR System Document corpus Query String IR System Ranked Documents 1. Doc1 2. Doc2 3. Doc3.. Yang Liu: CS6320 NLP 5 Relevance Relevance is a subjective judgment and may include: Being on the proper subject. Being timely (recent information). Being authoritative (from a trusted source). Satisfying the goals of the user and his/her intended use of the information (information need). Yang Liu: CS6320 NLP 6 3

Keyword Search Simplest notion of relevance is that the query string appears verbatim in the document. Slightly less strict notion is that the words in the query appear frequently in the document, in any order (bag of words). Yang Liu: CS6320 NLP 7 Problems with Keywords May not retrieve relevant documents that include synonymous terms. restaurant vs. café PRC vs. China May retrieve irrelevant documents that include ambiguous terms. bat (baseball vs. mammal) Apple (company vs. fruit) bite (unit of data vs. act of eating) Yang Liu: CS6320 NLP 8 4

Intelligent IR Taking into account the meaning of the words used. Taking into account the order of words in the query. Adapting to the user based on direct or indirect feedback. Taking into account the authority of the source. Yang Liu: CS6320 NLP 9 IR System Components Text Operations forms index words (tokens). Stopword removal Stemming Indexing constructs an inverted index of word to document pointers. Searching retrieves documents that contain a given query token from the inverted index. Ranking scores all retrieved documents according to a relevance metric. Yang Liu: CS6320 NLP 10 5

IR System Components (continued) User Interface manages interaction with the user: Query input and document output. Relevance feedback. Visualization of results. Query Operations transform the query to improve retrieval: Query expansion using a thesaurus. Query transformation using relevance feedback. Yang Liu: CS6320 NLP 11 History of IR 1960-70 s: Initial exploration of text retrieval systems for small corpora of scientific abstracts, and law and business documents. Development of the basic Boolean and vector-space models of retrieval. Prof. Salton and his students at Cornell University are the leading researchers in the area. 1980 s: Large document database systems, many run by companies Lexis-Nexis, Dialog, MEDLINE Yang Liu: CS6320 NLP 12 6

IR History 1990 s: Searching the World Wide Web Lycos, Yahoo, Altavista Organized Competitions NIST TREC Recommender Systems Ringo, Amazon, NetPerceptions Yang Liu: CS6320 NLP 13 Recent IR History 2000 s Link analysis for Web Search Google Automated Information Extraction Question Answering TREC Q/A track Multimedia IR Image Video Audio and music Cross-Language IR DARPA Tides Document Summarization Yang Liu: CS6320 NLP 14 7

Related Areas Database Management Library and Information Science Artificial Intelligence Natural Language Processing Machine Learning Yang Liu: CS6320 NLP 15 Related Areas Database management Recent move towards semi-structured data (XML) brings it closer to IR. Library and information science AI Recent work on digital libraries brings it closer to CS & IR. Recent work on web ontologies and intelligent information agents brings it closer to IR. Yang Liu: CS6320 NLP 16 8

NLP: IR Directions NLP: syntactic, semantic, and pragmatic analysis of natural language text and discourse. Ability to analyze syntax (phrase structure) and semantics could allow retrieval based on meaning rather than keywords. Methods for determining the sense of an ambiguous word based on context (word sense disambiguation). Methods for identifying specific pieces of information in a document (information extraction). Methods for answering specific NL questions from Yang Liu: CS6320 NLP 17 document corpora. Machine Learning: IR Directions Text Categorization Automatic hierarchical classification. Adaptive filtering/routing/recommending. Automated spam filtering. Text Clustering Clustering of IR query results. Automatic formation of hierarchies. Learning for Information Extraction Text Mining Yang Liu: CS6320 NLP 18 9

Retrieval Tasks Ad hoc retrieval: Fixed document corpus, varied queries. Filtering: Fixed query, continuous document stream. User Profile: A model of relative static preferences. Binary decision of relevant/not-relevant. Yang Liu: CS6320 NLP 19 Retrieval Models A retrieval model specifies the details of: Document representation Query representation Retrieval function Determines a notion of relevance. Notion of relevance can be binary or continuous (i.e., ranked retrieval). Yang Liu: CS6320 NLP 20 10

Classes of Retrieval Models Boolean models (set theoretic) Extended Boolean Vector space models (statistical/algebraic) Generalized VS Latent Semantic Indexing Probabilistic models Yang Liu: CS6320 NLP 21 Common Preprocessing Steps Strip unwanted characters/markup (e.g., HTML tags, punctuation, numbers, etc.). Break into tokens (keywords) on whitespace. Stem tokens to root words computational comput Remove common stopwords (e.g., a, the, it, etc.). Detect common phrases (possibly using a domain specific dictionary). Build inverted index (keyword list of docs containing it). Yang Liu: CS6320 NLP 22 11

Simple Tokenizing Analyze text into a sequence of discrete tokens (words). Sometimes punctuation (e-mail), numbers (1999), and case (Republican vs. republican) can be a meaningful part of a token. However, frequently they are not. Simplest approach is to ignore all numbers and punctuation and use only case-insensitive unbroken strings of alphabetic characters as tokens. Tokenizing HTML documents Yang Liu: CS6320 NLP 23 Stopwords It is typical to exclude high-frequency words (e.g., function words: a, the, in, to ; pronouns: I, he, she, it ). Stopwords are language dependent. Yang Liu: CS6320 NLP 24 12

Stemming Reduce tokens to root form of words to recognize morphological variation. computer, computational, computation all reduced to same token compute Correct morphological analysis is language specific and can be complex. Stemming blindly strips off known affixes (prefixes and suffixes) in an iterative fashion. Not always help IR. Yang Liu: CS6320 NLP 25 Porter Stemmer Simple procedure for removing known affixes in English without using a dictionary. Can produce unusual stems that are not English words: computer, computational, computation all reduced to same token comput May conflate (reduce to the same token) words that are actually distinct. Not recognize all morphological derivations. Yang Liu: CS6320 NLP 26 13

Boolean Model A document is represented as a set of keywords. Queries are Boolean expressions of keywords, connected by AND, OR, and NOT, including the use of brackets to indicate scope. [[Rio & Brazil] [Hilo & Hawaii]] & hotel &!Hilton] Output: Document is relevant or not. No partial matches or ranking. Pros: Popular retrieval model because: Easy to understand for simple queries. Clean formalism. Reasonably efficient implementations possible for normal queries. Yang Liu: CS6320 NLP 27 Boolean Models Problems Very rigid: AND means all; OR means any. Difficult to express complex user requests. Difficult to control the number of documents retrieved. All matched documents will be returned. Difficult to rank output. All matched documents logically satisfy the query. Difficult to perform relevance feedback. If a document is identified by the user as relevant or irrelevant, how should the query be modified? Yang Liu: CS6320 NLP 28 14

Statistical Models A document is typically represented by a bag of words (unordered words with frequencies). Bag = set that allows multiple occurrences of the same element. User specifies a set of desired terms with optional weights: Weighted query terms: Q = < database 0.5; text 0.8; information 0.2 > Unweighted query terms: Q = < database; text; information > No Boolean conditions specified in the query. Yang Liu: CS6320 NLP 29 Statistical Retrieval Retrieval based on similarity between query and documents. Output documents are ranked according to similarity to query. Similarity based on occurrence frequencies of keywords in query and document. Automatic relevance feedback can be supported: Relevant documents added to query. Irrelevant documents subtracted from query. Yang Liu: CS6320 NLP 30 15

Issues for Vector Space Model How to determine important words in a document? Word sense? Word n-grams (and phrases, idioms, ) terms How to determine the degree of importance of a term within a document and within the entire collection? How to determine the degree of similarity between a document and the query? In the case of the web, what is a collection and what are the effects of links, formatting information, etc.? Yang Liu: CS6320 NLP 31 The Vector-Space Model Assume t distinct terms remain after preprocessing; call them index terms or the vocabulary. These orthogonal terms form a vector space. Dimension = t = vocabulary Each term, i, in a document or query, j, is given a real-valued weight, w ij. Both documents and queries are expressed as t-dimensional vectors: d j = (w 1j, w 2j,, w tj ) Yang Liu: CS6320 NLP 32 16

Graphic Representation Example: D 1 = 2T 1 + 3T 2 +5T 3 D 2 = 3T 1 + 7T 2 + T 3 5 T 3 Q = 0T 1 + 0T 2 + 2T 3 D 1 = 2T 1 + 3T 2 + 5T 3 Q = 0T 1 + 0T 2 + 2T 3 2 3 T 1 D 2 = 3T 1 + 7T 2 + T 3 T 2 7 Is D 1 or D 2 more similar to Q? How to measure the degree of similarity? Distance? Angle? Projection? Yang Liu: CS6320 NLP 33 Document Collection A collection of n documents can be represented in the vector space model by a term-document matrix. An entry in the matrix corresponds to the weight of a term in the document; zero means the term has no significance in the document or it simply doesn t exist in the document. T 1 T 2. T t D 1 w 11 w 21 w t1 D 2 w 12 w 22 w t2 : : : : : : : : D n w 1n w 2n w tn Yang Liu: CS6320 NLP 34 17

Term Weights: Term Frequency (TF) More frequent terms in a document are more important, i.e., more indicative of the topic. f ij = frequency of term i in document j May want to normalize term frequency (tf) across the entire corpus: tf ij = f ij / max{f ij } Yang Liu: CS6320 NLP 35 Term Weights: Inverse Document Frequency (IDF) Terms that appear in many different documents are less indicative of overall topic. df i = document frequency of term i = number of documents containing term i idf i = inverse document frequency of term i, = log 2 (N/ df i ) (N: total number of documents) An indication of a term s discrimination power. Log used to dampen the effect relative to tf. Yang Liu: CS6320 NLP 36 18

TF-IDF Weighting A typical combined term importance indicator is tf-idf weighting: w ij = tf ij idf i = tf ij log 2 (N/ df i ) A term occurring frequently in the document but rarely in the rest of the collection is given high weight. Many other ways of determining term weights have been proposed. Experimentally, tf-idf has been found to work well. Yang Liu: CS6320 NLP 37 Computing TF-IDF -- An Example Given a document containing terms with given frequencies: A(3), B(2), C(1) Assume collection contains 10,000 documents and document frequencies of these terms are: A(50), B(1300), C(250) Then: A: tf = 3/3; idf = log(10000/50) = 5.3; tf-idf = 5.3 B: tf = 2/3; idf = log(10000/1300) = 2.0; tf-idf = 1.3 C: tf = 1/3; idf = log(10000/250) = 3.7; tf-idf = 1.2 Yang Liu: CS6320 NLP 38 19

Query Vector Query vector is typically treated as a document and also tf-idf weighted. Alternative is for the user to supply weights for the given query terms. Yang Liu: CS6320 NLP 39 Similarity Measure A similarity measure is a function that computes the degree of similarity between two vectors. Using a similarity measure between the query and each document: It is possible to rank the retrieved documents in the order of presumed relevance. It is possible to enforce a certain threshold so that the size of the retrieved set can be controlled. Yang Liu: CS6320 NLP 40 20

Similarity Measure - Inner Product Similarity between vectors for the document d i and query q can be computed as the vector inner product: t sim(d j,q) = d j q = w ij w iq where w ij is the weight of term i in document j and w iq is the weight of term i in the query For binary vectors, the inner product is the number of matched query terms in the document (size of intersection). For weighted term vectors, it is the sum of the products of the weights of the matched terms. i= 1 Yang Liu: CS6320 NLP 41 Properties of Inner Product The inner product is unbounded. Favors long documents with a large number of unique terms. Measures how many terms matched but not how many terms are not matched. Yang Liu: CS6320 NLP 42 21

Inner Product -- Examples Binary: D = 1, 1, 1, 0, 1, 1, 0 Q = 1, 0, 1, 0, 0, 1, 1 sim(d, Q) = 3 Size of vector = size of vocabulary = 7 0 means corresponding term not found in document or query Weighted: D 1 = 2T 1 + 3T 2 + 5T 3 D 2 = 3T 1 + 7T 2 + 1T 3 Q = 0T 1 + 0T 2 + 2T 3 sim(d 1, Q) = 2*0 + 3*0 + 5*2 = 10 sim(d 2, Q) = 3*0 + 7*0 + 1*2 = 2 Yang Liu: CS6320 NLP 43 Cosine Similarity Measure Cosine similarity measures the cosine of the angle between two vectors. Inner product normalized by the vector lengths. t r r ( d q w ij w iq ) j i = 1 cossim ( d, q ) = = j r r t 2 t 2 d j q w w ij i = 1 i = 1 D 1 = 2T 1 + 3T 2 + 5T 3 CosSim(D 1, Q) = 10 / (4+9+25)(0+0+4) = 0.81 D 2 = 3T 1 + 7T 2 + 1T 3 CosSim(D 2, Q) = 2 / (9+49+1)(0+0+4) = 0.13 Q = 0T 1 + 0T 2 + 2T 3 D 1 is 6 times better than D 2 using cosine similarity but only 5 times better using inner product. iq t 2 D 1 Yang Liu: CS6320 NLP 44 θ 1 θ 2 D 2 t 3 Q t 1 22

Naïve Implementation Convert all documents in collection D to tf-idf weighted vectors, d j, for keyword vocabulary V. Convert query to a tf-idf-weighted vector q. For each d j in D do Compute score s j = cossim(d j, q) Sort documents by decreasing score. Present top ranked documents to the user. Time complexity: O( V D ) Bad for large V & D! V = 10,000; D = 100,000; V D = 1,000,000,000 Yang Liu: CS6320 NLP 45 Comments on Vector Space Models Simple, mathematically based approach. Considers both local (tf) and global (idf) word occurrence frequencies. Provides partial matching and ranked results. Tends to work quite well in practice despite obvious weaknesses. Allows efficient implementation for large document collections. Yang Liu: CS6320 NLP 46 23

Problems with Vector Space Model Missing semantic information (e.g., word sense). Missing syntactic information (e.g., phrase structure, word order, proximity information). Assumption of term independence (e.g., ignores synonymy). Lacks the control of a Boolean model (e.g., requiring a term to appear in a document). Given a two-term query A B, may prefer a document containing A frequently but not B, over a document that contains both A and B, but both less frequently. Yang Liu: CS6320 NLP 47 Implementation Issues Sparse Vectors Vocabulary and therefore dimensionality of vectors can be very large, ~10 4. However, most documents and queries do not contain most words, so vectors are sparse (i.e. most entries are 0). Need efficient methods for storing and computing with sparse vectors. Linked list Trees Hash table Yang Liu: CS6320 NLP 48 24

Inverted Files In practice, document vectors are not stored directly; an inverted organization provides much better efficiency. The keyword-to-document index can be implemented as a hash table, a sorted array, or a tree-based data structure. Critical issue is logarithmic or constanttime access to token information. Yang Liu: CS6320 NLP 49 Inverted Index Index terms df D j, tf j computer database 3 2 D 7, 4 D 1, 3 science 4 D 2, 4 system 1 D 5, 2 Index file Postings lists Complexity of indexing: O(mn) (m documents, each has n tokens) Yang Liu: CS6320 NLP 50 25

Retrieval with an Inverted Index Tokens that are not in both the query and the document do not effect cosine similarity. Product of token weights is zero and does not contribute to the dot product. Usually the query is fairly short, and therefore its vector is extremely sparse. Use inverted index to find the limited set of documents that contain at least one of the query words. Yang Liu: CS6320 NLP 51 Inverted Query Retrieval Efficiency Assume that, on average, a query word appears in B documents: Q = q 1 q 2 q n D 11 D 1B D 21 D 2B D n1 D nb Then retrieval time is O( Q B), which is typically, much better than naïve retrieval that examines all N documents, O( V N), because Q << V and B << N. Yang Liu: CS6320 NLP 52 26