LING 408/508: Programming for Linguists Lecture 27 December 9 th.

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14 Introduction to Ruby.
Advertisements

Arrays A list is an ordered collection of scalars. An array is a variable that holds a list. Arrays have a minimum size of 0 and a very large maximum size.
Ruby (on Rails) CSE 190M, Spring 2009 Week 2. Arrays Similar to PHP, Ruby arrays… – Are indexed by zero-based integer values – Store an assortment of.
Container Types in Python
Current Assignments Homework 5 will be available tomorrow and is due on Sunday. Arrays and Pointers Project 2 due tonight by midnight. Exam 2 on Monday.
Section 1.6 Frequency Distributions and Histograms.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Administrivia Homework 1 graded – you should have gotten an from me.
The Symbol Table Lecture 13 Wed, Feb 23, The Symbol Table When identifiers are found, they will be entered into a symbol table, which will hold.
Chapter 9 Characters and Strings. Topics Character primitives Character Wrapper class More String Methods String Comparison String Buffer String Tokenizer.
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
CSC 160 Computer Programming for Non-Majors Lecture #3a: Stepper, Words, Sentences Prof. Adam M. Wittenstein
Ruby (on Rails) CSE 190M, Spring 2009 Week 2. Arrays Similar to PHP, Ruby arrays… – Are indexed by zero-based integer values – Store an assortment of.
Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
CS324e - Elements of Graphics and Visualization Java Intro / Review.
Data Structures in Python By: Christopher Todd. Lists in Python A list is a group of comma-separated values between square brackets. A list is a group.
Handling Lists F. Duveau 16/12/11 Chapter 9.2. Objectives of the session: Tools: Everything will be done with the Python interpreter in the Terminal Learning.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Continuing with Perl Homework 3: first Perl homework – due Sunday by midnight – one PDF file, by .
Scripting Languages Diana Trandab ă ț Master in Computational Linguistics - 1 st year
Python Lists and Such CS 4320, SPRING List Functions len(s) is the length of list s s + t is the concatenation of lists s and t s.append(x) adds.
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 2 (submit by midnight Friday) Today is Perl.
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
Prof. Alfred J Bird, Ph.D., NBCT -bird.wikispaces.umb.edu/ Office – McCormick 3rd floor.
Python Programming in Context Chapter 4. Objectives To understand Python lists To use lists as a means of storing data To use dictionaries to store associative.
Built-in Data Structures in Python An Introduction.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Chapter 1 – Matlab Overview EGR1302. Desktop Command window Current Directory window Command History window Tabs to toggle between Current Directory &
Python Primer 1: Types and Operators © 2013 Goodrich, Tamassia, Goldwasser1Python Primer.
Perl Chapter 5 Hashes. Outside of world of Perl, know as associative arrays Also called hash tables Perl one of few languages that has hashes built-in.
Prof. Alfred J Bird, Ph.D., NBCT Door Code for IT441 Students.
Computer Science 111 Fundamentals of Programming I Default and Optional Parameters Higher-Order Functions.
Discrete Mathematics Lecture # 10. Set Theory  A well defined collection of {distinct} objects is called a set.  The objects are called the elements.
LING 408/508: Programming for Linguists Lecture 26 December 7 th.
Warm Up A ___________________ is a letter used to represent an unknown. Evaluate the expression
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
LING 408/508: Programming for Linguists Lecture 25 December 2 nd.
Finding averages from the frequency table. In this screencast Mean from frequency table Mean from frequency table with intervals Mode from frequency table.
LING 408/508: Programming for Linguists Online Lecture 6 September 14 th.
CISW CRC - Fishman 2014 / 2015 PRESENTATION 4b: CISW 400 (Online) – Client-side Scripting for the Internet Cosumnes River College Fishman – 2015.
[ ] Square brackets enclose syntax options { } Braces enclose items of which only one is required | A vertical bar denotes options … Three dots indicate.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
Programming Fundamentals. Today’s Lecture Array Fundamentals Arrays as Class Member Data Arrays of Objects C-Strings The Standard C++ string Class.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 3: Built-in functions.
Python Arithmetic Operators OperatorOperationDescription +AdditionAdd values on either side of the operator -SubtractionSubtract right hand operand from.
Click to edit Master text styles Stacks Data Structure.
Quantitative variables continued
Chapter 4.
6.001 Jeopardy.
Lecture 10 Data Collections
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
Other Normal Distributions
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong.
Keyboarding True or false
Chapter 14 Introduction to Ruby.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Perl Variables: Array Web Programming.
מדינת ישראל הוועדה לאנרגיה אטומית
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
STL - Algorithms.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
LING 408/508: Computational Techniques for Linguists
Functional interface.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Visual Programming COMP-315
Intro to Computer Science CS1510 Dr. Sarah Diesburg
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
The Mean Variance Standard Deviation and Z-Scores
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
Presentation transcript:

LING 408/508: Programming for Linguists Lecture 27 December 9 th

Class Inheritance

Higher order functions map(function,list) apply function to each member of the list in turn creating a transformed list

Higher order functions map(function,list) apply function to each member of the list in turn creating a transformed list inline anonymous function: lambda example: λx.x+x lambda x:x+x

Higher order functions reduce(function,list) apply 2-argument function from left to right 1 st argument will be cumulative value 2 nd argument is fresh argument from the list number of cannonballs in pyramid (Wikipedia):

Higher order functions filter(function,list) apply function to each member of the list collect those for which the function returns true

Standard Deviation Example textbook code seems problematic…

Median Median: – average of middle two if even number of elements – middle element of list if odd number of elements

Lists Comparisons: – default sort order: cmp(x,y) – returns -1 (x y)

Lists create a list of Student objects in variable data

Dictionaries Hash table: List: – delimiter: square brackets Dictionary: – delimiter: curly braces

Dictionaries

Word frequency table program: tokenization

Dictionaries Word frequency table program default = 0

Dictionaries Word frequency table program

Corpus Lead NYTimes article one year ago tomorrow:

Non-ASCII Corpus

wc.py for non- ascii ” regular expression convert and insert space for curly quotes, commas, single quotes, and periods not preceded by a capital letter sys.argv list holds command line filename and n most freq words

Results sys.argv[1] sys.argv[2] top 2 content words in the article

Adminstrivia TCEs are fully online (paper TCEs are history)