31 Dec 2004 NLP-AI Java Lecture No. 15 Satish Dethe

Slides:



Advertisements
Similar presentations
Computer Science 209 Software Development Equality and Comparisons.
Advertisements

IKI 10100: Data Structures & Algorithms Ruli Manurung (acknowledgments to Denny & Ade Azurat) 1 Fasilkom UI Ruli Manurung (Fasilkom UI)IKI10100: Lecture22.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 9A Sorting (Concepts)
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11: Sorting and Searching  Searching Linear Binary  Sorting.
Insertion Sorting Lecture 21. Insertion Sort Start from element 2 of list location 1 –In first iteration: Compare element 1 with all of its elements to.
Distance Functions for Sequence Data and Time Series
Searches & Sorts V Deena Engel’s class Adapted from W. Savitch’s text An Introduction to Computers & Programming.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (3) Recurrence Relation 11/11 ~ 11/14/2008 Yang Song.
CS 106 Introduction to Computer Science I 03 / 03 / 2008 Instructor: Michael Eckmann.
Sorting and Searching Algorithms Week 11 DSA. Recap etc. Arrays are lists of data 1-D, 2-D etc. Lists associated with searching and sorting Other structures.
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
CS 106 Introduction to Computer Science I 10 / 15 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
DATABASES AND SQL. Introduction Relation: Relation means table(data is arranged in rows and columns) Domain : A domain is a pool of values appearing in.
Chapter 9: Advanced Array Concepts
Lesson 2. Starter Look at the hand out you have been given. Can you sort the numbers into ascending order. What mental or physical methods did you use.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and.
Applications of Arrays (Searching and Sorting) and Strings
Chapter 11 Arrays Continued
CSC141- Introduction to Computer programming Teacher: AHMED MUMTAZ MUSTEHSAN Lecture – 19 Thanks for Lecture Slides:
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Arrays Module 6. Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array.
Programming Fundamentals I (COSC-1336), Lecture 8 (prepared after Chapter 7 of Liang’s 2011 textbook) Stefan Andrei 4/23/2017 COSC-1336, Lecture 8.
Objectives - 11  We will work with processing Arrays.  Objectives:  Describe the concept of an array and its benefits.  Define the terms index, traverse,
10 Oct 2004 NLP-AI Java Lecture No. 10 Satish Dethe.
1 2. Program Construction in Java. 2.9 Sorting 3 The need Soritng into categories is relatively easy (if, else if, switch); here we consider sorting.
Data Structure Introduction.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 2.
03 August 2004 NLP-AI Java Lecture No. 4 Operators & Decision Constructs Satish Dethe.
1 CS 177 Week 12 Recitation Slides Running Time and Performance.
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
Sorting Algorithms: Selection, Insertion and Bubble.
1 Searching and Sorting Searching algorithms with simple arrays Sorting algorithms with simple arrays –Selection Sort –Insertion Sort –Bubble Sort –Quick.
A * Search A* (pronounced "A star") is a best first, graph search algorithm that finds the least-cost path from a given initial node to one goal node out.
Array Search & Sort (continues). On the fly questions Array declaration: int[] a, b, c; 1. a is an array of integers, b and c are two integers 2. a, b,
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
1 CS 163 Data Structures Chapter 5 Sorting Herbert G. Mayer, PSU Status 5/23/2015.
Recursion A recursive definition is one which uses the word or concept being defined in the definition itself Example: “A computer is a machine.
Course Code #IDCGRF001-A 5.1: Searching and sorting concepts Programming Techniques.
March 11, 2005 Recursion (Implementation) Satish Dethe
Arrays Chapter 7. MIS Object Oriented Systems Arrays UTD, SOM 2 Objectives Nature and purpose of an array Using arrays in Java programs Methods.
Lecture 2 What is a computational problem? What is an instance of a problem? What is an algorithm? How to guarantee that an algorithm is correct? What.
1 Applied Arrays Lists and Strings Chapter 12 2 Applying What You Learn Searching through arrays efficiently Sorting arrays Using character arrays as.
SORTING Sorting is storage of data in some order, it can be in ascending or descending order. The term Sorting comes along-with the term Searching. There.
Minimum Edit Distance Definition of Minimum Edit Distance.
Introduction to Programming Lecture 12. Today’s Lecture Includes Strings ( character arrays ) Strings ( character arrays ) Algorithms using arrays Algorithms.
Consultation Hours. Mubashir: – Tuesday from 12:30 to 1:30 with ease of Students. Zohaib – Wednesday b/w 9:30 -10:30 Location: TA Room (next to HOD Office)
Spell checking. Spelling Correction and Edit Distance Non-word error detection: – detecting “graffe” “ سوژن ”, “ مصواک ”, “ مداا ” Non-word error correction:
Dynamic Programming for the Edit Distance Problem.
Spelling correction. Spell correction Two principal uses Correcting document(s) being indexed Retrieve matching documents when query contains a spelling.
Chapter 9: Sorting and Searching Arrays
Lecture 5 of Computer Science II
Arrays.
Lecture 14 Searching and Sorting Richard Gesick.
@#? Text Search g ~ A R B n f u j u q e ! 4 k ] { u "!"
Chapter 5: Arrays: Lists and Tables
Distance Functions for Sequence Data and Time Series
Sorting Data are arranged according to their values.
Arrays … The Sequel Applications and Extensions
Objectives At the end of the class, students are expected to be able to do the following: Understand the purpose of sorting technique as operations on.
Sorting Data are arranged according to their values.
Lecture 11 Searching and Sorting Richard Gesick.
Dynamic Programming Computation of Edit Distance
Introduction To Programming Information Technology , 1’st Semester
Complement to lecture 11 : Levenshtein distance algorithm
Applications of Arrays
Arrays.
CS Problem Solving and Object Oriented Programming Spring 2019
Presentation transcript:

