Detection and analysis method of natural language requirements based on description template

Through the natural language demand detection and analysis method based on the description template, the elements and pattern structures in natural language requirements are extracted and analyzed, and the common fuzzy, inconsistency and incomplete problems in natural language requirements are solved, the accuracy and consistency of demand analysis are achieved, and work efficiency is improved.

CN114115810BActive Publication Date: 2025-04-29FUDAN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010868258.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-26
Publication Date
2025-04-29
Estimated Expiration
2040-08-26

AI Technical Summary

Technical Problem

Software requirements described in natural language often have vague, inconsistent and incomplete problems, which makes it difficult for analysts to ensure the accuracy, completeness and consistency of requirements in demand analysis.

Method used

The natural language demand detection and analysis method based on the description template is adopted, and the pattern structure of each element and element in the requirement description is extracted through conditional random field entity recognition and grammatical analysis, and the element mask of the main sentence and clause are formed, and the element mask of the preset reasonable conditions is compared to feedback the prompt information of unreasonable situations.

Benefits of technology

Effectively identify and correct unreasonable situations in natural language requirements, improve the accuracy and consistency of demand analysis, avoid ambiguity between analysts and developers, and improve work efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114115810B_ABST
    Figure CN114115810B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of semantic expression of natural language, and specifically relates to a technology for conformance detection of natural language requirements. Aiming at the natural language of requirements in the airborne field, a technology for conformance detection of natural language requirements is proposed, which includes two methods: a template conformance detection method and a collocation conformance detection method. Experiments show that this method can effectively discover most of the above-mentioned common requirement description defects by assisting in the detection of template conformance problems and element collocation rationality problems in natural language requirements. The above method can effectively locate potential defects in a large number of items in actual engineering requirements, thereby greatly reducing the reliance of such activities on manual subjective reading and review. At the same time, the results of running element extraction and conformance detection algorithms based on large-scale real project requirement cases also further verified the effectiveness of these two methods in real civil aircraft airworthiness conformity inspection scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a detection and analysis method of natural language requirements based on description templates, belongs to the field of semantic expression of natural language, and is used to assist analysts in checking and analyzing requirements described in natural language. Background Art

[0002] The flexibility of people in expressing in natural language often makes software requirements described in natural language vague, inconsistent, incomplete and other defects, which requires the requirements analysts to write system requirements according to certain templates, but in actual implementation, the requirements written by analysts often do not fully meet the requirements of the template. In this case, the method of design automation based on natural language processing technology came into being. This method is used to assist analysts in checking and analyzing the requirements described in natural language to ensure that their analysis results are correct.

[0003] Aiming at the typical defects commonly seen in the system requirement description process in the civil airborne field, the present invention designs an automated detection and analysis method of natural language requirements based on description templates based on the natural language requirement extraction method designed by us to detect and analyze the natural language requirements in the civil airborne field.

[0004] Typical defects in requirement descriptions include: accuracy issues due to lack of specificity and precision, completeness issues due to missing description elements, and consistency issues due to incorrect description categories.

[0005] For the problem of accuracy that is not specific and accurate, here is an example of a defective requirement: The RegulateTemperature Function shall set the value. This requirement correctly describes the operation object as the subject of the behavior, the operation as the behavior, and the operation attribute as the object of the behavior. However, due to the vague description of the operation attribute, the object of the Set operation cannot be clearly known through the operation attribute.

[0006] As for the problem of missing the completeness of description elements, an example of defective requirements is listed below: If the RegulatorInterface Failure, the Desired Range shall be set to UNSPECIFIED. The main clause of this requirement clearly assigns the operation, and the operation object and operation attributes are complete. However, the conditional clause only describes the condition association and condition object, and lacks condition judgment and possible condition attributes. The specific value of the condition object is "true" only when the writer defaults to not describing the specific value of the Boolean condition object (Regulator Interface Failure), otherwise the specific value of the condition object is "false", which makes it easy to cause misunderstanding and judgment when developing the requirement description.

