Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/api/lambeq.ansatz.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _api-ansatz:

lambeq.ansatz
=============

Expand Down
2 changes: 2 additions & 0 deletions docs/api/lambeq.rewrite.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _api-rewrite:

lambeq.rewrite
==============

Expand Down
2 changes: 2 additions & 0 deletions docs/api/lambeq.text2diagram.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _api-text2diagram:

lambeq.text2diagram
===================

Expand Down
32 changes: 23 additions & 9 deletions docs/cite.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,30 @@ If you use ``lambeq`` for your research, please cite the accompanying paper :cit

@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
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},
}

The :py:term:`DisCoCirc` extension introduced in Release :ref:`rel-0.5.0` is described in detail in this paper :cite:p:`krawchuk_2025`:

.. code-block:: bash

@article{krawchuk2025,
title={Efficient {G}eneration of {P}arameterised {Q}uantum {C}ircuits from {L}arge {T}exts,
author={Colin Krawchuk
and Nikhil Khatri
and Neil John Ortega
and Dimitri Kartsaklis
year={2025},
journal={arXiv preprint arXiv:2505.13208},
}
9 changes: 6 additions & 3 deletions docs/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Glossary
A model that produces semantic representations of sentences by composing together the semantic representations of the words within them. An example of a compositional model is :term:`DisCoCat`.

coreference resolution
A task whose goal is to identify which linguistic expressions in a text refer to the same real-world entity. In ``lambeq``, coreference resolution is mainly used in the context of :term:`DisCoCirc` models, and utilises the :term:`spaCy` NLP toolkit.
A task whose goal is to identify which linguistic expressions in a text refer to the same real-world entity. In ``lambeq``, coreference resolution is mainly used in the context of :term:`DisCoCirc` models, and utilises the :term:`spaCy` NLP toolkit and the `Maverick <https://github.com/SapienzaNLP/maverick-coref>`_ package.

cup
A special morphism in a :term:`rigid category`, which, together with a :term:`cap` morphism, obey certain conditions called :term:`snake equations`. In diagrammatic form, a cup is depicted as a wire with upward concavity (:math:`\cup`). In the context of :term:`DisCoCat`, a cup usually represents a tensor contraction between two-word representations.
Expand All @@ -55,9 +55,9 @@ Glossary

DisCoPy
DIStributional COmpositional PYthon. A Python library for working with :term:`monoidal categories <monoidal category>` :cite:p:`de_felice_2021`. It includes abstractions for creating all standard :term:`quantum gates <quantum gate>` and building :term:`quantum circuits <quantum circuit>`. Additionally, it is equipped with many language-related features, such as support for :term:`pregroup grammars <pregroup grammar>` and :term:`functors <functor>` for implementing :term:`compositional models <compositional model>`.

frame
In ``lambeq``'s :term:`string diagrams <string diagram>`, a special type of box that can contain other boxes or frames. Frames are mainly used in the context of :term:`DisCoCirc` models, representing higher-level linguistic expressions.
In ``lambeq``'s :term:`string diagrams <string diagram>`, a special type of box that can contain other boxes or frames. Frames are mainly used in the context of :term:`DisCoCirc` models, representing higher-level linguistic expressions.

Frobenius algebra
In the context of a :term:`symmetric monoidal category`, a Frobenius algebra provides morphisms :math:`\Delta: A \to A\otimes A` and :math:`\mu: A\otimes A \to A` for any object :math:`A`, satisfying certain conditions (the so-called Frobenius equations) and implementing the notion of a :term:`spider`. In ``lambeq`` and :term:`DisCoCat`, spiders can be used to implement :term:`rewrite rules <rewrite rule>` :cite:p:`kartsaklis_2016a,kartsaklis_2016b,sadrzadeh_2013,sadrzadeh_2014`.
Expand Down Expand Up @@ -89,6 +89,9 @@ Glossary
noise
Undesired artefacts that cause the measurement outcome of a :term:`quantum circuit` to deviate from the ideal distribution.

Oncilla
A new experimental end-to-end parser that simplifies the process of generating diagrams from text, minimizing or even eliminating exposure of the user to CCG representations and functionality. This parser utilises the :term:`pregroup tree` representation of diagrams.

parser
A statistical tool that converts a sentence into a hierarchical representation that reflects the syntactic relationships between the words (a :term:`syntax tree`) based on a specific grammar formalism.

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/lambeq-basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Related research
----------------

- The idea of using category theory to represent language was first introduced in :cite:p:`coecke_2010`, which detailed a framework that later became known as :term:`DisCoCat`. DisCoCat is supported in ``lambeq`` along with many other compositional schemes.
- An extension of DisCoCat that allows the compositional encoding of full paragraphs or documents into quantum circuits is described in :cite:p:`coecke_2021a`. ``lambeq`` provides experimental support for :term:`DisCoCirc` models through the :py:mod:`lambeq.experimental.discocirc` package.
- An extension of DisCoCat that allows the compositional encoding of full paragraphs or documents into quantum circuits is described in :cite:p:`coecke_2021a`. ``lambeq`` provides experimental support for :term:`DisCoCirc` models through the :py:mod:`lambeq.experimental.discocirc` package :cite:p:`krawchuk_2025`.
- An early, yet-unreleased version of ``lambeq`` was used in :cite:p:`lorenz_2023`, a paper that described one of the first small-scale NLP experiments on a real quantum computer. The 40-pages paper provides a detailed introduction to the theoretical framework and the principles on which ``lambeq`` is now based, and it's an excellent starting point for the interested readers.

6 changes: 5 additions & 1 deletion docs/guide/parsing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ Syntactic parsing

``lambeq``'s :ref:`string diagrams <sec-string-diagrams>` are based on a :ref:`pregroup grammar <sec-pregroup-grammars>` to keep track of the types and the interactions between the words in a sentence. When a detailed syntactic derivation is required (as in the case of :term:`DisCoCat`), a :term:`syntax tree` needs to be provided by a statistical :term:`parser`. However, since the :term:`pregroup grammar` formalism is not particularly well-known in the :term:`NLP <natural language processing (NLP)>` community, there is currently no wide-coverage pregroup :term:`parser` that can automatically provide the syntactic derivations. To address this problem, ``lambeq`` provides a passage from a derivation in the closest alternative grammar formalism, namely :term:`Combinatory Categorial Grammar (CCG)`, to a :term:`string diagram` which faithfully encodes the syntactic structure of the sentence in a pregroup-like form :cite:p:`yeung_2021`. Due to the availability of many robust :term:`CCG <Combinatory Categorial Grammar (CCG)>` :term:`parsing tools <parser>`, this allows the conversion of large corpora with sentences of arbitrary length and syntactic structure into :term:`pregroup <pregroup grammar>` and :term:`DisCoCat` form.

Since Release :ref:`rel-0.2.0`, the standard ``lambeq`` installation includes a state-of-the-art CCG parser based on :cite:p:`clark_2021`, fully integrated into the toolkit. This parser is provided under the name :term:`Bobcat`. Additionally, ``lambeq`` implements a detailed interface in the :py:mod:`.text2diagram` package that allows connection to one of the many external CCG parsing tools that are currently available. For example, ``lambeq`` is also shipped with support for :term:`depccg` [#f1]_ :cite:p:`yoshikawa_2017`, a fast parser that comes with a convenient Python interface.
The standard ``lambeq`` installation includes a state-of-the-art CCG parser based on :cite:p:`clark_2021`, fully integrated into the toolkit. This parser is provided under the name :term:`Bobcat`. Additionally, ``lambeq`` implements a detailed interface in the :py:mod:`.text2diagram` package that allows connection to one of the many external CCG parsing tools that are currently available. For example, ``lambeq`` is also shipped with support for :term:`depccg` [#f1]_ :cite:p:`yoshikawa_2017`, a fast parser that comes with a convenient Python interface.

Additional external parsers can be made available to ``lambeq`` by extending the :py:class:`.CCGParser` class in order to create a wrapper subclass that encapsulates the necessary calls and translates the respective parser's output into :py:class:`.CCGTree` format.

Finally, for users who prefer to keep the installation of the toolkit light, ``lambeq`` also includes a web-based parser class that sends parsing queries to an online API, so that local installation of a full CCG parser is not strictly necessary anymore -- although strongly recommended for most practical uses of the toolkit.

Oncilla parser
--------------
Since Release :ref:`rel-0.5.0`, ``lambeq`` provides a new end-to-end parser class, :py:class:`~lambeq.text2diagram.OncillaParser`, that simplifies the process of generating diagrams from text, minimizing or even eliminating exposure of the user to CCG representations and functionality. This parser utilises the :term:`pregroup tree` representation of diagrams, offering accuracy and coverage similar to Bobcat in much faster speeds -- up to three times faster. :term:`Oncilla` parser is currently available as an experimental feature.

Reading CCGBank
---------------

Expand Down
3 changes: 3 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ To install ``lambeq`` with optional dependencies for experimental features::

pip install lambeq[experimental]

.. note::
For best results with the experimental features, use Python 3.11.

DepCCG support
--------------

Expand Down
2 changes: 1 addition & 1 deletion docs/quantinuum-sphinx
9 changes: 9 additions & 0 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -404,3 +404,12 @@ @misc{tull_2024
primaryClass={cs.AI},
url={https://arxiv.org/abs/2406.17583},
}

@misc{krawchuk_2025,
title="{Efficient Generation of Parameterized Quantum Circuits from Large Texts}",
author={Colin Krawchuk and Nikhil Khatri and Neil John Ortega and Dimitri Kartsaklis},
year={2025},
eprint={2505.13208},
primaryClass={quant-ph},
url={https://arxiv.org/abs/2505.13208},
}
Loading