Running the Alpino parser on Windows 10

Jan 10, 2017

Tags: linux, nlp, windows


There used to be a (now ancient) version of the Alpino parser for Windows. However, since compiling Alpino on Windows requires an unholy mixture of Visual Studio and Cygwin, we gave up after a couple of builds.

Opening a corpus in Dact

Since then, Microsoft has introduced a beta version of the Windows Subsystem for Linux (WSL). This is basically an NT personality that implements Linux system calls and an ELF loader. As a consequence, Windows 10 with WSL can run Linux binaries natively (WSL is not a virtual machine or emulator). This opens up the possibility to run the unaltered Linux version of Alpino on Windows. This post gives a quick description of how to get Alpino running on WSL.

Enabling WSL

First follow the instructions for enabling WSL for Windows 10. On the regular Windows 10, this also installs Ubuntu 14.04 as the Linux userland. On Windows insider builds, this procedure will give you Ubuntu 16.04. You can now run bash at any time in a Windows command prompt to open a Linux shell.

If you want to use the graphical user interface of Alpino, you will also need an X server. The open source VcXsrv server seems to work very well. Other well-known options are Xming (latest version is paid) and MobaXterm. For the remainder of this post, I assume that VcXsrv is installed.

Installing Alpino

Enter the Linux environment by running bash in a Windows command prompt and install some support libraries that are required for Alpino:

$ sudo apt update
$ sudo apt install libxss1 libxft2 libtk8.5

Next, we can download, extract, and prepare Alpino:

$ cd
$ wget
$ tar zxf Alpino-x86_64-Linux-glibc-2.19-21014-sicstus.tar.gz
$ cd Alpino
$ rm create_bin/libtcl*.so
$ rm create_bin/libtk*.so

If you want another version of Alpino, change the wget and tar commands correspondingly. Alpino is distributed with the TCL and Tk libraries. However, the supplied versions conflict with the installed version, since the library versions need to correspond to the system-wide TCL files. For this reason, the last two lines remove the Alpino-supplied libraries. The dynamic linker will then automatically use the system-wide TCL/Tk libraries.

First run

If you want to run Alpino using its graphical user interface, you first need to start the X server. Double click the XLaunch icon that is on the desktop. Then select Multiple windows during the first step of the X server configuration, Start no client during the next step. Then continue clicking Next until the X server starts. The X server continues running until Windows is restarted.

Then open the Linux environment and enter the following commands if you want to run Alpino with its GUI:

$ cd ~/Alpino
$ export DISPLAY=:0
$ bin/Alpino

This should start Alpino and show Alpino’s main window. If you instead want to start Alpino without the GUI, use:

$ cd ~/Alpino
$ bin/Alpino -notk

Permanent configuration

To make running Alpino a bit more convenient, we want to set the following for every Linux shell session:

You can do this by adding the following lines to your ~/.bashrc

export ALPINO_HOME=~/Alpino
export DISPLAY=:0
export PATH=$PATH:${ALPINO_HOME}/bin

You could do this by executing:

cat << EOF >> ~/.bashrc
export ALPINO_HOME=~/Alpino
export DISPLAY=:0
export PATH=$PATH:${ALPINO_HOME}/bin

Now you can start Alpino by simply running Alpino in any Linux session.

One more thing

Even thought there is a Windows version of Dact, a search tool for Alpino treebanks, you can also install the Linux version of Dact. This has the added benefit that you can also install the command-line tools. Installation is simple:

$ sudo add-apt-repository ppa:danieldk/dact
$ sudo apt update
# For installing Dact:
$ sudo apt install alpino-dact
# For installing the Alpino tools:
$ sudo apt install alpino-corpus-util

After the installation, you can run Dact with:

$ alpino-dact

Or read the manual pages for the command-line tools:

$ man alpinocorpus-xpath