[0007] For the consistency problem of describing category errors, an example of defective requirements is listed: If the RegulatorInterface Failure indicate 100, the Desired Range shall be set to UNSPECIFIED. Among them, the value space of the condition object Regulator Interface Failure is "true" and "false". When the value range of the condition object is Boolean, it is compared with the numeric condition attribute (100) in the condition, which actually causes a category mismatch problem. In actual civil aircraft engineering projects, this type of error is also a typical error. Mismatches exist not only between condition objects and condition attributes, but also between operation objects and operation attributes. In programming languages, this type of error can be discovered and prompted by compiler syntax checking, but currently it can only be discovered through traditional manual inspection methods in natural language requirement descriptions. Summary of the invention

[0008] In order to solve the above problems, a method for detecting and analyzing natural language requirements based on description templates is provided. The present invention adopts the following technical solutions: The present invention provides a method for detecting and analyzing natural language requirements based on description templates, which is used to extract multiple elements and the corresponding pattern structures of the elements for the description requirements of the natural language that do not meet the requirements of certain templates by analysts, wherein the elements in the main sentence include operation objects, Shall, operations and operation attributes, and in addition, the elements in the subordinate clause include conditional associations, conditional objects, judgments, conditional attributes and conditional combinations, and is characterized in that it includes the following steps: Step 1, extracting the various items in the requirement description entry according to the grammatical analysis based on conditional random field entity recognition and the element extraction algorithm of the grammatical analysis for the input description requirements that do not meet the template requirements Elements and the pattern structure of elements; step 2, according to the element extraction results of the main clause in the requirement description without conditional clauses, according to the values ​​of operation object, Shall, operation, and operation attributes, form the corresponding element mask of the main clause; step 3, according to the element extraction results of the conditional clause in the requirement description item, according to the values ​​of condition association, condition object, judgment, condition attribute, and condition combination, form the corresponding element mask of the conditional clause; step 4, according to the element mask of the preset reasonable condition, respectively compare it with the element mask of the main clause and the element mask of the clause, and according to the corresponding comparison results, respectively feedback the prompt information of the respective unreasonable situations; step 5, according to each requirement description item in the element model, check the condition object, operation object and whether it has appeared in the vocabulary, and feedback the prompt information according to the specific situation.

[0009] According to a detection and analysis method for natural language requirements based on description templates, it is characterized in that: wherein, in step 5, corresponding measures are taken for possible unreasonable situations when the check operation object is "FIGURE", "STRING" or "ENUM", specifically including the following sub-steps: step 5-1, when the check condition object and the operation object exist and the operation type is one of "FIGURE", "ENUM" and "STRING", check whether there is a condition attribute or operation attribute associated with it in the entry, and if not, feedback prompt information; step 5-2, after passing the check in step 5-1, when the operation object type is "ENUM", check whether the corresponding condition attribute or operation attribute is in the vocabulary Value domain of the object, and if not, feedback prompt information.

[0010] According to a detection and analysis method for natural language requirements based on a description template, it is characterized in that: an element mask is a feature code through a surrounding word pattern with the element.

[0011] Function and Effect of the Invention

[0012] According to a method for detecting and analyzing natural language requirements based on description templates provided by the present invention, since the input description requirements that do not meet the template requirements are processed to obtain the various elements and the pattern structure of the elements in the requirement description entry, corresponding element masks are formed according to the value conditions of the element extraction results in the main clause and the subordinate clause, and the element masks are respectively compared with the element masks of preset reasonable conditions to obtain corresponding comparison results, and prompt information of unreasonable situations is fed back according to the comparison results. According to a method for detecting and analyzing natural language requirements based on description templates provided by the present invention, it is possible to identify the description requirements of natural language that do not meet the requirements of certain templates by analysts and obtain prompt information of unreasonable situations, thereby avoiding ambiguity between analysts and developers on the description requirements due to the fact that the description requirements written by the analysis writer do not fully meet the requirements of the template, thereby avoiding unnecessary troubles and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 is a flow chart of a detection and analysis method of natural language requirements based on description templates in the present invention;

