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).

Getting started

Prerequisites

  • Python 3.10+

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 the external parser separately.


Note: The DepCCG-related functionality is no longer actively supported in lambeq, and may not work as expected. We strongly recommend using the default Bobcat parser which comes as part of lambeq.


If you still want to use DepCCG, for example because you plan to apply lambeq on Japanese, you can install DepCCG separately following the instructions on the DepCCG homepage. 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 in lambeq's documentation repository contains notebooks demonstrating usage of the various tools in lambeq.

Example - parsing a sentence into a diagram (see docs/examples/parser.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 lambeq in a virtual environment, remember to install pytest in the same environment using pip.

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.4.3.tar.gz (236.4 kB view details)

Uploaded Source

Built Distribution

lambeq-0.4.3-py3-none-any.whl (210.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lambeq-0.4.3.tar.gz
  • Upload date:
  • Size: 236.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for lambeq-0.4.3.tar.gz
Algorithm Hash digest
SHA256 84ab792eb49797bd7594288ff546535078c39f44311259db1700e54a7fbdf070
MD5 b268713b40445aa4f045183cc341a7f0
BLAKE2b-256 d0cbec8bf15ac0e5a91d462e2bfcd7afb0b044810d0977cf1c7baf77944e7a1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lambeq-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 210.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for lambeq-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0070220f3feb4b64feb099d9cada7d83764446527d56232d7a82d37f88c21507
MD5 5b84c40a4da55a37ca295563febb57d1
BLAKE2b-256 63a7562ce1a102ea3cb1dfaa50a86741fbf5d56a583c0fcbdc3da47fa504c5c4

See more details on using hashes here.

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