LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong. Administrivia Homework 2 graded.

Slides:



Advertisements
Similar presentations
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong. Administrivia Homework 3 graded.
Advertisements

The Linux Operating System Lecture 6: Perl for the Systems Administrator Tonga Institute of Higher Education.
References and Data Structures. References Just as in C, you can create a variable that is a reference (or pointer) to another variable. That is, it contains.
1 Arrays in PHP PHP Functions. 2 Array Definition An array is a complex variable that enables you to store multiple values in a single variable; It comes.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Administrivia Homework 1 graded – you should have gotten an from me.
CS 106 Introduction to Computer Science I 02 / 18 / 2008 Instructor: Michael Eckmann.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
Hashes a “hash” is another fundamental data structure, like scalars and arrays. Hashes are sometimes called “associative arrays”. Basically, a hash associates.
Arrays  Writing a program that uses a large amount of information.  Such as a list of 100 elements.  It is not practical to declare.
CS 106 Introduction to Computer Science I 10 / 04 / 2006 Instructor: Michael Eckmann.
Introduction to Perl. How to run perl Perl is an interpreted language. This means you run it through an interpreter, not a compiler. Your program/script.
Sorting. Simple Sorting As you are probably aware, there are many different sorting algorithms: selection sort, insertion sort, bubble sort, heap sort,
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 12: Arrays.
1 CS101 Introduction to Computing Lecture 29 Functions & Variable Scope (Web Development Lecture 10)
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 8: Perl Basics Fundamentals of Web Programming.
LING/C SC/PSYC 438/538 Lecture 5 9/8 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong. Today’s Topics Did you read Chapter 1 of JM? – Short Homework 1 (submit by midnight Saturday) Some slides.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong. Today’s Topics File input/output – open, References Perl modules Homework 2: due next Monday by midnight.
1 An Introduction to Perl Part 2 CSC8304 – Computing Environments for Bioinformatics - Lecture 8.
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 .
Week 7. Lecture 2 Functions, Arrays, PHP&MySQL. Function with More than one argument and a return statement For a function to return a value, the return.
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.
ECMM6018 Enterprise Networking For Electronic Commerce Tutorial 5 Server Side Scripting Perl.
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
LING/C SC/PSYC 438/538 Lecture 7 9/15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 8/30 Sandiway Fong.
Perl Practical(?)‏ Extraction and Report Language.
Arrays. Indexed Arrays Use numbers as keys: $grades = array(); $grades[0] = ' A ' ; $grades[1] = ' A- ' ; $grades[2] = ' B+ ' ; Or with one statement:
Built-in Data Structures in Python An Introduction.
Perl Language Yize Chen CS354. History Perl was designed by Larry Wall in 1987 as a text processing language Perl has revised several times and becomes.
Today we will solve equations with two variables. Solve = figure out.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
An Intro to Perl, Pt. 2 Hashes, Foreach Control, and the Split Function.
CS 105 Perl: Data Types Nathan Clement 15 May 2014.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
C Programming – Part 3 Arrays and Strings.  Collection of variables of the same type  Individual array elements are identified by an integer index 
Data Structure and c K.S.Prabhu Lecturer All Deaf Educational Technology.
Perl Basics. sh-bang !!!! Every perl program starts with a sh-bang line #!/usr/bin/perl # hello.pl printf “Hello, world!\n”; printf STDOUT “Hello, world!\n”;
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.
CS 105 Perl: Basic I/O, Context, Strings, Lists Nathan Clement January 22, 2014.
LING/C SC/PSYC 438/538 Lecture 8 Sandiway Fong. Adminstrivia Homework 4 not yet graded …
CPTG286K Programming - Perl Chapter 5 & 6: Hashes & Basic I/O.
Introduction to Perl NICOLE VECERE. Background General Purpose Language ◦ Procedural, Functional, and Object-oriented Developed for text manipulation.
Perl Day 5. Arrays vs Hash Arrays are one way to store multiple things in a variable. Hashes are another. Arrays are one way to store multiple things.
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Perl Scripting III Arrays and Hashes (Also known as Data Structures) Ed Lee & Suzi Lewis Genome Informatics.
Week Four Agenda Link of the week Review week three lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines.
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong. Homework 4 Submit one PDF file Your submission should include code and sample runs Due date Monday 21.
Interpolation Variable Interpolation, Backslash Interpolation.
 History  Ease of use  Portability  Standard  Security & Privacy  User support  Application &Popularity Today  Ten Most Popular Programming Languages.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong. Today's Topics A note on the UIUC POS Tagger Fun with POS Tagging Perl regex wrap-up.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