[0014] Figure 2 is the element mask of the main clause of the present invention;

[0015] Figure 3 is the element mask of the clause of the present invention;

[0016] Figure 4 It is a data set about the template conformity detection experiment in the present invention;

[0017] Figure 5 It is the data result of the template conformity detection experiment in the present invention;

[0018] Figure 6 is a data set for the collocation rationality detection experiment in the present invention; and

[0019] Figure 7 It is the data result of the collocation rationality detection experiment in the present invention. DETAILED DESCRIPTION

[0020] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the following is a specific description of a natural language demand detection and analysis method based on a description template of the present invention in combination with embodiments and drawings.

[0021] <Example>

[0022] Figure 1 It is a flowchart of the detection and analysis method of natural language requirements based on description templates in this embodiment.

[0023] like Figure 1 As shown, the input description requirement is checked for at least extracting a plurality of elements and the corresponding pattern structures of the elements.

[0024] Figure 2 is the element mask of the main clause of the present invention; Figure 3 is the element mask of the clause of the present invention.

[0025] This embodiment provides a detection and analysis method for natural language requirements based on description templates, which is used to extract multiple elements and the corresponding pattern structures of the elements from the description requirement text that does not conform to the requirements of a certain template by the analyst, and the description requirement text is composed of a main clause and a subordinate clause, wherein, for example Figure 2 As shown in , the elements in the element mask of the main clause include the operation object, Shall, operation, and operation attributes. Figure 3 As shown, the elements in the element mask of the clause include condition association, condition object, judgment, condition attribute and condition combination, and are characterized in that they specifically include steps 1 to 5.

[0026] Step 1: extract the elements and the pattern structure of the elements in the requirement description entry according to the syntax analysis based on conditional random field entity recognition and the element extraction algorithm of the syntax analysis for the input description requirement that does not meet the template requirement.

[0027] The element extraction algorithm is to convert vocabulary into word vectors through TransE, segment the target text through Jieba, compare the segmented words with the word vectors and identify the parts with entity meaning. The element extraction algorithm used in this embodiment is the NER algorithm. The element pattern structure is the arrangement rule followed by the elements.

[0028] Step 2: Based on the element extraction result of the main clause in the requirement description without the conditional clause, an element mask corresponding to the main clause is formed according to the value of the extracted elements.

[0029] Step 3: extract the elements of the conditional clause according to the requirement description items, and form the element mask corresponding to the conditional clause according to the values ​​of the extracted elements.

[0030] Step 4: Compare the element mask of the preset reasonable conditions with the element mask of the main clause and the element mask of the clause respectively, and feedback the prompt information of the respective unreasonable situations according to the corresponding comparison results.

[0031] Among them, unreasonable situations include the standard requirement that component A is more than 5 cm above component B, but the design draft has component B below component A. This design draft is not completely consistent with the standard requirement, which is an unreasonable situation. At this time, the prompt message is <Component A is more than 5 cm above component B>.

[0032] Step 5: Check the condition object, operation object and whether they have appeared in the vocabulary according to each requirement description item in the element model, and provide feedback information based on the specific situation.

[0033] Among them, in step 5, corresponding measures are taken for possible unreasonable situations when the inspection operation objects are "FIGURE", "STRING" and "ENUM", and the specific sub-steps are as follows:

[0034] Step 5-1, when checking that the condition object and the operation object exist and the operation object type is one of "FIGURE", "ENUM" and "STRING", check whether there is a condition attribute or operation attribute associated with the entry, and if not, feedback prompt information.

[0035] Step 5-2: After passing the check in step 5-1, when the operation object type is "ENUM", it is checked whether the corresponding condition attribute or operation attribute is in the vocabulary Value domain of the object, and if not, a prompt message is fed back.

