<!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>CiRA: A Tool for the Automatic Detection of Causal Relationships in Requirements Artifacts</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Jannik Fischbach</string-name>
          <email>jannik.fischbach@qualicen.de</email>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Julian Frattini</string-name>
          <email>julian.frattini@bth.se</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andreas Vogelsang</string-name>
          <email>vogelsang@cs.uni-koeln.de</email>
          <xref ref-type="aff" rid="aff1">1</xref>
          <xref ref-type="aff" rid="aff3">3</xref>
          <xref ref-type="aff" rid="aff4">4</xref>
        </contrib>
        <contrib contrib-type="editor">
          <string-name>Causality, Requirements Engineering, Tool Demo, Natural Language Processing</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Blekinge Institute of Technology</institution>
          ,
          <country country="SE">Sweden</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Proceedings of REFSQ-2021 Workshops, OpenRE</institution>
          ,
          <addr-line>Posters and Tools Track, and Doctoral Symposium, Essen</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Qualicen GmbH</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff3">
          <label>3</label>
          <institution>R. Guizzardi</institution>
          ,
          <addr-line>J. Guo, A. Herrmann, J. Horkof, P. Mennig, E. Paja, A. Perini, N. Seyf, A. Susi, A. Vogelsang (eds.): Joint</addr-line>
        </aff>
        <aff id="aff4">
          <label>4</label>
          <institution>University of Cologne</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2021</year>
      </pub-date>
      <abstract>
        <p>Requirements often specify the expected system behavior by using causal relations (e.g., If A, then B). Automatically extracting these relations supports, among others, two prominent RE use cases: automatic test case derivation and dependency detection between requirements. However, existing tools fail to extract causality from natural language with reasonable performance. In this paper, we present our tool CiRA (Causality detection in Requirements Artifacts), which represents a first step towards automatic causality extraction from requirements. We evaluate CiRA on a publicly available data set of 61 acceptance criteria (causal: 32; non-causal: 29) describing the functionality of the German Corona-Warn-App. We achieve a macro  1 score of 83 %, which corroborates the feasibility of our approach.</p>
      </abstract>
      <kwd-group>
        <kwd>Requirements Artifacts</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        Conditional clauses are prevalent for the specification of system behavior, e.g., “If the user
