Skip to main content

A QNLP toolkit

Project description

lambeq

lambeq logo

Build status License PyPI version PyPI downloads arXiv

About

lambeq is a toolkit for quantum natural language processing (QNLP).


Note: Please do not try to read the documentation directly from the preview provided in the repository, since some of the pages will not be rendered properly.


Getting started

Prerequisites

  • Python 3.9+

Installation

lambeq can be installed with the command:

pip install lambeq

The default installation of lambeq includes Bobcat parser, a state-of-the-art statistical parser (see related paper) fully integrated with the toolkit.

To install lambeq with optional dependencies for extra features, run:

pip install lambeq[extras]

To enable depccg support, you will need to install depccg separately. More information can be found on the depccg homepage. Currently, only version 2.0.3.2 of depccg is supported. After installing depccg, you can download its model by using the script provided in the contrib folder of this repository:

python contrib/download_depccg_model.py

Usage

The docs/examples directory contains notebooks demonstrating usage of the various tools in lambeq.

Example - parsing a sentence into a diagram (see docs/examples/ccg2discocat.ipynb):

from lambeq import BobcatParser

parser = BobcatParser()
diagram = parser.sentence2diagram('This is a test sentence')
diagram.draw()

Testing

Run all tests with the command:

pytest

Note: if you have installed in a virtual environment, remember to install pytest in the same environment using pip.

Building documentation

To build the documentation, first install the required dependencies:

pip install -r docs/requirements.txt

then run the commands:

cd docs
make clean
make html

the docs will be under docs/_build.

License

Distributed under the Apache 2.0 license. See LICENSE for more details.

Citation

If you wish to attribute our work, please cite the accompanying paper:

@article{kartsaklis2021lambeq,
   title={lambeq: {A}n {E}fficient {H}igh-{L}evel {P}ython {L}ibrary for {Q}uantum {NLP}},
   author={Dimitri Kartsaklis and Ian Fan and Richie Yeung and Anna Pearson and Robin Lorenz and Alexis Toumi and Giovanni de Felice and Konstantinos Meichanetzidis and Stephen Clark and Bob Coecke},
   year={2021},
   journal={arXiv preprint arXiv:2110.04236},
}

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

lambeq-0.3.3.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lambeq-0.3.3-py3-none-any.whl (152.1 kB view details)

Uploaded Python 3

File details

Details for the file lambeq-0.3.3.tar.gz.

File metadata

  • Download URL: lambeq-0.3.3.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for lambeq-0.3.3.tar.gz
Algorithm Hash digest
SHA256 065e552f4969dec04d7b09aa87841a54a3a1be2ac0ed51ad3d6eab6dfb69049d
MD5 c8d853d16acd1e16af34a3fd1bdf4c5d
BLAKE2b-256 4eeba10f36d1f6ee11efd63e6e0df341aeeed2757c28c74da6997c95fe03cc68

See more details on using hashes here.

File details

Details for the file lambeq-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: lambeq-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 152.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for lambeq-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9ebc3f70a140d775d56225c0eb2db70ce3e13a0842a0c5e4306400524edfa249
MD5 9fd967679850b243c242e9c038136872
BLAKE2b-256 2833b6be6ba362f7b13cbf21185e794e6391a768f02d75e03a281f669b504ce8

See more details on using hashes here.

Supported by

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