{'fraction_non_alphanumeric': 0.02875892684809882, 'fraction_numerical': 0.008183748311136847, 'mean_word_length': 4.669949660757277, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Ambiguity and Incomplete Information in Categorical Models of Language

We investigate notions of ambiguity and partial information in categorical distributional models of natural language. Probabilistic ambiguity has previously been studied using Selinger's CPM construction. This construction works well for models built upon vector spaces, as has been shown in quantum computational applications. Unfortunately, it doesn't seem to provide a satisfactory method for introducing mixing in other compact closed categories such as the category of sets and binary relations. We therefore lack a uniform strategy for extending a category to model imprecise linguistic information. In this work we adopt a different approach. We analyze different forms of ambiguous and incomplete information, both with and without quantitative probabilistic data. Each scheme then corresponds to a suitable enrichment of the category in which we model language. We view different monads as encapsulating the informational behaviour of interest, by analogy with their use in modelling side effects in computation. Previous results of Jacobs then allow us to systematically construct suitable bases for enrichment. We show that we can freely enrich arbitrary dagger compact closed categories in order to capture all the phenomena of interest, whilst retaining the important dagger compact closed structure. This allows us to construct a model with real convex combination of binary relations that makes non-trivial use of the scalars. Finally we relate our various different enrichments, showing that finite subconvex algebra enrichment covers all the effects under consideration.


Introduction
The categorical distributional approach to natural language processing [6] aims to construct the meaning of a sentence from its grammatical structure and the meanings of its parts. The grammatical structure of language can be described using pregroup grammars [20]. The distributional approach to natural language models the meanings of word as vectors of statistics in finite dimensional real vector spaces. Both the category of real vector spaces and linear maps, and pregroups are examples of monoidal categories in which objects have duals. This common structure is the key observation that allows us to functorially transfer grammatical structure to linear maps modelling meaning in a compositional manner.
Recent work in categorical models of language has investigated ambiguity, for example words with multiple meanings, [27,26,16]. These papers exploit analogies with quantum mechanics, using density matrices to model partial and ambiguous information. In order to do this, the category in which meanings are interpreted must change. Selinger's CPM construction [29] is exploited to construct compact closed categories in which ambiguity can be described. This construction takes a compact closed category C and produces a new compact closed category CPM(C ). When applied to the category of finite dimensional Hilbert spaces and linear maps, FdHilb, the resulting category CPM(FdHilb) is equivalent to the category of finite dimensional Hilbert spaces and completely positive maps. In this way the construction takes the setting for pure state quantum mechanics and produces exactly the right setting for mixed state quantum mechanics. It is therefore tempting to consider the CPM construction as a mixing device for compact closed categories. This perspective was adopted in [27] by starting with the category Rel of sets and binary relations and interpreting CPM(Rel) as a toy model of ambiguity. As argued in [24,9], there are aspects of CPM(Rel) that conflict with its interpretation as a setting for mixing. Specifically: • There are pure states that can be formed as a convex mixture of two mixed states • There are convex combinations of distinct pure states that give pure states It could be argued that this anomalous behaviour is due to the restricted nature of the scalars in Rel. This then points to another weakness of CPM(Rel) as a setting for ambiguity and mixing. We may wish to say that the word bank is 90% likely to mean a financial institution and 10% likely to refer to the boundary of a river. We can express this in CPM(FdHilb) as the scalars are sufficiently rich. In CPM(Rel) the best we can do is say that it's either one or the other, with all the quantitative information being lost.
In this paper we investigate some alternative models of ambiguity in the compact closed setting. We consider a variety of different interpretations of what it might mean to have ambiguous or limited information, and how these can be described mathematically. Specifically: • In section 4 we describe constructions that model ambiguous and incomplete information in a nonquantitative manner. We show that compact closed categories can be freely extended so as to allow the modelling of incomplete information, ambiguity and a mixture of both phenomena.
• In section 5 we extend our constructions to describe quantitative ambiguous and incomplete information. Again we show that compact closed categories can be freely extended in order to model such features.
• Proposition 5.10 shows that these various informational notions embed into each other.
Our general perspective is to enrich the homsets of our categories in order to model the language features we are interested in. In order to do this systematically, we exploit some basic monad theory. Monads are commonly used to describe computational effects such as non-determinism, exceptions and continuations [25,31]. In our case we instead view them as models of informational effects in natural language applications. Monads have previously been used in models of natural language, see for example [30]. Work of Jacobs [11] provides the connection between a certain class of monads and categories that provide good bases for enriched category theory. We aim to give explicit constructions of the categories of concrete interest throughout, rather than pursuing a policy of maximum abstraction. Our systematic approach means we should be able to incorporate additional informational features in a similar manner. We assume familiarity with elementary category theory, and the notions of compact closed and dagger compact closed categories [1].

Monads
We will now outline the necessary background on monads required in later sections, and introduce the monads that will be of particular interest. The material in this section is standard, good sources for further background are [22,2,4,2,14]. In this paper we will only be interested in monads on the category Set of sets and total functions, although we will state some definitions more generally where it is cleaner to do so.
We now introduce the monads of interest in this paper, and relate them to computational behaviour. Similarly to [28], we emphasize that monads are induced by algebraic operations modelling computational, or in our case informational, behaviour. • The unit and multiplication are given componentwise by: The lift monad is commonly used to describe computations that can diverge.  (1) The unit and multiplication are given componentwise by: where δ x is the Dirac delta function and supp(e) is the support of e. The finite subdistribution monad (S, η, µ) has identical structure, except that we weaken the condition in equation (1) to: So our finite distributions are now sub-normalized rather than normalized to 1. Both the finite distribution and subdistribution monads are used to model probabilistic computations. Intuitively the subdistribution monad provides scope for diverging behaviour in the "missing" probability mass.
Remark 2.5. We adopt a convenient notational convention from [13] and write finite distributions as formal sums ∑ i p i |x i , where we abuse the physicists ket notation to indicate the sum is a formal construction. Using this notation, the unit of the (sub)distribution monad is the map x → |x and multiplication is given by expanding out sums of sums in the usual manner.
Each monad can be canonically related to a certain category of algebras. Definition 2.6 (Eilenberg-Moore Algebras). Let (T, η, µ) be a monad on C . An Eilenberg-Moore algebra [7] for T consists of an object A and a morphism a : TA → A satisfying the following axioms: The category of Eilenberg-Moore algebras and their homomorphisms will be denoted EM(T ). Example 2.7. For the monads under consideration we note that: • The Eilenberg-Moore category of the lift monad is equivalent to the category of pointed sets and functions that preserve the distinguished element, denoted Set • .
• The Eilenberg-Moore category of the finite powerset monad is equivalent to the category of join semilattices and homomorphisms, denoted JSLat.
• The Eilenberg-Moore category of the non-empty finite powerset monad is equivalent to the category of affine join semilattices and homomorphisms, denoted AJSLat.
• The Eilenberg-Moore category of the finite distribution monad is the category of convex algebras and functions commuting with forming convex combinations, denoted Convex. This category has received a great deal of attention in for example [12,15,8].
• The Eilenberg-Moore category of the finite subdistribution monad is the category of subconvex algebras, that is algebras that can form subconvex combinations of elements in a coherent manner. The morphisms are functions that commute with forming subconvex combinations. We denote this category Subconvex. We consider commutative monads on the category Set, and specialize their definition appropriately. Definition 2.8 (Commutative Monad). Let (T, η, µ) be a Set monad. There are a canonical strength and costrength natural transformations: The monad is said to be a commutative monad [19] if the following equation holds for all X ,Y : This composite is then called the double strength, denoted dst. Remark 2.9. Monads are intimately related to the topic of universal algebra. The Eilenberg-Moore algebras for a Set monad can be presented by operations and equations, if we permit infinitary operations. All the monads in this paper are in fact finitary monads, meaning they can presented by operations of finite arity. Let φ and ψ be operations of arities m and n respectively. These operations are said to commute with each other if the following equation holds: If we unravel the definition of commutative monad, it says that all the operations in a presentation commute with each other. We can also phrase this as every operation being a homomorphism. More detailed discussion of connections to universal algebra and presentations can be found in [23]. Remark 2.11. It is interesting that all the notions of partial information and ambiguity considered in this paper give rise to commutative monads. Possibly we could regard this as showing these informational effects are independent of the order in which they are built up?
Clearly many monads are not commutative: The list monad has a functor component that sends a set to finite lists of its elements. The unit maps an element to the corresponding single element list and the multiplication concatenates lists of lists. The Eilenberg-Moore algebras of this monad are arbitrary, not necessarily commutative, monoids. Unsurprisingly, this monad is not commutative.
The following proposition captures the essential properties of Eilenberg-Moore categories of commutative monads that we will need, all in one place. The key symmetric monoidal closed structure is due to work of Jacobs [11], the other properties are well known. Proposition 2.13. Let (T, η, µ) be a commutative monad on Set. The category EM(T ): • Is a symmetric monoidal closed category.
• Has universal bimorphisms for the monoidal tensor.
• The tensor product µ X ⊗ µ Y is isomorphic to µ X×Y .
• Is complete.
Proof. Completeness and cocompleteness of categories that are monadic over Set is standard. The category Set is a SMCC via its products and exponentials. Set is complete so we can use [11, lemma 5.3].
The additional properties of the monoidal structure come from [11, lemmas 5.1,5.2].
Remark 2.14. We avoid technical discussion of universal bimorphisms, details can be found in [18,11]. The essential idea is to generalize the universal property of the tensor product of vector spaces, and their relationship to bilinear functions. So in the set theoretic case, homomorphisms out of our tensors will bijectively correspond to functions out of the cartesian product that are homomorphisms in each component separately.

Enriched Categories
An enriched category is a category in which the homsets have additional structure that interacts well with composition. • As a trivial example, ordinary locally small categories are Set-enriched.
• A category is poset enriched if it's homsets have a poset structure and composition in monotone with respect to that structure. For example the category Rel is poset enriched.
• In the categorical quantum mechanics community, a category is said to have a superposition rule [10], or be a process theory with sums [5], if its homsets carry commutative monoid structure that is suitably compatible with composition (and possibly additional structure).
We have insufficient space for a detailed outline of the parts of enriched category theory we require, we refer the reader to [17,4] for background. The informal discussion above should hopefully be sufficient to understand the discussions in later sections.
The idea of this paper is that complete and cocomplete categories with symmetric monoidal closed structure provide a very good base of enrichment for enriched category theory. If we select a commutative monad that captures the linguistic feature we are interested in, we can then consider categories enriched in the corresponding algebraic structure.
The universal bimorphism property of the monoidal structure of Eilenberg-Moore categories of commutative monads allows us provide concrete conditions for enrichment in our categories of interest:

Proposition 3.2. A category C :
• Is Set • -enriched if its homsets have pointed set structures such that: • Is AJSLat-enriched if its homsets have affine join semilattice structures such that: • Is JSLat-enriched if its homsets have join semilattice lattice structures such that both the equations of (2) and (3) hold.
• Is Convex-enriched if its homsets have convex algebra structures such that: • Is Subconvex-enriched if its homsets have subconvex algebra structures such that the equations (4) hold for all subconvex combinations.
For a given cocomplete symmetric monoidal closed category V , we can form the free V -enriched category over an ordinary category. This construction will be exploited in the later sections, details can be found in [17,4].

Unquantified Mixing
We begin by considering probably the simplest case, in which we have incomplete information. For example, I simply don't know the meaning of the word "logolepsy". In order to model this, we enrich our category in pointed sets, with the distinguished element denoting missing information.  If C is a compact closed category then C ⊥ is a compact closed category. The monoidal structure on morphisms extends that in C as in (5).
There is an identity and surjective on objects strict monoidal embedding C → C ⊥ . If C is a dagger compact closed category then C ⊥ is a dagger compact closed category with the dagger extending that of C as in (6).
Proof. We sketch the basic ideas. We must check that the extended definitions of the monoidal product and if necessary the dagger are functorial. We then wish to inherit the associator, left and right unitor and symmetry from the base. In order to do so we must check they remain natural with respect to the extended functor actions on morphisms. Cups and caps and other structure and axioms are then broadly speaking inherited from C .
Although C ⊥ gives a new compact closed category, it is not particularly exciting. As soon as we compose or tensor with a ⊥ element, the whole term becomes ⊥. This is consistent with the intuition that if we have no idea about part of the information we require, we cannot know the whole either.
We took the opportunity to sketch the proof that C ⊥ is compact closed as it is easiest to follow in this simple case. Later proofs of similar claims are analogous. Remark 4.4. Although we have inherited some good properties from the base category in the construction 4.1, clearly not everything can be preserved. We are expanding the morphisms between each pair of objects, for example in Rel ⊥ we now have three scalars, which we can interpret as true, false and unknown. This expansion will interfere with (co)limits from the base category. For example if we have a zero object in C , that object will no longer be a zero object in C ⊥ as there will be 2 morphisms of type 0 → 0.
Noting the similarity with the behaviour of the ⊥ elements with that of zero morphisms in categories with zero objects, we note that:

Lemma 4.5. Every category with a zero object is Set • -enriched.
Although the lift monad and Set • -enrichment are extremely straightforward, we shall return to them later, in interaction with different types of ambiguity.
If the previous model captured incomplete information, we now move to consider ambiguity. In this case we intend situations where several things are possible, for example a bat is either a winged mammal or sporting equipment. In particular, unlike the previous model, we have complete information about the available possibilities, we are simply unaware of which one applies. If we don't have any sense of the relative likelihoods of the possibilities, we are just left with a non empty finite set of alternatives, and this points us in the direction of the monad P + ω . Definition 4.6. For category C we define the category C P + ω as having: • Objects: The same objects as C • Morphisms: We define C P + ω (A, B) = P + ω (C (A, B)) We define composition as follows: Identities are then given by the singletons containing the identities from C .

Proposition 4.7.
For a category C , C P + ω is the free affine join semilattice enriched category over C . Theorem 4.8. If C is a compact closed category then C P + ω is a compact closed category. The action of the tensor on morphisms extends that of C as in (7).
There is an identity and surjective on objects strict monoidal embedding C → C P + ω . If C is a dagger compact closed category then C P + ω is a dagger compact closed category with the dagger extending that of C as in (8).
As a final possibility, what if we wish to consider both ambiguous and incomplete information? It is then natural to consider the finite powerset monad as the source of our enrichment. The definition is almost identical to that of C P + ω : Definition 4.9. For category C we define the category C P ω as having: • Objects: The same objects as C • Morphisms: We define C P ω (A, B) = P ω (C (A, B)) We define composition as follows: Identities are then given by the singletons containing the identities from C . Proposition 4.10. For a category C , C P ω is the free join semilattice enriched category over C . Theorem 4.11. If C is a compact closed category then C P ω is a compact closed category. The action of the tensor on morphisms extends that of C as in (9).
There is an identity and surjective on objects strict monoidal embedding C → C P ω .
If C is a dagger compact closed category then C P ω is a dagger compact closed category with the dagger extending that of C as in (10). Definition 4.12. We consider two sub-classes of monad: • A monad is said to be affine [21,11] if the component of its unit at the terminal object is an isomorphism.
• A monad is said to be relevant [11] if dst •δ = T δ Techniques for extracting the affine and relevant parts of a commutative monad can be found in [11]. Remark 4.13. Again we can think about the notion of affine monad in terms of presentations, as we did with commutativity. An operation is said to be idempotent if: An algebraic theory is affine if all its operations are idempotent. In particular this means the theory can have no constants or non-trivial unary operations. It makes intuitive sense that descriptions of ambiguity should lead to affine algebraic theories. We cannot just conjure up elements out of thin air, and being confused between x and x should provide the same information as knowing x directly.
We now note a fundamental relationship between the three monads considered in this section. Remark 4.14. As observed in [11], P + ω and the lift monad are the affine and relevant parts of the finite powerset monad. In fact the finite powerset monad can be constructed from the non-empty finite powerset monad and the lift monad using a distributive law [3], and so in a mathematical sense it is precisely the description of incomplete information combined with non-quantitative ambiguity. A similar pattern will be repeated in the next section.

Quantified Mixing
We now move to the setting that has typically been considered in categorical models of mixing and ambiguity until now, probabilistic mixtures. Here we return to the situation where our state of knowledge is for example that the word "bank" suggests with 90% confidence a financial bank and 10% confidence a river bank. We now have quantitative information, and it should be possible to encode this information in our homsets. Composition is given as follows: Theorem 5.4. If C is a compact closed category then C D is a compact closed category. The action of the monoidal structure on morphisms extends that of C as in (11).
There is an identity and surjective on objects strict monoidal embedding C → C D . If C is a dagger compact closed category then C D is a dagger compact closed category with the dagger extending that of C as in (12). Proposition 5.5. For the finite subdistribution monad we have 1 : • The finite distribution monad is the affine part of the subdistribution monad.
• The lift monad is the relevant part of the subdistribution monad.
• The finite subdistribution monad can be constructed using a distributive law combining the finite distribution monad and the lift monad.
Remark 5.6. As we saw for unquantified ambiguity, quantified ambiguity is affine, so forming combinations is idempotent. Intuitively, quantified confusion between x and itself is the same as knowing x.
Similarly to the unquantified case, we see that the subdistribution monad is exactly the result of combining quantified ambiguity and incomplete information.
Definition 5.7. For category C we define the category C S as having: • Objects: The same objects as C Composition is given as follows: Proposition 5.8. For category C , C S is the free subconvex algebra enriched category over C .
Theorem 5.9. If C is a compact closed category then C S is a compact closed category. The action of the monoidal structure on morphisms extends that of C as in (13).
There is an identity and surjective on objects strict monoidal embedding C → C D . If C is a dagger compact closed category then C S is a dagger compact closed category with the dagger extending that of C as in (14).
The various free models of ambiguity and incomplete information that we have constructed can be embedded into each other as follows: Proposition 5.10. For category C there are identity and surjective on objects embeddings: where: 0 denotes the empty formal sum. Proposition 5.10 shows that C P ω allows us to model non-quantitative ambiguity and partial information. Analogously, the category C S allows the description of quantitative incomplete and ambiguous information. It seems natural to try and describe non-quantitative ambiguity using convex mixtures by restricting attention to uniform distributions. As such, one might expect vertical arrows in diagram (5.10) with embeddings C P + ω → C D and C P ω → C S . This turns out not to be functorial, essentially as a result of: Counterexample 5.11. Uniform distributions are not closed under composition in the free Convex or Subconvex enrichments. For uniform mixture e = 0.5| f + 0.5| f • f , e • e is not in general a uniform mixture once we collect terms.
It seems the best we can do is to observe that unquantified phenomena give general Convex-enriched and Subconvex-enriched categories, beyond the free ones: Theorem 5.12. For every category C , C P + ω is Convex-enriched, and C P ω is Subconvex-enriched. In both cases sums are given by supports: Proof. We must confirm that taking supports gives Convex-algebra or Subconvex-algebra structure as required. It then remains to confirm the equations specified in proposition 3.2 hold. Both are straightforward calculations.
Using the embeddings of proposition 5.10 and the general enrichments noted in theorem 5.12, all the phenomena of interest are captured in some way by Subconvex-enrichment.

Conclusion
In this paper we have considered freely extending the dagger compact closed categories used in categorical distributional models of meaning with sufficient algebraic structure to describe incomplete and ambiguous information. This was done in a systematic manner, constructing suitable bases for enrichment using monad theoretic principles. Our free models effectively record and combine the details of the information we lack. The data explicitly carried by this effectively syntactic construction suggests some algorithmic possibilities to be explored in later work.
Clearly, models other than the free models are of interest. For example, the category of Hilbert spaces and completely positive maps is subconvex algebra enriched, and Rel is join semilattice enriched. The category Rel Subconvex provides a category that allows non trivial mixing of relations with scalars in [0, 1]. The author is unaware of other (non-free) models involving relations that allow non-trivial mixing with real scalars, and this remains an open question.