Function point extraction method and device based on entity extraction and relation extraction, equipment, storage medium and program product

By introducing entity extraction and relationship extraction techniques into the functional point extraction method, combining the multi-head attention mechanism and long-term short-term memory model, the problem of existing methods insufficient understanding of the required text context is solved, and the accuracy and adaptability of functional point extraction is improved.

CN119597853APending Publication Date: 2025-03-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411712915.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing functional point extraction method has weak understanding of the context of the demand text, especially when dealing with complex demand statements, the extraction errors often occur, and the user's needs cannot be correctly understood, and there is a problem of low accuracy.

Method used

Using a method based on entity extraction and relation extraction, the demand text is vectorized through the word embedding model, and combined with the multi-head attention mechanism and long-term short-term memory model, the semantic encoding of entities and relationships and the understanding of text context is achieved.

Benefits of technology

It significantly improves the accuracy and adaptability of extracting complex demand statements, and can more accurately extract practical functional points descriptions from the requirements text, effectively supporting requirements analysis and planning work in the software development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597853A_ABST
    Figure CN119597853A_ABST
Patent Text Reader

Abstract

The invention relates to a function point extraction method and device based on entity extraction and relation extraction, equipment, a storage medium and a program product, and relates to the technical field of deep learning. By adopting the method, the extraction accuracy and adaptability of complex demand statements can be improved. The method comprises the following steps: inputting a required text sentence into a preset word embedding model to obtain a word embedding sequence; predicting the word embedding sequence based on a long short-term memory model to obtain a key vector and a value vector of the attention mechanism, performing vector splicing on the query vector, the key vector and the value vector to obtain a spliced new vector, and performing entity extraction in the new vector to obtain an entity set; determining two target entities corresponding to the candidate relationship, and local context information and global context information between the two target entities; and carrying out information splicing on the two target entities, the local context information and the global context information to obtain a relation vector, and carrying out relation extraction on the relation vector to obtain a relation extraction result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of deep learning technology, and in particular to a method, apparatus, computer device, computer-readable storage medium and computer program product for extracting function points based on entity extraction and relationship extraction. Background Art

[0002] Current software development generally follows a series of major phases, including problem definition and planning, requirements analysis, software design, and program coding and testing. Among these phases, requirements analysis is particularly critical because it directly affects the cost and quality of software development. If the functional points cannot be correctly identified and defined during the requirements analysis phase, it will lead to deviations in the planning and development process of subsequent phases, thus affecting the success of the entire project.

[0003] Currently, function point extraction for natural language text is an important research direction of function point mining, which aims to extract function point related vocabulary from requirement text to construct a complete function point description. However, the existing function point extraction methods have a weak understanding of the context of requirement text, especially when dealing with complex requirement statements, extraction errors often occur, and the user's needs cannot be correctly understood, resulting in low accuracy. Summary of the invention

[0004] Based on this, it is necessary to provide a function point extraction method, device, computer equipment, computer-readable storage medium and computer program product based on entity extraction and relationship extraction to address the above technical problems.

[0005] In a first aspect, the present application provides a method for extracting function points based on entity extraction and relationship extraction, comprising:

[0006] Acquire the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain demand text sentences;

[0007] Inputting the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model;

[0008] Obtaining a query vector of the attention mechanism, predicting the word embedding sequence based on a long short-term memory model to obtain a key vector and a value vector of the attention mechanism, performing vector concatenation on the query vector, the key vector and the value vector to obtain a concatenated new vector, and performing entity extraction in the new vector to obtain an entity set;

[0009] Acquire candidate relations existing in the entity set, and determine two target entities corresponding to the candidate relations, as well as local context information and global context information between the two target entities;

[0010] The two target entities, the local context information and the global context information are spliced ​​to obtain a spliced ​​relationship vector, and relationship extraction is performed on the relationship vector to obtain a relationship extraction result.

[0011] In one embodiment, obtaining a query vector of an attention mechanism includes:

[0012] Identify existing tag subsequences in the requirement text as spans; input the spans into the long short-term memory model for calculation to obtain a meaning representation of the spans; and generate the query vector of the attention mechanism based on the meaning representation.

