This is the official repository of NB N-Gram, created by Språkbanken at the National Library of Norway. In its current form NB N-gram is a trend viewer, similar to Google Ngram Viewer. It shows you the development of words or sequences of words in the vast material digitized at the National Library of Norway, but it is also perfectly adoptable to other corpora. This repository contains both the backend, written in Python/Flask, and the frontend, written in HTML/JavaScript.
To install:
- Create a virtual environment and install the packages in
requirements.txt
- Download the SQLite databases from Språkbanken's repository or provide your own data
- Configure the paths to the databases and the database schema in
backend.py
- Set the environment variable
FLASK_NGRAM_SETTINGS
to point to your Flask configuration file (eg. different settings for production and development machines): an example development configruation file is found inflask-example-devsettings.cfg
- Start the session with
python backend.py
, listens at 127.0.0.1:5000 per default (for development only!) or run it behind a WSGI server like UWSGI or Gunicorn (production use)
NB N-gram is released under the Apache 2.0 license.