While the parser provides lambeq’s input, DisCoPy [FTC2020] is lambeq’s underlying engine, the component where all the low-level processing takes place. At its core, DisCoPy is a Python library that allows computation with monoidal categories. The main data structure is that of a monoidal diagram, or string diagram, which is the format that lambeq uses internally to encode a sentence (discopy.grammar.pregroup.Diagram). DisCoPy makes this easy, by offering many language-related features, such as support for pregroup grammars and functors for implementing compositional models such as DisCoCat. Furthermore, from a quantum computing perspective, DisCoPy provides abstractions for creating all standard quantum gates and building quantum circuits, which are used by lambeq in the final stages of the pipeline.

Thus, it is not a surprise that the advanced use of lambeq, involving extending the toolkit with new compositional models and ansätze, requires some familiarity of DisCoPy. For this, you can use the following resources: