Named entity recognition method based on government affair industry large model and related equipment

By building a big model of the government affairs industry, using the fine-tuned BERT model and attention mechanism, the problem of insufficient adaptability and accuracy of naming entity recognition in the existing technology is solved, and efficient recognition of new language phenomena and entity content is achieved.

CN119783674AActive Publication Date: 2025-04-08SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The naming entity recognition method of existing government information is difficult to cover the newly added language phenomena and entity content in real time, resulting in poor adaptability and accuracy of recognition.

Method used

The named entity recognition method based on the government industry big model is adopted. By constructing a sample data set, fine-tuning the BERT model and using a self-attention mechanism or a multi-head attention mechanism, candidate models with different performance advantages and disadvantages are trained, and the model with the best performance is finally selected as the government industry big model for naming entity recognition.

Benefits of technology

It improves the accuracy and adaptability of naming entity recognition, so that the government industry big model can better identify new language phenomena and entity content, and is suitable for government text naming entity recognition tasks in production environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783674A_ABST
    Figure CN119783674A_ABST
Patent Text Reader

Abstract

The invention provides a named entity recognition method based on a large government affair industry model and related equipment. The method comprises the steps that all government affair texts of a target government affair field are screened in an initial data set; performing data preprocessing on each government affair text; constructing a sample data set based on the training task and the preprocessed government affair 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; according to a performance evaluation result, selecting a candidate model with the optimal performance as a government affair industry large model; and performing named entity identification on the to-be-identified government affair text by applying the government affair industry large model. By applying the method, named entity recognition can be carried out through the model constructed based on the sample data of the target government affair field, the model can complete named entity recognition on unmastered data based on the learning ability of the model, 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 affairs industry. Background Art

[0002] With the development of information technology, various types of government information are gradually used for data mining in the government field to facilitate better government management and decision-making. In the process of data mining of government information, named entity recognition is one of the key tasks. The goal of named entity recognition is to identify entities with specific meanings from the corresponding text, such as names of people, places, etc.

[0003] At present, in the task of named entity recognition 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, using rules or dictionaries to identify corresponding entities in the text.

[0004] In actual application scenarios, there are many terms in the government affairs industry, and new terms and descriptions often appear in the text of government affairs information. In existing recognition methods, the recognition of named entities depends on the definition of rules or the information configured in dictionaries, but the rules and dictionaries are usually fixed and need to be updated manually, making it difficult to cover new language phenomena and newly emerged entities in real time, making the adaptability and accuracy of named entity recognition poor, which is not conducive to data mining of government affairs 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, comprising:

[0009] Determining an initial data set; the initial data set includes a plurality of government affairs texts collected in advance;

[0010] Based on the 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;

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

[0012] Determine each training task; each of the training tasks 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 of the candidate models to obtain a performance evaluation result corresponding to each of the candidate models; the performance evaluation result corresponding to each of the candidate models represents the performance quality of the candidate model;

[0017] According to the performance evaluation results, the candidate model with the best performance is selected from among the candidate models 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] In the above method, optionally, the data screening of the initial data set based on a preset target government affairs field to obtain each target government affairs text corresponding to the target government affairs field includes:

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

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

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

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

[0024] Integrate 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's instruction to confirm the integrated candidate texts is received, the integrated candidate texts are used as the target government texts.

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

[0028] Performing format conversion on each of the target government affairs texts to obtain a first government affairs text corresponding to each of the target government affairs texts;

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

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

[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] In the above method, optionally, constructing a sample data set based on each of the training tasks and each of the processed government affairs texts includes:

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

[0034] Annotate each of the processed government affairs texts according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government affairs texts;

