Srihari-CSE635-Fall 2002 CSE 635 Multimedia Information Retrieval Chapter 7: Text Preprocessing.

Slides:



Advertisements
Similar presentations
Special Topics in Computer Science Advanced Topics in Information Retrieval Lecture 8: Natural Language Processing and IR. Synonymy, Morphology, and Stemming.
Advertisements

Srihari-CSE535-Spring2008 CSE 535 Information Retrieval Chapter 2: Text Operations.
CS Morphological Parsing CS Parsing Taking a surface input and analyzing its components and underlying structure Morphological parsing:
Chapter 5: Introduction to Information Retrieval
Introduction to Information Retrieval
Lex -- a Lexical Analyzer Generator (by M.E. Lesk and Eric. Schmidt) –Given tokens specified as regular expressions, Lex automatically generates a routine.
LING 388: Language and Computers Sandiway Fong Lecture 21: 11/8.
Properties of Text CS336 Lecture 3:. 2 Generating Document Representations Want to automatically generate with little human intervention Use significant.
Stemming Algorithms 資訊擷取與推薦技術:期中報告 指導教授:黃三益 老師 學生: 黃哲修 張家豪.
Intelligent Information Retrieval CS 336 –Lecture 3: Text Operations Xiaoyan Li Spring 2006.
 Lex helps to specify lexical analyzers by specifying regular expression  i/p notation for lex tool is lex language and the tool itself is refered to.
(C) 2003, The University of Michigan1 Information Retrieval Handout #4 January 28, 2005.
December 2007NLP: Conflation Algorithms1 Natural Language Processing Conflation Algorithms.
Term Processing & Normalization Major goal: Find the best possible representation Minor goals: Improve storage and speed First: Need to transform sequence.
CS 430 / INFO 430 Information Retrieval
1 Discussion Class 3 The Porter Stemmer. 2 Course Administration No class on Thursday.
Spring 2002NLE1 CC 384: Natural Language Engineering Week 2, Lecture 2 - Lemmatization and Stemming; the Porter Stemmer.
CS 430 / INFO 430 Information Retrieval
Vocabulary size and term distribution: tokenization, text normalization and stemming Lecture 2.
Text Operations: Preprocessing. Introduction Document preprocessing –to improve the precision of documents retrieved –lexical analysis, stopwords elimination,
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Association Clusters Definition The frequency of a stem in a document,, is referred to as. Let be an association matrix with rows and columns, where. Let.
176 Formal Languages and Applications: We know that Pascal programming language is defined in terms of a CFG. All the other programming languages are context-free.
The College of Saint Rose CIS 460 – Search and Information Retrieval David Goldschmidt, Ph.D. from Search Engines: Information Retrieval in Practice, 1st.
WMES3103 : INFORMATION RETRIEVAL
LING 438/538 Computational Linguistics Sandiway Fong Lecture 18: 11/1.
Lexical Analysis - Scanner- Contd Computer Science Rensselaer Polytechnic Compiler Design Lecture 4(01/26/98)
Learning Bit by Bit Class 3 – Stemming and Tokenization.
What is a document? Information need: From where did the metaphor, doing X is like “herding cats”, arise? quotation? “Managing senior programmers is like.
1 Basic Text Processing and Indexing. 2 Document Processing Steps Lexical analysis (tokenizing) Stopwords removal Stemming Selection of indexing terms.
LING 388 Language and Computers Lecture 21 11/13/03 Sandiway FONG.
Chapter 5: Information Retrieval and Web Search
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong. Administrivia Grading – Midterm grading not finished yet – Homework 3 graded Reminder – Next Monday:
Morphological Recognition We take each sub-lexicon of each stem class and we expand each arc (e.g. the reg-noun arc) with all the morphemes that make up.
Chapter 2 Architecture of a Search Engine. Search Engine Architecture n A software architecture consists of software components, the interfaces provided.
Text Preprocessing. Preprocessing step Aims to create a correct text representation, according to the adopted model. Step: –Lexical analysis; –Case folding,
Lexical Analysis Hira Waseem Lecture
Review: Regular expression: –How do we define it? Given an alphabet, Base case: – is a regular expression that denote { }, the set that contains the empty.
1 University of Palestine Topics In CIS ITBS 3202 Ms. Eman Alajrami 2 nd Semester
Chapter 6: Information Retrieval and Web Search
LIS618 lecture 3 Thomas Krichel Structure of talk Document Preprocessing Basic ingredients of query languages Retrieval performance evaluation.
Copyright © Curt Hill Languages and Grammars This is not English Class. But there is a resemblance.
Basic Implementation and Evaluations Aj. Khuanlux MitsophonsiriCS.426 INFORMATION RETRIEVAL.
Web- and Multimedia-based Information Systems Lecture 2.
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
1 String Processing CHP # 3. 2 Introduction Computer are frequently used for data processing, here we discuss primary application of computer today is.
LING/C SC/PSYC 438/538 Lecture 25 Sandiway Fong 1.
(C) 2003, The University of Michigan1 Information Retrieval Handout #2 February 3, 2003.
1 Discussion Class 3 Stemming Algorithms. 2 Discussion Classes Format: Question Ask a member of the class to answer Provide opportunity for others to.
NLP. Text similarity People can express the same concept (or related concepts) in many different ways. For example, “the plane leaves at 12pm” vs “the.
Feature Assignment LBSC 878 February 22, 1999 Douglas W. Oard and Dagobert Soergel.
Selecting Relevant Documents Assume: –we already have a corpus of documents defined. –goal is to return a subset of those documents. –Individual documents.
Modern Information Retrieval Chapter 7: Text Operations Ricardo Baeza-Yates Berthier Ribeiro-Neto.
1 Chapter 7 Text Operations. 2 Logical View of a Document document structure recognition text+ structure accents, spacing, etc. stopwords noun groups.
Advanced Data Structures Lecture 8 Mingmin Xie. Agenda Overview Trie Suffix Tree Suffix Array, LCP Construction Applications.
VECTOR SPACE INFORMATION RETRIEVAL 1Adrienn Skrop.
Stemming Algorithms 資訊擷取與推薦技術:期中報告 指導教授:黃三益 老師 學生: 黃哲修 張家豪 From
Information Retrieval in Practice
Chapter 2 :: Programming Language Syntax
CS 430: Information Discovery
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong.
Token generation - stemming
Review: Compiler Phases:
Chapter 7 Lexical Analysis and Stoplists
資訊擷取與推薦技術:期中報告 指導教授:黃三益 老師 學生: 黃哲修 張家豪
INFORMATION RETRIEVAL TECHNIQUES BY DR. ADNAN ABID
Basic Text Processing Word tokenization.
Discussion Class 3 Stemming Algorithms.
Information Retrieval and Web Design
Lexical Analysis - Scanner-Contd
Presentation transcript:

