Introduction
Transforming natural language software requirements into formal, executable specifications is a cornerstone of automated software engineering. However, this process—known as requirements elicitation—is fraught with ambiguity. A single sentence in a requirements document can often be interpreted in multiple ways. This paper presents a probabilistic framework that addresses this challenge by treating requirements documents as coherent discourses rather than isolated sentences. By leveraging a Hidden Markov Model (HMM), the system uses global context to resolve local ambiguities.
The Challenge of Requirements Elicitation
Stakeholders typically describe desired system behaviors in natural language. For example, a requirement like "The user clicks the button" might refer to several different buttons or actions depending on the system's state. Traditional semantic parsers often analyze sentences in a vacuum, leading to interpretations that may be syntactically valid but logically inconsistent with the rest of the document. The authors argue that requirements are logically linked within a shared System Model (SM), and this global context should guide the interpretation of individual sentences.
A Discourse-Aware Probabilistic Model
The proposed method integrates sentence-level grammar with discourse-level logic using a generative probabilistic model.
- Sentence-Level Emissions: A Probabilistic Context-Free Grammar (PCFG) generates candidate parses for each sentence. Each parse is mapped to a "semantic snapshot"—a fragment of a Live Sequence Chart (LSC) representing a specific behavior.
- Discourse-Level Transitions: The document is modeled as an HMM where states represent System Model snapshots. Transitions between states represent the logical flow or "gap" between requirements. The authors explored various transition functions, including Max-Overlap (favoring continuity of entities) and Max-Expansion (favoring the introduction of new information).
- Global Decoding: Using the Viterbi algorithm, the system identifies the sequence of parses across the entire document that maximizes joint probability. This allows the interpretation of one sentence to be informed by those that precede and follow it.
Experimental Setup
The model was evaluated using a "seed" dataset comprising four requirements-specification case studies: Phone, WristWatch, Chess, and Baby Monitor. Due to the limited size of this gold-standard data, the authors supplemented it with a synthetic dataset of 10,000 examples to help the model learn basic linguistic structures.
Results and Discussion
The discourse-based approach significantly outperformed baseline sentence-based models (where $N=1$). In the Phone dataset, the exact match (EM) rate for the system model jumped from 14.29% for the top individual parse to 57.14% when considering discourse context ($N=128$).
Key findings include:
- Contextual Disambiguation: The HMM effectively captures the consistency of the "conceptual world." If a "button" is established early on, subsequent actions are correctly associated with it.
- Balanced Transitions: The most effective models balanced the principles of overlap and expansion, reflecting how humans naturally communicate requirements.
- Executable Output: Unlike standard machine translation, this model produces formal LSC structures that can be directly executed or simulated.
Conclusion and Future Work
While the current study uses a controlled fragment of English, it demonstrates the power of discourse context in semantic parsing. Future work aims to expand the linguistic scope to less restricted natural language and improve the handling of complex discourse phenomena like anaphora. By moving beyond sentence-level analysis, this framework brings us closer to fully automated, context-aware requirements engineering.
Summary updated