Skip to main content

Colibri Core is an NLP tool as well as a C++ and Python library (all included in this package) for working with basic linguistic constructions such as n-grams and skipgrams (i.e patterns with one or more gaps, either of fixed or dynamic size) in a quick and memory-efficient way. At the core is the tool ``colibri-patternmodeller`` which allows you to build, view, manipulate and query pattern models.

Project description

Colibri Core

GitHub C++ build GitHub Python build DOI GitHub release Project Status: Active – The project has reached a stable, usable state and is being actively developed. PyPi

by Maarten van Gompel, proycon@anaproy.nl, Radboud University Nijmegen

Licensed under GPLv3 (See http://www.gnu.org/licenses/gpl-3.0.html)

Colibri Core is software to quickly and efficiently count and extract patterns from large corpus data, to extract various statistics on the extracted patterns, and to compute relations between the extracted patterns. The employed notion of pattern or construction encompasses the following categories:

  • n-gram -- n consecutive words
  • skipgram -- An abstract pattern of predetermined length with one or multiple gaps (of specific size).
  • flexgram -- An abstract pattern with one or more gaps of variable-size.

N-gram extraction may seem fairly trivial at first, with a few lines in your favourite scripting language, you can move a simple sliding window of size n over your corpus and store the results in some kind of hashmap. This trivial approach however makes an unnecessarily high demand on memory resources, this often becomes prohibitive if unleashed on large corpora. Colibri Core tries to minimise these space requirements in several ways:

  • Compressed binary representation -- Each word type is assigned a numeric class, which is encoded in a compact binary format in which highly frequent classes take less space than less frequent classes. Colibri core always uses this representation rather than a full string representation, both on disk and in memory.
  • Informed iterative counting -- Counting is performed more intelligently by iteratively processing the corpus in several passes and quickly discarding patterns that won't reach the desired occurrence threshold.

Skipgram and flexgram extraction are computationally more demanding but have been implemented with similar optimisations. Skipgrams are computed by abstracting over n-grams, and flexgrams in turn are computed either by abstracting over skipgrams, or directly from n-grams on the basis of co-occurrence information (mutual pointwise information).

At the heart of the sofware is the notion of pattern models. The core tool, to be used from the command-line, is colibri-patternmodeller which enables you to build pattern models, generate statistical reports, query for specific patterns and relations, and manipulate models.

A pattern model is simply a collection of extracted patterns (any of the three categories) and their counts from a specific corpus. Pattern models come in two varieties:

  • Unindexed Pattern Model -- The simplest form, which simply stores the patterns and their count.
  • Indexed Pattern Model -- The more informed form, which retains all indices to the original corpus, at the cost of more memory/diskspace.

The Indexed Pattern Model is much more powerful, and allows more statistics and relations to be inferred.

The generation of pattern models is optionally parametrised by a minimum occurrence threshold, a maximum pattern length, and a lower-boundary on the different types that may instantiate a skipgram (i.e. possible fillings of the gaps).

Technical Details

Colibri Core is available as a collection of standalone command-line tools, as a C++ library, and as a Python library.

Please consult the full documentation at https://proycon.github.io/colibri-core

Installation

Python binding

For the Colibri Core Python library, just install using:

pip install colibricore

We strongly recommend you use a Virtual Environment for this. Do note that this is only available for unix-like systems, Windows is not supported.

Installation from source

For the command-line tools, check if your distribution has a package available. There are packages for Alpine Linux (apk add colibri-core) and for macOS with homebrew (brew tap fbkarsdorp/homebrew-lamachine && brew install colibri-core). Note that these do not contain the Python binding!

If no packages are available, you will need to compile from source or use the container build (e.g. Docker) as explained later on.

In order to do so, you need a sane build environment, install the necessary dependencies for your distribution:

For Debian/Ubuntu::

$ sudo apt-get install make gcc g++ pkg-config autoconf-archive libtool autotools-dev libbz2-dev zlib1g-dev libtar-dev python3 python3-dev cython3

For RedHat-based systems (run as root)::

# yum install pkgconfig libtool autoconf automake autoconf-archive make gcc gcc-c++ libtar libtar-devel python3 python3-devel zlib zlib-devel python3-pip bzip2 bzip2-devel cython3

For macOS with homebrew:

$ brew install autoconf automake libtool autoconf-archive python3 pkg-config

Then clone this repository and install as follows:

$ bash bootstrap
$ ./configure
$ make
$ sudo make install

Container usage

The Colibri Core command-line tools are also available as an OCI/Docker container.

A pre-made container image can be obtained from Docker Hub as follows:

docker pull proycon/colibri-core

You can also build a container image yourself as follows, make sure you are in the root of this repository:

docker build -t proycon/colibri-core .

This builds the latest stable release, if you want to use the latest development version from the git repository instead, do:

docker build -t proycon/colibri-core --build-arg VERSION=development .

Run the frog container interactively as follows, it will dump you into a shell where the various command line tools are available:

docker run -t -i proycon/colibri-core

Add the -v /path/to/your/data:/data parameter if you want to mount your data volume into the container at /data.

Demo

Colibri Core Demo

Publication

This software is extensively described in the following peer-reviewed publication:

van Gompel, M and van den Bosch, A (2016)
Efficient n-gram, Skipgram and Flexgram Modelling with Colibri Core.
*Journal of Open Research Software*
4: e30, DOI: http://dx.doi.org/10.5334/jors.105

Access the publication here and please cite it if you make use of Colibri Core in your work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colibricore-2.5.9.tar.gz (1.0 MB view hashes)

Uploaded Source

Built Distributions

colibricore-2.5.9-cp311-cp311-musllinux_1_1_x86_64.whl (6.6 MB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp311-cp311-macosx_11_0_arm64.whl (612.9 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

colibricore-2.5.9-cp311-cp311-macosx_10_9_x86_64.whl (747.1 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

colibricore-2.5.9-cp310-cp310-musllinux_1_1_x86_64.whl (6.5 MB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp310-cp310-macosx_11_0_arm64.whl (613.6 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

colibricore-2.5.9-cp310-cp310-macosx_10_9_x86_64.whl (747.9 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

colibricore-2.5.9-cp39-cp39-musllinux_1_1_x86_64.whl (6.6 MB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp39-cp39-macosx_11_0_arm64.whl (624.7 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

colibricore-2.5.9-cp39-cp39-macosx_10_9_x86_64.whl (763.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

colibricore-2.5.9-cp38-cp38-musllinux_1_1_x86_64.whl (6.7 MB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp38-cp38-macosx_11_0_arm64.whl (619.1 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

colibricore-2.5.9-cp38-cp38-macosx_10_9_x86_64.whl (747.9 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

colibricore-2.5.9-cp37-cp37m-musllinux_1_1_x86_64.whl (6.4 MB view hashes)

Uploaded CPython 3.7m musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp37-cp37m-macosx_10_9_x86_64.whl (746.3 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

colibricore-2.5.9-cp36-cp36m-musllinux_1_1_x86_64.whl (6.5 MB view hashes)

Uploaded CPython 3.6m musllinux: musl 1.1+ x86-64

colibricore-2.5.9-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.1 MB view hashes)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

colibricore-2.5.9-cp36-cp36m-macosx_10_9_x86_64.whl (761.9 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page