Intention entity information extraction method, device, computer equipment and storage medium
By encoding and converting the initial text data of the pre-trained model in intelligent customer service, and combining it with a dictionary tree to build a text entity library, the problem of large memory and slow inference speed of the pre-trained model in intelligent customer service is solved, and the text intention and entity are realized Efficient and accurate extraction of information.
Patent Information
- Application Number
- CN202011310526.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-20
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-11-20
AI Technical Summary
The existing pre-training model in intelligent customer service uses large memory and slow model inference speed, resulting in long response time. Moreover, the neural network model can only extract specific entity information and cannot effectively extract uncertain entity information, resulting in text intent and entity extraction. Accuracy is low.
An intent entity information extraction method is adopted, by obtaining initial text data for preprocessing, using an initial training model including a coding layer, a conversion layer, a fully connected layer and a conditional random field model to train the text data to be processed, and extracting the network layer as the intent Recognition model, combine with dictionary tree to build text entity library, improve the recognition efficiency and accuracy of the model.
It achieves accurate extraction of text intent and entity information, improves the accuracy of text intent and entity information extraction, reduces the response time of model processing, and improves recognition efficiency.
Smart Images

Figure CN112417886B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, apparatus, computer equipment and storage medium for extracting intent entity information. Background Art
[0002] With the development of big data and artificial intelligence, intelligent customer service has become a key component in various fields such as e-commerce and travel. In the financial field, intelligent customer service is also widely used in the approval process of user data. By obtaining the expression content of the target object and identifying the expression content, the target object can be further identified and classified.
[0003] Currently, in the field of intent understanding, it is mainly divided into two modules: text classification and entity extraction. Existing text classification models include pre-trained models and long short-term memory network models, and entity extraction models include hidden Markov models. Among them, the pre-trained model quickly achieved good results in the field of natural language processing due to its excellent semantic understanding ability, and therefore has been widely used. However, in engineering applications, the pre-trained model occupies a large amount of video memory and has a slow model inference speed, resulting in a long response time for intelligent customer service. In addition, since the neural network model can only extract specific entities, it cannot extract some uncertain entity information, which ultimately leads to the problem of low accuracy of text intent and entity extraction. Summary of the invention
[0004] The purpose of the embodiments of the present application is to propose a method, apparatus, computer device and storage medium for extracting intent entity information to solve the technical problem of low accuracy in text intent and entity extraction.
[0005] In order to solve the above technical problems, the embodiment of the present application provides a method for extracting intent entity information, which adopts the following technical solution:
[0006] Acquire initial text data, and preprocess the initial text data to obtain text data to be processed;
[0007] Obtain a preset initial training model, input the text data to be processed into the initial training model, obtain training intention information and training entity information, train the initial training model according to the training intention information and the training entity information, and when the training of the initial training model is completed, determine the initial training model as an initial recognition model;
[0008] Extracting a preset number of network layers from the initial recognition model, and using the extracted initial recognition model as an intent recognition model;
[0009] When the target text data is received, the target text data is recognized according to the intention recognition model to obtain the intention result and entity information of the target text data.
[0010] Furthermore, the initial training model includes an encoding layer, a conversion layer, a fully connected layer, and a conditional random field model processing layer, and the step of inputting the text data to be processed into the initial training model to obtain training intent information and training entity information specifically includes:
[0011] Inputting the text data to be processed into the encoding layer, passing through the conversion layer and the fully connected layer, and outputting the training intention information;
[0012] The text data to be processed is input into the encoding layer, passes through the conversion layer and the conditional random field model processing layer, and outputs the training entity information.
[0013] Furthermore, the step of training the initial training model according to the training intention information and the training entity information specifically includes:
[0014] Obtaining standard intent information and standard entity information of the text data to be processed, calculating a first loss function according to the standard intent information and the training intent information, calculating a second loss function according to the standard entity information and the training entity information, calculating a total loss function according to the first loss function and the second loss function, and determining the initial training model as a model to be verified when the total loss function converges;
[0015] A test text is obtained, and the model to be verified is verified according to the test text. When a verification pass rate of the model to be verified for the test text is greater than or equal to a preset threshold, it is determined that the training of the initial training model is completed.
[0016] Furthermore, after the step of obtaining the intention result and entity information of the target text data, the method further includes:
[0017] Regularly collect text entity information, and establish a dictionary tree according to the text entity information;
[0018] A text entity library of the text entity information is constructed based on the dictionary tree.
[0019] Furthermore, the step of establishing a dictionary tree according to the text entity information specifically includes:
[0020] Acquire a standard weight value of the text entity information, determine that the standard weight value is a leaf node, and determine that the text entity information is a non-leaf node;
[0021] A dictionary tree is established according to the leaf nodes and the non-leaf nodes.
[0022] Furthermore, after the step of constructing a text entity library of the text entity information based on the dictionary tree, the method further includes:
[0023] When a new text to be detected is detected, first entity information of the new text to be detected is extracted according to the intention recognition model, and a default weight value is assigned to the first entity information;
[0024] Acquire second entity information of the new text to be detected and a standard weight value of the second entity information according to the text entity library;
[0025] The target entity information of the new text to be detected is determined according to the default weight value and the standard weight value.
[0026] Furthermore, the step of determining the target entity information of the new text to be detected according to the default weight value and the standard weight value specifically includes:
[0027] determining whether there is second entity information that is consistent with the first entity information, and when it is determined that there is second entity information that is consistent with the first entity information, adjusting the default weight value of the first entity information to a standard weight value of the second entity information that is consistent with the first entity information;
[0028] Determine that the entity information corresponding to the maximum weight value among all the standard weight values is the target entity information of the new text to be detected.
[0029] In order to solve the above technical problems, the embodiment of the present application also provides an intention entity information extraction device, which adopts the following technical solution:
[0030] An acquisition module, used for acquiring initial text data, preprocessing the initial text data, and obtaining text data to be processed;
[0031] A first training module is used to obtain a preset initial training model, input the text data to be processed into the initial training model, obtain training intention information and training entity information, train the initial training model according to the training intention information and the training entity information, and determine the initial training model as an initial recognition model when the training of the initial training model is completed;
[0032] A second training module is used to extract a preset number of network layers from the initial recognition model and use the extracted initial recognition model as an intent recognition model;
[0033] The recognition module is used to recognize the target text data according to the intention recognition model when receiving the target text data, so as to obtain the intention result and entity information of the target text data.
[0034] In order to solve the above technical problems, an embodiment of the present application also provides a computer device, including a memory and a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor implements the steps of the above-mentioned intention entity information extraction method when executing the computer-readable instructions.
[0035] In order to solve the above technical problems, an embodiment of the present application also provides a computer-readable storage medium, which stores computer-readable instructions. When the computer-readable instructions are executed by a processor, the steps of the above-mentioned intention entity information extraction method are implemented.
[0036] The above-mentioned intention entity information extraction method obtains initial text data, preprocesses the initial text data, and obtains the text data to be processed. By preprocessing the text data to be processed, the model training process can be reduced and the trained model can be made more accurate; then, a preset initial training model is obtained, the text data to be processed is input into the initial training model, and training intention information and training entity information are obtained. The initial training model is trained according to the training intention information and training entity information. When the initial training model is trained, the initial training model is determined to be an initial recognition model. The text intent can be accurately recognized through the initial recognition model. Afterwards, a preset number of network layers are extracted from the initial recognition model, and the extracted initial recognition model is used as the intent recognition model. By extracting the network layers of the initial recognition model, the response time of the model processing can be reduced, thereby improving the efficiency of extracting intent and entity information. When the target text data is received, the target text data is recognized according to the intent recognition model to obtain the intent result and entity information of the target text data, thereby achieving accurate extraction of text intent and entity information, improving the accuracy of text intent and entity information extraction, reducing the response time of the model processing, and improving the recognition efficiency of text intent and entity information. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0038] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0039] Figure 2 A flowchart of an embodiment of a method for extracting intent entity information according to the present application;
[0040] Figure 3 is a structural schematic diagram of an embodiment of an intention entity information extraction device according to the present application;
[0041] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application.
[0042] Reference numerals: apparatus for extracting intended entity information 300 , acquisition module 301 , first training module 302 , second training module 303 , and recognition module 304 . DETAILED DESCRIPTION
[0043] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0044] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0045] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0046] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0047] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0048] Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, etc.
[0049] The server 105 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal devices 101 , 102 , and 103 .
[0050] It should be noted that the intent entity information extraction method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the intent entity information extraction device is generally set in the server / terminal device.
[0051] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0052] Continue to refer Figure 2 , shows a flow chart of an embodiment of a method for extracting intent entity information according to the present application. The method for extracting intent entity information comprises the following steps:
[0053] Step S201, obtaining initial text data, and preprocessing the initial text data to obtain text data to be processed;
[0054] In this embodiment, the initial text data is the text data extracted by the target intention, and the initial text data can be converted from the target voice data. The initial text data is obtained, and when the initial text data is obtained, the initial text data is preprocessed. The preprocessing includes removing punctuation marks, filtering special characters, and replacing half-width and full-width characters. The preprocessed initial text data is the text data to be processed.
[0055] Step S202, obtaining a preset initial training model, inputting the text data to be processed into the initial training model, obtaining training intention information and training entity information, training the initial training model according to the training intention information and the training entity information, and determining the initial training model as an initial recognition model when the training of the initial training model is completed;
[0056] In this embodiment, when the text data to be processed is obtained, the initial training model is trained according to the text data to be processed. Specifically, the training intention information and the training entity information of the text data to be processed are obtained, and the loss function of the initial training model is calculated according to the training intention information and the training entity information. When the loss function converges, the initial training model is determined to be the model to be verified. After that, the test text is obtained, and the model to be verified is tested according to the test text. When the verification pass rate of the initial training model after training for the test text is greater than or equal to the preset threshold, the model to be verified is determined to be the initial recognition model.
[0057] Step S203, extracting a preset number of network layers from the initial recognition model, and using the extracted initial recognition model as an intent recognition model;
[0058] In this embodiment, when the initial recognition model is obtained, a preset number of network layers are extracted from the initial recognition model, and the network layers are network layers in the conversion layer in the initial recognition model. The conversion layer in the initial recognition model includes 12 layers of network layers, and a preset number of network layers are extracted from the 12 layers of network layers, such as extracting the first layer network, the fourth layer network, the eighth layer network, and the twelfth layer network. The extracted initial recognition model is the intent recognition model.
[0059] Step S204, when the target text data is received, the target text data is identified according to the intention recognition model to obtain the intention result and entity information of the target text data.
[0060] In this embodiment, the target text data is the received text data that needs to be subjected to intent recognition and entity recognition, and the acquired target text data is subjected to intent and entity recognition according to the intent recognition model. Specifically, the intent recognition model and the initial training model both include an encoding layer, a conversion layer, a fully connected layer, and a conditional random field model processing layer, and the number of network layers of the conversion layer in the intent recognition model is less than the number of network layers of the conversion layer in the initial training model. When the target text data is acquired, the target text data is input into the encoding layer, and the intent result of the target text data is obtained through the conversion layer and the fully connected layer, and the entity information of the target text data is obtained through the conversion layer and the conditional random field model processing layer.
[0061] It should be emphasized that in order to further ensure the privacy and security of the above intention results, the above intention results can also be stored in a node of a blockchain.
[0062] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0063] This embodiment achieves accurate extraction of text intent and entity information, improves the accuracy of text intent and entity information extraction, reduces the response time of model processing, and improves the recognition efficiency of text intent and entity information.
[0064] In some embodiments of the present application, the initial training model includes an encoding layer, a conversion layer, a fully connected layer, and a conditional random field model processing layer, and the step of inputting the text data to be processed into the initial training model to obtain training intent information and training entity information specifically includes:
[0065] Inputting the text data to be processed into the encoding layer, passing through the conversion layer and the fully connected layer, and outputting the training intention information;
[0066] The text data to be processed is input into the encoding layer, passes through the conversion layer and the conditional random field model processing layer, and outputs the training entity information.
[0067] In this embodiment, the initial training model includes a coding layer, a conversion layer, a fully connected layer and a conditional random field model processing layer, the conditional random field model processing layer and the fully connected layer are connected in parallel after the conversion layer, and the conversion layer is connected after the coding layer. When the text data to be processed is obtained, the text data to be processed is used as a training text, and the text data to be processed is input into the initial training model, and the text data to be processed is encoded based on the coding layer in the initial training model to obtain a text code, and then the text code is mapped to a space vector so that the text code is converted into a multi-dimensional text space vector. Afterwards, the text space vector is identified and classified by the conversion layer in the initial training model to obtain the output result of the conversion layer. When the output result of the conversion layer is obtained, the output result is output through the fully connected layer to obtain the training intention information of the text data to be processed; the output result is output through the conditional random field model to obtain the training entity information of the text data to be processed.
[0068] This embodiment obtains the training intent information and training entity information of the text data to be processed through the initial training model, so that the trained model can accurately identify the text intent and entity, further improving the accuracy and recognition efficiency of the text intent and entity recognition.
[0069] In some embodiments of the present application, the training of the initial training model according to the training intention information and the training entity information includes:
[0070] Obtaining standard intent information and standard entity information of the text data to be processed, calculating a first loss function according to the standard intent information and the training intent information, calculating a second loss function according to the standard entity information and the training entity information, calculating a total loss function according to the first loss function and the second loss function, and determining the initial training model as a model to be verified when the total loss function converges;
[0071] A test text is obtained, and the model to be verified is verified according to the test text. When a verification pass rate of the model to be verified for the test text is greater than or equal to a preset threshold, it is determined that the training of the initial training model is completed.
[0072] In this embodiment, when the training intent information and training entity information of the text data to be processed are obtained, the standard intent information and standard entity information corresponding to the text data to be processed are obtained, and the standard intent information and standard entity information can be a pre-set intent recognition result. The first loss function is calculated according to the training intent information and the standard intent information, and the second loss function is calculated according to the training entity information and the standard entity information. When the first loss function and the second loss function are obtained, the total loss function is calculated by weighted summation of the first loss function and the second loss function. The parameters of the initial training model are adjusted according to the total loss function, wherein when the total loss function converges, the initial training model is determined to be the model to be verified. The calculation formula of the first loss function or the second loss function is as follows:
[0073]
[0074] Among them, when H(p,q) is the first loss function, p(x i ) is the probability distribution of standard intention information, q(x i ) is the probability distribution of the training intention information; when H(p,q) is the second loss function, p(x i ) is the probability distribution of standard entity information, q(x i ) is the probability distribution of training entity information.
[0075] When the model to be verified is obtained, the test text is obtained, and the model to be verified is verified according to the test text. If the intent recognition result and entity recognition result output by the model to be verified for the test text are respectively consistent with the standard intent information and standard entity information corresponding to the test text, then it is determined that the model to be verified has passed the verification of the test text. When the verification pass rate of the model to be verified for the test text is greater than or equal to the preset threshold, the initial training model is determined to be the initial recognition model.
[0076] This embodiment trains the initial training model by training intent information and training entity information, thereby improving the training efficiency of the model and enabling the trained model to accurately and efficiently identify the intent and entities of the text.
[0077] In some embodiments of the present application, after obtaining the intention result and entity information of the target text data, the following steps are further included:
[0078] Regularly collect text entity information, and establish a dictionary tree according to the text entity information;
[0079] A text entity library of the text entity information is constructed based on the dictionary tree.
[0080] In this embodiment, text entity information is collected regularly, and the text entity information is the object of intent. For example, in "I want to buy apples", "buy apples" is the intent, and "apples" is the object corresponding to the intent, that is, text entity information. Text entity information is collected regularly, and a dictionary tree is established based on the regularly collected text entity information and the standard weight value corresponding to the text entity information, and the dictionary tree is stored in a text entity library, which stores multiple text entity information and the standard weight value corresponding to each text entity information.
[0081] This embodiment can quickly collect entity information of text data by establishing a text entity library, and can further screen and judge the intent and entity information obtained by model calculation based on the entity information, thereby ensuring the accuracy of intent and entity recognition of text.
[0082] In some embodiments of the present application, the above-mentioned establishment of a dictionary tree according to the text entity information includes:
[0083] Acquire a standard weight value of the text entity information, determine that the standard weight value is a leaf node, and determine that the text entity information is a non-leaf node;
[0084] A dictionary tree is established according to the leaf nodes and the non-leaf nodes.
[0085] In this embodiment, the standard weight value of the text entity information is obtained. Different text entity information may correspond to different standard weight values, and the standard weight value can be obtained by calculating the proportion of the text entity information of the same type through big data. When the standard weight value of the text entity information is obtained, the standard weight value is used as a leaf node, and the text entity information is a non-leaf node. A dictionary tree is established based on the leaf node and the non-leaf node, and the dictionary tree is stored in the text entity library.
[0086] This embodiment achieves standardized management of text entities by establishing a dictionary tree, so that corresponding entities and weights can be quickly obtained through the dictionary tree, further improving the recognition efficiency of text intent and entities.
[0087] In some embodiments of the present application, after constructing the text entity library of the text entity information based on the dictionary tree, the method further includes:
[0088] When a new text to be detected is detected, first entity information of the new text to be detected is extracted according to the intention recognition model, and a default weight value is assigned to the first entity information;
[0089] Acquire second entity information of the new text to be detected and a standard weight value of the second entity information according to the text entity library;
[0090] The target entity information of the new text to be detected is determined according to the default weight value and the standard weight value.
[0091] In this embodiment, the new text to be detected is the same as the target text data. When the new text to be detected is detected, the new text to be detected is detected according to the intention recognition model, and the entity information corresponding to the new text to be detected, that is, the first entity information, is extracted. When the first entity information is obtained, a default weight value is assigned to the first entity information. The second entity information of the new text to be detected is obtained according to the text entity library, and the standard weight value associated with the second entity information; according to the standard weight value and the default weight value, the target entity information corresponding to the new text to be detected can be determined.
[0092] This embodiment obtains entity information and corresponding weight values through a text entity library, and can further screen and judge the new text to be detected, so that the target entity information finally obtained is more accurate.
[0093] In some embodiments of the present application, determining the target entity information of the new text to be detected according to the default weight value and the standard weight value includes:
[0094] determining whether there is second entity information that is consistent with the first entity information, and when it is determined that there is second entity information that is consistent with the first entity information, adjusting the default weight value of the first entity information to a standard weight value of the second entity information that is consistent with the first entity information;
[0095] Determine that the entity information corresponding to the maximum weight value among all the standard weight values is the target entity information of the new text to be detected.
[0096] In this embodiment, multiple second entity information may be obtained through dictionary tree extraction. Therefore, it is determined whether there is second entity information consistent with the first entity information in the second entity information. If there is second entity information consistent with the first entity information in the second entity information, the default weight value of the first entity information is adjusted to the standard weight value corresponding to the second entity information. When the standard weight value corresponding to the first entity information is the maximum value among the standard weight values corresponding to all the obtained second entity information, the first entity information is determined to be the target entity information of the new text to be detected; when the standard weight value corresponding to the first entity information is not the maximum value among the standard weight values corresponding to all the obtained second entity information, the second entity information with the largest standard weight value among the obtained second entity information is selected as the target entity information of the new text to be detected.
[0097] This embodiment achieves accurate recognition of target entity information of new text to be detected, avoids errors in obtaining entity information only through model recognition, and improves the accuracy of text recognition.
[0098] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0099] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0100] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a device for extracting intent entity information. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0101] like Figure 3 As shown, the apparatus 300 for extracting intended entity information in this embodiment includes: an acquisition module 301, a first training module 302, a second training module 303 and a recognition module 304. Among them:
[0102] The acquisition module 301 is used to acquire initial text data and pre-process the initial text data to obtain text data to be processed;
[0103] In this embodiment, the initial text data is the text data extracted by the target intention, and the initial text data can be converted from the target voice data. The initial text data is obtained, and when the initial text data is obtained, the initial text data is preprocessed. The preprocessing includes removing punctuation marks, filtering special characters, and replacing half-width and full-width characters. The preprocessed initial text data is the text data to be processed.
[0104] The first training module 302 is used to obtain a preset initial training model, input the text data to be processed into the initial training model, obtain training intention information and training entity information, train the initial training model according to the training intention information and the training entity information, and determine the initial training model as an initial recognition model when the training of the initial training model is completed;
[0105] Wherein, the first training module 302 includes:
[0106] A first processing unit, configured to input the text data to be processed into the encoding layer, pass through the conversion layer and the fully connected layer, and output the training intention information;
[0107] The second processing unit is used to input the text data to be processed into the encoding layer, and output the training entity information after passing through the conversion layer and the conditional random field model processing layer.
[0108] A training unit, used for obtaining standard intent information and standard entity information of the text data to be processed, calculating a first loss function according to the standard intent information and the training intent information, calculating a second loss function according to the standard entity information and the training entity information, calculating a total loss function according to the first loss function and the second loss function, and determining the initial training model as a model to be verified when the total loss function converges;
[0109] The testing unit is used to obtain a test text, verify the model to be verified according to the test text, and determine that the training of the initial training model is completed when the verification pass rate of the model to be verified for the test text is greater than or equal to a preset threshold.
[0110] In this embodiment, when the text data to be processed is obtained, the initial training model is trained according to the text data to be processed. Specifically, the training intention information and the training entity information of the text data to be processed are obtained, and the loss function of the initial training model is calculated according to the training intention information and the training entity information. When the loss function converges, the initial training model is determined to be the model to be verified. After that, the test text is obtained, and the model to be verified is tested according to the test text. When the verification pass rate of the initial training model after training for the test text is greater than or equal to the preset threshold, the model to be verified is determined to be the initial recognition model.
[0111] A second training module 303 is used to extract a preset number of network layers from the initial recognition model, and use the extracted initial recognition model as an intent recognition model;
[0112] In this embodiment, when the initial recognition model is obtained, a preset number of network layers are extracted from the initial recognition model, and the network layers are network layers in the conversion layer in the initial recognition model. The conversion layer in the initial recognition model includes 12 layers of network layers, and a preset number of network layers are extracted from the 12 layers of network layers, such as extracting the first layer network, the fourth layer network, the eighth layer network, and the twelfth layer network. The extracted initial recognition model is the intent recognition model.
[0113] The recognition module 304 is used to recognize the target text data according to the intention recognition model when receiving the target text data, so as to obtain the intention result and entity information of the target text data.
[0114] In this embodiment, the target text data is the received text data that needs to be subjected to intent recognition and entity recognition, and the acquired target text data is subjected to intent and entity recognition according to the intent recognition model. Specifically, the intent recognition model and the initial training model both include an encoding layer, a conversion layer, a fully connected layer, and a conditional random field model processing layer, and the number of network layers of the conversion layer in the intent recognition model is less than the number of network layers of the conversion layer in the initial training model. When the target text data is acquired, the target text data is input into the encoding layer, and the intent result of the target text data is obtained through the conversion layer and the fully connected layer, and the entity information of the target text data is obtained through the conversion layer and the conditional random field model processing layer.
[0115] It should be emphasized that in order to further ensure the privacy and security of the above intention results, the above intention results can also be stored in a node of a blockchain.
[0116] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0117] The apparatus for extracting intention entity information proposed in this embodiment further includes:
[0118] A collection module, used for periodically collecting text entity information and establishing a dictionary tree according to the text entity information;
[0119] A construction module is used to construct a text entity library of the text entity information based on the dictionary tree.
[0120] Wherein, the acquisition module includes:
[0121] A first confirmation unit, configured to obtain a standard weight value of the text entity information, determine that the standard weight value is a leaf node, and determine that the text entity information is a non-leaf node;
[0122] A construction unit is used to establish a dictionary tree according to the leaf nodes and the non-leaf nodes.
[0123] In this embodiment, text entity information is collected regularly, and the text entity information is the object of intent. For example, in "I want to buy apples", "buy apples" is the intent, and "apples" is the object corresponding to the intent, that is, text entity information. Text entity information is collected regularly, and a dictionary tree is established based on the regularly collected text entity information and the standard weight value corresponding to the text entity information, and the dictionary tree is stored in a text entity library, which stores multiple text entity information and the standard weight value corresponding to each text entity information.
[0124] an extraction unit, configured to extract first entity information of the new text to be detected according to the intention recognition model when a new text to be detected is detected, and assign a default weight value to the first entity information;
[0125] An acquiring unit, configured to acquire second entity information of the new text to be detected and a standard weight value of the second entity information according to the text entity library;
[0126] The second confirmation unit is used to determine the target entity information of the new text to be detected according to the default weight value and the standard weight value.
[0127] Wherein, the second confirmation unit includes:
[0128] a first confirmation subunit, configured to determine whether there is second entity information that is consistent with the first entity information, and when it is determined that there is second entity information that is consistent with the first entity information, adjust the default weight value of the first entity information to a standard weight value of the second entity information that is consistent with the first entity information;
[0129] The second confirmation subunit is used to determine that the entity information corresponding to the maximum weight value among all the standard weight values is the target entity information of the new text to be detected.
[0130] In this embodiment, the new text to be detected is the same as the target text data. When the new text to be detected is detected, the new text to be detected is detected according to the intention recognition model, and the entity information corresponding to the new text to be detected, that is, the first entity information, is extracted. When the first entity information is obtained, a default weight value is assigned to the first entity information. The second entity information of the new text to be detected is obtained according to the text entity library, and the standard weight value associated with the second entity information; according to the standard weight value and the default weight value, the target entity information corresponding to the new text to be detected can be determined.
[0131] The intention entity information extraction device proposed in this embodiment realizes the accurate extraction of text intention and entity information, improves the accuracy of text intention and entity information extraction, reduces the response time of model processing, and improves the recognition efficiency of text intention and entity information.
[0132] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0133] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 6 with components 61-63, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform 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 (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0134] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.
[0135] The memory 61 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (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 61 can be an internal storage unit of the computer device 6, such as a hard disk or memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk equipped on the computer device 6, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Of course, the memory 61 can also include both the internal storage unit of the computer device 6 and its external storage device. In this embodiment, the memory 61 is generally used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions of the intention entity information extraction method, etc. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or are to be output.
[0136] The processor 62 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run computer-readable instructions or process data stored in the memory 61, such as computer-readable instructions for running the intended entity information extraction method.
[0137] The network interface 63 may include a wireless network interface or a wired network interface. The network interface 63 is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0138] The computer device proposed in this embodiment realizes the accurate extraction of text intent and entity information, improves the accuracy of text intent and entity information extraction, reduces the response time of model processing, and improves the recognition efficiency of text intent and entity information.
[0139] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the intention entity information extraction method as described above.
[0140] The computer-readable storage medium proposed in this embodiment realizes the accurate extraction of text intent and entity information, improves the accuracy of text intent and entity information extraction, reduces the response time of model processing, and improves the recognition efficiency of text intent and entity information.
[0141] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0142] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A method for extracting intent entity information, characterized in that: The steps include: Acquire initial text data, and preprocess the initial text data to obtain text data to be processed; Obtain a preset initial training model, input the text data to be processed into the initial training model, obtain training intention information and training entity information, train the initial training model according to the training intention information and the training entity information, and when the training of the initial training model is completed, determine the initial training model as an initial recognition model; Extracting a preset number of network layers from the initial recognition model, and using the extracted initial recognition model as an intent recognition model; When receiving the target text data, the target text data is identified according to the intention recognition model to obtain the intention result and entity information of the target text data; The initial training model includes an encoding layer, a conversion layer, a fully connected layer and a conditional random field model processing layer. The step of inputting the text data to be processed into the initial training model to obtain training intent information and training entity information specifically includes: Inputting the text data to be processed into the encoding layer, passing through the conversion layer and the fully connected layer, and outputting the training intention information; Inputting the text data to be processed into the encoding layer, passing through the conversion layer and the conditional random field model processing layer, and outputting the training entity information; The step of training the initial training model according to the training intention information and the training entity information specifically includes: Obtaining standard intent information and standard entity information of the text data to be processed, calculating a first loss function according to the standard intent information and the training intent information, calculating a second loss function according to the standard entity information and the training entity information, calculating a total loss function according to the first loss function and the second loss function, and determining the initial training model as a model to be verified when the total loss function converges; Acquire a test text, verify the model to be verified according to the test text, and determine that the training of the initial training model is completed when the verification pass rate of the model to be verified for the test text is greater than or equal to a preset threshold; After the step of obtaining the intention result and entity information of the target text data, the method further includes: Regularly collect text entity information, and establish a dictionary tree according to the text entity information; A text entity library of the text entity information is constructed based on the dictionary tree.
2. The method for extracting intended entity information according to claim 1, characterized in that: The step of establishing a dictionary tree according to the text entity information specifically includes: Acquire a standard weight value of the text entity information, determine that the standard weight value is a leaf node, and determine that the text entity information is a non-leaf node; A dictionary tree is established according to the leaf nodes and the non-leaf nodes.
3. The method for extracting intended entity information according to claim 1, characterized in that: After the step of constructing a text entity library of the text entity information based on the dictionary tree, the method further includes: When a new text to be detected is detected, first entity information of the new text to be detected is extracted according to the intention recognition model, and a default weight value is assigned to the first entity information; Acquire second entity information of the new text to be detected and a standard weight value of the second entity information according to the text entity library; The target entity information of the new text to be detected is determined according to the default weight value and the standard weight value.
4. The method for extracting intent entity information according to claim 3 is characterized in that: The step of determining the target entity information of the new text to be detected according to the default weight value and the standard weight value specifically includes: determining whether there is second entity information that is consistent with the first entity information, and when it is determined that there is second entity information that is consistent with the first entity information, adjusting the default weight value of the first entity information to a standard weight value of the second entity information that is consistent with the first entity information; Determine that the entity information corresponding to the maximum weight value among all the standard weight values is the target entity information of the new text to be detected.
5. A device for extracting intent entity information, characterized in that: The intention entity information extraction device implements the steps of the intention entity information extraction method according to any one of claims 1 to 4, and the intention entity information extraction device comprises: An acquisition module, used for acquiring initial text data, preprocessing the initial text data, and obtaining text data to be processed; A first training module is used to obtain a preset initial training model, input the text data to be processed into the initial training model, obtain training intention information and training entity information, train the initial training model according to the training intention information and the training entity information, and determine the initial training model as an initial recognition model when the training of the initial training model is completed; A second training module is used to extract a preset number of network layers from the initial recognition model and use the extracted initial recognition model as an intent recognition model; The recognition module is used to recognize the target text data according to the intention recognition model when receiving the target text data, so as to obtain the intention result and entity information of the target text data.
6. A computer device comprising a memory and a processor, wherein the memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the method for extracting intent entity information as described in any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the method for extracting intent entity information as described in any one of claims 1 to 4.