[0013] In one embodiment, the step of performing vector concatenation on the query vector, the key vector, and the value vector to obtain a concatenated new vector includes:

[0014] Based on the query vector, the key vector and the value vector, a multi-head attention calculation is performed; according to the multi-head attention calculation result, a weighted global context representation is obtained; and vector concatenation is performed on the query vector and the global context representation to obtain the new vector.

[0015] In one embodiment, extracting entities from the new vector to obtain an entity set includes:

[0016] The new vector is input into a preset first feedforward neural network, and a first activation function in the first feedforward neural network performs entity judgment on the new vector to obtain an entity judgment result; when the entity judgment result is that the new vector belongs to an entity, the entity type of the entity is determined; based on the entity judgment result and the entity type, the entity set is obtained by integration.

[0017] In one embodiment, performing relationship extraction on the relationship vector to obtain a relationship extraction result includes:

[0018] The relationship vector is input into a preset second feedforward neural network, and a second activation function in the second feedforward neural network performs relationship judgment on the relationship vector to obtain a relationship judgment result; when the relationship judgment result is an association relationship between the two target entities, the relationship type of the association relationship is determined; and the relationship extraction result is obtained based on the association relationship and the relationship type.

[0019] In one of the embodiments, the determining the two target entities corresponding to the candidate relationship, and the local context information and the global context information between the two target entities, includes:

[0020] Among the two target entities, determine the first entity and the second entity; use a preset recurrent neural network model to obtain a subsequence starting from the tail of the first entity and ending at the head of the second entity as the local context information; based on a multi-head attention mechanism and using the long short-term memory model, process the two target entities to obtain the global context information.

[0021] In a second aspect, the present application also provides a function point extraction device based on entity extraction and relationship extraction, comprising:

[0022] A text processing module is used to obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain demand text sentences;

[0023] A model processing module, used for inputting the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model;

[0024] An entity extraction module is used to obtain a query vector of an attention mechanism, predict the word embedding sequence based on a long short-term memory model, obtain a key vector and a value vector of the attention mechanism, perform vector concatenation on the query vector, the key vector and the value vector to obtain a concatenated new vector, and perform entity extraction in the new vector to obtain an entity set;

[0025] A relationship acquisition module, used to acquire candidate relationships existing in the entity set, and determine two target entities corresponding to the candidate relationships, as well as local context information and global context information between the two target entities;

[0026] The relationship extraction module is used to perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

[0027] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0028] Obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain the demand text sentence; input the demand text sentence into a preset word embedding model to obtain the word embedding sequence output by the word embedding model; obtain the query vector of the attention mechanism, predict the word embedding sequence based on the long short-term memory model to obtain the key vector and value vector of the attention mechanism, perform vector splicing on the query vector, the key vector and the value vector to obtain a spliced ​​new vector, and perform entity extraction in the new vector to obtain an entity set; obtain the candidate relationship existing in the entity set, and determine the two target entities corresponding to the candidate relationship, as well as the local context information and global context information between the two target entities; perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0030] Obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain the demand text sentence; input the demand text sentence into a preset word embedding model to obtain the word embedding sequence output by the word embedding model; obtain the query vector of the attention mechanism, predict the word embedding sequence based on the long short-term memory model to obtain the key vector and value vector of the attention mechanism, perform vector splicing on the query vector, the key vector and the value vector to obtain a spliced ​​new vector, and perform entity extraction in the new vector to obtain an entity set; obtain the candidate relationship existing in the entity set, and determine the two target entities corresponding to the candidate relationship, as well as the local context information and global context information between the two target entities; perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

[0031] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0032] Obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain the demand text sentence; input the demand text sentence into a preset word embedding model to obtain the word embedding sequence output by the word embedding model; obtain the query vector of the attention mechanism, predict the word embedding sequence based on the long short-term memory model to obtain the key vector and value vector of the attention mechanism, perform vector splicing on the query vector, the key vector and the value vector to obtain a spliced ​​new vector, and perform entity extraction in the new vector to obtain an entity set; obtain the candidate relationship existing in the entity set, and determine the two target entities corresponding to the candidate relationship, as well as the local context information and global context information between the two target entities; perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

