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

Slides:



Advertisements
Similar presentations
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.
Advertisements

Day 1 Punctuation and Capitalization
CPSC 422, Lecture 16Slide 1 Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 16 Feb, 11, 2015.
LING 388: Language and Computers Sandiway Fong Lecture 2.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong. Administrivia Homework 1 graded – you should have gotten an from me.
Tutorial 1 Scanner & Parser
Introduction to Computers and Programming - Class 2 1 Introduction to Computers and Programming Class 2 Introduction to C Professor Avi Rosenfeld.
2ex.1 Lists and Arrays. 2ex.2 Comments on exercises Always run your script with “ perl -w ” and take care of all warnings  submitted scripts should not.
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.
Introduction to Computational Linguistics Programming I.
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 .
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.
LING/C SC/PSYC 438/538 Lecture 3 8/30 Sandiway Fong.
Chapter 9: Perl Programming Practical Extraction and Report Language Some materials are taken from Sams Teach Yourself Perl 5 in 21 Days, Second Edition.
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong. Administrivia Homework 2 graded.
IDL Tutorial Day 1 Goals: 1) Introduce IDL basics 2) Describe fundamental IDL structures Angela Des Jardins
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Computer Programming for Biologists Class 3 Nov 13 th, 2014 Karsten Hokamp
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
Perl Variables: Array Web Programming1. Review: Perl Variables Scalar ► e.g. $var1 = “Mary”; $var2= 1; ► holds number, character, string Array ► e.g.
◦ Process of describing the structure of phrases and sentences Chapter 8 - Phrases and sentences: grammar1.
LING/C SC/PSYC 438/538 Lecture 18 Sandiway Fong. Adminstrivia Homework 7 out today – due Saturday by midnight.
2.1 Scalar data - revision numeric e-14 ( = 6.35 × )‏ operators: + (addition) - (subtraction) * (multiplication) / (division)
Python 1 SIGCS 1 Intro to Python March 7, 2012 Presented by Pamela A Moore & Zenia C Bahorski 1.
Programming Perl in UNIX Course Number : CIT 370 Week 2 Prof. Daniel Chen.
Arrays and Lists. What is an Array? Arrays are linear data structures whose elements are referenced with subscripts. Just about all programming languages.
NLP. Introduction to NLP #include int main() { int n, reverse = 0; printf("Enter a number to reverse\n"); scanf("%d",&n); while (n != 0) { reverse =
LING/C SC/PSYC 438/538 Lecture 19 Sandiway Fong 1.
LING/C SC 581: Advanced Computational Linguistics Lecture Notes Feb 17 th.
DAILY GRAMMAR PRACTICE (DGP)
Organization of Programming Languages Meeting 37 April 18, 2016.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
Adapted from Kaplan SAT Premier 2017 Chapter 23
Pamela Moore & Zenia Bahorski
Miscellaneous Items Loop control, block labels, unless/until, backwards syntax for “if” statements, split, join, substring, length, logical operators,
LING/C SC/PSYC 438/538 Lecture 3 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 2 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 20 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 7 Sandiway Fong.
Day 1: Punctuation & Capitalization
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong.
LING/C SC 581: Advanced Computational Linguistics
Introduction to Python
Perl Variables: Array Web Programming.
LING/C SC/PSYC 438/538 Lecture 6 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 10 Sandiway Fong.
Day 1: Punctuation & Capitalization
LING/C SC/PSYC 438/538 Lecture 23 Sandiway Fong.
MSIS 655 Advanced Business Applications Programming
Topics Designing a Program Input, Processing, and Output
LING/C SC/PSYC 438/538 Lecture 24 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 15 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 26 Sandiway Fong.
Homework Reading Programming Assignments Finish K&R Chapter 1
LING/C SC/PSYC 438/538 Lecture 13 Sandiway Fong.
LING/C SC/PSYC 438/538 Lecture 11 Sandiway Fong.
EECE.2160 ECE Application Programming
Class code for pythonroom.com cchsp2cs
LING/C SC/PSYC 438/538 Lecture 5 Sandiway Fong.
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.
Introduction to Computer Science
LING/C SC 581: Advanced Computational Linguistics
Presentation transcript:

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

