LING 408/508: Computational Techniques for Linguists

Slides:



Advertisements
Similar presentations
LING 408/508: Programming for Linguists Lecture 12 October 2 nd.
Advertisements

LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
LING 408/508: Programming for Linguists Lecture 13 October 7 th.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
25-Jun-15 JavaScript Language Fundamentals II. 2 Exception handling, I Exception handling in JavaScript is almost the same as in Java throw expression.
CS 299 – Web Programming and Design Overview of JavaScript and DOM Instructor: Dr. Fang (Daisy) Tang.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia.
Methods in Computational Linguistics II with reference to Matt Huenerfauth’s Language Technology material Lecture 4: Matching Things. Regular Expressions.
More Events and Validation CS Page/window events CS380 2.
Regular Expressions Regular expressions are a language for string patterns. RegEx is integral to many programming languages:  Perl  Python  Javascript.
Yet more on XSLT. Regular expression handling in EXSLT We saw that the EXSLT extensions are divided into a group of modules, each of which has its own.
Regular Expressions. 2 3 Using Regular Expressions Regular expressions give you much more power to handle strings in a script. They allow you to form.
Post-Module JavaScript BTM 395: Internet Programming.
Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
Javascript’s RegExp. RegExp object Javascript has an Object which compiles Regular Expressions into a Finite State Machine The F.S.M. is internal, and.
1 Final Review. 2 Final Exam  30% of your grade for the course  December 9 at 7:00 p.m., the regular class time  No makeup exam or alternate times.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
LING 408/508: Programming for Linguists Lecture 14 October 19 th.
LING 408/508: Programming for Linguists Lecture 5 September 9 th.
LING 408/508: Programming for Linguists
LING 408/508: Programming for Linguists Lecture 15 October 21 th.
Unit 11 –Reglar Expressions Instructor: Brent Presley.
LING 408/508: Programming for Linguists Lecture 12 October 7 th.
INT222 – Internet Fundamentals Week 11: RegExp Object and HTML5 Form Validation 1.
LING 408/508: Programming for Linguists Lecture 11 October 5 th.
-Joseph Beberman *Some slides are inspired by a PowerPoint presentation used by professor Seikyung Jung, which was derived from Charlie Wiseman.
Regular Expressions. What is it 4? Text searching & replacing Sequence searching (input, DNA) Sequence Tracking Machine Operation logic machines that.
Regular Expressions In Javascript cosc What Do They Do? Does pattern matching on text We use the term “string” to indicate the text that the regular.
Regular Expressions 'RegEx'.
Perl Regular Expression in SAS
© 2015, Mike Murach & Associates, Inc.
CMPT 120 Topic: Functions – Part 4
BIT116: Scripting Functions.
RegExps & DFAs CS 536.
* Lecture # 7 Instructor: Rida Noor Department of Computer Science
SEEM4570 Tutorial 05: JavaScript as OOP
Unit 2 Smarter Programming.
Looping and Random Numbers
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
Web Programming– UFCFB Lecture 17
Working with Forms and Regular Expressions
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
LING 388: Computers and Language
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 388: Computers and Language
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
LING 408/508: Computational Techniques for Linguists
Functions, Regular expressions and Events
i206: Lecture 19: Regular Expressions, cont.
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
LING 408/508: Computational Techniques for Linguists
Form Validation (with jQuery, HTML5, and CSS)
CSE 311: Foundations of Computing
Matcher functions boolean find() Attempts to find the next subsequence of the input sequence that matches the pattern. boolean lookingAt() Attempts to.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 17 Sandiway Fong.
More Variables and Data Types: references/matricies
Homework Reading Machine Projects Labs
Validation using Regular Expressions
Introduction to AJAX and JSON
Lab 8: Regular Expressions
Instructor: Dr. Michael Geiger Spring 2017 Lecture 12: Exam 1 Preview
Strings and Dates in JavaScript
Lecture 23: Regular Expressions
CMPT 120 Lecture 15 – Unit 3 – Graphics and Animation
JavaScript Session III
LING 388: Computers and Language
Presentation transcript:

LING 408/508: Computational Techniques for Linguists Lecture 18

Adminstrivia Reminder: no class next Tuesday (out of town @ meeting)

Today's Topics Homework 6 graded Part 2: Homework 6 review Last time: http://elmo.sbs.arizona.edu/sandiway/ling508-18/bmi-gauge.html

Homework 6 Review Javascript functions: Term project idea: shuffle() solved() Term project idea: animate solution 16!/2 = 10,461,394,944,000 valid configurations i.e. write a function solve() https://cornellmath.wordpre ss.com/2008/01/27/puzzles- groups-and-groupoids/ Stage 1: put 1 and 2 into position, get 3 and 4 into the corner Stage 2: repeat for 5-8 Stage 3: put 9 and 13 into position Stage 4: solve rest of the pieces

Javascript regular expressions Let's write our own browser-based tester to help you learn regular expressions: form See: http://elmo.sbs.arizona.edu/~sandiway/ling508-18/re-test.html

Javascript regular expressions <input name=str> <input name=g> <input name=re>

Javascript regular expressions optional What Javascript provides: RegEx object var re = new RegEx(string, flags) var re = /[A-Z]([a-z])*/gi (g= global; i=ignore case) Methods: var a = string.match(re) returns an array [entire match, ...submatches…] var a = regex.exec(string) returns an array different behaviors (under global flag)

Javascript Regexp Tester Let's try the code: http://elmo.sbs.arizona.edu/~sandiway/ling508-18/re-test.html Mr. ([A-Z][a-z]*) Mr\. ([A-Z][a-z]*)

Javascript Regexp Tester Useful property regex.lastIndex

Regular expression syntax http://www.w3schools.com/jsref/jsref_obj_regexp.asp

Regular expression syntax

Regular expression syntax

Regular expression syntax

Regular expression syntax

Regex Replace We'll also need the method replace(): var regex = new RegExp(re_s,flag_s); modified_string = string.replace(regex,replacement) replacement string can contain $n (NOT \n) (n = group number) developer.mozilla.org

Regex Replace Let's try it out: http://elmo.sbs.arizona.edu/~sandiway/ling508-18/rep-test.html