[0033] The above-mentioned function point extraction method, device, computer equipment, computer-readable storage medium and computer program product based on entity extraction and relationship extraction, in the preprocessing process, use the word embedding model to vectorize the demand text sentences, thereby enhancing the semantic representation of the demand text; in the entity extraction process, the semantic encoding of the entity and the text up-down encoding are realized through the multi-head attention mechanism and the long short-term memory model, thereby improving the entity extraction ability of the function point; in the relationship extraction process, the recurrent neural network model is used to obtain local context information, which increases the semantic representation of the local context, and the global context information is obtained again through the multi-head attention mechanism and the long short-term memory model, which increases the model's understanding of the global context in relationship judgment, thereby improving the relationship extraction ability. In summary, the entire technical solution can jointly extract data function points and transaction function points, and can process function points composed of non-continuous phrases, effectively avoiding the problem of error propagation. In addition, this application also significantly improves the accuracy and adaptability of extracting complex requirement statements by enhancing the ability to understand key information in the text context, so that it can more accurately extract meaningful functional point descriptions from the requirement text, effectively supporting the requirement analysis and planning work in the software development process. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0035] Figure 1An application environment diagram of a function point extraction method based on entity extraction and relationship extraction in one embodiment;

[0036] Figure 2 A flowchart of a function point extraction method based on entity extraction and relationship extraction in one embodiment;

[0037] Figure 3 is a flowchart of a query vector acquisition step in one embodiment;

[0038] Figure 4 It is a flowchart of a function point extraction method based on entity extraction and relationship extraction in a specific embodiment;

[0039] Figure 5 It is a flowchart of a function point extraction method based on entity extraction and relationship extraction in an application embodiment;

[0040] Figure 6 is a structural block diagram of a function point extraction device based on entity extraction and relationship extraction in one embodiment;

[0041] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0043] The function point extraction method based on entity extraction and relationship extraction provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal communicates with the server through the network. The data storage system can store the data that the server needs to process. The data storage system can be integrated on the server or placed on the cloud or other network servers.

[0044] Specifically, the function point extraction method based on entity extraction and relationship extraction provided in the embodiment of the present application can be executed by a server.

[0045] Exemplarily, the server obtains the demand text to be processed, performs text cleaning on the demand text, and performs sentence processing on the cleaned text to obtain the demand text sentence; the server inputs the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model; the server obtains the query vector of the attention mechanism, predicts the word embedding sequence based on the long short-term memory model, obtains the key vector and value vector of the attention mechanism, performs vector splicing on the query vector, the key vector and the value vector to obtain a spliced ​​new vector, and performs entity extraction in the new vector to obtain an entity set; the server obtains the candidate relationship existing in the entity set, and determines the two target entities corresponding to the candidate relationship, as well as the local context information and global context information between the two target entities; the server performs information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, performs relationship extraction on the relationship vector, and obtains a relationship extraction result.

[0046] In such Figure 1 In the application environment shown, the terminal can be, but is not limited to, various personal computers, notebook computers, smart phones, and tablet computers. The server can be implemented as an independent server or a server cluster consisting of multiple servers.

[0047] In one embodiment, Figure 2 As shown in the figure, a function point extraction method based on entity extraction and relationship extraction is provided. Figure 1 The server in the example is used to illustrate the following steps:

[0048] Step S201, obtaining the demand text to be processed, performing text cleaning on the demand text, and performing sentence processing on the cleaned text to obtain demand text sentences.

[0049] It should be noted that text cleaning of the requirement text is aimed at removing special contents such as special characters, pictures and charts in the requirement text.

[0050] Specifically, the server can use a standard natural language data processing process to process the demand text. First, the server removes special characters, pictures, charts and other special contents in the demand text; then, the server uses a period or a semicolon as a separator to separate the demand text into sentences; at the same time, the server uses characters as the basic unit for subsequent word segmentation to segment the text after the sentence segmentation.

[0051] Step S202: input the required text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model.

[0052] Among them, the preset word embedding model can be a BERT (Bidirectional Encoder Representations from Transformers, a pre-trained deep learning) model.

[0053] Specifically, the server uses the BERT model as the word embedding model, and for a required text sentence with an input length of n , after the BERT model, we get the word embedding sequence .

