Advancing Class Diagram Extraction from Requirement Text: A Transformer-Based Approach (2023)

Abstract: The class diagram plays an important role in software development. As these diagrams are created using software requirement text, it helps to improve communication between the developers and the stakeholders. Thus, the automatic extraction of class diagrams enhances the speed of software development procedures. The research carried out in this direction mostly relies on rule-based methodologies and deep learning models. These methodologies have their drawbacks, such as the fact that large rulebased systems are complex to handle, whereas the word embeddings used in deep learning models are context-independent. Thus, the presented research work strives to extract the class diagram entities from the natural language text by employing a transformer-based model, as the embeddings generated by these models are context-dependent. The results have been compared with the existing procedure, and an ablation study has also been carried out to find out the relevance of each step in the extraction procedure. The analysis involved examining the true positive, false positive, and false negative rates for specific class diagram elements in separate case studies. As a result, an enhancement of 9–7% has been observed in the procedures used for extracting the resulting class diagrams.

## introduction the unified modeling language (uml) is a significant aspect of the software requirement specification document. these models are pivotal points for enhancing pertinent communication between software developers and customers. thus, the modeling ameliorates software requirements and expedites product development according to the requirements of customers. thus, the automated process of converting software requirement document text into unified modeling language (uml), such as class diagrams, speeds up the adaptation process of requirements according to discussions. the existing literature indicates that different automated methods were proposed for uml model extraction from the requirement text. these processes prominently rely on rule-based methodology @xcite , @xcite , and a limited number of them are utilizing neural network architectures @xcite . however, these existing methods utilize neural networks such as rnn and lstm, which again take input as word embedding generated through word2vec @xcite . the word2vec model does not consider contextual information and generates a single-word embedding for each word. consider an example of the word 'bank' that can have two different meanings based on context, such as 'riverbank' or 'bank-a financial institution'. however, a transformer-based model will utilise context-based word embedding, and in recent advancements, transformers show remarkable improvement in terms of accuracy and efficient reduction for the computational requirements @xcite , @xcite . therefore, it motivates us to assess the effectiveness of a transformer-based language model in extracting class diagrams from software functional requirements. in the proposed approach, we have employed the robustly optimized bert pretraining approach (roberta) @xcite for extraction of class diagram entities. the proposed approach has also been compared with existing approaches to evaluate the performance and effectiveness of the roberta model. ## related works the literature suggests that existing research has a predominant emphasis on heuristic rules for model extraction from textual requirements. neural network-based studies in this area are notably scarce. in this section, we present a concise overview, which is divided into two segments. the first segment is dedicated to the extraction procedures focused on heuristic rules, while the second part delves into neural network-based extraction approaches. the literature suggests that several works have been reported that have utilized extraction rules procedures for the extraction of class diagrams. researchers employed heuristic extraction rules for uml model entities @xcite , @xcite , and some used universal dependencies for the extraction of class diagrams from requirement text @xcite . in the existing work, the developed extraction rules were formulated based on the grammatical structure of the sentences (thakur and gupta, 2016), @xcite . in summary, the extraction procedure based on extraction rules has its pros and cons @xcite , @xcite . rules can be easily removed or added to a rule-based system, and it does not require a large amount of corpus. however, a rule-based system with a large number of rules is difficult to maintain @xcite . thus, some researchers also employed neural network architecture for the extraction of different models from requirement text, such as authors identifying component state transition diagrams from requirements using recurrent neural network (rnn) and long short-term memory (lstm) architecture. similar work is also carried out to automatically identify actors and actions in a system's requirements using neural networks @xcite . in @xcite , a self-trained named-entity recognition model is used with bidirectional lstms and cnns to extract the system states from requirements text. in @xcite , authors found that the neural network rnn with lstm and rnn with gru architectures provide good performance in the identification of model elements, but the results changed in different conditions. hence, we can conclude that the transformer-based approach has not been utilized and tested until now for the model extraction process from the requirement text. ## proposed methodology the proposed methodology can be divided into mainly two components, i.e., data preprocessing and training of the model, as shown in fig. 1 . ## results and discussions the aim of this section is to evaluate the proposed model using metrics such as precision, recall, and accuracy. each of these evaluation metrics is explained as follows: ## ablation study the ablation study has been performed to find out the importance of every step of the proposed methodology. the following subsections demonstrate the significance of each part of the methodology. ## conclusion in the current study, we proposed a new approach to automate the software design process through language model-based entity analysis for class diagram formation in an attempt to address the limitations of the existing approaches. transformerbased models are also able to consider the context of the words while extracting the class diagram elements and, hence, achieve better results for previously unseen statements. the tool, although quite effective, remains a tool and must be human-assisted to maintain integrity and avoid edge cases that may hamper the planning process. there may exist cases that hold very correlated information that may be hard to disassemble correctly by the transformer-based model. this remains a limitation of the approach, along with its extensive dependence on the trained dataset, with inaccuracies being noticeable in software specifications not previously seen by the model. in conclusion, our research presents a promising approach to automating the software design process, significantly reducing the cognitive load on software architects while improving the quality of software designs.