Python Variable Types.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
Introduction to Perl Jarrad Battaglia.
LING/C SC/PSYC 438/538 Lecture 12 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
Karan Thaker CS 265 Section 001
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
Presentation transcript:

LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong

Administrivia Homework 2 graded

Today’s Topics Homework 2 review – reminder: submit plain text or PDF please (no.doc/.docx) Perl

Short Homework 2 Review Is tough sledding an idiom or compositional in meaning? Compositional: – Meaning(tough sledding) = Meaning(tough) Meaning(sledding) – Literal meaning: "kick the bucket" Idiom: – Meaning(tough sledding): explicitly learned and stored

Short Homework 2 Review The chickens are ready to eat In what way(s) is this sentence structurally ambiguous? gardenbetty.com X eat Y X = the chickens Berkeley Parser

Short Homework 2 Review The chickens are ready to eat In what way(s) is this sentence structurally ambiguous? wikipedia X eat Y Y = the chickens

Short Homework 2 Review John said he dislikes nearly everyone he meets In what way(s) is this sentence referentially ambiguous? 1.John said John dislikes nearly everyone John meets 2.John said Pete dislikes nearly everyone Pete meets 3.John said Pete dislikes nearly everyone John meets 4.…

Perl Day Learn Perl – Books… see next slide – Online resources we begin with... philosophy: Natural Language Principles in Perl If a language is designed so that you can ``learn as you go'', then the expectation is that everyone is learning, and that's okay. philosophy: Natural Language Principles in Perl If a language is designed so that you can ``learn as you go'', then the expectation is that everyone is learning, and that's okay.

Perl Day UA has free access to O'Reilly's Safari library: h?q=perl

Perl arrays and hashes Scalars: – strings, numbers (integers, floating point numbers), references Arrays: – Store multiple scalars together – Idea: list of scalars – Access by index: 0,1,2,… Hash (aka Associative Array): – Like an array except access not through a numeric index – Use user-specified keys %variable different namespaces: %apple are different data structures and can co-exist simultaneously different namespaces: %apple are different data structures and can co-exist simultaneously most programming languages will offer you all of these basic data types

Perl Week

Notes on arrays and hashes – arrays are indexed from 0,1,2,3… – hashes are like arrays with user-defined indexing (aka associative array or hash table) – initialization (use round brackets and = (“zero”, “one”, “two”, “three”, “four”); %h = (“zero”, 0, “one”, 1, “two”, 2, “three”, 3, “four”, 4); (key/value pairs) – access to individual elements (square brackets vs. curly braces) $a[1]“one” $h{zero}0

Perl Week Notes on arrays and hashes – output print one two three four print %hthree3one1zero0two2four4 (note: different order) print “%h”%h (literal, no interpolation) What happens here? – %pos = ("apple", "n", "speak", "v", "happy", "a", "walk", "n", "walk", "v"); – print $pos{"walk"}, "\n"; (hash keys are unique) controlled by variable $” default: a space controlled by variable $” default: a space

Perl Week Conditionals – if < 10 ) { print “Small array\n” } else {print “Big array\n” } – here is a scalar = size of array – unless > 10) { print } – Note: if size of array a is ≤ 10, it prints the contents of array a Looping %fruits = ("apple", "green", "orange", "orange", "lemon", "yellow"); foreach $fruit (keys %fruits) { print $fruit, " => ", $fruits{$fruit}, "\n” } gives output: lemon => yellow apple => green orange => orange Note: apparently keys %fruits = (“lemon” “apple” “orange”) is an array