[0054] Step S203, obtain the query vector of the attention mechanism, predict the word embedding sequence based on the long short-term memory model, obtain the key vector and value vector of the attention mechanism, concatenate the query vector, key vector and value vector to obtain a concatenated new vector, and extract entities in the new vector to obtain an entity set.

[0055] Among them, the attention mechanism is a technology inspired by the human visual attention system. It was originally used to improve the performance of deep learning models when processing sequence data (such as text in natural language processing tasks, machine translation, etc.). This technology allows the model to dynamically focus on different parts of the input instead of simply treating all parts equally, thereby more efficiently capturing key information in the input.

[0056] Among them, the long short-term memory model is a special recursive neural network that can be used to solve the gradient vanishing and gradient exploding problems encountered by traditional recursive neural networks when processing long sequence data. The long short-term memory model can effectively capture long-term dependencies and is widely used in time series prediction, natural language processing, speech recognition and other fields.

[0057] Specifically, the server obtains the query vector of the attention mechanism, predicts the word embedding sequence based on the long short-term memory model, obtains the key vector and value vector of the attention mechanism, concatenates the query vector, key vector and value vector to obtain a concatenated new vector, and extracts entities and determines the entity type in the new vector to obtain an entity set.

[0058] Step S204 , obtaining candidate relations existing in the entity set, and determining two target entities corresponding to the candidate relations, as well as local context information and global context information between the two target entities.

[0059] Among them, the candidate relationship can be , which means that the former acts on the latter; the candidate relationship is formed by combining any two entities in the entity set.

[0060] Specifically, for the entity set obtained by the server through the entity extraction operation, the relationship extraction will process each possible candidate relationship and determine the two target entities corresponding to the candidate relationship, as well as the local context information and global context information between the two target entities.

[0061] Step S205 , concatenating the two target entities, the local context information and the global context information to obtain a concatenated relationship vector, and performing relationship extraction on the relationship vector to obtain a relationship extraction result.

[0062] Among them, the relationship vector is a vector representation method for representing the relationship between two or more entities. The relationship vector can be used to capture the association or interaction between different entities and convert it into a numerical vector form to facilitate computer processing and reasoning.

[0063] Specifically, the server concatenates the two target entities, local context information, and global context information, and sends them into a feedforward neural network. It then uses the Softmax function to determine whether there is a relationship between the two entities to obtain the relationship extraction result.

[0064] In the above-mentioned function point extraction method based on entity extraction and relationship extraction, in the preprocessing process, the semantic representation of the demand text is enhanced by using a word embedding model to vectorize the demand text sentences; in the entity extraction process, the semantic encoding of the entity and the text up and down encoding are realized through the multi-head attention mechanism and the long short-term memory model, thereby improving the entity extraction ability of the function point; in the relationship extraction process, the recurrent neural network model is used to obtain local context information, which increases the semantic representation of the local context, and the global context information is obtained again through the multi-head attention mechanism and the long short-term memory model, which increases the model's understanding of the global context in relationship judgment, thereby improving the extraction ability of the relationship. In summary, the entire technical solution can jointly extract data function points and transaction function points, and can process function points composed of non-continuous phrases, effectively avoiding the problem of error propagation. In addition, the present application also significantly improves the extraction accuracy and adaptability of complex demand statements by enhancing the ability to understand key information in the text context, so that it can more accurately extract meaningful function point descriptions from the demand text, effectively supporting the demand analysis and planning work in the software development process.

[0065] In one embodiment, if Figure 3 As shown, in the above step S201, obtaining the query vector of the attention mechanism specifically includes the following steps:

[0066] Step S301, identifying existing tag subsequences in the requirement text as spans.

[0067] Step S302: input the span into the long short-term memory model for calculation to obtain a meaning representation of the span.

[0068] Step S303, generating a query vector of the attention mechanism based on the meaning representation.

[0069] Among them, labeling subsequences mainly involves extracting subsequences with specific attributes or patterns from a larger sequence, and labeling or classifying these subsequences. Taking "upload document" as an example, the sequence can be divided into subsequences "up", "upload", "upload document" and so on.

