Method and related device for named entity recognition based on government industry large model

By building a large model for the government industry based on the BERT model, the adaptability and accuracy issues of named entity recognition methods for government information when facing new language phenomena and entities are solved, and efficient named entity recognition of government information is achieved.

CN119783674BActive Publication Date: 2025-10-10SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510004692.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-02
Publication Date
2025-10-10
Estimated Expiration
2045-01-02

AI Technical Summary

Technical Problem

Existing named entity recognition methods for government information are difficult to cover new linguistic phenomena and entities in real time, resulting in poor adaptability and accuracy.

Method used

Build a large model for the government industry based on the BERT model, establish a highly adaptable named entity recognition system through data screening, preprocessing, training tasks, performance evaluation and other steps, use self-attention or multi-head attention mechanism to fine-tune the model, and select the candidate model with the best performance for named entity recognition.

Benefits of technology

The accuracy and adaptability of named entity recognition have been improved, and it can identify new linguistic phenomena and entities, making it suitable for real-time processing of government information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783674B_ABST
    Figure CN119783674B_ABST
Patent Text Reader

Abstract

The application provides a government industry large model-based named entity recognition method and related equipment, the method comprising: screening each government text of a target government field in an initial data set; performing data preprocessing on each government text; constructing a sample data set based on a training task and the preprocessed government text; training each initial model based on the sample data set to obtain each candidate model; performing performance evaluation on each candidate model to obtain a performance evaluation result of each candidate model; selecting the candidate model with the optimal performance as the government industry large model according to the performance evaluation result; and applying the government industry large model to perform named entity recognition on a government text to be recognized. The method of the application can perform named entity recognition through a model constructed based on sample data of a target government field, the model can also complete named entity recognition on unlearned data based on its learning ability, and the accuracy of named entity recognition can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a named entity recognition method and related equipment based on a large model of the government industry. Background Art

[0002] With the development of information technology, data mining of various government information is increasingly being applied to government affairs, facilitating better government management and decision-making. Named entity recognition (NER) is a key task in this process. Its goal is to identify entities with specific meanings, such as names of people and places, from the corresponding text.

[0003] Currently, in the named entity recognition task of government information, named entity recognition of government information is usually performed based on rules or dictionaries, that is, by manually writing rules or configuring dictionaries, and using rules or dictionaries to identify corresponding entities in the text.

[0004] In real-world applications, however, the government sector is rife with terminology, and new terms and descriptions frequently appear in government information. Existing recognition methods rely on rule definitions or information configured in dictionaries. However, these rules and dictionaries are typically fixed and require manual updating, making it difficult to capture new linguistic phenomena and entities in real time. This results in poor adaptability and accuracy for named entity recognition, hindering data mining of government information. Summary of the Invention

[0005] In view of this, an embodiment of the present invention provides a named entity recognition method based on a large model of the government affairs industry to solve the problem that the existing named entity recognition method of government affairs information is difficult to cover the new language phenomena and entity content in the government affairs field in real time, and the adaptability and accuracy of information recognition are poor.

[0006] The embodiment of the present invention also provides a named entity recognition device based on a large model of the government affairs industry to ensure the actual implementation and application of the above method.

[0007] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:

[0008] A named entity recognition method based on a large model of the government affairs industry includes:

[0009] Determining an initial data set; the initial data set includes a plurality of pre-collected government documents;

[0010] Based on a preset target government affairs field, the initial data set is screened to obtain target government affairs texts corresponding to the target government affairs field;

[0011] Performing data preprocessing on each of the target government documents to obtain each processed government document;

[0012] Determine each training task; each training task includes a named entity recognition task and a part-of-speech tagging task;

[0013] Constructing a sample data set based on each of the training tasks and each of the processed government affairs texts;

[0014] Determine multiple initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture;

[0015] Based on the sample data set, each of the initial models is trained respectively, and each initial model that has completed the training is used as a candidate model;

[0016] Performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model;

[0017] According to the performance evaluation results of each candidate model, the candidate model with the best performance is selected from each candidate model as the government affairs industry macro model;

[0018] The government affairs industry big model is applied to perform named entity recognition on government affairs texts to be identified in the production environment.

[0019] Optionally, the above method includes filtering the initial data set based on a preset target government affairs field to obtain target government affairs texts corresponding to the target government affairs field, including:

[0020] Determine the keywords corresponding to the target government affairs field;

[0021] Based on each of the keywords, a text search is performed on each of the government documents in the initial data set to obtain each of the government documents associated with each of the keywords, and each of the government documents associated with each of the keywords is used as a first candidate text;

[0022] For each government document in the initial data set, a preset government document classification model is applied to classify the government document to obtain a classification result indicating whether the government document belongs to the target government domain; if the classification result indicates that the government document belongs to the target government domain, the government document is selected as a second candidate document;

[0023] For each government document in the initial data set, applying a preset text analysis algorithm to perform text analysis on the government document to obtain a text analysis result indicating whether the government document belongs to the target government domain; if the text analysis result indicates that the government document belongs to the target government domain, then the government document is selected as a third candidate text;

[0024] Integrating each of the first candidate texts, each of the second candidate texts, and each of the third candidate texts to obtain integrated candidate texts;

[0025] Sending the integrated candidate texts to a designated person so that the designated person can review the integrated candidate texts;

[0026] When the designated person receives an instruction to confirm the integrated candidate texts, the integrated candidate texts are used as the target government texts.

[0027] In the above method, optionally, performing data preprocessing on each target government document to obtain each processed government document includes:

[0028] Performing format conversion on each of the target government documents to obtain a first government document corresponding to each of the target government documents;

[0029] Performing data cleaning on each of the first government documents to obtain each of the second government documents corresponding to each of the first government documents;

[0030] performing word segmentation processing on each of the second government affairs documents to obtain a word segmentation result corresponding to each of the second government affairs documents;

[0031] The word segmentation results corresponding to each of the second government affairs texts are used as each of the processed government affairs texts.

[0032] Optionally, in the above method, constructing a sample dataset based on each of the training tasks and each of the processed government documents includes:

[0033] Determining a labeling rule corresponding to each of the training tasks;

[0034] Annotating each of the processed government documents according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government documents;

[0035] According to a preset data enhancement strategy, data enhancement processing is performed on each of the annotated texts to obtain each newly annotated text;

[0036] The sample data set is composed of each of the newly annotated texts and each of the annotated texts.

[0037] Optionally, the method described above includes training each of the initial models based on the sample data set, including:

[0038] Based on the sample data set, determining a training set and a validation set;

[0039] Determine a loss function corresponding to each of the training tasks;

[0040] Constructing a comprehensive loss function based on the loss functions corresponding to each of the training tasks;

[0041] Based on the training set and the validation set, and in accordance with the comprehensive loss function and a preset adaptive learning rate adjustment algorithm, multi-task joint training is performed on each of the initial models.

[0042] In the above method, optionally, performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model includes:

[0043] Based on the sample data set, determining a test set;

[0044] Based on the test set, each candidate model is tested respectively to obtain a test result for each candidate model;

