Your understanding of linguistics and how it applies to spoken language processing is very important, but it is not much use unless you can implement it. So it’s essential to start to learn a programming language. Learning to programme on your own is hard, so a structured course is the way to go.
Credit: this page was updated by Catherine Lai
There are three levels to this part of the course, depending what stage you are at:
- Thinking about applying to a programme in this area: Check your aptitude.
- Preparing your application to a Masters programme: Prepare to apply, and optionally the first two basic milestones for each section of Prepare to study if you want to put together a really strong application.
- Applied and holding an offer: Prepare to study.
Check your aptitude
A few people simply don’t get on with programming, so your very first step should be to confirm you have some aptitude. If you try programming for the first time and don’t love it, then think carefully about whether speech and language processing is for you. You don’t need to aspire to be a software engineer, but you have to be motivated to master the essential tool of programming: it’s how all speech and language processing is implemented.
Stanford’s free online Computer Science 101 class introduces the “essential ideas of Computer Science” and will demystify computers for you. It includes a little coding; the language used in this particular course is Javascript, which is fine for getting started, but you should switch to Python after this.
Code First Girls (Tip: You don’t need to be girl! There are other eligibility requirements though.) has helped a lot of students get into coding, and their beginner-level courses on Python get positive feedback from our students. Alternatively, the interactive site Codecademy lets you start coding without having to install anything because it’s all done in a web browser.
Prepare to apply
Code First Girls and/or Codecademy will get you started, but you need to go a bit further than they allow, so now you should find something more substantial. Try your local community college, or find an online course. Programming for Everybody (Getting Started with Python) is a good starting point. It’s part of the University of Michigan’s Learn to Program and Analyze Data with Python specialism, and the 2nd course “Python Data Structures” is useful too, but the 3rd and 4th courses are not so important at this stage.
Now it’s just a case of practice, practice, practice. Just like learning a natural language or a musical instrument, you need to repeat, make mistakes, and gradually improve over time. Work through problems on Codecademy always making sure you’re an active learner, not just passively reading through solutions. Focus on the core concepts and don’t get carried away just yet: reading other people’s advanced code is no substitute for writing your own basic code from scratch.
Prepare to study
Programming competence is essential for the SLP program. Even though there is a semester long course (CPSLP) devoted to introducing programming in Python, you need a basic level of programming skill on arrival. This is because CPSLP goes through concepts quite fast and because the ANLP course assumes that you have basic competence with Python within the first few weeks of the first semester. Even more than with mathematics, you can only really learn programming by doing it (and by making mistakes!). So, start practising as soon as you can!
Make a plan
You need to set yourself some goals and a timeline. We’re suggesting a timeline over the summer before commencing study, but you can of course move everything earlier and spread it over a longer period if you are able to. We’re also assuming you already did everything above: if not, include that in your plan.
June
Set up your personal computer. All the necessary software is free.
- Check your computing requirements. Decide if you need a different computer or operating system.
- Figure out how to access a bash shell
- Terminal for OSX and Linux (already built-in)
- Cygwin or Windows Subsystem for Linux for Windows (install just one; WSL is reported as easier to install)
- Setup a python IDE:
Construct a personal study plan. Use the basic milestones below as your guide.
July
Execute your personal study plan.
August
After completing all the basic milestones, go back and complete the extensions. But, if you need more time on the basic milestones, then spend August on those. It’s better to build a really solid foundation of the basics than have a shaky understanding of more advanced material.
A suitable computer and operating system
Basically, all speech and language processing research programming is done in Unix-like environments (yes, even at Microsoft Research!), so you may want to consider switching to a different operating system to make your programming life easier. Many researchers like to use Apple computers because MacOS is a Unix operating system and because they have excellent audio support. They’ve worked very well for SLP students in the past, the only downside being cost. If you don’t want to use Apple products, there are many different versions of Linux out there, of which Ubuntu is probably the easiest to use ‘out of the box’. The normal way to create a Linux computer is to start from computer with a pre-installed Windows operating system. Linux is free, but does require more expertise to install and maintain than MacOS or Windows. Our recommendation is not to replace your current operating system (thus making a Linux-only machine) or to create a dual-boot machine. Instead, we recommend installing Linux as a virtual machine because this is easy, reversible, and works for both MacOS and Windows.
If you are preparing for the programme, or preparing to apply, then you can avoid installing Linux for the time being, using the recommendations under “June” to obtain a working bash shell and a Python IDE. If you are about to start the programme, then wait for the University to issue specific advice on setting up your machine ready for study (e.g., provision of a pre-configured virtual Linux machine).
Before programming: the shell and operating system
Can you list the files in a directory (also called a “folder”)? Create a new directory? Output the contents of a file to the screen? Can you do it without the mouse? Doing these tasks in a shell instead of your operating system’s graphical interface is not only faster, it also allows much more complex operations to be performed and automated.
On MacOS or Linux you can easily access the bash shell by using the built-in Terminal application. (MacOS users on Catalina will get zsh by default, so you might wish to change your default shell to bash). On Windows you will need to use the Windows Subsytem for Linux, or a Unix emulator like Cygwin.
Basic milestones
- Do the exercises from the first lecture (introducing the shell) of The Missing Semester of Your CS Education
- Practice through basic shell commands: e.g., Joe Collins’ intro to the bash terminal
- Remember: don’t just watch videos, but do everything yourself, then repeat the exercises without video assistance.
Extension
- Go through the remaining material from The Missing Semester of Your CS Education up to and including the class on version control.
The only programming language you need: Python
You will cover the basics of Python in CPSLP before needing it in ANLP during semester 1, but the scheduling is pretty tight. If you can do problems from the Python 2 course on CodeAcademy, you should be in a good position (similarly for The Missing Semester of Your CS Education course). It will definitely make your life a lot easier if you already know about lists, dictionaries, and functions in Python before the semester starts.
We’ve suggested a task to code from scratch (“dealing cards”) below, but you should feel free to pursue whatever challenge takes your interest. You can find many project ideas on the Raspberry Pi website.
Basic milestones
- Complete the CodeAcademy Python 2 “battleship” exercise (in 7: Lists and Functions)
- NB: CodeAcademy Python 2 is free (the python 3 version is not). There are some differences with Python 3 (e.g. how the print statement is used), but the basics are the same.
- Complete the CodeAcademy Python 2 “practice makes perfect” exercise (in 8: Loops)
- Check that you can run and read the code for this old ANLP lab
- Problem Solving from Scratch: Write a program that deals out cards for a game of your choice, e.g. blackjack or poker. Then, swap your code with someone else in the class and analyze how realistic and robust it is. Aim to finish your program before the end of July so that you can share it with a classmate in August!
- This problem is deliberately underspecified so you have to think about how you would go about translating ideas to code. This is really important and difficult and means you are now programming (which includes designing) and not just coding (implementing)!
- You might want to think about the following sorts of questions:
- what data types can be used to represent the deck of cards?
- for a standard set of cards, how will you represent different suits and values?
- is the number of players fixed or can you change it?
- how can you represent a shuffled deck?
- how will you select cards from the deck?
- NB: it’s not too hard to find card game simulation code on the internet. Don’t! The goal is to get some experience writing from scratch. By all means use sites like Stackoverflow to keep learning (e.g., how to randomise the order of a list), but that’s all.
Extensions
- Watch the CS dojo series on data structures and algorithms
- Make your card dealing program object-oriented.
- if you get stuck, or don’t yet know what object-oriented means (it’s a huge conceptual leap for everyone, so don’t worry if you don’t quite get it yet), follow this tutorial
- Simulate turns of a game of your choice, assuming the computer is the dealer and other players use text input to make their moves.
- ask other people to test your program and see if they can understand your code (“code review” is standard practice across industry: you must always write code that someone else can easily understand)
- Once you’ve got a good grasp of programming fundamentals, reading code in other (related) languages becomes possible. In fact, we would consider it a part of programming competency. See if you can follow this tutorial on object-oriented programming which uses JavaScript rather than Python (just read the code, don’t attempt to write any)
- To complement the data structures course you took earlier, take this course on algorithms: data structures and algorithms are the two key principles from Computer Science that we need in the field of speech and language processing.
Related forums
-
- Forum
- Topics
- Last Post