Text processing method, text analysis model training method, and related device
By introducing an encoding module and N parsing modules into the text parsing model, and combining intent and entity recognition and matching, the problem of low response accuracy caused by ignoring entity information in existing technologies is solved, and more accurate understanding and response to user needs is achieved.
Patent Information
- Application Number
- CN202211234372.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-10
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2042-10-10
AI Technical Summary
In existing technologies, when using pre-trained intent recognition models to respond to user dialogue text, entity information is ignored, resulting in an inability to accurately understand the user's true needs and a low response accuracy rate.
A text parsing model with an encoding module and N parsing modules is adopted. By semantically encoding and identifying intents in user dialogue text, entity information under N candidate intents is identified, and the target response text is determined by combining the pairing of intents and entities.
It improves the accuracy of responses, enabling it to more accurately meet users' real needs.
Smart Images

Figure CN116150330B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text processing technology, and in particular to a text processing method, a training method for a text parsing model, and related equipment. Background Technology
[0002] With the rapid development of artificial intelligence, the use of robots for automatic responses has been widely applied in various industries, such as in human-computer interaction scenarios like intelligent customer service, where robots automatically answer users' business inquiries.
[0003] In related technologies, when dealing with user dialogue text, a pre-trained intent recognition model is typically used to identify the user's intent in the dialogue text, and then the response is based on the identified intent. However, this approach ignores another crucial piece of information in the dialogue text that expresses the user's true needs—the entity itself. Therefore, it cannot accurately understand the user's true needs, resulting in low response accuracy. Summary of the Invention
[0004] The purpose of this application is to provide a text processing method, a text parsing model training method, and related equipment to improve the accuracy of user dialogue text response schemes.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions:
[0006] In a first aspect, embodiments of this application provide a text processing method, including:
[0007] Get the first user dialogue text to be processed;
[0008] The first user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0009] Based on the intent information and the entity information, the target response text corresponding to the first user dialogue text is determined; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are related to the N candidate intent information. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text, and the i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0010] The text processing method provided in this application employs a text parsing model with an encoding module and N parsing modules. The N parsing modules are associated with N candidate texts. Figure 1 In a one-to-one correspondence, each parsing module can be used to perform intent recognition and entity recognition under a corresponding candidate intent. That is, it identifies whether the input text has a corresponding candidate intent and identifies the entities contained in the text that correspond to that candidate intent. Based on this, the encoding module performs semantic encoding on the first user dialogue text to obtain a semantic representation vector that can represent the semantics of the first user dialogue text. Then, the first user dialogue text to be processed is parsed by N parsing modules, which can perform intent recognition and entity recognition on the first user dialogue text under N candidate intents respectively, and obtain the intent recognition results and entity recognition results of the first user dialogue text corresponding to the N candidate intents respectively. Thus, the three tasks of intent recognition, entity recognition, and intent-entity pairing are completed simultaneously. Furthermore, based on the intent recognition results and entity recognition results corresponding to these candidate intents respectively, the target response text corresponding to the first user dialogue text is determined. Compared with the automatic response method based solely on the intent recognition result, it also fully considers the entities in the first user dialogue text that are paired with the intent. Therefore, the determined target response text can more accurately meet the user's real needs and is conducive to improving the response accuracy.
[0011] Secondly, embodiments of this application provide a method for training a text parsing model, including:
[0012] Acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text;
[0013] The sample dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0014] The text parsing model is trained based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are coupled with the N candidate intent tags. Figure 1In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text, and the i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0015] The text parsing model training method provided in this application uses a text parsing model with an encoding module and N parsing modules, where the N parsing modules are coupled with N candidate semantic units. Figure 1 A one-to-one correspondence is established. Based on this, the text parsing model is trained using the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text. The encoding module performs semantic encoding on the sample dialogue text to obtain a semantic representation vector that can represent the semantics of the sample dialogue text. Then, each parsing module learns the intent of the sample dialogue text from the intent tags and the entities contained in the sample dialogue text that correspond to the intent from the entity tags, so that the trained text parsing model integrates functions such as intent recognition, entity recognition, and intent-entity pairing. In this way, the trained text parsing model can be used to accurately understand the user's real needs and parse the user's dialogue text intent and the entity corresponding to the intent. Based on the parsed intent and its corresponding entity, the model can respond to the user's dialogue text, which helps to improve the response accuracy.
[0016] Thirdly, embodiments of this application provide a text processing apparatus, including:
[0017] The first acquisition unit is used to acquire the first user dialogue text to be processed.
[0018] The first parsing unit is used to parse the first user dialogue text through a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0019] The first determining unit is configured to determine the target response text corresponding to the first user dialogue text based on the intent information and the entity information; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are associated with the N candidate intent information. Figure 1In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text, and the i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0020] Fourthly, embodiments of this application provide a training apparatus for a text parsing model, comprising:
[0021] The second acquisition unit is used to acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text.
[0022] The second parsing unit is used to parse the sample dialogue text through a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0023] A training unit is used to train the text parsing model based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are coupled with the N candidate intent tags. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text, and the i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0024] Fifthly, embodiments of this application provide an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method as described in the first aspect; or, the processor is configured to execute the instructions to implement the method as described in the second aspect.
[0025] In a sixth aspect, embodiments of this application provide a computer-readable storage medium that, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method described in the first aspect; or enables the electronic device to perform the method described in the second aspect. Attached Figure Description
[0026] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0027] Figure 1 A flowchart illustrating a text processing method provided in one embodiment of this application;
[0028] Figure 2A A schematic diagram of the structure of a text parsing model provided in one embodiment of this application;
[0029] Figure 2B A schematic diagram of the structure of a text parsing model provided for another embodiment of this application;
[0030] Figure 3 A schematic diagram of the structure of a parsing module provided in one embodiment of this application;
[0031] Figure 4 A flowchart illustrating a text processing method provided for another embodiment of this application;
[0032] Figure 5 A flowchart illustrating a training method for a text parsing model provided in one embodiment of this application;
[0033] Figure 6 A schematic diagram of intent tags and entity tags for a sample dialogue text provided in one embodiment of this application;
[0034] Figure 7 A schematic diagram of the structure of a text processing device provided in one embodiment of this application;
[0035] Figure 8 A schematic diagram of the structure of a training device for a text parsing model provided in one embodiment of this application;
[0036] Figure 9 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] The terms "first," "second," etc., used in this specification and claims are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in this specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0039] As mentioned earlier, in related technologies, user dialogue text is typically analyzed using a pre-trained intent recognition model to identify the user's intent, and then the response is based on the identified intent. However, this approach ignores another crucial piece of information in the dialogue text that expresses the user's true needs—the entity itself. Consequently, it fails to accurately understand the user's true needs, resulting in low response accuracy.
[0040] In view of this, the embodiments of this application aim to propose a text processing method, which employs a text parsing model with an encoding module and N parsing modules, wherein the N parsing modules and N candidate meanings Figure 1 In a one-to-one correspondence, each parsing module can be used to perform intent recognition and entity recognition under a corresponding candidate intent. That is, it identifies whether the input text has a corresponding candidate intent and identifies the entities contained in the text that correspond to that candidate intent. Based on this, the encoding module performs semantic encoding on the first user dialogue text to obtain a semantic representation vector that can represent the semantics of the first user dialogue text. Then, the first user dialogue text to be processed is parsed by N parsing modules, which can perform intent recognition and entity recognition on the first user dialogue text under N candidate intents respectively, and obtain the intent recognition results and entity recognition results of the first user dialogue text corresponding to the N candidate intents respectively. Thus, the three tasks of intent recognition, entity recognition, and intent-entity pairing are completed simultaneously. Furthermore, based on the intent recognition results and entity recognition results corresponding to these candidate intents respectively, the target response text corresponding to the first user dialogue text is determined. Compared with the automatic response method based solely on the intent recognition result, it also fully considers the entities in the first user dialogue text that are paired with the intent. Therefore, the determined target response text can more accurately meet the user's real needs and is conducive to improving the response accuracy.
[0041] This application also proposes a training method for a text parsing model, employing a text parsing model with an encoding module and N parsing modules, wherein the N parsing modules are coupled with N candidate semantic modules. Figure 1A one-to-one correspondence is established. Based on this, the text parsing model is trained using the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text. The encoding module performs semantic encoding on the sample dialogue text to obtain a semantic representation vector that can represent the semantics of the sample dialogue text. Then, each parsing module learns the intent of the sample dialogue text from the intent tags and the entities contained in the sample dialogue text that correspond to the intent from the entity tags, so that the trained text parsing model integrates functions such as intent recognition, entity recognition, and intent-entity pairing. In this way, the trained text parsing model can be used to accurately understand the user's real needs and parse the user's dialogue text intent and the entity corresponding to the intent. Based on the parsed intent and its corresponding entity, the model can respond to the user's dialogue text, which helps to improve the response accuracy.
[0042] It should be understood that the text processing method and text parsing model training method provided in the embodiments of this application can be executed by an electronic device or software installed in an electronic device. The electronic device referred to herein may include terminal devices, such as smartphones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, smartwatches, vehicle terminals, aircraft, etc.; or, the electronic device may also include a server, such as a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0043] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0044] Please see Figure 1 The following is a flowchart illustrating a text processing method according to an embodiment of this application. The method may include the following steps:
[0045] S102, Obtain the first user dialogue text to be processed.
[0046] In this embodiment of the application, the first user dialogue text may be directly input by the user through the user terminal, or the first user dialogue text may be obtained by converting the voice input by the user through the user terminal into text using Automatic Speech Recognition (ASR) technology.
[0047] S104, the first user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the first user dialogue text.
[0048] The intent information of the first user dialogue text refers to information that can represent the intent of the first user dialogue text. In this embodiment, the intent information of the first user dialogue text may include intent recognition results corresponding to N candidate intents. The intent recognition result corresponding to each candidate intent is used to indicate whether the first user dialogue text possesses that candidate intent.
[0049] In practical applications, the N candidate intents can be selected based on the dialogue scenario, and this application embodiment does not limit this selection. For example, in the intelligent customer service scenario of a shopping platform, the N candidate intents may include price inquiries, product parameter inquiries, time-related information inquiries, after-sales inquiries, complaints, etc.
[0050] The entity information of the first user dialogue text refers to information that can represent the entities contained in the first user dialogue text. In the embodiments of this application, the so-called entities may include, but are not limited to, names of people, place names, times, organizations, product names, etc. For example, the first user dialogue text "How much does product A cost?" contains the entity "product A"; similarly, the first user dialogue text "How long does it take to repair a motherboard malfunction?" contains the entity "motherboard malfunction", and so on.
[0051] In this embodiment, the entity information of the first user dialogue text may include entity recognition results corresponding to N candidate intents. Each candidate intent's entity recognition result represents the entity contained in the first user dialogue text that corresponds to that candidate intent. In other words, the entity information of the first user dialogue text reflects the pairing relationship between the intents of the first user dialogue text and the entities contained within it. For example, the first user dialogue text "How long does it take to modify the computer? How is the repair cost for a motherboard failure calculated?" contains two intents, "repair time" and "repair cost," and two entities, "computer" and "motherboard failure." The entity corresponding to the intent "repair time" is "computer," and the entity corresponding to the intent "repair cost" is "motherboard failure."
[0052] A text parsing model refers to a model with text parsing capabilities, integrating functions such as intent recognition, entity recognition, and intent-entity pairing. Intent recognition identifies the intent conveyed in the text, entity recognition identifies the entities contained within the text, and intent-entity pairing identifies the pairing relationship between intents and entities. The text parsing model in this application embodiment can have any suitable structure, and can be specifically set according to actual needs; this application embodiment does not limit this.
[0053] Optionally, Figure 2A As shown, in order to achieve automatic pairing of intent and entity while accurately identifying intent and entity, the text parsing model can include an encoding module and N parsing modules. The N parsing modules are paired with N candidate intents. Figure 1 There is a one-to-one correspondence, where N is a positive integer. The encoding module performs semantic encoding on the first user dialogue text to obtain a semantic representation vector. The i-th parsing module parses the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where i is a positive integer less than or equal to N.
[0054] The semantic representation vector of the first user dialogue text refers to the vector used to represent the semantics of the first user dialogue text. This semantic representation vector can include the text semantic representation vector of the first user dialogue text and the character semantic representation vector for each character in the first user dialogue text. The text semantic representation vector represents the textual semantics of the first user dialogue text, that is, the semantics of the first user text at the sentence level; the character semantic representation vector for each character represents the semantics of that character in the first user dialogue text, that is, the semantics of the first user dialogue text at the character level. It can be understood that the semantics of the first user dialogue text can be accurately expressed through sentence-level semantic representation vectors and character-level semantic representation vectors.
[0055] In practical applications, the encoding module can have any appropriate structure, which can be set according to actual needs, such as the deep bidirectional language representation (BERT) model, long short-term memory network (LSTM), etc. This application embodiment does not limit this.
[0056] Optionally, to improve the accuracy of semantic representation, the encoding module can employ the BERT model. The BERT model includes an embedding layer and a transformer layer. The embedding layer has three embedding modes: token embedding, token type embedding, and position embedding. Token embedding embeds the features of each character in the first user's dialogue text, resulting in a character representation vector for each character. Token type embedding embeds the paragraph features of each character in the first user's dialogue text, resulting in a paragraph representation vector. Position embedding embeds the position features of each character in the first user's dialogue text, resulting in a position representation vector. Furthermore, the character representation vector, paragraph representation vector, and position representation vector of each character in the first user's dialogue text are fused to obtain the fused vector for each character in the first user's dialogue text. Furthermore, the transformation layer can use a self-attention mechanism to understand the semantics of each character by combining the contextual information of each character in the first user dialogue text, and perform a non-linear transformation on the fusion vector of each character through a feed-forward mechanism, thereby obtaining the text semantic representation vector of the first user dialogue text and the character semantic representation vector of each character.
[0057] For example, the first user text is "How long will it take to repair the computer? How much does motherboard repair cost?". To accurately understand the semantics of the first user text, the identifier [CLS] is inserted before the first character to indicate the beginning of the text, and the identifier [SEP] is inserted after the last character to indicate the end of the text, resulting in [CLS] "How long will it take to repair the computer? [SEP] How much does motherboard repair cost [SEP]". Furthermore, the embedding layer obtains the character representation vector {E} of each character in the first user dialogue text through word embedding patterns. [CLS] E 电 E 脑 E 多 E 久 E 可 E 以 E 修 E 好 E [SEP] E 主 E 板 E 的 E 维 E 修 E 费 E用 E 怎 E 么 E 算 E [SEP] By using the segment embedding pattern, the segment representation vector {E} for each character in the first user dialogue text can be obtained. A E A E A E A E A E A E A E A E A E A E B E B E B E B E B E B E B E B E B E B E B}, and through position embedding patterns, the position representation vector {E0,E1,E2,E3,E4,E5,E6,E7,E8,E9,E} of each character in the first user dialogue text can be obtained. 10 E 11 E 12 E 13 E 14 E 15 E 16 E 17 E 18 E 19 E 20}, where subscript A indicates that the corresponding character belongs to the first paragraph, subscript B indicates that the corresponding character belongs to the second paragraph, and subscripts 0 to 20 indicate the order of the corresponding characters in the first user dialogue text; by fusing the character representation vector, paragraph representation vector, and position representation vector of each character in the first user dialogue text, the fused vector {v} of each character in the first user dialogue text can be obtained. CLS , v1, v2, v3, v4, v5, v6, v7, v8, v9, v 10 v 11 v 12 v 13 v 14 v 15 v 16 v 17 v 18 v 19 v 20Furthermore, after the fusion vector of each character in the first user dialogue text is transformed by the transformation layer, the semantic representation vector {h} of the first user dialogue text can be obtained. CLS , h1, h2, h3, h4, h5, h6, h7, h8, h9, h SEP1 h 11 h 12 h 13 h 14 h 15 h 16 h 17 h 18 h 19 h SEP2}, where h CLS That is, the text semantic representation vector of the first user dialogue text, h1~h SEP2 That is, the character semantic representation vector of each character in the first user dialogue text.
[0058] In practical applications, the parsing module can have any suitable structure, which can be configured according to actual needs. Optionally, to achieve intent recognition, entity recognition, and pairing between intent and entity, such as Figure 3 As shown, each parsing module includes a first linear layer, a second linear layer, and a third linear layer.
[0059] The first linear layer of the i-th parsing module is used to convert the text semantic representation vector into a first target representation vector in the vector space of the i-th candidate intent, and to convert the character semantic representation vector of each character in the first user dialogue text into a second target representation vector in the vector space of the i-th candidate intent; the second linear layer of the i-th parsing module is used to perform intent recognition on the first user dialogue text based on the first target representation vector in the vector space of the i-th candidate intent, and to obtain the intent recognition result corresponding to the i-th candidate intent; the third linear layer of the i-th parsing module is used to perform entity recognition on the first user dialogue text based on the second target representation vector of each character in the first user dialogue text in the vector space of the i-th candidate intent, and to obtain the entity recognition result corresponding to the i-th candidate intent.
[0060] Understandably, since the vector spaces of different candidate intents differ, by using a first linear layer in the parsing module to transform the semantic representation vector of the first user dialogue text into the corresponding candidate intent vector space, and then using corresponding linear layers for intent recognition and entity recognition respectively, it can be ensured that the intent recognition results match the entity recognition results. In addition, when performing intent recognition, the text semantic representation vector, which is spatially transformed and can represent the sentence-level semantics of the first user dialogue text, is used, which helps to improve the accuracy of the intent recognition structure; when performing entity recognition, the character semantic representation vector, which is spatially transformed and can represent the character-level semantics of the first user dialogue text, is used, which helps to improve the accuracy of the entity recognition results.
[0061] In practical applications, the N candidate intentions can be set according to the needs of the actual application scenario, and this application embodiment does not limit this.
[0062] Considering that in actual dialogue, the user-input dialogue text may only contain entities without intent, such as the dialogue text "I want to know about product A" which only contains the entity "product A" but no intent, if the text parsing module does not include a parsing module for such intent recognition results, entity recognition will be impossible in these cases, and even matching entity recognition results with intent recognition results will be impossible. Therefore, optionally, in this embodiment, the aforementioned N candidate intents may include a first candidate intent and M second candidate intents. The intent recognition result corresponding to the first candidate intent of the first user dialogue text is used to indicate whether the first user dialogue text has at least one of the aforementioned M second candidate intents, or in other words, whether the first user dialogue text has an intent, where M = N-1.
[0063] In this case, such as Figure 2B As shown, the N parsing modules include a first parsing module and M second parsing modules, wherein the first parsing module is relative to the first candidate intent, and the M second parsing modules are relative to the M second candidate intents. Figure 1 One-to-one correspondence.
[0064] The first parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the first candidate intent. The intent recognition result corresponding to the first candidate intent is used to indicate whether the intent of the first user dialogue text contains at least one of the M second candidate intents.
[0065] The j-th second parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the j-th candidate intent. The intent recognition result corresponding to the j-th candidate intent is used to indicate whether the intent of the first user dialogue text contains the j-th candidate intent, where j is a positive integer and 1≤j≤M.
[0066] For example, in the intelligent customer service scenario of a shopping platform, the M second candidate intentions can include price inquiries, product parameter inquiries, time-related information inquiries, after-sales inquiries, and complaints. The first candidate intention represents the case of no intention. If the first user's dialogue text is "How much does it cost?", the above text parsing model can identify that the first user's dialogue text has the second candidate intention "price inquiry", but does not include the entity. If the first user's dialogue text is "I want to know about product A", the above text parsing model can identify that the first user's dialogue text does not have any of the above second candidate intentions, but includes the entity "product A". If the first user's dialogue text is "How much does product A cost?", the above text parsing model can identify that the first user's dialogue text has the second candidate intention "price inquiry", and the entity corresponding to this intention is "product A". If the first user's dialogue text is "I'll think about it", the above text parsing model can identify that the first user's dialogue text does not have any of the above second candidate intentions, and does not include the entity.
[0067] Understandably, by setting up a first parsing module in the text parsing model to identify whether there is intent, the text parsing model can be applied to the accurate parsing of various types of text, such as text without intent and without entity, text with intent but no entity, and text with intent and entity. In this way, a single text parsing model can complete accurate text parsing and response processing in application scenarios, which not only helps to improve response efficiency and accuracy, but also reduces development difficulty.
[0068] S106, Based on intent information and entity information, determine the target response text corresponding to the first user dialogue text.
[0069] The target response text corresponding to the first user dialogue text refers to the text used to respond to the first user dialogue text.
[0070] Since intent information can accurately represent the intent of the first user's dialogue text, and entity information can accurately represent the entities contained in the first user's dialogue text that correspond to its intent, combining intent information and entity information to determine the target response text corresponding to the first user's dialogue text. Compared with the method of automatically responding based solely on intent recognition results, this method also fully considers the entities in the first user's dialogue text that are paired with the intent. Therefore, the determined target response text can more accurately meet the user's real needs and is conducive to improving the response accuracy.
[0071] In one alternative implementation, to further improve response accuracy, such as Figure 4 As shown, the above S106 specifically includes the following steps:
[0072] S161, Based on the intent recognition results corresponding to the N candidate intents, determine the target intent of the first user dialogue text.
[0073] Since the intent recognition result corresponding to each candidate intent can indicate whether the first user's dialogue text has that candidate intent, the target intent of the first user's dialogue text can be determined based on the intent recognition results corresponding to the N candidate intents.
[0074] S162, Based on the entity recognition results corresponding to the N candidate intents, determine the entity corresponding to the target intent in the first user dialogue text.
[0075] After identifying the target intent, the entity corresponding to the target intent in the first user dialogue text can be determined based on the entity recognition result corresponding to the target intent.
[0076] S163, Based on the target intent and its corresponding entity in the first user dialogue text, determine the target response text corresponding to the first user dialogue text from the question-and-answer text library.
[0077] The question-and-answer text library stores a large number of response texts. This library can be pre-built and continuously updated during application.
[0078] To improve response accuracy, the target response text corresponding to the first user's dialogue text can be determined from the question-and-answer text database according to four cases: no intent and no entity, no intent and entity, intent and no entity, and intent and entity.
[0079] Scenario 1: Intentional, but no physical entity.
[0080] If the target intent contains at least one of the above N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then the first response text is output, wherein the first response text is used to guide the input of the user dialogue text containing the entity; the received user dialogue text is parsed by a text parsing model to obtain the intent information and entity information of the user dialogue text; further, based on the target intent, the intent information and entity information of the user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
[0081] For example, taking the intelligent customer service scenario of a shopping platform as an example, assuming N candidate intents include no intent, price inquiry, product parameter inquiry, time-related information inquiry, after-sales inquiry, and complaint, for the first user dialogue text "How much does it cost?", the text parsing model mentioned above can identify that the target intent of the first user dialogue text includes price inquiry, but this target intent does not have a corresponding entity in the first user dialogue text. Therefore, the first response text "Which mobile phone do you want to inquire about the price of?" is output to guide the input of user dialogue text containing a specific product name. If the user inputs the dialogue text "Mobile Phone A", then the text parsing model mentioned above can identify that the user dialogue text contains the entity "Mobile Phone A". Further, the response text used to answer the price of Mobile Phone A, "Hello, the current price of the low-end version of Mobile Phone A is 4999 yuan, the high-end version is 5999 yuan, and the top-end version is 6999 yuan", can be selected from the question-and-answer text library as the target response text corresponding to the first user dialogue text and output.
[0082] It is understandable that when the first user dialogue text only contains intent but not corresponding entities, by outputting the corresponding first response text to guide the input of user dialogue text containing entities, and further combining the target intent of the first user dialogue text with the intent information and entity information obtained by parsing the received user dialogue text, the first user dialogue text can be responded to, which can more accurately understand and meet the user's real needs and help improve the response accuracy.
[0083] Scenario 2: No intent, but with a physical entity.
[0084] If the target intent does not contain any of the above N candidate intents, and the target intent has a corresponding entity in the first user dialogue text, then the second response text is output. The second response text is used to guide the input of a user dialogue text containing at least one candidate intent. The received user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the user dialogue text. Further, based on the entity corresponding to the target intent in the first user dialogue text, the intent information and entity information of the user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
[0085] For example, taking the intelligent customer service scenario of a shopping platform as an example, assuming N candidate intents include no intent, price inquiry, product parameter inquiry, time-related information inquiry, after-sales inquiry, and complaint, for the first user dialogue text "I want to know about phone A", the above text parsing model can identify that the first user dialogue text does not have an intent, but the first user dialogue text includes the entity "phone A". Then, the second response text "What specific aspects of phone A would you like to know about?" is output to guide the input of user dialogue text containing intent. If the user input dialogue text is "I want to know about the configuration of phone A", then the above text parsing model can identify that the intent of the user dialogue text includes "product parameter inquiry". Further, the response text used to answer the configuration of product A, "Okay, phone A is currently equipped with an OLED screen, ppi is 432...", can be selected from the question-and-answer text library as the target response text corresponding to the first user dialogue text and output.
[0086] It is understandable that when the first user dialogue text does not contain intent but contains entities, by outputting the corresponding second response text to guide the user to input user dialogue text containing intent, and further combining the entities contained in the first user dialogue text with the intent information and entity information obtained by parsing the received user dialogue text, the user can respond to the first user dialogue text. This can more accurately understand and meet the user's real needs and help improve the response accuracy.
[0087] Scenario 3: No intent, no entity.
[0088] If the target intent does not contain N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then the third response text is output. The third response text is used to guide the input of a user dialogue text containing the entity corresponding to the target intent and at least one candidate intent. The received user dialogue text is parsed by a text parsing model to obtain the intent information and entity information of the user dialogue text. Further, based on the intent information and entity information of the user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
[0089] For example, taking the intelligent customer service scenario of a shopping platform as an example, assuming N candidate intents include no intent, price inquiry, product parameter inquiry, time-related information inquiry, after-sales inquiry, and complaint, for the first user dialogue text "I'll think about it," the above text parsing model can identify that the first user dialogue text does not have intent or contain an entity. Then, the third response text "What aspect are you mainly considering? Is it price or configuration?" is output to guide the input of user dialogue text containing intent and / or entity. If the user inputs the dialogue text "I mainly feel that the current price of phone A is too expensive, and I want to look at other options," then the above text parsing model can identify that the user dialogue text contains the intent "price inquiry" and its corresponding entity "phone A." Furthermore, the target response text corresponding to the first user dialogue text can be selected from the question-and-answer text library: "Currently, there is a promotional activity for phone A. You can follow the store to receive a 300-yuan discount for purchases over 3000 yuan. In addition, if you are a member of our store, you can get an additional 50 yuan off."
[0090] It is understandable that when the first user dialogue text does not contain intent or entity, by outputting the corresponding third response text to guide the user to input a user dialogue text containing intent and entity, and further combining the intent information and entity information obtained by parsing the received user dialogue text to respond to the first user dialogue text, it is possible to more accurately understand and meet the user's real needs, which is conducive to improving the response accuracy.
[0091] Scenario 4: Intentional and physical.
[0092] If the target intent includes at least one of the above N candidate intents, and the target intent has a corresponding entity in the first user dialogue text, then based on the target intent and the corresponding entity of the target intent in the first user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
[0093] For example, taking the intelligent customer service scenario of a shopping platform as an example, assuming N candidate intents include no intent, price inquiry, product parameter inquiry, time-related information inquiry, after-sales inquiry, and complaint, for the first user dialogue text "How much does phone A cost? Which manufacturer makes the display?", the text parsing model mentioned above can identify that the target intents of the first user dialogue text include "price inquiry" and "product parameter inquiry". In the first user dialogue text, the entity corresponding to the intent "price inquiry" is "phone A", and the entities corresponding to the intent "product parameter inquiry" are "display" and "manufacturer". Then, the response text used to answer the price of phone A, "Hello, the current price of the low-end version of phone A is 4999 yuan, the high-end version is 5999 yuan, and the top-end version is 6999 yuan", and the response text used to answer the question about the display manufacturer of phone A, "The displays of these three configurations are all made by company X", can be selected from the question-and-answer text library as the target response text corresponding to the first user dialogue text and output.
[0094] It is understandable that when the first user dialogue text contains both intent and the entity corresponding to the intent, responding to the first user dialogue text by combining the identified intent and its corresponding entity can more accurately understand and meet the user's real needs, which is conducive to improving the response accuracy.
[0095] This application embodiment illustrates one specific implementation of S106 described above. Of course, it should be understood that S106 can also be implemented using various techniques commonly used in the art, and this application embodiment does not limit this implementation.
[0096] One or more embodiments of this application provide a text processing method that employs a text parsing model with an encoding module and N parsing modules, wherein the N parsing modules and N candidate meanings Figure 1In a one-to-one correspondence, each parsing module can be used to perform intent recognition and entity recognition under a corresponding candidate intent. That is, it identifies whether the input text has a corresponding candidate intent and identifies the entities contained in the text that correspond to that candidate intent. Based on this, the encoding module performs semantic encoding on the first user dialogue text to obtain a semantic representation vector that can represent the semantics of the first user dialogue text. Then, the first user dialogue text to be processed is parsed by N parsing modules, which can perform intent recognition and entity recognition on the first user dialogue text under N candidate intents respectively, and obtain the intent recognition results and entity recognition results of the first user dialogue text corresponding to the N candidate intents respectively. Thus, the three tasks of intent recognition, entity recognition, and intent-entity pairing are completed simultaneously. Furthermore, based on the intent recognition results and entity recognition results corresponding to these candidate intents respectively, the target response text corresponding to the first user dialogue text is determined. Compared with the automatic response method based solely on the intent recognition result, it also fully considers the entities in the first user dialogue text that are paired with the intent. Therefore, the determined target response text can more accurately meet the user's real needs and is conducive to improving the response accuracy.
[0097] This application also provides a method for training a text parsing model, which is used to train a text parsing model that integrates functions such as intent recognition, entity recognition, and intent-entity pairing. This text parsing model can be applied to the text processing methods provided in one or more embodiments of this application.
[0098] Please see Figure 5 The following is a flowchart illustrating a method for training a text parsing model, provided as an embodiment of this application. The method may include the following steps:
[0099] S502, acquire training data.
[0100] The training data includes sample dialogue text, intent labels, and entity labels. Intent labels represent the candidate intents of the sample dialogue text among N candidate intents, and entity labels represent the entities corresponding to the intents expressed in the sample dialogue text. In practical applications, entity labels may include N entity sub-labels, and the N entity sub-labels and N candidate intents... Figure 1 In a one-to-one correspondence, the i-th entity sub-label is used to represent the entity in the sample dialogue text that corresponds to the i-th candidate intent.
[0101] For example, such as Figure 6As shown, assuming the above N candidate intents include price inquiries, time-related inquiries, and no intent, the sample dialogue text "[CLS] How long will it take to repair the computer? How much does motherboard repair cost? [SEP]" contains the intents "price inquiries" and "time-related inquiries". In this sample text, the entity corresponding to the intent "time-related inquiries" is "computer", and the entity corresponding to the intent "price inquiries" is "motherboard repair". Then, we can obtain the entity sub-labels corresponding to the N candidate intents. In the entity sub-label, the symbol "B" represents the first character of the entity, and the symbol "I" represents the non-first character of the entity.
[0102] In addition, training data can include various types of sample dialogue texts, such as sample dialogue texts with intent but no entity, sample dialogue texts with intent and entity, sample dialogue texts without intent but with entity, and sample dialogue texts without intent and with entity, etc.
[0103] S504 uses a text parsing model to parse the sample dialogue text, obtaining the intent and entity information of the sample dialogue text.
[0104] The intent information of the sample dialogue text refers to information that represents the intent of the sample dialogue text. In this embodiment, the intent information of the sample dialogue text includes intent recognition results corresponding to N candidate intents, and the entity information includes entity recognition results corresponding to N candidate intents. The intent recognition result corresponding to each candidate intent is used to indicate whether the sample dialogue text possesses that candidate intent.
[0105] The text parsing model includes an encoding module and N parsing modules, with the N parsing modules corresponding to N candidate semantic units. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text. The i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent. N is a positive integer, and i is a positive integer less than or equal to N.
[0106] It should be noted that the specific structure of the text parsing model has been described in detail in the text processing method embodiments above, and will not be repeated here. Furthermore, during the training phase of the text parsing model, the processing of sample dialogue text by the text parsing model is similar to the processing of the first user's dialogue text by the text parsing model during the text processing phase. For details, please refer to the description of the processing of the first user's dialogue text by the text parsing model during the text processing phase above, which will not be repeated here.
[0107] S506, the text parsing model is trained based on the intent information and intent labels of the sample dialogue text, as well as the entity information and entity labels of the sample dialogue text.
[0108] In an optional implementation, to enable the text parsing model to learn the semantics of the sample dialogue text from the intent labels and entity labels of the sample dialogue text, thereby enhancing the parsing capability of the text parsing model, the above S506 may specifically include the following steps:
[0109] S561, based on the intent information and intent labels of the sample dialogue text, as well as the entity information and entity labels of the sample dialogue text, determine the processing loss of the text parsing model.
[0110] The processing loss of the text parsing model is used to represent the difference between the parsing results (including intent information and entity information) obtained by the text parsing model based on the sample dialogue text and the corresponding labels (including intent labels and entity labels) of the sample dialogue text.
[0111] Considering that the text parsing model integrates multiple tasks such as intent recognition, entity recognition, and pairing between intent and entity, the execution result of each task will affect the parsing accuracy of the text parsing model. Based on this, in order to enable the text parsing model to fully learn the intent of the sample dialogue text from the intent tags of the sample dialogue text, so as to improve the intent recognition accuracy of the text parsing model, and to enable the text parsing model to fully learn the entities contained in the sample dialogue text and the pairing relationship between entities and intent from the entity tags of the sample dialogue text, so as to improve the entity recognition accuracy and the pairing accuracy between entities and intent, the above-mentioned S561 can be specifically implemented as follows: Based on the intent information and intent tags of the sample dialogue text, determine the intent recognition loss of the text parsing model, and based on the entity information and entity tags of the sample dialogue text, determine the entity recognition loss of the text parsing model; further, perform a weighted summation of the intent recognition loss and the entity recognition loss to obtain the processing loss of the text parsing model.
[0112] In this embodiment, the intent recognition loss of the text parsing model is used to represent the difference between the intent information obtained by the text parsing model from the sample dialogue text and the intent label of the sample text. In practical applications, the intent recognition loss of the text parsing model can be determined based on the first preset loss function, the intent information of the sample dialogue text, and the intent label. The first preset loss function can be set according to actual needs, and this embodiment does not limit it. For example, the first preset loss function can be the cross-entropy loss function (Focal Loss). In this case, the intent recognition loss of the text parsing model can be determined by the following formula (1).
[0113]
[0114] Among them, L fl1 Let represent the intent recognition loss of the text parsing model, where y represents the sample dialogue text, y=1 indicates that the sample dialogue text has intent, and y=0 indicates that the sample dialogue text does not have intent. γ1 represents the probability that the intent information of the sample dialogue text is the same as the intent label, and γ1 represents the first preset influence factor, which can be set according to actual needs. This application does not limit it.
[0115] Understandably, determining the intent recognition loss of the text parsing model through the cross-entropy loss function can address the difficulty in classifying sample dialogue texts, allowing the text parsing model to focus on sample dialogue texts with difficult-to-identify intents. This solves the problem of low intent recognition accuracy of the text parsing model for a small number of sample dialogue texts caused by the imbalance of sample dialogue texts in the training data, and is beneficial to improving the intent recognition accuracy of the text parsing model.
[0116] The entity recognition loss of the text parsing model is used to represent the difference between the entity recognition results of the sample dialogue text obtained by the text parsing model under N candidate intents and the entity labels of the sample text. In practical applications, the entity recognition loss of the text parsing model can be determined based on the second preset loss function, the entity information of the sample dialogue text, and the entity labels. The second preset loss function can be set according to actual needs, and this application embodiment does not limit it. For example, the second preset loss function can be the cross-entropy loss function. In this case, the entity recognition loss of the text parsing model can be determined by the following formula (2).
[0117]
[0118] Among them, L fl2 Let represent the entity recognition loss of the text parsing model, and y represent the sample dialogue text, where y = 1 indicates that the sample dialogue text contains entities, and y = 0 indicates that the sample dialogue text does not contain entities. γ represents the probability that the entity information of the sample dialogue text is the same as the entity label, and γ2 represents the second preset influence factor, which can be set according to actual needs. This application does not limit it.
[0119] Understandably, determining the entity recognition loss of the text parsing model through the cross-entropy loss function can address the difficulty in classifying sample dialogue texts. This allows the text parsing model to focus on sample dialogue texts where entities are difficult to identify, thus solving the problem of low entity recognition accuracy for a small number of sample dialogue texts caused by imbalance in the training data. This is beneficial for improving the accuracy of the text parsing model in entity recognition under N different intentions.
[0120] S562 adjusts the model parameters of the text parsing model based on the processing loss of the text parsing model.
[0121] The model parameters of the text parsing model include the module parameters of the encoding module and the module parameters of each of the N parsing modules. For each module in the text parsing module, its module parameters may include the number of nodes (e.g., neurons) in each network layer, the connection relationships and edge weights between nodes in different network layers, and the biases corresponding to the nodes in each network layer.
[0122] Considering that the output of the preceding module in the text parsing model affects the output of the following module, to further improve the parsing accuracy of the text parsing model, S562 can be specifically implemented as follows: based on the direction propagation algorithm and the processing loss of the text parsing model, the module parameters of the encoding module and the N parsing modules are adjusted respectively. Of course, in other optional implementations, the module parameters of the encoding module and the N parsing modules can also be adjusted respectively based on the Adam algorithm and the processing loss of the text parsing model.
[0123] Furthermore, S506 may also include: S563, if the text parsing model after adjusting the model parameters does not meet the preset training stopping condition, then repeat the above steps of parsing the sample dialogue text through the text parsing model to adjusting the model parameters of the text parsing model, that is, repeat S504 to S562 until the text parsing model after adjusting the model parameters meets the preset training stopping condition.
[0124] This application embodiment illustrates one specific implementation of the above-described S506. It should be understood that S506 can also be implemented using various techniques commonly used in the art, and this application embodiment does not limit its implementation.
[0125] The text parsing model training method provided in one or more embodiments of this application employs a text parsing model with an encoding module and N parsing modules, wherein the N parsing modules and N candidate meanings... Figure 1A one-to-one correspondence is established. Based on this, the text parsing model is trained using the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text. The encoding module performs semantic encoding on the sample dialogue text to obtain a semantic representation vector that can represent the semantics of the sample dialogue text. Then, each parsing module learns the intent of the sample dialogue text from the intent tags and the entities contained in the sample dialogue text that correspond to the intent from the entity tags, so that the trained text parsing model integrates functions such as intent recognition, entity recognition, and intent-entity pairing. In this way, the trained text parsing model can be used to accurately understand the user's real needs and parse the user's dialogue text intent and the entity corresponding to the intent. Based on the parsed intent and its corresponding entity, the model can respond to the user's dialogue text, which helps to improve the response accuracy.
[0126] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0127] The foregoing describes a text processing method provided by one or more embodiments of this application. The text processing method provided by the embodiments of this application can be used in various scenarios that require automatic response, including but not limited to the following application scenarios: intelligent customer service, human-computer interaction in virtual reality scenarios, etc.
[0128] For example, in an intelligent customer service scenario, historical dialogue text, its intent, and entities contained within the intent of the historical dialogue text can be extracted from the historical call record data of the customer service center. This yields training data for training a text parsing model. Then, using the text parsing model training method provided in this embodiment, the text parsing model is trained with this training data. The trained text parsing model integrates multiple functions such as intent recognition, entity recognition, and intent-entity matching. Afterward, the trained text parsing model is deployed on the customer service center's server. Accordingly, in the application phase, after receiving the first user dialogue text input by the user, the customer service center's client can send the first user dialogue text to the customer service center's server. The server, based on the deployed text parsing model and the text processing method provided in this embodiment, determines the target response text corresponding to the first user dialogue text and returns it to the client for display, thereby achieving automatic response to the user.
[0129] For example, in human-computer interaction within a virtual reality scenario, historical dialogue text, its intent, and entities contained within that intent can be obtained from historical interaction data. This provides training data for training a text parsing model. Then, using the text parsing model training method provided in this application, the text parsing model is trained with this training data. The trained text parsing model integrates multiple functions such as intent recognition, entity recognition, and intent-entity matching. Afterward, the trained text parsing model is deployed on a server. Accordingly, in the application phase, the client can display a virtual reality interactive interface to the user, which includes a virtual digital human for dialogue. The user can directly interact with the virtual digital human, such as by inputting text or voice. If the user inputs dialogue text, the client sends the dialogue text to the server; if the user inputs voice, the client converts the voice into text and sends it to the server. Based on the deployed text parsing model, the server uses the text processing method provided in this application to determine the target response text corresponding to the dialogue text and returns it to the client. The client then controls the virtual digital human to respond to the user based on the target response text, such as controlling the virtual digital human to play the target response text in the form of speech, and / or displaying the target response text on the virtual reality interactive interface, thereby realizing automatic response to the user.
[0130] Of course, it should be understood that the text processing method provided in this application embodiment can also be applied to other scenarios. The text processing process in other scenarios is similar to the text processing process in the above-mentioned intelligent customer service scenario and virtual reality scenario, and will not be elaborated here.
[0131] In addition, with the above Figure 1 Corresponding to the text processing method shown, this application also provides a text processing apparatus. Please refer to... Figure 7 The diagram below illustrates the structure of a text processing apparatus according to an embodiment of this application. The apparatus 700 may include:
[0132] The first acquisition unit 710 is used to acquire the first user dialogue text to be processed.
[0133] The first parsing unit 720 is used to parse the first user dialogue text through a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0134] The first determining unit 730 is configured to determine the target response text corresponding to the first user dialogue text based on the intent information and the entity information; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are related to the N candidate intent information. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text, and the i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0135] Optionally, the semantic representation vector includes the text semantic representation vector of the first user dialogue text and the character semantic representation vector of each character in the first user dialogue text, and each parsing module includes a first linear layer, a second linear layer and a third linear layer;
[0136] The first linear layer of the i-th parsing module is used to convert the text semantic representation vector into a first target representation vector in the vector space of the i-th candidate intent, and to convert the character semantic representation vector of each character in the first user dialogue text into a second target representation vector in the vector space of the i-th candidate intent;
[0137] The second linear layer of the i-th parsing module is used to perform intent recognition on the first user dialogue text based on the first target representation vector in the vector space of the i-th candidate intent, and obtain the intent recognition result corresponding to the i-th candidate intent;
[0138] The third linear layer of the i-th parsing module is used to perform entity recognition on the first user dialogue text based on the second target representation vector of each character in the first user dialogue text under the vector space of the i-th candidate intent, so as to obtain the entity recognition result corresponding to the i-th candidate intent.
[0139] Optionally, the N candidate intentions include a first candidate intention and M second candidate intentions, where M = N-1;
[0140] The N parsing modules include a first parsing module and M second parsing modules. The first parsing module corresponds to the first candidate intent, and the M second parsing modules correspond to the M second candidate intents. Figure 1 One-to-one correspondence;
[0141] The first parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the first candidate intent, wherein the intent recognition result corresponding to the first candidate intent is used to indicate whether the intent of the first user dialogue text contains at least one of the M second candidate intents.
[0142] The j-th second parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the j-th candidate intent. The intent recognition result corresponding to the j-th candidate intent is used to indicate whether the intent of the first user dialogue text contains the j-th candidate intent, where j is a positive integer and 1≤j≤M.
[0143] Optionally, the first determining unit is specifically configured to: determine the target intent of the first user dialogue text based on the intent recognition results corresponding to the N candidate intents respectively; determine the entity corresponding to the target intent in the first user dialogue text based on the entity recognition results corresponding to the N candidate intents respectively; and determine the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text.
[0144] Optionally, the first determining unit determines the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text, including: if the target intent contains at least one of the N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then outputting a first response text, the first response text being used to guide the input of user dialogue text containing entities; parsing the received user dialogue text through the text parsing model to obtain the intent information and entity information of the received user dialogue text; and determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent, the intent information and entity information of the received user dialogue text.
[0145] Optionally, the first determining unit determines the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text, including: if the target intent does not contain the N candidate intents and the target intent has a corresponding entity in the first user dialogue text, then outputting a second response text, the second response text being used to guide the input of a user dialogue text containing at least one of the candidate intents; parsing the received user dialogue text through the text parsing model to obtain the intent information and entity information of the received user dialogue text; and determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the entity corresponding to the target intent in the first user dialogue text, the intent information and entity information of the received user dialogue text.
[0146] Optionally, the first determining unit is configured to determine the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text, including: if the target intent does not contain the N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then outputting a third response text, the third response text being used to guide input of a user dialogue text containing the entity corresponding to the target intent and at least one of the candidate intents; parsing the received user dialogue text through the text parsing model to obtain the intent information and entity information of the received user dialogue text; and determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the intent information and entity information of the received user dialogue text.
[0147] Optionally, the first determining unit determines the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text, including: if the target intent contains at least one of the N candidate intents and the target intent has a corresponding entity in the first user dialogue text, then the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library based on the target intent and the corresponding entity of the target intent in the first user dialogue text.
[0148] Obviously, the text processing device provided in this application embodiment can serve as... Figure 1 The execution body of the text processing method shown, for example Figure 1 In the text processing method shown, step S102 can be performed by... Figure 7 The first acquisition unit in the text processing device shown executes step S104, which can be performed by... Figure 7The first parsing unit in the text processing device shown executes step S106, which can be performed by... Figure 7 The first determining unit in the text processing device shown is executed.
[0149] According to another embodiment of this application, Figure 7 The text processing apparatus shown can be composed of individual or combined units into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the text processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0150] According to another embodiment of this application, a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), can run an application capable of performing tasks such as... Figure 1 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 7 The text processing apparatus shown herein, and the text processing method for implementing the embodiments of this application, are described. The computer program may be recorded on, for example, a computer-readable storage medium, and may be transferred to and executed in an electronic device via such a medium.
[0151] In addition, with the above Figure 5 Corresponding to the training method of the text parsing model shown, this application also provides a training apparatus for a text parsing model. Please refer to... Figure 8 The diagram below illustrates the structure of a training device for a text parsing model, as provided in one embodiment of this application. The device 800 may include:
[0152] The second acquisition unit 810 is used to acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text.
[0153] The second parsing unit 820 is used to parse the sample dialogue text through a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0154] Training unit 830 is used to train the text parsing model based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text.
[0155] The text parsing model includes an encoding module and N parsing modules, wherein the N parsing modules are related to the N candidate semantic modules. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text, and the i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0156] Optionally, the training unit is specifically used to: determine the processing loss of the text parsing model based on the intent information and intent tags of the sample dialogue text, and the entity information and entity tags of the sample dialogue text; and adjust the model parameters of the text parsing model based on the processing loss of the text parsing model.
[0157] Optionally, the training unit determines the processing loss of the text parsing model based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text, including: determining the intent recognition loss of the text parsing model based on the intent information and intent tags of the sample dialogue text; determining the entity recognition loss of the text parsing model based on the entity information and entity tags of the sample dialogue text; and performing a weighted summation of the intent recognition loss and the entity recognition loss to obtain the processing loss of the text parsing model.
[0158] Obviously, the training device for the text parsing model provided in this application embodiment can be used as... Figure 5 The execution entity of the training method of the text parsing model shown, for example Figure 5 In the training method of the text parsing model shown, step S502 can be performed by... Figure 8 The second acquisition unit in the training device of the text parsing model shown is executed, and step S504 can be performed by... Figure 8 The second parsing unit in the training device of the text parsing model shown is executed, and step S506 can be performed by... Figure 8The training unit in the training device of the text parsing model shown is executed.
[0159] According to another embodiment of this application, Figure 8 The units in the training device of the text parsing model shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effect of the embodiments of this application. The above units are based on logical function division. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the training device of the text parsing model may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0160] According to another embodiment of this application, a general-purpose computing device, such as a computer, including processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), can run an application capable of performing tasks such as... Figure 5 The computer program (including program code) for each step involved in the corresponding method shown, to construct such... Figure 8 The diagram illustrates a training apparatus for a text parsing model, and a training method for implementing the text parsing model according to embodiments of this application. The computer program may be recorded on, for example, a computer-readable storage medium, and may be transferred to and run in an electronic device via such a medium.
[0161] Figure 9 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Please refer to it. Figure 9 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.
[0162] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.
[0163] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.
[0164] The processor reads the corresponding computer program from non-volatile memory into main memory and then executes it, forming a text processing device at the logical level. The processor executes the program stored in memory and specifically performs the following operations:
[0165] Get the first user dialogue text to be processed;
[0166] The first user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0167] Based on the intent information and the entity information, the target response text corresponding to the first user dialogue text is determined;
[0168] The text parsing model includes an encoding module and N parsing modules, wherein the N parsing modules are related to the N candidate semantic modules. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text, and the i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0169] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and runs it, forming a training device for the text parsing model at the logical level. The processor executes the program stored in memory and specifically performs the following operations:
[0170] Acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text;
[0171] The sample dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0172] The text parsing model is trained based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text.
[0173] The text parsing model includes an encoding module and N parsing modules, wherein the N parsing modules are related to the N candidate semantic modules. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text, and the i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0174] The above is as stated in this application. Figure 1 The illustrated embodiments disclose the method performed by the text processing apparatus, or as described in this application. Figure 5The method executed by the training device for the text parsing model disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0175] The electronic device can also perform Figure 1 The method, and implement the text processing device in Figure 1 , Figure 4 The illustrated embodiment may also perform the functions of the electronic device, or the electronic device may also perform the functions of the embodiment shown. Figure 5 The method, and the implementation of the training device for the text parsing model in Figure 5 The functions of the embodiments shown are not described in detail here.
[0176] Of course, in addition to software implementation, the electronic device of this application does not exclude other implementation methods, such as logic devices or a combination of hardware and software, etc. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0177] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by a portable electronic device including multiple applications, enable the portable electronic device to perform... Figure 1 The method of the illustrated embodiment is specifically used to perform the following operations:
[0178] Get the first user dialogue text to be processed;
[0179] The first user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0180] Based on the intent information and the entity information, the target response text corresponding to the first user dialogue text is determined; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are related to the N candidate intent information. Figure 1 In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text, and the i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0181] Alternatively, embodiments of this application also propose a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by a portable electronic device including multiple applications, enable the portable electronic device to perform... Figure 5 The method of the illustrated embodiment is specifically used to perform the following operations:
[0182] Acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text;
[0183] The sample dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents.
[0184] The text parsing model is trained based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text; wherein, the text parsing model includes an encoding module and N parsing modules, and the N parsing modules are coupled with the N candidate intent tags. Figure 1In a one-to-one correspondence, the encoding module is used to perform semantic encoding processing on the sample dialogue text to obtain the semantic representation vector of the sample dialogue text, and the i-th parsing module is used to parse the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent, where N is a positive integer and i is a positive integer less than or equal to N.
[0185] In summary, the above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
[0186] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0187] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0188] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0189] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
Claims
1. A text processing method, characterized in that, include: Get the first user dialogue text to be processed; The first user dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents. Based on the intent information and the entity information, the target response text corresponding to the first user dialogue text is determined; The text parsing model includes an encoding module and N parsing modules. The N parsing modules correspond one-to-one with the N candidate intentions. The encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text. The i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intention recognition result and entity recognition result corresponding to the i-th candidate intention. N is a positive integer, and i is a positive integer less than or equal to N.
2. The method according to claim 1, characterized in that, The semantic representation vector includes the text semantic representation vector of the first user dialogue text and the character semantic representation vector of each character in the first user dialogue text. Each parsing module includes a first linear layer, a second linear layer and a third linear layer. The first linear layer of the i-th parsing module is used to convert the text semantic representation vector into a first target representation vector in the vector space of the i-th candidate intent, and to convert the character semantic representation vector of each character in the first user dialogue text into a second target representation vector in the vector space of the i-th candidate intent; The second linear layer of the i-th parsing module is used to perform intent recognition on the first user dialogue text based on the first target representation vector in the vector space of the i-th candidate intent, and obtain the intent recognition result corresponding to the i-th candidate intent; The third linear layer of the i-th parsing module is used to perform entity recognition on the first user dialogue text based on the second target representation vector of each character in the first user dialogue text under the vector space of the i-th candidate intent, so as to obtain the entity recognition result corresponding to the i-th candidate intent.
3. The method according to claim 1, characterized in that, The N candidate intentions include a first candidate intention and M second candidate intentions, where M = N-1; The N parsing modules include a first parsing module and M second parsing modules. The first parsing module corresponds to the first candidate intent, and the M second parsing modules correspond one-to-one with the M second candidate intents. The first parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the first candidate intent, wherein the intent recognition result corresponding to the first candidate intent is used to indicate whether the intent of the first user dialogue text contains at least one of the M second candidate intents. The j-th second parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the j-th candidate intent. The intent recognition result corresponding to the j-th candidate intent is used to indicate whether the intent of the first user dialogue text contains the j-th candidate intent, where j is a positive integer and 1≤j≤M.
4. The method according to any one of claims 1 to 3, characterized in that, Determining the target response text corresponding to the first user dialogue text based on the intent information and the entity information includes: Based on the intent recognition results corresponding to the N candidate intents, the target intent of the first user dialogue text is determined. Based on the entity recognition results corresponding to the N candidate intentions, the entity corresponding to the target intention in the first user dialogue text is determined. Based on the target intent and its corresponding entity in the first user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
5. The method according to claim 4, characterized in that, The step of determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text includes: If the target intent includes at least one of the N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then the first response text is output, and the first response text is used to guide the input of user dialogue text containing entities. The received user dialogue text is parsed using the text parsing model to obtain the intent information and entity information of the received user dialogue text; Based on the target intent, the intent information and entity information of the received user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
6. The method according to claim 4, characterized in that, The step of determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text includes: If the target intent does not contain the N candidate intents, and the target intent has a corresponding entity in the first user dialogue text, then output a second response text. The second response text is used to guide the input of a user dialogue text containing at least one of the candidate intents. The received user dialogue text is parsed using the text parsing model to obtain the intent information and entity information of the received user dialogue text; Based on the entity corresponding to the target intent in the first user dialogue text, the intent information and entity information of the received user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
7. The method according to claim 4, characterized in that, The step of determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text includes: If the target intent does not contain the N candidate intents and the target intent does not have a corresponding entity in the first user dialogue text, then a third response text is output. The third response text is used to guide the input of a user dialogue text that contains the entity corresponding to the target intent and at least one of the candidate intents. The received user dialogue text is parsed using the text parsing model to obtain the intent information and entity information of the received user dialogue text; Based on the intent and entity information of the received user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
8. The method according to claim 4, characterized in that, The step of determining the target response text corresponding to the first user dialogue text from the question-and-answer text library based on the target intent and its corresponding entity in the first user dialogue text includes: If the target intent includes at least one of the N candidate intents, and the target intent has a corresponding entity in the first user dialogue text, then based on the target intent and the corresponding entity of the target intent in the first user dialogue text, the target response text corresponding to the first user dialogue text is determined from the question-and-answer text library.
9. A training method for a text parsing model, characterized in that, include: Acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text; The sample dialogue text is parsed using a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents. The text parsing model is trained based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text. The text parsing model includes an encoding module and N parsing modules, each corresponding to one of the N candidate intents. The encoding module performs semantic encoding on the sample dialogue text to obtain a semantic representation vector of the sample dialogue text. The i-th parsing module parses the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent. N is a positive integer, and i is a positive integer less than or equal to N.
10. The method according to claim 9, characterized in that, The process of training the text parsing model based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text, includes: Based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text, the processing loss of the text parsing model is determined. Based on the processing loss of the text parsing model, the model parameters of the text parsing model are adjusted.
11. A text processing device, characterized in that, include: The first acquisition unit is used to acquire the first user dialogue text to be processed. The first parsing unit is used to parse the first user dialogue text through a text parsing model to obtain the intent information and entity information of the first user dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents. The first determining unit is configured to determine the target response text corresponding to the first user dialogue text based on the intent information and the entity information; The text parsing model includes an encoding module and N parsing modules. The N parsing modules correspond one-to-one with the N candidate intentions. The encoding module is used to perform semantic encoding processing on the first user dialogue text to obtain the semantic representation vector of the first user dialogue text. The i-th parsing module is used to parse the first user dialogue text based on the semantic representation vector to obtain the intention recognition result and entity recognition result corresponding to the i-th candidate intention. N is a positive integer, and i is a positive integer less than or equal to N.
12. A training device for a text parsing model, characterized in that, include: The second acquisition unit is used to acquire training data, which includes sample dialogue text, intent tags and entity tags of the sample dialogue text, wherein the intent tags are used to represent the intent of the sample dialogue text, and the entity tags are used to represent the entity corresponding to the intent in the sample dialogue text. The second parsing unit is used to parse the sample dialogue text using a text parsing model to obtain the intent information and entity information of the sample dialogue text. The intent information includes the intent recognition results corresponding to N candidate intents, and the entity information includes the entity recognition results corresponding to the N candidate intents. The training unit is used to train the text parsing model based on the intent information and intent tags of the sample dialogue text, as well as the entity information and entity tags of the sample dialogue text. The text parsing model includes an encoding module and N parsing modules, each corresponding to one of the N candidate intents. The encoding module performs semantic encoding on the sample dialogue text to obtain a semantic representation vector of the sample dialogue text. The i-th parsing module parses the sample dialogue text based on the semantic representation vector to obtain the intent recognition result and entity recognition result corresponding to the i-th candidate intent. N is a positive integer, and i is a positive integer less than or equal to N.
13. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the method as described in any one of claims 1 to 8; or the processor is configured to execute the instructions to implement the method as described in any one of claims 9 to 10.
14. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the method as described in any one of claims 1 to 8; or, the electronic device is enabled to perform the method as described in any one of claims 9 to 10.
Citation Information
Patent Citations
Intention model training method and device, intention identification method and device, equipment and medium
CN110287283A
Semantic recognition method and device, electronic equipment and computer readable storage medium
CN111125331A