Scala Programming for Computational Linguistics

This is the public Git repository of the class "Scala Programming for Computational
at the University of Tübingen in the 16/17 winter term by Verena
Henrich and Thilo Götz. For more general information about the class, please
check the official course website.

In this repository you will find the slides from the class, the sample
code that goes with the slides, and the weekly exercises. As a student,
you will want to clone this repository (instructions below), and regularly get
the latest copy.

Contents of this repository

The contents of this repository are updated as the course proceeds.
You find three folders in this repository:

  • slides: We upload all slides to this folder.
  • samples: This folder contains code examples that go with the slides.
  • exercises: Here you find the weekly exercises (in subfolder src/main)
    and corresponding unit tests (in subfolder src/test).

Setting up your development environment

For the purposes of this class, we will do our Scala development in the
free edition of the Intellij IDEA development environment.

You should install the following tools (in this order):

  1. The Java 8 JDK, latest version.
  2. Apache Maven
  3. Git
  4. Intellij IDEA community edition

Operating system specific instructions:

  • On the Mac, use homebrew to install Maven and Git. Get IDEA from their website.
  • On Linux, use your distribution’s update mechanism to install Java,
    Maven and Git (e.g., apt-get on Ubuntu). Get IDEA from their website.

Installing Scala for the command line is not strictly necessary. Make
sure to enable Scala language support when installing IDEA.

Cloning this repository

To get a copy of the repository to your local machine, you have to clone the repository.
This help page
explains how to get the repository cloned to your local machine. It is basically
the command
git clone

Configure source directories

Open the project in Intellij and configure exercises/src/main/scala and
exercises/src/test/scala as source directories:

  1. Right-click on exercises/src/main/scala -> Mark Directory as -> Sources Root
  2. Right-click on exercises/src/test/scala -> Mark Directory as -> Test Sources Root

Using this repository

Once you have a local copy of the repository, you can update it on
the command line with git pull. Since you
will not be committing any code to the repository, that's all you really need to
know about Git.

If you don't want to use Git for some reason, you can also just click on the
Source navigation item on the left and browse to files directly, without
having to install Git.

It is very useful to have some Git skills though. If you would like to learn
more about git, you can start with the help pages over on Once you know the
basics, a very useful reference is this online book.

Using Apache Maven

You can use Maven to build your project and to run tests. For now it is
sufficient to know two Maven commands:

  1. To compile your source code run mvn clean compile.
  2. To run all Scala unit tests run mvn clean test.

We will learn more about Maven later. If you like to learn
more about it already now, you can start with the help pages on](