Srihari-CSE635-Fall 2002 CSE 635 Multimedia Information Retrieval Chapter 7: Text Preprocessing

Srihari-CSE635-Fall 2002 Document Pre-Processing Lexical analysis digits, hypens, punctuation marks e.g. I’ll --> I will Stopword elimination filter out words with low discriminatory value stopword list reduces size of index by 40% or more might miss documents, e.g. “to be or not to be” Stemming connecting, connected, etc. Selection of index terms e.g. select nouns only Thesaurus construction permits query expansion Lexical analysis digits, hypens, punctuation marks e.g. I’ll --> I will Stopword elimination filter out words with low discriminatory value stopword list reduces size of index by 40% or more might miss documents, e.g. “to be or not to be” Stemming connecting, connected, etc. Selection of index terms e.g. select nouns only Thesaurus construction permits query expansion

Srihari-CSE635-Fall 2002 Lexical Analysis Converting stream of characters into stream of words/tokens more than just detecting spaces between words Disregard numbers as index terms too vague perform date and number normalization Hyphens consistent policy on removal e.g. B-52 Punctuation marks typically removed sometimes problematic, e.g. variable names myclass.height Orthographic variations typically disregarded Converting stream of characters into stream of words/tokens more than just detecting spaces between words Disregard numbers as index terms too vague perform date and number normalization Hyphens consistent policy on removal e.g. B-52 Punctuation marks typically removed sometimes problematic, e.g. variable names myclass.height Orthographic variations typically disregarded

