A QNLP toolkit
Project description
lambeq
About
lambeq is a toolkit for quantum natural language processing (QNLP).
- Documentation: https://cqcl.github.io/lambeq-docs/
- User support: lambeq-support@cambridgequantum.com
- Contributions: Please read our guide.
- If you want to subscribe to lambeq's mailing list, let us know by sending an email to lambeq-support@cambridgequantum.com.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84ab792eb49797bd7594288ff546535078c39f44311259db1700e54a7fbdf070 |
|
MD5 | b268713b40445aa4f045183cc341a7f0 |
|
BLAKE2b-256 | d0cbec8bf15ac0e5a91d462e2bfcd7afb0b044810d0977cf1c7baf77944e7a1b |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0070220f3feb4b64feb099d9cada7d83764446527d56232d7a82d37f88c21507 |
|
MD5 | 5b84c40a4da55a37ca295563febb57d1 |
|
BLAKE2b-256 | 63a7562ce1a102ea3cb1dfaa50a86741fbf5d56a583c0fcbdc3da47fa504c5c4 |