The present application claims priority to Chinese Patent Application No.201910862398.2, entitled “Method and Apparatus for Processing Voices, Device and Computer Storage Medium”, filed on Sep. 12, 2019.
The present application relates to the technical field of computer applications, and particularly to a method and apparatus for processing voices and a computer storage medium in a voice technology.
This section is intended to provide a background or context for implementations of the present disclosure which are recited in the claims. The description herein is not admitted to be the prior art by inclusion in this section.
With the rapid development of voice recognition technologies, voice assistants are favored by various mobile phone application providers and mobile phone users. The user may interact with the voice assistant by means of inputting a voice request, and after recognizing the voice request, the voice assistant performs a corresponding processing task and responds to the user.
However, when the user uses the voice assistant, it is possible that the current voice assistant is unable to well handle the voice request input by the user, but other voice assistants in the same terminal device are able to well handle this voice request. Currently, a mechanism for responding to the voice request by a mutual call between the voice assistants is lacked.
In view of this, the present application provides a method and apparatus for processing voices and a computer storage medium, so as to implement a mutual call between voice assistants to respond to a voice request.
In a first aspect, the present application provides a method for processing voices, including:
recognizing a received voice request by a server of a first voice assistant; sending a recognized text request to a server of a second voice assistant;
receiving token information generated and returned by the server of the second voice assistant for the text request; and sending the text request and the token information to a client of the first voice assistant, such that the client of the first voice assistant calls a client of the second voice assistant to respond to the text request based on the token information.
According to an implementation of the present application, the sending a recognized text request to a server of a second voice assistant includes:
determining, by the server of the first voice assistant, information of the second voice assistant which is able to process the text request; and sending the text request to the server of the second voice assistant.
According to an implementation of the present application, the determining, by the server of the first voice assistant, information of the second voice assistant which is able to process the text request includes:
sending the text request to a server of at least one other voice assistant; and determining information of the second voice assistant from the server of the other voice assistant which returns acknowledgment information, the acknowledgment information indicating that the server of the other voice assistant which sends the acknowledgment information is able to process the text request.
According to an implementation of the present application, the method further includes: receiving an information list of voice assistants installed in a terminal device sent by the client of the first voice assistant; and executing the step of sending the text request to a server of at least one other voice assistant according to the information list of the voice assistants.
According to an implementation of the present application, the determining, by the server of the first voice assistant, information of the second voice assistant which is able to process the text request includes:
recognizing the field of the text request by the server of the first voice assistant; and
determining information of the voice assistant corresponding to the recognized field as the information of the second voice assistant.
According to an implementation of the present application, before the sending a recognized text request to a server of a second voice assistant, the method further includes:
judging whether the server of the first voice assistant is able to process the text request, if not, continuing to execute the step of sending a recognized text request to a server of a second voice assistant, and if yes, responding to the text request and returning a response result to the client of the first voice assistant.
In a second aspect, the present application provides a method for processing voices, including:
receiving, by a server of a second voice assistant, a text request sent by a server of a first voice assistant, the text request being obtained by recognizing a voice request by the server of the first voice assistant;
generating token information for the text request, and sending the token information to the server of the first voice assistant; receiving a text request sent by a client of the second voice assistant and the token information; and performing authentication based on the received token information and the generated token information, and if a check is passed, responding to the text request, and returning a response result of the text request to the client of the second voice assistant.
According to an implementation of the present application, the responding to the text request includes:
parsing the text request into a task instruction, and executing a corresponding task processing operation according to the task instruction; or parsing the text request into a task instruction, and returning the task instruction and information of a non-voice assistant executing the task instruction to the client of the second voice assistant, such that the client of the second voice assistant calls a client of the non-voice assistant to execute the task instruction.
According to an implementation of the present application, the method further includes:
performing a frequency control operation on the client of the second voice assistant, and if the number of the requests which are sent by the client of the second voice assistant and do not pass authentication exceeds a preset threshold within a set time, placing the client of the second voice assistant into a blacklist.
According to an implementation of the present application, the method further includes:
recording, by the server of the second voice assistant, a corresponding relationship between the token information and information of the first voice assistant;
counting the number of responses corresponding to the first voice assistant in the responses to the text request based on the corresponding relationship; and charging the first voice assistant based on the number of responses.
According to an implementation of the present application, the method further includes:
if the server of the second voice assistant is able to process the text request, returning acknowledgment information to the server of the first voice assistant.
In a third aspect, the present application provides an apparatus for processing voices provided at a server of a first voice assistant, the apparatus including:
a client interaction unit configured to receive a voice request sent by a client of the first voice assistant;
a recognition unit configured to recognize the voice request to obtain a text request; and
a server interaction unit configured to send the text request to a server of a second voice assistant; and receive token information generated and returned by the server of the second voice assistant for the text request;
wherein the client interaction unit is further configured to send the text request and the token information to the client of the first voice assistant, such that the client of the first voice assistant calls a client of the second voice assistant to respond to the text request based on the token information.
In an fourth aspect, the present application provides an apparatus for processing voices provided at a server of a second voice assistant, the apparatus including:
a server interaction unit configured to receive a text request sent by a server of a first voice assistant, the text request being obtained by recognizing a voice request by the server of the first voice assistant; and sending token information generated by an authentication unit to the server of the first voice assistant; the authentication unit configured to generate the token information for the text request; performing a check using token information received by a client interaction unit and the generated token information;
the client interaction unit configured to receive a text request sent by a client of the second voice assistant and the token information; return a response result of a response processing unit to the text request to the client of the second voice assistant; and
the response processing unit configured to, if the check is passed, respond to the text request.
In a fifth aspect, the present application provides an electronic device, including:
at least one processor; and
a memory connected with the at least one processor communicatively;
wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the above-mentioned method.
In a sixth aspect, the present application provides a non-transitory computer readable storage medium with computer instructions stored thereon, wherein the computer instructions are used for causing a computer to perform the above-mentioned methods.
An embodiment of the above-mentioned application has the following advantages.
1) With the present application, a mechanism of a mutual call between the voice assistants based on the token information is provided to realize the response to the voice request input by a user, such that after the user inputs the voice request with the first voice assistant, the first voice assistant may call the second voice assistant to respond to the voice request when the second voice assistant may better respond to the voice request.
2) A token-based checking mechanism provided by the server of the second voice assistant may prevent a false response caused by an error call of the client of the second voice assistant by the client of the first voice assistant, and may also prevent the client of a malicious first voice assistant from calling the client of the second voice assistant for an attack, thereby improving reliability and safety.
3) The server of the second voice assistant may use a token to perform a frequency control processing operation, which may prevent malicious attacks caused when an illegal client counterfeits a request.
4) The server of the second voice assistant may count the number of times of replacing the first voice assistant to respond to the text request by recording a corresponding relationship between the token and the first voice assistant, and use this result as a charging basis for the first voice assistant.
5) In the present application, the server of the first voice assistant sends the text request to the servers of the other voice assistants, and the information of the second voice assistant is determined from the server of the other voice assistant returning the acknowledgment information for the call, thereby providing a specific way of determining the second voice assistant which is able to process the voice request, such that the response to the voice request is more accurate. Other effects of the above-mentioned alternatives will be described below in conjunction with embodiments.
The following part will illustrate exemplary embodiments of the present application with reference to the figures, including various details of the embodiments of the present application for a better understanding. The embodiments should be regarded only as exemplary ones. Therefore, those skilled in the art should appreciate that various changes or modifications can be made with respect the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for clarity and conciseness, the descriptions of the known functions and structures are omitted in the descriptions below.
As shown in
A user may use the terminal device 100 to interact with the servers 104, 105 through the network 103. Various clients may be installed on the terminal device 100, and in addition to the voice-assistant client shown in
The terminal device 100 may be configured as various electronic devices supporting voice interaction, and may be configured as a screen device or a non-screen device, including, but not limited to, smart phones, tablets, intelligent loudspeaker boxes, smart televisions, or the like. The apparatus for processing voices according to the present application may be provided and run in the above-mentioned terminal device 100. The apparatus may be implemented as a plurality of pieces of software or a plurality of software modules (for example, for providing distributed service), or a single piece of software or a single software module, which is not specifically limited herein.
Each of the servers 104, 105 may be configured as a single server or a server group including a plurality of servers. In the present application, the servers 104, 105 are configured to receive and respond to information from respective clients, and information interaction also exists between the servers 104, 105. It should be understood that the numbers of the terminal devices, the network, and the server in
In the prior art, when the user uses the first voice assistant, after the client of the first voice assistant sends a voice request input by the user to the server of the first voice assistant, the server of the first voice assistant is responsible for performing voice recognition and an instruction parsing operation on the voice request, the voice recognition includes recognizing the voice request into a text request, and the instruction parsing operation includes parsing the text request into a task instruction in conjunction with a preset parsing policy. Then, a corresponding task processing operation is performed according to the task instruction. Usually, the instruction parsing operation is deeply related to a specific field, and only a specialized voice assistant in the related field may well perform the instruction parsing operation on a text request in this field.
For example, when using a built-in voice assistant of a mobile phone system, the user inputs a voice request “going to the multicolored city first and then to the Tsinghua university”, but after the voice request is recognized into a text, the built-in voice assistant of the mobile phone system has difficulty in converting the text into a correct task instruction. The text is parsed into a task instruction “initiating route retrieval with the Tsinghua university as a destination”, but the passing multicolored city is lost. Even if the built-in voice assistant of the mobile phone system calls a client of a navigation or map application in response to the task instruction, and the navigation or map client executes the task instruction, requirements of the user are unable to be met correctly.
After research, the inventor of the present application finds that usually, the voice assistant is able to well complete a catching link (that is, a voice instruction may be well recognized into a text instruction), but a client of a more specialized voice assistant is required in an understanding link (that is, the text instruction is parsed into the task instruction). In view of this, the core idea of the present application is that when the user inputs the voice request using the first voice assistant, the catching link is still performed by the first voice assistant, but the understanding link and a performing link are performed by the second voice assistant which is able to process the text request corresponding to the voice request. The method according to the present application will be described below in conjunction with embodiments.
In 201, receiving, by the client of the first voice assistant, a voice request input by the user.
In this step, the user inputs the voice request when using the client of the first voice assistant, or the first voice assistant is activated by a wakeup word used when the user inputs the voice request, such that the client of the first voice assistant receives the voice request input by the user.
For example, assuming that the user inputs the voice request by pressing a record button while using the client of the first voice assistant, the client of the first voice assistant receives the voice request input by the user.
For another example, assuming that the user starts a client of a built-in voice assistant of a system and inputs the voice request while using a mobile phone, the client of the built-in voice assistant of the system receives the voice request.
For another example, assuming that the user inputs the voice request “Duer . . . ” while using the Baidu map, the wakeup word “Duer” awakes a built-in voice assistant of the Baidu map, and a client of the Baidu map receives the voice request input by the user.
Certainly, this step is also applicable to other scenarios which are not enumerated here.
In 202, sending the voice request to a server of the first voice assistant by the client of the first voice assistant.
In 203, recognizing the voice request by the server of the first voice assistant to obtain a corresponding text request.
Currently, most voice assistants may well perform voice recognition, and therefore, after receiving the voice request, the server of the first voice assistant recognizes the voice request to obtain the corresponding text request.
In 204, sending the text request to a server of the second voice assistant by the server of the first voice assistant.
This step is implemented on the premise that the server of the first voice assistant determines information of the second voice assistant which is able to process the text request. Specifically, any determination way may be adopted, including, but is not limited to:
the first manner: the server of the first voice assistant recognizes the field of the text request, and then determines information of the voice assistant corresponding to the recognized field as the information of the second voice assistant. For example, the filed of the text request is determined by simple keyword or semantic-based analysis of the text request.
As one implementation, the server of the first voice assistant may be preconfigured with information of other cooperative voice assistants, and then determine the information of the second voice assistant from these voice assistants.
As another implementation, the client of the first voice assistant may scan an information list of voice assistants installed in the terminal device. Corresponding information may be adopted in an installation package to indicate voice assistant information of a client of each voice assistant in the terminal device, and the client of the first voice assistant may determine the clients of the voice assistants installed in the terminal device with the installation package in the terminal device, thereby obtaining the information list of the installed voice assistants. Then, the client of the first voice assistant may upload the information list of the voice assistants to the server of the first voice assistant. The information list may be uploaded when the client of the first voice assistant is started, while the voice request is sent, or before the voice request is sent. The server of the first voice assistant may determine the information of the second voice assistant according to the information list of the voice assistants uploaded by the client of the first voice assistant.
The second manner: the server of the first voice assistant sends the text request to a server of at least one other voice assistant, and the server of the other voice assistant replies acknowledgment information if judging that the server is able to handle the text request. The server of the first voice assistant selects one of the servers of the voice assistants replying the acknowledgment information as the server of the second voice assistant.
The second manner will be described in detail in an embodiment shown in
In addition to the above-mentioned two ways, other ways are possible. For example, the terminal device used by the user only has the clients of the first and second voice assistants. The server of the first voice assistant sends the text request to the second voice assistant when determining that the server is unable to handle the text request. Whether the server of the first voice assistant is able to handle the text request may be judged according to the field of the server, for example, the field of the text request is determined by simply analyzing the text request based on keywords or semantics, and whether the field of the text request is consistent with the field of the server is judged, if yes, it is considered that the server is able to process the text request, otherwise, it is considered that the server is unable to process the text request. Other field recognition ways may be adopted.
In 205, by the server of the second voice assistant, generating a token for the text request, and returning the token to the server of the first voice assistant.
In this step, the token may be generated by encrypting random information using a key and an encryption method known only to the server, so as to obtain the token, as long as the uniqueness of the token in the validity period is guaranteed and the token is difficult to crack by other devices.
In 206, sending the text request and the token to the client of the first voice assistant by the server of the first voice assistant.
In 207, calling, by the client of the first voice assistant, the client of the second voice assistant to respond to the text request, and transferring the text request and the token during the call.
In this step, if the terminal device only has the clients of the two voice assistants, the server of the first voice assistant is not required to transfer the information of the second voice assistant to the client of the first voice assistant in 206.
However, more generally, the server of the first voice assistant sends the determined information of the second voice assistant to the client of the first voice assistant in 206, such that the client of the first voice assistant calls the client of the corresponding second voice assistant in 207.
In 208, sending the text request and the token to the server of the second voice assistant by the client of the second voice assistant.
In 209, checking, by the server of the second voice assistant, the text request with the token, and if the check is passed, responding to the text request.
In this step, the server of the second voice assistant may perform the check using the received token and the token generated for the text request to determine whether the two tokens are consistent, and if yes, the check is passed, otherwise, the check fails.
If the check is passed, the server of the second voice assistant responds to the text request.
If the check fails, the server of the second voice assistant does not respond to the text request, or returns check failure or response failure information to the client of the second voice assistant.
2) The above-mentioned token-based check may prevent a false response caused by an error call of the client of the second voice assistant by the client of the first voice assistant, and may also prevent the client of a malicious first voice assistant from calling the client of the second voice assistant for an attack. For example, if the client of the malicious first voice assistant calls the client of the second voice assistant to send an offensive text request for multiple times, since the client of the malicious first voice assistant is unable to know the token, the server of the second voice assistant does not respond to the malicious text request.
In addition to being used for the check, the token may be used for at least one of frequency control and/or a charging operation in the present application.
When the token is used for frequency control, if the client of the second voice assistant frequently sends text requests and tokens to the server of the second voice assistant, but the check of the tokens fails, that is, if the number of the requests which are sent by the client of the second voice assistant and do not pass authentication exceeds a preset threshold within a set time, the client of the second voice assistant may be placed into a blacklist. The server of the second voice assistant discards all the requests sent by the client in the blacklist and does not respond. By such a frequency control way, malicious attack behaviors may be prevented.
When the token is used for the charging operation, the server of the second voice assistant counts the number of times of replacing the first voice assistant to respond to the text request by recording a corresponding relationship between the token and the first voice assistant, and use this result as a charging basis for the first voice assistant. Specifically, the server of the second voice assistant counts the number of responses corresponding to the first voice assistant in the responses to the text request based on the corresponding relationship, and charges the first voice assistant based on the number of responses.
In 210, returning the response result to the client of the second voice assistant by the server of the second voice assistant.
steps 301 to 303 which are the same as steps 201 to 203 in
In 304, sending the text request to a server of at least one other voice assistant by the server of the first voice assistant. Preferably, before this step, the server of the first voice assistant may first determine whether the server is able to process the text request, and if yes, directly respond to the text request, that is, parse the text request to obtain a task instruction. The subsequent process is the same as the prior art. If the server is unable to process the text request, the step of distributing the text request to the server of the other voice assistant is executed.
Whether the text request is able to be processed may be judged according to the field of the server, for example, the field of the text request is determined by simply analyzing the text request based on keywords or semantics, and whether the field of the text request is consistent with the field of the server is judged, if yes, it is considered that the server is able to process the text request, otherwise, it is considered that the server is unable to process the text request. Other field recognition ways may be adopted.
As one implementation, the server of the first voice assistant may be preconfigured with information of other cooperative voice assistants, and then send the text request to the servers of these voice assistants respectively.
As another implementation, the client of the first voice assistant may scan an information list of voice assistants installed in the terminal device. Corresponding information may be adopted in an installation package to indicate voice assistant information of a client of each voice assistant in the terminal device, and the client of the first voice assistant may determine the clients of the voice assistants installed in the terminal device with the installation package in the terminal device, thereby obtaining the information list of the installed voice assistants. Then, the client of the first voice assistant may upload the information list of the voice assistants to the server of the first voice assistant. The information list may be uploaded when the client of the first voice assistant is started, while the voice request is sent, or before the voice request is sent. In this step, the server of the first voice assistant may send the text request to the servers of the voice assistants in the list according to the information list of the voice assistants uploaded by the client of the first voice assistant.
In 305, after determining that the server of each other voice assistant is able to process the text request, generating a token for the text request, and returning acknowledgment information and the token to the server of the first voice assistant.
The server of each other voice assistant receiving the text request may also determine whether the server is able to process the text request in the above-mentioned manner based on the field recognition. After determining that the server is able to process the text request, the server returns the acknowledgment information to the server of the first voice assistant. If the server determines that the server is unable to process the text request, no response may be generated, or negative acknowledgment information may be returned to the server of the first voice assistant.
In this step, the token may be generated by encrypting random information using a key and an encryption method known only to the server, so as to obtain the token, as long as the uniqueness of the token in the validity period is guaranteed and the token is difficult to crack by other devices.
In 306, determining, by the server of the first voice assistant, information of the second voice assistant from the server returning the acknowledgment information.
Only aspects of the client and the server of the second voice assistant are shown in
This step is actually the process of determining the target voice assistant which is referred to as the second voice assistant in this embodiment. if only one server of the other voice assistant which returns the acknowledgment information exists, the information of the voice assistant corresponding to the server is directly determined as the information of the second voice assistant, for example, the information may be embodied as the identification, the name, or the like, of the second voice assistant.
If a plurality of servers of the other voice assistants which return the acknowledgment information exist, the information of the voice assistant corresponding to one of the servers may be selected as the information of the second voice assistant. The one server may be selected at random or according to a preset priority order. The setting policy of the priority order is not limited in the present application.
In addition, if none of the servers of all the voice assistants returns the acknowledgment information, the server of the first voice assistant may respond to the text request by itself.
In 307, sending the text request, the token and the information of the second voice assistant to the client of the first voice assistant by the server of the first voice assistant.
In 308, according to the information of the second voice assistant, calling, by the client of the first voice assistant, the client of the second voice assistant to respond to the text request, and transferring the text request and the token during the call.
If the server of the first voice assistant distributes the text request based on the cooperative relationship in step 304, the selected second voice assistant may face the problem that the second voice assistant is not installed in the terminal device where the client of the first voice assistant is located, and in this case, the client of the first voice assistant may fail to call, and at this moment, the client of the first voice assistant may return information indicating that the voice request is unable to be processed to the user.
Based on the above-mentioned situation, in the above-mentioned step 304, it is preferable that the server of the first voice assistant distributes the text request and selects the information of the second voice assistant based on the information list of the voice assistants uploaded by the client of the first voice assistant. Thus, the second voice assistant is certainly installed in the terminal device, and when calling the client of the second voice assistant, the client of the first voice assistant transfers the text request to the client of the second voice assistant. The call between the clients of the two voice assistants may adopt an interprocess communication mode, which is not the focus of the present application and not described in detail here.
In 309, sending the text request and the token to the server of the second voice assistant by the client of the second voice assistant.
In 310, checking, by the server of the second voice assistant, the text request with the token, and if the check is passed, responding to the text request.
The responding to the text request at least includes: parsing the text request to obtain the task instruction. Further, the server of the second voice assistant may directly execute a corresponding task processing operation according to the task instruction, and return a processing result to the client of the second voice assistant. Or, a client of a non-voice assistant executing the task instruction may be determined, and information of the client of the non-voice assistant is returned to the client of the second voice assistant together with the text request, such that the client of the second voice assistant calls the client of the non-voice assistant to execute the task instruction. The server of the second voice assistant may respond to the text request in a response way in the prior art, which is not limited in the present application.
That is, the server of the second voice assistant performs parsing and subsequent processing operations on the text request according to a parsing policy in the specialized field, thereby completing the catching and performing links. Moreover, the whole processing process of the text request by the second voice assistant is invisible to the first voice assistant, and the first voice assistant only knows that the second voice assistant is able to process the text request, but does not know how the second voice assistant processes the text request, which maintains the independence between the two voice assistants.
In 311, returning the response result to the client of the second voice assistant by the server of the second voice assistant.
Two examples in which the above-mentioned method is adopted are listed below.
A user inputs a voice request “Going to the Multicolored City first and then to the Tsinghua university” using a client of a built-in voice assistant of an operating system of a mobile phone, as shown in
It may be seen that the user calls the client of the voice assistant of the mapping application from the client of the built-in voice assistant of the system of the mobile phone as shown in
When using the client of the map application, the user receives a short message from his wife inquiring about location information, as shown in
It may be seen that after the user realizes the catching link and determines the target voice assistant from the client of the voice assistant of the map application shown in
The methods according to the present application are described above, and apparatuses according to the present application will be described below in detail in conjunction with embodiments.
The client interaction unit 03 is configured to receive a voice request sent by a client of the first voice assistant.
The recognition unit 01 is configured to recognize the voice request received by the client interaction unit 03 to obtain a text request.
The server interaction unit 02 is configured to send the text request to a server of a second voice assistant; and receive token information generated and returned by the server of the second voice assistant for the text request.
The client interaction unit 03 is further configured to send the text request and the token information to the client of the first voice assistant, such that the client of the first voice assistant calls a client of the second voice assistant to respond to the text request based on the token information.
As a preferred implementation, the server interaction unit 02 is specifically configured to send the text request to a server of at least one other voice assistant; and determine information of the second voice assistant from the server of the other voice assistant which returns acknowledgment information, the acknowledgment information indicating that the server of the other voice assistant which sends the acknowledgment information is able to process the text request.
As a preferred implementation, the client interaction unit 03 may further receive an information list of voice assistants installed in a terminal device sent by the client of the first voice assistant. The client of the first voice assistant may scan the information list of the voice assistants installed in the terminal device when started and send the information list to the server of the first voice assistant, or may send the list of the voice assistants to the server of the first voice assistant together with the voice request.
Correspondingly, according to the received information list of the voice assistants, the server interaction unit 02 executes the operation of sending a recognized text request to a server of at least one other voice assistant.
In addition, the apparatus may further include a response processing unit (not shown) configured to judge whether the server of the first voice assistant is able to process the text request, if not, trigger the server interaction unit 02 to send the recognized text request to the server of the second voice assistant, and if yes, respond to the text request and return a response result to the client of the first voice assistant.
When determining the information of the second voice assistant from the server of the other voice assistant which returns the acknowledgment information, the server interaction unit 02, if only one server of the other voice assistant which returns the acknowledgment information exists, determines the information of the voice assistant corresponding to the server as the information of the second voice assistant, and if a plurality of servers of the other voice assistants which return the acknowledgment information exist, selects the information of the voice assistant corresponding to one of the servers as the information of the second voice assistant.
The server interaction unit 11 is configured to send a voice request input by a user to the server of the first voice assistant; and receive a text request which is returned by the server of the first voice assistant and obtained by recognizing the voice request and information of a second voice assistant which is able to process the text request.
The client interaction unit 12 is configured to call a client of the second voice assistant to respond to the above-mentioned text request.
Preferably, the server interaction unit 11 may further receive token information returned by the server of the first voice assistant, the token information being generated by a server of the second voice assistant for the above-mentioned text request. The token information may be received together with the text request and the information of the second voice assistant.
Correspondingly, the client interaction unit 12 transfers the text request and the token information when the client of the second voice assistant is called.
The scanning unit 13 is configured to scan an information list of voice assistants installed in a terminal device where the client of the first voice assistant is located.
Correspondingly, the server interaction unit 11 sends the information list of the voice assistants to the server of the first voice assistant.
The client interaction unit 21 is configured to receive a call by a client of a first voice assistant.
The server interaction unit 22 is configured to send a text request transferred by the call to a server of the second voice assistant; and receive a response result returned by the server of the second voice assistant for the text request.
Preferably, token information may also be transferred in the above-mentioned call; that is, when the client of the first voice assistant calls the client of the second voice assistant, transferred parameters include the text request and the token information.
Correspondingly, the server interaction unit 22 sends the token information and the text request to the server of the second voice assistant together, such that the server of the second voice assistant may perform authentication using the token information.
The server interaction unit 31 is configured to receive a text request sent by a server of a first voice assistant, the text request being obtained by recognizing a voice request by the server of the first voice assistant.
The authentication unit 34 is configured to generate token information for the text request. The token information may be generated by encrypting random information using a key and an encryption method known only to the server of the second voice assistant, so as to obtain the token information, as long as the uniqueness of the token information in the validity period is guaranteed and the token information is difficult to crack by other devices.
The server interaction unit 31 sends the token information to the server of the first voice assistant.
The client interaction unit 32 is configured to receive a text request sent by a client of the second voice assistant and the token information.
The authentication unit 34 is further configured to perform a check using the token information received by the client interaction unit 32 and the generated token information.
The response processing unit 33 is configured to, if the check is passed, respond to the text request.
If the check fails, the client interaction unit 32 does not respond to the text request, or returns check failure or response failure information to the client of the second voice assistant.
The client interaction unit 32 is further configured to return a response result of the text request to the client of the second voice assistant.
The above-mentioned token-based check may prevent an error call of the client of the second voice assistant by the client of the first voice assistant, and may also prevent the client of a malicious first voice assistant from calling the client of the second voice assistant for an attack. For example, if the client of the malicious first voice assistant calls the client of the second voice assistant to send an offensive text request for multiple times, since the client of the malicious first voice assistant is unable to know the token, the server of the second voice assistant does not respond to the malicious text request.
In addition to being used for the check, the token may be used for at least one of frequency control and/or a charging operation in the present application.
The frequency-control processing unit 35 is configured to perform a frequency control operation on the client of the second voice assistant, and if the number of the requests which are sent by the client of the second voice assistant and do not pass authentication exceeds a preset threshold within a set time, the client of the second voice assistant is placed into a blacklist. The client interaction unit 32 directly discards requests from the client in the blacklist.
The authentication unit 34 is further configured to record a corresponding relationship between the token information and information of the first voice assistant.
A charging unit (not shown) is configured to count the number of times of replacing the first voice assistant to respond to the text request based on corresponding relationship, and use this result as a charging basis for the first voice assistant. Specifically, the number of responses corresponding to the first voice assistant in the responses to the text request may be counted based on the corresponding relationship; the first voice assistant may be charged based on the number of responses.
According to the embodiments of the present application, there are also provided an electronic device and a readable storage medium.
As shown in
The memory 1002 is configured as the non-transitory computer readable storage medium according to the present application. The memory stores instructions executable by the at least one processor to cause the at least one processor to perform a method for processing voices according to the present application. The non-transitory computer readable storage medium according to the present application stores computer instructions for causing a computer to perform the method for processing voices according to the present application.
The memory 1002 which is a non-transitory computer readable storage medium may be configured to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions/modules corresponding to the method for processing voices according to the embodiments of the present application. The processor 1001 executes various functional applications and data processing of a server, that is, implements the method for processing voices according to the above-mentioned embodiments, by running the non-transitory software programs, instructions, and modules stored in the memory 1002.
The memory 1002 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application program required for at least one function; the data storage area may store data created according to use of the electronic device for processing voices, or the like. Furthermore, the memory 1002 may include a high-speed random access memory, or a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid state storage devices. In some embodiments, optionally, the memory 1002 may include memories remote from the processor 1001, and such remote memories may be connected to the electronic device for processing voices via a network. Examples of such a network include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device for the method for processing voices may further include an input apparatus 1003 and an output apparatus 1004. The processor 1001, the memory 1002, the input apparatus 1003 and the output apparatus 1004 may be connected by a bus or other means, and
The input apparatus 1003 may receive input numeric or character information and generate key signal input related to user settings and function control of the electronic device for processing voices, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a trackball, a joystick, or the like. The output apparatus 1004 may include a display device, an auxiliary lighting apparatus (for example, an LED) and a tactile feedback apparatus (for example, a vibrating motor), or the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.
Various implementations of the systems and technologies described here may be implemented in digital electronic circuitry, integrated circuitry, ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various implementations may be implemented in one or more computer programs which are executable and/or interpretable on a programmable system including at least one programmable processor, and the programmable processor may be special or general, and may receive data and instructions from, and transmitting data and instructions to, a storage system, at least one input apparatus, and at least one output apparatus.
These computer programs (also known as programs, software, software applications, or codes) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms “machine readable medium” and “computer readable medium” refer to any computer program product, device and/or apparatus (for example, magnetic discs, optical disks, memories, programmable logic devices (PLDs)) for providing machine instructions and/or data to a programmable processor, including a machine readable medium which receives machine instructions as a machine readable signal. The term “machine readable signal” refers to any signal for providing machine instructions and/or data to a programmable processor.
To provide interaction with a user, the systems and technologies described here may be implemented on a computer having: a display apparatus (for example, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing apparatus (for example, a mouse or a trackball) by which a user may provide input to the computer. Other kinds of apparatuses may also be used to provide interaction with a user; for example, feedback provided to a user may be any form of sensory feedback (for example, visual feedback, auditory feedback, or tactile feedback); and input from a user may be received in any form (including acoustic, voice or tactile input).
The systems and technologies described here may be implemented in a computing system (for example, as a data server) which includes a back-end component, or a computing system (for example, an application server) which includes a middleware component, or a computing system (for example, a user computer having a graphical user interface or a web browser through which a user may interact with an implementation of the systems and technologies described here) which includes a front-end component, or a computing system which includes any combination of such back-end, middleware, or front-end components. The components of the system may be interconnected through any form or medium of digital data communication (for example, a communication network). Examples of the communication network include: a local area network (LAN), a wide area network (WAN) and the Internet.
A computer system may include a client and a server. Generally, the client and the server are remote from each other and interact through the communication network. The relationship between the client and the server is generated by virtue of computer programs which are run on respective computers and have a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used and reordered, and steps may be added or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution disclosed in the present application may be achieved.
The above-mentioned embodiments are not intended to limit the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made, depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present application all should be included in the extent of protection of the present application.
Number | Date | Country | Kind |
---|---|---|---|
CN201910862398.2 | Sep 2019 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2020/088943 | 5/7/2020 | WO | 00 |