Srihari-CSE635-Fall 2002 OAC Stopword list (~ 275 words) The Complete OAC-Search Stopword List adidhasnobodysomewhereusually aboutdohavenoonesoonvery alldoeshavingnorstillwas almostdoingherenotsuchway alongdonehownothingthanways alreadyduringhowevernowthatwe alsoeachiofthewell althougheitherifoncetheirwent alwaysenoughiionetheirswere ametcinone'sthenwhat amongevenincludingonlytherewhen aneverindeedorthereforewhenever andeveryinsteadotherthesewhere anyeveryoneintootherstheywherever anyoneeverythingisourthingwhether anythingforitoursthingswhich

Srihari-CSE635-Fall 2002 Stopword list contd. anywhere from its out this while are further itself over those who as gave just own though whoever at get like perhaps through why away getting likely rather thus will because give may really to with between given maybe same together within beyond giving me shall too without both go might should toward would but going mine simply until yes by gone much since upon yet can good must so us you cannot got neither some use your come great never someone used yours could had no something uses yourself sometimes using

Srihari-CSE635-Fall 2002 Stemming Algorithms Designed to standardize morphological variations stem is the portion of a word which is left after the removal of its affixes (prefixes and suffixes) Benefits of stemming supposedly, to increase recall; could lead to lower precision controversy surrounding benefits web search engines do NOT perform stemming 4 types of stemming algorithms affix removal table look-up successor variety (uses knowledge from structural linguistics, more complex) n-grams Porter Stemming algorithm Designed to standardize morphological variations stem is the portion of a word which is left after the removal of its affixes (prefixes and suffixes) Benefits of stemming supposedly, to increase recall; could lead to lower precision controversy surrounding benefits web search engines do NOT perform stemming 4 types of stemming algorithms affix removal table look-up successor variety (uses knowledge from structural linguistics, more complex) n-grams Porter Stemming algorithm

Srihari-CSE635-Fall 2002 Porter Stemmer - 1 A consonant in a word is a letter other than A, E, I, O or U, and other than Y preceded by a consonant. (The fact that the term ‘consonant’ is defined to some extent in terms of itself does not make it ambiguous.) So in TOY the consonants are T and Y, and in SYZYGY they are S, Z and G. If a letter is not a consonant it is a vowel. A consonant will be denoted by c, a vowel by v. A list ccc... of length greater than 0 will be denoted by C, and a list vvv... of length greater than 0 will be denoted by V. Any word, or part of a word, therefore has one of the four forms: CVCV... C CVCV... V VCVC... C VCVC... V These may all be represented by the single form [C]VCVC... [V] where the square brackets denote arbitrary presence of their contents. Using (VC) m to denote VC repeated m times, this may again be written as [C](VC) m [V]. m will be called the measure of any word or word part when represented in this form. The case m = 0 covers the null word. Here are some examples: m=0 TR, EE, TREE, Y, BY. m=1 TROUBLE, OATS, TREES, IVY. m=2 TROUBLES, PRIVATE, OATEN, ORRERY.

Srihari-CSE635-Fall 2002 Porter Stemmer - 2 The rules for removing a suffix will be given in the form (condition) S1 -> S2 This means that if a word ends with the suffix S1, and the stem before S1 satisfies the given condition, S1 is replaced by S2. The condition is usually given in terms of m, e.g. (m > 1) EMENT -> Here S1 is ‘EMENT’ and S2 is null. This would map REPLACEMENT to REPLAC, since REPLAC is a word part for which m = 2. The ‘condition’ part may also contain the following: *S - the stem ends with S (and similarly for the other letters). *v* - the stem contains a vowel. *d - the stem ends with a double consonant (e.g. -TT, -SS). *o - the stem ends cvc, where the second c is not W, X or Y (e.g. -WIL, -HOP). And the condition part may also contain expressions with and, or and not, so that (m>1 and (*S or *T)) tests for a stem with m>1 ending in S or T, while (*d and not (*L or *S or *Z)) tests for a stem ending with a double consonant other than L, S or Z. Elaborate conditions like this are required only rarely. In a set of rules written beneath each other, only one is obeyed, and this will be the one with the longest matching S1 for the given word. For example, with SSES -> SS IES -> I SS -> SS S -> (here the conditions are all null) CARESSES maps to CARESS since SSES is the longest match for S1. Equally CARESS maps to CARESS (S1=‘SS’) and CARES to CARE (S1=‘S’).