[0070] Specifically, during the entity extraction process, the server identifies all possible token subsequences in the requirement text as spans. For each span, the server uses a long short-term memory model to calculate the meaning representation of the span to obtain the meaning representation of the span. Based on the meaning representation of the span, the server generates a query vector of the attention mechanism, thereby quickly and accurately obtaining the query vector.

[0071] In one embodiment, in the above step S203, vector concatenation is performed on the query vector, the key vector and the value vector to obtain a concatenated new vector, which specifically includes the following steps:

[0072] Based on the query vector, key vector and value vector, multi-head attention calculation is performed; according to the multi-head attention calculation results, a weighted global context representation is obtained; vector concatenation is performed on the query vector and the global context representation to obtain a new vector.

[0073] Among them, multi-head attention calculation is a key mechanism in deep learning, especially in natural language processing (NLP), and is widely used in the Transformer architecture. Its core idea is to extend the "attention mechanism" to multiple subspaces, thereby improving the expressiveness and learning ability of the model.

[0074] Specifically, the server processes the word embedding sequence obtained through the long short-term memory model as the key vector and value vector of the attention mechanism, and then uses the meaning representation of the span as the query vector of the attention mechanism to perform multi-head attention calculations and obtain a weighted global context representation. Finally, we concatenate the query vector and the global context representation to obtain a concatenated new vector, so that by calculating multiple attention heads in parallel, the model can learn information in multiple subspaces and capture more complex relationships between data.

[0075] In one embodiment, in the above step S203, entity extraction is performed in the new vector to obtain an entity set, which specifically includes the following steps:

[0076] The new vector is input into a preset first feedforward neural network, and the first activation function in the first feedforward neural network performs entity judgment on the new vector to obtain an entity judgment result; when the entity judgment result is that the new vector belongs to an entity, the entity type of the entity is determined; based on the entity judgment result and the entity type, an entity set is obtained by integration.

[0077] Among them, the first feedforward neural network can be a FNN (Feedforward Neural Network), the main feature of which is that the information flow in the network is unidirectional, that is, it flows from the input layer to the output layer, and does not contain a loop or feedback path.

[0078] The first activation function may be a softmax function, which is an activation function for calculating weights and can convert similarity into a probability distribution.

[0079] Specifically, the server inputs the new vector into a preset first feedforward neural network, and the first activation function in the first feedforward neural network performs entity judgment on the new vector (including whether it is an entity and which entity type it belongs to), and obtains an entity judgment result; when the entity judgment result is that the new vector belongs to an entity, the entity type of the entity is determined; based on the entity judgment result and the entity type, an entity set is integrated to obtain, thereby effectively improving the efficiency and accuracy of entity extraction.

[0080] In one embodiment, in the above step S205, performing relationship extraction on the relationship vector to obtain a relationship extraction result specifically includes the following steps:

[0081] The relationship vector is input into a preset second feedforward neural network, and the second activation function in the second feedforward neural network performs relationship judgment on the relationship vector to obtain a relationship judgment result; when the relationship judgment result is an association relationship between two target entities, the relationship type of the association relationship is determined; and the relationship extraction result is obtained based on the association relationship and the relationship type.

[0082] The second feedforward neural network may also be a FNN (Feedforward Neural Network), and the second activation function may also be a softmax function.

[0083] It should be noted that the following entity types are predefined in this application:

[0084] Data function point: represents the software data object on which user operations act, such as "document", "user data" and "registration record information".

[0085] Operation: Indicates the software operation that the user wants to perform, such as "download", "upload", "query" and "delete".

[0086] At the same time, the following relationship types are also defined in this application:

[0087] Operation--acts on--data function point: indicates the data function point that the user wants the current software operation to act on in the requirement document. For example, in the requirement text "In the document module, users can download documents", there are data function point types "document" and operation types "download" and there is an "operation-acts on-data function point" relationship between them, that is, download acts on documents, which constitutes a transaction function point.

[0088] Specifically, the server inputs the relationship vector into a preset second feedforward neural network, and the second activation function in the second feedforward neural network performs relationship judgment on the relationship vector to obtain a relationship judgment result output by the second feedforward neural network; when the relationship judgment result is an association relationship between two target entities, the relationship type of the association relationship is determined; based on the association relationship and the relationship type, the relationship extraction result is integrated.