31 Dec 2004 NLP-AI Java Lecture No. 15 Satish Dethe

31 Dec 2004 String Distance String Comparison Need in Spell Checker Levenshtein Technique Swapping Contents

31 Dec 2004 String Comparison Accuracy measurement: compare the transcribed and intended strings and identify the errors Automated error tabulation: a tricky task. Consider the following example: transformation (intended text) transxformaion (transcribed text) A simple characterwise comparison gives 6 errors. But there are only 2: insertion of ‘x’ and omission of ‘t’.

31 Dec 2004 Need in Spell Checker The difference between two strings is an important parameter for suggesting alternatives for typographical errors Example: difference (“game”, “game”); //should be 0 difference (“game”, “gme”); //should be 1 difference (“game”, “agme”); //should be 2 Possible ways for correction (for last example): 1. delete ‘a’, insert ‘a’ after ‘g’ 2. insert ‘g’ before ‘a’, delete the succeeding ‘g’ 3. substitute ‘g’ for ‘a’, substitute ‘a’ for ‘g’ If search in vocabulary is unsuccessful, suggest alternatives Words are arranged in ascending order by the string distance and then offered as suggestions (with constraints)

31 Dec 2004 String Distance Definition: String distance between two strings, s1 and s2, is defined as the minimum number of point mutations required to change s1 into s2, where a point mutation is one of substitution, insertion, deletion Widely used methods to find out string distance: 1.Hamming String Distance: For strings of equal length 2.Levenshtein String Distance: For strings of unequal length

31 Dec 2004 Levenshtein Technique

31 Dec 2004 Levenshtein Technique

31 Dec 2004 Levenshtein String Distance: Implementation int equal (char x,char y){ if(x = = y ) return 0; // equal operator else return 1; } int Lev (string s1, string s2){ for (i=0;i<=s1.length();i++) D[i,0] = i; // Initializing first column for (i=0;i<=s2.length();i++) D[0,i] = i; // Initializing first row for (i=1;i<=s1.length();i++){ for (j=1;j<=s2.length();i++){ D[i,j]= min ( D[i-1,j]+1, D[i,j-1]+1, equal (s1[i], s2[j]) + D[i-1,j-1] ); } }}

31 Dec 2004 Levenshtein String Distance: Applications Spell checking Speech recognition DNA analysis Plagiarism detection

31 Dec 2004 Swapping is an important technique in most of the sorting algorithms. int a = 242, b = 215, temp; temp = a; // temp = 242 a = b; // a = 215 b = temp; // b = 242 swap.java Swapping

31 Dec 2004 Bubble Sort Initial elements : iteration : [1] [2] [3] [4] [5]

31 Dec 2004 Assignments Swap two integers without using an extra variable Swap two strings without using an extra variable

31 Dec 2004 References dithttp:// dit

31 Dec 2004 Thank You! Wish You a Very Happy New Year.. Yahoo! End