{'fraction_non_alphanumeric': 0.035502342529932326, 'fraction_numerical': 0.008953669963560645, 'mean_word_length': 5.00375, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 1, '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}}
NALABS: Detecting Bad Smells in Natural Language Requirements and Test Specifications

In large-scale embedded system development, requirement and test specifications are often expressed in natural language. In the context of developing such products, requirement review is performed in many cases manually using these specifications as a basis for quality assurance. Low-quality specifications can have expensive consequences during the requirement engineering process. Especially, if feedback loops during requirement engineering are long, leading to artifacts that are not easily maintainable, are hard to understand, and are inefficient to port to other system variants. We use the idea of smells to specifications expressed in natural language, defining a set of specifications for bad smells. We developed a tool called NALABS (NAtural LAnguage Bad Smells), available on https://github.com/eduardenoiu/NALABS and used for automatically checking specifications. We discuss some of the decisions made for its implementation, and future work.


I. INTRODUCTION
In many embedded system domains, requirement engineering is performed manually by engineers that are hand-crafting those artifacts using natural or semi-structured languages and using them for other stages of software development, such as testing them against the system-under-test. Issues in natural language artifacts (i.e., requirements), such as ambiguities or vague specifications, can lead to higher costs during system development [1]. Previous research found that test specifications written in natural language contain a rather high degree of cloning and bad structure [2], [3] which can influence the cost of maintaining and executing test cases. For requirements [4], [4], [5] as well as for system test cases [3] written in natural language, so called bad smells have been established as indicators to identify poorly written natural language artifacts.
Based on several natural language smells observed in previous studies, we established a set of indicators for requirement flaws and defined dictionary-based metrics to automatically detect these smells in natural language artifacts. This paper introduces NALABS, a new tool that aims at quick analysis of requirements by detecting problematic requirements.

II. RELATED WORK
Related to quality assurance of other natural language artifacts such as requirements, several researchers have focused on detection of clones [6], requirement similarity [7] and ambiguity [8]. Femmer et al. [4] proposed to detect issues based on requirement smells based on the quality attributes of natural language requirements in ISO/IEC/IEEE 29148. Hauptmann et al [3] is the first to study smells in natural language test specification. Hauptmann [9] proposed several natural language test smells to identify quality problems in test cases as well as showing the results of applying this approach on nine industrial test suites. We identified gaps in the previous research which we are tackling in this paper. Firstly, the set of smells for natural language artifacts used in some previous studies is limited and mainly based on maintainability attributes. We extend this list by tailoring requirement-based bad smells to other metrics related to complexity. In addition, only two studies apply their work on real industrial specifications. The aim of NALABS is to help in bringing more evidence on the industrial use of bad smells for detecting specification quality defects.

III. NATURAL LANGUAGE SPECIFICATIONS SMELLS
In this section, we describe the quality of natural language specifications, how we created the set of smells and the automatic measurement of these smells using specific dictionaries.
• Vagueness is a common problematic property when it comes to understanding requirements and requirement issues. Many papers are identifying this as an indicator of quality problems, but we have found definitions on how to measure it only in two papers [10], [11]. It is interesting that the suggested lists of keywords are completely different in these two papers. However, the list of keywords found in [11] was incomplete and only the definition found in [10] is used in NALABS. The following list of keywords has been used: may, could, has to, have to, might, will, should have + past participle, must have + past participle, all the other, all other, based on, some, appropriate, as a, as an, a minimum, up to, adequate, as applicable, be able to, be capable, but not limited to, capability of, capability to, effective, normal. • Referenceability. Number of reference documents [10] was found in a couple of papers under different names (i.e., Directive Frequency [11], Directives [12]). This is usually an indication of nesting in the requirements documents or a need for additional reading in order to understand the requirement that contains references. The issue on how to measure this indicator it is not well defined. In [10], [12] it was suggested to count the overall occurrence of keywords that would indicate referencing. In [11] the list of keywords was not provided, but the authors suggested that the rate of pointers to figures, tables, notes should be counted. We have decided to implement the measures from [10] and [12] as two separate measures (NR1 and NR2). The authors of [10] have anticipated the need of adjusting this measure for different writing styles of each company and therefore we have decided to expand the list of keywords by adding the keyword "see", since this is the most common writing style of referencing noticed in requirements documents in a large manufacturing company in Sweden. List of keywords (NR1 [10]): defined in reference, defined in the reference, specified in reference, specified in the reference, specified by reference, specified by the reference, see reference, see the reference, refer to reference, refer to the reference, further reference, follow reference, follow the reference, see document. List of keywords (NR2 [12]): For example, Figure, Table, Note. • Optionality. This metric was found in certain papers [13] and [11] with similar definitions. Optional words are giving the developers a latitude of interpretations to satisfy the specified statements and their use is usually not recommended in requirements documentation. Authors have proposed different lists of keywords, but the list found in [11] was incomplete and therefore we have decided to select the measure found in [12]. List of keywords: can, may, optionally. • Subjectivity. Subjectivity metric is measuring personal opinions or feelings in sentences. It was proposed in [11] with a list of keywords to be counted in text. However, since one of the proposed phrases to detect was "as [adjective] as possible", we have decided to avoid detection of adjectives in text, and replace this phrase and detect only the last part of this sentence. List of keywords: similar, better, similarly, worse, having in mind, take into account, take into consideration, as possible • Weakness [11] [12] is a metric that counts words and phrases that may introduce uncertainty into requirements statements by leaving room for multiple interpretations. The metric was found in two mentioned papers, but we have decided to use only the one found in [12], since the list of keywords found in [11] was very similar to the keywords used for the Optionality metric. List of keywords: adequate, as appropriate, be able to, be capable of, capability of, capability to, effective, as required, normal, provide for, timely, easy to. • Readability. Automated Readability Index (ARI) is calculated using W S + 9 × SW , where WS is the average number of words per sentence and SW is the average number of letters per word [11]. Readability is considered by a couple of other papers as well, mostly by the use of different readability indexes such as Flesch reading ease index, Flesch-Kincaid, Coleman-Liau and Bormuth grade level index. We have decided to use ARI for its simplicity of implementation. • Complexity Metrics. Measuring the size of the requirement was used in a couple of discovered papers and it is defined differently in different papers [10], [12]. It can be defined in many different ways such as the total number of characters, number of words, paragraphs and lines of text. We have decided to use the number of words as the measure of size to account for different writing styles. In addition, we count the overall number of occurrences of conjunctions. This measure was found to be a contextindependent measure and can show relations and actions.
IV. TOOL DESCRIPTION AND FUTURE WORK Figure 1 shows the use of NALABS from a GUI interface. Although NALABS is still in an early phase of development (it was started in the late 2019), it has already been used to successfully find several problems in requirements in existing industrial projects [14]. NALABS is released under the MIT open-source license, and it is freely accessible on GitHub 1 . It is a desktop WPF application that depends on standard .NET packages. The tool was developed in C# as a desktop application for Windows OS and contains three essential layers: (i) the pre-processing of requirement documents stored as excel spreadsheets 2 , (ii) the configuration and application of bad smells metrics and (iii) presenting these results to the user. Future research should focus on exploring and proposing new bad smells measures, combining the existing measures in a single index of quality and complexity as well as exploring new ways of applying such requirement checkers in industrial systems.