80 likes | 220 Views
NLTK (Natural Language Tool Kit) http://www.nltk.org/. Unix for Poets (without Unix). NLTK: Unix for Poets (without Unix) Unix Python. No need to buy the book Free online at http://www.nltk.org/book Homework #4 Read Chapter 1 http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html
E N D
NLTK (Natural Language Tool Kit)http://www.nltk.org/ Unix for Poets (without Unix)
NLTK: Unix for Poets (without Unix)Unix Python • No need to buy the book • Free online at http://www.nltk.org/book • Homework #4 • Read Chapter 1 • http://nltk.googlecode.com/svn/trunk/doc/book/ch01.html • Start with exercise 22 and go as far as you can • Exercise 23: Solve however you like • (no need to use for and if)
Python def fact(x): if(x <= 1): return 1 else: return x * fact(x-1) • Exercise: Fibonacci in Python
Introduction to Programming Traditional (Start with Definitions) 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 • Constants: 1 • Variables:x • Objects: lists, arrays, matrices • Expressions: 1+x • Statements: print 1+x; • Conditionals: • If (x<=1) return 1; • Iteration • Functions • Recursion: • Streams:
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
Installing • Chapter 01: pp. 1 - 4 • Python • NLTK • Data
An Equivalence Relation • Partitions a set into several disjoint subsets • Called equivalence classes • All the elements in a class are equivalent • No element from one class is equivalent to an element from another • Example: Partition integers into two subsets • Even integers: 2,4,6… • Odd integers: 1,3,5… • Three Properties • Reflexive: xRx • Symmetric: xRyyRx • Transitive: xRy & yRzxRz • Canonical Elements: 1 & 2 • Computational Convenience
A Partial Order • Subsets of {x,y,z} • Ordered by inclusion • Three properties • Reflexive: • xRx • Antisymmetric: • xRy⌃yRx • Transitivity: • xRy & yRzxRz