[0089] In one embodiment, in the above step S204, determining the two target entities corresponding to the candidate relationship, and the local context information and the global context information between the two target entities specifically includes the following steps:

[0090] Among the two target entities, a first entity and a second entity are determined; a preset recurrent neural network model is used to obtain a subsequence starting from the tail of the first entity and ending at the head of the second entity as local context information; based on a multi-head attention mechanism and using a long short-term memory model, the two target entities are processed to obtain global context information.

[0091] The first entity may be an entity ranked higher among the two target entities, and the second entity may be an entity ranked lower among the two target entities.

[0092] Among them, the preset recurrent neural network model can be a GRU (Gated Recurrent Unit) network structure, which is an improved recurrent neural network (RNN) structure used to process sequence data, especially suitable for long-term dependency problems.

[0093] Specifically, the server determines the first entity and the second entity among the two target entities; uses the GRU network structure to obtain the subsequence from the tail of the first entity to the head of the second entity as local context information; and then performs weighted calculation on the two target entities based on the multi-head attention mechanism and using the long short-term memory model, so as to accurately obtain the global context information.

[0094] In one embodiment, Figure 4 As shown, a function point extraction method based on entity extraction and relationship extraction in a specific embodiment is provided, which specifically includes the following steps:

[0095] Step S401, obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain the demand text sentences; input the demand text sentences into a preset word embedding model to obtain the word embedding sequence output by the word embedding model.

[0096] Step S402, identifying the existing token subsequence in the demand text as the span; inputting the span into the long short-term memory model for calculation to obtain the meaning representation of the span; based on the meaning representation, generating the query vector of the attention mechanism, predicting the word embedding sequence based on the long short-term memory model, and obtaining the key vector and value vector of the attention mechanism.

[0097] Step S403, based on the query vector, the key vector and the value vector, perform multi-head attention calculation; obtain a weighted global context representation according to the multi-head attention calculation result; perform vector concatenation on the query vector and the global context representation to obtain a new vector.

[0098] Step S404, input the new vector into a preset first feedforward neural network, and perform entity judgment on the new vector by the first activation function in the first feedforward neural network to obtain an entity judgment result; when the entity judgment result is that the new vector belongs to an entity, determine the entity type of the entity; based on the entity judgment result and the entity type, integrate to obtain an entity set.

[0099] Step S405, obtain the candidate relations existing in the entity set, and determine the first entity and the second entity in the two target entities; use the preset recurrent neural network model to obtain the subsequence from the tail of the first entity to the head of the second entity as local context information; based on the multi-head attention mechanism and using the long short-term memory model, process the two target entities to obtain global context information.

[0100] Step S406: concatenate the two target entities, the local context information and the global context information to obtain a concatenated relationship vector.

[0101] Step S407, input the relationship vector into a preset second feedforward neural network, and use the second activation function in the second feedforward neural network to perform relationship judgment on the relationship vector to obtain a relationship judgment result; when the relationship judgment result is an association relationship between two target entities, determine the relationship type of the association relationship; and obtain a relationship extraction result based on the association relationship and the relationship type.

[0102] The beneficial effects brought by the above embodiments are as follows:

[0103] The present application can jointly extract data function points and transaction function points, and can process function points consisting of non-continuous phrases, effectively avoiding the problem of error propagation; in addition, the present application also significantly improves the accuracy and adaptability of extracting complex requirement statements by enhancing the ability to understand key information in the text context, thereby being able to more accurately extract practical function point descriptions from the requirement text, effectively supporting the requirement analysis and planning work in the software development process.

[0104] In order to more clearly illustrate the function point extraction method based on entity extraction and relationship extraction provided by the embodiment of the present application, the function point extraction method based on entity extraction and relationship extraction is specifically described below with an application embodiment. Figure 5 As shown, the present application also provides a function point extraction method based on entity extraction and relationship extraction, which specifically includes the following steps:

[0105] Step 1: Data preprocessing: We use the standard natural language data processing process to process the requirement text in the requirement document. First, we remove special characters, pictures, charts and other special contents in the requirement text. Then, we use periods or semicolons as separators to separate the requirement text into sentences. At the same time, we use characters as the basic unit for subsequent word segmentation and perform word segmentation on the text after the sentence segmentation.