[0036] For steps 1 to 4 in the above steps, the following template conformance detection experiment was conducted.

[0037] During the experiment, the specific steps S1-1 to S1-4 of the template conformity detection method are as follows:

[0038] Figure 4 It is a data set of the template conformity detection experiment in Example 1 of the present invention.

[0039] Step S1-1, such as Figure 4 As shown, Figure 4 It shows that the requirements of requirement sets 8 and 9 are recognized for entities using a conditional random field model trained based on case data in requirement sets 1, 2a, and 3a, and preprocessed with noun phrases and Be verb lines for replacement;

[0040] Step S1-2, extract the element models in sets 8 and 9 through the same syntax analysis procedure as Section 4.4;

[0041] Among them, the grammar analyzer is a traditional grammar analyzer, and its function is to mark out the language structures such as nouns, verbs, and predicates in natural language requirements.

[0042] Step S1-3, performing rationality analysis on the element models generated by requirement sets 4, 5 and 6 and the element models generated by requirement sets 8 and 9 in the RQ1 experiment.

[0043] Step S1-4, based on the analysis of the questions prompted in step S1-3, check the error prompts in the requirement sets 2b, 3b, 4, 5, and 6 and the correct prompts in the requirement sets 8 and 9.

[0044] Figure 5 It is the data result of the template conformity detection experiment in the present invention;

[0045] like Figure 5 As shown in Figure 1, by combing the template types and applying the templates to requirement sets 8 and 9, we verify whether the template elements are missing and verify the experimental results. From the experimental results, we can see that the template conformity detection method proposed in this paper can correctly detect most of the situations that do not conform to the template.

[0046] For step 1 and step 5 in the above steps, the following experiment on matching rationality detection was conducted.

[0047] During the experiment, the specific steps S2-1 to S2-3 of the template conformity detection experiment are as follows:

[0048] Figure 6 It is the data set of the collocation rationality detection experiment in the present invention.

[0049] Step S2-1, such as Figure 6 As shown, Figure 6 It shows that for requirement sets 4, 5 and 6, a total of 347 elements of four types, including numerical values, enumerations, characters and objects, were artificially generated.

[0050] Step S2-2, randomly select some requirements from requirement sets 4, 5, and 6 to form requirement set 10 as the experimental data of this experiment, check it according to the matching rationality method proposed in this paper, and use the inspection result as a reference item.

[0051] Step S2-3, select four types of vocabulary and randomly delete two items, check again according to the collocation rationality method in this article, compare the check results with the reference items, and analyze the problem items prompted by the two runs of the check program. By comparing the difference in the check results after deleting some vocabulary, it can be seen whether the current check results can effectively find the collocation of demand elements that are insufficiently defined or exceed the allowed range of the vocabulary.

[0052] Figure 7 This is the data result of the rationality detection experiment of Experimental Example 2 in the present invention.

[0053] like Figure 7 As shown, Figure 7 The experimental results of the collocation rationality detection method of this experiment are shown. From the experimental results, it can be seen that the collocation rationality detection method of this paper can find most of the missing definitions of requirement objects, attributes, condition objects, and condition attributes caused by undefined data types in the vocabulary.

[0054] Example Function and Effect

[0055] According to a method for detecting and analyzing natural language requirements based on description templates provided by the present invention, since the input description requirements that do not meet the template requirements are processed to obtain the various elements and the pattern structure of the elements in the requirement description entry, corresponding element masks are formed according to the value conditions of the element extraction results in the main clause and the subordinate clause, and the element masks are respectively compared with the element masks of preset reasonable conditions to obtain corresponding comparison results, and prompt information of unreasonable situations is fed back according to the comparison results. According to a method for detecting and analyzing natural language requirements based on description templates provided by the present invention, it is possible to identify the description requirements of natural language that do not meet the requirements of certain templates by analysts and obtain prompt information of unreasonable situations, thereby avoiding ambiguity between analysts and developers on the description requirements due to the fact that the description requirements written by the analysis writer do not fully meet the requirements of the template, thereby avoiding unnecessary troubles and improving work efficiency.

