Python programming for linguists: Introduction

Python programming for linguists: Introduction

This is a very much delayed series of posts related the yearly module I give on Python programming for Natural Language Processing. The purpose of this module is to teach students how to use Python for processing corpora and for other Natural Language Processing (NLP) related tasks. The background of students is different from year to year, but in general students come with non-computer science related backgrounds. This makes the module a bit challenging because in about 12 weeks, I need to bring these students from zero to an intermediate level.

I have been teaching this module for 10 years. This means the module has gone through a number of revisions and refinements. I gave a condensed version of this module at Dublin City University in 2017 and the slides are available on my GitHub account. I use the same repository to post updates of my slides.

Structure of the module

When I teach, I have only about 10 teaching weeks to cover all the material. In general, the module has roughly the following structure:

Weeks 1-5 Basic Python notions (data structures, python syntax, how to analyse a problem and design an algorithm etc.), learn what we can do with NLTK

Week 6 Catch up with any topics that were not clear enough. Ensure that all the students are comfortable with basic Python. Tackle more complicated problems.

Week 7 More about functions and explore more advanced notions such as list comprehension and functional programming in Python.

Week 8 Regular expressions: how to use regular expressions to match patterns in text and clean “messy” texts

Week 9 Processing XML files: learn how to read information from XML files and how to produce them

Week 10 Processing other types of files (e.g. reading and creating JSON and CSV files). Accessing information from APIs.

Week 11: Stop and recap/mock in-class test. Use Python to solve more complicated problems. Have a look at SpaCy.

Quite often, I end up updating this schedule depending on the students’ interest and the speed in which I manage to cover each topic. In the context of these posts, the week numbers are not too meaningful. I will use them largely to order the material.

Where I can learn more about Python

Each year, I am contacted at the beginning of each academic year by eager students who want to start learning python before the year starts. Assuming that I will be organised enough, this series of posts will provide the necessary background. Alternatively, you can consider the following links to articles about how to start learning Python:

Real python also contains numerous tutorials that are very useful for learning Python. For beginners, the articles tagged as basic can be useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.