Insurance text classification method and device, equipment and medium
By combining entity recognition and data augmentation with the encoding, recurrence, and attention mechanisms of the text classification model, the problem of low efficiency and accuracy in insurance text classification is solved, achieving automated and efficient classification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA PING AN PROPERTY INSURANCE CO LTD
- Filing Date
- 2023-09-21
- Publication Date
- 2026-06-02
AI Technical Summary
In existing technologies, insurance text classification relies on human experience, resulting in low classification efficiency and difficulty in ensuring accuracy, which is time-consuming and labor-intensive.
Text entity recognition is performed using an entity recognition model. The text content is expanded through data augmentation operations, and features are extracted and attention weights are calculated using the encoding layer, bidirectional recurrent layer, and multi-head attention mechanism layer in the trained text classification model to achieve automatic classification.
It improves the efficiency and accuracy of insurance text classification, reduces the need for manual data entry, and enhances the level of automation in classification.
Smart Images

Figure CN117312558B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a method, apparatus, device, and medium for classifying insurance texts. Background Technology
[0002] Text classification refers to categorizing texts based on predetermined rules. For example, in the financial field, insurance texts can be categorized using deep learning technology. Traditional insurance text classification methods rely on manual categorization based on experience.
[0003] However, due to the wide variety of coverage scenarios and the large amount of customer information involved in insurance texts, this method is time-consuming and labor-intensive, and the accuracy is difficult to guarantee. As a result, the efficiency and accuracy of insurance text classification are low. When classifying insurance texts manually based on one's own experience, if there is a problem with the entered insurance category, it needs to be revised. Summary of the Invention
[0004] The purpose of this application is to provide an insurance text classification method, apparatus, device and medium, the main purpose of which is to improve the efficiency and accuracy of insurance text classification.
[0005] To address the aforementioned technical problems, this application provides an insurance text classification method, employing the following technical solution:
[0006] Obtain the insurance text set to be classified, and use the trained entity recognition model to perform entity recognition on the insurance text set to obtain the text entity set;
[0007] Perform data augmentation operations on the text entity set to obtain an augmented text set;
[0008] The enhanced text feature set is obtained by extracting features from the encoding layer in the trained text classification model.
[0009] The context features of the enhanced text feature set are extracted using the bidirectional recurrent layer in the text classification model to obtain the context feature set;
[0010] The attention weight values of the context feature set are calculated using the multi-head attention mechanism layer in the text classification model.
[0011] The attention weight values are input into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set.
[0012] Furthermore, the step of extracting contextual features from the enhanced text feature set using the bidirectional recurrent layer in the text classification model to obtain the contextual feature set includes:
[0013] The enhanced text feature set is input into the input gate and forget gate of the bidirectional recurrent layer to obtain the text state value;
[0014] The forward context feature set corresponding to the text state value is calculated using the forward output gate in the bidirectional recurrent layer;
[0015] The backward context feature set corresponding to the text state value is calculated using the backward output gate in the bidirectional recurrent layer;
[0016] The forward context feature set and the backward context feature set are concatenated to obtain the context feature set.
[0017] Furthermore, the entity recognition model trained is used to perform entity recognition on the insurance text set to obtain a text entity set, including:
[0018] The features of the insurance text set are extracted using the feature layer in the entity recognition model to obtain a text feature set;
[0019] The recurrent layer in the entity recognition model is used to perform entity recognition on each word in the text feature set to obtain the entity label to be predicted.
[0020] The entity labels of the entities to be predicted are annotated using the entity layer in the entity recognition model to obtain the text entity set.
[0021] Furthermore, the step of using the entity layer in the entity recognition model to annotate the labels of the entities to be predicted to obtain the text entity set includes:
[0022] The entity layer is used to obtain the score matrix and transition feature matrix of the entity label to be predicted;
[0023] The entity labels to be predicted, the score matrix, and the feature transition matrix are calculated to obtain the entity scores corresponding to the entity labels to be predicted, and the entity labels corresponding to the entity scores with the highest entity scores are integrated as the text entity set.
[0024] Furthermore, the step of calculating the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model includes:
[0025] The multi-head attention mechanism layer is used to calculate attention weights on the context feature set to obtain multiple weight values;
[0026] The attention weight value is obtained by performing a weighted operation on multiple weight values.
[0027] Furthermore, the enhanced text feature set is obtained by extracting features from the encoding layer of the trained text classification model, including:
[0028] The enhanced text set is encoded using the encoding layer to obtain a word vector feature set;
[0029] The word vector feature set is weighted and pooled to obtain a dynamic word vector feature set;
[0030] The dynamic word vector feature set is subjected to average pooling to obtain the enhanced text feature set.
[0031] Furthermore, the data augmentation operation performed on the text entity set to obtain an augmented text set includes:
[0032] Replace the location entities and scene entities in the text entity set with similar entities to obtain the first enhanced text set;
[0033] The text entity set is expanded using a preset dictionary to obtain a second enhanced text set;
[0034] The first enhanced text set and the second enhanced text set are merged to obtain the enhanced text set.
[0035] To address the aforementioned technical problems, this application also provides an insurance text classification device, which employs the following technical solution:
[0036] The recognition module is used to acquire the insurance text set to be classified, and to perform entity recognition on the insurance text set using the trained entity recognition model to obtain the text entity set;
[0037] The enhancement module is used to perform data enhancement operations on the text entity set to obtain an enhanced text set;
[0038] The first extraction module is used to extract features from the enhanced text set using the encoding layer in the trained text classification model, thereby obtaining an enhanced text feature set.
[0039] The second extraction module is used to extract the context features of the enhanced text feature set using the bidirectional recurrent layer in the text classification model, thereby obtaining the context feature set.
[0040] The calculation module is used to calculate the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model; and
[0041] The classification module is used to input the attention weight values into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set.
[0042] To address the aforementioned technical problems, this application also provides a device that employs the following technical solution:
[0043] Memory, storing at least one computer program; and
[0044] The processor executes the computer program stored in the memory to implement the insurance text classification method described above.
[0045] To address the aforementioned technical problems, this application also provides a computer-readable medium, which employs the following technical solution:
[0046] The computer-readable medium stores at least one computer program, which is executed by a processor in an electronic device to implement the insurance text classification method described above.
[0047] Compared with the prior art, the embodiments of this application have the following main advantages:
[0048] In this embodiment, firstly, entity recognition is performed on the insurance text set using an entity recognition model to obtain a text entity set. Data augmentation is then performed on this text entity set to expand its content, improving the accuracy of subsequent text classification. Secondly, features of the augmented text set are extracted using the encoding layer of the trained text classification model, enabling accurate feature extraction of the insurance text. Furthermore, context features of the augmented text feature set are extracted using a bidirectional recurrent layer, resulting in a context feature set that accurately captures the contextual features between insurance texts, further improving the accuracy of subsequent text classification. Finally, attention weights of the context feature set are calculated using a multi-head attention mechanism layer and input into the text classification model to obtain the insurance classification category of the insurance text set. This enables automatic classification of insurance texts, eliminating the need for manual input of insurance categories and improving the efficiency and accuracy of insurance text classification. Therefore, the insurance text classification method, apparatus, device, and medium proposed in this application can improve the efficiency and accuracy of insurance text classification. Attached Figure Description
[0049] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0051] Figure 2A flowchart of an embodiment of the insurance text classification method according to this application;
[0052] Figure 3 yes Figure 2 A flowchart of a specific implementation of step S204;
[0053] Figure 4 This is a schematic diagram of the structure of an embodiment of the insurance text classification device according to this application;
[0054] Figure 5 This is a schematic diagram of the structure of one embodiment of the device according to this application. Detailed Implementation
[0055] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0056] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0057] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0058] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0059] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0060] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0061] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0062] It should be noted that the insurance text classification method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the insurance text classification device is generally set in the server / terminal device.
[0063] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0064] Continue to refer to Figure 2 A flowchart of an embodiment of the insurance text classification method according to this application is shown. The insurance text classification method includes the following steps:
[0065] S201. Obtain the insurance text set to be classified, and use the trained entity recognition model to perform entity recognition on the insurance text set to obtain the text entity set.
[0066] In this embodiment, the insurance text set includes text collections such as accident insurance, auto insurance, insurance coverage scenarios, insurance coverage locations, and customer information (e.g., name, type of insurance purchased). The text entity set is a collection of entities describing the insurance text set, such as accident insurance, construction accident insurance, hydropower station accident insurance, and customer names.
[0067] Furthermore, in this embodiment, the trained entity recognition model is a neural network model composed of an embedding layer, a recurrent layer, and an entity layer. The embedding layer is used to extract features from the insurance text set; the recurrent layer is used to initially identify entity labels in the insurance text set; and the entity layer is used to annotate entity labels to further determine the set of text entities in the insurance text.
[0068] As an embodiment of this application, the step of using the trained entity recognition model to perform entity recognition on the insurance text set to obtain a text entity set includes:
[0069] The features of the insurance text set are extracted using the feature layer in the entity recognition model to obtain a text feature set;
[0070] The recurrent layer in the entity recognition model is used to perform entity recognition on each word in the text feature set to obtain the entity label to be predicted.
[0071] The entity labels of the entities to be predicted are annotated using the entity layer in the entity recognition model to obtain the text entity set.
[0072] The embedding layer can be a RoBERTa network layer. The [CLS] of the RoBERTa network layer marks the start position of the insurance text set sequence; [SEP] identifies the sentence segmentation position of the insurance text set. The insurance text set is segmented into sentences according to the [CLS] and [SEP] symbols, and features are extracted from each character of the segmented sentence to obtain a text feature set including the vector of each character.
[0073] In one embodiment of this application, the recurrent layer can be an LSTM network layer. The LSTM network layer further captures the contextual features in the text feature set and outputs the label corresponding to each character feature of the contextual features as the entity label to be predicted. For example, if a group accident insurance policy is effective at location A and in a railway scenario, the entity labels to be predicted output by the LSTM network layer would be group accident insurance, effective, location, scenario, location A and railway scenario, etc.
[0074] Furthermore, in this embodiment, the entity layer can be a CRF network layer, which uses the highest-scoring label among the entity labels to be predicted output by the LSTM layer as the text entity set.
[0075] In this embodiment of the application, by using the entity layer in the entity recognition model to label the entity to be predicted, the transition relationship between the entity to be predicted output by the loop layer can be identified, the interrelationship between the entity to be predicted can be strengthened, and the accuracy of entity recognition can be further improved.
[0076] Furthermore, in this embodiment of the application, the step of using the entity layer in the entity recognition model to annotate the entity labels to be predicted to obtain the text entity set includes:
[0077] The entity layer is used to obtain the score matrix and transition feature matrix of the entity label to be predicted;
[0078] The entity labels to be predicted, the score matrix, and the feature transition matrix are calculated to obtain the entity scores corresponding to the entity labels to be predicted, and the entity labels corresponding to the entity scores with the highest entity scores are integrated as the text entity set.
[0079] The score matrix is the label score of the entity label to be predicted output by the LSTM network layer, and the transfer feature matrix is the new label score obtained by randomly transferring the entity labels to be predicted between the score matrix. For example, transferring entity group accident insurance a to entity group accident insurance b will form a new transferred label score.
[0080] In one embodiment of this application, the entity label to be predicted, the score matrix, and the feature transition matrix can be calculated using the following formula:
[0081]
[0082] Where S(y) represents the entity score of the y-th entity label to be predicted; n represents the number of words; and P is the score matrix. This represents the y-th word of the t-th word. t The label scores of the entities to be predicted; A is the transition feature matrix. Indicates the yth t The label score of the entity label to be predicted and the label score of the y-th entity. t-1 The probability of transitions between the label scores of the entities to be predicted.
[0083] In this embodiment of the application, by calculating the entity score corresponding to the entity label to be predicted, the score matrix and the feature transition matrix, all possible entity scores of the entity label to be predicted can be obtained, and the entity label corresponding to the highest entity score among the obtained entity scores is taken as the corresponding text entity, which further improves the accuracy of entity recognition.
[0084] S202. Perform data augmentation operations on the text entity set to obtain an augmented text set.
[0085] In this embodiment of the application, the enhanced text set refers to the text set after text entities have been expanded.
[0086] As an embodiment of this application, the step of performing data augmentation on the insurance text set based on the location entities and scene entities in the text entity set to obtain an augmented text set includes:
[0087] Replace the location entities and scene entities in the text entity set with similar entities to obtain the first enhanced text set;
[0088] The text entity set is expanded using a preset dictionary to obtain a second enhanced text set;
[0089] The first enhanced text set and the second enhanced text set are merged to obtain the enhanced text set.
[0090] The aforementioned entity replacement can be achieved by replacing location entities with scene entities to enhance data. For example, group accident insurance 'a' corresponds to the location entity region B and the scene entity hydropower station; group accident insurance 'b' corresponds to the location entity region C and the scene entity breakwater. By replacing the entities of region B and region C, and replacing the entity of hydropower station with breakwater, we can obtain two new enhanced texts: group accident insurance 'a' corresponds to region C and breakwater, or region C and hydropower station; and group accident insurance 'b' corresponds to region B and breakwater, or region B and hydropower station.
[0091] In one embodiment of this application, the preset dictionary can be an insurance dictionary. Multiple dictionary vectors can be obtained by performing word embedding operations on the dictionary, and multiple text entity vectors corresponding to the text entity set can be obtained. The multiple dictionary vectors and the multiple text entity vectors are concatenated to obtain the second enhanced text set.
[0092] In this embodiment, by replacing the location entities and scene entities in the text entity set with similar entities, and by expanding the text entity set using a preset dictionary, diverse insurance text entities can be generated, which facilitates improving the accuracy of subsequent insurance text classification.
[0093] S203. Extract the features of the enhanced text set using the encoding layer in the trained text classification model to obtain the enhanced text feature set.
[0094] In this embodiment of the application, the trained text classification model can be a model combining a RoBERTa model, a bidirectional recurrent model (BiLSTM), and a multi-head attention mechanism. The text classification model includes an encoding layer, a bidirectional recurrent layer, a multi-head attention mechanism layer, and a fully connected layer.
[0095] In this embodiment, when training the text classification model, the following steps are taken: First, the set of insurance texts to be classified and the corresponding standard insurance classification categories are obtained. Then, the enhanced text feature set of the enhanced text set is extracted through the encoding layer, and the context feature set of the enhanced text feature set is extracted through the bidirectional recurrent layer. Second, the attention weight value of the context feature set is calculated through the multi-head attention mechanism layer. Finally, the attention weight value is input into the fully connected layer to obtain the predicted insurance classification category. The loss value between the standard insurance classification category and the predicted insurance classification category is calculated using a loss function (such as the ReLU function). The parameters of the text classification model are adjusted according to the loss value until the loss value meets the preset threshold, thus obtaining the trained text classification model.
[0096] As an embodiment of this application, the step of extracting features from the enhanced text set using the encoding layer of the trained text classification model to obtain an enhanced text feature set includes:
[0097] The enhanced text set is encoded using the encoding layer to obtain a word vector feature set;
[0098] The word vector feature set is weighted and pooled to obtain a dynamic word vector feature set;
[0099] The dynamic word vector feature set is subjected to average pooling to obtain the enhanced text feature set.
[0100] The encoding layer consists of a RoBERTa model, which encodes the augmented text set to extract accurate augmented text feature sets.
[0101] In one embodiment of this application, the encoding layer encodes the enhanced text set. The encoding layer can encode each word in the enhanced text set to extract the word vector feature set corresponding to each word in the enhanced text set.
[0102] Furthermore, in one embodiment of this application, the weighted pooling means taking the average of the first and last vectors in the vector sequence of the word vector feature set. Through weighted pooling, word vectors with semantic features from different layers can be fused to improve the semantic representation ability of word vectors.
[0103] In this embodiment, the average pooling means taking the average value of all dynamic word vector features in the dynamic word vector feature set, realizing information interaction between dynamic word vector features to generate an enhanced text feature set that is closely related to the context, further improving the semantic representation ability of word vectors and accurately representing the semantic information of text features.
[0104] S204. Use the bidirectional recurrent layer in the text classification model to extract the context features of the enhanced text feature set to obtain the context feature set.
[0105] In this embodiment, the bidirectional recurrent layer is constructed using a Bidirectional Long Short-Term Memory (Bi-LSTM) model. Its main function is to capture not only the dependencies between forward text features but also the dependencies between backward text features, thereby improving the accuracy of context feature extraction. The bidirectional recurrent layer includes an input gate, a forget gate, a forward output gate, and a backward output gate.
[0106] As an embodiment of this application, reference is made to Figure 3 As shown, the step of extracting contextual features from the enhanced text feature set using the bidirectional recurrent layer in the text classification model to obtain the contextual feature set includes the following steps S2041-S2044:
[0107] S2041. Input the enhanced text feature set into the input gate and forget gate of the bidirectional recurrent layer to obtain the text state value;
[0108] S2042. Calculate the forward context feature set corresponding to the text state value using the forward output gate in the bidirectional recurrent layer;
[0109] S2043. Calculate the backward context feature set corresponding to the text state value using the backward output gate in the bidirectional recurrent layer;
[0110] S2044. The forward context feature set and the backward context feature set are concatenated to obtain the context feature set.
[0111] Specifically, the text state value can be obtained by inputting an enhanced text feature set into an input gate to output a first state value, inputting the first state value into a forget gate to output a second state value, further calculating the product between the first state value and the peak value of the enhanced text feature set at time t of the input gate to obtain the first text state value; calculating the product between the second state value and the enhanced text feature set and the peak value at time t of the forget gate to obtain the second text state value, and using the sum of the first text state value and the second text state value as the text state value.
[0112] In one embodiment of this application, the forward context feature set and the backward context feature set can be calculated using the following formula:
[0113]
[0114]
[0115] in, Represents the forward context feature set at time t. Represents the backward context feature set at time t. and For the variable parameters in the Bi-LSTM network, For the preceding forward context feature at time t-1 of the forward context feature set, This is the previous backward context feature of the backward context feature set at time t+1.
[0116] In this embodiment, the forward output gate in the bidirectional recurrent layer is used to calculate the forward context feature set corresponding to the text state value, and the backward output gate in the bidirectional recurrent layer is used to calculate the backward context feature set corresponding to the text state value. This not only captures the dependency relationship between forward text features in the text, but also captures the dependency relationship between backward text features, thereby further improving the accuracy of context feature extraction.
[0117] S205. Calculate the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model.
[0118] In this embodiment of the application, the multi-head attention mechanism layer is composed of a multi-head attention mechanism (Multi-HeadAttention) model.
[0119] As an embodiment of this application, the step of calculating the attention weight value of the context feature set using the multi-head attention mechanism layer in the text classification model includes:
[0120] The multi-head attention mechanism layer is used to calculate attention weights on the context feature set to obtain multiple weight values;
[0121] The attention weight value is obtained by performing a weighted operation on multiple weight values.
[0122] Specifically, by performing dot product operations on context features in the context feature set using preset transformation parameters (including Query, Key, and Value) in the attention mechanism, multiple weight values (including query vector, key vector, and value vector) can be obtained. Then, the query vector, key vector, and value vector are multiplied by preset training matrices Wquery, Wkey, and Wvalue respectively to obtain multiple feature attention scores. Finally, the multiple weight values are weighted and summed with their corresponding feature attention scores to obtain the attention weight value.
[0123] S206. Input the attention weight values into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set.
[0124] In this embodiment of the application, the insurance categories include accident insurance, auto insurance, and property insurance, etc.
[0125] In one embodiment of this application, attention weight values are input into the fully connected layer, and the activation function (such as the Softmax function) in the fully connected layer outputs the category probability of the attention weight values. For example, if there is an insurance text set E, the probability of belonging to the accident insurance category is 0.85 and the probability of belonging to the property insurance category is 0.65, then the insurance category corresponding to the highest probability among the above two category probabilities is selected as the classification result of the insurance text set E.
[0126] For example, if there is an insurance policy document outlining the types of insurance that members of a mountaineering team in region A need to purchase, then the insurance category would be group accident insurance.
[0127] In this embodiment, the attention weight value is input into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set. This enables the automatic input of the insurance text set into the corresponding insurance category, achieving automatic classification of insurance text without the need for manual input of insurance categories, thus improving the efficiency and accuracy of insurance text classification.
[0128] Compared with the prior art, the embodiments of this application have the following main advantages:
[0129] In this embodiment, firstly, entity recognition is performed on the insurance text set using an entity recognition model to obtain a text entity set. Data augmentation is then performed on this text entity set to expand its content, improving the accuracy of subsequent text classification. Secondly, features of the augmented text set are extracted using the encoding layer of the trained text classification model, enabling accurate feature extraction of the insurance text. Furthermore, context features of the augmented text feature set are extracted using a bidirectional recurrent layer, resulting in a context feature set that accurately captures the contextual features between insurance texts, further improving the accuracy of subsequent text classification. Finally, attention weights of the context feature set are calculated using a multi-head attention mechanism layer and input into the text classification model to obtain the insurance classification category of the insurance text set. This enables automatic classification of insurance texts, eliminating the need for manual input of insurance categories and improving the efficiency and accuracy of insurance text classification. Therefore, the insurance text classification method proposed in this application can improve the efficiency and accuracy of insurance text classification.
[0130] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0131] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a computer-readable medium. When executed, the program can include the processes of the embodiments of the above methods. The aforementioned medium can be a non-volatile medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0132] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0133] Further reference Figure 4 As a response to the above Figure 2 The implementation of the method shown in this application provides an embodiment of an insurance text classification device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0134] like Figure 4 As shown, the insurance text classification device 400 described in this embodiment includes: a recognition module 401, an enhancement module 402, a first extraction module 403, a second extraction module 404, a calculation module 405, and a classification module 406. Wherein:
[0135] The recognition module 401 is used to acquire the insurance text set to be classified, and to perform entity recognition on the insurance text set using the trained entity recognition model to obtain the text entity set;
[0136] The enhancement module 402 is used to perform data enhancement operations on the text entity set to obtain an enhanced text set;
[0137] The first extraction module 403 is used to extract features of the enhanced text set using the encoding layer in the trained text classification model to obtain an enhanced text feature set;
[0138] The second extraction module 404 is used to extract the context features of the enhanced text feature set using the bidirectional recurrent layer in the text classification model, thereby obtaining the context feature set;
[0139] The calculation module 405 is used to calculate the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model; and
[0140] The classification module 406 is used to input the attention weight values into the fully connected layer in the text classification model to obtain the insurance classification category of the insurance text set.
[0141] In this embodiment, the functions of each module / unit are as follows:
[0142] In detail, the modules in the insurance text classification device 400 described in this application embodiment adopt the same methods as described above when in use. Figures 1 to 3 The method uses the same technical means as the insurance text classification method described above and can produce the same technical effect, so it will not be elaborated here.
[0143] In this embodiment, firstly, entity recognition is performed on the insurance text set using an entity recognition model to obtain a text entity set. Data augmentation is then performed on this text entity set to expand its text content, improving the accuracy of subsequent text classification. Secondly, features of the augmented text set are extracted using the encoding layer of the trained text classification model, enabling accurate feature extraction of the insurance text. Furthermore, context features of the augmented text feature set are extracted using a bidirectional recurrent layer, resulting in a context feature set that accurately captures the contextual features between insurance texts, further improving the accuracy of subsequent text classification. Finally, attention weights of the context feature set are calculated using a multi-head attention mechanism layer and input into the text classification model to obtain the insurance classification category of the insurance text set. This enables automatic classification of insurance texts, eliminating the need for manual input of insurance categories and improving the efficiency and accuracy of insurance text classification. Therefore, the insurance text classification device proposed in this application can improve the efficiency and accuracy of insurance text classification.
[0144] The device 5 includes a memory 51, a processor 52, and a network interface 53 that are interconnected via a system bus. It should be noted that only device 5 with components 51-53 is shown in the figure; however, it should be understood that it is not required to implement all shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the device described here is one capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0145] The device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0146] The memory 51 includes at least one type of readable medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or D-type text classification memory), random access memory (RAM), static random access memory (SRAM), etc.
[0147] (SRAM), Read-Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Programmable Read-Only Memory (PROM), Magnetic Memory, Disk, Optical Disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the device 5, such as the hard disk or memory of the device 5. In other embodiments, the memory 51 may also be an external storage device of the device 5, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the device 5. Of course, the memory 51 may include both the internal storage unit and the external storage device of the device 5. In this embodiment, the memory 51 is typically used to store the operating system and various application software installed on the device 5, such as computer-readable instructions for insurance text classification methods. In addition, the memory 51 may also be used to temporarily store various types of data that have been output or will be output.
[0148] In some embodiments, the processor 52 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 52 is typically used to control the overall operation of the device 5. In this embodiment, the processor 52 is used to execute computer-readable instructions stored in the memory 51 or to process data, such as executing computer-readable instructions for the insurance text classification method.
[0149] The network interface 53 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the device 5 and other electronic devices.
[0150] In this embodiment, firstly, entity recognition is performed on the insurance text set using an entity recognition model to obtain a text entity set. Data augmentation is then performed on this text entity set to expand its content, improving the accuracy of subsequent text classification. Secondly, features of the augmented text set are extracted using the encoding layer of the trained text classification model, enabling accurate feature extraction of the insurance text. Furthermore, contextual features of the augmented text feature set are extracted using a bidirectional recurrent layer, resulting in a contextual feature set that accurately captures the contextual features between insurance texts, further improving the accuracy of subsequent text classification. Finally, attention weights of the contextual feature set are calculated using a multi-head attention mechanism layer and input into the text classification model to obtain the insurance classification category of the insurance text set. This enables automatic classification of insurance texts, eliminating the need for manual input of insurance categories and improving the efficiency and accuracy of insurance text classification. Therefore, the insurance text classification medium proposed in this application can improve the efficiency and accuracy of insurance text classification.
[0151] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0152] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for classifying insurance texts, characterized in that, Includes the following steps: Obtain the insurance text set to be classified, and use the trained entity recognition model to perform entity recognition on the insurance text set to obtain the text entity set; Perform data augmentation operations on the text entity set to obtain an augmented text set; The enhanced text feature set is obtained by extracting features from the encoding layer of the trained text classification model. The trained text classification model is a model that combines the RoBERTa model, the bidirectional recurrent model, and the multi-head attention mechanism. The text classification model includes an encoding layer, a bidirectional recurrent layer, a multi-head attention mechanism layer, and a fully connected layer. The context features of the enhanced text feature set are extracted using the bidirectional recurrent layer in the text classification model to obtain the context feature set; The attention weight values of the context feature set are calculated using the multi-head attention mechanism layer in the text classification model. The attention weight values are input into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set; The step of calculating the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model includes: The multi-head attention mechanism layer is used to calculate attention weights on the context feature set to obtain multiple weight values; The attention weight value is obtained by performing a weighted operation on multiple weight values; In this process, multiple weight values are obtained by performing dot product operations on the context features in the context feature set using preset transformation parameters in the attention mechanism. These multiple weight values include query vectors, key vectors, and numerical vectors. The query vector, key vector, and numerical vector are then multiplied by a preset training matrix to obtain multiple feature attention scores. Finally, the multiple weight values are summed with their corresponding feature attention scores to obtain the attention weight value. The transformation parameters include query parameters, key parameters, and numerical parameters. The context features of the enhanced text feature set are extracted using the bidirectional recurrent layer in the text classification model, resulting in the context feature set, which includes: The enhanced text feature set is input into the input gate and forget gate of the bidirectional recurrent layer to obtain the text state value; The forward context feature set corresponding to the text state value is calculated using the forward output gate in the bidirectional recurrent layer; The backward context feature set corresponding to the text state value is calculated using the backward output gate in the bidirectional recurrent layer; The forward context feature set and the backward context feature set are concatenated to obtain the context feature set; The enhanced text feature set is obtained by extracting features from the encoding layer of the trained text classification model, including: The enhanced text set is encoded using the encoding layer to obtain a word vector feature set; The word vector feature set is weighted and pooled to obtain a dynamic word vector feature set. The weighted pooling means taking the average of the first and last vectors in the vector sequence of the word vector feature set. The dynamic word vector feature set is subjected to average pooling to obtain an enhanced text feature set. The average pooling means taking the average value of all dynamic word vector features in the dynamic word vector feature set.
2. The insurance text classification method according to claim 1, characterized in that, The entity recognition model, after training, is used to perform entity recognition on the insurance text set to obtain a text entity set, including: The features of the insurance text set are extracted using the feature layer in the entity recognition model to obtain a text feature set; The recurrent layer in the entity recognition model is used to perform entity recognition on each word in the text feature set to obtain the entity label to be predicted. The entity labels of the entities to be predicted are annotated using the entity layer in the entity recognition model to obtain the text entity set.
3. The insurance text classification method according to claim 1 or 2, characterized in that, The step of calculating the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model includes: The multi-head attention mechanism layer is used to calculate attention weights on the context feature set to obtain multiple weight values; The attention weight value is obtained by performing a weighted operation on multiple weight values.
4. The insurance text classification method according to claim 1 or 2, characterized in that, The data augmentation operation performed on the text entity set to obtain the augmented text set includes: Replace the location entities and scene entities in the text entity set with similar entities to obtain the first enhanced text set; The text entity set is expanded using a preset dictionary to obtain a second enhanced text set; The first enhanced text set and the second enhanced text set are merged to obtain the enhanced text set.
5. An insurance text classification device, characterized in that, The insurance text classification device implements the steps of the insurance text classification method as described in any one of claims 1 to 4, and the insurance text classification device includes: The recognition module is used to acquire the insurance text set to be classified, and to perform entity recognition on the insurance text set using the trained entity recognition model to obtain the text entity set; The enhancement module is used to perform data enhancement operations on the text entity set to obtain an enhanced text set; The first extraction module is used to extract features from the enhanced text set using the encoding layer in the trained text classification model, thereby obtaining an enhanced text feature set. The second extraction module is used to extract the context features of the enhanced text feature set using the bidirectional recurrent layer in the text classification model, thereby obtaining the context feature set. The calculation module is used to calculate the attention weight values of the context feature set using the multi-head attention mechanism layer in the text classification model; and The classification module is used to input the attention weight values into the fully connected layer of the text classification model to obtain the insurance classification category of the insurance text set.
6. An apparatus comprising a memory and a processor, the memory storing computer-readable instructions, wherein the processor, when executing the computer-readable instructions, implements the steps of the insurance text classification method as described in any one of claims 1 to 4.
7. A computer-readable medium, characterized in that, The computer-readable medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the insurance text classification method as described in any one of claims 1 to 4.