[0056] According to the detection and analysis method of natural language requirements based on description templates provided in this embodiment, this section summarizes the element templates for typical requirement descriptions. Experiments show that this method can effectively discover most of the above-mentioned common requirement description defects and effectively locate potential defects in a large number of items in actual engineering requirements by assisting the detection of template compliance issues and element matching rationality issues in natural language requirements, thereby greatly reducing the reliance of such activities on manual subjective reading and review. At the same time, the results of running element extraction and compliance detection algorithms based on large-scale real project requirement cases further verified the effectiveness of these two methods in real civil aircraft airworthiness compliance inspection scenarios.

[0057] The above embodiments are only used to illustrate the specific implementation of this embodiment, and the present invention is not limited to the description scope of the above embodiments.

[0058] In the above embodiment, when removing the elements of the main clause in the requirement description of the conditional clause and extracting the remaining elements, only the values ​​of the extracted elements such as operation object, Shall, operation, and operation attribute are considered and sampled. However, in actual implementation, not only the values ​​of the extracted elements such as operation object, Shall, operation, and operation attribute are sampled, but the element of operation limitation should also be within the scope of consideration for element sampling.

[0059] When the above embodiment extracts the elements of the conditional clause in the requirement description, it only considers sampling the value of the extracted elements such as condition association, condition object, judgment, condition attribute and condition combination. In actual implementation, not only the value of the extracted elements such as condition association, condition object, judgment, condition attribute and condition combination are sampled, but the element of condition limitation should also be within the scope of consideration of element sampling.

Claims

1. A detection and analysis method for natural language requirements based on description templates, which is used to extract at least multiple elements and the corresponding pattern structure of the elements from the description requirement text that does not meet the requirements of a certain template, where the elements include operation objects, Shall, operations, operation attributes, condition associations, condition objects, judgments, condition attributes, and condition combinations, and is characterized in that: The following steps are involved: Step 1, extracting the elements and the pattern structure of the elements in the requirement description items according to the syntax analysis based on conditional random field entity recognition and the element extraction algorithm of the syntax analysis for the input description requirements that do not meet the template requirements; Step 2: Based on the element extraction result of the main clause in the requirement description without the conditional clause, an element mask corresponding to the main clause is formed according to the values ​​of the operation object, Shall, operation, and operation attribute; Step 3, according to the element extraction result of the conditional clause in the requirement description item, according to the value of the extracted element, form the element mask corresponding to the conditional clause; Step 4, comparing the element mask of the preset reasonable condition with the element mask of the main clause and the element mask of the conditional clause, and feeding back prompt information of the respective unreasonable situations according to the corresponding comparison results; Step 5, according to each of the requirement description items in the element model, check the condition object, the operation object and whether they are in the Name field of the vocabulary, and feedback the prompt information according to the specific situation; Corresponding measures are taken for possible unreasonable situations when checking the operation objects as "FIGURE", "STRING", and "ENUM", specifically including the following sub-steps: Step 5-1, when checking that the condition object and the operation object exist and the operation object type is one of "FIGURE", "ENUM" and "STRING", check whether there is a condition attribute or operation attribute associated with the requirement description item, and if not, feedback prompt information; Step 5-2, after passing the check in step 5-1, when the operation object type is "ENUM", it is checked whether the corresponding condition attribute or operation attribute is in the vocabulary Value domain of the operation object, and if not, a prompt message is fed back.

2. The method for detecting and analyzing natural language requirements based on description templates according to claim 1, characterized in that: The element mask is a feature code obtained by including surrounding word patterns of the element.

Citation Information

Patent Citations

  • An e-commerce field oriented demand description model design method based on a knowledge graph

    CN109697050A

  • Method for generating and analyzing VRM formalized demand model

    CN111176614A