Introduction
Introduction to HG2051 (slides)
Python programming for beginners: Learn Python the Hard Way
Basic computer science concepts: File structure and command line operations
Read this for a more in-depth guide to file structure and command line operations. And read this for a bit more history.
Environment Setup
Git Basics
Overview
-
(Thanks to Evan Peter Williamson of the University of Idaho)
Commands
Just once
git clone
For each changeset
git add
git commit
git push
Introduction to GitHub
- https://github.com/
- Basic Concept: hosting for remote repositories (plus much more)
- Navigating the UI
- Cloning a repository
Running Python
- Different ways of running Python
- REPL (e.g., IDLE)
- Script
- Notebook (https://jupyter.org/)
- Getting results from Python
If time allows..
Introduction to the Natural Language Tool Kit
In-class setup of NLTK (Windows/Mac/Linux):
$ pip install nltk
$ python
>>> import nltk
>>> nltk.download() # first time on this machine
>>> from nltk.book import *
Searching Text Choose an English word, and see how it is used in the different example texts by making concordances. Try other words. Find a word that is used frequently in one text and never used in the other texts.
Generating Text Generate paragraphs in the style of each different example text, using generate(). An example is shown in Searching Text.
Spoken Dialog Systems The Turing Test. Have a conversation with at least two different NLTK chatbots. Do any of these chatbots pass the test?
NLTK demos (optional)
In VS Code (Python), run this NLTK application:
>>> nltk.app.rdparser()
Keep clicking Step for a while and try to see what’s going on. Alternatively, click Autostep once and just watch. Challenge: can you parse the whole sentence successfully using only the Expand, Match and Backtrack buttons?
In VS Code (Python), run this NLTK application:
>>> nltk.app.srparser()
Keep clicking Step for a while and try to see what’s going on. Challenge: can you parse the whole sentence successfully using only the Shift and Reduce buttons?
Homework 1
See invite for GitHub on NTULearn.
Readings for next week:
We will spend the next few weeks becoming familiar with Python programming and practicing basic concepts and methods.
The primary readings for next week are from the official Python tutorial:
Additionally, please read the section on sets (only this section, not the rest of the chapter):
To familiarize you with the Natural Language ToolKit (NLTK) and give you a taste of what we will start to cover from Week 4, here are some additional readings, which also allow you to practice some of what we will go through in Week 2:
- NLTK Chapter 1: Language Processing and Python
- NLTK Chapter 1.1: Computing with Language: Texts and Words
- NLTK Chapter 1.2: A Closer Look at Python: Texts as Lists of Words
- NLTK Chapter 1.3: Computing with Language: Simple Statistics
- NLTK Chapter 1.5: Automatic Natural Language Understanding