Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong."— Presentation transcript:

1 LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong

2 Administrivia Last Time:
Quick Homework 1 (you should have received an back from me) Today's class: Quick Homework 1 Review continue with perlintro with a dash of python

3 Quick Homework 1 Review 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. (

4 Quick Homework 1 Review Facebook
Joke relies on the the human ability to flexibly attach PPs. Also, there could be a garden path here: preferred attachment site might be to lowest (most recent) VP.

5 Quick Homework 1 Review Berkeley Parser Not a good parse: why?
subject of play can't be interpreted as the kids A constructive question: can we force the Berkeley parser to give us the syntax we want?

6 Quick Homework 1 Review Quirk: no period here!
Assume unexpressed subject is the speaker, i.e. [S [NP PRO][VP [VBG V-ing] …]]

7 Quick Homework 1 Review Move the PP with an adult beverage earlier in the sentence. result is high attachment to sitting. Unfortunately, watching the kids play now modifies an adult beverage.

8 Quick Homework 1 Review Move the PP with an adult beverage ahead of in the sun. The VP watching the kids modifies the sun. What is the intended subject of play here?

9 Quick Homework 1 Review Interpret unexpressed
subject as the Speaker (of the sentence)

10 Quick Homework 1 Review

11 Quick Homework 1 Review Problematic: looks like the VP modifies the NP

12 Quick Homework 1 Review

13 Quick Homework 1 Review Can we force high attachment?
Change of PP attachment location Preposition with: accompaniment with cf. instrument with Can we force high attachment?

14 Quick Homework 1 Review High attachment achieved!

15 Quick Homework 1 Review

16 Dependency Relations http://universaldependencies.org
List of universal dependencies (v2): Relevant relations: ccomp: clausal complement xcomp: open clausal complement (no explicit subject) pobj (not V2): prepositional object

17 World and word knowledge
adult beverage: not defined in a dictionary semantic compositionality at work: a beverage restricted to adults kid vs. adult: WordNet (taxonomy and semantic relations between word senses): adult#n#1 antonym of juvenile#n#1 hypernym of kid#n#1

18 Google search

19 perlintro Notes from the tutorial:
semicolon (;) is not always necessary Command separator semantics vs. end of command (termination) token Best practice? Terminate every command with a semicolon Variable types: Every variable type has its own namespace. This means that $foo are two different variables. It also means that $foo[1] is a part not a part of $foo. This may seem a bit weird, but that's okay, because it is weird.

20 Perl Variable Prefixation
Reading Perl code (perldata) aloud: Larry Wall was a linguist … The '$' symbol works semantically like the English word "the" in that it indicates a single value is expected. Entire arrays (and slices of arrays and hashes) are denoted by which works much like the word "these" or "those" does in English, in that it indicates multiple values are expected. Also: Entire hashes are denoted by '%’… (no translation) In addition, subroutines are named with an initial '&', though this is optional when unambiguous, just as the word "do" is often redundant in English.

21 Perl Arrays Arrays: A note on output: Idea: list of scalars
like a simple ordered list (cf. Python lists) access by index: 0,1,2,… negative indices count from the end A note on output: zeroonetwothreefour print zero one two three four controlled by system variable $" default value: a space

22 perlintro: 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]

23 perlintro: Perl Arrays
like a simple ordered list… (in Python, we use a list) Coercion @ARRAY = number of elements in scalar context Python (no coercion): len(array) Built-in functions: $ELEMENT; $ELEMENT, $OFFSET, $LENGTH, $ELEMENT $ELEMENT above can Python: array.sort(), array.reverse(), NO push (use array.append() instead), array.pop(), No shift/unshift etc… Built-in arrays: @ARGV (command line arguments) @_ (sub(routine) arguments)

24 perlintro: Perl Arrays
Similar to pop/push, but operates at the left end of the array Python doesn't have these defined but can be simulated via slicing and concatenation: array[1:] list + array

25 perlintro: Perl Arrays


Download ppt "LING/C SC/PSYC 438/538 Lecture 4 Sandiway Fong."

Similar presentations


Ads by Google