A method and device for generating speech
By integrating the semantic information vector generation model and greeting trigger prediction model into the smart speaker, processing the customer's service demand text and generating greeting voice that meets customer needs, the problem of how hotels can improve service quality is solved, and the customer experience is improved and the hotel image is enhanced.
Patent Information
- Application Number
- CN202110238618.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-04
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2041-03-04
AI Technical Summary
Hotels are faced with the challenge of providing better services through smart speakers to enhance their image and reputation.
By integrating the semantic information vector generation model and greeting trigger prediction model into the smart speaker, the customer's service demand text is processed and a greeting voice that meets the customer's needs is generated.
Improve customer experience and enhance hotel image and reputation.
Smart Images

Figure CN112926338B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more particularly to a speech generation method and device. Background Art
[0002] With the continuous development of science and technology, smart facilities including smart speakers have gradually been widely used in various industries. In recent years, the number of domestic hotels has increased sharply, facing severe industry competition pressure.
[0003] As hotels face severe competition in the industry, how to use smart speakers to provide better services to guests and thus enhance the hotel's image and reputation is an urgent issue that needs to be addressed. Summary of the Invention
[0004] In view of this, the present invention provides a voice generation method and device, so as to provide hotel guests with better services by using smart speakers, thereby improving the hotel's image and reputation.
[0005] A first aspect of the present invention discloses a speech generation method, which is applied to a smart speaker. The method comprises:
[0006] Obtaining a current customer service request text sent by the customer, and extracting customer demand semantic information from the current customer service request text;
[0007] Inputting the customer demand semantic information into a semantic information vector generation model, and processing the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector, wherein the semantic information vector generation model is obtained by training an LSTM neural network using historical customer demand service texts;
[0008] Inputting a concatenation result of the customer demand semantic information vector and the pre-constructed greeting semantic vector into a greeting trigger prediction model, and using the greeting trigger prediction model to predict a greeting trigger probability on the concatenation result to obtain a greeting trigger probability, wherein the greeting trigger prediction model is obtained by training the LSTM neural network using the customer demand semantic information vector of the historical customer demand service text and the pre-constructed greeting semantic vector;
[0009] If the greeting trigger probability is greater than a preset greeting trigger threshold, a greeting text is generated according to the customer demand semantic information vector and the pre-constructed greeting semantic vector, and the greeting text is converted into a greeting voice.
[0010] Optionally, extracting customer demand semantic information from the current customer demand service text includes:
[0011] Performing word segmentation processing on the current customer service demand text to obtain words and sentences of the current customer service demand text;
[0012] Vectorize the words and sentences in the current customer service text to obtain customer service semantic information.
[0013] Optionally, generating a greeting text according to the customer demand semantic information vector and the pre-built greeting semantic vector includes:
[0014] Calculating a first similarity between the customer demand semantic information vector and each hotel semantic information vector in a pre-constructed hotel semantic information vector library, where the pre-constructed hotel semantic information vector library is obtained by concatenating a plurality of the hotel semantic information vectors;
[0015] Calculating a second similarity between the customer demand semantic information vector and each environmental semantic information vector in a pre-constructed environmental semantic information vector library, where the pre-constructed environmental semantic information vector library is obtained by splicing a plurality of the environmental semantic information vectors;
[0016] If a target first similarity greater than a first threshold exists among the first similarities, and none of the second similarities is greater than a second threshold, generating a greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, and the pre-constructed greeting semantic vector;
[0017] If a target second similarity exists among the second similarities that is greater than the second threshold, and none of the first similarities is greater than the first threshold, generating a greeting text based on the customer demand semantic information vector, the environment semantic information vector library, and the pre-constructed greeting semantic vector;
[0018] If a target first similarity exists among each of the first similarities that is greater than a first threshold, and if a target second similarity exists among each of the second similarities that is greater than the second threshold, a greeting text is generated based on the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-constructed greeting semantic vector.
[0019] Optionally, generating a greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector includes:
[0020] splicing the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector to obtain a first splicing result;
[0021] Inputting the first splicing result into a greeting speech generation model, processing the first splicing result using the greeting text generation model, and outputting a greeting text;
[0022] The greeting text generation model is obtained by training a seq2seq model based on LSTM using the historical customer service text and the historical greeting text corresponding to the historical customer service text.
[0023] Optionally, generating a greeting text according to the customer demand semantic information vector, the environment semantic information vector library, and the pre-built greeting semantic vector includes:
[0024] splicing the customer demand semantic information vector, the pre-constructed environment semantic information vector library, and the pre-constructed greeting semantic vector to obtain a second splicing result;
[0025] The second splicing result is input into the greeting text generation model, and the second splicing result is processed by the greeting text generation model to output a greeting text.
[0026] Optionally, generating a greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-built greeting semantic vector includes:
[0027] splicing the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-constructed greeting semantic vector to obtain a third splicing result;
[0028] The third splicing result is input into the greeting text generation model, and the third splicing result is processed by the greeting text generation model to output a greeting text.
[0029] Optionally, the process of pre-building the greeting semantic vector includes:
[0030] Get multiple historical greeting type texts and the most recent historical greeting text;
[0031] Extracting historical semantic information of each of the historical greeting type texts and semantic information of the historical greeting texts;
[0032] Inputting a plurality of the historical greeting type texts and the semantic information of the historical greeting texts into the semantic information vector generation model, and using the semantic information vector generation model to process the semantic information of each of the historical greeting type texts and the historical greeting texts, respectively, to obtain a semantic vector for each of the historical greeting type texts and the semantic vector for the historical greeting texts;
[0033] The semantic vectors of the plurality of historical greeting type texts and the semantic vector of the historical greeting text are concatenated to obtain the greeting semantic vector.
[0034] Optionally, the process of pre-building the hotel semantic information vector library includes:
[0035] Acquire the plurality of pre-set hotel information and extract hotel semantic information from each piece of the hotel information;
[0036] Inputting a plurality of hotel semantic information into the semantic information vector generation model, and using the semantic information vector generation model to process each piece of the hotel semantic information respectively to obtain a hotel semantic information vector for each piece of the hotel semantic information;
[0037] Each of the hotel semantic information vectors is spliced together to obtain a hotel semantic information vector library.
[0038] Optionally, the process of pre-building the environmental semantic information vector library includes:
[0039] Acquire current environment information related to each preset environment greeting type, and extract environment semantic information of the current environment information of each environment greeting type;
[0040] Inputting each piece of the environmental semantic information into the semantic information vector generation model to obtain an environmental semantic information vector for each piece of the environmental semantic information;
[0041] Each environmental semantic information vector is spliced together to obtain an environmental semantic information vector library.
[0042] A second aspect of the present invention discloses a speech generation device, which is applied to a smart speaker. The device includes:
[0043] A first acquiring unit is configured to acquire a current customer service demand text sent by a customer and extract customer demand semantic information from the current customer service demand text;
[0044] a first processing unit, configured to input the customer demand semantic information into a semantic information vector generation model, and process the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector, wherein the semantic information vector generation model is obtained by training an LSTM neural network using historical customer demand service texts;
[0045] a greeting trigger probability prediction unit, configured to input a concatenation result of the customer demand semantic information vector and a pre-constructed greeting semantic vector into a greeting trigger model, and use the greeting trigger prediction model to predict the greeting trigger probability of the concatenation result to obtain a greeting trigger probability, wherein the greeting trigger prediction model is obtained by training the LSTM neural network using the customer demand semantic information vector of the historical customer demand service text and the pre-constructed greeting semantic vector;
[0046] The first generating unit is configured to generate a greeting text according to the customer demand semantic information vector and the pre-built greeting semantic vector if the greeting trigger probability is greater than a preset greeting trigger threshold, and convert the greeting text into a greeting voice.
[0047] The present invention provides a speech generation method and device, which are applied to a smart speaker. A semantic information vector generation model and a greeting trigger prediction model are pre-integrated in the smart speaker. After obtaining a current customer service request greeting sent by a customer, customer demand semantic information extracted from the current customer service request text is input into the semantic information vector generation model. The semantic information vector generation model processes the input customer demand semantic information and outputs a customer demand semantic information vector. The customer demand semantic information vector and a pre-constructed greeting semantic vector are then concatenated and input into a greeting trigger prediction model. The greeting trigger prediction model predicts a greeting trigger probability based on the input concatenation result and outputs a greeting trigger probability. When the greeting trigger probability is greater than a preset greeting trigger threshold, the greeting text is generated based on the customer demand semantic information vector and the pre-constructed greeting semantic vector. The greeting text is converted into a greeting voice, and a greeting is initiated to the customer based on the converted greeting voice. The technical solution provided by the present invention can generate a greeting voice that meets customer needs based on the customer service request text sent by the customer, thereby improving the customer experience and thereby enhancing the hotel's image and reputation. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0049] Figure 1 A flowchart of a speech generation method provided by an embodiment of the present invention;
[0050] Figure 2 A flowchart of a method for generating a greeting text based on a customer demand semantic information vector and a pre-built greeting semantic vector provided by an embodiment of the present invention;
[0051] Figure 3 A schematic structural diagram of a speech generation device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0053] In this application, the terms "comprises," "comprising," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0054] See also Figure 1 , shows a flow chart of a speech generation method provided by an embodiment of the present invention, the speech generation method is applied to a smart speaker, and the speech generation method specifically includes the following steps:
[0055] S101: Acquire a current customer service demand text sent by a customer, and extract customer demand semantic information from the current customer service demand text.
[0056] During the specific execution of step S101, the customer can speak to the smart speaker or click on the customer service record text pre-set on the smart speaker to send the current customer service text to the smart speaker. After obtaining the current customer service text sent by the customer, the smart speaker performs word segmentation processing on the obtained current customer service text to obtain the words and sentences of the current customer service text, and vectorizes the words and sentences of the current customer service text to obtain the customer semantic information of the current customer service text.
[0057] In the embodiment of the present application, a dictionary based on the maximum matching word segmentation method can be used to segment the obtained current customer service text, and the words and sentences of the current customer service text can be {w1, w2, ..., w max}, where w is a word in the current customer service text, and max represents the maximum length of the current customer service text. The dictionary based on the maximum matching word segmentation method is trained using 100,000 manually annotated customer reviews of hotels.
[0058] Each word w in the obtained sentence of the current customer service text is mapped into a low-dimensional continuous vector of customer semantic information. Specifically, the word {w1, w2, ..., w max}, and the customer semantic information of the low-dimensional continuous vector is {d w1 , d w2 ,...,d wmax}, where the Word2Vec model is a conversion tool that can convert words into vector form.
[0059] It should be noted that the current service request text may be "Please ask the waiter to come up to check out for me", or "How is the weather today", or "Where can I eat breakfast in the hotel".
[0060] S102: Inputting the customer demand semantic information into a semantic information vector generation model, and processing the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector.
[0061] In step S102, the customer service texts sent by guests who have previously stayed at the hotel using smart speakers are collected, and the collected customer service texts are used as historical customer service texts. The historical customer demand semantic information of the historical customer service texts is extracted, and the extracted historical customer demand semantic information is input into the LSTM neural network to be trained, so that the LSTM neural network to be trained processes the input historical customer demand semantic information, and the target historical customer demand semantic information vector of the historical customer demand semantic information is close to the obtained historical customer demand semantic information vector as the training target. The LSTM neural network to be trained is trained until the LSTM neural network to be trained converges to obtain a semantic information vector generation model. Among them, the method of extracting the historical customer demand semantic information of the historical customer demand service text is the same as the method of extracting the customer demand semantic information of the current customer demand service text in step S101. Please refer to the corresponding part in step S101 and will not be repeated here.
[0062] During the specific execution of step S102, after obtaining the customer demand semantic information of the current customer demand service text, the obtained customer demand semantic information can be input into the semantic information vector generation model so that the semantic information vector generation model processes the input customer demand semantic information to obtain a customer demand semantic information vector.
[0063] S103: Inputting the concatenation result of the customer demand semantic information vector and the pre-constructed greeting semantic vector into the greeting trigger prediction model, and using the greeting trigger prediction model to predict the greeting trigger probability of the concatenation result to obtain the greeting trigger probability.
[0064] In step S103, multiple historical greeting texts initiated by the smart speaker during the previous guest's stay in the hotel are collected. The hotel technicians can summarize the collected multiple historical greeting texts to obtain multiple historical greeting type texts. The multiple historical greeting type texts and the most recent historical greeting texts are obtained, and the semantic information of each historical greeting type text and the most recent historical greeting text is extracted as {greet1, greet2, ..., greet s}. Among them, {greet1, greet2, ..., greet s-1} are the semantic information of each historical greeting type text, {greet s} is the semantic information of the most recent historical greeting text. The method for extracting the semantic information of the historical greeting type text and the semantic information of the most recent historical greeting text is the same as the method for extracting the customer demand semantic information of the current customer service demand text in step S101. Please refer to the corresponding part in step S101 and will not be repeated here.
[0065] Each historical greeting type text and the semantic information of the most recent historical greeting text {greet1, greet2, ..., greet s} Input semantic information vector generation model so that semantic information vector generation model can generate semantic information {greet1, greet2, ..., greet} of each historical greeting type text and the most recent historical greeting text respectively. s} to perform semantic vector encoding and obtain the hidden state {h1, h2, ..., h} of each historical greeting type text and the most recent historical greeting text at the current moment. s}.
[0066] For each historical greeting type text and the most recent historical greeting text, the weight of the semantic information of the historical greeting type text and the hidden state at the current moment is calculated, and the weight of the semantic information of the most recent historical greeting text and the hidden state at the current moment is calculated, so as to calculate the context information of the historical greeting type text at the current moment based on the weight of the historical greeting type text, calculate the context information of the historical greeting text at the current moment based on the weight of the most recent historical greeting text, and decode the context information and semantic information of the historical greeting type text to obtain a semantic vector for the historical greeting type text. Also, decode the context information and semantic information of the most recent historical greeting text to obtain a semantic vector for the most recent historical greeting text.
[0067] The semantic vector of each historical greeting type text is concatenated with the semantic vector of the most recent historical greeting text to obtain a greeting semantic vector.
[0068] The method for calculating the weight of the semantic information of the historical greeting type text and the hidden state at the current moment is shown in formula (1), and the method for calculating the context information of the historical greeting type text at the current moment based on the weight of the historical greeting type text is shown in formula (2).
[0069]
[0070]
[0071] in, is the semantic information of the historical greeting type text and the weight of the hidden state at the current moment, c t is the context information of the historical greeting type text at the current moment, dot represents the dot, and d(h) represents the dimension of the hidden state of the historical greeting type text at the current moment.
[0072] It should be noted that the method for calculating the weight of the semantic information of the most recent historical greeting text and the current hidden state is the same as the method for calculating the weight of the semantic information of the historical greeting type text and the current hidden state. The method for calculating the context information of the most recent historical greeting text at the current moment is the same as the method for calculating the context information of the historical greeting type text at the current moment, and will not be repeated here.
[0073] It should be noted that the greeting type can be weather forecast, traffic reminder, check-out service, breakfast service, etc. Among them, weather forecast and traffic reminder are environmental greeting types; historical greeting type text can be "The weather is sunny today" or "The restaurant is on the 3rd floor."
[0074] In step S103, a historical customer demand service text is obtained, and historical customer demand semantic information of the historical customer demand service text is extracted. The extracted historical customer demand semantic information is input into a semantic information vector generation model, and the input historical customer demand semantic information is processed using the semantic information vector generation model to obtain a historical customer demand semantic information vector; the historical customer demand semantic information vector is spliced with a pre-constructed greeting semantic vector, and the splicing result is input into an LSTM neural network to be trained, so that the LSTM neural network to be trained predicts the greeting trigger probability according to the input splicing result, and the training goal is that the obtained greeting trigger probability approaches the target greeting trigger probability, and the LSTM neural network to be trained is trained until the LSTM neural network to be trained converges to obtain a greeting trigger prediction model.
[0075] In the specific process of executing step S103, after the customer demand semantic information is processed using the semantic information vector generation model to obtain the customer demand semantic information vector, the obtained customer demand semantic information vector is spliced with the pre-constructed greeting semantic vector, and the splicing result of the customer demand semantic information vector and the pre-constructed greeting semantic vector is input into the greeting trigger prediction model, so that the greeting trigger prediction model predicts the greeting probability based on the splicing result of the input customer demand semantic information vector and the pre-constructed greeting semantic vector to obtain the greeting trigger probability.
[0076] S104: If the greeting trigger probability is greater than a preset greeting trigger threshold, a greeting text is generated according to the customer demand semantic information vector and the pre-constructed greeting semantic vector, and the greeting text is converted into a greeting voice.
[0077] During the specific execution of step S104, a greeting trigger threshold is pre-set. After the greeting trigger prediction model is used to predict the greeting probability based on the concatenation result of the input customer demand semantic information vector and the pre-constructed greeting semantic vector, a judgment is made as to whether the obtained greeting trigger probability is greater than the pre-set greeting trigger threshold. If the greeting trigger probability is greater than the pre-set greeting trigger threshold, a greeting text is generated based on the customer demand semantic information vector and the pre-constructed greeting semantic vector, and the generated greeting text is converted into a greeting voice. If the greeting trigger probability is not greater than the pre-set greeting trigger threshold, it can be considered that the current customer demand service text sent by the customer does not meet the greeting condition, and the current process ends.
[0078] The present invention provides a speech generation method, which is applied to a smart speaker. A semantic information vector generation model and a greeting trigger prediction model are pre-integrated in the smart speaker. After obtaining a current customer service request text sent by a customer, customer demand semantic information extracted from the current customer service request text is input into the semantic information vector generation model. The semantic information vector generation model processes the input customer demand semantic information and outputs a customer demand semantic information vector. The customer demand semantic information vector and a pre-constructed greeting semantic vector are then concatenated into a greeting trigger prediction model. The greeting trigger prediction model predicts a greeting trigger probability based on the input concatenation result and outputs a greeting trigger probability. When the greeting trigger probability is greater than a preset greeting trigger threshold, a greeting text is generated based on the customer demand semantic information vector and the pre-constructed greeting semantic vector. The greeting text is converted into a greeting voice, and a greeting is initiated to the customer based on the converted greeting voice. The technical solution provided by the present invention can generate a greeting voice that meets customer needs based on the customer service request text sent by the customer, thereby improving the customer experience and thereby enhancing the hotel's image and reputation.
[0079] Based on the speech generation method shown above, step S104 is executed to generate a greeting text according to the customer demand semantic information vector and the pre-built greeting semantic vector, as shown in FIG. Figure 2 As shown, the specific steps include:
[0080] S201: Calculating a first similarity between a customer demand semantic information vector and each hotel semantic information vector in a pre-built hotel semantic information vector library.
[0081] In step S201, a hotel knowledge base is pre-set, and the pre-set hotel knowledge base includes n pieces of hotel information. The n pieces of hotel information included in the pre-set hotel knowledge base can be represented as {Knowledge1, Knowledge2, ..., Knowledge n Each piece of hotel information can be represented as {i, j, r}, which means that entity i has relationship r with entity j. For example, if entity i can be a restaurant and j can be the 3rd floor, then r means that the restaurant is located on the 3rd floor. Where n is greater than 1.
[0082] For each piece of hotel information, the hotel semantic information of the hotel information is extracted. Specifically, the hotel information is segmented using a dictionary based on the maximum matching segmentation method. The words and sentences of the hotel information can be expressed as The Word2Vec model is used to represent each word in the sentence of the hotel information to obtain the hotel semantic information of the hotel information.
[0083] Input multiple hotel semantic information into the semantic information vector generation model so that the semantic information vector generation model processes each hotel semantic information separately to obtain the hotel semantic information vector k of each hotel semantic information; splice multiple hotel semantic information vectors to obtain the hotel semantic information vector library K = {k1, k2, ..., k n}.
[0084] In the specific process of executing step S201, the similarity between the customer demand semantic information vector and each hotel semantic information vector in the pre-built hotel semantic information vector library is calculated respectively (for the convenience of distinction, the similarity between the customer demand semantic information vector and the hotel semantic information vector is called the first similarity). For example, the first similarity between the customer demand semantic information vector and the hotel semantic information vector k1 in the pre-built hotel semantic information vector library is calculated, and the first similarity between the customer demand semantic information vector and the hotel semantic information vector k2 in the pre-built hotel semantic information vector library is calculated, ..., the first similarity between the customer demand semantic information vector and the hotel semantic information vector k in the pre-built hotel semantic information vector library is calculated. n The first similarity.
[0085] S202: Calculate a second similarity between the customer demand semantic information vector and each environmental semantic information vector in a pre-built environmental semantic information vector library.
[0086] In step S202, multiple environmental greeting types supported by the hotel can be determined based on multiple historical greeting type texts summarized by the hotel's technical staff, and current environmental information related to each environmental greeting type can be obtained.
[0087] For each piece of current environmental information, the environmental semantic information of the current environmental information is extracted. Specifically, the current environmental information is segmented using a dictionary based on the maximum matching segmentation method, and the words and sentences of the current environmental information can be represented as {m1, m2, ..., m max}, use the Word2Vec model to represent each word in the sentence of the current environmental information to obtain the hotel semantic information of the current environmental information.
[0088] Multiple pieces of environmental semantic information are input into the semantic information vector generation model so that the semantic information vector generation model processes each piece of environmental semantic information separately to obtain each environmental semantic information vector o; multiple environmental semantic information vectors are spliced to obtain an environmental semantic information vector library O = {o1, o2, ..., o n}.
[0089] In the specific process of executing step S202, the similarity between the customer demand semantic information vector and each environmental semantic information vector in the pre-built environmental semantic information vector library is calculated respectively (for the convenience of distinction, the similarity between the customer demand semantic information vector and the environmental semantic information vector is referred to as the second similarity). For example, the second similarity between the customer demand semantic information vector and the environmental semantic information vector o1 in the pre-built environmental semantic information vector library is calculated, the second similarity between the customer demand semantic information vector and the environmental semantic information vector o2 in the pre-built environmental semantic information vector library is calculated, ..., the second similarity between the customer demand semantic information vector and the environmental semantic information vector o3 in the pre-built environmental semantic information vector library is calculated. n The first similarity.
[0090] S203: If a target first similarity greater than a first threshold exists among the first similarities, and all second similarities are not greater than a second threshold, a greeting text is generated according to the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector.
[0091] In step S203, a first threshold and a second threshold are pre-set, and each calculated first similarity is compared with the first similarity, and each calculated second similarity is compared with the second similarity. If a target first similarity greater than the first threshold exists among the first similarities, it can be considered that the current customer service text sent by the customer is related to the hotel; if no target first similarity greater than the first threshold exists among the first similarities, it can be considered that the current customer service text sent by the customer is not related to the hotel; if a target second similarity greater than the second threshold exists among the second similarities, it can be considered that the current customer service text sent by the customer is related to the environment; if no target second similarity greater than the second threshold exists among the second similarities, it can be considered that the current customer service text sent by the customer is not related to the environment.
[0092] During step S203, the historical customer demand service text and the historical greeting text corresponding to the historical customer demand service text are obtained, the historical customer demand semantic information of the historical customer demand service text is extracted, the extracted historical customer demand semantic information is input into the semantic information vector generation model, and the input historical customer demand semantic information is processed using the semantic information vector generation model to obtain the historical customer demand semantic information vector.
[0093] The historical first similarity between the historical customer demand semantic information vector and each hotel semantic information vector in the pre-built hotel semantic information vector library, as well as the historical second similarity between the historical customer demand semantic information vector and each environmental semantic information vector in the pre-built environmental semantic information vector library, are calculated. If a target historical first similarity is greater than a first threshold among the historical first similarities, and if all historical second similarities are less than a second threshold, the concatenation of the historical customer demand semantic information vector, the pre-built hotel semantic information vector library, and the pre-built greeting semantic vector is input into the LSTM-based seq2seq model to be trained. The LSTM-based seq2seq model to be trained processes the input concatenation result, with the training goal of ensuring that the resulting greeting text approximates the target historical greeting text. The LSTM-based seq2seq model to be trained is trained until the LSTM-based seq2seq model to be trained converges, thereby obtaining a greeting text generation model.
[0094] If all historical first similarities are not greater than the first threshold, and there is a target historical second similarity greater than the historical second threshold among all historical second similarities, the concatenation result of the historical customer demand semantic information vector, the pre-constructed Han Jing semantic information vector library and the pre-constructed greeting semantic vector is input into the LSTM-based seq2seq model to be trained, so that the LSTM-based seq2seq model to be trained processes according to the input concatenation result, and takes the obtained greeting text approaching the target historical greeting text as the training goal, and trains the LSTM-based seq2seq model to be trained until the LSTM-based seq2seq model to be trained converges to obtain a greeting text generation model.
[0095] If there is a target historical first similarity greater than a first threshold among each historical first similarity, and there is a target historical second similarity greater than a second threshold among each historical second similarity, the splicing result of the historical customer demand semantic information vector, the pre-constructed hotel semantic information vector library, the pre-constructed environment semantic information vector library and the pre-constructed greeting semantic vector is input into the LSTM-based seq2seq model to be trained, so that the LSTM-based seq2seq model to be trained is processed according to the input splicing result, and the obtained greeting text is close to the target historical greeting text as the training goal. The LSTM-based seq2seq model to be trained is trained until the LSTM-based seq2seq model to be trained converges to obtain a greeting text generation model.
[0096] During the specific execution of step S203, if there is a target first similarity greater than the first threshold among each first similarity and each second similarity is not greater than the second threshold, it can be considered that the current customer service text sent by the customer is related to the hotel and not related to the environment; the customer demand semantic information vector, the pre-built hotel semantic information vector library and the pre-built greeting semantic vector are spliced (for ease of distinction, the splicing result obtained by splicing the customer demand semantic information vector, the pre-built hotel semantic information vector library and the pre-built greeting semantic vector is called the first splicing result); the first splicing result is input into the greeting text generation model, so that the greeting text generation model processes the first splicing result and outputs the greeting text.
[0097] In this embodiment, to prevent the final generated greeting text from being too long, a beam search method can be used to control the length of the greeting text output by the greeting text generation model. Specifically, a beam size can be selected. After determining the beam size, decoding is performed from left to right of the greeting text based on the beam size. After each decoding, a sequence in the current decoding result that is equal to the selected beam size is retained as a candidate text requirement until each candidate text sequence contains a termination marker. The beam search method is used to control the length of the greeting text output by the greeting text generation model as shown in the following formula:
[0098] P(text t |x)=P(y1,y2...y t |x)=P(y1|x)*P(y2|y2x)*...*P(y t |y1,y2...y t-1 x)(3)
[0099] Where x is the size of the selected beam, y t Represents the prediction result of the output word at time t, text t is the candidate text, P(text t |x) is the candidate text for the final output.
[0100] Furthermore, in the hotel application scenario, the candidate text should be as short as possible. Therefore, a penalty for the length of the candidate text sequence can be added to further control the length of the final generated greeting text. The penalty for the length of the candidate text sequence is shown in the following formula:
[0101]
[0102] Among them, P(text t ) is the greeting text received after a punishment.
[0103] It should be noted that as the number of decodings increases, the termination token obtained each time will also increase. When decoding to the tth time, the probability that the token obtained in the tth decoding is the termination token is as shown in the following formula (5). The probability of obtaining the token in the remaining decoding times decreases proportionally, as shown in formula (6).
[0104]
[0105]
[0106] Among them, eos is the termination mark, i is the current decoding number, t is the tth decoding number, y iIt represents the predicted result of the output word at time i, and e is a constant of approximately 2.7182818284.
[0107] S204: If a target second similarity greater than a second threshold exists among the second similarities, and all the first similarities are not greater than the first threshold, a greeting text is generated according to the customer demand semantic information vector, the environment semantic information vector library, and the pre-built greeting semantic vector.
[0108] During the specific execution of step S204, if there is a target first similarity greater than the second threshold among each second similarity, and each first similarity is not greater than the first threshold, it can be considered that the current customer service demand text sent by the customer is related to the environment and not related to the hotel; the customer demand semantic information vector, the pre-built environment semantic information vector library and the pre-built greeting semantic vector are spliced (for ease of distinction, the splicing result obtained by splicing the customer demand semantic information vector, the pre-built environment semantic information vector library and the pre-built greeting semantic vector is called the second splicing result); the second splicing result is input into the greeting text generation model, so that the greeting text generation model processes the second splicing result and outputs the greeting text.
[0109] S205: If a target first similarity exists among the first similarities that is greater than a first threshold, and a target second similarity exists among the second similarities that is greater than a second threshold, a greeting text is generated according to the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-constructed greeting semantic vector.
[0110] During the specific execution of step S205, if there is a target first similarity greater than the first threshold among each first similarity, and if there is a target second similarity greater than the second threshold among each second similarity, it can be considered that the current customer service text sent by the customer is not only related to the hotel, but also unrelated to the environment; the customer demand semantic information vector, the pre-built hotel semantic information vector library, the pre-built environment semantic information vector and the pre-built greeting semantic vector are spliced (for ease of distinction, the splicing result obtained by splicing the customer demand semantic information vector, the pre-built hotel semantic information vector library, the pre-built environment semantic information vector and the pre-built greeting semantic vector is called a third splicing result); the third splicing result is input into the greeting text generation model, so that the greeting text generation model processes the third splicing result and outputs a greeting text.
[0111] Corresponding to a speech generation method provided in an embodiment of the present invention, the present invention also provides a speech generation device, such as Figure 3 As shown, the speech generating device is applied to a smart speaker, and the speech generating device includes:
[0112] The first acquisition unit 31 is used to acquire the current customer service demand text sent by the customer and extract the customer demand semantic information of the current customer service demand text;
[0113] A first processing unit 32 is configured to input customer demand semantic information into a semantic information vector generation model, and process the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector. The semantic information vector generation model is obtained by training an LSTM neural network using historical customer demand service texts.
[0114] The greeting trigger probability prediction unit 33 is configured to input the concatenation result of the customer demand semantic information vector and the pre-constructed greeting semantic vector into the greeting trigger model, and use the greeting trigger prediction model to predict the greeting trigger probability of the concatenation result to obtain the greeting trigger probability. The greeting trigger prediction model is obtained by training an LSTM neural network using the customer demand semantic information vector of the historical customer service request text and the pre-constructed greeting semantic vector.
[0115] The first generating unit 34 is configured to generate a greeting text according to the customer demand semantic information vector and the pre-built greeting semantic vector if the greeting trigger probability is greater than a preset greeting trigger threshold, and convert the greeting text into a greeting voice.
[0116] It should be noted that the specific principles and execution processes of each unit in the speech generation device disclosed in the above embodiment of the present invention are the same as the speech generation method shown in the above embodiment of the present invention. Please refer to the corresponding parts of the speech generation method disclosed in the above embodiment of the present invention, and no further details will be given here.
[0117] The present invention provides a speech generation device for use in a smart speaker. A semantic information vector generation model and a greeting trigger prediction model are pre-integrated in the smart speaker. After receiving a current customer service request text sent by a customer, semantic information extracted from the current customer service request text is input into the semantic information vector generation model. The semantic information vector generation model processes the input customer service semantic information and outputs a customer service semantic information vector. The concatenation result of the customer service semantic information vector and a pre-constructed greeting semantic vector is then input into a greeting trigger prediction model. The greeting trigger prediction model predicts a greeting trigger probability based on the concatenation result and outputs a greeting trigger probability. When the greeting trigger probability exceeds a preset greeting trigger threshold, the model generates a greeting text based on the customer service semantic information vector and the pre-constructed greeting semantic vector. The greeting text is converted into a greeting voice, and a greeting is initiated to the customer based on the converted greeting voice. The technical solution provided by the present invention can generate a greeting voice that meets customer needs based on the customer service request text sent by the customer, thereby improving the customer experience and thereby enhancing the hotel's image and reputation.
[0118] Preferably, the first acquiring unit includes:
[0119] A word segmentation processing unit is used to perform word segmentation processing on the current customer service text to obtain the words and sentences of the current customer service text;
[0120] The vectorization processing unit is used to perform vectorization processing on the words and sentences of the current customer service text to obtain customer demand semantic information.
[0121] Preferably, the first generating unit includes:
[0122] a first calculation unit, configured to calculate a first similarity between the customer demand semantic information vector and each hotel semantic information vector in a pre-constructed hotel semantic information vector library, wherein the pre-constructed hotel semantic information vector library is obtained by concatenating multiple hotel semantic information vectors;
[0123] a second calculation unit, configured to calculate a second similarity between the customer demand semantic information vector and each environmental semantic information vector in a pre-built environmental semantic information vector library, wherein the pre-built environmental semantic information vector library is obtained by splicing a plurality of environmental semantic information vectors;
[0124] a second generating unit configured to generate a greeting text based on the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector if a target first similarity exists among the first similarities and none of the second similarities is greater than the second threshold;
[0125] a third generating unit configured to generate a greeting text based on the customer demand semantic information vector, the environment semantic information vector library, and the pre-constructed greeting semantic vector if a target second similarity exists among the second similarities and none of the first similarities is greater than the first threshold;
[0126] The fourth generating unit is configured to generate a greeting text based on the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-built greeting semantic vector if a target first similarity greater than a first threshold exists among the first similarities and a target second similarity greater than a second threshold exists among the second similarities.
[0127] Preferably, the second generating unit includes:
[0128] A first splicing unit is used to splice the customer demand semantic information vector, the hotel semantic information vector library and the pre-built greeting semantic vector to obtain a first splicing result;
[0129] a second processing unit, configured to input the first splicing result into a greeting speech generation model, process the first splicing result using a greeting text generation model, and output a greeting text;
[0130] Among them, the greeting text generation model is obtained by training the LSTM-based seq2seq model using the historical customer service texts and the historical greeting texts corresponding to the historical customer service texts.
[0131] Preferably, the third generating unit includes:
[0132] A second splicing unit is used to splice the customer demand semantic information vector, the pre-built environment semantic information vector library and the pre-built greeting semantic vector to obtain a second splicing result;
[0133] The third processing unit is configured to input the second splicing result into a greeting text generation model, process the second splicing result using the greeting text generation model, and output a greeting text.
[0134] Preferably, the fourth generating unit includes:
[0135] The third splicing result is used to splice the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-built greeting semantic vector to obtain a third splicing result;
[0136] The fourth processing unit is configured to input the third splicing result into the greeting text generation model, process the third splicing result using the greeting text generation model, and output a greeting text.
[0137] Preferably, the process of pre-building the greeting semantic vector includes:
[0138] A second acquiring unit is configured to acquire a plurality of historical greeting type texts and a recent historical greeting text;
[0139] A first extraction unit is used to extract historical semantic information of each historical greeting type text and semantic information of the historical greeting text;
[0140] a fifth processing unit, configured to input the plurality of historical greeting type texts and the semantic information of the historical greeting texts into a semantic information vector generation model, and process the semantic information of each historical greeting type text and the historical greeting text using the semantic information vector generation model to obtain a semantic vector for each historical greeting type text and the semantic vector for the historical greeting text;
[0141] The fourth concatenation unit is configured to concatenate the semantic vectors of the plurality of historical greeting type texts and the semantic vector of the historical greeting text to obtain a greeting semantic vector.
[0142] Preferably, the process of pre-building the hotel semantic information vector library includes:
[0143] A third acquisition unit is used to acquire a plurality of preset hotel information and extract hotel semantic information from each piece of hotel information;
[0144] a sixth processing unit, configured to input each piece of hotel semantic information into a semantic information vector generation model, and process each piece of hotel semantic information using the semantic information vector generation model to obtain a hotel semantic information vector for each piece of hotel semantic information;
[0145] The fifth splicing unit is used to splice each hotel semantic information vector to obtain a hotel semantic information vector library.
[0146] Preferably, the process of pre-building the environmental semantic information vector library includes:
[0147] a fourth acquiring unit, configured to acquire current environmental information related to each preset environmental greeting type, and extract environmental semantic information of the current environmental information of each environmental greeting type;
[0148] a seventh processing unit, configured to input each piece of environmental semantic information into a semantic information vector generation model, and process each piece of environmental semantic information using the semantic information vector generation model to obtain an environmental semantic information vector for each piece of environmental semantic information;
[0149] The sixth splicing unit is used to splice each environmental semantic information vector to obtain an environmental semantic information vector library.
[0150] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without making any creative efforts.
[0151] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0152] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
[0153] The above are only preferred embodiments of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A speech generation method, characterized in that: Applied to a smart speaker, the method includes: Obtaining a current customer service request text sent by the customer, and extracting customer demand semantic information from the current customer service request text; Inputting the customer demand semantic information into a semantic information vector generation model, and processing the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector, wherein the semantic information vector generation model is obtained by training an LSTM neural network using historical customer demand service texts; Inputting a concatenation result of the customer demand semantic information vector and the pre-constructed greeting semantic vector into a greeting trigger prediction model, and using the greeting trigger prediction model to predict a greeting trigger probability on the concatenation result to obtain a greeting trigger probability, wherein the greeting trigger prediction model is obtained by training the LSTM neural network using the customer demand semantic information vector of the historical customer demand service text and the pre-constructed greeting semantic vector; If the greeting trigger probability is greater than a preset greeting trigger threshold, generating a greeting text according to the customer demand semantic information vector and the pre-constructed greeting semantic vector, and converting the greeting text into a greeting voice; The process of pre-building the greeting semantic vector includes: Get multiple historical greeting type texts and the most recent historical greeting text; Extracting historical semantic information of each of the historical greeting type texts and semantic information of the historical greeting texts; Inputting a plurality of the historical greeting type texts and the semantic information of the historical greeting texts into the semantic information vector generation model, and using the semantic information vector generation model to process the semantic information of each of the historical greeting type texts and the historical greeting texts, respectively, to obtain a semantic vector for each of the historical greeting type texts and the semantic vector for the historical greeting texts; The semantic vectors of the plurality of historical greeting type texts and the semantic vector of the historical greeting text are concatenated to obtain the greeting semantic vector.
2. The method according to claim 1, characterized in that The extracting of customer demand semantic information from the current customer demand service text includes: Performing word segmentation processing on the current customer service demand text to obtain words and sentences of the current customer service demand text; Vectorize the words and sentences in the current customer service text to obtain customer service semantic information.
3. The method according to claim 1, characterized in that Generating a greeting text according to the customer demand semantic information vector and the pre-built greeting semantic vector includes: Calculating a first similarity between the customer demand semantic information vector and each hotel semantic information vector in a pre-constructed hotel semantic information vector library, where the pre-constructed hotel semantic information vector library is obtained by concatenating a plurality of the hotel semantic information vectors; Calculating a second similarity between the customer demand semantic information vector and each environmental semantic information vector in a pre-constructed environmental semantic information vector library, where the pre-constructed environmental semantic information vector library is obtained by splicing a plurality of the environmental semantic information vectors; If a target first similarity greater than a first threshold exists among the first similarities, and none of the second similarities is greater than a second threshold, generating a greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, and the pre-constructed greeting semantic vector; If a target second similarity exists among the second similarities that is greater than the second threshold, and none of the first similarities is greater than the first threshold, generating a greeting text based on the customer demand semantic information vector, the environment semantic information vector library, and the pre-constructed greeting semantic vector; If a target first similarity exists among each of the first similarities that is greater than a first threshold, and if a target second similarity exists among each of the second similarities that is greater than the second threshold, a greeting text is generated based on the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-constructed greeting semantic vector.
4. The method according to claim 3, characterized in that Generating a greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector includes: splicing the customer demand semantic information vector, the hotel semantic information vector library, and the pre-built greeting semantic vector to obtain a first splicing result; Inputting the first splicing result into a greeting speech generation model, processing the first splicing result using the greeting text generation model, and outputting a greeting text; The greeting text generation model is obtained by training a seq2seq model based on LSTM using the historical customer service text and the historical greeting text corresponding to the historical customer service text.
5. The method according to claim 3, characterized in that Generating a greeting text according to the customer demand semantic information vector, the environment semantic information vector library, and the pre-built greeting semantic vector includes: splicing the customer demand semantic information vector, the pre-constructed environment semantic information vector library, and the pre-constructed greeting semantic vector to obtain a second splicing result; The second splicing result is input into the greeting text generation model, and the second splicing result is processed by the greeting text generation model to output a greeting text.
6. The method according to claim 3, characterized in that The generating of the greeting text according to the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library and the pre-built greeting semantic vector includes: splicing the customer demand semantic information vector, the hotel semantic information vector library, the environment semantic information vector library, and the pre-constructed greeting semantic vector to obtain a third splicing result; The third splicing result is input into the greeting text generation model, and the third splicing result is processed by the greeting text generation model to output a greeting text.
7. The method according to claim 3, characterized in that The process of pre-building the hotel semantic information vector library includes: Acquire the plurality of pre-set hotel information and extract hotel semantic information from each piece of the hotel information; Inputting a plurality of hotel semantic information into the semantic information vector generation model, and using the semantic information vector generation model to process each piece of the hotel semantic information respectively to obtain a hotel semantic information vector for each piece of the hotel semantic information; Each of the hotel semantic information vectors is spliced together to obtain a hotel semantic information vector library.
8. The method according to claim 3, characterized in that The process of pre-building the environmental semantic information vector library includes: Acquire current environment information related to each preset environment greeting type, and extract environment semantic information of the current environment information of each environment greeting type; Inputting each piece of the environmental semantic information into the semantic information vector generation model to obtain an environmental semantic information vector for each piece of the environmental semantic information; Each environmental semantic information vector is spliced together to obtain an environmental semantic information vector library.
9. A speech generating device, characterized in that: Applied to a smart speaker, the device includes: A first acquiring unit is configured to acquire a current customer service demand text sent by a customer and extract customer demand semantic information from the current customer service demand text; a first processing unit, configured to input the customer demand semantic information into a semantic information vector generation model, and process the customer demand semantic information using the semantic information vector generation model to obtain a customer demand semantic information vector, wherein the semantic information vector generation model is obtained by training an LSTM neural network using historical customer demand service texts; a greeting trigger probability prediction unit, configured to input a concatenation result of the customer demand semantic information vector and a pre-constructed greeting semantic vector into a greeting trigger prediction model, and use the greeting trigger prediction model to predict the greeting trigger probability of the concatenation result to obtain a greeting trigger probability, wherein the greeting trigger prediction model is obtained by training the LSTM neural network using the customer demand semantic information vector of the historical customer demand service text and the pre-constructed greeting semantic vector; a first generating unit, configured to generate a greeting text according to the customer demand semantic information vector and the pre-constructed greeting semantic vector if the greeting trigger probability is greater than a preset greeting trigger threshold, and convert the greeting text into a greeting voice; The process of pre-building the greeting semantic vector includes: Get multiple historical greeting type texts and the most recent historical greeting text; Extracting historical semantic information of each of the historical greeting type texts and semantic information of the historical greeting texts; Inputting a plurality of the historical greeting type texts and the semantic information of the historical greeting texts into the semantic information vector generation model, and using the semantic information vector generation model to process the semantic information of each of the historical greeting type texts and the historical greeting texts, respectively, to obtain a semantic vector for each of the historical greeting type texts and the semantic vector for the historical greeting texts; The semantic vectors of the plurality of historical greeting type texts and the semantic vector of the historical greeting text are concatenated to obtain the greeting semantic vector.
Citation Information
Patent Citations
Voice data processing method and device, memory medium, electronic device
CN108320733A
Interaction method and system based on intelligent loudspeaker box
CN108882111A