Srihari-CSE635-Fall 2002 Porter Stemmer - Step 1a In the rules below, examples of their application, successful or otherwise, are given on the right in lower case. Only one rule from each step can fire. The algorithm now follows: Step 1a SSES -> SS caresses -> caress IES -> I ponies -> poni ties -> ti SS -> SS caress -> caress S -> cats -> cat

Srihari-CSE635-Fall 2002 Porter Stemmer- Step 1b Step 1b (m>0) EED -> EE feed -> feed agreed -> agree (*v*) ED -> plastered -> plaster bled -> bled (*v*) ING -> motoring -> motor sing -> sing If the second or third of the rules in Step 1b is successful, the following is done: AT -> ATE conflat(ed) -> conflate BL -> BLE troubl(ed) -> trouble IZ -> IZE siz(ed) -> size (*d and not (*L or *S or *Z)) -> single letter hopp(ing) -> hop tann(ed) -> tan fall(ing) -> fall hiss(ing) -> hiss fizz(ed) -> fizz (m=1 and *o) -> E fail(ing) -> fail fil(ing) -> file The rule to map to a single letter causes the removal of one of the double letter pair. The -E is put back on -AT, -BL and -IZ, so that the suffixes -ATE, -BLE and -IZE can be recognised later. This E may be removed in step 4.

Srihari-CSE635-Fall 2002 Porter Stemmer- Step 1c Step 1c (*v*) Y -> I happy -> happi sky -> sky Step 1 deals with plurals and past participles. The subsequent steps are much more straightforward.

Srihari-CSE635-Fall 2002 Porter Stemmer - Step 2 (m>0) ATIONAL -> ATE relational -> relate (m>0) TIONAL -> TION conditional -> condition rational -> rational (m>0) ENCI -> ENCE valenci -> valence (m>0) ANCI -> ANCE hesitanci -> hesitance (m>0) IZER -> IZE digitizer -> digitize (m>0) ABLI -> ABLE conformabli -> conformable (m>0) ALLI -> AL radicalli -> radical (m>0) ENTLI -> ENT differentli -> different (m>0) ELI -> E vileli -> vile (m>0) OUSLI -> OUS analogousli -> analogous (m>0) IZATION -> IZE vietnamization -> vietnamize (m>0) ATION -> ATE predication -> predicate (m>0) ATOR -> ATE operator -> operate (m>0) ALISM -> AL feudalism -> feudal (m>0) IVENESS -> IVE decisiveness -> decisive (m>0) FULNESS -> FUL hopefulness -> hopeful (m>0) OUSNESS -> OUS callousness -> callous (m>0) ALITI -> AL formaliti -> formal (m>0) IVITI -> IVE sensitiviti -> sensitive (m>0) BILITI -> BLE sensibiliti -> sensible The test for the string S1 can be made fast by doing a program switch on the penultimate letter of the word being tested. This gives a fairly even breakdown of the possible values of the string S1. It will be seen in fact that the S1-strings in step 2 are presented here in the alphabetical order of their penultimate letter. Similar techniques may be applied in the other steps.

Srihari-CSE635-Fall 2002 Porter Stemmer - Step 3 (m>0) ICATE -> IC triplicate -> triplic (m>0) ATIVE -> formative -> form (m>0) ALIZE -> AL formalize -> formal (m>0) ICITI -> IC electriciti -> electric (m>0) ICAL -> IC electrical -> electric (m>0) FUL -> hopeful -> hope (m>0) NESS -> goodness -> good