[0045] For each candidate model, based on the test results corresponding to the candidate model, a performance indicator set corresponding to the candidate model is determined, and the performance indicator set is used as the performance evaluation result corresponding to the candidate model. The performance indicator set includes the accuracy, recall rate and F1 value corresponding to the candidate model.

[0046] The above method may optionally further include:

[0047] Monitoring the named entity recognition results of the government affairs industry big model during application;

[0048] Based on the named entity recognition result of the government affairs industry big model, the actual performance of the government affairs industry big model is evaluated to obtain the actual performance evaluation result corresponding to the government affairs industry big model;

[0049] The named entity recognition results and the actual performance evaluation results are stored to facilitate optimization of the government affairs industry big model.

[0050] A named entity recognition device based on a large model of the government affairs industry, comprising:

[0051] A first determining unit is configured to determine an initial data set; the initial data set includes a plurality of pre-collected government documents;

[0052] A data screening unit, configured to screen the initial data set based on a preset target government affairs field to obtain target government affairs texts corresponding to the target government affairs field;

[0053] A preprocessing unit, configured to perform data preprocessing on each target government document to obtain each processed government document;

[0054] A second determining unit is configured to determine each training task; each of the training tasks includes a named entity recognition task and a part-of-speech tagging task;

[0055] A sample construction unit, configured to construct a sample data set based on each of the training tasks and each of the processed government documents;

[0056] A third determining unit is configured to determine a plurality of initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture;

[0057] A model training unit, configured to train each of the initial models based on the sample data set, and use each trained initial model as a candidate model;

[0058] A performance evaluation unit is used to perform performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model;

[0059] A model selection unit, configured to select, from among the candidate models, a candidate model with the best performance as a large model for the government affairs industry based on the performance evaluation results;

[0060] The entity recognition unit is used to apply the government affairs industry big model to perform named entity recognition on the government affairs text to be identified in the production environment.

[0061] A storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned named entity recognition method based on the government industry big model.

[0062] An electronic device includes a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the above-mentioned named entity recognition method based on the government industry big model.

[0063] A method for named entity recognition based on a large model of the government industry provided in the above-mentioned embodiment of the present invention includes: determining an initial data set; the initial data set includes a plurality of pre-collected government texts; based on a preset target government field, screening the initial data set to obtain target government texts corresponding to the target government field; preprocessing the data of each target government text to obtain a processed government text corresponding to each target government text; determining each training task; each training task includes a named entity recognition task and a part-of-speech tagging task; constructing a sample data set based on each training task and each processed government text; determining multiple initial models; each initial model is a BERT The model obtained by fine-tuning the model, each initial model adopts a self-attention mechanism or a multi-head attention mechanism, and the network layer architecture of each initial model is different; based on the sample data set, each initial model is trained separately, and each initial model that has completed the training is used as a candidate model; each candidate model is performance evaluated to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance of the candidate model; based on each performance evaluation result, the candidate model with the best performance is selected from each candidate model as the government affairs industry big model; the government affairs industry big model is used to perform named entity recognition on government affairs text to be recognized in a production environment. Using the method provided by the embodiment of the present invention, a sample data set can be constructed based on government affairs text in a target government affairs field and various training tasks, multiple initial models can be established by fine-tuning the BERT model, and each initial model is trained using the sample data set so that each initial model can be trained on training tasks such as named entity recognition tasks and part-of-speech tagging tasks in the target government affairs field, and the government affairs industry big model is selected from each trained initial model to perform named entity recognition in a production environment using the government affairs industry big model. When faced with data containing new linguistic phenomena or entity objects that are not yet mastered, the large-scale model of the government affairs industry can also identify the corresponding named entities based on its learning ability, which is conducive to the accurate identification of various types of named entity objects and improves the accuracy and adaptability of named entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0065] Figure 1 A method flow chart of a named entity recognition method based on a large model of the government affairs industry provided by an embodiment of the present invention;

[0066] Figure 2 Another method flow chart of a method for named entity recognition based on a large model of the government affairs industry provided by an embodiment of the present invention;

[0067] Figure 3 A schematic diagram of a process for constructing a large model for the government affairs industry provided by an embodiment of the present invention;

[0068] Figure 4 A schematic diagram of the structure of a named entity recognition device based on a large model of the government affairs industry provided by an embodiment of the present invention;

[0069] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0071] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0072] The embodiment of the present invention provides a method for named entity recognition based on a large model of the government industry. The method can be applied to various government information processing platforms, and its execution subject can be the processor of the platform. The method flow chart of the method is as follows: Figure 1 Shown, including:

[0073] S101: Determine an initial data set; the initial data set includes a plurality of pre-collected government documents;

[0074] In the method provided by the embodiments of the present invention, various government text data, such as policies and regulations, official notices, work reports, and meeting minutes, can be pre-collected from various information channels, such as e-government platforms and government databases. For example, various policy documents published over the past year can be collected from government service websites. These pre-collected government texts serve as the initial data set.

[0075] S102: Based on a preset target government affairs field, the initial data set is screened to obtain target government affairs texts corresponding to the target government affairs field;

[0076] In the method provided in the embodiments of the present invention, a target government domain, such as urban planning or municipal administration, can be set based on actual business needs. Using a preset data screening method, government documents associated with the target government domain are screened from the various government documents in the initial data set, and the screened government documents are used as the target government documents.

[0077] S103: performing data preprocessing on each of the target government documents to obtain each processed government document;

[0078] In the method provided by the embodiment of the present invention, data preprocessing is performed on each target government text according to a pre-set data preprocessing strategy, so that each target government text is uniformly processed into data that meets the corresponding specifications, and the target government text that has undergone data preprocessing is used as the processed government text.

[0079] S104: Determine various training tasks; each of the training tasks includes a named entity recognition task and a part-of-speech tagging task;

[0080] In the method provided in the embodiments of the present invention, various training tasks can be defined for training the model. These training tasks include named entity recognition tasks and part-of-speech tagging tasks, and may also include other training tasks such as syntactic analysis tasks. It is understood that the named entity recognition task is used to train the model to identify named entities in text, and the part-of-speech tagging task is used to train the model to tag the parts of speech of the identified named entities.

[0081] S105: Constructing a sample data set based on each of the training tasks and each of the processed government documents;

[0082] In the method provided by the embodiment of the present invention, corresponding text data can be extracted from each processed government text as sample data, the sample data can be labeled according to each training task, and a sample data set can be constructed based on the labeled sample data.

[0083] S106: Determine multiple initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture;

[0084] In the method provided in the embodiment of the present invention, the BERT model is loaded as the base model. Specifically, the BERT-Base model can be selected. BERT (Bidirectional Encoder Representations from Transformers) is a deep learning model based on Transformer. The BERT model is an existing pre-trained model and will not be introduced in detail here. Fine-tuning is performed on the basis of the BERT model. For example, a fully connected layer with 256 neurons is added after the output layer of the BERT model, and a classification layer is added after the fully connected layer to output the category of the named entity, etc. An attention mechanism is introduced into the BERT model. A self-attention mechanism or a multi-head self-attention mechanism can be used. Different network hierarchical architectures are used to fine-tune the BERT model respectively, and each fine-tuned BERT model is used as the initial model.

