Programming environment

For most of our work, we will use Python extended with various packages. Here is an overview with some recommendations.

Python

We will use Python 3. If any of you are still only familiar with Python 2, you can find  the differences between Python 2 and Python 3 on the web. We will use Python 3.7 as our official version.

 

IPython or Jupyter notebook 

We recommend working interactively when working with Python. The IPython package adds a lot of functionality, including auto indent and command completion with the tab key. Also the help function with ? and ?? are useful, and so are the magic commands.

Try for example

  • import nltk
  • nltk.FreqD #and hit tab
  • nltk.FreqDistribution?
  • nltk.FreqDistribution??
  • history?

You can work with ipython either in the terminal window, or through a Jupyter notebook.

Toolkits and packages

During the course, we will be familiar with several toolkits and packages.

The family of packages for numeric computing:

  • numpy
  • scipy
  • matplotlib
  • pandas

Machine learning packages

  • scikit-learn
  • tensorflow2 or pytorch

NLP-packages

  • nltk
  • spacy
  • gensim

(and maybe more)

IFI machines

On an IFI terminal, the command

  • export PATH=/opt/ifi/anaconda3/bin/:$PATH

should give you access to this beautiful world. Commands like

  • python
  • ipython
  • jupyter notebook

should give you a python 3.7 with all these packages available. (Some of them might not be installed yet, but will be in the near future.)

If you put the "export ... etc." line in your .bashrc-file and login anew, you will get the same access.

In the course, we will use several corpora and data provided with nltk. To get easy access to them on the IFI-machines, you can put

  • export NLTK_DATA=/projects/nlp/nltk_data

in your .bashrc file. Then you don't have to install the data to your own area.

Installing on your own machine

If you want to install Python together with all the packages we will use, I recommend Anaconda or miniconda. It manages all the packages and dependencies between them and makes it easy to stay updated. It should work on Linux, iOS and Windows. If you run Ubuntu, you may be able to install all packages without installing Anaconda.

See instructions here.

Published Aug. 13, 2020 11:59 AM - Last modified Aug. 21, 2020 2:15 PM