DisCoCat (Categorical Compositional Distributional) is a mathematical framework for natural language processing which uses category theory to unify distributional semantics with the principle of compositionality. The grammatical derivations in a categorial grammar (usually a pregroup grammar) are interpreted as linear maps acting on the tensor product of word vectors to produce the meaning of a sentence or a piece of text. String diagrams are used to visualise information flow and reason about natural language semantics.
History
The framework was first introduced by Bob Coecke, Mehrnoosh Sadrzadeh, and Stephen Clark[1] as an application of categorical quantum mechanics to natural language processing. It started with the observation that pregroup grammars and quantum processes shared a common mathematical structure: they both form a rigid category (also known as a non-symmetric compact closed category). As such, they both benefit from a graphical calculus, which allows a purely diagrammatic reasoning. Although the analogy with quantum mechanics was kept informal at first, it eventually led to the development of quantum natural language processing.[2][3]
Definition
There are multiple definitions of DisCoCat in the literature, depending on the choice made for the compositional aspect of the model. The common denominator between all the existent versions, however, always involves a categorical definition of DisCoCat as a structure-preserving functor from a category of grammar to a category of semantics, which usually encodes the distributional hypothesis.
The original paper[1] used the categorical product of FinVect with a pregroup seen as a posetal category. This approach has some shortcomings: all parallel arrows of a posetal category are equal, which means that pregroups cannot distinguish between different grammatical derivations for the same syntactically ambiguous sentence.[4] A more intuitive manner of saying the same is that one works with diagrams rather than with partial orders when describing grammar.
This problem is overcome when one considers the free rigid category generated by the pregroup grammar.[5] That is, has generating objects for the words and the basic types of the grammar, and generating arrows for the dictionary entries which assign a pregroup type to a word . The arrows are grammatical derivations for the sentence which can be represented as string diagrams with cups and caps, i.e. adjunction units and counits.[6]
With this definition of pregroup grammars as free rigid categories, DisCoCat models can be defined as strong monoidal functors . Spelling things out in detail, they assign a finite dimensional vector space to each basic type and a vector in the appropriate tensor product space to each dictionary entry where (objects for words are sent to the monoidal unit, i.e. ). The meaning of a sentence is then given by a vector which can be computed as the contraction of a tensor network.[7]
The reason behind the choice of as the category of semantics is that vector spaces are the usual setting of distributional reading in computational linguistics and natural language processing. The underlying idea of distributional hypothesis "A word is characterized by the company it keeps" is particularly relevant when assigning meaning to words like adjectives or verbs, whose semantic connotation is strongly dependent on context.
Variations
Variations of DisCoCat have been proposed with a different choice for the grammar category. The main motivation behind this lies in the fact that pregroup grammars have been proved to be weakly equivalent to context-free grammars.[8] One example of variation[9] chooses Combinatory categorial grammar as the grammar category.
List of linguistic phenomena
The DisCoCat framework has been used to study the following phenomena from linguistics.
Applications in NLP
The DisCoCat framework has been applied to solve the following tasks in natural language processing.
See also
External links
- DisCoPy, a Python toolkit for computing with string diagrams
- lambeq, a Python library for quantum natural language processing
References
- 1 2 Coecke, Bob; Sadrzadeh, Mehrnoosh; Clark, Stephen (2010-03-23). "Mathematical Foundations for a Compositional Distributional Model of Meaning". arXiv:1003.4394 [cs.CL].
- ↑ Zeng, William; Coecke, Bob (2016-08-02). "Quantum Algorithms for Compositional Natural Language Processing". Electronic Proceedings in Theoretical Computer Science. 221: 67–75. arXiv:1608.01406. doi:10.4204/EPTCS.221.8. ISSN 2075-2180. S2CID 14897915.
- ↑ Coecke, Bob; de Felice, Giovanni; Meichanetzidis, Konstantinos; Toumi, Alexis (2020-12-07). "Foundations for Near-Term Quantum Natural Language Processing". arXiv:2012.03755 [quant-ph].
- ↑ Preller, Anne (2014-12-27). "From Logical to Distributional Models". Electronic Proceedings in Theoretical Computer Science. 171: 113–131. arXiv:1412.8527. doi:10.4204/EPTCS.171.11. ISSN 2075-2180. S2CID 18631267.
- ↑ Preller, Anne; Lambek, Joachim (2007-01-18). "Free Compact 2-Categories". Mathematical Structures in Computer Science. 17 (doi: 10.1017/S0960129506005901): 309. doi:10.1017/S0960129506005901. S2CID 10763735.
- ↑ Selinger, Peter (2010). "A survey of graphical languages for monoidal categories". New Structures for Physics. Lecture Notes in Physics. Vol. 813. pp. 289–355. arXiv:0908.3347. doi:10.1007/978-3-642-12821-9_4. ISBN 978-3-642-12820-2. S2CID 8477212.
- ↑ de Felice, Giovanni; Meichanetzidis, Konstantinos; Toumi, Alexis (2020-09-15). "Functorial Question Answering". Electronic Proceedings in Theoretical Computer Science. 323: 84–94. arXiv:1905.07408. doi:10.4204/EPTCS.323.6. ISSN 2075-2180. S2CID 195874109.
- ↑ Buszkowski, Wojciech (2001). "Lambek grammars based on pregroups". In International Conference on Logical Aspects of Computational Linguistics.
- ↑ Yeung, Richie; Kartsaklis, Dimitri (2021). "A CCG-based version of the DisCoCat framework". arXiv:2105.07720 [cs.CL].
- ↑ Sadrzadeh, Mehrnoosh; Kartsaklis, Dimitri; Balkır, Esma (2018). "Sentence entailment in compositional distributional semantics". Annals of Mathematics and Artificial Intelligence. 82 (4): 189–218. arXiv:1512.04419. doi:10.1007/s10472-017-9570-x. S2CID 5038840.
- ↑ Kartsaklis, Dimitri (2016). "Coordination in Categorical Compositional Distributional Semantics". Electronic Proceedings in Theoretical Computer Science. 221: 29–38. arXiv:1606.01515. doi:10.4204/EPTCS.221.4. S2CID 10842035.
- ↑ Bankova, Dea; Coecke, Bob; Lewis, Martha; Marsden, Dan (2018). "Graded hyponymy for compositional distributional semantics". Journal of Language Modelling. 6 (2): 225–260.
- ↑ Meyer, Francois; Lewis, Martha (2020-10-12). "Modelling Lexical Ambiguity with Density Matrices". arXiv:2010.05670 [cs.CL].
- ↑ Coecke, Bob; de Felice, Giovanni; Marsden, Dan; Toumi, Alexis (2018-11-08). "Towards Compositional Distributional Discourse Analysis". Electronic Proceedings in Theoretical Computer Science. 283: 1–12. arXiv:1811.03277. doi:10.4204/EPTCS.283.1. ISSN 2075-2180.
- ↑ Wijnholds, Gijs; Sadrzadeh, Mehrnoosh (2019). "A type-driven vector semantics for ellipsis with anaphora using lambek calculus with limited contraction". Journal of Logic, Language and Information. 28 (2): 331–358. arXiv:1905.01647. doi:10.1007/s10849-019-09293-4. S2CID 146120631.
- ↑ Bradley, Tai-Danae; Lewis, Martha; Master, Jade; Theilman, Brad (2018). "Translating and Evolving: Towards a Model of Language Change in DisCoCat". Electronic Proceedings in Theoretical Computer Science. 283: 50–61. arXiv:1811.11041. doi:10.4204/EPTCS.283.4. S2CID 53775637.
- ↑ Grefenstette, Edward; Sadrzadeh, Mehrnoosh (2011-06-20). "Experimental Support for a Categorical Compositional Distributional Model of Meaning". arXiv:1106.4058 [cs.CL].
- ↑ Kartsaklis, Dimitri; Sadrzadeh, Mehrnoosh (2013). "Prior disambiguation of word tensors for constructing sentence vectors".
{{cite journal}}
: Cite journal requires|journal=
(help) - ↑ Grefenstette, Edward; Dinu, Georgiana; Zhang, Yao-Zhong; Sadrzadeh, Mehrnoosh; Baroni, Marco (2013-01-30). "Multi-Step Regression Learning for Compositional Distributional Semantics". arXiv:1301.6939 [cs.CL].
- ↑ de Felice, Giovanni; Meichanetzidis, Konstantinos; Toumi, Alexis (2019). "Functorial Question Answering". Electronic Proceedings in Theoretical Computer Science. 323: 84–94. arXiv:1905.07408. doi:10.4204/EPTCS.323.6. S2CID 195874109.
- ↑ Tyrrell, Brian (2018-11-08). "Applying Distributional Compositional Categorical Models of Meaning to Language Translation". Electronic Proceedings in Theoretical Computer Science. 283: 28–49. arXiv:1811.03274. doi:10.4204/EPTCS.283.3. ISSN 2075-2180.
- ↑ Coecke, Bob; de Felice, Giovanni; Marsden, Dan; Toumi, Alexis (2018-11-08). "Towards Compositional Distributional Discourse Analysis". Electronic Proceedings in Theoretical Computer Science. 283: 1–12. arXiv:1811.03277. doi:10.4204/EPTCS.283.1. ISSN 2075-2180.