Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 408/508: Programming for Linguists Lecture 26 December 7 th.

Similar presentations


Presentation on theme: "LING 408/508: Programming for Linguists Lecture 26 December 7 th."— Presentation transcript:

1 LING 408/508: Programming for Linguists Lecture 26 December 7 th

2 Adminstrivia Due Dates – Term Programming Project Write-up and code by December 17 th – Homework 12 Install NLTK. Screenshots to show it working. Due Friday 11th

3 www.nltk.org

4 Install

5 get-pip.py

6 PIP (Pip Installs Packages)

7 Using pip to install nltk

8 Install nltk_data Command: –sudo python -m nltk.downloader -d /usr/local/share/nltk_data all

9 Test nltk

10 Test nltk_data

11 Ubuntu

12

13 curl Command line tool using URL syntax to transfer a file –curl URL (downloads file specified in HRL) – can understand http/https and ftp/sftp protocols

14 setuptools

15

16 Ubuntu pip

17 Ubuntu nltk

18 Ubuntu nltk_data

19 Homework 12 Install NLTK – show it working 1 st sentence from the WSJ section of the Penn Treebank

20 Homework 12 Pick a sentence of your choosing, tokenize and Part-of-Speech (POS) label it. Comment on whether the labeling is good. Tagset documented here https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos.html

21 Homework 12 Pick another sentence with noun-noun compounds, – e.g. Helicopters will patrol the temporary no-fly zone around New Jersey's MetLife Stadium Sunday, with F-16s based in Atlantic City ready to be scrambled if an unauthorized aircraft does enter the restricted airspace. Tokenize, POS tag, and extract named entities

22 Homework 12

23 GPE = Geo-Political Entity

24 http://www.nltk.org/book/

25 Today's Topics Chapter 11: Data Collections – Lists – Arrays – Dictionaries (Hash)

26 Lists We've seen these before … Example: –range(start,stop,step) – parameters are integers – start = 0 by default – step = 1 by default

27 Lists split:

28 Lists Basic operations:

29 Lists

30 a = [1,2,3]

31 Lists Lists are malleable: Can implement stacks and queues easily

32 Lists

33

34

35 Queue #1: list.append(x) and list.pop(0)

36 Lists Queue #2: list.insert(0,x) and list.pop(len(list)-1) non-object-oriented function: del

37 Higher order functions map(function,list) reduce(function,list) inline anonymous function: lambda example: λx.x+xlambda x:x+x filter(function,list)

38 Standard Deviation Example


Download ppt "LING 408/508: Programming for Linguists Lecture 26 December 7 th."

Similar presentations


Ads by Google