<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Quantum Logic and Natural Language Processing</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>National Research University Higher School of Economics, School of Data Analysis and Artificial Intelligence</institution>
          ,
          <addr-line>125319, 3 Kochnovskiy Proezd, Moscow</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The paper presents a short summary on the applications of the quantum logic categorical constructions to the natural language processing. We give a brief overview on the topic of quantum logic in general, and in natural language processing, in particular. As a result, we discuss comparison of sentences and their representation in quantum logic formalism. The examples of using quantum diagrams are considered in order to understand text analysis in terms of quantum logic techniques.</p>
      </abstract>
      <kwd-group>
        <kwd>Natural Language Processing</kwd>
        <kwd>Compositional Distributional Model of Meaning</kwd>
        <kwd>Quantum Logic</kwd>
        <kwd>Similarity Measures</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>The main goal of our work is to provide an overview on combining words and
grammar in the natural language processing using quantum logic categorical
methods.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], the authors created a new model of categorical formalism inspired by
the quantum teleportation protocol. In terms of quantum information,
quantum teleportation is a way of sharing information between processes. In [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], a
framework of diagrammatic calculus was proposed for reasoning on quantum
information processes. The main proposed advantage of the model is that it
takes into account grammatical structure of a sentence as well as meanings of
individual words.
We consider the natural language processing problem of forming the meaning of
a sentence from the meanings of its parts. There are two core approaches to this
issue: distributional models and formal semantics.
      </p>
      <p>The former one does not take into account the interaction between
syntactically linked words and is based only on the meaning of words, from which the
sentence was composed. The word meaning is usually represented as vector,
calculated from the context, in which this word occurs. One word is considered to
be in context of another word, if it is in the n-word window of this word in the
text. For instance, in the sentence ’The cat ate the mouse’ words ’the’ and ’ate’
are in window of size one of the word ’cat’. The sentence meaning can be then
determined as certain simple functions like addition or element-wise
multiplication of vectors of constituting words. The main drawback of this method is its
non-compositional nature. For example, the sentences ’The cat ate the mouse’
and ’The mouse ate the cat’ will have the same meanings in such type of models.</p>
      <p>
        The latter one, in opposite, is concerned only with syntax. The meaning of a
sentence is represented as a function derived from the grammatical structure of
the sentence. The major aim of this approach is to represent natural language
sentences as logical expressions. For this reason, the only thing we can say about
the meaning of a sentence, is its truth or falsity. Thus, formal semantics deal with
qualitative scale, and we cannot numerically estimate similarity of meaning of
two sentences. In [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] the authors draw an analogy between quantum teleportation
and natural language processing problem and apply diagrammatic calculus to
grammatical structure of sentences.
      </p>
      <p>
        Each of the two approaches has its own shortcomings, which are more or less
solved in the other one. In [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], Coecke, Sadrzadeh and Clark presented so-called
compositional distributional model unifying these two approaches of sentence
representation. They described grammar structure of sentence using algebra of
pregroups as a type-categorial logic, assigned di↵ erent representations to words
with di↵ erent types, and took tensor product and inner product as operations
that ”glue” parts of a sentence together.
3
      </p>
    </sec>
    <sec id="sec-2">
      <title>Similarity Analysis</title>
      <p>One of the main applications of sentence representation models is to compute
