Method and system for automatically compiling user manual based on neural network model
By automatically compiling the user manual through a semantic extraction model based on the BERT model and the CRF neural network, the problem of low efficiency in user manual writing in the existing technology is solved, and efficient and accurate user manual generation is achieved.
Patent Information
- Application Number
- CN202510317720.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-03-18
AI Technical Summary
The writing of software user manuals requires professionals to write them word for word. The process is tedious and error-prone, consumes a lot of manpower and time, and is difficult to improve efficiency and accuracy.
A semantic extraction model based on the BERT model and CRF neural network is used. By setting the user manual template and the semantic extraction model for training and fine-tuning, entity information in the development document is extracted and filled into the user manual template to generate a complete user manual.
Automatically generate natural language paragraphs for each content module of the user manual, saving developers time, improving the efficiency and accuracy of user manual compilation, reducing the difficulty of entity extraction, and overcoming the training data density problem caused by different software specificities.
Smart Images

Figure CN120218038B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of generative large model technology, and specifically relates to a method and system for automatically compiling a user manual based on a neural network model. Background Art
[0002] In the fiercely competitive software development industry, efficiency and quality are key to a company's survival. Software user manuals serve as an important bridge between products and users, and optimizing their compilation process is crucial for software development companies. Writing software user manuals requires a certain level of professionalism, making it difficult for non-professionals to write. Professionals are required to write them word for word, from functional descriptions to operational steps. The process is tedious and error-prone, and consumes a lot of manpower and time. Improving the efficiency and accuracy of software user manual writing and saving developers' time are technical issues that the industry urgently needs to address. Summary of the Invention
[0003] The present application provides a method and system for automatically compiling a user manual based on a neural network model to solve or partially solve the problems raised in the above background technology.
[0004] This application provides a method for automatically compiling a user manual based on a neural network model, comprising the following steps:
[0005] S1: Set up a user manual template and a semantic extraction model based on the BERT model and CRF neural network, and train and fine-tune the semantic extraction model;
[0006] S2: The semantic extraction model receives development document data, extracts entity information related to the user manual from the development document, and populates the entity information into the user manual template to generate a complete user manual;
[0007] Set phrase replacement positions and text replacement positions in the user manual template, and use the semantic extraction model to extract entity information that matches the corresponding positions one by one.
[0008] Preferably, in step S1, the specific method of setting the user manual template is as follows:
[0009] The phrases to be replaced in each phrase replacement position and the continuous text to be replaced in the text replacement position are marked as sample fields to be filled, and the remaining contents in each paragraph are auxiliary fields.
[0010] Set a semantic identification label for each example field to be filled.
[0011] Preferably, in step S1, the training and fine-tuning method of the semantic extraction model includes:
[0012] A custom entity type based on the example fields to be filled in the user manual template is as follows:
[0013] Define phrase feature entity types and paragraph feature entity types, corresponding to the phrase content and text content required by the user manual respectively;
[0014] For phrase feature entity types, add qualifying feature words to their actual entity types;
[0015] For paragraph feature entity types, a label summary with a limited number of words is set as the entity type name, and paragraph feature entities with a word count greater than the preset word count M are split into multiple paragraph sub-entities and the relationship between the sub-entities is defined, where M is the preset word count threshold.
[0016] Preferably, in step S2, the specific method for the semantic extraction model to extract entity information related to the user manual in the development document is as follows:
[0017] Preprocess the input text, construct a complete input sequence, and input the input sequence into the BERT model;
[0018] Through the multi-layer Transformer structure of the BERT model, deep feature extraction is performed on the input sequence to obtain the semantic representation vector of each group of tokens;
[0019] Use the CRF layer to predict the label of the semantic representation vector of the token, calculate the probability distribution of each token belonging to different entity categories, and select the entity category with the highest probability;
[0020] Filter the sub-entities of the paragraph feature entity, calculate the relationship scores between sub-entities, extract entity pairs with sub-entity spacing ≤ N in the context, perform vector splicing and MLP processing on the entity pairs, and calculate the score of each relationship between entities:
[0021]
[0022] In the formula, r represents the relationship type, ei and ej are entity representation vectors, and Context is the BERT encoding of the text between the two entities. Represents vector concatenation;
[0023] Perform Softmax normalization on the score S(r|ei,ej) and take the highest probability relationship type;
[0024] The paragraph sub-entities are merged according to the identified relationships, and finally the paragraph feature entity and phrase feature entity are output. N is the preset sub-entity number threshold.
[0025] Preferably, an entity-assisted retrieval model is set in parallel with the CRF neural network in the semantic extraction model to cooperate with the CRF neural network to identify paragraph feature entities and their sub-entities. The specific method of entity recognition of the entity-assisted retrieval model is as follows:
[0026] Create a mapping dictionary D between the semantic vectors transformed by BERT in the training set and the custom entity type.
[0027]
[0028] Among them, Si represents the semantic vector, yi represents the entity type, and N represents the total number of entity types;
[0029] The semantic representation vector is input into the entity-assisted retrieval model, and the top-K nearest neighbors of the vector are filtered using cosine similarity.
[0030]
[0031] Where Nt represents the set of nearest neighbors, K represents the number of nearest neighbors, rank is the sorting function from high to low, St is the input vector, and (Sj, yj) is the key-value pair in D;
[0032] Use radial basis function RBF to assign similarity weights to the neighbor set to generate entity type probability distribution Pknn,
[0033]
[0034] Where Xt is the input sample, C is the entity type, σ is the bandwidth parameter in RBF, and its default value is 0.5. It controls the influence of the weight of neighboring samples on the final vote. The smaller σ is, the faster the weight decays with increasing distance. The value of σ is adjusted through pre-training. I is the indicator function, which takes 1 when the condition is met and 0 otherwise.
[0035] Preferably, the semantic representation vector output by the BERT model is simultaneously input into the CRF neural network and the entity-assisted retrieval model to obtain the entity type probability distribution Pcrf based on the CRF and the entity type probability distribution Pknn based on the entity-assisted retrieval model, respectively. The two probability distributions are combined based on weighted voting to generate the final probability distribution. The specific formula is as follows:
[0036] P final (y t )=λ t ·P crf (y t )+(1-λ t )·P knn (y t ),
[0037] Among them, yt represents the entity type, λt represents the weight coefficient, and the entity type with the highest probability is selected.
[0038] Preferably, in step S2, after obtaining the paragraph feature entity and the phrase feature entity, the specific method of filling each entity into the user manual template is:
[0039] For phrase feature entities, semantic matching is performed between the entity type of the phrase feature entity and the semantic identification label of each phrase-to-be-filled example field, and the phrase feature entity is filled and covered to the corresponding position;
[0040] For the paragraph feature entity, its label summary is semantically matched with the semantic identification label of each text-to-be-filled example field, and the paragraph feature entity is filled in the corresponding position.
[0041] Preferably, when multiple paragraph feature entities of the same type are identified, a similarity comparison is performed between the example field to be filled corresponding to the semantic identification tag and the text contents of the multiple feature entities, and the feature entity with the highest similarity is selected to match the corresponding filling position.
[0042] Preferably, the content modules of the user manual template include cover, preface, installation configuration, functional use cases, interface introduction, and data management.
[0043] This application also provides a user manual automatic compilation system based on a neural network model, including: a model construction module, an entity extraction module, and a matching insertion module;
[0044] The model construction module generates a semantic extraction model based on the BERT model and the CRF neural network, and sets up an entity-assisted retrieval model in parallel with the CRF neural network. It receives software document data for training, uses open source annotation tools to perform BIO annotation on the software document data, and divides the annotated data into training, validation, and test sets to complete the construction and training of the semantic extraction model.
[0045] The semantic extraction module uses the semantic extraction model to receive the target development document data and extract entity information related to the user manual in the development document;
[0046] The matching and insertion module matches and fills the identified entity information with the example fields to be filled in the user manual template one by one to generate a complete user manual.
[0047] Compared with the prior art, this application has the following beneficial effects:
[0048] (1) This application sets phrase replacement positions and text replacement positions in the user manual template, and uses a semantic extraction model based on the BERT model plus a CRF neural network to automatically generate complete natural language paragraphs corresponding to each content module of the user manual by combining entity information that matches the corresponding positions in the development document with the original auxiliary fields, thereby saving developers' time and improving the efficiency of compiling the user manual.
[0049] (2) This application divides two types of custom entities based on word count to fill in the user manual template, adapting to the setting structure of auxiliary content plus professional content of the user manual, decomposing the entity extraction task, and reducing the difficulty of entity extraction.
[0050] (3) This application sets up an entity-assisted retrieval model in parallel with CRF based on a clustering algorithm, which is helpful to overcome the training data density problem caused by different software specificities and improves the recognition accuracy of paragraph feature entities. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The present application is further described below with reference to the accompanying drawings and examples.
[0052] Figure 1 This is a schematic diagram of the system composition of this application.
[0053] Figure 2 Schematic diagram of the method flow of this application. DETAILED DESCRIPTION
[0054] For example, certain words are used in the specification and claims to refer to specific components. Those skilled in the art should understand that hardware manufacturers may use different terms to refer to the same component. This specification and claims do not use differences in names as a way to distinguish components, but use differences in the functions of the components as the criteria for distinction. For example, "including" mentioned throughout the specification and claims is an open term, so it should be interpreted as "including but not limited to". "Approximately" means that within an acceptable error range, those skilled in the art can solve the technical problem within a certain error range and basically achieve the technical effect.
[0055] In the description of the present application, it should be understood that the terms "upper", "lower", "front", "rear", "left", "right", "horizontal", etc., indicating directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings and are only used to facilitate the description of the present application and simplify the description. They do not indicate or imply that the devices or elements referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, they should not be understood as limiting the present application.
[0056] In this application, unless otherwise specified or limited, the terms "mounted," "connected," "connect," "fixed," etc. should be understood broadly. For example, they can refer to fixed connection, detachable connection, or integral connection; mechanical connection or electrical connection; direct connection or indirect connection through an intermediate medium; or internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in this application based on specific circumstances.
[0057] Example 1
[0058] like Figures 1 to 2 As shown, this application provides a method for automatically compiling a user manual based on a neural network model, and the specific steps are as follows:
[0059] S1: Set up a user manual template and a semantic extraction model based on the BERT model and CRF neural network, and train and fine-tune the semantic extraction model;
[0060] S2: The semantic extraction model receives development document data, extracts entity information related to the user manual in the development document, and fills the entity information into the user manual template to generate a complete user manual.
[0061] Specifically, development documents refer to various types of document data during the development, testing, and practical processes.
[0062] Specifically, the BERT model, or bidirectional encoder representation, is a pre-trained language model that can capture bidirectional semantic information in text and performs well in natural language processing tasks such as question answering, text classification, and semantic similarity comparison. CRF, or conditional random field, is an undirected graph model that is commonly used in sequence labeling tasks. It can take into account contextual information and improve labeling accuracy in part-of-speech tagging and named entity recognition.
[0063] In practice, a software user manual generally includes the following:
[0064] Cover: Contains information such as the software name, version number, manual title, release date, and copyright statement, such as "XX Office Software V1.0 User Manual," to give users a preliminary overall understanding of the software and manual;
[0065] Preface: Includes the purpose of writing, applicable objects, and software overview, briefly introducing the applicable population of the manual and the software functions, features, and application scenarios;
[0066] Installation and configuration: software, hardware environment and installation and configuration instructions required for software installation;
[0067] Functional use case: including functional module division, functional description, and operation process;
[0068] Interface introduction: introduce the overall interface layout of the software, such as menu bar, toolbar, workspace, status bar, etc.
[0069] Data management: data entry, storage, backup and recovery.
[0070] Some user manuals also include troubleshooting, shortcut key lists, etc.
[0071] Set up a user manual template based on the content modules (cover, preface, functional use cases, etc.) of the above software user manual, and adjust the content modules of the template according to the type of software to be generated. The specific setting method is as follows:
[0072] S101: setting phrase replacement positions and text replacement positions in the natural language paragraphs corresponding to each content module;
[0073] S102: Mark the phrases to be replaced in each phrase replacement position and the continuous text to be replaced in the text replacement position as sample fields to be filled, and the remaining content in each paragraph as auxiliary fields;
[0074] S103: Setting a semantic identification tag for each example field to be filled.
[0075] The phrase replacement position and text replacement position are set based on the word count classification of the sample field to be filled. Different placeholders can be added at the beginning and end of the phrase replacement position and text replacement position to distinguish them. The placeholders are removed after filling is completed.
[0076] In the user manual, the importance, professionalism and versatility of each content module are different. For example, the description consistency of each content paragraph in the cover and preface is high in different user manuals, and its role in the user manual is also auxiliary. It is only necessary to simply replace some phrases (such as the customer company name, software name, etc.) to achieve the reuse of the content paragraph. On the contrary, for more professional content paragraphs, such as functional use cases, data storage, etc., the user manuals of different software are quite different, and there are fewer universal descriptions. It is necessary to set the text replacement position to achieve accurate description. It is obvious that, for example, for each auxiliary paragraph in the cover and preface, several phrase replacement positions are set, and almost no text replacement position is set. The proportion of auxiliary fields in the paragraph is high. For example, professional paragraphs such as functional use cases require text replacement positions, and the proportion of auxiliary fields in the paragraph is low.
[0077] The positions of each phrase replacement and text replacement are the positions where the entity information that needs to be extracted by the semantic extraction model is inserted. The specific content is the example description of the same type of software at the corresponding position. For example, the phrase corresponding to the customer's company name in the example field to be filled is "xxxx Company". The setting of the semantic identification tag is to match the entity information and the example field to be filled one by one. Its content is a description of the semantic features of the entity at the replacement position.
[0078] Pre-train the neural network-based semantic extraction model using relevant software document data to enable the module to better understand the professional terminology and contextual information in the software field. The specific method for training and fine-tuning the semantic extraction model is as follows:
[0079] S111: Customize the entity type based on the content to be filled in the user manual template (example fields to be filled), as follows:
[0080] Define phrase feature entity types and paragraph feature entity types, corresponding to the phrase content and text content required by the user manual respectively;
[0081] For phrase feature entity types, add qualifying feature words to their actual entity types;
[0082] For paragraph feature entity types, set a label summary with a limited number of words as the entity type name, split paragraph feature entities with a word count greater than the preset word count M into multiple paragraph sub-entities, and define the relationship between the sub-entities;
[0083] S112: Obtain a software document dataset, perform BIO annotation on the software document data using an open source annotation tool, divide the annotated data into a training set, a validation set, and a test set, and set a validation accuracy threshold and a prediction accuracy threshold;
[0084] S113: Using the training set data to train the semantic extraction model;
[0085] S114: Evaluate the recognition accuracy of the document parsing model for entities and relationships using the validation set data. If the recognition accuracy is greater than the validation accuracy, proceed to step S115; otherwise, return to step S113.
[0086] S115: Use the test set data to test the semantic extraction model. If the accuracy of entity and relationship recognition is less than the prediction accuracy threshold, return to step S113 and adjust the hyperparameters of the semantic extraction model. Otherwise, end the training.
[0087] In step S111, the phrase feature entity type refers to various phrase words that need to be filled in the user manual template, such as customer company name, developer, shortcut key combination, software name, special function module name, development software or platform name, various open source algorithm modules and interface names, etc. Adding limiting feature words to the phrase feature entity means adding modifications to the general phrase entity type name to narrow its type range. For example, the format of the "developer name" entity is "developer + name", and the format of the "customer company" entity is "customer plus company name"; the paragraph feature entity type refers to the various text filling contents required in the user manual template, such as the login process paragraph in the functional use case, etc. Extracting the title summary is to name the paragraph entity, which facilitates the filling of the identified entity into the user manual template. The sub-entity division is to reduce the difficulty of complex entity recognition and adapt to the input length limit of the BERT model (generally 512 tokens, equivalent to a content length of 300 to 500 Chinese characters). The setting of the sub-entity relationship is to clarify the nested relationship between the sub-entity and the paragraph entity and the sorting of the sub-entities into the paragraph entity, so as to facilitate the combination of the sub-entities into paragraph feature entities after identification.
[0088] Specifically, in step S2, the semantic extraction model extracts entity information related to the user manual in the development document in the following manner:
[0089] S201: Preprocess the input text by segmenting the software development document into sentences or paragraphs, ensuring that each segment fits within the BERT model's input length limit (typically 512 tokens). Use BERT's Tokenizer to perform word segmentation on the segmented text, converting the text into a token sequence acceptable to the model.
[0090] S202: Model input: First, construct the input sequence, add a special tag [CLS] (classification tag) at the beginning of the token sequence, and add a [SEP] (separator) tag between sentences to construct a complete input sequence. The constructed input sequence is fed into the pre-trained BERT model.
[0091] S203: Acquiring semantic representation vectors: First, feature extraction is performed. Through the multi-layer Transformer structure of the BERT model, deep feature extraction is performed on the input sequence to obtain the semantic representation vector of each group of tokens. By leveraging the bidirectional encoding capability of BERT, the semantic representation vector of each group of tokens is integrated with its contextual information.
[0092] S204: Conditional Random Field (CRF) decoding: Use the CRF layer to predict labels for the semantic representation vector of the token, taking into account the dependencies between labels to obtain the globally optimal label sequence. Based on the CRF decoding results, calculate the probability distribution of each token belonging to different entity categories and select the entity category with the highest probability.
[0093] S205: Filter the sub-entities of the paragraph feature entity, calculate the relationship scores between the sub-entities, extract entity pairs with sub-entity spacing ≤ N in the context, perform vector concatenation and MLP processing on the entity pairs, and calculate the score of each relationship between the entities:
[0094]
[0095] In the formula, r represents the relationship type, ei and ej are entity representation vectors, and Context is the BERT encoding of the text between the two entities. Represents vector concatenation;
[0096] S206: Perform Softmax normalization on the score S(r|ei,ej) and take the highest probability relationship type;
[0097] S207: Merge the paragraph sub-entities according to the identified relationships, and finally output the paragraph feature entity and the phrase feature entity.
[0098] M and N are preset thresholds.
[0099] Specifically, after obtaining the paragraph feature entity and the phrase feature entity, each entity is filled into the user manual template. For the phrase feature entity, the entity type of the phrase feature entity (including the limiting feature word) is semantically matched with the semantic identification label of each phrase-to-be-filled example field, and the phrase feature entity is filled and covered to the corresponding position; for the paragraph feature entity, its label summary is semantically matched with the semantic identification label of each text-to-be-filled example field, and the paragraph feature entity is filled into the corresponding position.
[0100] This application sets semantic tags, and the ideal state is to achieve a one-to-one correspondence between entities and each example field to be filled. To achieve this goal, it is only necessary to set the limiting feature words of the phrase feature entity and the label summary of the paragraph feature entity to be consistent with the semantic identification label. However, due to the complexity of the paragraph feature entity, multiple paragraph feature entities of the same type may be identified. In this regard, as an optimal technical solution, when this happens, the text content of the example field to be filled corresponding to the semantic identification label and multiple feature entities is compared for similarity, and the feature entity with the highest similarity is selected to match the corresponding filling position.
[0101] The specific algorithm for similarity comparison can utilize existing algorithm modules. Various algorithm modules, including the BERT model, can perform similarity comparison operations, which will not be described in detail here.
[0102] Example 2
[0103] This embodiment is based on Example 1. In Example 1, the present application uses software development document data to train and fine-tune the semantic extraction model based on the BERT model and the CRF neural network, so that it can recognize the paragraph feature entities and their sub-entities of the user manual template. Due to the high complexity of the paragraph feature entities and the specificity of the functions between different software, there is less data for specific software function paragraphs, and the semantic extraction model is prone to the long-tail problem, that is, it performs well in recognizing high-frequency common entities (head data), but its recognition ability for low-frequency, diverse entities (tail data) is significantly reduced.
[0104] Based on the above problems, this application sets up an entity-assisted retrieval model in parallel with the CRF neural network in the semantic extraction model to cooperate with the CRF neural network to identify paragraph feature entities and their sub-entities. The specific method is as follows:
[0105] Create a mapping dictionary D between the semantic vectors transformed by BERT in the training set and the custom entity type.
[0106]
[0107] Among them, Si represents the semantic vector, yi represents the entity type, and N represents the total number of entity types;
[0108] When extracting using the semantic extraction model, in step S204, the semantic representation vector of each group of Tokens is simultaneously input into the CRF neural network and the entity assisted retrieval model to obtain its CRF-based entity type probability distribution P respectively. crf And the entity type probability distribution P based on the entity-assisted retrieval model knn , based on weighted voting, the two probability distributions are combined to generate the final probability distribution. The specific formula is as follows:
[0109] P final (y t )=λ t ·P crf (y t )+(1-λ t )·P knn (y t ),
[0110] Among them, y t Represents the entity type, λ t Represents the weight coefficient, selecting the entity type with the highest probability;
[0111] The semantic representation vector is input into the entity-assisted retrieval model, and the top-K nearest neighbors of the vector are filtered using cosine similarity.
[0112]
[0113] Among them, N t represents the set of nearest neighbors, K represents the number of nearest neighbors, rank is the sorting function from high to low, S t is the input vector, (S j ,y j ) is a key-value pair in D;
[0114] Use radial basis function RBF to assign similarity weights to the neighbor set to generate entity type probability distribution P knn ,
[0115]
[0116] Where Xt is the input sample, C is the entity type, σ is the bandwidth parameter in RBF, and its default value is 0.5. It controls the influence of the weight of neighboring samples on the final vote. The smaller σ is, the faster the weight decays with increasing distance. The value of σ is adjusted through pre-training. I is the indicator function, which takes 1 when the condition is met and 0 otherwise.
[0117] Example 3
[0118] This embodiment, based on Embodiment 1 and Embodiment 2, provides a user manual automatic compilation system based on a neural network model, which can implement the user manual automatic compilation system in Embodiment 1 and Embodiment 2, including a model construction module, an entity extraction module, and a matching insertion module.
[0119] The model construction module generates a semantic extraction model based on the BERT model and the CRF neural network, and sets up an entity-assisted retrieval model in parallel with the CRF neural network. It receives software document data for training, uses open source annotation tools to perform BIO annotation on the software document data, and divides the annotated data into training, validation, and test sets to complete the construction and training of the semantic extraction model.
[0120] The semantic extraction module uses the semantic extraction model to receive the target development document data and extract entity information related to the user manual in the development document;
[0121] The matching and insertion module matches and fills the identified entity information with the example fields to be filled in the user manual template one by one to generate a complete user manual.
[0122] The above describes the implementation methods of the present application in detail in conjunction with the accompanying drawings, but the present application is not limited to the above implementation methods. Various changes can be made within the scope of knowledge possessed by ordinary technicians in the relevant technical field without departing from the purpose of the present application.
Claims
1. A method for automatically compiling a user manual based on a neural network model, characterized in that: The steps include: S1: Set up a user manual template and a semantic extraction model based on the BERT model and CRF neural network, and train and fine-tune the semantic extraction model; S2: The semantic extraction model receives development document data, extracts entity information related to the user manual from the development document, and populates the entity information into the user manual template to generate a complete user manual; Set phrase replacement positions and text replacement positions in the user manual template, and use the semantic extraction model to extract entity information that matches the corresponding positions one by one; In the semantic extraction model, an entity-assisted retrieval model is set up in parallel with the CRF neural network to cooperate with the CRF neural network to identify paragraph feature entities and their sub-entities. The specific method of entity recognition in the entity-assisted retrieval model is as follows: Create a mapping dictionary D between the semantic vectors transformed by BERT in the training set and the custom entity type. Among them, Si represents the semantic vector, yi represents the entity type, and N represents the total number of entity types; The semantic representation vector is input into the entity-assisted retrieval model, and the top-K nearest neighbors of the vector are filtered using cosine similarity. Where Nt represents the set of nearest neighbors, K represents the number of nearest neighbors, rank is the sorting function from high to low, St is the input vector, and (Sj, yj) is the key-value pair in D; Use radial basis function RBF to assign similarity weights to the neighbor set to generate entity type probability distribution Pknn, Where Xt is the input sample, C is the entity type, σ is the bandwidth parameter in RBF, and its default value is 0.
5. It controls the influence of the weight of the neighboring samples on the final vote. The smaller σ is, the faster the weight decays with increasing distance. The value of σ is adjusted through pre-training. I is the indicator function, which takes 1 when the condition is met and 0 otherwise. The semantic representation vector output by the BERT model is input into the CRF neural network and the entity-assisted retrieval model at the same time to obtain the entity type probability distribution Pcrf based on CRF and the entity type probability distribution Pknn based on the entity-assisted retrieval model respectively. The two probability distributions are combined based on weighted voting to generate the final probability distribution. The specific formula is as follows: P final (y)=λ t ·P crf (y t )+(1-λ t )·P knn (y t ), Among them, yt represents the entity type, λt represents the weight coefficient, and the entity type with the highest probability is selected.
2. The method for automatically compiling a user manual based on a neural network model according to claim 1, characterized in that: In step S1, the specific method of setting the user manual template is as follows: Mark the phrases to be replaced in each phrase replacement position and the continuous text to be replaced in the text replacement position as sample fields to be filled, and the remaining contents in each paragraph as auxiliary fields; Set a semantic identification label for each example field to be filled.
3. The method for automatically compiling a user manual based on a neural network model according to claim 2, characterized in that: In step S1, the training and fine-tuning method of the semantic extraction model includes: A custom entity type based on the example fields to be filled in the user manual template is as follows: Define phrase feature entity types and paragraph feature entity types, corresponding to the phrase content and text content required by the user manual respectively; For phrase feature entity types, add qualifying feature words to their actual entity types; For paragraph feature entity types, a label summary with a limited number of words is set as the entity type name, and paragraph feature entities with a word count greater than the preset word count M are split into multiple paragraph sub-entities and the relationship between the sub-entities is defined, where M is the preset word count threshold.
4. The method for automatically compiling a user manual based on a neural network model according to claim 3, characterized in that: In step S2, the specific method for the semantic extraction model to extract entity information related to the user manual in the development document is as follows: Preprocess the input text, construct a complete input sequence, and input the input sequence into the BERT model; Through the multi-layer Transformer structure of the BERT model, deep feature extraction is performed on the input sequence to obtain the semantic representation vector of each group of tokens; Use the CRF layer to predict the label of the semantic representation vector of the token, calculate the probability distribution of each token belonging to different entity categories, and select the entity category with the highest probability; Filter the sub-entities of the paragraph feature entity, calculate the relationship scores between sub-entities, extract entity pairs with sub-entity spacing ≤ N in the context, perform vector splicing and MLP processing on the entity pairs, and calculate the score of each relationship between entities: In the formula, r represents the relationship type, ei and ej are entity representation vectors, and Context is the BERT encoding of the text between the two entities. Represents vector concatenation; Perform Softmax normalization on the score S(r|ei,ej) and take the highest probability relationship type; The paragraph sub-entities are merged according to the identified relationships, and finally the paragraph feature entity and phrase feature entity are output. N is the preset sub-entity number threshold.
5. The method for automatically compiling a user manual based on a neural network model according to claim 4, characterized in that: In step S2, after obtaining the paragraph feature entity and the phrase feature entity, the specific method of filling each entity into the user manual template is as follows: For phrase feature entities, semantic matching is performed between the entity type of the phrase feature entity and the semantic identification label of each phrase-to-be-filled example field, and the phrase feature entity is filled and covered to the corresponding position; For the paragraph feature entity, its label summary is semantically matched with the semantic identification label of each text-to-be-filled example field, and the paragraph feature entity is filled in the corresponding position.
6. The method for automatically compiling a user manual based on a neural network model according to claim 5, characterized in that: When multiple paragraph feature entities of the same type are identified, a similarity comparison is performed between the to-be-filled example field corresponding to the semantic identification tag and the text content of the multiple feature entities, and the feature entity with the highest similarity is selected to match the corresponding filling position.
7. The method for automatically compiling a user manual based on a neural network model according to any one of claims 1 or 2, characterized in that: The content modules of the user manual template include cover, preface, installation configuration, functional use cases, interface introduction, and data management.
8. The user manual automatic compilation system based on the neural network model is characterized by: include: Model building module, entity extraction module, matching insertion module; The model construction module generates a semantic extraction model based on the BERT model and the CRF neural network, and sets up an entity-assisted retrieval model in parallel with the CRF neural network. It receives software document data for training, uses open source annotation tools to perform BIO annotation on the software document data, and divides the annotated data into training, validation, and test sets to complete the construction and training of the semantic extraction model. The semantic extraction module uses the semantic extraction model to receive the target development document data and extract entity information related to the user manual in the development document; The matching and insertion module matches and fills the identified entity information with the example fields to be filled in the user manual template one by one to generate a complete user manual; The specific method of entity recognition in the entity-assisted retrieval model is as follows: Create a mapping dictionary D between the semantic vectors transformed by BERT in the training set and the custom entity type. Among them, Si represents the semantic vector, yi represents the entity type, and N represents the total number of entity types; The semantic representation vector is input into the entity-assisted retrieval model, and the top-K nearest neighbors of the vector are filtered using cosine similarity. Where Nt represents the set of nearest neighbors, K represents the number of nearest neighbors, rank is the sorting function from high to low, St is the input vector, and (Sj, yj) is the key-value pair in D; Use radial basis function RBF to assign similarity weights to the neighbor set to generate entity type probability distribution Pknn, Where Xt is the input sample, C is the entity type, σ is the bandwidth parameter in RBF, and its default value is 0.
5. It controls the influence of the weight of the neighboring samples on the final vote. The smaller σ is, the faster the weight decays with increasing distance. The value of σ is adjusted through pre-training. I is the indicator function, which takes 1 when the condition is met and 0 otherwise. The semantic representation vector output by the BERT model is input into the CRF neural network and the entity-assisted retrieval model at the same time to obtain the entity type probability distribution Pcrf based on CRF and the entity type probability distribution Pknn based on the entity-assisted retrieval model respectively. The two probability distributions are combined based on weighted voting to generate the final probability distribution. The specific formula is as follows: P final (y t )=λ t ·P crf (y t )+(1-λ t )·P knn (y t ), Among them, y t Represents the entity type, λt represents the weight coefficient, and the entity type with the highest probability is selected.
Citation Information
Patent Citations
Intelligent compilation method, system and equipment for bid inviting file and storage medium
CN117893295A
Text extraction method, apparatus, and device, and storage medium
WO2021051871A1