Semantic understanding template generation method and device, storage medium and electronic device
By constructing a concept network and generating a semantic understanding template, and using entity word tags to identify user intent, the problem of inaccurate interaction intent of smart devices is solved, and the accuracy of interaction is improved.
Patent Information
- Application Number
- CN202310808731.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-07-03
AI Technical Summary
In existing technologies, smart devices cannot accurately determine the user's interaction intent when interacting with the user, resulting in low accuracy of the interaction intent.
By generating semantic understanding templates, a concept network is constructed using historical voice interaction data from smart devices. This network stores entity relationships between entity words and entity word tags, identifies target entity words in the voice interaction data, and uses the target entity word tags to generate target semantic understanding templates to determine the user's interaction intent.
It improves the accuracy of understanding user interaction intentions and enhances the accuracy of interactions between smart devices and users.
Smart Images

Figure CN119252233B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of smart home, in particular to a semantic understanding template generation method and device, a storage medium and an electronic device. BACKGROUND
[0002] At present, with the continuous progress of intelligent connection technology, in the fields of smart home, smart medical treatment and the like, voice interaction has become an interaction trend. This interaction mode of voice interaction between intelligent devices and users through voice recognition and natural language processing technology enables users to control devices such as opening an air conditioner, increasing the temperature of the air conditioner and the like through simple oral instructions. However, the user intention understood by the user in the interaction with the intelligent device is still limited, and different user intentions cannot be accurately determined.
[0003] Therefore, in the related art, there is a technical problem of how to solve the low accuracy of the determined user interaction intention.
[0004] For the technical problem of low accuracy of the determined user interaction intention in the related art, an effective solution has not been proposed. SUMMARY
[0005] Embodiments of the present application provide a semantic understanding template generation method and device, a storage medium and an electronic device to at least solve the technical problem of low accuracy of the determined user interaction intention in the related art.
[0006] According to an embodiment of the present application, a semantic understanding template generation method is provided, comprising: generating a concept network according to historical voice interaction data of an intelligent device, wherein the concept network is used to store entity relationships between entity words and entity word labels; identifying voice interaction data received by the intelligent device to obtain target entity words contained in the voice interaction data; obtaining target entity word labels corresponding to the target entity words from the concept network, and generating a target semantic understanding template using the target entity word labels, wherein semantic information corresponding to the target semantic understanding template is an interaction intention of a target object.
[0007] In an example embodiment, generating a concept network according to historical voice interaction data of an intelligent device comprises: grouping the historical voice interaction data according to interaction types to obtain a plurality of groups of interaction data, wherein each group of interaction data of the plurality of groups of interaction data comprises a first label element for representing an entity word in the each group of interaction data, the first label element being identified by a neural network model according to the entity word; setting a second label element for representing an interaction type of the each group of interaction data as a first root node associated with a center node of the concept network, and setting the first label element contained in the each group of interaction data as a first leaf node associated with the first root node, to generate the concept network.
[0008] In an example embodiment, before grouping the historical voice interaction data according to interaction types to obtain a plurality of groups of interaction data, the method further comprises: parsing a plurality of voice interaction sentences from the historical voice interaction data; determining entity word labels pre-labeled for entity words of the plurality of voice interaction sentences; determining the entity words of the plurality of voice interaction sentences and the entity word labels as training samples, and training the neural network model using the training samples, wherein the trained neural network model is used to identify an entity word label corresponding to the entity word.
[0009] In an example embodiment, after training the neural network model using the training samples, the method further comprises: inputting a target entity word contained in the voice interaction data into the trained neural network model; determining an output result of the trained neural network model, wherein the output result comprises a target entity word label corresponding to the target entity word; and updating the concept network according to an interaction type of the voice interaction data.
[0010] In an example embodiment, updating the concept network according to the interaction type of the voice interaction data comprises: searching for a preset entity word corresponding to the target entity word label from a first preset word library; wherein the first preset word library stores different entity words corresponding to the target entity word label; and in a case where the target entity word is determined to be consistent with the preset entity word, setting the interaction type of the voice interaction data as a second root node associated with the center node, and setting the target entity word label corresponding to the target entity word as a second leaf node associated with the second root node, to update the concept network.
[0011] In an example embodiment, the target semantic understanding template is generated using the target entity word labels, including: replacing target entity words in the voice interaction data with the target entity word labels; determining a first combination order of the target entity word labels according to a first occurrence order of the target entity words in the voice interaction data; sequentially combining the target entity word labels in the first combination order to obtain the target semantic understanding template.
[0012] In an example embodiment, sequentially combining the target entity word labels in the first combination order to obtain the target semantic understanding template includes: in a case where it is determined that the voice interaction data contains non-entity words, obtaining a stop word corresponding to the non-entity words from a second preset word library; replacing the non-entity words in the voice interaction data with the stop words; determining a second combination order of the stop words according to a second occurrence order of the non-entity words in the voice interaction data; obtaining an intermediate result of sequentially combining the target entity word labels in the first combination order, and combining the stop words with the intermediate result in the second combination order to obtain the target semantic understanding template.
[0013] In an example embodiment, after obtaining the target entity word labels corresponding to the target entity words from the concept network and generating the target semantic understanding template using the target entity word labels, the method further includes: obtaining a stop word in the target semantic understanding template; in a case where it is determined that a third preset word library contains the stop word, obtaining a stop word label corresponding to the stop word from the third preset word library; and replacing the stop word in the target semantic understanding template with the stop word label to obtain a first semantic understanding template.
[0014] In an example embodiment, after obtaining the stop word in the target semantic understanding template, the method further includes: in a case where it is determined that the third preset word library does not contain the stop word, sending prompt information containing the stop word to the target object; in a case where feedback information sent by the target object based on the prompt information is received, replacing the stop word in the target semantic understanding template with a stop word backup label carried in the feedback information to obtain a second semantic understanding template.
[0015] In an example embodiment, after the stop words in the target semantic understanding template are replaced by the stop word labels to obtain a first semantic understanding template, the method further comprises: determining other words in the first semantic understanding template that are not replaced by the stop word labels, generating a word regular expression corresponding to the other words, and replacing the other words in the first semantic understanding template by the word regular expression to obtain a third semantic understanding template; in the case where there are multiple third semantic understanding templates, determining multiple groups of other words, obtaining a common field in the multiple groups of other words, and generating a field regular expression of the common field; and replacing the common field in the multiple third semantic understanding templates by the field regular expression.
[0016] According to another aspect of the embodiments of the present application, a computer readable storage medium is also provided, which stores a computer program. The computer program is configured to execute the above-mentioned method for generating a semantic understanding template when running.
[0017] According to another aspect of the embodiments of the present application, an electronic device is also provided, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the above-mentioned method for generating a semantic understanding template through the computer program.
[0018] In the embodiments of the present application, a concept network for storing entity relationships between entity words and entity word labels is generated according to historical voice interaction data of a smart device; voice interaction data received by the smart device is recognized to obtain target entity words contained in the voice interaction data; a target entity word label corresponding to the target entity words is obtained from the concept network, and a target semantic understanding template is generated using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is an interactive intent of a target object. By using the above technical solution, the technical problem of how to improve the understanding accuracy of the interactive intent of the user is solved, and the understanding accuracy of the interactive intent of the user is improved. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0021] Figure 1is a hardware environment schematic diagram of a semantic understanding template generation method according to an embodiment of the present application;
[0022] Figure 2 is a flow chart of a semantic understanding template generation method according to an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a concept network (I) according to an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of a concept network (II) according to an embodiment of the present application;
[0025] Figure 5 is a structural block diagram of a semantic understanding template generation device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] According to an aspect of an embodiment of the present application, a semantic understanding template generation method is provided. The semantic understanding template generation method is widely applied to smart home (Smart Home), smart home, smart home device ecology, intelligence house (Intelligence House) ecology, and other whole-house intelligent digital control application scenarios. Optionally, in the present embodiment, the above-mentioned semantic understanding template generation method can be applied to the hardware environment composed of a terminal device 102 and a server 104 as shown in Figure 1 Figure 1 As shown, the server 104 is connected with the terminal device 102 through a network, and can be used to provide services (such as application services, etc.) for the terminal or the client installed on the terminal, a database can be set on the server or independently of the server, used to provide data storage services for the server 104, cloud computing and / or edge computing services can be configured on the server or independently of the server, used to provide data operation services for the server 104.
[0029] The network can include but is not limited to at least one of the following: wired network, wireless network. The wired network can include but is not limited to at least one of the following: wide area network, metropolitan area network, local area network. The wireless network can include but is not limited to at least one of the following: WIFI (Wireless Fidelity), Bluetooth. The terminal device 102 can not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart oven, smart refrigerator, smart oven, smart oven, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projection equipment, smart television, smart clothesline, smart curtain, smart audio and video, smart socket, smart sound, smart sound box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart sweeping robot, smart window cleaning robot, smart mopping robot, smart air purification equipment, smart steamer, smart microwave oven, smart kitchen treasure, smart purifier, smart water dispenser, smart door lock, etc.
[0030] In the embodiment, a semantic understanding template generation method is provided, which is applied to the terminal device, Figure 2 is a flowchart of the semantic understanding template generation method according to the embodiment of the application, which includes the following steps:
[0031] Step S202, generating a concept network according to historical voice interaction data of the intelligent device, wherein the concept network is used to store entity relationships between entity words and entity word labels;
[0032] Step S204, identifying voice interaction data received by the intelligent device to obtain target entity words contained in the voice interaction data;
[0033] Step S206, obtaining a target entity word label corresponding to the target entity word from the concept network, and generating a target semantic understanding template using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is an interactive intent of a target object.
[0034] Further, before step S206 is performed, it can be judged whether the target entity word belongs to the pre-stored entity words of the concept network, and after it is determined that the target entity word belongs to the pre-stored entity words of the concept network, step S206 is performed.
[0035] By the above steps, the concept network for storing the entity relationship between the entity word and the entity word label is generated according to the historical voice interaction data of the intelligent device; the voice interaction data received by the intelligent device is recognized to obtain the target entity word contained in the voice interaction data; the target entity word label corresponding to the target entity word is obtained from the concept network, and the target semantic understanding template is generated using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is the interaction intent of the target object; by using the above technical solution, the technical problem of how to improve the understanding accuracy of the user's interaction intent is solved, and the understanding accuracy of the user's interaction intent is improved.
[0036] In an example embodiment, for the technical solution of how to generate the concept network according to the historical voice interaction data of the intelligent device in the above step S202, the specific steps include: grouping the historical voice interaction data according to the interaction type to obtain a plurality of groups of interaction data, wherein each group of interaction data of the plurality of groups of interaction data includes a first label element for representing an entity word in the each group of interaction data, and the first label element is recognized by a neural network model according to the entity word; based on a center node preset for the concept network, a second label element for representing the interaction type of the each group of interaction data is set as a first root node associated with the center node, and the first label element contained in the each group of interaction data is set as a first leaf node associated with the first root node, so as to generate the concept network.
[0037] For example, the interaction type of each group of interaction data includes an interaction type of a place, an interaction type of an interaction device, an interaction type of an interaction action, and the like, but is not limited thereto. Figure 3 As shown in the table, the interaction type can include a place "room", an interaction device "device", an interaction action "action", and the like, but is not limited thereto.
[0038] In an example embodiment, before the historical voice interaction data is grouped according to the interaction type to obtain a plurality of groups of interaction data, the following implementation steps can be further proposed: step S11, parsing a plurality of voice interaction sentences from the historical voice interaction data; step S12, determining the entity word label pre-labeled for the entity word of the plurality of voice interaction sentences; step S13, determining the entity word of the plurality of voice interaction sentences and the entity word label as a training sample, and training the neural network model using the training sample, wherein the trained neural network model is used to recognize the entity word label corresponding to the entity word.
[0039] In an example embodiment, after the neural network model is trained using the training samples, the following technical solution can be further implemented: inputting the target entity word in the voice interaction data into the trained neural network model; determining an output result of the trained neural network model, wherein the output result comprises a target entity word label corresponding to the target entity word; and updating the concept network according to the interaction type of the voice interaction data.
[0040] In an example embodiment, the process of updating the concept network according to the interaction type of the voice interaction data is further illustrated by the following implementation steps: searching for a preset entity word corresponding to the target entity word label from a first preset word library; wherein the first preset word library stores different entity words corresponding to the target entity word label; and in a case where the target entity word is determined to be consistent with the preset entity word, setting the interaction type of the voice interaction data as a second root node associated with the center node, and setting the target entity word label corresponding to the target entity word as a second leaf node associated with the second root node, so as to update the concept network.
[0041] In an example embodiment, for the technical solution of generating a target semantic understanding template using the target entity word label in step S206, the following steps are included: replacing the target entity word in the voice interaction data with the target entity word label; determining a first combination order of the target entity word label according to a first occurrence order of the target entity word in the voice interaction data; and sequentially combining multiple target entity word labels according to the first combination order to obtain the target semantic understanding template.
[0042] In an example embodiment, further, the implementation process of sequentially combining multiple target entity word labels according to the first combination order to obtain the target semantic understanding template can further include the following steps: in a case where the voice interaction data comprises a non-entity word, obtaining a stop word corresponding to the non-entity word from a second preset word library; replacing the non-entity word in the voice interaction data with the stop word; determining a second combination order of the stop word according to a second occurrence order of the non-entity word in the voice interaction data; obtaining an intermediate result of sequentially combining multiple target entity word labels according to the first combination order, and combining the stop word with the intermediate result according to the second combination order to obtain the target semantic understanding template.
[0043] In this embodiment, the stop word is combined with the intermediate result according to the second combination order, and the combination process includes, for example, sequentially splicing target entity word labels and stop words.
[0044] Optionally, according to different combination orders, the combination can include but is not limited to head combination, middle combination, and tail combination.
[0045] For example, for the voice interaction data "turn on the air conditioner in the living room", "give me" (i.e., a non-entity word) is combined with the intermediate result "{action: TurnOn} {room: LivingRoom} {device: AirConditioner}" in the form of head combination, and "of" (i.e., a non-entity word) is combined with the intermediate result in the form of middle combination, to obtain the target semantic understanding template "give me {action: TurnOn} {room: LivingRoom} of {device: AirConditioner}".
[0046] For the voice interaction data "turn on the air conditioner in the living room", "once" (i.e., a non-entity word) and "of" are combined with the intermediate result "{action: TurnOn} {room: LivingRoom} {device: AirConditioner}" in the form of middle combination, to obtain the target semantic understanding template "{action: TurnOn} once {room: LivingRoom} of {device: AirConditioner}".
[0047] For the voice interaction data "turn on the air conditioner in the living room once", "once" (i.e., a non-entity word) is combined with the intermediate result "{action: TurnOn} {room: LivingRoom} {device: AirConditioner}" in the form of tail combination, and "of" is combined with the intermediate result in the form of middle combination, to obtain the target semantic understanding template "{action: TurnOn} {room: LivingRoom} of {device: AirConditioner} once".
[0048] In the above embodiments, for example, the stop words such as "give me" and "of" are consistent with themselves, and the present application does not limit whether the non-entity words and the corresponding stop words must be consistent.
[0049] Based on the above embodiments, in the case that the target entity word label corresponding to the target entity word fails to be obtained from the concept network, the neural network model trained is used to identify the target entity word label corresponding to the target entity word, and then the target entity word label is used to replace the target entity word, to obtain the target semantic understanding template.
[0050] In an example embodiment, after the target entity word is replaced by the target entity word label in step S206, the target semantic understanding template is obtained, and further, the following operations can be performed on the target semantic understanding template: obtaining a stop word in the target semantic understanding template; in a case where it is determined that the stop word exists in a third preset word library, obtaining a stop word label corresponding to the stop word from the third preset word library; and replacing the stop word in the target semantic understanding template by the stop word label to obtain a first semantic understanding template.
[0051] In an example embodiment, further, after the stop word in the target semantic understanding template is obtained, in a case where it is determined that the stop word does not exist in the third preset word library, prompt information containing the stop word can be sent to the target object; in a case where feedback information sent by the target object based on the prompt information is received, the stop word in the target semantic understanding template is replaced by a stop word backup label carried in the feedback information to obtain a second semantic understanding template.
[0052] In an example embodiment, further, after the stop word in the target semantic understanding template is replaced by the stop word label to obtain the first semantic understanding template, for the first semantic understanding template, if it is determined that the first semantic understanding template is not replaced by other words of the stop word label, a word regular expression corresponding to the other words is generated, and the other words of the first semantic understanding template are replaced by the word regular expression to obtain a third semantic understanding template; in a case where a plurality of third semantic understanding templates exist, a plurality of groups of other words are determined, a common field in the plurality of groups of other words is obtained, a field regular expression of the common field is generated; and the common field of the plurality of third semantic understanding templates is replaced by the field regular expression.
[0053] It should be noted that, for the above common field, if there are a plurality of continuous common fields, the plurality of continuous common fields can be combined into a string, and then a field regular expression corresponding to the string is generated, and the common field of the plurality of third semantic understanding templates is replaced by the field regular expression corresponding to the string.
[0054] For generating the field regular expression of the common field, a regular expression generation tool can be directly used, and the present application does not limit this.
[0055] Further, for the process of replacing the common field of the plurality of third semantic understanding templates by the field regular expression, specifically, for each of the plurality of third semantic understanding templates, the common field of the each third semantic understanding template is replaced by the field regular expression.
[0056] Optionally, after the common fields of the plurality of third semantic understanding templates are replaced by using the field regular expression, the plurality of third semantic understanding templates after the replacement can be determined as a group of semantic understanding templates, a template type of the group of semantic understanding templates is obtained, and semantic information indicated by the template type is determined as the interactive intention of the target object.
[0057] For example, the template type can correspond to weather, time, location, etc., and the semantic information indicated by the template type can be inquiring about weather, inquiring about time, inquiring about location, etc.
[0058] In order to better understand the process of the above semantic understanding template generation method, the implementation method flow of the above semantic understanding template generation will be described in combination with optional embodiments below, but not used to limit the technical solutions of the embodiments of the present application.
[0059] In the embodiment, a semantic understanding template generation method is provided, Figure 3 is a schematic diagram of a concept network according to an embodiment of the present application (one), as Figure 3 shown, the specific steps are as follows:
[0060] Step S301: constructing a concept network.
[0061] For example, the concept network can be constructed using the dictionary data provided by the Zhi Network, as Figure 3 shown, the concept network contains a plurality of groups of nodes and edges having a connection relationship, the node represents an entity, and the edge represents the association relationship between different nodes, that is Figure 3 “is A” in the above. In Figure 3 , for the center node Semantic, the node “Action” (equivalent to the above first root node) having the association relationship can be determined, and then the node “close: Turn off” (representing a label element, equivalent to the above first leaf node) associated with the node “Action” is determined.
[0062] Step S302: training a neural network model for mining the concept relationship between the entity word and the entity word label.
[0063] In this step, the voice interaction data of the user is collected, the entity word in the voice interaction data and the corresponding entity word label are labeled, the labeled data is determined as a training sample, and a deep learning model (LSTM+CRF) is trained.
[0064] For example, the following can be marked:
[0065] Example 1:
[0066] “hit”→“B-action: TurnOn”;
[0067] “on” -> “I-action: TurnOn”;
[0068] “one” -> “O”;
[0069] “down” -> “O”;
[0070] “guest” -> “B-room: LivingRoom”;
[0071] “hall” -> “I-room: LivingRoom”;
[0072] “of” -> “O”;
[0073] “empty” -> “B-device: AirConditioner”;
[0074] “adjust” -> “I-device: AirConditioner”.
[0075] Example 2:
[0076] “wash” -> “B-room: Washroom”;
[0077] “mouth” -> “I-room: Washroom”;
[0078] “room” -> “I-room: Washroom”;
[0079] “of” -> “O”;
[0080] “hot” -> “B-device: Heater”;
[0081] “water” -> “I-device: Heater”;
[0082] “device” -> “I-device: Heater”;
[0083] “give” -> “O”;
[0084] “me” -> “O”;
[0085] “off” -> “B-action: TurnOff”;
[0086] “on” -> “I-action: TurnOff”.
[0087] Step S303: obtaining the entity word label corresponding to the entity word using the model trained in step S302.
[0088] Further, the obtained entity words and entity word labels can be audited by human beings, and the audited entity words and entity word labels can be fused with the concept network constructed in step S301. As shown in FIG. 3, the nodes “balcony” and “entrance hall” represented by the dashed boxes are newly added nodes. Figure 4
[0089] Step S304: generating a semantic understanding template based on the concept network.
[0090] The corpus (i.e., the voice interaction data described above) is segmented, and entity words in the corpus are obtained. The leaf nodes corresponding to the entity words are matched in the concept network. If the matching is successful, the label (i.e., the second label element described above) indicated by the root node associated with the leaf node is obtained, the entity word is replaced with the label indicated by the root node, and a semantic understanding template is generated.
[0091] If the matching fails, the entity word label corresponding to the entity word is obtained using a neural network model, the entity word is replaced with the newly obtained entity word label, a semantic understanding template is generated, and the concept network is supplemented with the newly obtained entity word and entity word label.
[0092] For example, the process of generating a semantic understanding template is as follows:
[0093] Example 1:
[0094] “Turn on the air conditioner in the living room”→==>→“{action: TurnOn} the {room: LivingRoom}’s {device: AirConditioner}”.
[0095] Example 2:
[0096] “Turn off the heater in the washroom for me”→==>→“{room: Washroom}’s {device: Heater} for me {action: TurnOff}”.
[0097] Step S305: stop word replacement.
[0098] For the semantic understanding template generated in step S304, there can be stop words that do not affect semantics and are not replaced. For these stop words, stop word labels in a general stop word table can be used for replacement, thereby further improving the generalization ability of the semantic understanding template.
[0099] For example, for example 2:
[0100] "Turn off the heater in the washroom for me" -> == > "{room: Washroom} of {device: Heater} {action: TurnOff} for me" -> == > "{room: Washroom} of {device: Heater} {stopword: Please} {action: TurnOff}".
[0101] Step S306: If there are multiple semantic understanding templates, and there are characters in the multiple semantic understanding templates that have not been replaced by stop word tags (i.e., the above shared field), multiple characters that have not been replaced by stop word tags can be found, the strings corresponding to these characters are merged into a regular expression, and then the regular expression is used to replace the characters replaced by stop word tags in the multiple semantic understanding templates.
[0102] For example: the string "{room: Washroom} of {device: Heater} {stopword: Please} {action: TurnOff}", the string "{room: Washroom} of {device: Heater} now {stopword: Please} {action: TurnOff}", and the string "{room: Washroom} of {device: Heater} now just {stopword: Please} {action: TurnOff}" can be merged into == > "{room: Washroom} of {device: Heater} now just {stopword: Please} {action: TurnOff}".
[0103] Through the above steps, the semantic understanding template can be automatically generated, the stop words of the generated semantic understanding template are replaced, and the regular expression replacement is further performed on the semantic understanding template after replacing the stop words, which improves the generalization ability of the semantic understanding template and further improves the recognition accuracy of the interactive intention of the user.
[0104] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software on a general hardware platform as necessary, and of course, can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product in essence or in the form of a part of the prior art that makes a contribution. The computer software product is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, or a network device) to execute the method of each embodiment of the present application.
[0105] Figure 5 is a structural block diagram of a semantic understanding template generation device according to an embodiment of the present application; as shown in Figure 5 , comprising:
[0106] A first generation module 52 is configured to generate a concept network according to historical voice interaction data of an intelligent device, wherein the concept network is configured to store entity relationships between entity words and entity word labels;
[0107] A word obtaining module 54 is configured to identify voice interaction data received by the intelligent device to obtain target entity words contained in the voice interaction data;
[0108] A second generation module 56 is configured to obtain a target entity word label corresponding to the target entity words from the concept network, and generate a target semantic understanding template using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is an interactive intent of a target object.
[0109] Further, the word obtaining module 54 can be used to determine whether the target entity words belong to the pre-stored entity words of the concept network. After the word obtaining module 54 determines that the target entity words belong to the pre-stored entity words of the concept network, the second generation module 56 continues to perform the following steps: obtaining a target entity word label corresponding to the target entity words from the concept network, and generating a target semantic understanding template using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is an interactive intent of a target object.
[0110] By the above device, a concept network for storing entity word and entity word label is generated according to historical voice interaction data of the intelligent device; voice interaction data received by the intelligent device is recognized to obtain a target entity word contained in the voice interaction data; a target entity word label corresponding to the target entity word is obtained from the concept network, and a target semantic understanding template is generated using the target entity word label, wherein the semantic information corresponding to the target semantic understanding template is an interactive intent of a target object; by using the above technical solution, the technical problem of how to improve the understanding accuracy of the interactive intent of the user is solved, and the understanding accuracy of the interactive intent of the user is improved.
[0111] In an example embodiment, the first generation module 52 is further configured to: obtain historical voice interaction data of the target object and the intelligent device; group the historical voice interaction data according to interaction types to obtain a plurality of groups of interaction data, wherein each group of interaction data of the plurality of groups of interaction data includes a first label element for representing an entity word in the each group of interaction data, the first label element being recognized by a neural network model according to the entity word; based on a center node pre-set for the concept network, set a second label element for representing an interaction type of the each group of interaction data as a first root node associated with the center node, and set the first label element contained in the each group of interaction data as a first leaf node associated with the first root node, to generate the concept network.
[0112] For example, the interaction type of each group of interaction data includes at least one of a place, an interaction device, and an interaction action. Figure 3 For example, the place can be "room", the interaction device can be "device", and the interaction action can be "action", but is not limited thereto.
[0113] In an example embodiment, the first generation module 52 further includes a training unit configured to perform the following implementation steps: step S11, parsing a plurality of voice interaction sentences from the historical voice interaction data; step S12, determining entity word labels pre-labeled for entity words of the plurality of voice interaction sentences; step S13, determining the entity words of the plurality of voice interaction sentences and the entity word labels as training samples, and training the neural network model using the training samples, wherein the trained neural network model is used to recognize the entity word labels corresponding to the entity words.
[0114] In an example embodiment, the training unit is further configured to: input the target entity word included in the voice interaction data into the trained neural network model; determine an output result of the trained neural network model, wherein the output result includes a target entity word label corresponding to the target entity word; and update the concept network according to the interaction type of the voice interaction data.
[0115] In an example embodiment, the training unit is further configured to: search for a preset entity word corresponding to the target entity word label from a first preset word library, wherein the first preset word library stores different entity words corresponding to the target entity word label; and in a case where the target entity word is consistent with the preset entity word, set the interaction type of the voice interaction data as a second root node associated with the center node, set the target entity word label corresponding to the target entity word as a second leaf node associated with the second root node, and update the concept network.
[0116] In an example embodiment, the second generation module 56 is further configured to: replace the target entity word included in the voice interaction data with the target entity word label; determine a first combination order of the target entity word label according to a first occurrence order of the target entity word in the voice interaction data; and sequentially combine the plurality of target entity word labels according to the first combination order to obtain the target semantic understanding template.
[0117] In an example embodiment, the second generation module 56 is further configured to: in a case where the voice interaction data includes a non-entity word, obtain a stop word corresponding to the non-entity word from a second preset word library; replace the non-entity word included in the voice interaction data with the stop word; determine a second combination order of the stop word according to a second occurrence order of the non-entity word in the voice interaction data; obtain an intermediate result of sequentially combining the plurality of target entity word labels according to the first combination order, and combine the stop word with the intermediate result according to the second combination order to obtain the target semantic understanding template.
[0118] Based on the above embodiments, in a case where the target entity word label corresponding to the target entity word fails to be obtained from the concept network, the trained neural network model can be used to identify the target entity word label corresponding to the target entity word, and then the target entity word label is used to replace the target entity word to obtain the target semantic understanding template.
[0119] In an example embodiment, further, the second generation module 56 is further configured to: acquire a stop word in the target semantic understanding template; acquire a stop word label corresponding to the stop word from a third preset word library, in a case where the third preset word library contains the stop word; and replace the stop word in the target semantic understanding template with the stop word label, to obtain a first semantic understanding template.
[0120] In an example embodiment, further, the second generation module 56 is further configured to, after acquiring the stop word in the target semantic understanding template, replace the stop word in the target semantic understanding template with a stop word backup label carried in feedback information sent by the target object based on prompt information, to obtain a second semantic understanding template, in a case where the third preset word library does not contain the stop word.
[0121] In an example embodiment, further, the second generation module 56 is further configured to, after replacing the stop word in the target semantic understanding template with the stop word label to obtain the first semantic understanding template, for the first semantic understanding template, determine other words in the first semantic understanding template that are not replaced by the stop word label, generate a word regular expression corresponding to the other words, and replace the other words in the first semantic understanding template with the word regular expression, to obtain a third semantic understanding template; in a case where there are multiple third semantic understanding templates, determine multiple groups of other words, acquire a common field in the multiple groups of other words, generate a field regular expression of the common field; and replace the common field in the multiple third semantic understanding templates with the field regular expression.
[0122] Further, for the process of replacing the common field in the multiple third semantic understanding templates with the field regular expression, the process specifically includes: for each of the multiple third semantic understanding templates, replacing the common field in the each third semantic understanding template with the field regular expression.
[0123] Optionally, after replacing the common field in the multiple third semantic understanding templates with the field regular expression, the multiple third semantic understanding templates after replacement can be determined as a group of semantic understanding templates, a template type of the group of semantic understanding templates can be acquired, and semantic information indicated by the template type can be determined as an interactive intention of the target object.
[0124] For example, the template type can correspond to weather, time, location, etc., and the semantic information indicated by the template type can be, for example, asking about the weather, asking about the time, asking about the location, etc.
[0125] Embodiments of the present application also provide a storage medium comprising a stored program, wherein the program performs any of the above methods when executed.
[0126] Optionally, in the embodiment, the storage medium can be configured to store program code for performing the following steps:
[0127] S1, generating a concept network according to historical voice interaction data of a smart device, wherein the concept network is used to store entity relationships between entity words and entity word labels;
[0128] S2, identifying voice interaction data received by the smart device to obtain target entity words contained in the voice interaction data;
[0129] S3, obtaining a target entity word label corresponding to the target entity word from the concept network, and generating a target semantic understanding template using the target entity word label, wherein semantic information corresponding to the target semantic understanding template is an interaction intent of a target object.
[0130] Embodiments of the present application also provide an electronic device comprising a memory and a processor, the memory storing a computer program, and the processor being configured to execute the computer program to perform the steps in any of the above method embodiments.
[0131] Optionally, the electronic device can further comprise a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0132] Optionally, in the embodiment, the processor can be configured to execute the following steps through the computer program:
[0133] S1, generating a concept network according to historical voice interaction data of a smart device, wherein the concept network is used to store entity relationships between entity words and entity word labels;
[0134] S2, identifying voice interaction data received by the smart device to obtain target entity words contained in the voice interaction data;
[0135] S3, obtaining a target entity word label corresponding to the target entity word from the concept network, and generating a target semantic understanding template using the target entity word label, wherein semantic information corresponding to the target semantic understanding template is an interaction intent of a target object.
[0136] Optionally, in the embodiment, the storage medium can include, but is not limited to, a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various storage medium capable of storing program codes.
[0137] Optionally, the specific examples in the embodiment can refer to the examples described in the above embodiments and optional implementation manners, and the embodiment will not be described here.
[0138] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be realized by a general computing device, which can be concentrated on a single computing device or distributed on a network composed of multiple computing devices, and optionally, they can be realized by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in different order, or they can be manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module to realize. Thus, the present application is not limited to any specific hardware and software combination.
[0139] The above only describes the preferred embodiments of the present application, and it should be noted that those skilled in the art can make several improvements and refinements without departing from the principles of the present application, and these improvements and refinements should be regarded as the protection scope of the present application.
Claims
1. A method for generating a semantic understanding template, characterized in that, The method comprises: generating a concept network according to historical voice interaction data of the intelligent device, wherein the concept network is used to store entity relationships between entity words and entity word labels; recognizing voice interaction data received by the intelligent device to obtain target entity words contained in the voice interaction data; replacing the target entity words with target entity word labels to generate a target semantic understanding template using the target entity word labels, wherein the semantic information corresponding to the target semantic understanding template is an interaction intent of a target object, and the target entity words belong to entity words pre-stored in the concept network; generating a concept network according to historical voice interaction data of an intelligent device, comprising: grouping the historical voice interaction data according to interaction types to obtain multiple groups of interaction data, wherein each group of interaction data of the multiple groups of interaction data comprises a first label element used to represent entity words in the each group of interaction data, and the first label element is recognized by a neural network model according to the entity words in the each group of interaction data; based on a center node pre-set for the concept network, setting a second label element used to represent an interaction type of the each group of interaction data as a first root node associated with the center node, and setting the first label element contained in the each group of interaction data as a first leaf node associated with the first root node, to generate the concept network.
2. The method of claim 1, wherein, Before grouping the historical voice interaction data according to interaction types to obtain multiple groups of interaction data, the method further comprises: parsing multiple voice interaction sentences from the historical voice interaction data; determining entity word labels pre-annotated for entity words of the multiple voice interaction sentences; determining the entity words of the multiple voice interaction sentences and the entity word labels as training samples, and training the neural network model using the training samples, wherein the trained neural network model is used to recognize entity word labels corresponding to the entity words.
3. The method of claim 2, wherein, After training the neural network model using the training samples, the method further comprises: inputting target entity words contained in the voice interaction data into the trained neural network model; determining an output result of the trained neural network model, wherein the output result contains a target entity word label corresponding to the target entity words; updating the concept network according to the interaction type of the voice interaction data.
4. The method of claim 3, wherein, Updating the concept network according to the interaction type of the voice interaction data comprises: finding a pre-set entity word corresponding to the target entity word label from a first pre-set word library; wherein the first pre-set word library stores different entity words corresponding to the target entity word label; in a case where the target entity word is consistent with the pre-set entity word, setting the interaction type of the voice interaction data as a second root node associated with the center node, and setting the target entity word label corresponding to the target entity word as a second leaf node associated with the second root node, to update the concept network.
5. The method of claim 1, wherein, Generating a target semantic understanding template using the target entity word label comprises: determine a first combination order of the target entity word labels according to a first occurrence order of the target entity words in the voice interaction data; sequentially combine the target entity word labels according to the first combination order to obtain the target semantic understanding template.
6. The method of claim 5, wherein, sequentially combine the target entity word labels according to the first combination order to obtain the target semantic understanding template, comprising: in a case where it is determined that the voice interaction data contains non-entity words, obtaining a stop word corresponding to the non-entity words from a second preset word library; replacing the non-entity words contained in the voice interaction data with the stop words; determining a second combination order of the stop words according to a second occurrence order of the non-entity words in the voice interaction data; obtaining an intermediate result of sequentially combining the target entity word labels according to the first combination order, and combining the stop words with the intermediate result according to the second combination order to obtain the target semantic understanding template.
7. The method of claim 1, wherein, after using the target entity word labels to generate the target semantic understanding template, the method further comprises: obtaining a stop word in the target semantic understanding template; in a case where it is determined that the third preset word library contains the stop word, obtaining a stop word label corresponding to the stop word from the third preset word library; using the stop word label to replace the stop word in the target semantic understanding template to obtain a first semantic understanding template.
8. The method of claim 7, wherein, after obtaining the stop word in the target semantic understanding template, the method further comprises: in a case where it is determined that the third preset word library does not contain the stop word, sending prompt information containing the stop word to the target object; in a case where feedback information sent by the target object based on the prompt information is received, using a stop word backup label carried by the feedback information to replace the stop word in the target semantic understanding template to obtain a second semantic understanding template.
9. The method of claim 7, wherein, after using the stop word label to replace the stop word in the target semantic understanding template to obtain a first semantic understanding template, the method further comprises: determining other words in the first semantic understanding template that are not replaced by the stop word label, generating a word regular expression corresponding to the other words, and using the word regular expression to replace the other words in the first semantic understanding template to obtain a third semantic understanding template; in a case where there are multiple third semantic understanding templates, determining multiple groups of other words, obtaining a common field in the multiple groups of other words, and generating a field regular expression of the common field; using the field regular expression to replace the common field of multiple third semantic understanding templates.
10. A computer readable storage medium, characterized in that, The computer readable storage medium comprises a stored program, wherein the program executes the method described in any one of claims 1 to 9 when running. 11.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 by using the computer program.
Citation Information
Patent Citations
Semantic comprehension method, device and equipment and storage medium
CN111814487A
Query information processing method and device, storage medium and electronic device
CN111831911A