[0106] Step 2: Text word embedding: We use the BERT model as our word embedding model. For a required text sentence with an input length of n , after the BERT model, we get the word embedding sequence .

[0107] Step 3: Entity extraction: In the actual extraction, for each span, we use LSTM to calculate the meaning of the span, so as to obtain At the same time, we process the word embedding sequence obtained previously through the long short-term memory model as the Key and Value of the attention mechanism, and then Query as the attention mechanism, so as to perform multi-head attention calculation and obtain the weighted global context representation Finally, we will and Vector concatenation is performed, passing through a single-layer feed-forward neural network FNN, and finally the Softmax function is used to determine whether it is an entity and which entity type it belongs to.

[0108] Step 4: Relationship extraction: For the entity set obtained through entity extraction operation, relationship extraction will process each possible candidate relationship, such as , which means that the former acts on the latter. Candidate relations are formed by combining any two entities in the entity set. In relation extraction, two kinds of context representations are used, a local context and a global context. Among them, for the local context, GRU is used to obtain the local context information between the two entities. The local context here refers to the subsequence ranging from the tail of the first entity to the head of the second entity. For the global context, the LSTM and multi-head attention mechanism consistent with the extraction layer are used to obtain it. The difference is that the Query of the multi-head attention here is the concatenation of the two entity vectors in the relation. Finally, the two entity vectors, local context information and global context information in the relation are concatenated and sent to a feedforward neural network, and then the Softmax function is used to determine whether there is a relationship between the two entities.

[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0110] Based on the same inventive concept, the embodiment of the present application also provides a function point extraction device based on entity extraction and relationship extraction for implementing the function point extraction method based on entity extraction and relationship extraction involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the function point extraction device based on entity extraction and relationship extraction provided below can refer to the limitations of the function point extraction method based on entity extraction and relationship extraction above, and will not be repeated here.

[0111] In an exemplary embodiment, Figure 6 As shown, a function point extraction device based on entity extraction and relationship extraction is provided, comprising:

[0112] The text processing module 601 is used to obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain the demand text sentences;

[0113] The model processing module 602 is used to input the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model;

[0114] The entity extraction module 603 is used to obtain the query vector of the attention mechanism, predict the word embedding sequence based on the long short-term memory model, obtain the key vector and value vector of the attention mechanism, perform vector concatenation on the query vector, the key vector and the value vector to obtain a concatenated new vector, and perform entity extraction in the new vector to obtain an entity set;

[0115] The relationship acquisition module 604 is used to acquire the candidate relationship existing in the entity set, and determine the two target entities corresponding to the candidate relationship, as well as the local context information and the global context information between the two target entities;

[0116] The relationship extraction module 605 is used to perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

[0117] In one embodiment, the entity extraction module 603 is also used to identify existing tag subsequences in the requirement text as spans; input the spans into the long short-term memory model for calculation to obtain the meaning representation of the spans; and generate a query vector of the attention mechanism based on the meaning representation.

[0118] In one embodiment, the entity extraction module 603 is also used to perform multi-head attention calculation based on the query vector, key vector and value vector; obtain a weighted global context representation according to the multi-head attention calculation results; and perform vector concatenation on the query vector and the global context representation to obtain a new vector.

[0119] In one embodiment, the entity extraction module 603 is also used to input the new vector into a preset first feedforward neural network, and perform entity judgment on the new vector by the first activation function in the first feedforward neural network to obtain an entity judgment result; when the entity judgment result is that the new vector belongs to an entity, determine the entity type of the entity; based on the entity judgment result and the entity type, integrate to obtain an entity set.

[0120] In one embodiment, the relationship extraction module 605 is also used to input the relationship vector into a preset second feedforward neural network, and the second activation function in the second feedforward neural network performs relationship judgment on the relationship vector to obtain a relationship judgment result; when the relationship judgment result is an association relationship between two target entities, determine the relationship type of the association relationship; and obtain a relationship extraction result based on the association relationship and the relationship type.

[0121] In one embodiment, the relationship acquisition module 604 is also used to determine the first entity and the second entity in the two target entities; use a preset recurrent neural network model to obtain a subsequence starting from the tail of the first entity and ending at the head of the second entity as local context information; based on a multi-head attention mechanism and using a long short-term memory model, the two target entities are processed to obtain global context information.

