NLTK & Python Day 8 LING Computational Linguistics Harry Howard Tulane University
11-Sept-2009LING , Prof. Howard, Tulane University2 Course organization NLTK should be installed on the computers in this room!
NLPP §2 Accessing text corpora and lexical resources §2.2 Conditional frequency
11-Sept-2009LING , Prof. Howard, Tulane University4 Practice Do "Your Turn" up to p. 55 Exercises , 2.8.8
NLPP §2 Accessing text corpora and lexical resources §2.3 More Python: Reusing code
11-Sept-2009LING , Prof. Howard, Tulane University6 Creating a program with a text editor Create the monty.py program.
11-Sept-2009LING , Prof. Howard, Tulane University7 Other IDEs Eclipse (Java Dev) + Pydev plugin Mac users should use Cocoa version Xcode Tools now supports Python It is part of optional installation on DVD. You have to register as a developer to download it from
11-Sept-2009LING , Prof. Howard, Tulane University8 Functions What might you want to put in your program? Why, a function, of course! A function takes an input to produce an output or return value: >>> def my_function_name(my_inputs)... # calculate my_output... return my_output...
11-Sept-2009LING , Prof. Howard, Tulane University9 Modules and higher As you accumulate functions, you will want to store them somewhere. Save them all in the same text file with the.py suffix, i.e. my_mod.py, called a module and import them as needed: from my_mod import my_function_name Hierarchy function < module < package < library
NLPP §2 Accessing text corpora and lexical resources §2.4 Lexical resources
11-Sept-2009LING , Prof. Howard, Tulane University11 Lexical resources What is a lexicon? a collection of words and/or phrases, sometimes with additional information such as part of speech or meaning What is a lexical entry? A headword/lemma, along with that other info saw 1 [verb] past tense of see saw 2 [noun] cutting instrument
11-Sept-2009LING , Prof. Howard, Tulane University12 More corpora Wordlist corpora words Names Corpus Do ex CMU Pronouncing Dictionary Do ex Comparative wordlists Swadesh wordlist Shoebox/Toolbox
NLPP §2 Accessing text corpora and lexical resources §2.5 WordNet
11-Sept-2009LING , Prof. Howard, Tulane University14 Semantic relations Synonym Synonyms are grouped into synsets in WordNet look at code Do Your turn
Next time Q/P2 Do two of Ex Start NLPP §3