Download presentation

Presentation is loading. Please wait.

Published byAmira Metcalfe Modified over 2 years ago

1
Prepare for next time No need to buy the book – Free online at http://www.nltk.org/bookhttp://www.nltk.org/book Read Chapter 1 – http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html Install NLTK (see next slide) – Warning: It might not be easy (and it might not be your fault) – Let us know how it goes (both positive and negative responses are more appreciated)

2
Installing NLTK http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html Chapter 01: pp. 1 - 4 – Python – NLTK – Data

3
Homework

4
George Miller’s Example: Erode Exercise: Use “erode” in a sentence: – My family erodes a lot. to eat into or away; destroy by slow consumption or disintegration – Battery acid had eroded the engine. – Inflation erodes the value of our money. Miller’s Conclusion: – Dictionary examples are more helpful than defs Definition Examples George Miller: Chomsky’s Mentor & Wordnet

5
Introduction to Programming Traditional (Start with Definitions) Constants: 1 Variables: x Objects: – lists, strings, arrays, matrices Expressions: 1+x Statements: Side Effects – print 1+x; Conditionals: – If (x<=1) return 1; Iteration: for loops Functions Recursion Streams Non-Traditional (Start with Examples) Recursion def fact(x): if(x <= 1): return 1 else: return x * fact(x-1) Streams: – Unix Pipes Briefly mentioned – Everything else

6
Python def fact(x): if(x <= 1): return 1 else: return x * fact(x-1) def fact2(x): result=1 for i in range(x): result *=(i+1); return result Exercise: Fibonacci in Python Recursion Iteration

7
Lists

8
Strings

9
Subscripting

10
Python Objects Lists >>> sent1 ['Call', 'me', 'Ishmael', '.'] >>> type(sent1) >>> sent1[0] 'Call' >>> sent1[1:len(sent1)] ['me', 'Ishmael', '.'] Strings >>> sent1[0] 'Call' >>> type(sent1[0]) >>> sent1[0][0] 'C' >>> sent1[0][1:len(sent1[0])] 'all' First Rest

11
Flatten: Inverse of Split >>> def flatten(list): if(len(list) == 1): return list[0]; else: return list[0] + ' ' + flatten(list[1:len(list)]); First Rest flatten = split -1

12
Types & Tokens Polymorphism

13
Polymorphism (From Wikipedia)

14
Flatten: Inverse of Split >>> def flatten(list): if(len(list) == 1): return list[0]; else: return list[0] + ' ' + flatten(list[1:len(list)]); +

Similar presentations

OK

Def f(n): if (n == 0): return else: print(“*”) return f(n-1) f(3)

Def f(n): if (n == 0): return else: print(“*”) return f(n-1) f(3)

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Free ppt on india size and location Ppt on role of information technology in agriculture Ppt on sea level rise map Ppt on swami vivekananda books Ppt on solar power system Ppt on hydro power plant for class 10 Download ppt on conservation of water resources Free download ppt on world war 1 Ppt on power line communication final year project Ppt on abo blood grouping system