[0122] Each module in the above-mentioned function point extraction device based on entity extraction and relationship extraction can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.

[0123] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store demand text data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a function point extraction method based on entity extraction and relationship extraction is implemented.

[0124] Those skilled in the art will understand that Figure 7The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0125] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0126] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0127] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0128] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0129] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0130] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0131] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A function point extraction method based on entity extraction and relationship extraction, characterized in that: The method comprises: Acquire the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain demand text sentences; Inputting the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model; Obtaining a query vector of the attention mechanism, predicting the word embedding sequence based on a long short-term memory model to obtain a key vector and a value vector of the attention mechanism, performing vector concatenation on the query vector, the key vector and the value vector to obtain a concatenated new vector, and performing entity extraction in the new vector to obtain an entity set; Acquire candidate relations existing in the entity set, and determine two target entities corresponding to the candidate relations, as well as local context information and global context information between the two target entities; The two target entities, the local context information and the global context information are spliced ​​to obtain a spliced ​​relationship vector, and relationship extraction is performed on the relationship vector to obtain a relationship extraction result.

2. The method according to claim 1, characterized in that The query vector of the attention mechanism is obtained, including: identifying a subsequence of tokens existing in the requirement text as a span; Inputting the span into the long short-term memory model for calculation to obtain a meaning representation of the span; Based on the meaning representation, the query vector of the attention mechanism is generated.

3. The method according to claim 1, characterized in that: The step of performing vector concatenation on the query vector, the key vector, and the value vector to obtain a concatenated new vector includes: Performing multi-head attention calculation based on the query vector, the key vector and the value vector; According to the multi-head attention calculation results, the weighted global context representation is obtained; Vector concatenation is performed on the query vector and the global context representation to obtain the new vector.

4. The method according to claim 3, characterized in that The entity extraction is performed in the new vector to obtain an entity set, including: Inputting the new vector into a preset first feedforward neural network, performing entity judgment on the new vector by a first activation function in the first feedforward neural network, and obtaining an entity judgment result; When the entity determination result is that the new vector belongs to an entity, determining the entity type of the entity; The entity set is obtained by integrating the entity judgment result and the entity type.

5. The method according to claim 1, characterized in that The performing relationship extraction on the relationship vector to obtain a relationship extraction result includes: Inputting the relationship vector into a preset second feedforward neural network, and performing relationship judgment on the relationship vector by a second activation function in the second feedforward neural network to obtain a relationship judgment result; When the relationship judgment result is that there is an association relationship between the two target entities, determining the relationship type of the association relationship; The relationship extraction result is obtained according to the association relationship and the relationship type.

6. The method according to any one of claims 1 to 5, characterized in that: The determining of the two target entities corresponding to the candidate relationship, and the local context information and the global context information between the two target entities, includes: Determine a first entity and a second entity among the two target entities; Using a preset recurrent neural network model, obtaining a subsequence starting from the tail of the first entity and ending at the head of the second entity as the local context information; Based on the multi-head attention mechanism and utilizing the long short-term memory model, the two target entities are processed to obtain the global context information.

7. A function point extraction device based on entity extraction and relationship extraction, characterized in that: The device comprises: A text processing module is used to obtain the demand text to be processed, perform text cleaning on the demand text, and perform sentence processing on the cleaned text to obtain demand text sentences; A model processing module, used for inputting the demand text sentence into a preset word embedding model to obtain a word embedding sequence output by the word embedding model; An entity extraction module is used to obtain a query vector of an attention mechanism, predict the word embedding sequence based on a long short-term memory model, obtain a key vector and a value vector of the attention mechanism, perform vector concatenation on the query vector, the key vector and the value vector to obtain a concatenated new vector, and perform entity extraction in the new vector to obtain an entity set; A relationship acquisition module, used to acquire candidate relationships existing in the entity set, and determine two target entities corresponding to the candidate relationships, as well as local context information and global context information between the two target entities; The relationship extraction module is used to perform information splicing on the two target entities, the local context information and the global context information to obtain a spliced ​​relationship vector, perform relationship extraction on the relationship vector, and obtain a relationship extraction result.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.