[0085] S107: Based on the sample data set, each of the initial models is trained respectively, and each trained initial model is used as a candidate model;

[0086] In the method provided by the embodiments of the present invention, each initial model is jointly trained for various training tasks based on a sample dataset, and the trained initial model is used as a candidate model. Specifically, model training can be performed by dynamically adjusting the learning rate, and hyperparameters are adjusted during the model training process until the model meets the predetermined training requirements, completing the model training process.

[0087] S108: Performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model;

[0088] In the method provided by the embodiment of the present invention, performance evaluation is performed on each candidate model according to a predetermined performance evaluation method, for example, various performance evaluation parameters are calculated to obtain a performance evaluation result for each candidate model.

[0089] S109: Selecting the candidate model with the best performance from among the candidate models based on the performance evaluation results as the government affairs industry master model;

[0090] In the method provided by the embodiment of the present invention, the candidate models are sorted in order of performance from best to worst according to the performance evaluation results of the candidate models, and the candidate model with the best performance is selected as the large model of the government affairs industry.

[0091] S110: Apply the government affairs industry big model to perform named entity recognition on government affairs texts to be identified in the production environment.

[0092] In the method provided by the embodiment of the present invention, the government affairs industry big model can be deployed to the corresponding government affairs information processing system, integrated with the system interface, and named entity recognition can be performed on the government affairs text input in real time in the production environment.

[0093] Based on the method provided in the embodiment of the present invention, an initial data set can be determined; based on a preset target government affairs field, the initial data set is screened to obtain each target government affairs text corresponding to the target government affairs field; data preprocessing is performed on each target government affairs text to obtain a processed government affairs text corresponding to each target government affairs text; each training task is determined; based on each training task and each processed government affairs text, a sample data set is constructed; multiple initial models are determined; each initial model is a model obtained by fine-tuning the BERT model, each initial model adopts a self-attention mechanism or a multi-head attention mechanism, and the network hierarchical architecture of each initial model is different; based on the sample data set, each initial model is trained separately, and each initial model that has completed the training is used as a candidate model; performance evaluation is performed on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model; based on each performance evaluation result, the candidate model with the best performance is selected from each candidate model as the government affairs industry big model; the government affairs industry big model is applied to perform named entity recognition on the government affairs texts to be identified in the production environment. By applying the method provided in the embodiment of the present invention, a sample data set can be constructed based on the government texts and various training tasks in the target government field, multiple initial models can be established by fine-tuning the BERT model, and each initial model can be trained using the sample data set, so that each initial model can be trained on training tasks such as named entity recognition tasks and part-of-speech tagging tasks in the target government field. A large model for the government industry is selected from the various initial models that have completed training, and named entity recognition is performed in a production environment using the large model for the government industry. When the large model for the government industry faces data with newly added linguistic phenomena or entity objects that it has not yet mastered, it can also identify the corresponding named entities based on its learning ability, which is conducive to accurate recognition of various types of named entity objects and improves the accuracy and adaptability of named entity recognition.

[0094] exist Figure 1 Based on the method shown, Figure 2 As shown, in the method provided by the embodiment of the present invention, the process of filtering the initial data set based on the preset target government affairs field in step S102 to obtain target government affairs texts corresponding to the target government affairs field includes:

[0095] S201: Determine keywords corresponding to the target government affairs field;

[0096] In the method provided by the embodiment of the present invention, keywords for the target government affairs field can be pre-set based on the information characteristics of the target government affairs field. For example, for the market supervision field, the corresponding keywords may include market supervision, market management, price supervision, product quality, product safety, food safety, etc. The keywords corresponding to the target government affairs field are obtained from the pre-configured data.

[0097] S202: Based on each of the keywords, perform a text search on each of the government documents in the initial data set to obtain each of the government documents associated with each of the keywords, and use each of the government documents associated with each of the keywords as a first candidate text;

[0098] In the method provided by an embodiment of the present invention, a text search tool is used to perform a text search on each government text in the initial data set. If one or more of the above-mentioned keywords exist in the government text, the government text is screened out and used as the government text associated with each keyword. That is, the government text containing each keyword is screened out and marked as the first candidate text.

[0099] S203: For each government document in the initial data set, apply a preset government document classification model to classify the government document to obtain a classification result indicating whether the government document belongs to the target government domain. If the classification result indicates that the government document belongs to the target government domain, the government document is selected as a second candidate document.

[0100] In the method provided by the embodiment of the present invention, a government text classification model can be pre-constructed to classify the government fields to which government texts belong. Specifically, the classification model can be trained using sample data corresponding to each government field to obtain a government text classification model.

[0101] In the method provided by an embodiment of the present invention, each government document in an initial dataset is classified by its domain using a preset government document classification model, obtaining a classification result for each government document. Based on the classification result for each government document, whether the document belongs to the target government domain is identified, and government documents whose classification result indicates that they belong to the target government domain are marked as second candidate documents. In other words, the government document classification model classifies government documents and selects government documents belonging to the target government domain.

[0102] S204: For each government document in the initial data set, a preset text analysis algorithm is applied to perform text analysis on the government document to obtain a text analysis result indicating whether the government document belongs to the target government domain. If the text analysis result indicates that the government document belongs to the target government domain, the government document is selected as a third candidate text.

[0103] The method provided by the embodiment of the application can set a text analysis algorithm in advance based on a semantic analysis technology of natural language processing, and the algorithm identifies a government affair field to which a text belongs by analyzing the theme and semantics of the text.

[0104] In the method provided by the embodiment of the application, the theme and semantics of each government affair text in the initial data set are analyzed respectively by the text analysis algorithm, and the government affair field to which each government affair text belongs is identified, so as to obtain the text analysis result of each government affair text. It can be understood that the text analysis result of each government affair text represents whether the government affair field to which the government affair text belongs is the target government affair field. According to the text analysis result corresponding to each government affair text, it is identified whether each government affair text belongs to the target government affair field, and the government affair text whose text analysis result represents that it belongs to the target government affair field is marked as a third candidate text. That is, the government affair text belonging to the target government affair field is screened out by semantic analysis of the text.

[0105] S205: integrating each of the first candidate texts, each of the second candidate texts and each of the third candidate texts to obtain integrated candidate texts;

[0106] In the method provided by the embodiment of the application, each of the first candidate texts, each of the second candidate texts and each of the third candidate texts can be integrated, and the same government affair text is removed from the integrated texts, and each text obtained after the integration is taken as an integrated candidate text. For example, if a government affair text A is marked as a first candidate text and a second candidate text at the same time, only one copy of the government affair text A is retained in the integrated candidate texts. That is, the government affair texts screened out based on the keyword screening, the government affair text classification model and the text analysis are integrated, and each government affair text obtained after the integration is taken as an integrated candidate text.

[0107] S206: sending the integrated candidate texts to designated personnel, so that the designated personnel audit the integrated candidate texts;

[0108] In the method provided by the embodiment of the application, the integrated candidate texts can be sent to designated professional personnel, and the candidate texts are audited manually by the relevant personnel.