enters an incorrect password, an error message shall be displayed” (REQ 1). Such conditionals
are a widely used linguistic pattern in both traditional requirements documents [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] as well as
agile requirement artifacts, such as acceptance criteria [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Semantically, conditional clauses can
be understood as a causal relation between the antecedent (in case of REQ 1: incorrect password
is entered ) and the consequent (error message is displayed ). Understanding and extracting such
causal relations ofers great potential for Requirements Engineering (RE) as it supports among
others the following use cases [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]:
Vogelsang)
In: F.B. Aydemir, C. Gralha, S. Abualhaija, T. Breaux, M. Daneva, N. Ernst, A. Ferrari, X. Franch, S. Ghanavati, E. Groen,
determine the combinations of causes and efects that need to be covered by test cases [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]. This
is not only cumbersome but also becomes increasingly error-prone with growing requirements
complexity [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. We argue that causality extraction combined with existing automatic test case
derivation methods contributes to the alignment of RE and testing (e.g., by mapping the causal
relation to a Cause-Efect-Graph from which test cases can be derived automatically [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]).
      </p>
      <p>
        Use Case 2: Automatic Dependency Detection Between Requirements As modern
systems are becoming more and more complex, the number of requirements and their relations
is constantly increasing. Practitioners fail in keeping an overview of the relationships between
the requirements [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. This may lead to undetected redundancies and inconsistencies within the
requirements and consequently to faults in the system design [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. We argue that an automatic
causality extraction from requirements can help to compare the semantics by analyzing the
diferent embedded causal relations. As a result, relations between requirements can be identified
automatically (e.g., contradictory and redundant requirements).
      </p>
      <p>
        Existing approaches [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] fail to extract causality from NL with a performance that allows
for use in practice. Therefore, we argue for the need of a novel method for the extraction of
causality from requirements [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. We understand causality extraction as a two-step problem:
We first need to detect whether requirements contain causal relations. Second, if they contain
causal relations, we need to locate and extract them. In this paper, we present a demo of our
tool CiRA (Causality detection in Requirements Artifacts), which forms a first step towards
causality extraction from NL requirements [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In the remainder of this paper we provide an
overview1 of the functionality of CiRA (Section 2) and outline how we plan to conduct the
demo at the workshop (Section 3).
      </p>
    </sec>
    <sec id="sec-2">
      <title>2. The CiRA Approach</title>
      <p>
        CiRA has been trained to solve causality detection as a binary classification problem. Specifically,
CiRA is capable of classifying single sentences or even multiple concatenated sentences written
in unrestricted natural language into two categories: 1) the input contains a causal relation or
2) the input does not contain a causal relation. The classification is performed in four steps:
⃝ A Tokenization of the Text Input First, the text input must be decomposed into individual
tokens. Since we use the Bidirectional Encoder Representations from Transformers (BERT)
model [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] as the foundation for CiRA, the input must be brought to a fixed length (maximum
512 tokens). For sentences that are shorter than this fixed length, padding tokens (PAD)
are inserted to adjust all sentences to the same length. In addition to the PAD token, SEP
tokens are inserted as special separator tokens and the CLS (classification) token is inserted
as the first token in the input sequence. The CLS token represents the whole sentence (i.e.,
it is the pooled output of all tokens of a sentence). Our experiments [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] revealed that CiRA
performs best with a fixed length of 384 tokens.
⃝ B Enriching the Text Input with Syntactic Information In this step, we provide
knowledge about the grammatical structure of the sentence to the classifier. For this purpose, we
add the corresponding Dependency (DEP) tag to each token by using the spaCy NLP library.
Our experiments [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] demonstrated that adding the DEP tags leads to a performance gain
1In this paper, we only provide a high level overview of the architecture of CiRA. For a detailed description of
the training and tuning of our approach, please refer to our paper at the REFSQ Research Track [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]
      </p>
      <sec id="sec-2-1">
        <title>Acceptance Criterion</title>
        <p>The prompt no longer appears after the first
time the app is used.</p>
        <p>The terms of use can be displayed within the
app.</p>
        <p>The consent prompt is shown only the first
time a user launches the app.</p>
        <p>An explanation of the app’s various
functions will be provided.</p>
        <p>There is a “Publication information” item in
the menu.</p>
        <p>The IDs can be sent to the Warn server
pseudonymized.</p>
      </sec>
      <sec id="sec-2-2">
        <title>Causal</title>
        <p>(Support: 32)</p>
      </sec>
      <sec id="sec-2-3">
        <title>Non-causal</title>
        <p>(Support: 29)</p>
      </sec>
      <sec id="sec-2-4">
        <title>Accuracy</title>
        <p>(Support: 61)</p>
      </sec>
      <sec id="sec-2-5">
        <title>Precision</title>
      </sec>
      <sec id="sec-2-6">
        <title>Recall</title>
        <p>0.92
0.77
0.75
0.93
0.84</p>
        <p>Label
1
0
1
0
0
0
F1
0.83
0.84</p>
        <p>Home Demo
BERT Classi er: Demo</p>
        <p>ThisisademoofusingtheBERTClassi ertoidentifycausalandnon-causalsentences.</p>
        <p>Enter a sentence to analyze</p>
        <p>Classify
Ifthecontentisnotavailableinthedetectedsystemlanguage,Englishisselectedbydefault.</p>
        <p>Classi cation
causal</p>
        <p>Con dence
compared to adding Part-of-Speech (POS) tags to the text input or the usage of the vanilla
BERT model.
⃝ C Generate Sentence Embedding After the pre-processing, the tokens are fed into the BERT
model, which generates the corresponding embeddings. For our classification tasks, we are
mainly interested in the CLS token and its embedding. Since the CLS token represents the
whole sentence, the embedding created by BERT represents a sentence embedding that can
be easily used for classification.
⃝ D Softmax Classification Finally, the sentence embedding is fed into a single-layer feed
forward neural network that uses a softmax layer, which calculates the probability that a
sentence is causal or not.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Demo Plan</title>
      <p>Technical Setup &amp; User Interface During the workshop we will use our online demo of
CiRA (www.cira.bth.se\bert). The website is built as a restful node.js server utilizing the Express
framework. The backend’s main purpose is to execute a Python script, which acts as a wrapper
around the classifier: our pre-trained binary-file classifier is loaded, the sentence classified, and
the resulting classification alongside the classifier’s confidence returned. The UI provides a text
input field, where an arbitrary NL sentence can be entered (see top of Fig. 1). On pressing the
“classify”-button, the sentence is sent to the backend where it is processed by the aforementioned,
wrapped classifier. On return of the REST call, the classification and confidence of the model
are rendered in the UI. The user may confirm or correct the classifiers choice. The entered
sentence and the optional user confirmation or correction is then stored in the backend, in
order to (1) display the five most recently entered sentences (see bottom of Fig. 1), (2) provide
preliminary insight into the performance of the classifier on unseen sentences, and (3) preserve
sentences for future training of the classifier. Currently, we only support batch learning, but we
plan to implement an online learning algorithm in future research to leverage the collected data
directly for enhancing CiRA.</p>
      <p>Evaluation On Unseen Real World Data In the NLP4RE-workshop, we will demonstrate
that CiRA is suitable for practical use. For this purpose, we evaluate CiRA on unseen real
word data to simulate its application in the intended context. We use a publicly available data
set of acceptance criteria2 provided by SAP, which describe the functionality of the German
“Corona-Warn-App”. The data set consists of 32 user stories containing a total of 61 acceptance
criteria. In order to measure the performance of CiRA, we manually annotated all acceptance
criteria and classified them into two categories: causal (Label: 1) and non-causal (Label: 0). We
then classified each acceptance criterion using CiRA and compared the results with ground
truth (see Tab. 1). During the workshop, we will present both true and false predictions and
discuss the performance, challenges, and possibilities of CiRA with the other participants.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fischbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Frattini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Spaans</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Kummeth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Vogelsang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Mendez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Unterkalmsteiner</surname>
          </string-name>
          ,
          <article-title>Automatic detection of causality in requirement artifacts: the cira approach</article-title>
          , in: REFSQ,
          <year>2021</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fischbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Vogelsang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Spies</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Wehrle</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Junker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Freudenstein</surname>
          </string-name>
          ,
          <article-title>Specmate: Automated creation of test cases from acceptance criteria</article-title>
          ,
          <source>in: ICST</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fischbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Hauptmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Konwitschny</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Spies</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Vogelsang</surname>
          </string-name>
          ,
          <article-title>Towards causality extraction from requirements</article-title>
          , in: RE,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>V.</given-names>
            <surname>Garousi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Bauer</surname>
          </string-name>
          ,
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Felderer, NLP-assisted software testing: a systematic review</article-title>
          ,
          <source>CoRR</source>
          (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.</given-names>
            <surname>Fischbach</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Femmer</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Mendez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Fucci</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Vogelsang</surname>
          </string-name>
          ,
          <article-title>What makes agile test artifacts useful? an activity-based quality model from a practitioners' perspective</article-title>
          , in: ESEM,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>F.</given-names>
            <surname>Dalpiaz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Ferrari</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Franch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Palomares</surname>
          </string-name>
          ,
          <article-title>Natural language processing for requirements engineering: The best is yet to come</article-title>
          ,
          <source>IEEE Software 35</source>
          (
          <year>2018</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Vogelsang</surname>
          </string-name>
          ,
          <article-title>Feature dependencies in automotive software systems: Extent, awareness, and refactoring</article-title>
          ,
          <source>Journal of Systems and Software</source>
          <volume>160</volume>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>N.</given-names>
            <surname>Asghar</surname>
          </string-name>
          ,
          <article-title>Automatic extraction of causal relations from natural language texts: A comprehensive survey</article-title>
          ,
          <source>ArXiv abs/1605</source>
          .07895 (
          <year>2016</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>J.</given-names>
            <surname>Frattini</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Junker</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Unterkalmsteiner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Mendez</surname>
          </string-name>
          ,
          <article-title>Automatic extraction of causeefect-relations from requirements artifacts</article-title>
          ,
          <source>in: ASE</source>
          ,
          <year>2020</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>J.</given-names>
            <surname>Devlin</surname>
          </string-name>
          , M.-
          <string-name>
            <given-names>W.</given-names>
            <surname>Chang</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Lee</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Toutanova</surname>
          </string-name>
          , BERT:
          <article-title>Pre-training of deep bidirectional transformers for language understanding</article-title>
          ,
          <source>in: NAACL</source>
          ,
          <year>2019</year>
          .
          <article-title>2The data set can be found</article-title>
          at https://github.com/corona-warn-app/cwa-documentation/blob/master/scoping_ document.md.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>