how close are the meanings of two given sentences. If a model can define, which
sentences are similar and which are not, then we could apply this model for
paraphrasing problem and improving search engines answers to queries taking
into account answers for similar queries. We can also use similarity analysis as a
model indicator: if model correctly determine meaning of any sentence, then it
can identify which of them are close.</p>
      <p>
        In [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the authors gave the examples how to compare meanings of sentences
using the model from [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. Here, we present a short description of their method.
      </p>
      <p>In distributional models all meanings of words are represented as vectors,
that is why we cannot apply the verb to its subject and object. In order for the
model to take it into account, all words are divided into atomic type and
compound functional type. Nouns have atomic type, and verbs, adjective phrases,
prepositional phrases, adverbs have compound types.</p>
      <p>
        The authors of [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] consider the vector space N, and the bases of N are
annotated with ’properties’ obtained by combining dependency relations with nouns,
verbs and adjectives.
      </p>
      <p>Nouns are assigned to vectors with elements equal to the number of times
they have been in relations with the bases in the corpus of text.</p>
      <p>Verbs are assigned with matrices in the following way: element i, j is equal
to the number of times a noun with property i has been subject of the verb, and
a noun with property j has been object of the verb in the corpus of text. In a
similar way they define vectors for other syntax types.</p>
      <p>For example, basis vectors might be associated with properties such as
’arghungry’, denoting the argument of the adjective ’hungry’, ’subj-eat’ denoting
the subject of the verb ’eat’, ’arg-tasty’ denoting the argument of the adjective
’tasty’. If a noun has occurred as an argument of ’hungry’ 5 times, a subject of
’eat’ 6 times and argument of ’tasty’ 4 times, its vector is (5, 6, 4). If there are
5 occasions when something hungry buys something tasty, the value in the cell
(1, 3) of the ’buy’ matrix is 5.</p>
      <p>Using the described algorithm one can compute the inner product and cosine
similarity of two sentences. The main feature of this methodology consists of
its ability to compare sentences with di↵ erent grammatical structure due to
reduction of sentences to one type.</p>
      <p>Let us consider some simple text as an example how to get representations
of nouns and verbs:
’Hungry predators eat tasty victims. Fast predators like tasty food. Small
victims like tasty food. Big predator frighten tasty victims. Small victims
don’t like big predators. Fast predators eat fast victims. Hungry victims
eat tasty food. Hungry predators frighten big victims. Small predators
eat hungry victims.’
Let the bases are ’arg-big’, ’arg-small’, ’arg-tasty’, ’arg-hungry’, ’arg-fast’. The
vector for the noun ’predator’ is (2, 1, 0, 2, 3), the vector for the noun ’victim’ is
(1, 2, 2, 2, 1). The matrix representation for the verb ’eat’ with respect to a given
text corpus:
2 0 0 0 0 03
6 0 0 0 1 07
66 0 0 0 0 077
64 0 0 2 0 075</p>
      <p>0 0 0 0 1</p>
      <p>In large text datasets, these matrices are not so sparse. Let us manually
define example of non-trivial distribution for nouns and matrix for ’eat’:
Predators Victims Wolves Rabbits</p>
      <p>Cij</p>
      <p>Big Small Tasty Hungry Fast
Big
Small
Tasty
Hungry</p>
      <p>Fast</p>
      <p>With the help of these representations we can compare meanings of the two
sentences:
hS1 | S2i = hpredators eat victims | wolves eat rabbitsi =
= X {hpredators | nii · Ciejat · hnj | victimsi⇥
ij</p>
      <p>⇥ h wolves | nii · Ciejat · hnj | rabbitsi } = 148470, (1)
where ni are standard basis vectors with ni[j] = 1 if j = i and 0, otherwise.</p>
      <p>Normalising it by the product of the lengths of both sentence vectors leads
us to the cosine similarity value
q
hS1 | S2i</p>
      <p>q
hS1 | S1i · hS2 | S2i
= 0.958,
which is close to 1 and, thus, our sentences have close meanings.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Quantum Logic in Diagrams</title>
      <p>In the proposed compositional distributional model the meaning of a sentence is
obtained by applying some function of the tensor products of the words’ meaning
vectors. This function is a morphism corresponding to the grammatical structure
of the sentence in the category of finite dimensional vector spaces of meanings.
Basically it is a linear map of sentence’s structure and words’ meanings to the
meaning of the sentence.</p>
      <p>
        Such a linear map for the grammatical type reduction can be represented as
a diagram. For example, lets look at the examples presented in [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. The sentence
Mary likes words can be represented along with grammatical types of the words
as the following diagram:
The following pregroup type reduction corresponds to the diagram above:
n 1 · n · s · n 1 · n 6 1 · s · 1 6 s.
      </p>
      <p>The idea behind the usage of diagrams is that we treat quantum logic as a
theory of types of systems, processes and their interactions, and all the
properties are also specified in terms of processes and their compositions. The types of
systems are the objects in consideration, e.g. words in a sentence. Processes are
morphisms of types, such as compound types and type reduction. And
composition of morphisms form sequential application on processes. Then the
diagrammatic calculus framework can be applied to reason on information processes.</p>
    </sec>
    <sec id="sec-4">
      <title>Evaluation on NLP Problems</title>
      <p>
        The abstract categorical model of Coecke et al.[
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] was implemented by authors of
[
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. It was evaluated on a word disambiguation task for transitive and intransitive
sentences against a benchmark dataset provided by Mitchell and Lapata (2008).
For both tasks datasets with potentially ambiguous verbs were provided in [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. In
these datasets, every verb is given with a context of potentially disambiguating
nouns, subject nouns for intransitive verbs and pairs of subject and object nouns
for transitive verbs. The task was to compose given verbs with corresponding
nouns and evaluate similarity of di↵ erent meanings of the verb.
      </p>
      <p>The authors showed that on the task with intransitive verbs the categorical
method performs on par with the other approaches. The other approaches are
addition an multiplicative models, which basically are applications of meaning
vectors addition and multiplication, correspondingly. There are still doubts on
the small size of the context to be fully representative, however, considering more
complex grammatical structure showed better performance in comparison to the
other models.
6</p>
    </sec>
    <sec id="sec-5">
      <title>Discussion</title>
      <p>There are several directions of quantum logic study in NLP area. We aim to
compare the diagrammatic reasoning versus semantic modelling.</p>
      <p>
        We first plan to implement the model and run it on available corpus data
in order to evaluate performance of the model and indicate possible complexity
issues for further optimisation. As authors of [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] pointed out, a straightforward
implementation of the model leads to e ciency issues that should be taken into
consideration, investigated and dealt with optimisation techniques.
      </p>
      <p>
        We would also try to extend the notion of the sentence meaning to a
definition of the paragraph meaning. On can use the concept of syntactic thickets
described, for example, in [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] for determination of paragraph grammar structure.
One could think about considering further applications on identifying nonsense
[
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] or ambiguous [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ] sentences. Another direction will be study of the
theoretical foundations of computational complexity in terms of significant complexity
constraints on Lambek Calculus as one of the important grammar extensions for
NLP [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ].
      </p>
      <p>Acknowledgements. The work is supported by the Russian Science
Foundation under grant 17-11-01294 and performed at National Research University
Higher School of Economics, Russia.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Coecke</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Grefenstette</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pulman</surname>
            ,
            <given-names>S.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadrzadeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>A quantum teleportation inspired algorithm produces sentence meaning from word meaning and grammatical structure</article-title>
          .
          <source>CoRR abs/1305</source>
          .0556.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Abramsky</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Coecke</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          (
          <year>2004</year>
          )
          <article-title>A categorical semantics of quantum protocols</article-title>
          .
          <source>In: Proceedings of 19th IEEE conference on Logic in Computer Science</source>
          , IEEE Press, pp.
          <fpage>415425</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Coecke</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadrzadeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          (
          <year>2010</year>
          ).
          <article-title>Mathematical foundations for a compositional distributional model of meaning</article-title>
          .
          <source>arXiv preprint arXiv:1003</source>
          .
          <fpage>4394</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Grefenstette</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sadrzadeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Clark</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Coecke</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pulman</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          (
          <year>2014</year>
          ).
          <article-title>Concrete sentence spaces for compositional distributional models of meaning</article-title>
          . In Computing meaning, Springer Netherlands, pp.
          <fpage>71</fpage>
          -
          <lpage>86</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Grefenstette</surname>
            ,
            <given-names>E</given-names>
          </string-name>
          ,.
          <string-name>
            <surname>Sadrzadeh</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2011</year>
          ).
          <article-title>Experimental Support for a Categorical Compositional Distributional Model of Meaning</article-title>
          .
          <source>Proceedings of the 2011 Conference on Empirical Methods in Natural Language Processing</source>
          , pp.
          <fpage>13941404</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6. Mitchell, J.,
          <string-name>
            <surname>Lapata</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          (
          <year>2008</year>
          ).
          <article-title>Vector-based models of semantic composition</article-title>
          .
          <source>Proceedings of the 46th Annual Meeting of the Association for Computational Linguistics</source>
          , pp.
          <fpage>236244</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Zeng</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Coecke</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <source>Quantum Algorithms for Compositional Natural Language Processing. Workshop on Semantic Spaces at the Intersection of NLP, Physics and Cognitive Science (SLPCS16) EPTCS 221</source>
          ,
          <year>2016</year>
          , pp.
          <fpage>6775</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Galitsky</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ilvovsky</surname>
            ,
            <given-names>D.I.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuznetsov</surname>
            ,
            <given-names>S.O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Strok</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          (
          <year>2013</year>
          ).
          <article-title>Matching sets of parse trees for answering multi-sentence questions</article-title>
          .
          <source>In RANLP</source>
          , pp.
          <fpage>285</fpage>
          -
          <lpage>293</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Kanovich</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kuznetsov</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Scedrov</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>Undecidability of the Lambek Calculus with a Relevant Modality</article-title>
          .
          <source>FG</source>
          <year>2016</year>
          , pp.
          <fpage>240</fpage>
          -
          <lpage>256</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Ferguson</surname>
            ,
            <given-names>T.M.</given-names>
          </string-name>
          (
          <year>2015</year>
          ).
          <article-title>Logics of nonsense and Parry systems</article-title>
          .
          <source>Journal of Philosophical Logic</source>
          , vol.
          <volume>44</volume>
          (
          <issue>1</issue>
          ), Springer Netherlands, pp.
          <fpage>65</fpage>
          -
          <lpage>80</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <surname>Wurm</surname>
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Lichte</surname>
            <given-names>T.</given-names>
          </string-name>
          (
          <year>2016</year>
          ).
          <article-title>The Proper Treatment of Linguistic Ambiguity in Ordinary Algebra</article-title>
          . In: Foret A.,
          <string-name>
            <surname>Morrill</surname>
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Muskens</surname>
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Osswald</surname>
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Pogodalla</surname>
            <given-names>S</given-names>
          </string-name>
          . (eds)
          <article-title>Formal Grammar</article-title>
          .
          <source>FG</source>
          <year>2016</year>
          ,
          <source>FG 2015. Lecture Notes in Computer Science</source>
          , vol
          <volume>9804</volume>
          . Springer, Berlin, Heidelberg, pp.
          <fpage>306</fpage>
          -
          <lpage>322</lpage>
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>