## 4 Case Study
### Structured Information Extraction Based on Prompt Engineering  
After completing data cleaning and annotation, to achieve the structured extraction of requirement information, this study designs dedicated prompts for the metro design domain in the 'Code for Design of Metro' (GB 50157-2013) based on the components included in the GPT-4 prompt template for information extraction described in Section 3.3, as shown in Figure 6. The design of this prompt encompasses all of the modules mentioned in Section 3.3, ensuring that the key elements of the requirement text can be effectively cap \begin{table}
\begin{tabular}{p{142.3 pt} p{142.3 pt}} \hline \hline
**Requirement Description** & **Requirement Category** \\ \hline The metro should set different levels of AFC systems according to construction and economic development conditions. The station control room shall be equipped with an emergency control button. The automatic fare collection system shall implement interfaces with related systems. The central line computer system shall receive and send ticket allocation information. The automatic fare collection system equipment shall be capable of continuous 24 h operation. & Design constraint \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Partial data from the ‘Code for Design of Metro’ dataset. tured during the information extraction process and, according to the information extraction template, converted into standardized structured data. In the specific implementation process, we input the data into the GPT-4 API in the format of \(\langle\)requirement description text, requirement category\(\rangle\) and guide GPT-4 to perform information extraction based on predefined prompts. In terms of model configuration, a lower temperature value makes the output more deterministic. To ensure higher accuracy and consistency, the temperature is set to 0.3 [46], and max-tokens is set to 300 based on the length of the input text. GPT-4 returns JSON-structured data according to the specified output format, where each data field corresponds to the information extraction template of different requirement categories to ensure the accuracy and consistency of the extracted information. To ensure that the model's output format strictly adheres to the predefined information extraction template and to minimize inconsistencies in knowledge graph construction caused by hallucinations, this study introduces an automatic format validation mechanism in the code implementation process. Specifically, after receiving the JSON structure generated using GPT-4, the code checks whether the output key names match the key information elements required in the information extraction template. If extra fields or format mismatches are detected, the data are re-input into GPT-4, requesting it to generate the output again until the output key names fully match. Additionally, if the generated data do not contain the \"subject\" field, the model is also instructed to regenerate the output. Table 6 presents the partial results of structured information extraction performed using GPT-4 under the guidance of prompts, where the example data are derived from the translated version of the original Chinese requirement text. With the assistance of prompt examples, GPT-4 can identify key information in the text based on the information extraction template. In some cases, it may also expand the content contextually to enhance the completeness and readability of the extracted results. For example, in Table 6, within the functional requirement description \"The semi-automatic ticket vending machine should have the following key functions: processing ticket refunds, ticket replacements, fare top  
Figure 6: Structure of SR information extraction task prompt template. ups, ticket validation, and ticket exchanges for passengers.\", when extracting information under the \"function\" category, GPT-4 automatically added \"for passengers\".