[0109] S207: when receiving an instruction that the designated personnel confirm the integrated candidate texts, the integrated candidate texts are taken as the target government affair texts.

[0110] In the method provided by the embodiment of the present application, if the relevant personnel confirm that the screening of each candidate text is correct after the screening, the front end can send an instruction for confirming each candidate text, and when the platform receives the instruction, each candidate text can be taken as a target government text. If the relevant personnel think that there is a text with domain identification error in each candidate text after the screening, the front end can send an instruction for adjusting each candidate text, for example, deleting a specified candidate text, and when the relevant personnel receive the instruction for adjusting each candidate text, the corresponding adjustment operation corresponding to the instruction can be determined, and each candidate text is processed according to the adjustment operation, and each processed candidate text is taken as a target government text. For example, if an instruction for deleting a specified candidate text is received, the specified candidate text is deleted from each candidate text, and each remaining candidate text is taken as a target government text.

[0111] Based on the method provided by the embodiment of the present application, various methods such as keyword screening, government text classification model classification, and text analysis can be combined to screen each government text associated with the target government domain from the initial data set, and the final target government text is determined in combination with manual screening, which is beneficial to improve the accuracy and relevance of data screening.

[0112] In Figure 1 Based on the method shown in the figure, in the method provided by the embodiment of the present application, the process of data preprocessing of each target government text in step S103 includes:

[0113] Converting the format of each target government text to obtain a first government text corresponding to each target government text;

[0114] In the method provided by the embodiment of the present application, each target government text can be data in different formats, such as PDF format, HTML format, etc. In the data preprocessing process, the format of each target government text is converted to a unified format, each target government text is converted to text data in pure text format, and each text data obtained by conversion is standardized, the font, line spacing, and paragraph first line indentation of the text are standardized, and each text data processed by standardization is taken as a first government text corresponding to the corresponding target government text. That is, for a target government text, it is determined whether the target government text is text data in pure text format, if not, the format of the target government text is converted to text data in pure text format, and the font, line spacing, and paragraph first line indentation of the text data obtained by conversion are standardized according to the predetermined format specification, and the text data processed by standardization is taken as a first government text corresponding to the target government text.

[0115] data cleaning is performed on each of the first government texts to obtain each second government text corresponding to each of the first government texts;

[0116] In the method provided by the embodiment of the application, data in each first government text is cleaned, such as removing random codes and meaningless special characters in the text, and texts lacking key information are marked for subsequent attention. Hash algorithm can also be used to identify whether there is repeated text in each first government text, and the repeated text is deleted, for example, only one copy of a meeting record is retained when two copies of the meeting record are completely identical. Each government text obtained after data cleaning is taken as each second government text.

[0117] Each second government text is subjected to word segmentation processing to obtain a word segmentation result corresponding to each second government text;

[0118] In the method provided by the embodiment of the application, a word segmentation tool (for example, Jieba word segmentation tool) and a custom dictionary of a target government field can be used to perform word segmentation processing on text data in each second government text, and the word segmentation result output by the tool is taken as the word segmentation result corresponding to the corresponding second government text. The word segmentation result output by the tool can also be fed back to designated personnel for manual checking and correction, and the word segmentation result confirmed manually is taken as the word segmentation result of the corresponding second government text.

[0119] Each word segmentation result corresponding to each second government text is taken as each processed government text.

[0120] In the method provided by the embodiment of the application, each word segmentation result corresponding to each second government text is taken as each processed government text.

[0121] Based on the method provided by the embodiment of the application, multi-source government texts can be converted into data in a unified form through data cleaning, format conversion and the like, which is beneficial to subsequent data processing, improves processing speed, and can combine a word segmentation tool and manual review to perform word segmentation on government texts, which is beneficial to improving the accuracy of word segmentation and then improving the accuracy of subsequent sample construction.

[0122] In Figure 1 Based on the method shown in the figure, in the method provided by the embodiment of the application, the process of constructing a sample data set based on each training task and each processed government text in step S105 includes:

[0123] Determine the annotation rule corresponding to each training task;

[0124] In the method provided by the embodiment of the present invention, labeling rules corresponding to each training task can be formulated in advance according to the requirements of each training task. For example, for the named entity recognition task, the words belonging to the named entities in the text are labeled with their corresponding named entity categories, such as personal names, organization names, place names, etc. For the part-of-speech tagging task, the words belonging to the named entities in the text are labeled with their corresponding parts of speech, such as noun phrases or verb phrases.

[0125] Annotating each of the processed government documents according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government documents;

[0126] In the method provided by the embodiments of the present invention, each processed government document is annotated according to the annotation rules corresponding to each training task, and the annotated processed government document is considered the annotated text. For example, if the word "government service" appears in a processed government document, "government service" is labeled as a service name according to the annotation rules of the named entity recognition task, and is also labeled as a noun phrase according to the annotation rules of the part-of-speech tagging task.

[0127] According to a preset data enhancement strategy, data enhancement processing is performed on each of the annotated texts to obtain each newly annotated text;

[0128] In the method provided by the embodiment of the present invention, data enhancement operations can be performed on the basis of each annotated text according to a pre-set data enhancement method, and the annotated text derived by data enhancement can be used as a newly annotated text. Specifically, data enhancement can be performed by sample replication, random transformation, and back-translation technology. For example, the named entity categories with less data in each annotated text can be counted, and the data of these named entity categories can be copied, and the copied text can be used as a newly annotated text. For example, based on the annotated text, the vocabulary therein can be randomly replaced, or the corresponding vocabulary can be inserted / deleted to randomly generate a new text. Alternatively, the specified vocabulary in the text can be translated into English, and then the English can be translated back into Chinese, and the back-translated Chinese can replace the original vocabulary to generate a new text.

[0129] The sample data set is composed of each of the newly annotated texts and each of the annotated texts.

[0130] In the method provided by the embodiment of the present invention, each newly annotated text obtained through data enhancement and each original annotated text are used as sample data to form a sample data set.

[0131] exist Figure 1On the basis of the method shown, in the method provided by the embodiment of the present invention, the process of training each of the initial models based on the sample data set mentioned in step S107 includes:

[0132] Based on the sample data set, determining a training set and a validation set;

[0133] In the method provided by the embodiment of the present invention, the sample data set may be divided into a training set, a validation set, and a test set according to a predetermined ratio.

[0134] Determine a loss function corresponding to each of the training tasks;

[0135] In the method provided by the embodiment of the present invention, the loss function used for each type of training task can be pre-set. For the named entity recognition task, the cross entropy loss function is used, and for the part-of-speech tagging task, the mean square error loss function is used.

[0136] Constructing a comprehensive loss function based on the loss functions corresponding to each of the training tasks;

[0137] In the method provided by the embodiments of the present invention, the loss functions of each training task are combined through weighted summation to construct a corresponding composite loss function. For example, if the weight of the named entity recognition task is set to 0.6 and the weight of the part-of-speech tagging task is set to 0.4, the composite loss function is (the loss function of the named entity recognition task * 0.6 + the loss function of the part-of-speech tagging task * 0.4).

[0138] Based on the training set and the validation set, and in accordance with the comprehensive loss function and a preset adaptive learning rate adjustment algorithm, multi-task joint training is performed on each of the initial models.

[0139] In the method provided by the embodiments of the present invention, initial values ​​for various model training parameters, such as the initial learning rate, can be pre-set. The training set and validation set are then used as training data, and the loss is calculated using a comprehensive loss function. Training optimization is performed using the adaptive learning rate adjustment algorithm (Adadelta), with multi-task joint training performed on each initial model. During training, the training status of each initial model can be monitored in real time, and model parameters can be saved after a certain number of iterations, allowing for rollback in the event of training problems.

[0140] exist Figure 1 Based on the method shown, in the method provided by the embodiment of the present invention, the process of performing performance evaluation on each candidate model mentioned in step S108 to obtain the performance evaluation result corresponding to each candidate model includes:

[0141] Based on the sample data set, determining a test set;

[0142] In the method provided by the embodiment of the present invention, during model training, the sample data set is divided into a training set, a validation set, and a test set according to a predetermined ratio. The test set can be used to evaluate the model performance.

[0143] Based on the test set, each candidate model is tested respectively to obtain a test result for each candidate model;

[0144] In the method provided by the embodiment of the present invention, for each candidate model, a test set is applied to perform model testing to obtain the recognition status of the candidate model on the test set, that is, the test result.

[0145] For each candidate model, based on the test results corresponding to the candidate model, a performance indicator set corresponding to the candidate model is determined, and the performance indicator set is used as the performance evaluation result corresponding to the candidate model. The performance indicator set includes the accuracy, recall rate and F1 value corresponding to the candidate model.

[0146] In the method provided by the embodiment of the present invention, the performance indicators such as accuracy, recall rate and F1 of each candidate model on the test set can be calculated based on the test results of each candidate model on the test set, and the performance indicator set composed of these performance indicators can be used as the performance evaluation result of the candidate model.

[0147] exist Figure 1 On the basis of the method shown, the method provided in the embodiment of the present invention further includes:

[0148] Monitoring the named entity recognition results of the government affairs industry big model during application;

[0149] In the method provided by the embodiments of the present invention, during the application of the government affairs industry big model, that is, during its operation in a production environment, named entity recognition data from the government affairs industry big model in actual application is monitored in real time. The named entity recognition data within a certain time period is periodically integrated as the named entity recognition results of the government affairs industry big model during its application. For example, the named entity recognition results of each government affairs document by the government affairs industry big model on that day are used as the named entity recognition results.

[0150] Based on the named entity recognition result of the government affairs industry big model, the actual performance of the government affairs industry big model is evaluated to obtain the actual performance evaluation result corresponding to the government affairs industry big model;

[0151] In the method provided in the embodiment of the present invention, the performance of the government affairs industry big model is evaluated based on the named entity recognition results of the government affairs industry big model, for example, performance indicators such as the accuracy and recall rate of the model are calculated, and the calculated performance indicators are used as the actual performance evaluation results of the model.

[0152] The named entity recognition results and the actual performance evaluation results are stored to facilitate optimization of the government affairs industry big model.

[0153] In the method provided by an embodiment of the present invention, the named entity recognition results and actual performance evaluation results of the large model of the government industry during the application process are stored in a designated space to facilitate subsequent updating and optimization of the model. For example, every three months, the named entity recognition results and actual performance evaluation results generated during this period are analyzed and the model is retrained.

[0154] Based on the method provided in the embodiment of the present invention, large government industry models in production environments can be continuously tested and the models can be continuously optimized to enable the models to better adapt to changes in business needs, thereby improving the accuracy of named entity recognition in government texts.

[0155] In order to better illustrate the method provided by the embodiment of the present invention, based on the methods provided by the above embodiments and in combination with actual application scenarios, the embodiment of the present invention provides another method for named entity recognition based on the government industry big model. The method provided by the embodiment of the present invention is applied to the named entity recognition scenario of government texts. The method identifies the named entities of the government texts that need to be analyzed by deploying the government industry big model. The government industry big model in the embodiment of the present invention is constructed based on the BERT model, such as Figure 3 As shown in the schematic diagram, in the method provided by the embodiment of the present invention, the process of constructing the large model of the government affairs industry mainly includes the following operations:

[0156] (1) Data collection and data preprocessing;

[0157] In the method provided by the embodiment of the application, various government text data such as policies and regulations, official documents, work reports, and meeting minutes are obtained in advance from channels such as official websites of various departments, e-government platforms, and government databases. For example, various policy documents published in the past year are collected from a government service website of a certain city. The collected various government texts are screened, and relevant government texts in a specific government field (i.e., the target government field in the foregoing embodiment) are retained. Specifically, the texts can be screened by using keywords, such as the keywords of a specific government field, such as “city planning”, “environmental protection”, “law enforcement”, and the like, to screen the texts containing these keywords by using a text search tool. Machine learning algorithms can be used for text screening, such as training a classification model to automatically identify and screen texts related to a specific government field. Natural language processing techniques can also be used to screen texts, such as identifying the theme and semantics in the government texts by using a text analysis tool to analyze whether they are related to a specific government field, and thus screening the texts related to a specific government field. After the various technologies are applied to preliminarily screen the government texts, the screened government texts can be sent to professional personnel for manual review to ensure the accuracy and relevance of the screening results. It can be understood that the specific government field is the field to which the government text currently requires named entity recognition, for example, the current application of the government industry large model for named entity recognition in the market supervision field, and the specific government field is the market supervision field.

[0158] In the method provided by the embodiment of the application, the government texts in the specific government field screened are subjected to text format conversion, and various formats of government texts are uniformly converted into pure text format, for example, policy files in PDF format and government announcements in HTML format are uniformly converted into data in pure text TXT format, and the converted text data is subjected to normalization processing, such as uniform line spacing of 1.5 times and paragraph first line indentation of two characters. The various government texts subjected to format conversion and data normalization processing are subjected to data cleaning to remove garbled codes and meaningless special characters in the text data, for example, for a certain official document, delete the existing garbled code paragraphs and irrelevant emoticons. For texts with missing key information (such as missing document date), corresponding marks are made for cautious processing in subsequent analysis. In addition, hash algorithms are used to identify and delete duplicate texts, for example, only one of two meeting minutes with the same content is retained.

[0159] (2) word segmentation preprocessing;

[0160] In the method provided by the embodiments of the present invention, the Jieba word segmenter is used to segment each government document obtained through data preprocessing, combined with a custom dictionary for the government sector, to ensure that professional terms are correctly segmented. For example, when processing a document regarding land expropriation, "land expropriation" is segmented as a whole. The segmentation results are manually reviewed and corrected. For example, if "administrative reconsideration procedure" is incorrectly segmented as "administrative-reconsideration-procedure", it is corrected to "administrative reconsideration procedure".

[0161] (3) Extract sample data;

[0162] Based on the word segmentation results for each government document, the corresponding text data is extracted as the data to be annotated. In the model training scenario, corresponding training tasks are defined, such as named entity recognition and part-of-speech tagging. Detailed annotation rules are developed for each training task. For example, in part-of-speech tagging, "government services" is annotated as a noun phrase. The data to be annotated is annotated according to the annotation rules corresponding to the training task to obtain sample data.

[0163] (4) Sample data enhancement;

[0164] In the method provided in the embodiment of the present invention, data enhancement can be performed on the basis of the original sample data, and specifically, data enhancement can be performed through minority sample replication, random transformation and back translation technology. The processing process of minority sample replication is mainly to statistically count the categories with fewer named entity categories in the original sample data, such as the names of specific types of institutions, and to carry out targeted replication of samples of these minority categories to triple their number. For example, there were originally only 100 samples of "Urban Construction Committee", and these samples were replicated, and the number increased to 300 after replication. The processing process of random transformation is mainly to randomly replace words in the original text, such as replacing "environmental protection measures" with "environmental protection means", and inserting and deleting words with a certain probability, such as randomly inserting "efficient" or deleting "platform" in "Government Affairs Disclosure Platform". The processing process based on back-translation technology is mainly to back-translate the Chinese text in the text into the corresponding English. For example, the Chinese text "Administrative Approval Process Optimization" is translated into English "Optimization of administrative approval process", and then translated back into Chinese "Administrative Approval Process Optimization". The back-translated text is screened to remove samples with large semantic deviations, and the remaining suitable samples are used as sample data.

[0165] (5) Load the pre-trained model;

[0166] In the method provided in the embodiment of the present invention, the BERT-Base model is selected as the base model, and its pre-trained parameters and architecture are loaded.

[0167] (6) Adjust the pre-training model parameters;

[0168] In the method provided in the embodiment of the present invention, fine-tuning is performed based on the BERT model. For example, for the named entity recognition task in the government affairs field, the input and output formats of the model are determined. A fully connected layer with 256 neurons is added after the output layer of the BERT model, and ReLU is selected as the activation function. A classification layer is added after the fully connected layer to output the category of the named entity. For common professional vocabulary in the government affairs field, such as "administrative approval" and "government service center", its weight in the pre-trained word vector is increased. This can be achieved by fine-tuning the pre-trained model, retraining the word vector, selecting domain-specific corpus, adjusting the word frequency or using different training algorithms, so that the model is more accurate and effective when processing government-related texts. The number of hidden layers of the BERT model is increased to 16 to better capture the complex semantics of government affairs texts. The L2 regularization coefficient is adjusted to 0.001 to prevent the model from overfitting. An attention mechanism is introduced, and a self-attention mechanism or a multi-head attention mechanism can be used. The self-attention mechanism introduces a feature extraction layer to calculate the correlation score between each word in the input government text and other words. For example, in a report on environmental law enforcement, the word "polluting enterprise" has a high correlation score with words like "fine" and "shutdown." This process typically involves calculating three representations for each element in the input sequence: query, key, and value. Attention scores are then calculated using these representations. The correlation scores are normalized using a softmax function to obtain an attention weight for each word. This step ensures that all weights sum to 1, allowing them to be viewed as a probability distribution indicating the relative importance of each word to the others. The word representations are weighted and summed according to the attention weights, highlighting the importance of key information such as "polluting enterprise" in the text representation. This step is effectively a weighted average, where the weights are determined by the attention scores calculated in the previous step. The multi-head attention mechanism, on the other hand, uses multiple attention heads in parallel within the model, each learning a different attention pattern. This is typically achieved by adding multiple self-attention layers to the model, each responsible for capturing different aspects of the correlation in the input data. For example, some heads may focus on local information in the text, while others may focus on global information. The outputs of each head are concatenated and linearly transformed to obtain a richer and more comprehensive text representation, which helps to better identify named entities. This step involves merging the outputs of multiple attention heads and may further process them through a linear layer to integrate the information captured by different heads. Synchronously adjust the hierarchical results. Based on the BERT model, fine-tune and build multiple initial models through different hierarchical architecture adjustments. For example, different architectures are used for layers such as dense layers (fully connected layers), convolutional layers, pooling layers, normalization layers, dropout layers, and attention layers.

[0169] (7) Define the task and loss function;

[0170] In the method provided in an embodiment of the present invention, for the training tasks in model training, a named entity recognition task is defined, along with other training tasks such as part-of-speech tagging tasks (e.g., noun, verb, adjective, etc.) and syntactic analysis tasks (e.g., sentence component analysis). A loss function is constructed for each training task. For example, a cross-entropy loss function is used for the named entity recognition task, and a mean squared error loss function is used for the part-of-speech tagging task. A comprehensive loss function is constructed by combining the loss functions of each training task using a weighted summation approach. For example, a weight of 0.6 is assigned to the named entity recognition task, and a weight of 0.4 is assigned to the part-of-speech tagging task.

[0171] (8) Dynamic training model;

[0172] In the method provided by the embodiments of this invention, the sample data obtained through data augmentation is used as the sample dataset. The sample dataset is then divided into a training set, a validation set, and a test set in a ratio of 7:2:1. For example, if there are 10,000 samples, 7,000 samples are used for training, 2,000 samples are used for validation, and 1,000 samples are used for testing. This ensures that the distribution of each dataset is representative and covers government documents of different types and fields.

[0173] In the method provided in the embodiment of the present invention, the adaptive learning rate adjustment algorithm Adadelta is selected as the optimization algorithm. This algorithm has good stability and convergence when processing large-scale data. Relevant parameters of the Adadelta algorithm are set, such as setting the rho parameter to 0.95.

[0174] Initialize the model parameters and weights using a normal distribution with a mean of 0 and a standard deviation of 0.1. Initialize the bias term to 0.

[0175] During model training, a dynamic learning rate adjustment strategy is employed. The learning rate is automatically adjusted based on the model's training progress and performance, accelerating model convergence and improving training efficiency. Regarding the parameters for dynamic learning rate adjustment, the initial learning rate is set to 0.005 based on the model scale and data volume. During the initial training phase, the model's loss on the training set is observed to determine whether the initial learning rate is appropriate. Regarding the learning rate decay strategy, an exponential decay strategy is employed, multiplying the learning rate by 0.9 every 5,000 training steps. The decay rate and magnitude are adjusted based on the model's performance on the validation set. The learning rate is dynamically adjusted during training. If the model's accuracy on the validation set does not improve after three consecutive iterations, the learning rate is reduced to 80% of its current value. Model performance is continuously monitored and the learning rate is dynamically adjusted to find the optimal learning rate setting.

[0176] The method provided by this embodiment uses sample data to jointly train each initial model across multiple tasks. During each training iteration, the losses for both named entity recognition and part-of-speech tagging are calculated simultaneously. By sharing the underlying parameters of the BERT model, each training task can mutually enhance learning. For example, the lexical information learned from part-of-speech tagging can help named entity recognition better determine entity boundaries.

[0177] (9) Verify the model and adjust the parameters;

[0178] The method provided by the embodiment of the present invention monitors the training process in real time and saves the model parameters every 100 training steps so that it can roll back to the previous better state when problems occur in training. The accuracy, recall rate and F1 value on the training set and validation set are calculated in real time, and the learning curve is drawn to observe the training and overfitting of the model. According to the learning curve and the performance of the model on the validation set, the hyperparameters of the model, such as the number of layers and the number of neurons, are adjusted. For example, if the model is found to be overfitting, the number of layers is reduced or the regularization strength is increased. Different hyperparameter combinations are tried through the grid search method to find the optimal setting. An early stopping strategy is adopted. If the F1 value of the model on the validation set does not improve in 5 consecutive iterations, training is stopped to prevent overfitting.

[0179] (10) Save the model;

[0180] In the method provided by the embodiment of the present invention, after the training process of each initial model is completed, the trained initial models are saved as candidate models.

[0181] (11) Test the models and select the best one based on the test results.

[0182] In the method provided by the embodiment of the present invention, each candidate model is evaluated on a test set. For example, each candidate model is tested on a test set containing 1,000 samples, and various evaluation indicators of the model are calculated. Accuracy, recall and F1 value are mainly used as evaluation indicators, and attention can also be paid to precision and confusion matrix. The threshold of accuracy is set to 90%, the threshold of recall is set to 85%, and the threshold of F1 value is set to 88%. Compare the performance evaluation results of different candidate models, select the model with the best performance, and use the model with the best performance as the large model of the government affairs industry. For example, the accuracy of model A is 92%, the recall rate is 88%, and the F1 value is 90%, while the accuracy of model B is 90%, the recall rate is 85%, and the F1 value is 87%, then model A is selected as the final model.

[0183] In the method provided by the embodiment of the application, the finally selected government industry large model can be deployed into a corresponding government information processing system, integrated with the interface of the system, and used to realize the named entity recognition of real-time input government texts. For example, the model is deployed in an official document automatic processing system, and the model is used to quickly identify the names of persons, places and organizations in the official document to be analyzed.

[0184] In the method provided by the embodiment of the application, the performance of the model in actual application can be continuously monitored, for example, the accuracy and recall rate of the model are counted every day. According to the changes of business requirements and the drift of data distribution, the model is updated and optimized regularly, for example, the model is retrained every three months.

[0185] Based on the method provided by the embodiment of the application, the corresponding government industry large model can be constructed by means of the fine tuning of the BERT model, the introduction of the attention mechanism, the multi-task learning strategy and other technical means, the model can more accurately capture the semantic information and entity features in the government texts, the model can better process the professional texts and complex language phenomena in the government field, thereby improving the accuracy and recall rate of the named entity recognition, and then improving the accuracy of the named entity recognition in the government information. In the model training process, the data enhancement technology is used to effectively balance the class distribution in the government data, improve the recognition ability of the model for the minority class named entities, and avoid the performance degradation of the model caused by the data imbalance. Through the strategy of dynamically adjusting the learning rate, the convergence speed of the model can be accelerated, the training time can be reduced, the training efficiency can be improved, and the computing cost can be reduced. The method provided by the embodiment of the application can be applied to different government fields according to actual requirements, for example, applied to government official document processing, government information retrieval, government public opinion monitoring and other fields, can provide strong technical support for government management and decision-making, and has important practical application value.

[0186] With Figure 1 Corresponding to the named entity recognition method based on the government industry large model as shown in the method, the embodiment of the application further provides a named entity recognition device based on the government industry large model, which is used for the specific implementation of the method as shown in the method, and a structure diagram is as shown in Figure 1 Figure 4 As shown, it comprises:

[0187] The first determination unit 301 is used for determining an initial data set; the initial data set comprises a plurality of government texts collected in advance;

[0188] The data screening unit 302 is used for screening the initial data set based on a preset target government field, and obtaining each target government text corresponding to the target government field;

[0189] ​A preprocessing unit 303 is configured to perform data preprocessing on each target government document to obtain each processed government document;

[0190] The second determining unit 304 is configured to determine various training tasks, wherein each of the training tasks includes a named entity recognition task and a part-of-speech tagging task;

[0191] A sample construction unit 305 is configured to construct a sample data set based on each of the training tasks and each of the processed government documents;

[0192] The third determining unit 306 is configured to determine a plurality of initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture;

[0193] A model training unit 307 is configured to train each of the initial models based on the sample data set, and use each trained initial model as a candidate model;

[0194] The performance evaluation unit 308 is configured to perform a performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model;

[0195] A model selection unit 309 is configured to select a candidate model with the best performance from among the candidate models according to the performance evaluation results as the government affairs industry macro model;

[0196] The entity recognition unit 310 is used to apply the government affairs industry big model to perform named entity recognition on the government affairs text to be identified in the production environment.

[0197] By using the device provided by the embodiment of the present invention, a sample data set can be constructed based on the government texts and various training tasks in the target government field, multiple initial models can be established by fine-tuning the BERT model, and each initial model can be trained using the sample data set, so that each initial model can be trained on training tasks such as named entity recognition tasks and part-of-speech tagging tasks in the target government field. A large model for the government industry is selected from the various initial models that have completed training, and named entity recognition is performed in a production environment using the large model for the government industry. When the large model for the government industry faces data with newly added linguistic phenomena or entity objects that it has not yet mastered, it can also identify the corresponding named entities based on its learning ability, which is conducive to accurate recognition of various types of named entity objects and improves the accuracy and adaptability of named entity recognition.

[0198] exist Figure 4Based on the device shown, the device provided by the embodiment of the present invention can be further expanded into multiple units. The functions of each unit can be found in the description of the various embodiments provided in the previous text for the named entity recognition method based on the big model of the government industry, and no further examples will be given here.

[0199] An embodiment of the present invention also provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned named entity recognition method based on the government industry big model.

[0200] The embodiment of the present invention further provides an electronic device, the structural diagram of which is shown in FIG. Figure 5 As shown, the system specifically includes a memory 401 and one or more instructions 402, wherein the one or more instructions 402 are stored in the memory 401 and are configured to be executed by one or more processors 403 to perform the following operations:

[0201] Determining an initial data set; the initial data set includes a plurality of pre-collected government documents;

[0202] Based on a preset target government affairs field, the initial data set is screened to obtain target government affairs texts corresponding to the target government affairs field;

[0203] Performing data preprocessing on each of the target government documents to obtain each processed government document;

[0204] Determine each training task; each training task includes a named entity recognition task and a part-of-speech tagging task;

[0205] Constructing a sample data set based on each of the training tasks and each of the processed government affairs texts;

[0206] Determine multiple initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture;

[0207] Based on the sample data set, each of the initial models is trained respectively, and each initial model that has completed the training is used as a candidate model;

[0208] Performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model;

[0209] According to the performance evaluation results of each candidate model, the candidate model with the best performance is selected from each candidate model as the government affairs industry macro model;

[0210] The government affairs industry big model is applied to perform named entity recognition on government affairs texts to be identified in the production environment.

[0211] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0212] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0213] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A named entity recognition method based on a large model of the government industry, characterized by: include: Determine the initial dataset; The initial data set includes a plurality of government documents collected in advance; Based on a preset target government affairs field, the initial data set is screened to obtain target government affairs texts corresponding to the target government affairs field; The step of screening the initial data set based on the preset target government affairs field to obtain target government affairs texts corresponding to the target government affairs field includes: Determine the keywords corresponding to the target government affairs field; Based on each of the keywords, a text search is performed on each of the government documents in the initial data set to obtain each of the government documents associated with each of the keywords, and each of the government documents associated with each of the keywords is used as a first candidate text; For each government document in the initial data set, a preset government document classification model is applied to classify the government document to obtain a classification result indicating whether the government document belongs to the target government domain; if the classification result indicates that the government document belongs to the target government domain, the government document is selected as a second candidate document; For each government document in the initial data set, applying a preset text analysis algorithm to perform text analysis on the government document to obtain a text analysis result indicating whether the government document belongs to the target government domain; if the text analysis result indicates that the government document belongs to the target government domain, then the government document is selected as a third candidate text; Integrating each of the first candidate texts, each of the second candidate texts, and each of the third candidate texts to obtain integrated candidate texts; Sending the integrated candidate texts to a designated person so that the designated person can review the integrated candidate texts; When receiving an instruction from the designated person to confirm the integrated candidate texts, using the integrated candidate texts as the target government documents; Performing data preprocessing on each of the target government documents to obtain each processed government document; Determine each training task; each training task includes a named entity recognition task and a part-of-speech tagging task; Constructing a sample data set based on each of the training tasks and each of the processed government affairs texts; Determine multiple initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture; Based on the sample data set, each of the initial models is trained respectively, and each initial model that has completed the training is used as a candidate model; Performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model; According to the performance evaluation results of each candidate model, the candidate model with the best performance is selected from each candidate model as the government affairs industry macro model; The government affairs industry big model is applied to perform named entity recognition on government affairs texts to be identified in the production environment.

2. The method for named entity recognition based on a large model of the government affairs industry according to claim 1 is characterized in that: The performing data preprocessing on each target government document to obtain each processed government document includes: Performing format conversion on each of the target government documents to obtain a first government document corresponding to each of the target government documents; Performing data cleaning on each of the first government documents to obtain each of the second government documents corresponding to each of the first government documents; performing word segmentation processing on each of the second government affairs documents to obtain a word segmentation result corresponding to each of the second government affairs documents; The word segmentation results corresponding to each of the second government affairs texts are used as each of the processed government affairs texts.

3. The method for named entity recognition based on a large model of government affairs industry according to claim 1 is characterized in that: The constructing of a sample data set based on each of the training tasks and each of the processed government affairs texts includes: Determining a labeling rule corresponding to each of the training tasks; Annotating each of the processed government documents according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government documents; According to a preset data enhancement strategy, data enhancement processing is performed on each of the annotated texts to obtain each newly annotated text; The sample data set is composed of each of the newly annotated texts and each of the annotated texts.

4. The method for named entity recognition based on a large model of government affairs industry according to claim 1 is characterized in that: The training of each of the initial models based on the sample data set includes: Based on the sample data set, determining a training set and a validation set; Determine a loss function corresponding to each of the training tasks; Constructing a comprehensive loss function based on the loss functions corresponding to each of the training tasks; Based on the training set and the validation set, and in accordance with the comprehensive loss function and a preset adaptive learning rate adjustment algorithm, multi-task joint training is performed on each of the initial models.

5. The method for named entity recognition based on a large model of government affairs industry according to claim 1 is characterized in that: The performing performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model includes: Based on the sample data set, determining a test set; Based on the test set, each candidate model is tested respectively to obtain a test result for each candidate model; For each candidate model, based on the test results corresponding to the candidate model, a performance indicator set corresponding to the candidate model is determined, and the performance indicator set is used as the performance evaluation result corresponding to the candidate model. The performance indicator set includes the accuracy, recall rate and F1 value corresponding to the candidate model.

6. The method for named entity recognition based on a large model of government affairs industry according to claim 1 is characterized in that: Also includes: Monitoring the named entity recognition results of the government affairs industry big model during application; Based on the named entity recognition result of the government affairs industry big model, the actual performance of the government affairs industry big model is evaluated to obtain the actual performance evaluation result corresponding to the government affairs industry big model; The named entity recognition results and the actual performance evaluation results are stored to facilitate optimization of the government affairs industry big model.

7. A named entity recognition device based on a large model of the government industry, characterized in that: include: A first determining unit, configured to determine an initial data set; The initial data set includes a plurality of government documents collected in advance; A data screening unit, configured to screen the initial data set based on a preset target government affairs field to obtain target government affairs texts corresponding to the target government affairs field; The step of screening the initial data set based on the preset target government affairs field to obtain target government affairs texts corresponding to the target government affairs field includes: Determine the keywords corresponding to the target government affairs field; Based on each of the keywords, a text search is performed on each of the government documents in the initial data set to obtain each of the government documents associated with each of the keywords, and each of the government documents associated with each of the keywords is used as a first candidate text; For each government document in the initial data set, a preset government document classification model is applied to classify the government document to obtain a classification result indicating whether the government document belongs to the target government domain; if the classification result indicates that the government document belongs to the target government domain, the government document is selected as a second candidate document; For each government document in the initial data set, applying a preset text analysis algorithm to perform text analysis on the government document to obtain a text analysis result indicating whether the government document belongs to the target government domain; if the text analysis result indicates that the government document belongs to the target government domain, then the government document is selected as a third candidate text; Integrating each of the first candidate texts, each of the second candidate texts, and each of the third candidate texts to obtain integrated candidate texts; Sending the integrated candidate texts to a designated person so that the designated person can review the integrated candidate texts; When receiving an instruction from the designated person to confirm the integrated candidate texts, using the integrated candidate texts as the target government documents; A preprocessing unit, configured to perform data preprocessing on each target government document to obtain each processed government document; A second determining unit is configured to determine each training task; each of the training tasks includes a named entity recognition task and a part-of-speech tagging task; A sample construction unit, configured to construct a sample data set based on each of the training tasks and each of the processed government documents; A third determining unit is configured to determine a plurality of initial models; each of the initial models is a model obtained by fine-tuning the BERT model, each of the initial models adopts a self-attention mechanism or a multi-head attention mechanism, and each of the initial models has a different network layer architecture; A model training unit, configured to train each of the initial models based on the sample data set, and use each trained initial model as a candidate model; A performance evaluation unit is used to perform performance evaluation on each candidate model to obtain a performance evaluation result corresponding to each candidate model; the performance evaluation result corresponding to each candidate model represents the performance quality of the candidate model; A model selection unit, configured to select, from among the candidate models, a candidate model with the best performance as a large model for the government affairs industry based on the performance evaluation results; The entity recognition unit is used to apply the government affairs industry big model to perform named entity recognition on the government affairs text to be identified in the production environment.

8. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the named entity recognition method based on the government affairs industry big model as described in any one of claims 1 to 6.

9. An electronic device, characterized in that: It includes a memory and one or more instructions, wherein one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform the named entity recognition method based on the government industry big model as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Data security intelligent protection model construction method and device and collaboration platform

    CN116527411A

  • Data processing method and device, equipment and storage medium

    CN116956875A