Inquiry statement rewriting method and device
By obtaining and utilizing the context and intent information in historical conversation information to rewrite the original query information, the problem of difficulty in intent matching in multiple rounds of conversations in the intelligent question and answer system is solved, and the reliability of the system and customer experience are improved.
Patent Information
- Application Number
- CN202110825658.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-21
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-07-21
AI Technical Summary
In the intelligent question and answer system, due to the different context of the inquiry information input by the customer in multiple rounds of dialogue, the same intention is expressed in different forms in different rounds of dialogue. The existing inquiry rewriting method cannot accurately match the customer's true intention, which reduces the reliability of the system.
By obtaining historical conversation information related to the original inquiry information, historical context information and intent information are obtained, and the original inquiry information is rewritten with this information to generate target inquiry information, so as to generate a response that matches the customer's true intention.
It improves the reliability of the intelligent question and answer system, ensures that the generated response information matches the user's true intention, and improves the customer experience.
Smart Images

Figure CN113673256B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and in particular to a method and device for rewriting a query statement. Background Art
[0002] With the development of artificial intelligence technology and natural language processing technology, intelligent question-answering systems have emerged. Intelligent question-answering systems can use accurate and concise natural language to answer in human-computer dialogue based on the inquiry information entered by the customer, realize interaction with customers, and provide customers with personalized services. In some cases, when the inquiry information entered by the customer does not reflect the customer's intention well, the intelligent question-answering system may not be able to determine the matching answer information based only on the inquiry information entered by the customer, resulting in a poor customer experience. In order to enable the intelligent question-answering system to provide answer information that matches the customer's intention, the inquiry information entered by the customer can be rewritten to ultimately obtain new inquiry information that is closer to the customer's intention.
[0003] Normally, in the inquiry rewriting, one or more words with low relevance to the customer's intention can be removed from the inquiry information to obtain new inquiry information. However, this approach also has some disadvantages: when the intelligent question-answering system is applied to the customer service scenario, the intelligent question-answering system often needs to have multiple rounds of dialogues with the customer. In multiple rounds of dialogues, as the context of the inquiry information input by the customer is different, the same customer intention may have different expressions in the inquiry information of multiple rounds of dialogue, and different customer intentions may also have the same expression in the inquiry information of multiple rounds of dialogue. Therefore, even if the inquiry information is rewritten according to the above inquiry rewriting scheme, the new inquiry information obtained may not reflect the customer's true intention. Therefore, the above inquiry rewriting method makes the intelligent question-answering system unable to obtain response information that matches the customer's true intention based on the rewritten new inquiry information, reducing the reliability of the intelligent question-answering system. Summary of the invention
[0004] The present invention provides a method and device for rewriting a query statement.
[0005] The embodiment of the present disclosure provides a method for rewriting a query statement. The method for rewriting a query statement is applicable to an intelligent human-computer dialogue service, and includes: obtaining historical dialogue information related to original query information; obtaining historical context information and historical intention information based on the historical dialogue information; rewriting the original query information using the historical context information and historical intention information to obtain target query information; and generating response information corresponding to the original query information based on the target query information.
[0006] In an implementation of the present disclosure, obtaining historical conversation information related to original inquiry information includes: performing intent analysis on the original inquiry information to obtain the intent of the original inquiry information; and obtaining historical conversation information having the same intent.
[0007] In one implementation of the present disclosure, obtaining historical context information and historical intent information based on historical conversation information includes: taking the historical conversation information as input, inputting it into a pre-trained conversation analysis model, and obtaining historical context information and historical intent information corresponding to the historical conversation information.
[0008] An implementation of the present disclosure also includes: training a conversation analysis model.
[0009] In an implementation of the present disclosure, the method further includes: filtering the conversation data set.
[0010] In one implementation of the present disclosure, filtering a conversation data set includes: counting the number of reply messages having preset semantic features in the conversation information of the conversation data set, and deleting the conversation information when the number of reply messages having preset semantic features exceeds a first preset number threshold; and / or counting the number of inquiry messages and corresponding reply messages in the conversation information of the conversation data set, and deleting the conversation information when the number of inquiry messages and corresponding reply messages is lower than a second preset number threshold.
[0011] In one implementation of the present disclosure, rewriting original query information using historical context information and historical intent information to obtain target query information includes: performing grammatical analysis on the original query information; when it is determined that context information is missing in the original query information, filling the historical context information into the context information position in the original query information to obtain the target query information; and / or when it is determined that intent information is missing in the original query information, filling the historical intent information into the intent information position in the original query information to obtain the target query information.
[0012] In an implementation of the present disclosure, the method further includes: performing semantic evaluation on the target query information; when the semantic evaluation result meets the preset requirement, replacing the original query information with the target query information.
[0013] In one implementation of the present disclosure, performing a semantic evaluation on a target inquiry information includes: obtaining evaluation factors, wherein the evaluation factors may include one or more of the following factors: whether there is reply information with preset semantic features in the target inquiry information, whether the number of reply information with preset semantic features in the target inquiry information exceeds a first preset number threshold, whether the number of dialogue information in the target inquiry information that is consistent with the subject of the original inquiry information is lower than a second preset number threshold, and whether there are grammatical errors in the target inquiry information; performing a weighted score on the target inquiry information based on the evaluation factors to obtain a semantic evaluation result.
[0014] In one implementation of the present disclosure, performing semantic evaluation on target query information includes: extracting preset features of the target query information, wherein the preset features include one or more of the following features: reply sentences with preset semantic features in the target query information, the number of reply messages with preset semantic features in the target query information, the number of dialogue messages in the target query information that are consistent with the subject of the original query information, and the grammatical components of the target query information; taking the target query information and its preset features as input, and inputting them into a pre-trained semantic evaluation model to obtain a semantic evaluation result corresponding to the target query information.
[0015] In an implementation of the present disclosure, performing semantic evaluation on the target query information further includes: training a semantic evaluation model.
[0016] In one implementation of the present disclosure, response information corresponding to original inquiry information is generated based on target inquiry information, including: performing intent analysis on the target inquiry information to obtain the intent of the target inquiry information; obtaining response information with the same intent from a preset response database as response information corresponding to the original inquiry information, wherein the preset response database stores response information and its corresponding intent information.
[0017] In an implementation of the present disclosure, it also includes: acquiring original inquiry information from an interactive interface of a terminal; and outputting response information to the terminal to display the response information on the interactive interface.
[0018] In one implementation of the present disclosure, the response information is text information or sound information, and the step of displaying the response information on the interactive interface includes: displaying the response text information on the interactive interface, or converting the response information into a response voice information, and playing the response voice information on the interactive interface.
[0019] The embodiment of the present disclosure also provides a query statement rewriting device. The query statement rewriting device includes: a dialogue acquisition module, configured to acquire historical dialogue information related to the original query information; a context intention acquisition module, configured to acquire historical context information and historical intention information based on the historical dialogue information; a query information rewriting module, configured to rewrite the original query information using the historical context information and historical intention information to obtain target query information; and a response information generation module, configured to generate response information corresponding to the original query information based on the target query information.
[0020] In one implementation of the present disclosure, the part of the conversation acquisition module that acquires historical conversation information related to the original query information is configured to: perform intent analysis on the original query information to obtain the intent of the original query information; and acquire historical conversation information with the same intent.
[0021] In one implementation of the present disclosure, the part of the contextual intent acquisition module that acquires historical context information and historical intent information based on historical conversation information is configured as follows: the historical conversation information is taken as input into a pre-trained conversation analysis model to obtain historical context information and historical intent information corresponding to the historical conversation information.
[0022] In one implementation of the present disclosure, the device further includes: a model training module configured to train a conversation analysis model.
[0023] In one implementation of the present disclosure, the part of the model training module that trains the conversation analysis model is configured to: determine an initial conversation analysis model; obtain a conversation data set with consistent topics, wherein the conversation data set includes one or more conversation information with consistent topics, and the conversation information includes inquiry information and corresponding reply information; use the conversation information in the conversation data set as input, and use the context information and intention information of the conversation information as output to train the initial behavior determination model to obtain a conversation analysis model.
[0024] In an implementation of the present disclosure, the device further includes: a conversation filtering module configured to filter the conversation data set.
[0025] In one implementation of the present disclosure, the portion of the filtering module that filters the conversation data set is configured to: count the number of reply messages having preset semantic features in the conversation information of the conversation data set, and when the number of reply messages having preset semantic features exceeds a first preset number threshold, delete the conversation information; and / or count the number of inquiry messages and corresponding reply messages in the conversation information of the conversation data set, and when the number of inquiry messages and corresponding reply messages is lower than a second preset number threshold, delete the conversation information.
[0026] In one implementation of the present disclosure, the portion of the query information rewriting module that uses historical context information and historical intent information to rewrite the original query information to obtain the target query information is configured to: perform grammatical analysis on the original query information; when it is determined that the original query information lacks context information, fill the historical context information into the context information position in the original query information to obtain the target query information; and / or when it is determined that the original query information lacks intent information, fill the historical intent information into the intent information position in the original query information to obtain the target query information.
[0027] In an implementation of the present disclosure, the device further includes: a semantic evaluation module configured to perform semantic evaluation on target query information; and a query replacement module configured to replace original query information with the target query information when a semantic evaluation result meets preset requirements.
[0028] In one implementation of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target inquiry information is configured to: obtain evaluation factors, wherein the evaluation factors may include one or more of the following factors: whether there is reply information with preset semantic features in the target inquiry information, whether the number of reply information with preset semantic features in the target inquiry information exceeds a first preset number threshold, whether the number of dialogue information in the target inquiry information that is consistent with the subject of the original inquiry information is lower than a second preset number threshold, and whether there are grammatical errors in the target inquiry information; and perform weighted scoring on the target inquiry information based on the evaluation factors to obtain a semantic evaluation result.
[0029] In one implementation of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target inquiry information is configured to: extract preset features of the target inquiry information, wherein the preset features include one or more of the following features: reply sentences with preset semantic features in the inquiry information, the number of reply messages with preset semantic features in the inquiry information, the number of dialogue messages consistent with the topic of the inquiry information, and the grammatical components of the inquiry information; take the target inquiry information and its preset features as input, input them into a pre-trained semantic evaluation model, and obtain a semantic evaluation result corresponding to the target inquiry information.
[0030] In an implementation of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target query information is further configured to: train a semantic evaluation model.
[0031] In one implementation of the present disclosure, the part of the semantic evaluation module that trains the semantic evaluation model is configured to: determine an initial semantic evaluation model; obtain training dialogue information and extract preset features of the training dialogue information; use the training dialogue information and its preset features as input and the semantic evaluation result of the training dialogue information as output to train the initial semantic evaluation model to obtain a semantic evaluation model.
[0032] In one implementation of the present disclosure, a portion of a response information generation module that generates response information corresponding to original inquiry information based on target inquiry information is configured to: perform intent analysis on the target inquiry information to obtain the intent of the target inquiry information; and obtain response information with the same intent from a preset response database as the response information corresponding to the original inquiry information, wherein the preset response database stores response information and its corresponding intent information.
[0033] In one implementation of the present disclosure, the device also includes: an interface inquiry acquisition module, configured to obtain original inquiry information from an interactive interface of a terminal; and an interface response output module, configured to output response information to the terminal to display the response information on the interactive interface.
[0034] In one implementation of the present disclosure, the response information is text information or sound information, and the part of the interface response output module that displays the response information on the interactive interface is configured to: display the response text information on the interactive interface, or convert the response information into response voice information and play the response voice information on the interactive interface.
[0035] The embodiment of the present disclosure further provides a computer-readable storage medium for storing computer instructions used by the query statement rewriting device, which includes computer instructions involved in executing the above-mentioned query statement rewriting method.
[0036] An embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the method steps of the above-mentioned query statement rewriting method.
[0037] The technical solution provided by the embodiments of the present disclosure may include the following beneficial effects: the above technical solution obtains historical context information and historical intent information based on historical conversation information related to the original query information, and rewrites the original query information in combination with the historical context information and the historical intent information to obtain the target query information, so that the rewritten target query information has both intent information and context information. In combination with the intent information and context information in the target query information, the target query information can reflect the user's unique true intention, ensure that the response information corresponding to the original query information generated based on the target query information can match the user's unique true intention, and improve the reliability of the intelligent question and answer system.
[0038] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0040] Figure 1 A flowchart showing a method for rewriting a query statement according to an embodiment of the present disclosure is shown;
[0041] Figure 2 An overall flow chart of a query statement rewriting method according to an embodiment of the present disclosure is shown;
[0042] Figure 3 A structural block diagram of a query statement rewriting device according to an embodiment of the present disclosure is shown;
[0043] Figure 4 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown;
[0044] Figure 5 It is a structural diagram of a computer system suitable for implementing the query statement rewriting method of an embodiment of the present disclosure. DETAILED DESCRIPTION
[0045] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0046] It should be understood that terms such as “include” or “have” in the present disclosure are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof exist or are added.
[0047] It should also be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0048] As mentioned above, with the development of artificial intelligence technology and natural language processing technology, intelligent question-answering systems have emerged. Intelligent question-answering systems can use accurate and concise natural language to answer based on the query information input by the user in human-computer dialogue, realize interaction with users, and provide users with personalized services. In some cases, when the query information input by the user does not reflect the user's intention well, the intelligent question-answering system may not be able to determine the matching response information only through the query information input by the user, resulting in a poor user experience. In order to enable the intelligent question-answering system to provide response information that matches the user's intention, the query information input by the user can be rewritten to ultimately obtain new query information that is closer to the user's intention. Usually, in the rewriting of the query information, one or more words in the query information that are less relevant to the user's intention can be removed to obtain new query information, but this approach also has some disadvantages. In multiple rounds of dialogue, as the context of the query information input by the user is different, the same user intention may have different expressions in the query information of multiple rounds of dialogue, and different user intentions may have the same expression in the query information of multiple rounds of dialogue. Therefore, even if the query information is rewritten according to the above query information rewriting scheme, the obtained new query information may not reflect the user's true intention. Therefore, the above query rewriting method makes it impossible for the intelligent question-answering system to obtain response information that matches the user's true intention based on the rewritten new query information, which reduces the reliability of the intelligent question-answering system.
[0049] In view of the above-mentioned defects, the technical solution provided by the present invention is to obtain historical context information and historical intention information based on historical conversation information related to the original query information, and rewrite the original query information in combination with the historical context information and historical intention information to obtain the target query information, so that the rewritten target query information has both intention information and context information. Combined with the intention information and context information in the target query information, the target query information can reflect the user's unique true intention, so that the response information corresponding to the original query information generated based on the target query information can match the user's unique true intention, thereby improving the reliability of the intelligent question and answer system.
[0050] Figure 1 A flowchart of a method for rewriting a query statement according to an embodiment of the present disclosure is shown. Figure 1 As shown, the query statement rewriting method includes the following steps S101-S104:
[0051] In step S101, historical conversation information related to the original inquiry information is obtained.
[0052] In step S102, historical context information and historical intention information are acquired based on the historical dialogue information.
[0053] In step S103, the original query information is rewritten using the historical context information and the historical intent information to obtain the target query information.
[0054] In step S104, response information corresponding to the original inquiry information is generated based on the target inquiry information.
[0055] In one embodiment of the present disclosure, the query statement rewriting method may be applicable to a query statement rewriting party such as a computer, a computing device, an electronic device, a server, a service cluster, etc. that rewrites a query statement.
[0056] In one embodiment of the present disclosure, original query information refers to query information input by a user during a conversation, and the original query information may include one or more words.
[0057] In one embodiment of the present disclosure, the historical conversation information related to the original inquiry information refers to the conversation sentences adjacent to the original inquiry information in the conversation information to which the original inquiry information belongs, or may be the sentences in the conversation information to which the original inquiry information belongs, the number of conversation sentences of which is less than or equal to the conversation sentence number threshold. For example, when the original inquiry information is: "Can it arrive tomorrow?" and the conversation to which the original inquiry information belongs is: "CUST: Hello, are you there? STAFF: Hello, I'm here. CUST: What kind of express do you send for your oranges? STAFF: Hello, we send by SF Express. CUST: Can it arrive tomorrow?" (where CUST refers to the party who puts forward the inquiry information, and STAFF refers to the party who responds to the inquiry information), the historical conversation information related to the original inquiry information may be "Hello, we send by SF Express" or "What kind of express do you send for your oranges? Hello, we send by SF Express".
[0058] In one embodiment of the present disclosure, historical intent information refers to the purpose of the conversation to be achieved by the historical conversation information. Specifically, the historical intent information may include a conversation field and a conversation intent, wherein the conversation field may limit the scope of the conversation intent. For example, when the conversation field is logistics timeliness, the conversation intent may be "when can it be delivered", "how many days will it take to arrive", "how many days will it take to deliver", etc.; when the conversation field is the return policy, the conversation intent may be "can I return it if it doesn't fit", "can I return it if it doesn't fit", "can I return it if it's too big", "can I return it if it's too small", etc.
[0059] In one embodiment of the present disclosure, historical context information refers to the historical dialogue information that can be combined with the historical intent information to complete the key information missing in the historical dialogue information due to semantic simplification or semantic substitution. For example, when the original inquiry information is: "Can I return it if it doesn't fit?", the historical dialogue information is: "CUST: Do you still have XL size for the green T-shirt? STAFF: Hello, dear, the XL size is sold out. This one is a loose fit. Can you try the L size? CUST: Can I return it if it doesn't fit?", the sentence "Can I return it if it doesn't fit?" in the historical dialogue information lacks the key information "green T-shirt L size" due to semantic simplification, that is, the historical intent information is: "Can I return it if it doesn't fit?", and the historical context information is: "green T-shirt", "L size".
[0060] In one embodiment of the present disclosure, the target query information refers to the information obtained by filling the missing historical context information or historical intent information into the corresponding position in the original query information when any one of the context information and historical intent information is missing in the original query information. For example, when the original query information is: "How many days will it take to arrive", the original query information lacks the historical context information "SF Express", and the target query information can be obtained by rewriting the original query information as: "How many days will it take to arrive if sent by SF Express"; the original query information is: "What about the shirt in size L", the original query information lacks the intent information "Is it in stock", and the target query information can be obtained by rewriting the original query information as: "Is the shirt in size L in stock".
[0061] In one embodiment of the present disclosure, the response information corresponding to the original inquiry information refers to the information used to answer the original inquiry information, and the response information may include the information requested in the original inquiry information. For example, when the original inquiry information is "how many days will it take to arrive" and the target inquiry information is "how many days will it take for the shirt to arrive if it is sent by SF Express", the response information may be "Dear, it can be delivered in N days", where "N days" may be the number of days of express delivery obtained by querying the corresponding express delivery number.
[0062] The above query statement rewriting method can be used in a variety of application scenarios, such as machine dialogue scenarios, intelligent dialogue scenarios, human-computer dialogue scenarios, etc.
[0063] In one embodiment of the present disclosure, obtaining historical conversation information related to original inquiry information may include the following steps: performing intent analysis on the original inquiry information to obtain the intent of the original inquiry information; and obtaining historical conversation information having the same intent.
[0064] Intent analysis of original query information can be performed by combining various data processing methods such as structured, semi-structured, and unstructured data with various NLP (Natural Language Processing) technologies to identify the intent of the original query information. For example, intent analysis of event information can be performed based on natural language understanding technologies such as support vector machine (SVM), conditional random field (CRF), convolutional neural network (CNN), and recurrent neural network (RNN).
[0065] In this implementation, by performing intent analysis on the original query information to obtain the intent of the original query information, and obtaining historical conversation information with the same intent as the original query information, the historical intent information obtained based on the historical conversation information can be made the same as the intent of the original query information, ensuring that the intent embodied in the target query information obtained by rewriting the original query information using the historical context information and the historical intent information is the same as the intent of the original query information, that is, the user's only true intent, making the intent embodied in the target query information more accurate.
[0066] In one embodiment of the present disclosure, obtaining historical context information and historical intent information based on historical conversation information may include the following steps: taking the historical conversation information as input, inputting it into a pre-trained conversation analysis model, and obtaining historical context information and historical intent information corresponding to the historical conversation information.
[0067] The conversation analysis model may be a conversation analysis model based on posterior probability. In this embodiment, a pre-trained conversation analysis model is first obtained, and then the conversation analysis model is used to obtain historical context information and historical intention information based on historical conversation information. Specifically, the historical conversation information may be input into the pre-trained conversation analysis model to obtain multiple context information and intention information, as well as the probabilities corresponding to the historical context information and the historical intention information. Then, the context information and intention information with the highest probability are determined as the historical context information and the historical intention information.
[0068] In this embodiment, the historical context information and historical intention information corresponding to the historical dialogue information are obtained by using a pre-trained dialogue analysis model. In practical applications, after the dialogue analysis model has been fully learned and trained, the reliability of the historical context information and historical intention information obtained based on the dialogue analysis model will be greatly increased, so that the target query information rewritten based on the historical context information and historical intention information can more accurately reflect the user's unique true intention.
[0069] In one embodiment of the present disclosure, the query sentence rewriting method may further include the following steps: training a conversation analysis model. Training a conversation analysis model may include the following steps: determining an initial conversation analysis model; obtaining a conversation data set with a consistent topic, wherein the conversation data set includes one or more conversation information with a consistent topic, and the conversation information includes inquiry information and corresponding reply information; using the conversation information in the conversation data set as input, and using the context information and intention information of the conversation information as output to train the initial behavior determination model, and obtain a conversation analysis model.
[0070] In this embodiment, when training a conversation analysis model, an initial conversation analysis model is first determined, wherein the initial conversation analysis model can be selected according to the needs of the actual application. Then, a conversation data set with the same topic is obtained, the conversation information in the conversation data set is used as input, the context information and intention information of the conversation information are used as output, and the initial behavior determination model is trained. When the training results converge, the conversation analysis model can be obtained. The learning and training of the above conversation analysis model can be implemented by using learning and training methods such as q-learning, DQN, Policy Gradient, DDPG, etc., and the present disclosure does not specifically limit the specific learning and training implementation method of the conversation analysis model.
[0071] In one embodiment of the present disclosure, after acquiring a conversation data set with a consistent topic, the query statement rewriting method may further include the following steps: filtering the conversation data set.
[0072] In one embodiment of the present disclosure, filtering a conversation data set may include the following steps: counting the number of reply messages having preset semantic features in the conversation information of the conversation data set, and deleting the conversation information when the number of reply messages having preset semantic features exceeds a first preset number threshold; and / or counting the number of inquiry messages and corresponding reply messages in the conversation information of the conversation data set, and deleting the conversation information when the number of inquiry messages and corresponding reply messages is lower than a second preset number threshold.
[0073] Among them, the reply information with preset semantic features refers to a preset word, multiple preset words, a combination of multiple preset words, or multiple preset words combined according to a preset grammatical relationship. For example, the reply information with preset semantic features can be: "Are you there?", "OK dear", "What's the matter?", etc. The reply information with preset semantic features does not represent the actual intention of the customer, and does not have any explanation or description of the actual intention of the customer. If there are too many reply information with preset semantic features in the dialogue information, training the initial dialogue analysis model based on the dialogue information will cause interference to the training. In this embodiment, by counting the number of reply information with preset semantic features in the dialogue information of the dialogue data set, when the number of reply information with preset semantic features exceeds the first preset number threshold, deleting the dialogue information can avoid the dialogue information from interfering with the training of the initial dialogue analysis model, so as to improve the efficiency of training the initial dialogue analysis model.
[0074] Similarly, when the number of inquiry information and corresponding reply information in the dialogue information of the dialogue data set is small, the dialogue information may correspond to an interrupted dialogue or an incompletely recorded dialogue. The actual intention expressed by the customer in the uninterrupted dialogue or the fully recorded dialogue cannot be obtained based on the dialogue information. If the initial dialogue analysis model is trained based on the dialogue information, it will interfere with the training. In this embodiment, the number of inquiry information and corresponding reply information in the dialogue information of the dialogue data set is counted. When the number of inquiry information and corresponding reply information is lower than the second preset number threshold, the dialogue information is deleted to avoid the dialogue information from interfering with the training of the initial dialogue analysis model, so as to improve the efficiency of training the initial dialogue analysis model.
[0075] In one embodiment of the present disclosure, rewriting original query information using historical context information and historical intent information to obtain target query information may include the following steps: performing grammatical analysis on the original query information; when it is determined that context information is missing in the original query information, filling the historical context information into the context information position in the original query information to obtain target query information; and / or when it is determined that intent information is missing in the original query information, filling the historical intent information into the intent information position in the original query information to obtain target query information.
[0076] Considering that the original inquiry information usually lacks only one of the context information and the intent information, in order to minimize the amount of information to be rewritten in the original inquiry information, in this embodiment, first, grammatical analysis is performed on the original inquiry information; when it is determined that the original inquiry information lacks context information, the historical context information is filled into the context information position in the original inquiry information to obtain the target inquiry information; and / or when it is determined that the original inquiry information lacks intent information, the historical intent information is filled into the intent information position in the original inquiry information to obtain the target inquiry information, which can ensure that the rewritten target inquiry information has both intent information and context information, improving the efficiency of rewriting.
[0077] In an embodiment of the present disclosure, the inquiry statement rewriting method may further include the following steps: performing semantic evaluation on the target inquiry information; when the semantic evaluation result meets the preset requirements, using the target inquiry information to replace the original inquiry information.
[0078] In an embodiment of the present disclosure, performing semantic evaluation on the target inquiry information may include the following steps: obtaining evaluation factors, and the evaluation factors may include one or more of the following factors: whether there is a response information with a preset semantic feature in the target inquiry information, whether the number of response information with a preset semantic feature in the target inquiry information exceeds the first preset quantity threshold, whether the number of conversation information consistent with the theme of the original inquiry information in the target inquiry information is lower than the second preset quantity threshold, whether there is a grammar error in the target inquiry information; performing weighted scoring on the target inquiry information based on the evaluation factors to obtain the semantic evaluation result.
[0079] The target inquiry information with a preset semantic feature refers to that the target inquiry information includes words or combinations of multiple words that do not conform to normal conversation habits or common sense of life. For example, if the target inquiry information includes "Does this model of mobile phone have size L?" "Does this piece of clothing need to change the battery?" and so on, the target inquiry information has a preset semantic feature. The existence of a grammar error in the target inquiry information means that there is one or more typos in the target inquiry information, or there are words or combinations of multiple words in the target inquiry information that do not conform to normal grammar relationships. For example, if the target inquiry information includes "L Ma", "Lv Se" and so on, then there is a grammar error in the target inquiry information.
[0080] If the target inquiry information contains reply information with preset semantic features, the number of reply information with preset semantic features in the target inquiry information is large, or there are grammatical errors in the target inquiry information, the target inquiry information is difficult to be correctly understood. The difficulty of generating reply information corresponding to the target inquiry information is also increased accordingly. When the number of dialogue information with the same theme as the original inquiry information is small, the content expressed by the target inquiry information may not be consistent with the content expressed by the original inquiry information, and the target inquiry information cannot reflect the user's true intention. The reply information corresponding to the target inquiry information may not match the user's unique true intention. In this embodiment, by obtaining evaluation factors, weighted scoring is performed on the target inquiry information based on the evaluation factors to obtain a semantic evaluation result, so that when the semantic evaluation result meets the preset requirements, the target inquiry information is used to replace the original inquiry information, which can ensure that the target inquiry information can reflect the user's true intention and at the same time facilitate user understanding.
[0081] In one embodiment of the present disclosure, performing semantic evaluation on target inquiry information may include the following steps: extracting preset features of the target inquiry information, the preset features including one or more of the following features: reply sentences with preset semantic features in the inquiry information, the number of reply messages with preset semantic features in the inquiry information, the number of dialogue messages consistent with the subject of the inquiry information, and the grammatical components of the inquiry information; taking the target inquiry information and its preset features as input, and inputting them into a pre-trained semantic evaluation model to obtain a semantic evaluation result corresponding to the target inquiry information.
[0082] Among them, the semantic evaluation model can be a semantic evaluation model based on posterior probability. In this embodiment, a pre-trained semantic evaluation model is obtained, and the semantic evaluation model can be used to obtain a semantic evaluation result based on preset features of the target query information.
[0083] In this embodiment, the semantic evaluation result corresponding to the target query information is obtained by using the pre-trained semantic evaluation model. In practical applications, after sufficient learning and training, the reliability of the semantic evaluation result obtained based on the semantic evaluation model will be greatly increased.
[0084] In one embodiment of the present disclosure, performing semantic evaluation on target query information may further include the following steps: training a semantic evaluation model. Training a semantic evaluation model may include the following steps: determining an initial semantic evaluation model; obtaining training dialogue information and extracting preset features of the training dialogue information; using the training dialogue information and its preset features as input and the semantic evaluation result of the training dialogue information as output to train the initial semantic evaluation model to obtain a semantic evaluation model.
[0085] In this embodiment, when training the semantic evaluation model, first determine an initial semantic evaluation model, wherein the initial semantic evaluation model can be selected according to the needs of the actual application; then obtain the training dialogue information, and extract the preset features of the training dialogue information; use the training dialogue information and its preset features as input, and use the semantic evaluation results of the training dialogue information as output. Train the initial semantic evaluation model, and when the training results converge, the semantic evaluation model can be obtained. The learning and training of the above-mentioned semantic evaluation model can be implemented by using learning and training methods such as q-learning, DQN, PolicyGradient, DDPG, etc. The present disclosure does not specifically limit the specific learning and training implementation methods of the semantic evaluation model.
[0086] In one embodiment of the present disclosure, generating response information corresponding to original inquiry information based on target inquiry information may include the following steps: performing intent analysis on the target inquiry information to obtain the intent of the target inquiry information; obtaining response information with the same intent from a preset response database as the response information corresponding to the original inquiry information, wherein the preset response database stores the response information and its corresponding intent information.
[0087] The preset response database is pre-set, and the intention information in the preset response database may correspond to one or more response information, and multiple intention information may correspond to different response information or the same response information.
[0088] In this embodiment, the intent of the target inquiry information is firstly analyzed, and the intent of the target inquiry information is obtained. Then, the response information with the same intent is obtained from the preset response database as the response information corresponding to the original inquiry information, which can improve the accuracy of the response information of the original inquiry information obtained.
[0089] In an embodiment of the present disclosure, the following steps may also be included: obtaining original inquiry information from an interactive interface of a terminal, and outputting response information to the terminal to display the response information on the interactive interface.
[0090] The interactive interface of the terminal may be an interactive interface of an application (APP) running on the terminal, in which the user may input corresponding information, and the terminal may display corresponding response information for the information input by the user in the interactive interface to achieve interaction with the user. For example, the interactive interface may be an after-sales service interactive interface of a shopping application, or the interactive interface may be a chat interface of a chat software, etc.
[0091] In this implementation, by acquiring original inquiry information from an interactive interface of a terminal and outputting response information to the terminal to display the response information on the interactive interface, interaction with the user can be achieved, thereby improving the user experience.
[0092] In one embodiment of the present disclosure, the response information is text information or sound information. Displaying the response information on the interactive interface may include the following steps: displaying the response text information on the interactive interface, or converting the response information into a response voice information and playing the response voice information on the interactive interface.
[0093] The response information may be displayed in a specified position in the interactive interface, or may be displayed according to the position of the original inquiry information in the interactive interface. For example, the response information may be displayed below the original inquiry information in the interactive interface. The response voice information may be played directly in the interactive interface, or may be played in response to a trigger operation detected through the interactive interface.
[0094] In this embodiment, by displaying the response text information on the interactive interface, or converting the response information into response voice information and playing the response voice information on the interactive interface, the way of displaying the response information can be enriched, which is convenient for users to understand and improves the user experience.
[0095] Figure 2 The overall flow chart of the query statement rewriting method according to an embodiment of the present disclosure is shown as follows: Figure 2 As shown, the method comprises the following steps:
[0096] In step S201, original inquiry information is obtained from an interactive interface of a terminal.
[0097] In step S202, the original query information is analyzed for its intent to obtain the intent of the original query information.
[0098] In step S203, historical conversation information with the same intention is obtained.
[0099] In step S204, the conversation analysis model is trained.
[0100] In step S205, the historical conversation information is input as an input into a pre-trained conversation analysis model to obtain historical context information and historical intent information corresponding to the historical conversation information.
[0101] In step S206, the original query information is parsed.
[0102] In step S207, when it is determined that the original query information lacks context information, the historical context information is filled into the context information position in the original query information to obtain the target query information; and / or when it is determined that the original query information lacks intent information, the historical intent information is filled into the intent information position in the original query information to obtain the target query information.
[0103] In step S208, the target query information is analyzed for intent to obtain the intent of the target query information.
[0104] In step S209, response information having the same intention is obtained from a preset response database as response information corresponding to the original inquiry information.
[0105] In step S210, the response information is output to the terminal, the response text information is displayed on the interactive interface, or the response voice information converted from the response information is played on the interactive interface.
[0106] In step S211, evaluation factors are acquired.
[0107] In step S212, a weighted score is performed on the target query information based on the evaluation factors to obtain a semantic evaluation result.
[0108] In step S213, preset features of the target query information are extracted.
[0109] In step S214, a semantic evaluation model is trained.
[0110] In step S215, the target query information and its preset features are input into a pre-trained semantic evaluation model to obtain a semantic evaluation result corresponding to the target query information.
[0111] In step S216, when the semantic evaluation result meets the preset requirement, the target query information is used to replace the original query information.
[0112] The above query statement rewriting method can be used in a variety of application scenarios, such as machine dialogue scenarios, intelligent dialogue scenarios, human-computer dialogue scenarios, etc.
[0113] The following are embodiments of the apparatus of the present disclosure, which can be used to execute embodiments of the method of the present disclosure.
[0114] Figure 3 The structure block diagram of the query statement rewriting device according to one embodiment of the present disclosure is shown. The device can be implemented as part or all of the electronic device through software, hardware or a combination of both. Figure 3As shown, the query statement rewriting device includes: a dialogue acquisition module 301, configured to acquire historical dialogue information related to the original query information. A context intention acquisition module 302, configured to acquire historical context information and historical intention information based on the historical dialogue information. A query information rewriting module 303, configured to rewrite the original query information using the historical context information and the historical intention information to obtain the target query information. A response information generation module 304, configured to generate response information corresponding to the original query information based on the target query information.
[0115] The query statement rewriting device obtains historical context information and historical intention information based on historical dialogue information related to the original query information, and rewrites the original query information in combination with the historical context information and the historical intention information to obtain the target query information, so that the rewritten target query information has both the intention information and the context information. Combined with the intention information and the context information in the target query information, the target query information can reflect the user's unique true intention, so that the response information corresponding to the original query information generated based on the target query information can match the user's unique true intention, thereby improving the reliability of the intelligent question-answering system.
[0116] In one embodiment of the present disclosure, the query statement rewriting device may be applicable to a query statement rewriting party such as a computer, a computing device, an electronic device, a server, a service cluster, etc. that rewrites a query statement.
[0117] In one embodiment of the present disclosure, original query information refers to query information input by a user during a conversation, and the original query information may include one or more words.
[0118] In one embodiment of the present disclosure, the historical conversation information related to the original inquiry information refers to the conversation sentences adjacent to the original inquiry information in the conversation information to which the original inquiry information belongs, or may be the sentences in the conversation information to which the original inquiry information belongs, the number of conversation sentences of which is less than or equal to the conversation sentence number threshold. For example, when the original inquiry information is: "Can it arrive tomorrow?" and the conversation to which the original inquiry information belongs is: "CUST: Hello, are you there? STAFF: Hello, I'm here. CUST: What kind of express do you send for your oranges? STAFF: Hello, we send by SF Express. CUST: Can it arrive tomorrow?" (where CUST refers to the party who puts forward the inquiry information, and STAFF refers to the party who responds to the inquiry information), the historical conversation information related to the original inquiry information may be "Hello, we send by SF Express" or "What kind of express do you send for your oranges? Hello, we send by SF Express".
[0119] In one embodiment of the present disclosure, historical intent information refers to the purpose of the conversation to be achieved by the historical conversation information. Specifically, the historical intent information may include a conversation field and a conversation intent, wherein the conversation field may limit the scope of the conversation intent. For example, when the conversation field is logistics timeliness, the conversation intent may be "when can it be delivered", "how many days will it take to arrive", "how many days will it take to deliver", etc.; when the conversation field is the return policy, the conversation intent may be "can I return it if it doesn't fit", "can I return it if it doesn't fit", "can I return it if it's too big", "can I return it if it's too small", etc.
[0120] In one embodiment of the present disclosure, historical context information refers to the historical dialogue information that can be combined with the historical intent information to complete the key information missing in the historical dialogue information due to semantic simplification or semantic substitution. For example, when the original inquiry information is: "Can I return it if it doesn't fit?", the historical dialogue information is: "CUST: Do you still have XL size for the green T-shirt? STAFF: Hello, dear, the XL size is sold out. This one is a loose fit. Can you try the L size? CUST: Can I return it if it doesn't fit?", the sentence "Can I return it if it doesn't fit?" in the historical dialogue information lacks the key information "green T-shirt L size" due to semantic simplification, that is, the historical intent information is: "Can I return it if it doesn't fit?", and the historical context information is: "green T-shirt", "L size".
[0121] In one embodiment of the present disclosure, the target query information refers to the information obtained by filling the missing historical context information or historical intent information into the corresponding position in the original query information when any one of the context information and historical intent information is missing in the original query information. For example, when the original query information is: "How many days will it take to arrive", the original query information lacks the historical context information "SF Express", and the target query information can be obtained by rewriting the original query information as: "How many days will it take to arrive if sent by SF Express"; the original query information is: "What about the shirt in size L", the original query information lacks the intent information "Is it in stock", and the target query information can be obtained by rewriting the original query information as: "Is the shirt in size L in stock".
[0122] In one embodiment of the present disclosure, the response information corresponding to the original inquiry information refers to the information used to answer the original inquiry information, and the response information may include the information requested in the original inquiry information. For example, when the original inquiry information is "how many days will it take to arrive" and the target inquiry information is "how many days will it take for the shirt to arrive if it is sent by SF Express", the response information may be "Dear, it can be delivered in N days", where "N days" may be the number of days of express delivery obtained by querying the corresponding express delivery number.
[0123] The above-mentioned inquiry statement rewriting device can be used in various application scenarios, such as machine dialogue scenarios, intelligent dialogue scenarios, human-computer dialogue scenarios, etc.
[0124] In one embodiment of the present disclosure, the part of the conversation acquisition module 301 that acquires historical conversation information related to the original query information may be configured to: perform intent analysis on the original query information to obtain the intent of the original query information; and acquire historical conversation information with the same intent.
[0125] Intent analysis of original query information can be performed by combining various data processing methods such as structured, semi-structured, and unstructured data with various NLP (Natural Language Processing) technologies to identify the intent of the original query information. For example, intent analysis of event information can be performed based on natural language understanding technologies such as support vector machine (SVM), conditional random field (CRF), convolutional neural network (CNN), and recurrent neural network (RNN).
[0126] In this implementation, by performing intent analysis on the original query information to obtain the intent of the original query information, and obtaining historical conversation information with the same intent as the original query information, the historical intent information obtained based on the historical conversation information can be made the same as the intent of the original query information, ensuring that the intent embodied in the target query information obtained by rewriting the original query information using the historical context information and the historical intent information is the same as the intent of the original query information, that is, the user's only true intent, even if the intent embodied in the target query information is more accurate.
[0127] In one embodiment of the present disclosure, the part of the contextual intention acquisition module 302 that acquires historical context information and historical intention information based on historical conversation information can be configured as follows: the historical conversation information is taken as input into a pre-trained conversation analysis model to obtain historical context information and historical intention information corresponding to the historical conversation information.
[0128] The conversation analysis model may be a conversation analysis model based on posterior probability. In this embodiment, a pre-trained conversation analysis model is first obtained, and then the conversation analysis model is used to obtain historical context information and historical intention information based on historical conversation information. Specifically, the historical conversation information may be input into the pre-trained conversation analysis model to obtain multiple context information and intention information, as well as the probabilities corresponding to the historical context information and the historical intention information. Then, the context information and intention information with the highest probability are determined as the historical context information and the historical intention information.
[0129] In this embodiment, the historical context information and historical intention information corresponding to the historical dialogue information are obtained by using a pre-trained dialogue analysis model. In practical applications, after sufficient learning and training, the reliability of the historical context information and historical intention information obtained based on the dialogue analysis model will be greatly increased, so that the target query information rewritten based on them can more accurately reflect the user's unique true intention.
[0130] In one embodiment of the present disclosure, the query statement rewriting device may further include a model training module, and the model training module is configured to train a dialogue analysis model.
[0131] The part of the model training module that trains the conversation analysis model can be configured to: determine the initial conversation analysis model; obtain a conversation data set with consistent topics, wherein the conversation data set includes one or more conversation messages with consistent topics, and the conversation information includes inquiry information and corresponding reply information; use the conversation information in the conversation data set as input, and use the context information and intention information of the conversation information as output to train the initial behavior determination model to obtain the conversation analysis model.
[0132] In this embodiment, when training a conversation analysis model, an initial conversation analysis model is first determined, wherein the initial conversation analysis model can be selected according to the needs of the actual application. Then, a conversation data set with the same topic is obtained, the conversation information in the conversation data set is used as input, the context information and intention information of the conversation information are used as output, and the initial behavior determination model is trained. When the training results converge, the conversation analysis model can be obtained. The learning and training of the above conversation analysis model can be implemented by using learning and training devices such as q-learning, DQN, Policy Gradient, DDPG, etc., and the present disclosure does not specifically limit the specific learning and training implementation device of the conversation analysis model.
[0133] In an embodiment of the present disclosure, the query statement rewriting apparatus may further include a conversation filtering module, and the conversation filtering module may be configured to filter the conversation data set.
[0134] In one embodiment of the present disclosure, the part of the filtering module that filters the conversation data set is configured to: count the number of reply messages having preset semantic features in the conversation information of the conversation data set, and when the number of reply messages having preset semantic features exceeds a first preset number threshold, delete the conversation information; and / or count the number of inquiry messages and corresponding reply messages in the conversation information of the conversation data set, and when the number of inquiry messages and corresponding reply messages is lower than a second preset number threshold, delete the conversation information.
[0135] The reply information with preset semantic features refers to a preset word, multiple preset words, a combination of multiple preset words, or multiple preset words combined according to preset grammatical relations. For example, the reply information with preset semantic features can be: "Are you there?", "OK dear", "What's the matter?", etc. The reply information with preset semantic features does not represent the actual intention of the customer, and does not have any explanation or description of the actual intention of the customer. If there are too many reply information with preset semantic features in the dialogue information, training the initial dialogue analysis model based on the dialogue information will interfere with the training. In this embodiment, by counting the number of reply information with preset semantic features in the dialogue information of the dialogue data set, when the number of reply information with preset semantic features exceeds the first preset number threshold, deleting the dialogue information can avoid the dialogue information from interfering with the training of the initial dialogue analysis model, so as to improve the efficiency of training the initial dialogue analysis model.
[0136] Similarly, when the number of inquiry information and corresponding reply information in the dialogue information of the dialogue data set is small, the dialogue information may correspond to an interrupted dialogue or an incompletely recorded dialogue. The actual intention expressed by the customer in the uninterrupted dialogue or the fully recorded dialogue cannot be obtained based on the dialogue information. If the initial dialogue analysis model is trained based on the dialogue information, it will interfere with the training. In this embodiment, the number of inquiry information and corresponding reply information in the dialogue information of the dialogue data set is counted. When the number of inquiry information and corresponding reply information is lower than the second preset number threshold, the dialogue information is deleted to avoid the dialogue information from interfering with the training of the initial dialogue analysis model, so as to improve the efficiency of training the initial dialogue analysis model.
[0137] In one embodiment of the present disclosure, the portion of the query information rewriting module 303 that uses historical context information and historical intent information to rewrite the original query information to obtain target query information can be configured as: performing grammatical analysis on the original query information; when it is determined that the original query information lacks context information, filling the historical context information into the context information position in the original query information to obtain the target query information; and / or when it is determined that the original query information lacks intent information, filling the historical intent information into the intent information position in the original query information to obtain the target query information.
[0138] Considering that the original inquiry information usually lacks only one of the context information and the intent information, in order to minimize the amount of information to be rewritten in the original inquiry information, in this embodiment, first, grammatical analysis is performed on the original inquiry information; when it is determined that the original inquiry information lacks context information, the historical context information is filled into the context information position in the original inquiry information to obtain the target inquiry information; and / or when it is determined that the original inquiry information lacks intent information, the historical intent information is filled into the intent information position in the original inquiry information to obtain the target inquiry information, which can ensure that the rewritten target inquiry information has both intent information and context information, improving the efficiency of rewriting.
[0139] In an embodiment of the present disclosure, the inquiry statement rewriting device may further include a semantic evaluation module and an inquiry replacement module. The semantic evaluation module is configured to perform semantic evaluation on the target inquiry information, and the inquiry replacement module is configured to use the target inquiry information to replace the original inquiry information when the semantic evaluation result meets the preset requirements.
[0140] In an embodiment of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target inquiry information may be configured to: obtain evaluation factors, and the evaluation factors may include one or more of the following factors: whether there is a reply information with a preset semantic feature in the target inquiry information, whether the number of reply information with a preset semantic feature in the target inquiry information exceeds a first preset quantity threshold, whether the number of dialogue information consistent with the theme of the original inquiry information in the target inquiry information is lower than a second preset quantity threshold, whether there is a grammar error in the target inquiry information; perform weighted scoring on the target inquiry information based on the evaluation factors to obtain the semantic evaluation result.
[0141] The target inquiry information with a preset semantic feature refers to that the target inquiry information includes words or combinations of multiple words that do not conform to normal conversation habits or common sense of life. For example, if the target inquiry information includes "Does this model of mobile phone have an L size?" "Does this piece of clothing need to change the battery?" and so on, the target inquiry information has a preset semantic feature. The existence of a grammar error in the target inquiry information means that there is one or more typos in the target inquiry information, or there are words or combinations of multiple words that do not conform to normal grammar relations in the target inquiry information. For example, if the target inquiry information includes "L Ma", "Green Se" and so on, there is a grammar error in the target inquiry information.
[0142] If the target inquiry information contains reply information with preset semantic features, the number of reply information with preset semantic features in the target inquiry information is large, or there are grammatical errors in the target inquiry information, the target inquiry information is difficult to be correctly understood. The difficulty of generating the reply information corresponding to the target inquiry information is also increased accordingly. When the number of dialogue information with the same theme as the original inquiry information is small, the content expressed by the target inquiry information may not be consistent with the content expressed by the original inquiry information, the target inquiry information cannot reflect the user's true intention, and the reply information corresponding to the target inquiry information may not match the user's only true intention. In this embodiment, by obtaining the evaluation factors, the target inquiry information is weighted and scored based on the evaluation factors to obtain the semantic evaluation results, so that when the semantic evaluation results meet the preset requirements, the target inquiry information is used to replace the original inquiry information, which can ensure that the target inquiry information can reflect the user's true intention, and the difficulty of generating the corresponding reply information according to the target inquiry information is low.
[0143] In one embodiment of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target inquiry information can be configured as follows: extracting preset features of the target inquiry information, the preset features including one or more of the following features: reply sentences with preset semantic features in the inquiry information, the number of reply messages with preset semantic features in the inquiry information, the number of dialogue messages consistent with the topic of the inquiry information, and the grammatical components of the inquiry information; taking the target inquiry information and its preset features as input, inputting them into a pre-trained semantic evaluation model, and obtaining a semantic evaluation result corresponding to the target inquiry information.
[0144] Among them, the semantic evaluation model can be a semantic evaluation model based on posterior probability. In this embodiment, a pre-trained semantic evaluation model can be obtained first, and then the semantic evaluation model can be used to obtain the semantic evaluation result based on the preset features of the target query information.
[0145] In this embodiment, the semantic evaluation result corresponding to the target query information is obtained by using the pre-trained semantic evaluation model. In practical applications, after sufficient learning and training, the reliability of the semantic evaluation result obtained based on the semantic evaluation model will be greatly increased.
[0146] In one embodiment of the present disclosure, the part of the semantic evaluation module that performs semantic evaluation on the target query information is further configured to: train a semantic evaluation model.
[0147] The part of the semantic evaluation module that trains the semantic evaluation model is configured as follows: determining an initial semantic evaluation model; obtaining training dialogue information and extracting preset features of the training dialogue information; taking the training dialogue information and its preset features as input and the semantic evaluation results of the training dialogue information as output to train the initial semantic evaluation model and obtain a semantic evaluation model.
[0148] In this embodiment, when training the semantic evaluation model, first determine an initial semantic evaluation model, wherein the initial semantic evaluation model can be selected according to the needs of the actual application; then obtain the training dialogue information, and extract the preset features of the training dialogue information; use the training dialogue information and its preset features as input, and use the semantic evaluation results of the training dialogue information as output. Train the initial semantic evaluation model, and when the training results converge, the semantic evaluation model can be obtained. The learning and training of the above-mentioned semantic evaluation model can be implemented using learning and training devices such as q-learning, DQN, PolicyGradient, DDPG, etc. The present disclosure does not specifically limit the specific learning and training implementation device of the semantic evaluation model.
[0149] In one embodiment of the present disclosure, the part of the response information generation module 304 that generates response information corresponding to the original inquiry information based on the target inquiry information is configured to: perform intent analysis on the target inquiry information to obtain the intent of the target inquiry information; obtain response information with the same intent from a preset response database as the response information corresponding to the original inquiry information, wherein the preset response database stores the response information and its corresponding intent information.
[0150] The preset response database is pre-set, and the intention information in the preset response database may correspond to one or more response information, and multiple intention information may correspond to different response information or the same response information.
[0151] In this embodiment, the intent of the target inquiry information is firstly analyzed, and the intent of the target inquiry information is obtained. Then, the response information with the same intent is obtained from the preset response database as the response information corresponding to the original inquiry information, which can improve the accuracy of the response information of the original inquiry information obtained.
[0152] In one embodiment of the present disclosure, the query statement rewriting device may also include: an interface query acquisition module and an interface response output module, the interface query acquisition module is configured to acquire original query information from an interactive interface of a terminal, and the interface response output module is configured to output response information to the terminal to display the response information on the interactive interface.
[0153] The interactive interface of the terminal may be an interactive interface of an application (APP) running on the terminal, in which the user may input corresponding information, and the terminal may display corresponding response information for the information input by the user in the interactive interface to achieve interaction with the user. For example, the interactive interface may be an after-sales service interactive interface of a shopping application, or the interactive interface may be a chat interface of a chat software, etc.
[0154] In this implementation, by acquiring original inquiry information from an interactive interface of a terminal and outputting response information to the terminal to display the response information on the interactive interface, interaction with the user can be achieved, thereby improving the user experience.
[0155] In one embodiment of the present disclosure, the response information is text information or sound information. The part of the interface response output module that displays the response information on the interactive interface can be configured to: display the response text information on the interactive interface, or convert the response information into a response voice information and play the response voice information on the interactive interface.
[0156] Displaying the response information on the interactive interface may be displaying the response information at a specified position in the interactive interface, or displaying the response information according to the position of the original inquiry information in the interactive interface. For example, the response information may be displayed below the original inquiry information in the interactive interface. Playing the response voice information on the interactive interface may be playing the response voice information directly on the interactive interface, or playing the response voice information in response to a trigger operation detected through the interactive interface.
[0157] In this embodiment, by displaying the response text information on the interactive interface, or converting the response information into response voice information, and playing the response voice information on the interactive interface, the way of displaying the response information can be enriched, which is convenient for users to understand and improves the user experience.
[0158] The above-mentioned inquiry statement rewriting device can be used in various application scenarios, such as machine dialogue scenarios, intelligent dialogue scenarios, human-computer dialogue scenarios, etc.
[0159] The present disclosure also discloses an electronic device, Figure 4 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown as follows: Figure 4 As shown, the electronic device 400 includes a memory 401 and a processor 402; wherein the memory 401 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 402 to implement the above method steps.
[0160] Figure 5 Schematic diagram of the structure of a computer system embodiment suitable for implementing the query statement rewriting method disclosed in the present invention. Figure 5As shown, the computer system 500 includes a processing unit 501, which can perform various processes in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The processing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0161] The following components are connected to the I / O interface 505: an input part 506 including a keyboard, a mouse, etc.; an output part 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part 508 including a hard disk, etc.; and a communication part 509 including a network interface card such as a LAN card, a modem, etc. The communication part 509 performs communication processing via a network such as the Internet. The drive 510 is also connected to the I / O interface 505 as needed. Removable media 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive 510 as needed, so that the computer program read therefrom is installed into the storage part 508 as needed. Among them, the processing unit 501 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, an NPU, etc.
[0162] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the road map or block diagram can represent a part of a module, program segment or code, and the part of the module, program segment or code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a different order from the order marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0163] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0164] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the device described in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into the device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0165] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A query statement rewriting method, applicable to machine / intelligent / human-machine dialogue services, comprising: Obtain historical conversation information related to the original inquiry information; Inputting the historical conversation information into a target conversation analysis model to obtain historical context information and historical intention information corresponding to the historical conversation information; The target conversation analysis model is a conversation analysis model obtained by pre-training, and the training process of the target conversation analysis model includes: determining an initial conversation analysis model, training the initial conversation analysis model according to conversation information in a filtered conversation data set to obtain a training result, and obtaining the target conversation analysis model in response to convergence of the training result, wherein the filtered conversation data set is obtained by filtering conversation data sets with consistent topics, and the historical context information is key information in the historical conversation information combined with the historical intent information to supplement the missing information in the historical conversation information due to semantic simplification or semantic substitution; Rewriting the original query information using the historical context information and the historical intent information to obtain target query information; generating response information corresponding to the original query information based on the target query information; Acquiring evaluation factors, wherein the evaluation factors may include multiple factors of the following: whether there is reply information with preset semantic features in the target inquiry information, whether the number of reply information with preset semantic features in the target inquiry information exceeds a first preset number threshold, whether the number of dialogue information in the target inquiry information that is consistent with the subject of the original inquiry information is lower than a second preset number threshold, and whether there is a grammatical error in the target inquiry information, wherein the preset semantic features at least include failure to conform to normal dialogue habits or common sense; Performing a weighted score on the target query information based on the evaluation factors to obtain a semantic evaluation result; When the semantic evaluation result meets the preset requirement, the target query information is used to replace the original query information.
2. According to the method of claim 1, the step of obtaining historical conversation information related to the original inquiry information comprises: Performing intent analysis on the original inquiry information to obtain the intent of the original inquiry information; Get the history conversation information of the same intent.
3. The method according to claim 1, wherein the step of rewriting the original query information using the historical context information and the historical intent information to obtain the target query information comprises: Performing grammatical analysis on the original query information; When it is determined that the original query information lacks context information, filling the historical context information into the context information position in the original query information to obtain target query information; and / or When it is determined that the original query information lacks intent information, the historical intent information is filled into the intent information position in the original query information to obtain the target query information.
4. The method according to claim 1, wherein the semantic evaluation of the target query information comprises: Extracting preset features of the target inquiry information, wherein the preset features include one or more of the following features: reply sentences with preset semantic features in the target inquiry information, the number of reply messages with preset semantic features in the target inquiry information, the number of dialogue messages in the target inquiry information that are consistent with the subject of the original inquiry information, and the grammatical components of the target inquiry information; The target query information and its preset features are used as input and input into a pre-trained semantic evaluation model to obtain a semantic evaluation result corresponding to the target query information.
5. The method according to any one of claims 1 to 4, further comprising: Obtaining original inquiry information from an interactive interface of a terminal; and The response information is output to the terminal so as to display the response information on the interactive interface.
6. The method according to claim 5, wherein the response information is a text message or a voice message; The displaying the response information on the interactive interface includes: Displaying the text information on the interactive interface, or, The response information is converted into response voice information, and the response voice information is played on the interactive interface.
7. A query statement rewriting device, comprising: A dialogue acquisition module, configured to acquire historical dialogue information related to the original inquiry information; a contextual intention acquisition module, configured to input the historical dialogue information into a target dialogue analysis model to obtain historical context information and historical intention information corresponding to the historical dialogue information, wherein the target dialogue analysis model is a dialogue analysis model obtained by pre-training, and the training process of the target dialogue analysis model includes: determining an initial dialogue analysis model, training the initial dialogue analysis model according to dialogue information in a filtered dialogue data set to obtain a training result, and obtaining the target dialogue analysis model in response to convergence of the training result, wherein the filtered dialogue data set is obtained by filtering a dialogue data set with consistent topics, and the historical context information is key information in the historical dialogue information combined with the historical intention information to supplement the missing information in the historical dialogue information due to semantic simplification or semantic substitution; A query information rewriting module, configured to rewrite the original query information using the historical context information and the historical intent information to obtain target query information; A response information generating module, configured to generate response information corresponding to the original inquiry information based on the target inquiry information; The semantic evaluation module is configured to obtain evaluation factors, wherein the evaluation factors may include multiple factors of the following: whether there is reply information with preset semantic features in the target inquiry information, whether the number of reply information with preset semantic features in the target inquiry information exceeds a first preset number threshold, whether the number of dialogue information in the target inquiry information that is consistent with the subject of the original inquiry information is lower than a second preset number threshold, and whether there is a grammatical error in the target inquiry information, wherein the preset semantic features at least include failure to conform to normal dialogue habits or common sense; weighted scoring is performed on the target inquiry information based on the evaluation factors to obtain a semantic evaluation result; The indirect replacement module is configured to replace the original query information with the target query information when the semantic evaluation result meets the preset requirement.
8. The device according to claim 7, wherein the part of the conversation acquisition module that acquires the historical conversation information related to the original inquiry information is configured as follows: Performing intent analysis on the original inquiry information to obtain the intent of the original inquiry information; Get the historical conversation information with the same intent.
9. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the computer instructions are executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
10. A computer program product comprising a computer program / instructions, wherein: When the computer program / instructions are executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
