Project demand analysis specification generation method based on natural language processing
By fine-tuning the pre-trained language model and BIO annotation system, combined with the validation rule base and template engine, the problem of insufficient accuracy in requirement parsing in existing technologies has been solved, and efficient and standardized requirement document generation has been achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA CONSTRUCTION BANK
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-10
AI Technical Summary
Existing requirements analysis methods that directly use general NLP models for sequence labeling fail to adapt and fine-tune to the business requirements corpus, resulting in insufficient accuracy in identifying key elements and an inability to handle the contextual relationships of multi-dimensional requirements elements, thus affecting the standardization of requirements documents and the reliability of project execution.
A finely tuned pre-trained language model is used for semantic understanding and information extraction to generate a tag sequence containing requirement elements. The BIO annotation system is used for accurate boundary identification, and automated verification is performed based on a preset verification rule base. A template engine is used to generate a requirement analysis specification that conforms to the specifications.
It significantly improves the accuracy and efficiency of requirements analysis, reduces manual intervention and error rate, and realizes intelligent parsing of unstructured natural language requirements and automatic completion of key elements, generating structured requirements documents that meet industry standards.
Smart Images

Figure CN121835638A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, and in particular to a method for generating project requirements analysis specifications based on natural language processing. Background Technology
[0002] Requirements analysis, a core component of software engineering, is widely used in project initiation and requirements definition phases. Among related technologies, an automated requirements analysis solution has been built through the collaborative work of natural language processing, structured data modeling, and collaborative editing techniques. Specifically, this technology system covers the entire process from requirements gathering to document generation, including key steps such as text preprocessing, semantic parsing, feature annotation, rule validation, version control, and template rendering. Among these, the semantic parsing technology based on a pre-trained language model utilizes formulas... Modeling contextual relationships enables the mapping from unstructured text to structured tag sequences. However, existing requirement parsing methods directly use general NLP models for sequence labeling without domain-adaptive fine-tuning for business requirement corpora. This may lead to insufficient accuracy in identifying key elements or an inability to handle the contextual relationships of multi-dimensional requirement elements, thus affecting the standardization of requirement documents and the reliability of project execution. Furthermore, while traditional collaborative editing tools have basic version management functions, they lack refined difference marking and semantic version control mechanisms based on the Myers difference algorithm, making it difficult to meet the needs of visual traceability of requirement changes in complex projects. Especially in areas such as acceptance standard templates and quantitative verification of non-functional requirements, existing technologies typically rely on manual experience, resulting in systemic defects such as high missing element rates and frequent priority misjudgments. This leads to significant fluctuations in requirement document quality, resulting in serious consequences such as increased project rework rates and extended delivery cycles. Summary of the Invention
[0003] The present invention aims to at least partially solve one of the technical problems in the related art.
[0004] Therefore, the first objective of this invention is to propose a method for generating project requirements analysis specifications based on natural language processing.
[0005] Another objective of this invention is to provide a device for generating project requirements analysis specifications based on natural language processing.
[0006] The third objective of this invention is to provide a computer device.
[0007] The fourth objective of this invention is to provide a non-transitory computer-readable storage medium.
[0008] To achieve the above objectives, a first aspect of the present invention proposes a method for generating project requirements analysis specifications based on natural language processing, comprising: S1, Obtain the unstructured natural language requirement text input by the business party; S2, using the fine-tuned pre-trained language model to perform semantic understanding and information extraction on the requirement text, generating a tag sequence containing requirement elements; S3, Based on a preset verification rule base, automatically verify the tag sequence and generate a verification report containing error level, problem description and modification suggestions; S4. Based on the modification suggestions in the verification report and the preset acceptance standard template library, intelligently complete the missing or non-compliant requirement elements to generate structured requirement data. S5 inputs structured requirement data into a pre-set standard document template, and the template engine automatically populates and generates a requirement analysis specification that conforms to the specifications.
[0009] In one embodiment of the present invention, S2 includes: S21, input the preprocessed text sequence into the fine-tuned GPT model, and use the formula...
[0010] Modeling contextual relationships, where The output tag sequence includes B-Requirement, I-Requirement, B-Actor, B-Action, and B-Condition types; S22 uses the BIO annotation system to accurately identify the boundaries of demand elements, ensuring the contextual relevance of adjacent terms in the tag sequence.
[0011] In one embodiment of the present invention, S3 includes: S31, use a demand priority mapping table to map keywords in the text to fixed priority levels; S32, a condition-outcome template is used to verify the acceptance criteria. The template format is: When When this happens, the system should perform the action. and output the results. Its performance indicators Error does not exceed the threshold .
[0012] In one embodiment of the present invention, S4 includes: S41, for the missing acceptance criteria item, match the most similar condition-result template from the template library and fill in the placeholder; S42 performs threshold verification on non-functional requirement indicators and generates completion suggestions that meet the preset range.
[0013] In one embodiment of the present invention, S5 includes: S51 uses the Apache FreeMarker template engine to bind structured data to variables in `.ftl` template files; S52 uses the Aspose.Words format conversion library to convert the rendered template file into Word format, and uses the iText library to generate the final PDF document.
[0014] To achieve the above objectives, a second aspect of the present invention provides an apparatus for generating project requirements analysis specifications based on natural language processing, comprising: The requirement text acquisition module is used to acquire unstructured natural language requirement text input by the business party; The semantic understanding and information extraction module is used to perform semantic understanding and information extraction on the requirement text using a fine-tuned pre-trained language model, and generate a tag sequence containing requirement elements. An automated verification module is used to automatically verify the tag sequence based on a preset verification rule base and generate a verification report that includes error level, problem description and modification suggestions. The intelligent completion module is used to intelligently complete missing or non-compliant requirement elements based on the modification suggestions in the verification report and the preset acceptance standard template library, and generate structured requirement data. The document generation module is used to input structured requirement data into a pre-set standard document template, and automatically fill in and generate a requirement analysis specification that conforms to the specifications through the template engine.
[0015] The present invention discloses a method and apparatus for generating project requirements analysis specifications based on natural language processing, which can realize intelligent parsing of unstructured natural language requirements and automatic completion of key elements, significantly improving the efficiency and standardization of requirements analysis, and reducing manual intervention and error rate.
[0016] To achieve the above objectives, a third aspect of this application provides a computer device comprising a processor and a memory; wherein the processor runs a program corresponding to the executable program code stored in the memory, for implementing a method for generating a project requirements analysis specification based on natural language processing as described in the first aspect embodiment.
[0017] To achieve the above objectives, a fourth aspect of this application provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for generating a project requirements analysis specification based on natural language processing as described in the first aspect embodiment.
[0018] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0019] Figure 1 This is a flowchart of a method for generating a project requirements analysis specification based on natural language processing according to an embodiment of the present invention; Figure 2 This is a structural diagram of a project requirements analysis specification generation device based on natural language processing according to an embodiment of the present invention; Figure 3 It is a computer device according to an embodiment of the present invention. Detailed Implementation
[0020] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other. The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0021] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0022] The following description, with reference to the accompanying drawings, illustrates a method and apparatus for generating project requirements analysis specifications based on natural language processing, according to an embodiment of the present invention.
[0023] Example 1 Figure 1 This is a flowchart of a method for generating a project requirements analysis specification based on natural language processing according to an embodiment of the present invention, such as... Figure 1 As shown, it includes: S1: Obtain the unstructured natural language requirement text input by the business party.
[0024] Specifically, the process involves acquiring unstructured natural language requirement text input from business stakeholders, based on a multimodal input interface and text preprocessing mechanism. This step aims to provide high-quality raw corpus input for subsequent structured parsing and key element identification. The business requirement input unit supports three main input methods: text input box, file upload (supporting Word, Excel, PDF, and other formats), and voice input. The text input box uses the UTF-8 encoding standard and supports a maximum character length of 10,000 bytes to accommodate medium-sized requirement descriptions. The file upload module integrates parsing libraries such as PDFBox and Apache POI to achieve full-text extraction and format conversion of unstructured documents. Voice input uses an ASR (Automatic Speech Recognition) interface to convert audio signals into text, achieving an accuracy rate of over 95% in standard corpus testing.
[0025] Furthermore, this step incorporates a text normalization process in its technical implementation, including word segmentation, stop word removal, punctuation standardization, and case unification. In the Chinese context, word segmentation algorithms based on Jieba or HanLP are used, achieving part-of-speech tagging accuracy of over 92%; for the English context, spaCy or NLTK is used for lexical analysis. The preprocessed text sequence is then uniformly encoded into a token sequence, which is input into the subsequent structured parsing unit for semantic modeling and information extraction.
[0026] Furthermore, this step is widely applicable in practical applications to business scenarios such as software development, product design, and system integration. Especially in cross-departmental collaborations, business stakeholders can express their needs using natural language without needing a technical background, and the system automatically completes the initial structured processing. Its technical value lies in providing a standardized and processable input foundation for the entire requirements analysis process, which is a prerequisite for achieving automated requirements analysis and document generation.
[0027] S2, using the fine-tuned pre-trained language model to perform semantic understanding and information extraction on the requirement text, generating a tag sequence containing requirement elements.
[0028] Specifically, this step uses a fine-tuned pre-trained language model to perform semantic understanding and information extraction on the requirement text, generating a tag sequence containing requirement elements. This process leverages the contextual modeling capabilities of the GPT model, combined with a task-specific tagging system, to achieve structured parsing of unstructured natural language.
[0029] Furthermore, the requirement text undergoes preprocessing, including word segmentation, stop word removal, and punctuation normalization, to improve the semantic clarity of the model input. Subsequently, the text sequence is fed into the fine-tuned GPT model. Based on the original pre-training, this model undergoes supervised fine-tuning to optimize parameters for the requirement element identification task. Internally, the model employs a Transformer architecture, using a multi-head self-attention mechanism to capture the dependencies between words in the text, thereby identifying key elements such as functional requirements, non-functional requirements, participants, actions, and conditions. The model output is a sequence of labels, where each label corresponds to the semantic role of a word or phrase in the text, such as (B-Requirement, I-Requirement, B-Actor, B-Action, B-Condition, O), etc.
[0030] Furthermore, the model's label prediction process can be formally represented as:
[0031] in, This represents the output label sequence. Given a sequence of text as input, This means that, given the preceding label and the input sequence, the current word is predicted to be the label. The probability of [the entity recognition]. The model's label set needs to be defined according to actual needs, and usually includes entity recognition labels (B-, I- prefixes) and irrelevant labels (O).
[0032] Furthermore, this step is widely applicable to scenarios such as software project management, product requirement document (PRD) generation, and business process modeling. In actual deployment, the system can receive text, voice, or file input from business stakeholders, automatically identify and label key requirement elements through the model, and provide a foundation for subsequent structured data organization and validation.
[0033] Furthermore, this step enables intelligent conversion from natural language to structured tag sequences, significantly improving the automation and accuracy of requirements analysis. Through tag sequence generation, the system can transform vague requirements descriptions into operable and verifiable data structures, laying a solid foundation for subsequent verification, collaborative editing, and document generation.
[0034] Furthermore, S2 includes: S21, input the preprocessed text sequence into the fine-tuned GPT model, and use the formula...
[0035] Modeling contextual relationships, where This represents the output tag sequence, including B-Requirement, I-Requirement, B-Actor, B-Action, and B-Condition types.
[0036] Specifically, inputting the preprocessed text sequence into the fine-tuned GPT model is the core step in transforming unstructured requirement text into structured data. This step, based on the GPT model's self-attention mechanism and Transformer architecture, uses context-aware sequence labeling to identify and extract key elements from the requirement text, such as functional requirements, non-functional requirements, participants, actions, and conditions.
[0037] Furthermore, the GPT model used in this invention is a finely tuned version based on the HuggingFaceTransformers framework. Its input is a standardized text sequence, including operations such as tokenization, stop word removal, and punctuation normalization. The length of the input sequence is typically controlled within 512 tokens to ensure efficient inference under reasonable computing resources. The model output is a sequence of labels. Each of the tags The corresponding input sequence in the first Each token, with a tag set including (but not limited to) B-Requirement, I-Requirement, B-Actor, B-Action, B-Condition, O, etc., is used to represent the start and continuation of different semantic categories.
[0038] This process can be formally represented as:
[0039] in, This represents the input text sequence. Indicates before Given a set of labels and an input sequence, the current token is predicted to be a label. The model is trained using Maximum Likelihood Estimation (MLE), with the optimization objective being to maximize the joint probability of the label sequences.
[0040] Furthermore, this step is applicable to the initial requirements gathering phase of software projects, especially when business stakeholders submit a large number of unstructured requirements documents or meeting minutes. The system can automatically identify and annotate key requirement elements, providing a data foundation for subsequent structured organization and validation. Through this step, the system achieves semantic mapping from natural language to structured tag sequences, laying a crucial foundation for the automated generation of requirements specifications. Its technical value lies in significantly improving the accuracy and efficiency of requirements parsing, reducing reliance on human experience, and providing standardized data input for subsequent validation and version management.
[0041] S22 uses the BIO annotation system to accurately identify the boundaries of demand elements, ensuring the contextual relevance of adjacent terms in the tag sequence.
[0042] Specifically, the BIO annotation system is used to accurately identify the boundaries of requirement elements. Its core objective is to use sequence labeling technology to precisely define the boundaries and assign labels to requirement elements (such as functional requirements, non-functional requirements, participants, and actions) in unstructured text, thereby providing a foundation for subsequent structured data organization and verification. The BIO annotation system consists of three types of labels: "Begin" (B), "Inside" (I), and "Outside" (O). The B label identifies the starting word of a certain type of element, the I label identifies the continuing word of that type of element, and the O label represents a common word that does not belong to any element. For example, when identifying "user" and "system" in the sentence "When a user logs into the system, the system should verify the username and password," they can be labeled as B-Actor and I-System respectively, thus clarifying their boundaries and semantic roles.
[0043] Furthermore, the technical implementation of this step is based on a fine-tuned GPT model, whose input is a text sequence that has undergone word segmentation and normalization, and whose output is a sequence of labels corresponding one-to-one with the input terms. The model uses conditional probability. Proceed step by step to predict the label for each word, where This represents the input text sequence. Indicates the preceding The label context of each word. During the training phase, the model uses the cross-entropy loss function. Optimize the labeled data to ensure the coherence of the label sequence and the consistency of the context.
[0044] Furthermore, the model typically uses the maximum sequence length. Tag set size (Including B-Requirement, I-Requirement, B-Actor, I-Actor, B-Action, I-Action, B-Condition, I-Condition, B-NonFunctional, O, etc.), and using the Adam optimizer, learning rate Batch size Number of training rounds Furthermore, to improve the accuracy of boundary recognition, the model can be combined with a CRF (Conditional Random Field) layer for post-processing to optimize the global consistency of the label sequence.
[0045] Furthermore, this step is widely applied in scenarios such as software project requirements analysis, product requirement document (PRD) generation, and system design specifications, and is particularly suitable for handling requirement documents with multiple iterations and multi-party participation. Through precise boundary identification, the system can effectively distinguish the start and continuation of different requirement elements, avoiding semantic ambiguity caused by misaligned labels, thereby improving the accuracy and completeness of structured data. Furthermore, this step provides high-quality input data for subsequent verification and version management, and is a key link in achieving full automation and intelligence in the requirements analysis process.
[0046] S3. Based on a preset verification rule base, the tag sequence is automatically verified to generate a verification report containing error level, problem description and modification suggestions.
[0047] Specifically, in some implementations, the key element verification unit automatically verifies the tag sequence output by the structured parsing unit using a built-in, extensible verification rule library. This verification process, based on a predefined rule set, compares each key requirement element in the structured data item by item, identifies missing items or non-compliant entries, and generates a verification report containing the error level, problem description, and modification suggestions. The verification logic employs a combination of rule matching and pattern recognition to ensure the comprehensiveness and accuracy of the verification.
[0048] Furthermore, the validation rule base includes, but is not limited to, a requirement priority mapping table, a general template library for acceptance criteria, and threshold values for non-functional requirement indicators. For example, the requirement priority mapping table maps keywords in text (such as "must," "should," "hope") to fixed priority levels (P0, P1, P2), and its mapping relationship can be configured according to industry standards or internal company specifications. In the acceptance criterion template library, the formal description of condition-result templates is: when... At that time, the system should and output ,That Error not exceeding Non-functional requirements metrics include response time ( ), concurrent users ( System availability These thresholds can be set according to standards such as ISO / IEC 25010 or ITIL.
[0049] Furthermore, this verification unit is widely applicable to the requirements analysis phase of software projects, especially in scenarios where multiple business stakeholders collaboratively submit requirements and requirements change frequently. The system can automatically identify key fields such as "acceptance criteria" and "non-functional requirements" that are not labeled in the tag sequence, and generate completion suggestions based on the template library to help users quickly make corrections.
[0050] Furthermore, this step significantly improves the standardization and completeness of requirements analysis, reduces the workload of manual verification, and helps users prioritize critical issues through error level classification (such as warnings and errors), thereby improving the overall quality and delivery efficiency of requirements documents.
[0051] Furthermore, S3 includes: S31 uses a priority mapping table to map keywords in the text to fixed priority levels.
[0052] Specifically, in some implementations, the requirement priority mapping table in the key element verification unit uses natural language processing technology to map keywords in the text (such as "must," "should," "hope") to fixed priority levels (such as P0, P1, P2). This step, based on semantic recognition and rule matching mechanisms, combined with contextual semantic analysis, achieves automatic grading of requirement intensity. In the specific implementation, the system first traverses the tag sequence output by the structured parsing unit to identify keywords related to requirement intensity. These keywords typically appear in the context of "condition" or "action" tags, such as "must support user login" or "should respond to requests within 3 seconds."
[0053] Furthermore, the system matches the identified keywords with their corresponding priority levels using a pre-defined mapping rule table. For example, "must" is mapped to P0 (highest priority), "should" to P1 (medium priority), and "hope" to P2 (lowest priority). This mapping relationship is configurable and allows users to customize and extend it according to project specifications. In practical applications, this step is typically deployed at the front end of the requirements validation process to quickly identify and label the priority of requirements, providing data support for subsequent resource allocation and development scheduling.
[0054] Furthermore, the keyword library of this mapping table should cover at least 50 common demand-intensity words and support fuzzy matching and context-sensitive recognition to improve recognition accuracy. In implementation, TF-IDF or word vectors (such as Word2Vec and BERT) can be used for contextual semantic enhancement to ensure that "must" is correctly recognized in different contexts. In addition, the system should support a visual display of the mapping results for easy user verification and correction.
[0055] Furthermore, this step is of significant value in project requirements analysis systems, not only improving the standardization and readability of requirements documents, but also providing basic data for automated scheduling and prioritization, thereby enhancing the intelligence level of the entire requirements management process.
[0056] S4. Based on the modification suggestions in the verification report and the preset acceptance standard template library, intelligently complete the missing or non-compliant requirement elements to generate structured requirement data.
[0057] Specifically, in some implementations, based on the modification suggestions in the verification report and the preset acceptance standard template library, the missing or non-compliant requirement elements are intelligently completed. The core of this step is to use the semantic matching mechanism between the structured verification results and the preset templates to automatically identify and supplement the elements in the requirement document that are not fully expressed or do not conform to the specifications, thereby improving the completeness and standardization of the requirement data.
[0058] Furthermore, the system first parses the missing or non-compliant items identified in the verification report, such as undefined acceptance criteria or vague non-functional requirement descriptions. Then, the system calls a pre-defined acceptance criterion template library, which contains various standardized template structures, such as condition-result templates, whose formal description is: when... At that time, the system should and output ,That Error not exceeding The system uses semantic matching algorithms (such as BERT-based semantic similarity calculation) to match the current requirement content with keywords in the template and identify the most suitable template structure.
[0059] Furthermore, the system supports multiple template matching strategies, including TF-IDF-based keyword matching and semantic vector-based similarity matching (the cosine similarity threshold can be set to...). (This includes) rule-based pattern matching. During the completion process, the system automatically fills in placeholders in the template based on the context, such as actions. ,result Performance indicators and threshold And ensure that it conforms to the preset format specifications and business logic.
[0060] Furthermore, this step is widely used in the early requirements analysis phase of software projects, especially when key elements are missing or poorly described in the requirements documents submitted by the business side. For example, when the response time or the number of concurrent users is not specified in the requirements, the system can automatically complete it to "response time". "or "concurrent users" The system will prompt the user to confirm or make adjustments.
[0061] Furthermore, this step effectively enhances the automation capabilities of requirements documents, reduces the workload of manual verification and completion, and ensures the structured and standardized nature of the output data, laying a solid foundation for subsequent version management and document generation.
[0062] Furthermore, S4 includes: S41, for the missing acceptance criterion item, match the most similar condition-outcome template from the template library and fill in the placeholder.
[0063] Specifically, in the key element verification unit, when the system detects a missing acceptance criterion item in the structured parsing result, a template matching and filling mechanism will be activated. This step identifies and matches the most similar condition-result type template from the preset general template library of acceptance criteria, and automatically fills in the placeholders to achieve intelligent completion of missing items.
[0064] Furthermore, the template matching process combines semantic similarity calculation with rule matching. The system first extracts the contextual semantic features of the current requirement, including key information such as verbs, conditional descriptions, and expected behaviors, to construct a semantic vector representation. Then, using cosine similarity or a BERT-based semantic matching algorithm, it compares the template with multiple condition-result templates in the template library, selecting the template with the highest similarity as the matching result.
[0065] Furthermore, this step supports dynamic expansion and updating of templates. Users can customize and add new acceptance criterion templates, which the system then incorporates into the matching pool through a template registration mechanism. In practical applications, this step is widely used for the automated completion of software requirements documents, especially when requirements are ambiguous or acceptance criteria are unclear, significantly improving the completeness and standardization of the documents. Its technical value lies in achieving intelligent enhancement of structured data through the combination of semantic understanding and template matching, thereby reducing the burden of manual verification and improving the level of automation in requirements analysis.
[0066] S42 performs threshold verification on non-functional requirement indicators and generates completion suggestions that meet the preset range.
[0067] Specifically, threshold validation of non-functional requirement indicators is a crucial step in ensuring the technical feasibility of the requirements specification and the compliance of system performance. This step automatically validates the performance parameters output by the structured parsing unit using a built-in threshold library for non-functional requirement indicators, and generates completion suggestions when parameters exceed preset ranges. In practice, the system first extracts non-functional requirement fields from the structured data, such as "response time," "concurrent users," and "system availability," and then compares them with preset thresholds. For example, the response time must meet certain requirements. The number of concurrent users needs to be System availability needs If a certain indicator fails to reach the set threshold, the system will classify and process it according to the degree of deviation (such as the specific number of milliseconds for a response time exceeding 200ms) and generate targeted completion suggestions, such as "suggest optimizing the database query strategy" or "adding server cluster nodes".
[0068] Furthermore, the system supports user-defined threshold ranges, allowing the setting of upper and lower limits (e.g., ...). and It supports multi-level alarm mechanisms (such as warning, error, and critical). The verification logic is implemented based on a rule engine, using an IF-THEN structure for condition matching to ensure the scalability and flexibility of the verification process. In addition, the system also supports automatic identification and conversion of indicator units, such as converting "seconds" to "milliseconds" or "number of users" to "number of concurrent connections".
[0069] Furthermore, this step is widely applied in scenarios such as software project requirements analysis, system performance evaluation, and product acceptance standard formulation. In practice, the system can interface with requirements management systems (such as Jira and TAPD) to automatically read and validate requirement fields, ensuring that the output documents comply with software quality standards such as ISO / IEC 25010.
[0070] Furthermore, the system enables intelligent identification and compliance verification of non-functional requirements, effectively improving the technical rigor and executability of the requirements specification and providing a clear performance benchmark for subsequent development and testing.
[0071] S5 inputs structured requirement data into a pre-set standard document template, and the template engine automatically populates and generates a requirement analysis specification that conforms to the specifications.
[0072] Specifically, in the specification generation unit, structured requirement data is input into a pre-set standard document template, and the template engine automatically fills in the requirement analysis specification. This step is based on the final requirement data processed by the structured parsing unit and the key element verification unit. It adopts a template-driven approach to bind the data with the document structure, thereby generating a deliverable document that conforms to industry standards.
[0073] Furthermore, the template engine can be a mature Java template engine such as Apache FreeMarker or Thymeleaf, which supports complex logic such as variable substitution, conditional statements, and loop structures, and can flexibly adapt to different template file formats (such as .ftl or .html). Structured data is usually stored in JSON or XML format and includes fields such as requirement number, functional description, priority, acceptance criteria, and non-functional requirements. The template engine maps these fields to placeholders in the template through a variable binding mechanism.
[0074] Furthermore, the template file must comply with standards such as GB / T8567 "National Standard for Software Documentation" or IEEE 830 "Software Requirements Specification" to ensure that the generated document conforms to industry standards in terms of format, chapter division, and terminology. The template can preset fixed-format headings, paragraph styles, table structures, and chart insertion points to enhance the readability and professionalism of the document.
[0075] Furthermore, the rendering efficiency of a template engine is typically related to the data size and template complexity. For example, when the number of required items exceeds 500, the system should support paginated rendering and asynchronous loading mechanisms to avoid memory overflow or UI lag. In addition, the export format should support mainstream document formats such as Word (.docx) and PDF (.pdf), and format conversion can be achieved through libraries such as Aspose.Words or iText. During the conversion process, consistency in font, paragraph, and table styles must be maintained.
[0076] Furthermore, this is commonly used in the requirements delivery phase of software development projects. After the business party or project manager submits requirements, the system completes semantic parsing, validation, and collaborative editing, generating a standardized document with one click for review and confirmation by the development team, testing team, and client. Through this step, the system achieves end-to-end automation from original requirements to formal document, significantly improving document generation efficiency and consistency, reducing the workload of manual typesetting and format validation, and is a crucial step in achieving intelligent requirements analysis.
[0077] Furthermore, S5 includes: S51 uses the Apache FreeMarker template engine to bind structured data to variables in `.ftl` template files.
[0078] Specifically, in the specification generation unit, the Apache FreeMarker template engine is used to bind the JSON or XML format data output from the structured parsing unit with the `.ftl` template file, which is a key step in automating the generation of requirements analysis specifications. FreeMarker is a Java-based template engine widely used for dynamic content generation. Its core mechanism separates static templates from dynamic data models through a template language (FTL), thereby achieving a flexible and reusable document generation process.
[0079] Further, this step first constructs the structured data model (DataModel) as a Java object graph, containing requirement elements (such as functional descriptions, acceptance criteria, non-functional requirements, etc.) and their nested structure. The template file (`.ftl`) is written according to standard FreeMarker syntax, defining the document's structure, style, and content layout. For example, the template may contain the statement `<#listrequirementsasreq>`, used to iterate through the requirement list and dynamically insert each item. The variable binding process loads the template through the `Configuration` class and uses the `Template.process(dataModel,writer)` method to inject the data model into the template, ultimately outputting the rendered HTML or text content.
[0080] Furthermore, the template engine supports various configuration parameters, such as `classic_compatible` for compatibility with older syntax, `default_encoding` to set the default character encoding (usually UTF-8), and `template_exception_handler` to control template error handling strategies (such as throwing exceptions or ignoring errors). In addition, macros and functions can be defined in templates to achieve reuse and logic encapsulation, improving template maintainability and extensibility.
[0081] Furthermore, this step runs on the document generation module of the backend service, typically deployed in a Spring Boot or JavaEE environment, and interacts with the frontend collaborative editing unit via a RESTful API or message queue. Upon receiving the final confirmed structured data, the system immediately triggers the template rendering process to generate a requirements document conforming to the ISO / IEC 29148 (SQuaRE) standard.
[0082] Furthermore, through the variable binding mechanism, efficient and configurable conversion from structured data to standard format documents is achieved, ensuring the consistency of the output document's format and the integrity of its content, and significantly improving the efficiency and professionalism of the requirements specification generation.
[0083] S52 uses the Aspose.Words format conversion library to convert the rendered template file into Word format, and uses the iText library to generate the final PDF document.
[0084] Specifically, in the final stage of the instruction manual generation unit, the system uses the Aspose.Words format conversion library to convert the rendered template file into Word format, and further utilizes the iText library to generate the final PDF document. This step is a crucial step in transforming structured requirements data into a deliverable, printable, and industry-standard formal document.
[0085] Furthermore, Aspose.Words, a commercial document processing library based on Java / .NET, supports dynamically populating predefined Word templates with structured content in formats such as HTML, XML, and JSON. The system first sends the final, collaboratively edited and validated requirements data to the template engine (such as FreeMarker or Thymeleaf) in JSON format. The template engine then inserts the data into the appropriate locations in the Word document according to variable binding rules, including complex structures such as headings, body paragraphs, tables, and lists. During the conversion process, Aspose.Words supports advanced features such as font embedding, style inheritance, header and footer processing, and pagination control, ensuring that the output Word document conforms to the ISO / IEC 26300 standard (i.e., the OfficeOpenXML standard) in terms of format, layout, and content integrity.
[0086] Furthermore, the system calls the iText library to convert Word documents to PDF format. iText supports generating PDFs from HTML or XML, and can also further process intermediate PDF files exported from Aspose.Words. During the conversion process, the system sets PDF output parameters, such as page size (A4, Letter), resolution (300 DPI), font embedding strategy (Subset or FullEmbed), and PDF version (e.g., PDF / A-1b for archiving), to meet the compliance requirements of different industries for document formats. iText also supports adding watermarks, digital signatures, and access control (e.g., disabling printing or editing) to enhance document security and formality.
[0087] Furthermore, this step is widely applied in business processes that require structured output, such as software project delivery, bidding document generation, and contract drafting. Through standardized templates and automated conversion, the system ensures consistent document formatting and complete content, avoids manual formatting errors, and improves delivery efficiency.
[0088] Furthermore, it achieves a seamless transition from structured data to formal documents, ensuring that the output documents meet enterprise-level standards in terms of format, content, and security, thereby enhancing the readability, traceability, and legal validity of the documents.
[0089] The requirement analysis specification generation method based on natural language processing in this invention can achieve intelligent parsing and structured conversion of unstructured natural language requirements. Combined with automated verification, real-time collaborative editing, and refined version management, it significantly improves the efficiency, standardization, and traceability of requirement analysis specification generation.
[0090] Example 2 Another embodiment of the present invention provides a method for generating project requirements analysis specifications based on natural language processing, comprising: a business requirements input unit, a structured parsing unit, a key element verification unit, a collaborative editing unit, a version management unit, and a specification generation unit. The units interact with each other through data interfaces. The specific architecture is as follows: 1. Business Requirement Input Unit: Provides three input methods for requirements: text input box, file upload (supports Word, Excel, PDF and other formats), and voice input, to meet the requirements submission needs in different business scenarios; 2. Structured Parsing Unit: Responsible for transforming the input unstructured text into structured data according to the requirements. Its core is semantic understanding and information extraction based on a pre-trained GPT (Generative Pre-trained Transformer) model. The specific process is as follows: Step 1: Preprocess the input text, including word segmentation, stop word removal, and punctuation standardization.
[0091] Step 2: Input the preprocessed text sequence into the fine-tuned GPT model. This model, through its powerful contextual understanding capabilities, identifies and extracts key requirement elements.
[0092] Step 3: The model performs sequence labeling on the text sequence based on a pre-set label set, outputting structured data. This process can be formally represented as:
[0093] in: This represents the input word sequence.
[0094] The output label sequence is represented by: (B-Requirement, I-Requirement, B-Actor, B-Action, B-Condition, O, etc.).
[0095] This represents the probability that the current word is predicted to be the label y_t, given the preceding label and the input sequence.
[0096] Step 4: Organize the annotation results into a structured JSON or XML format.
[0097] 3. Key Element Verification Unit: This unit has a built-in extensible verification rule library to automatically verify the data output by the structured parsing unit.
[0098] 3.1. Rule base composition: 3.1.1. Requirement Priority Mapping Table: Maps keywords in the text (such as "must", "should", "hope") to fixed priority levels (such as P0, P1, P2).
[0099] 3.1.2. Acceptance Criteria General Template Library: Contains a variety of preset templates, such as condition-result type templates, whose formal description is: When <condition C>, the system should <execute action A> and output <result R>, and its <performance index P> error does not exceed <threshold T>.
[0100] 3.1.3. Thresholds for non-functional requirements indicators: Thresholds are defined for indicators such as response time (≤200ms), concurrent users (≥1000), and system availability (≥99.9%).
[0101] 3.2. Validation Logic: The system iterates through the structured data and matches it against the rule base. For missing or rule-incompatible items, a validation report is generated, including the error level (warning, error), problem description, and suggested modifications.
[0102] 4. Collaborative Editing Unit: Based on the WebSocket full-duplex communication protocol, this unit enables real-time collaborative editing of the requirements specification. Different roles are assigned different operation permissions; a real-time synchronization mechanism ensures that any user's editing operation (such as input or deletion) is broadcast to other online users in real time via the WebSocket channel, guaranteeing seamless synchronization. Figure 1 Consistency: An Operational Transformation (OT) algorithm is used to resolve conflicts when multiple people are editing the same area simultaneously, ensuring the correctness of the final result.
[0103] 5. Version Management Unit: Enables full lifecycle management of document versions through multi-dimensional technologies.
[0104] 5.1. Semantic Version Numbering Standard: The naming convention is Major Version Number.Minor Version Number.Revision Number (e.g., V1.2.0). Version number changes are strictly correlated with the magnitude of requirement changes, facilitating intuitive identification of iteration levels.
[0105] 5.2. Difference labeling based on Myers difference algorithm: 5.2.1. Algorithm Core: The Myers algorithm compares the differences between two text sequences by finding the shortest editing path (consisting of "insert" and "delete" operations). Its goal is to find the path that transforms sequence A into sequence B with the fewest operations.
[0106] 5.2.2. Application Process: Step 1. The system compares the current document with the previous version line by line; Step 2. Execute the Myers algorithm to generate an editing script. ,in for or operate.
[0107] Step 3. Based on the editing script, perform visual rendering in the user interface: newly added content is marked with a green background and a leading "+" symbol; deleted content is marked with a red strikethrough and a leading "-" symbol; modifications are treated as a combination of "delete first, then add".
[0108] 5.2.3. Contextual View: When the user hovers the mouse over the difference marker, the system dynamically loads and displays the complete "before" and "after" content of that area side by side through a pop-up window.
[0109] 5.3. Version Rollback and Locking: The system records a complete version log for each saved version, supporting one-click rollback to any historical version. Confirmed final versions of documents can be locked to prevent unauthorized modifications.
[0110] 6. Instruction Manual Generation Unit: Based on a pre-set standard template, the unit automatically fills in and generates a deliverable document from the final requirements data after verification and collaborative editing.
[0111] 6.1. Template Engine: Use a template engine such as Apache FreeMarker or Thymeleaf to bind structured data (variables, lists) with template files (.ftl, .html).
[0112] 6.2. Multi-format export: After the template engine renders, the final requirements analysis specification in Word, PDF and other formats is generated through a format conversion library (such as Aspose.Words, iText) for users to download and use.
[0113] The embodiments of this invention also have the following technical features: Automation and intelligence: The GPT model enables automatic parsing and structuring of unstructured requirements, significantly reducing manual intervention; Standardization and normalization: Built-in validation rules and standard templates ensure the quality and standardization of output documents, reducing ambiguity and omissions; Highly efficient collaboration: Real-time collaborative editing based on WebSocket and strict version management significantly improve team collaboration efficiency and reduce communication costs; Strong traceability: Complete version history and visual difference comparisons make the requirement change process clear and traceable, facilitating project management and auditing.
[0114] Example 3 To achieve the above embodiments, such as Figure 2 As shown, this embodiment also provides a project requirements analysis specification generation device 10 based on natural language processing, including: The requirement text acquisition module 100 is used to acquire unstructured natural language requirement text input by the business party; The semantic understanding and information extraction module 200 is used to perform semantic understanding and information extraction on the requirement text using a fine-tuned pre-trained language model, and generate a tag sequence containing requirement elements. The automated verification module 300 is used to automatically verify the tag sequence based on a preset verification rule base and generate a verification report containing error level, problem description and modification suggestions. The intelligent completion module 400 is used to intelligently complete the missing or non-compliant requirement elements according to the modification suggestions in the verification report and the preset acceptance standard template library, and generate structured requirement data. The document generation module 500 is used to input structured requirement data into a preset standard document template, and automatically fill in and generate a requirement analysis specification that conforms to the specifications through the template engine.
[0115] Furthermore, the semantic understanding and information extraction module 200 is also used for: The preprocessed text sequence is input into the fine-tuned GPT model, and the formula is used to...
[0116] Modeling contextual relationships, where The output tag sequence includes B-Requirement, I-Requirement, B-Actor, B-Action, and B-Condition types; The BIO annotation system is used to accurately identify the boundaries of demand elements, ensuring the contextual relevance of adjacent terms in the tag sequence.
[0117] Furthermore, the automated verification module 300 is also used for: The keywords in the text are mapped to fixed priority levels using a demand priority mapping table; The acceptance criteria are validated using a condition-outcome template. The template format is: when When this happens, the system should perform the action. and output the results. Its performance indicators Error does not exceed the threshold .
[0118] An embodiment of the present invention provides a project requirements analysis specification generation device based on natural language processing, which can realize intelligent parsing of unstructured natural language requirements and automatic completion of key elements, significantly improving the efficiency and standardization of requirements analysis, and reducing manual intervention and error rate.
[0119] Example 4 To implement the methods of the above embodiments, the present invention also provides a computer device, such as... Figure 3 As shown, the computer device 600 includes a memory 601 and a processor 602; wherein, the processor 602 reads the executable program code stored in the memory 601 to run a program corresponding to the executable program code, so as to implement the various steps of the project requirements analysis specification generation method based on natural language processing described above.
[0120] Example 5 To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a method for generating a project requirements analysis specification based on natural language processing as described in the foregoing embodiments.
[0121] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0122] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
Claims
1. A method for generating project requirements analysis specifications based on natural language processing, characterized in that, include: S1, Obtain the unstructured natural language requirement text input by the business party; S2, using the fine-tuned pre-trained language model to perform semantic understanding and information extraction on the requirement text, generating a tag sequence containing requirement elements; S3, Based on a preset verification rule base, automatically verify the tag sequence and generate a verification report containing error level, problem description and modification suggestions; S4. Based on the modification suggestions in the verification report and the preset acceptance standard template library, intelligently complete the missing or non-compliant requirement elements to generate structured requirement data. S5 inputs structured requirement data into a pre-set standard document template, and the template engine automatically populates and generates a requirement analysis specification that conforms to the specifications.
2. The method as described in claim 1, characterized in that, The S2 includes: S21, input the preprocessed text sequence into the fine-tuned GPT model, and use the formula... Modeling contextual relationships, where The output tag sequence includes B-Requirement, I-Requirement, B-Actor, B-Action, and B-Condition types; S22 uses the BIO annotation system to accurately identify the boundaries of demand elements, ensuring the contextual relevance of adjacent terms in the tag sequence.
3. The method as described in claim 1, characterized in that, The S3 includes: S31, use a demand priority mapping table to map keywords in the text to fixed priority levels; S32, a condition-outcome template is used to verify the acceptance criteria. The template format is: When When this happens, the system should perform the action. and output the results. Its performance indicators Error does not exceed the threshold .
4. The method as described in claim 1, characterized in that, The S4 includes: S41, for the missing acceptance criteria item, match the most similar condition-result template from the template library and fill in the placeholder; S42 performs threshold verification on non-functional requirement indicators and generates completion suggestions that meet the preset range.
5. The method as described in claim 1, characterized in that, The S5 includes: S51 uses the Apache FreeMarker template engine to bind structured data to variables in `.ftl` template files; S52 uses the Aspose.Words format conversion library to convert the rendered template file into Word format, and uses the iText library to generate the final PDF document.
6. A device for generating project requirements analysis specifications based on natural language processing, characterized in that, include: The requirement text acquisition module is used to acquire unstructured natural language requirement text input by the business party; The semantic understanding and information extraction module is used to perform semantic understanding and information extraction on the requirement text using a fine-tuned pre-trained language model, and generate a tag sequence containing requirement elements. An automated verification module is used to automatically verify the tag sequence based on a preset verification rule base and generate a verification report that includes error level, problem description and modification suggestions. The intelligent completion module is used to intelligently complete missing or non-compliant requirement elements based on the modification suggestions in the verification report and the preset acceptance standard template library, and generate structured requirement data. The document generation module is used to input structured requirement data into a pre-set standard document template, and automatically fill in and generate a requirement analysis specification that conforms to the specifications through the template engine.
7. The apparatus as claimed in claim 6, characterized in that, The semantic understanding and information extraction module is also used for: The preprocessed text sequence is input into the fine-tuned GPT model, and the formula is used to... Modeling contextual relationships, where The output tag sequence includes B-Requirement, I-Requirement, B-Actor, B-Action, and B-Condition types; The BIO annotation system is used to accurately identify the boundaries of demand elements, ensuring the contextual relevance of adjacent terms in the tag sequence.
8. The apparatus as claimed in claim 6, characterized in that, The automated verification module is also used for: The keywords in the text are mapped to fixed priority levels using a demand priority mapping table; The acceptance criteria are validated using a condition-outcome template. The template format is: when When this happens, the system should perform the action. and output the results. Its performance indicators Error does not exceed the threshold .
9. A computer device, characterized in that, Including processor and memory; The processor reads executable program code stored in the memory to run a program corresponding to the executable program code, so as to implement the method for generating a project requirements analysis specification based on natural language processing as described in any one of claims 1-5.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements a method for generating a project requirements analysis specification based on natural language processing as described in any one of claims 1-5.