Srihari-CSE635-Fall 2002 Porter Stemmer- Step 4 (m>1) AL -> revival -> reviv (m>1) ANCE -> allowance -> allow (m>1) ENCE -> inference -> infer (m>1) ER -> airliner -> airlin (m>1) IC -> gyroscopic -> gyroscop (m>1) ABLE -> adjustable -> adjust (m>1) IBLE -> defensible -> defens (m>1) ANT -> irritant -> irrit (m>1) EMENT -> replacement -> replac (m>1) MENT -> adjustment -> adjust (m>1) ENT -> dependent -> depend (m>1 and (*S or *T)) ION -> adoption -> adopt (m>1) OU -> homologou -> homolog (m>1) ISM -> communism -> commun (m>1) ATE -> activate -> activ (m>1) ITI -> angulariti -> angular (m>1) OUS -> homologous -> homolog (m>1) IVE -> effective -> effect (m>1) IZE -> bowdlerize -> bowdler The suffixes are now removed. All that remains is a little tidying up.

Srihari-CSE635-Fall 2002 Porter Stemmer - Step 5 Step 5a (m>1) E -> probate -> probat rate -> rate (m=1 and not *o) E -> cease -> ceas Step 5b (m > 1 and *d and *L) -> single letter controll -> control roll -> roll

Srihari-CSE635-Fall 2002 Stemming - example Word is “duplicatable” duplicatstep 4 duplicatestep 1b duplicstep 3 Word is “duplicatable” duplicatstep 4 duplicatestep 1b duplicstep 3

Srihari-CSE635-Fall 2002 Index Term Selection Noun groups e.g. computer science cluster into a single indexing term Noun groups e.g. computer science cluster into a single indexing term

Srihari-CSE635-Fall 2002 Thesauri Thesaurus precompiled list of words in a given domain for each word above, a list of related words computer-aided instruction computer applications educational computing Applications of Thesaurus in IR provides a standard vocabulary for indexing and searching medical literature querying proper query formulation classified hierarchies that allow broadening/narrowing of current query e.g. Yahoo Components of a thesaurus index terms relationship among terms layout design for term relationships Thesaurus precompiled list of words in a given domain for each word above, a list of related words computer-aided instruction computer applications educational computing Applications of Thesaurus in IR provides a standard vocabulary for indexing and searching medical literature querying proper query formulation classified hierarchies that allow broadening/narrowing of current query e.g. Yahoo Components of a thesaurus index terms relationship among terms layout design for term relationships

Srihari-CSE635-Fall 2002 Implementing Stoplists 2 ways to filter stoplist words from input token stream examine tokenizer output and remove any stopwords remove stopwords as part of lexical analysis (or tokenization) phase Approach 1: filtering after tokenization standard list search problem; every token must be looked up in stoplist binary search trees, hashing hashing is preferred method insert stoplist into a hash table each token hashed into table if location is empty, not a stopword; otherwise string comparisons to see whether hashed value is really a stopword Approach 2 much more efficient 2 ways to filter stoplist words from input token stream examine tokenizer output and remove any stopwords remove stopwords as part of lexical analysis (or tokenization) phase Approach 1: filtering after tokenization standard list search problem; every token must be looked up in stoplist binary search trees, hashing hashing is preferred method insert stoplist into a hash table each token hashed into table if location is empty, not a stopword; otherwise string comparisons to see whether hashed value is really a stopword Approach 2 much more efficient

Srihari-CSE635-Fall 2002 Building Lexical Analysers Finite state machines recognizer for regular expressions Lex ( popular Unix utility program generator designed for lexical processing of character input streams input: high-level, problem oriented specification for character string matching output: program in a general purpose language which recognizes regular expressions Source -> | Lex | -> yylex Input -> | yylex | -> Output Finite state machines recognizer for regular expressions Lex ( popular Unix utility program generator designed for lexical processing of character input streams input: high-level, problem oriented specification for character string matching output: program in a general purpose language which recognizes regular expressions Source -> | Lex | -> yylex Input -> | yylex | -> Output

Srihari-CSE635-Fall 2002 Writing lex source files Format of a lex source file: {definitions} % {rules} % {user subroutines} invoking lex: lex source cc lex.yy.c -ll minimum lex program is % (null program copies input to output) use rules to do any special transformations Program to convert British spelling to American colour printf("color"); mechanise printf("mechanize"); petrol printf("gas");

Srihari-CSE635-Fall 2002 Sample tokenizer using lex Sample input and output from above program here are some ids 1: now some numbers : ids with numbers x123 78xyz 3: 4: \:\