Voice control method and device for terminal device, storage medium and electronic device
By receiving voice in the terminal device and turning on asynchronous threads for semantic analysis and device list service calls, the problem of excessive time-consuming device list calls caused by multiple intelligent devices in the LAN is solved, the voice control efficiency is improved, and the voice control success is ensured sex.
Patent Information
- Application Number
- CN202210302041.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-03-25
AI Technical Summary
In the case of multiple smart devices in the LAN, the long time to call the device list leads to low voice control efficiency, and may even fail voice control due to timeout.
After receiving the target voice, the voice recognition results are obtained and the asynchronous thread is turned on for semantic analysis, and the asynchronous thread calls the device list service to obtain the terminal device list, thereby synchronously obtaining the device list, reducing the time for calling the device list individually, and improving the voice control efficiency.
It realizes synchronous acquisition of device list while analyzing the target voice semantics, saves the time to call the device list, improves the efficiency of voice control, and avoids voice control failure caused by timeout.
Smart Images

Figure CN114678022B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent devices, and in particular to a voice control method and device for terminal equipment, a storage medium and an electronic device. Background Art
[0002] Currently, smart devices can usually be controlled by voice. Voice control of smart devices is achieved by receiving voice commands through interactive devices, determining the specific smart device corresponding to the voice commands through voice command analysis, and sending the control name to the corresponding smart device to realize voice control of smart devices.
[0003] When multiple smart devices are deployed in a local area network, it is usually necessary to call the device list of smart devices associated with the interactive device in the local area network and determine the smart device to be controlled by the voice command from the device list. If there are many smart devices in the local area network, such as in a home appliance market environment, there will be many smart devices in a certain range at the same time, then calling the device list will take a long time, or the voice control efficiency will be low, and even the voice control will fail due to timeout.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a voice control method and apparatus for a terminal device, a storage medium, and an electronic device, so as to at least solve the technical problem that the device list call takes a long time and leads to low voice control efficiency.
[0006] According to one aspect of an embodiment of the present invention, a voice control method for a terminal device is provided, comprising: upon receiving a target voice, obtaining a voice recognition result of the target voice, wherein the target voice is voice data collected by a terminal device network; upon the voice recognition result indicating that the target voice belongs to a device control voice, starting a target asynchronous thread, and performing semantic analysis on the target voice based on the voice recognition result; utilizing the target asynchronous thread to call a device list service to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; searching for a target terminal device from the terminal device list according to the semantic analysis result, and sending a target control instruction matching the semantic analysis result to the target terminal device.
[0007] According to another aspect of an embodiment of the present invention, a voice control device for a terminal device is also provided, including: an acquisition unit, for acquiring a voice recognition result of the target voice when a target voice is received, wherein the target voice is voice data collected by a terminal device network; a start unit, for starting a target asynchronous thread when the voice recognition result indicates that the target voice belongs to a device control voice, and performing semantic analysis on the target voice based on the voice recognition result; a calling unit, for calling a device list service using the target asynchronous thread to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; a sending unit, for finding a target terminal device from the terminal device list according to the semantic analysis result, and sending a target control instruction matching the semantic analysis result to the target terminal device.
[0008] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the voice control method of the terminal device when running.
[0009] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the voice control method of the terminal device through the computer program.
[0010] In an embodiment of the present invention, when a target voice is received, a speech recognition result of the target voice is obtained, wherein the target voice is voice data collected by a terminal device network; when the speech recognition result indicates that the target voice belongs to a device control voice, a target asynchronous thread is started, and semantic analysis of the target voice is performed based on the speech recognition result; the target asynchronous thread is used to call a device list service to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; the target terminal device is found from the terminal device list according to the semantic analysis result, and a target control instruction matching the semantic analysis result is sent to the target terminal device, by which the target terminal device is detected by the terminal device. When the network receives the target voice and determines through the voice recognition result that the target voice is a device control voice, that is, when it is determined that the terminal device list of the terminal device network needs to be retrieved to determine the target terminal device to be controlled by the target voice, while performing semantic analysis of the target voice, an asynchronous thread is started to call the device list service, so as to obtain the terminal device list through the device list service, thereby achieving the purpose of synchronously obtaining the device list by starting an asynchronous thread to call the device list service while parsing the semantics of the target voice, thereby achieving the technical effect of saving the time occupied by a separate call to the device list and improving the voice control efficiency, and thus solving the technical problem of low voice control efficiency caused by a long device list call. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0012] Figure 1 is a schematic diagram of an application environment of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0013] Figure 2 is a flow chart of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0014] Figure 3 is a flow chart of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0015] Figure 4 is a flow chart of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0016] Figure 5 is a flow chart of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0017] Figure 6 is a flow chart of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0018] Figure 7 is a timing diagram of an optional voice control method for a terminal device according to an embodiment of the present invention;
[0019] Figure 8 is a schematic structural diagram of an optional voice control device for a terminal device according to an embodiment of the present invention;
[0020] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. 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 creative work should fall within the scope of protection of the present invention.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0023] According to one aspect of an embodiment of the present invention, a voice control method for a terminal device is provided. Optionally, the voice control method for the terminal device can be applied to, but is not limited to, Figure 1 In the environment shown in FIG. 1 , multiple smart devices 104 are constructed into a target device network 102, and the target device network 102 interacts with a server 112 through a network 110 to implement voice control of the target device network 102. The target device network 102 sends the received target voice to the server 112 through the network 110, and the server 112 directly sends the target control instruction corresponding to the target voice to the target terminal device in the target device network 102 after parsing it.
[0024] The server 112 runs a database 114 and a processing engine 116. The database 114 is not limited to storing target voices and target control instructions, and the processing engine 106 is not limited to determining the corresponding target control instructions according to the target voice by executing S102 to S108 in sequence, and sending them to the target terminal device. S102, obtaining the voice recognition result. When the target voice is received, the voice recognition result of the target voice is obtained, wherein the target voice is the voice data collected by the terminal device network. S104, starting the target asynchronous thread. When the voice recognition result indicates that the target voice belongs to the device control voice, the target asynchronous thread is started, and the target voice is semantically parsed based on the voice recognition result. S106, calling the device list service using the target asynchronous thread. The device list service is called using the target asynchronous thread to obtain the terminal device list through the device list service, and the terminal device list includes the device information of the terminal devices located in the terminal device network. S108, sending the target control instruction to the target terminal device. According to the semantic parsing result, the target terminal device is found from the terminal device list, and the target control instruction matching the semantic parsing result is sent to the target terminal device.
[0025] Optionally, in this embodiment, the above-mentioned smart device 104 can be a terminal device configured with a target client, which can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an IOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The above-mentioned network 110 can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The above-mentioned server 112 can be a single server, or a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0026] As an optional implementation, Figure 2 As shown, the voice control method of the above terminal device includes:
[0027] S202, when a target voice is received, obtaining a voice recognition result of the target voice, wherein the target voice is voice data collected by the terminal device network;
[0028] S204, when the speech recognition result indicates that the target speech belongs to the device control type speech, start the target asynchronous thread, and perform semantic analysis on the target speech based on the speech recognition result;
[0029] S206, using the target asynchronous thread to call the device list service to obtain a terminal device list through the device list service, where the terminal device list includes device information of terminal devices located in the terminal device network;
[0030] S208, searching for a target terminal device from the terminal device list according to the semantic analysis result, and sending a target control instruction matching the semantic analysis result to the target terminal device.
[0031] The terminal device network receiving interactive voice is not limited to collecting voice data through voice devices located in the terminal device network, and the voice devices in the terminal device network are not limited to any terminal devices including a voice collection function, or terminal devices pre-set for voice collection, such as smart speakers in the terminal device network.
[0032] In the case where the target voice received by the terminal device network does not belong to the device control type voice, the voice interaction is not limited to using the feedback voice corresponding to the target voice to respond to the target voice. For example, when the target voice is an inquiry voice asking about the current temperature, the answer voice containing the current temperature is used as a response.
[0033] Determining whether the target voice belongs to the device control type voice is not limited to calling the voice service to perform voice recognition on the target voice, thereby determining whether the target voice belongs to the device control type voice based on the voice recognition result. As an optional implementation, the above-mentioned obtaining the voice recognition result of the target voice includes:
[0034] S1, calling the voice service to perform voice recognition on the target voice and obtain the target text corresponding to the target voice;
[0035] S2, when a device control text is identified from the target text, determining that the speech recognition result indicates that the target speech belongs to a device control speech, wherein the device control text is text related to the device control instruction.
[0036] When the target voice is received, the target voice is recognized by calling the voice service to obtain a target text corresponding to the target voice, and the target text is used as the voice recognition result. When the device control text is recognized in the target text, it is determined that the voice recognition result of the target voice indicates that the target voice belongs to the device control type of voice. When the device control text is not recognized in the target text, it is determined that the voice recognition result indicates that the target voice does not belong to the device control type of voice.
[0037] The device control text is not limited to the text in the control instruction text library, and the text in the control instruction text library is the text corresponding to the device control instruction. By comparing the target text with the device control text, it is determined whether the target text includes the device control text. In the case where the target text includes any device control text in the control instruction text library, it is determined that the device control text is identified from the target text.
[0038] The device list service is used to obtain the device information of all terminal devices in the terminal device network, and record the device information of all terminal devices in the form of a device list. When the semantic analysis result of the target voice and the terminal device list are obtained, the target terminal device to be voice-controlled by the target voice is determined through the semantic analysis result of the target voice and the terminal device list, and the target control instruction corresponding to the semantic analysis result of the target voice is determined, so as to send the target control instruction to the target terminal device.
[0039] After the target control instruction is sent to the target terminal device, the target terminal device is not limited to responding to the target control instruction to perform the target operation, thereby achieving the technical effect of voice control of the target terminal device through the target voice.
[0040] In an embodiment of the present application, when a target voice is received, a speech recognition result of the target voice is obtained, wherein the target voice is voice data collected by the terminal device network; when the speech recognition result indicates that the target voice belongs to a device control voice, a target asynchronous thread is started, and semantic analysis of the target voice is performed based on the speech recognition result; the target asynchronous thread is used to call a device list service to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; the target terminal device is found from the terminal device list according to the semantic analysis result, and a target control instruction matching the semantic analysis result is sent to the target terminal device, by When the network receives the target voice and determines through the voice recognition result that the target voice is a device control voice, that is, when it is determined that the terminal device list of the terminal device network needs to be retrieved to determine the target terminal device to be controlled by the target voice, while performing semantic analysis of the target voice, an asynchronous thread is started to call the device list service, so as to obtain the terminal device list through the device list service, thereby achieving the purpose of synchronously obtaining the device list by starting an asynchronous thread to call the device list service while parsing the semantics of the target voice, thereby achieving the technical effect of saving the time occupied by a separate call to the device list and improving the voice control efficiency, and thus solving the technical problem of low voice control efficiency caused by a long device list call.
[0041] As an optional implementation, Figure 3As shown, after using the target asynchronous thread to call the device list service, it also includes:
[0042] S302, when a terminal device list is obtained through a device list service, the terminal device list is stored in a target cache location;
[0043] S304: When a semantic analysis result is obtained through analysis, a terminal device list is retrieved from a target cache location.
[0044] When the terminal device list is obtained by calling the device list service through the target asynchronous thread, the target device schedule is stored in the target cache location, which is not limited to the redis cache. The obtained terminal device list is cached in the cache, so that when the terminal device list needs to be called, the terminal device list can be directly retrieved from the cache without spending time to obtain the terminal device list.
[0045] As an optional implementation, performing semantic analysis on the target speech based on the speech recognition result includes: using the main thread to call the language processing service, so as to perform semantic analysis on the target text by calling the semantic model through the language processing service to obtain the semantic analysis result.
[0046] Calling the language processing service through the main thread is not limited to performing semantic analysis on the target text obtained by the voice service through the main thread calling the natural language processing (NLP) service to obtain the semantic analysis result of the target voice. Semantic analysis is not limited to performing semantic analysis on the target text to determine the target terminal device indicated by the target voice and the corresponding target control instruction.
[0047] As an optional implementation, Figure 4 As shown, after using the target asynchronous thread to call the device list service, it also includes:
[0048] S402, searching for a target terminal device that matches the semantic analysis result in a terminal device list;
[0049] S404: Determine, from the device control instructions corresponding to the target terminal device, a target control instruction that matches the semantic parsing result.
[0050] According to the semantics of the target speech, a matching target terminal device is searched from the terminal device list, and a target control instruction matching the semantics of the target speech is determined from the device control instructions of the target terminal device.
[0051] From receiving the target voice to sending the target control instruction to the target terminal device, it is not limited to calling the voice service in sequence to perform voice recognition on the target voice to obtain the target text, calling the target language service to perform semantic analysis on the target text, and starting an asynchronous thread to call the device list service to obtain the terminal device list. When the semantic analysis result of the target voice and the terminal device list are obtained, it is not limited to determining the target terminal device and the target control instruction through the device control service. The target control instruction is sent to the target terminal device through the Internet of Things (IOT) service.
[0052] Taking the terminal device network including 20 terminal devices as an example, the time taken to implement each voice control service is not limited to that shown in the following Table 1.
[0053] Table 1
[0054] Execution Order Calling a service Time consumed (in milliseconds) 1 Voice service (synchronous) 330 2 NLP Service (Synchronous) 300 3 Device List Service (Synchronization) 250 4 Device Control Service (Synchronous) 150 5 IOT Service (Synchronization) 200 Total duration 1230
[0055] When five service calls are executed in sequence, the total duration of voice control is the sum of the durations of each service. Using the above voice control method, while calling the NLP service, the device list service is called by opening an asynchronous thread, and the duration of voice control is shown in Table 2 below.
[0056] Table 2
[0057] Execution Order Calling a service Time consumed (in milliseconds) 1 Voice service (synchronous) 330 2 NLP Service (Synchronous) 300 2 Device List Service (Asynchronous) 0 4 Device Control Service (Synchronous) 150 5 IOT Service (Synchronization) 200 Total duration 980
[0058] Table 2 shows that by calling the device list service through an asynchronous thread, the time for calling the device list service to obtain the terminal device list can be saved, thereby shortening the overall time of voice control and improving the efficiency of voice control. In the above example, the terminal device network includes 20 terminal devices. If the number of terminal devices is larger, the time saved will be longer and the improvement of voice control efficiency will be more obvious.
[0059] As an optional implementation, Figure 5 As shown, after sending the target control instruction matching the semantic parsing result to the target terminal device, it also includes:
[0060] S502, feeding back the target control instruction to the voice service to establish an association relationship between the target text and the target control instruction;
[0061] S504: Update the device control text using the association relationship.
[0062] When the target control instruction is determined, the device control text is not limited to being updated using the target control instruction. The method of updating the device control text is not limited to updating the text in the control instruction text library, and updating the control instruction text library is not limited to adding control text to the control instruction text library, correcting the control text, etc. At the same time, the control instruction text library is not limited to recording the relationship between the text and the control text. When the target text corresponding to the target speech is identified, the control text corresponding to the target text is determined to facilitate the type determination and semantic analysis of the target speech.
[0063] As an optional implementation, Figure 6 As shown, after sending the target control instruction matching the semantic parsing result to the target terminal device, it also includes:
[0064] S602, obtaining an operation result fed back by the target terminal device after executing the target operation;
[0065] S604: Update the device status of the target terminal device using the operation result.
[0066] After the target terminal device responds to the target control instruction and completes the target operation indicated by the target control instruction, it is not limited to feeding back the operation result and the current device status to the server that issued the target control instruction, so that the server uses the operation result and the current device status to update the device status recorded by the target terminal device in the server, so as to facilitate the server to perform voice control on the terminal devices in the terminal device network.
[0067] The timing interaction between various services in the voice control of the terminal device is not limited to the following: Figure 7 As shown. After the terminal device network receives the voice, the voice service is called to convert the voice into text. When the text is obtained, the NLP service is called to perform semantic analysis on the text. At the same time, the device list service is called through an asynchronous thread to obtain the device list. After obtaining the parsed semantics, the device control service is called to retrieve the device list from the cache, and the target device and target control instructions that match the semantics are parsed. When the target control instruction is obtained, the IOT service is called to send the target control instruction to the target terminal device. The target control instruction and its issuance are fed back to the voice service.
[0068] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0069] According to another aspect of the embodiments of the present invention, there is also provided a voice control device for a terminal device for implementing the voice control method for the terminal device. Figure 8 As shown, the device comprises:
[0070] The acquisition unit 802 is used to acquire the speech recognition result of the target speech when receiving the target speech, wherein the target speech is the speech data collected by the terminal device network.
[0071] The start unit 804 is used to start the target asynchronous thread when the speech recognition result indicates that the target speech belongs to the device control type speech, and perform semantic analysis on the target speech based on the speech recognition result;
[0072] The calling unit 806 is used to call the device list service by using the target asynchronous thread to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network;
[0073] The sending unit 808 is used to find the target terminal device from the terminal device list according to the semantic analysis result, and send the target control instruction matching the semantic analysis result to the target terminal device.
[0074] Optionally, the voice control device of the above-mentioned terminal device also includes a cache unit, which is used to store the terminal device list in a target cache location after calling the device list service using the target asynchronous thread and obtaining the terminal device list through the device list service; when a semantic parsing result is obtained through parsing, the terminal device list is retrieved from the target cache location.
[0075] Optionally, the acquisition unit 802 is also used to call a voice service to perform voice recognition on the target voice to obtain a target text corresponding to the target voice; when a device control text is identified from the target text, it is determined that the voice recognition result indicates that the target voice belongs to a device control voice, wherein the device control text is text related to device control instructions.
[0076] Optionally, the start unit 804 is further configured to use the main thread to call a language processing service, so as to perform semantic analysis on the target text by calling a semantic model through the language processing service to obtain a semantic analysis result.
[0077] Optionally, the voice control device of the above-mentioned terminal device also includes a determination unit, which is used to search for a target terminal device that matches the semantic parsing result in the terminal device list after using the target asynchronous thread to call the device list service; and determine the target control instruction that matches the semantic parsing result from the device control instructions corresponding to the target terminal device.
[0078] Optionally, the voice control device of the above-mentioned terminal device also includes an updating unit, which is used to feed back the target control instruction to the voice service after sending the target control instruction matching the semantic parsing result to the target terminal device, so as to establish an association relationship between the target text and the target control instruction; and update the device control text using the association relationship.
[0079] Optionally, the voice control device of the above-mentioned terminal device also includes a feedback unit, which is used to obtain the operation result fed back by the target terminal device after the target terminal device performs the target operation after sending the target control instruction matching the semantic parsing result to the target terminal device; and use the operation result to update the device status of the target terminal device.
[0080] In an embodiment of the present application, when a target voice is received, a speech recognition result of the target voice is obtained, wherein the target voice is voice data collected by the terminal device network; when the speech recognition result indicates that the target voice belongs to a device control voice, a target asynchronous thread is started, and semantic analysis of the target voice is performed based on the speech recognition result; the target asynchronous thread is used to call a device list service to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; the target terminal device is found from the terminal device list according to the semantic analysis result, and a target control instruction matching the semantic analysis result is sent to the target terminal device, by When the network receives the target voice and determines through the voice recognition result that the target voice is a device control voice, that is, when it is determined that the terminal device list of the terminal device network needs to be retrieved to determine the target terminal device to be controlled by the target voice, while performing semantic analysis of the target voice, an asynchronous thread is started to call the device list service, so as to obtain the terminal device list through the device list service, thereby achieving the purpose of synchronously obtaining the device list by starting an asynchronous thread to call the device list service while parsing the semantics of the target voice, thereby achieving the technical effect of saving the time occupied by a separate call to the device list and improving the voice control efficiency, and thus solving the technical problem of low voice control efficiency caused by a long device list call.
[0081] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above method is also provided. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0082] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0083] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0084] S1, when receiving a target voice, obtaining a voice recognition result of the target voice, wherein the target voice is voice data collected by a terminal device network;
[0085] S2, when the speech recognition result indicates that the target speech belongs to the device control type speech, start the target asynchronous thread, and perform semantic analysis on the target speech based on the speech recognition result;
[0086] S3, using the target asynchronous thread to call the device list service to obtain a terminal device list through the device list service, where the terminal device list includes device information of terminal devices located in the terminal device network;
[0087] S4, searching for the target terminal device from the terminal device list according to the semantic analysis result, and sending the target control instruction matching the semantic analysis result to the target terminal device.
[0088] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an IOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Fig. 9 The structure of the electronic device is not limited. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations shown.
[0089] Among them, the memory 902 can be used to store software programs and modules, such as the program instructions / modules corresponding to the voice control method and device of the terminal device in the embodiment of the present invention. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, realizing the above-mentioned voice control method of the terminal device. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely arranged relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 can be specifically but not limited to being used to store information such as target speech, speech recognition results, semantic parsing results, target control instructions, etc. As an example, such as Fig. 9 As shown, the memory 902 may include, but is not limited to, the acquisition unit 802, the start unit 804, the call unit 806, and the delivery unit 808 in the voice control device of the terminal device. In addition, other module units in the voice control device of the terminal device may also be included but are not limited to, which will not be repeated in this example.
[0090] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0091] In addition, the electronic device further comprises: a display 908 for displaying the target voice and target control instructions; and a connection bus 910 for connecting various module components in the electronic device.
[0092] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.
[0093] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the voice control of the above-mentioned terminal device. The computer program is configured to execute the steps of any of the above-mentioned method embodiments when it is run.
[0094] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0095] S1, when receiving a target voice, obtaining a voice recognition result of the target voice, wherein the target voice is voice data collected by a terminal device network;
[0096] S2, when the speech recognition result indicates that the target speech belongs to the device control type speech, start the target asynchronous thread, and perform semantic analysis on the target speech based on the speech recognition result;
[0097] S3, using the target asynchronous thread to call the device list service to obtain a terminal device list through the device list service, where the terminal device list includes device information of terminal devices located in the terminal device network;
[0098] S4, searching for the target terminal device from the terminal device list according to the semantic analysis result, and sending the target control instruction matching the semantic analysis result to the target terminal device.
[0099] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0100] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0101] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
[0102] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0104] 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 units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0105] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0106] The above is only a preferred embodiment 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 principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A voice control method for a terminal device, characterized in that: include: When receiving a target voice, obtaining a voice recognition result of the target voice, wherein the target voice is voice data collected by a terminal device network; When the speech recognition result indicates that the target speech belongs to the device control type speech, start the target asynchronous thread, and use the main thread to perform semantic analysis on the target speech based on the speech recognition result; Using the target asynchronous thread to call a device list service, so as to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; Finding a target terminal device from the terminal device list according to the semantic analysis result, and sending a target control instruction matching the semantic analysis result to the target terminal device; The step of obtaining the speech recognition result of the target speech includes: calling a speech service to perform speech recognition on the target speech to obtain a target text corresponding to the target speech; and in the case where a device control text is recognized from the target text, determining that the speech recognition result indicates that the target speech belongs to the device control type speech, wherein the device control text is text related to a device control instruction; After the target control instruction matching the semantic analysis result is sent to the target terminal device, the method further includes: feeding back the target control instruction to the voice service to establish an association relationship between the target text and the target control instruction; and updating the device control text using the association relationship; Wherein, updating the device control text includes: updating the text in a control instruction text library, wherein the control instruction text library records the relationship between the text and the control text.
2. The method according to claim 1, characterized in that After the target asynchronous thread is used to call the device list service, the method further includes: When the terminal device list is obtained through the device list service, the terminal device list is stored in a target cache location; When the semantic parsing result is obtained through parsing, the terminal device list is retrieved from the target cache location.
3. The method according to claim 2, characterized in that The using the main thread to perform semantic analysis on the target speech based on the speech recognition result includes: The language processing service is called by the main thread, so as to perform semantic analysis on the target text by calling the semantic model through the language processing service to obtain the semantic analysis result.
4. The method according to claim 3, characterized in that After the target asynchronous thread is used to call the device list service, the method further includes: Searching the target terminal device matching the semantic analysis result in the terminal device list; The target control instruction matching the semantic parsing result is determined from the device control instructions corresponding to the target terminal device.
5. The method according to any one of claims 1 to 4, characterized in that: After sending the target control instruction matching the semantic parsing result to the target terminal device, the method further includes: Obtaining an operation result fed back by the target terminal device after executing the target operation; The device status of the target terminal device is updated using the operation result.
6. A voice control device for a terminal device, characterized in that: include: An acquisition unit, configured to acquire a speech recognition result of a target speech when a target speech is received, wherein the target speech is speech data collected by a terminal device network; An opening unit, configured to open a target asynchronous thread when the speech recognition result indicates that the target speech belongs to a device control type speech, and perform semantic analysis on the target speech based on the speech recognition result by using a main thread; A calling unit, configured to call a device list service by using the target asynchronous thread, so as to obtain a terminal device list through the device list service, wherein the terminal device list includes device information of terminal devices located in the terminal device network; a sending unit, configured to find a target terminal device from the terminal device list according to a semantic parsing result, and send a target control instruction matching the semantic parsing result to the target terminal device; The acquisition unit is further configured to call a voice service to perform voice recognition on the target voice to obtain a target text corresponding to the target voice; when a device control text is recognized from the target text, determining that the voice recognition result indicates that the target voice belongs to a device control voice, wherein the device control text is text related to a device control instruction; The device further includes an updating unit, which is used to feed back the target control instruction to the voice service after sending the target control instruction matching the semantic parsing result to the target terminal device, so as to establish an association relationship between the target text and the target control instruction; and update the device control text using the association relationship; The updating unit is used to update the device control text in the following manner: updating the text in the control instruction text library, wherein the control instruction text library records the relationship between the text and the control text.
7. A computer-readable storage medium, the computer-readable storage medium comprising a stored program, wherein: When the program is executed, the method described in any one of claims 1 to 5 is executed.
8. An electronic device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 5 through the computer program.