Administrivia Last Time: http://perldoc.perl.org/perlintro.html Quick Quiz (you should have received an email back from me) Today's class: Quick Quiz Review Quick Homework 1 Continue with perlintro …

Quick Quiz on Chapter 1 Review NN = common noun NP = noun phrase VBD = verb past tense VP = verb phrase

Quick Quiz on Chapter 1 Review http://www.oed.com.ezproxy4.library.arizona.edu

Quick Quiz on Chapter 1 Review

Syntactic Labeling (Standard) How to read the parse http://languagelog.ldc.upenn.edu/myl/PennTreebank1995.pdf Phrasal Labels: VP = Verb Phrase, S = Sentence, SBAR = Embedded Sentences, NP = Noun Phrase, PP = Prepositional Phrase. ADJP = Adjectival Phrase. Basic declarative sentence: [S NP [VP VBD NP]] Part of Speech (POS) labels: DT = Determiner, JJ = Adjective, JJR = Adjective (Comparative Form), NN = Common Noun, NNS = Common Noun (plural), NNP = Proper Noun, VB = Verb (base form), VBD = Verb (past tense), IN = Preposition, PRP$ = Possessive Pronoun. More here: https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html

Quick Homework 1 Q1: What's supposed to be funny about this? Q2: Run the 1st sentence on the Berkeley Parser (from Quick Quiz 1). Critique the parse. Q3: Run the 1st sentence on the Google Parser. Critique the dependency parse. (https://cloud.google.com/natural-language/)

Quick Homework 1 email me your answers by the end of Wednesday Rules: Subject: 438/538 Your Name Homework 1 One PDF file only (include any diagrams) – no multiple attachments, no Word documents

Perl http://perldoc.perl.org/perlintro.html One-liner: perl -e 'PerlCode' Notes from the tutorial: whitespace not always necessary, e.g. print"Hello class!\n”; is fine, but good idea to consistently use spacing (not just for readability) variable names must not begin with a number (use a letter), so $538students is out $students538 is ok error messages are frequently uninformative (and sometimes misleading), e.g. Bareword found where operator expected at example.prl line 3, near "$538students" (Missing operator before students?) error not associated with the variable starting with a number “Nanny mode”: helps with debugging: makes you declare variables with my

print as a statement vs. function Perl Python3 Same behavior, different assumptions about end of line (\n) from these two programming languages escape character Note also the differences in syntax: (..) in Python3, no parentheses (needed) in Perl ; need to separate the statements in Perl, none in Python

Perl vs. Python3 Scalars: (basically things that take up one 32/64 bit word of memory) variables begin with ($) - no such type requirement in Python Numbers (integer, floating point) Python includes complex numbers (cmath library) Strings (double ".." or single quoted '..') References (pointers to (non-)scalars)

Perl vs. Python3 Variable interpolation Perl: Python3: Python2.7: print "My name is $name\n"; print "My name is \$name\n"; print 'My name is \$name\n'; Python3: print("My name is", name) Python2.7: Note: white spacing

Perl Arrays like a simple ordered list… (in Python, we use a list) Literal: @ARRAY = ( … , … , …) (round brackets; comma separator) Python: array = [… , … , … ] Access: $ARRAY[ INDEX] (zero-indexed; negative indices ok; slices ok) Python: array[index] Index of last element:  $#array (a scalar) Python: array[-1] Coercion @ARRAY = number of elements in scalar context Python: len(array) Built-in functions: sort @ARRAY; reverse @ARRAY,; push @ARRAY, $ELEMENT; pop @ARRAY; shift @ARRAY; unshift @ARRAY, $ELEMENT, splice @ARRAY, $OFFSET, $LENGTH, $ELEMENT $ELEMENT above can be @ARRAY Python: array.sort(), array.reverse() Built-in arrays: @ARGV (command line arguments) @_ (sub(routine) arguments)

Exercises If you’re new to programming, practice using Perl read the intro and run all the examples!