[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 added annotated texts and each of the annotated texts.

[0037] In the above method, optionally, the training of each of the initial models based on the sample data set includes:

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

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

[0040] Based on the loss functions corresponding to the training tasks, a comprehensive loss function is constructed;

[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 of the candidate models is tested respectively to obtain a test result of each of the candidate models;

[0045] For each of the candidate models, 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 a government affairs industry, comprising:

[0051] A first determining unit is used to determine an initial data set; the initial data set includes a plurality of government affairs texts collected in advance;

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

[0053] A preprocessing unit, used for performing data preprocessing on each of the target government documents to obtain each processed government document;

[0054] A second determination unit is used 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, used to construct a sample data set based on each of the training tasks and each of the processed government affairs texts;

[0056] A third determination unit is used to 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 the network layer architecture of each of the initial models is different;

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

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

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

[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 affairs 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 named entity recognition method based on the government industry big model as described above.

[0063] A method for named entity recognition based on a large model of the government industry provided based on 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, the initial data set is screened to obtain each target government text corresponding to the target government field; data preprocessing is performed on each target government text to obtain a processed government text corresponding to each target government text; each training task is determined; each training task includes a named entity recognition task and a part-of-speech tagging task; a sample data set is constructed based on each training task and each processed government text; multiple initial models are determined; 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 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; each candidate model is evaluated for performance, and a performance evaluation result corresponding to each candidate model is obtained; the performance evaluation result corresponding to each candidate model represents the performance of the candidate model; according to 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 the government affairs text to be identified in the production environment. Applying the method provided by the embodiment of the present invention, a sample data set can be constructed based on the government affairs text and each training task in the target government affairs field, multiple initial models are 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 initial model that has completed the training, and named entity recognition is performed in the production environment through the government affairs industry big model. When faced with data with new language phenomena or entity objects that are not yet mastered, the big 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 drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0065] Figure 1 A 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;

[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 of constructing a large model of a 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 diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work 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 cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising 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 a processor of the platform. The method flow chart of the method is as follows: Figure 1 As shown, including:

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

[0074] In the method provided by the embodiment of the present invention, various government text data such as policies and regulations, official notices, work reports, and meeting minutes can be obtained in advance from various information channels such as e-government platforms and government databases. For example, various policy documents issued in the past year can be collected from government service websites. The various government texts collected in advance are used as the initial data set.

[0075] S102: 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;

[0076] In the method provided in the embodiment of the present invention, the target government affairs field can be set according to actual business needs, such as urban planning or municipal administration, etc. According to the preset data screening method, various government affairs texts associated with the target government affairs field are screened out from various government affairs texts in the initial data set, and the screened government affairs texts are used as the target government affairs texts.

[0077] S103: performing data preprocessing on each of the target government affairs documents to obtain each processed government affairs 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 preset data preprocessing strategy, so that each target government text is uniformly processed into data that meets corresponding specifications, and the target government text that has undergone data preprocessing is used as a 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 embodiment of the present invention, various training tasks for training the model can be defined, and each training task includes a named entity recognition task and a part-of-speech tagging task, and can also include other training tasks such as a syntactic analysis task. It can be understood that the named entity recognition task is used to train the model to recognize named entities in the text, and the part-of-speech tagging task is used to train the model to tag the part of speech of the recognized named entities.

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

[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 annotated according to each training task, and a sample data set can be constructed based on the annotated 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 basic model, and the BERT-Base model can be specifically 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-tune the BERT model, for example, add a fully connected layer with 256 neurons after the output layer of the BERT model, and add a classification layer after the fully connected layer to output the category of the named entity, etc. Introduce an attention mechanism in the BERT model, and a self-attention mechanism or a multi-head self-attention mechanism can be used. Use different network hierarchical architectures to fine-tune the BERT model respectively, and use each fine-tuned BERT model as the initial model.

[0085] S107: 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;

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

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

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

[0089] S109: According to the performance evaluation results, the candidate model with the best performance is selected from the candidate models as the government affairs industry macro model;

[0090] In the method provided by the embodiment of the present invention, the candidate models are sorted in order from best to worst according to the degree of performance represented by the performance evaluation results, and the candidate model with the best performance is selected as the big 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 each initial model has a different network hierarchy architecture; 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; according to each performance evaluation result, the candidate model with the best performance is selected from each candidate model as a large model for the government affairs industry; the large model for the government affairs industry 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, and a government industry big model is selected from the various initial models that have completed training, and named entity recognition is performed in a production environment through the government industry big model. When the government industry big model faces data with newly added language phenomena or entity objects that are not mastered, it can also identify the corresponding named entities based on its learning ability, which is conducive to accurate recognition of various 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 performing data screening on the initial data set based on the preset target government affairs field mentioned in step S102 to obtain each target government affairs text corresponding to the target government affairs field includes:

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

[0096] In the method provided by the embodiment of the present invention, various keywords in the target government affairs field may be set in advance according to 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 texts in the initial data set to obtain each of the government texts associated with each of the keywords, and use each of the government texts 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 the government text is 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 text in the initial data set, applying a preset government text classification model to classify the government text, and obtaining a classification result indicating whether the government text belongs to the target government field; if the classification result indicates that the government text belongs to the target government field, the government text is used as a second candidate text;

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

[0101] In the method provided by the embodiment of the present invention, each government text in the initial data set is classified into its own field by a preset government text classification model, and a classification result corresponding to each government text is obtained. According to the classification results corresponding to each government text, it is identified whether each government text belongs to the target government field, and the government text whose classification result indicates that it belongs to the target government field is marked as the second candidate text. That is, by classifying the government text by the government text classification model, the government text belonging to the target government field is screened out.

[0102] S204: for each government text in the initial data set, applying a preset text analysis algorithm to perform text analysis on the government text to obtain a text analysis result indicating whether the government text belongs to the target government field; if the text analysis result indicates that the government text belongs to the target government field, the government text is used as a third candidate text;

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

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

[0105] S205: Integrate 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 present invention, each first candidate text, each second candidate text and each third candidate text can be integrated, and the same government texts therein can be deduplicated, and each text obtained after integration can be used as each candidate text after integration. For example, if government text A is marked as both the first candidate text and the second candidate text, then only one government text A is retained in the candidate text after integration. That is, the government texts obtained by screening based on keyword screening, government text classification model and text analysis are deduplicated and integrated, and each obtained government text is regarded as each candidate text after integration.

[0107] S206: sending the integrated candidate texts to a designated person, so that the designated person can review the integrated candidate texts;

[0108] In the method provided in the embodiment of the present invention, each integrated candidate text can be sent to designated professionals, who can then manually review each candidate text.

[0109] S207: When receiving the instruction from the designated person to confirm the integrated candidate texts, the integrated candidate texts are used as the target government texts.

[0110] In the method provided by the embodiment of the present invention, if the relevant personnel confirm that the screening of each candidate text is correct after review, then the front end can send an instruction to confirm each candidate text, and when the platform receives the instruction, each candidate text can be used as the target government text. If the relevant personnel believe that there are texts with recognition errors in the corresponding fields in each candidate text after review, the front end can send an instruction to adjust each candidate text, such as deleting the specified candidate text. When the instruction of the relevant personnel to adjust each candidate text is received, the adjustment operation corresponding to the instruction can be determined, and the corresponding data processing is performed on each candidate text according to the adjustment operation, and the processed candidate texts are used as the target government text. For example, if an instruction to delete the specified candidate text is received, the specified candidate text is deleted from each candidate text, and the remaining candidate texts are used as the target government text.

[0111] Based on the method provided in the embodiment of the present invention, various government texts related to the target government field can be screened from the initial data set by combining keyword screening, government text classification model classification, text analysis and other methods, and the final target government text can be determined by combining manual review, which is conducive to improving the accuracy and relevance of data screening.

[0112] exist Figure 1 On the basis of the method shown, in the method provided by the embodiment of the present invention, the process of performing data preprocessing on each of the target government documents mentioned in step S103 to obtain each processed government document includes:

[0113] Performing format conversion on each of the target government affairs texts to obtain a first government affairs text corresponding to each of the target government affairs texts;

[0114] In the method provided by the embodiment of the present invention, each target government text may be data in different formats, such as PDF format, HTML format, etc. In the data preprocessing process, each target government text is converted into a unified format, each target government text is converted into text data in plain text format, and each text data obtained by the conversion is normalized to unify the text font, line spacing, first line indentation of paragraphs and other data, and each text data processed by the planning standard is used as the first government text corresponding to the corresponding target government text. That is, for a certain target government text, it is determined whether the target government text is text data in plain text format. If not, the target government text is formatted and converted into text data in plain text format, and the font, line spacing, first line indentation of paragraphs and other parameters of the converted text data are normalized according to the predetermined format specification, and the text data processed by the normalization is used as the first government text corresponding to the target government text.

[0115] Performing data cleaning on each of the first government affairs texts to obtain each of the second government affairs texts corresponding to each of the first government affairs texts;

[0116] In the method provided by the embodiment of the present invention, data in each first government text is cleaned, such as removing garbled characters and meaningless special characters in the text, marking the text that lacks key information for subsequent attention, and using a hash algorithm to identify whether there are repeated texts in each first government text, and delete the repeated texts, such as retaining only one of two meeting minutes with exactly the same content. Each government text obtained after data cleaning is used as each second government text.

[0117] Performing word segmentation processing on each of the second government affairs texts to obtain a word segmentation result corresponding to each of the second government affairs texts;

[0118] In the method provided by the embodiment of the present invention, a word segmentation tool (such as Jieba word segmenter) and a custom dictionary in the target government field can be used to perform word segmentation on the text data in each second government text, and the word segmentation result output by the tool can be used 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 inspection and correction, and the word segmentation result manually confirmed can be used as the word segmentation result of the corresponding second government text.

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

[0120] In the method provided by the embodiment of the present invention, the word segmentation results corresponding to each second government text are used as each processed government text.

[0121] Based on the method provided in the embodiment of the present invention, multi-source government texts can be converted into data in a unified form through data cleaning, format conversion and other processes, which is conducive to subsequent data processing and improves the processing speed. The government texts can be segmented in combination with word segmentation tools and manual review, which is conducive to improving the accuracy of word segmentation and then improving the accuracy of subsequent sample construction.

[0122] exist Figure 1 On the basis of the method shown, in the method provided by the embodiment of the present invention, the process of constructing a sample data set based on each of the training tasks and each of the processed government affairs texts mentioned in step S105 includes:

[0123] Determine a labeling rule corresponding to each of the training tasks;

[0124] In the method provided in 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 a named entity recognition task, the words belonging to the named entities in the text are labeled with their corresponding named entity categories, such as names of people, names of organizations, names of places, etc. For a 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, etc.

[0125] Annotate each of the processed government affairs texts according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government affairs texts;

[0126] In the method provided by the embodiment of the present invention, each processed government text is annotated according to the annotation rules corresponding to each training task, and the annotated processed government text is used as the annotated text. For example, if the word "government service" exists in a processed government text, "government service" is marked as a service name according to the annotation rules of the named entity recognition task, and "government service" is marked 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 techniques. For example, the named entity categories with less data in each annotated text can be counted, the data of these named entity categories can be copied, and the copied text can be used as a newly annotated text. For another 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, or 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 added 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, determine a training set and a validation set;

[0133] In the method provided by the embodiment of the present invention, the sample data set can 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] Based on the loss functions corresponding to the training tasks, a comprehensive loss function is constructed;

[0137] In the method provided by the embodiment of the present invention, the loss functions of each training task are integrated by weighted summation to construct a corresponding comprehensive 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, then the comprehensive loss function is (loss function of the named entity recognition task * 0.6 + 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 embodiment of the present invention, the initial values ​​of various parameters of model training, such as the initial learning rate, etc., can be pre-set, and then the training set and the validation set are used as training data, the loss is calculated by the comprehensive loss function, and the adaptive learning rate adjustment algorithm (Adadelta) is used for training optimization, and multi-task joint training is performed on each initial model. During the training process, the training status of each initial model can be monitored in real time, and the model parameters can be saved after a certain number of iterations are completed, so that it can be rolled back when problems occur in the training.

[0140] exist Figure 1 On the basis of 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 in 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, and the test set can be used to evaluate the model performance.

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

[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 of the candidate models, 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 in 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 according to the test results of each candidate model on the test set, and the performance indicator set composed of these performance indicators is 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 embodiment of the present invention, during the application process of the government affairs industry big model, that is, during the operation in the production environment, the named entity recognition data of the government affairs industry big model in the actual application of named entity recognition is monitored in real time, and the named entity recognition data within a certain period of time is regularly integrated as the named entity recognition result of the government affairs industry big model in the application process. For example, the named entity recognition situation of each government affairs text by the government affairs industry big model on that day is used as the named entity recognition result.

[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 an 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 government industry big model 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, the large model of the government industry in the production environment can be continuously tested, and the model can be continuously optimized to make the model 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 previous 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 recognizes the named entities of the government texts 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 big 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 present invention, various types of government text data covering policies and regulations, official documents, work reports, meeting minutes, etc. are obtained in advance from channels such as official websites of various departments, e-government platforms, and government databases. For example, various policy documents released in the past year are collected from the government service website of a certain city. The various types of government texts collected are screened, and relevant government texts in a specific government field (i.e., the target government field in the above embodiment) are retained. Specifically, keywords can be used to screen texts, such as specific keywords in a specific government field, such as "urban planning", "environmental protection", "law enforcement", etc., and texts containing these keywords are screened out through text search tools. Machine learning algorithms can be used for text screening, such as training classification models, and automatically identifying and screening texts related to specific government fields through classification models. Natural language processing technology can also be used to screen texts, such as using text analysis tools to identify themes and semantics in government texts, analyze whether they are related to specific government fields, and thus screen out texts related to specific government fields. After applying various technologies to preliminarily screen government texts, the screened government texts can be sent to professionals for manual review to ensure the accuracy and relevance of the screening results. It can be understood that the specific government affairs field is the field to which the government affairs texts that currently have the need for named entity recognition belong. For example, if it is currently necessary to apply the government affairs industry big model for named entity recognition in the scenario of market supervision, then the specific government affairs field is the market supervision field.

[0158] In the method provided by the embodiment of the present invention, the text format conversion is performed on the government texts in the specific government field that have been screened out, and government texts of various formats are uniformly converted into plain text format. For example, policy documents in PDF format and government announcements in HTML format are uniformly converted into plain text TXT format data, and the converted text data is normalized, such as unifying the line spacing to 1.5 times and indenting the first line of a paragraph by two characters. Data cleaning is performed on each government text that has undergone format conversion and data normalization processing to remove garbled characters and meaningless special characters in the text data. For example, for a certain official document notification, the existing garbled paragraphs and irrelevant emoticons are deleted. For texts with missing key information (such as missing date of issue), corresponding markings are performed so that they can be handled with caution in subsequent analysis. In addition, a hash algorithm is used to identify and delete duplicate texts. For example, only one copy of two meeting minutes with exactly the same content is retained.

[0159] (2) Word segmentation preprocessing;

[0160] In the method provided by the embodiment of the present invention, for each government text obtained after data preprocessing, the Jieba word segmenter is used in combination with a custom dictionary in the government field to segment the text to ensure that professional terms can be correctly segmented. For example, when processing official documents on land expropriation, "land expropriation" is segmented as a whole. The segmentation results are manually checked and corrected. For example, if it is found that "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 of each government text, 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 tasks and part-of-speech tagging tasks, and detailed annotation rules are formulated 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 numbers in the named entity categories in the original sample data, such as the names of specific types of institutions, and to carry out targeted replication of these minority category samples 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 the 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" in "government affairs disclosure platform", or deleting "platform". The processing process based on back-translation technology is mainly to back-translate the Chinese text in the text through 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-trained model parameters;

[0168] In the method provided in the embodiment of the present invention, the BERT model is fine-tuned as the basis. 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. Increase the number of hidden layers of the BERT model to 16 to better capture the complex semantics of government affairs texts. Adjust the L2 regularization coefficient to 0.001 to prevent the model from overfitting. Introduce an attention mechanism, which can adopt a self-attention mechanism or a multi-head attention mechanism. The self-attention mechanism calculates the correlation score between each word in the input government text and other words by introducing a feature extraction layer. For example, in a report on environmental law enforcement, the word "polluting enterprise" has a high correlation score with words such as "fine" and "shutdown". This process usually involves calculating three representations of each element in the input sequence: query, key, and value, and then calculating the attention score through these representations. The relevance score is normalized by the Softmax function to obtain the attention weight of each word. This step ensures that the sum of all weights is 1, so that it can be regarded as a probability distribution, indicating the relative importance of each word to other words. The representation of the word is weighted and summed according to the attention weight, highlighting the importance of key information such as "polluting enterprise" in the text representation. This step is actually a weighted averaging process, in which the weight is determined by the attention score calculated in the previous step. The multi-head attention mechanism uses multiple attention heads in parallel in the model, and each head learns a different attention mode. This is usually achieved by adding multiple self-attention layers to the model, each layer is responsible for capturing the correlation of different aspects of the input data. For example, some heads may focus on local information of 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 be further processed through a linear layer to integrate the information captured by different heads. Synchronize different adjustments to 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 dense layers (fully connected layers), convolutional layers, pooling layers, normalization layers, dropout layers, attention layers, and other layers.

[0169] (7) Define tasks and loss functions;

[0170] In the method provided by the embodiment of the present invention, for the training tasks in the model training, a named entity recognition task is defined, and at the same time, training tasks such as part-of-speech tagging tasks (such as nouns, verbs, adjectives, etc.) and syntactic analysis tasks (such as sentence component analysis) are defined. A loss function is constructed for each training task. For example, for the named entity recognition task, a cross entropy loss function is used, and for the part-of-speech tagging task, a mean square error loss function is used. By weighted summation, the loss functions of each training task are combined to construct a comprehensive loss function. For example, the weight of the named entity recognition task is 0.6, and the weight of the part-of-speech tagging task is 0.4.

[0171] (8) Dynamic training model;

[0172] In the method provided by the embodiment of the present invention, the sample data obtained through data enhancement is used as a sample data set, and the sample data set is divided into a training set, a validation set, and a test set according to 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. Ensure that the distribution of each data set 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, which 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 parameters of the model and use normal distribution to initialize the weight of the model with a mean of 0 and a standard deviation of 0.1. Initialize the bias term to 0.

[0175] During the model training process, a strategy of dynamically adjusting the learning rate is adopted. According to the training progress and performance of the model, the learning rate is automatically adjusted to speed up the convergence of the model and improve the training efficiency. Regarding the parameters of the dynamic adjustment of the learning rate, the initial learning rate is set to 0.005 according to the model scale and data volume. You can observe the decrease in the loss of the model on the training set at the beginning of training to determine whether the initial learning rate is appropriate. Regarding the learning rate decay strategy, an exponential decay strategy is adopted. After every 5,000 training steps, the learning rate is multiplied by 0.9. According to the performance of the model on the validation set, the decay speed and amplitude are adjusted. The learning rate is dynamically adjusted during the training process. If the accuracy of the model on the validation set does not improve for three consecutive iterations, the learning rate is reduced to 80% of the current value. Continuously monitor the model performance and dynamically adjust the learning rate to find the optimal learning rate setting.

[0176] The method provided by the embodiment of the present invention uses sample data to perform multi-task joint training on each initial model, and in each training iteration, simultaneously calculates the loss of named entity recognition and part-of-speech tagging tasks. The underlying parameters of the BERT model are shared, so that each training task promotes learning from each other. For example, the lexical information learned through the part-of-speech tagging task can help the named entity recognition task better judge the entity boundary.

[0177] (9) Model verification and parameter adjustment;

[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 the training. The accuracy, recall rate and F1 value on the training set and the 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, reduce the number of layers or increase the regularization strength. Through the grid search method, try different hyperparameter combinations to find the optimal setting. Adopt an early stopping strategy. If the F1 value of the model on the validation set does not improve in 5 consecutive iterations, stop training 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, each trained initial model is saved as a candidate model.

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

[0182] In the method provided in the embodiment of the present invention, each candidate model is evaluated on the test set. For example, on a test set containing 1,000 samples, each candidate model is tested and various evaluation indicators of the model are calculated. The accuracy, recall and F1 value are mainly used as evaluation indicators, and the precision and confusion matrix can also be paid attention to. The threshold of the accuracy is set to 90%, the threshold of the recall is set to 85%, and the threshold of the 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 present invention, the finally selected government industry big model can be deployed to the corresponding government information processing system and integrated with the system interface to realize named entity recognition of government text input in real time. For example, the model is deployed in the official document automation processing system to quickly identify the names of people, places and institutions in the official documents to be analyzed.

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

[0185] Based on the method provided by the embodiment of the present invention, the corresponding large model of the government industry can be constructed by fine-tuning the BERT model, introducing the attention mechanism, and multi-task learning strategies. The model can more accurately capture the semantic information and entity features in the government text, and the model can better handle professional texts and complex language phenomena in the government field, thereby improving the accuracy and recall of named entity recognition, and then improving the accuracy of named entity recognition in government information. In the model training process, data enhancement technology is used to effectively balance the category distribution in government data, improve the model's recognition ability for minority named entities, and avoid the performance degradation of the model due to data imbalance. By dynamically adjusting the learning rate strategy, 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 present invention can be applied to different government fields according to actual needs, such as government document processing, government information retrieval, government public opinion monitoring, and other fields, and can provide strong technical support for government management and decision-making, and has important practical application value.

[0186] and Figure 1 Corresponding to the method for named entity recognition based on the government affairs industry big model shown in FIG, an embodiment of the present invention further provides a device for named entity recognition based on the government affairs industry big model, for Figure 1 The specific implementation of the method shown in is shown in the structural diagram Figure 4 As shown, including:

[0187] The first determining unit 301 is used to determine an initial data set; the initial data set includes a plurality of government documents collected in advance;

[0188] A data screening unit 302 is used to screen the initial data set based on a preset target government affairs field to obtain each target government affairs text corresponding to the target government affairs field;

[0189] A preprocessing unit 303 is used to perform data preprocessing on each of the target government documents to obtain each processed government document;

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

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

[0192] The third determining unit 306 is used to 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 the network layer architecture of each of the initial models is different;

[0193] A model training unit 307 is used 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 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;

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

[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, and a government industry big model is selected from the various initial models that have completed the training, and named entity recognition is performed in a production environment through the government industry big model. When the government industry big model faces data with newly added language phenomena or entity objects that are not 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 function of each unit can be found in the description of each embodiment provided in the previous text for the named entity recognition method based on the big model of the government affairs 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, it 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 government affairs texts collected in advance;

[0202] Based on the 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;

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

[0204] Determine each training task; each of the training tasks 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 of the candidate models to obtain a performance evaluation result corresponding to each of the candidate models; the performance evaluation result corresponding to each of the candidate models represents the performance quality of the candidate model;

[0209] According to the performance evaluation results, the candidate model with the best performance is selected from among the candidate models 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, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can 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 may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without 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 composition and steps of each example have been generally described in the above description according to function. 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 to be beyond the scope of the present invention.

[0213] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be 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 will not be limited to the embodiments shown herein, but rather 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 in that: include: Determine the initial data set; The initial data set includes a plurality of government affairs texts collected in advance; Based on the 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; Performing data preprocessing on each of the target government affairs documents to obtain each processed government affairs document; Determine each training task; each of the training tasks 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 of the candidate models to obtain a performance evaluation result corresponding to each of the candidate models; the performance evaluation result corresponding to each of the candidate models represents the performance quality of the candidate model; According to the performance evaluation results, the candidate model with the best performance is selected from among the candidate models 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 step of screening the initial data set based on the preset target government affairs field to obtain each target government affairs text corresponding to the target government affairs field includes: Determine each keyword corresponding to the target government affairs field; Based on each of the keywords, a text search is performed on each of the government affairs texts in the initial data set to obtain each of the government affairs texts associated with each of the keywords, and each of the government affairs texts associated with each of the keywords is used as a first candidate text; For each government text in the initial data set, a preset government text classification model is applied to classify the government text to obtain a classification result indicating whether the government text belongs to the target government field; if the classification result indicates that the government text belongs to the target government field, the government text is used as the second candidate text; For each government text in the initial data set, a preset text analysis algorithm is applied to perform text analysis on the government text to obtain a text analysis result indicating whether the government text belongs to the target government field; if the text analysis result indicates that the government text belongs to the target government field, the government text is used as the third candidate text; Integrate 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 the designated person's instruction to confirm the integrated candidate texts is received, the integrated candidate texts are used as the target government texts.

3. The method for named entity recognition based on a large government industry model according to claim 1 is characterized in that: The step of performing data preprocessing on each of the target government documents to obtain each processed government document includes: Performing format conversion on each of the target government affairs texts to obtain a first government affairs text corresponding to each of the target government affairs texts; Performing data cleaning on each of the first government affairs texts to obtain each of the second government affairs texts corresponding to each of the first government affairs texts; Performing word segmentation processing on each of the second government affairs texts to obtain a word segmentation result corresponding to each of the second government affairs texts; The word segmentation results corresponding to each of the second government affairs texts are used as each of the processed government affairs 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 constructing of a sample data set based on each of the training tasks and each of the processed government affairs texts includes: Determine a labeling rule corresponding to each of the training tasks; Annotate each of the processed government affairs texts according to the annotation rules corresponding to each of the training tasks to obtain annotated text corresponding to each of the processed government affairs texts; 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 added annotated texts and each of the annotated texts.

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 training of each of the initial models based on the sample data set includes: Based on the sample data set, determine a training set and a validation set; Determine a loss function corresponding to each of the training tasks; Based on the loss functions corresponding to the training tasks, a comprehensive loss function is constructed; 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.

6. 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 of the candidate models to obtain a performance evaluation result corresponding to each of the candidate models includes: Based on the sample data set, determining a test set; Based on the test set, each of the candidate models is tested respectively to obtain a test result of each of the candidate models; For each of the candidate models, 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.

7. 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.

8. A named entity recognition device based on a large model of the government affairs 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 affairs texts collected in advance; A data screening unit, configured to screen the initial data set based on a preset target government affairs field, and obtain each target government affairs text corresponding to the target government affairs field; A preprocessing unit, used for performing data preprocessing on each of the target government documents to obtain each processed government document; A second determination unit is used 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, used to construct a sample data set based on each of the training tasks and each of the processed government affairs texts; A third determination unit is used to 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 the network layer architecture of each of the initial models is different; A model training unit, used to train each of the initial models based on the sample data set, and use each initial model that has completed the training as a candidate model; A performance evaluation unit is used to perform performance evaluation on each of the candidate models to obtain a performance evaluation result corresponding to each of the candidate models; the performance evaluation result corresponding to each of the candidate models represents the performance quality of the candidate model; A model selection unit, configured to select a candidate model with the best performance from among the candidate models according to the performance evaluation results as a large model for the government affairs industry; 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.

9. 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 7.

10. 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 7.

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

  • Model training method and device suitable for large language model, equipment and medium

    CN116976424A

  • Text data processing method, model training method and named entity recognition method

    CN117273003A

  • Named entity identification method and device for financial service

    CN118153576A