Text association method and refrigeration equipment
Through the entity and entity correlation in the text knowledge graph, the problem of lack of hierarchy and priority in the existing text association methods is solved, and more accurate and efficient text association query is achieved, improving user experience and work efficiency.
Patent Information
- Application Number
- CN202310770276.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2024-12-27
AI Technical Summary
The existing text association methods lack hierarchy and priority settings when processing text data, resulting in the inability to give corresponding responses accurately and efficiently, and are cost-effective.
Using the hierarchy and correlation between entities in the text knowledge graph, we can identify the intention and slot information of text data, traverse and match the association rules, and use the knowledge graph to find entities and entity relationships to achieve more accurate query functions.
It improves the accuracy and user experience of text associations, simplifies the expansion and maintenance of knowledge graphs, reduces the workload of adding new text entities or entity relationships, and meets the granularity of associations that meet different needs.
Smart Images

Figure CN119202263A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer technology, and in particular to a text association method and refrigeration equipment. Background Art
[0002] The text association method is a technique in the field of natural language processing that is used to automatically infer possible related words based on input text data. The text association method is widely used, especially in smart home appliances such as refrigerators, for example, the food ingredient query association question of the refrigerator voice assistant.
[0003] The so-called ingredient query association is an application that uses text association methods in queries about ingredients. When a user searches for ingredients, the association method can automatically provide users with suggestions related to the ingredients they entered. For example, a user asks "Is there any fruit in the refrigerator?" There is no ingredient called "fruit" in the refrigerator, but there are apples and oranges, which belong to the specific subcategory of fruit. At this time, the refrigerator can infer that apples and oranges meet the user's query requirements and can report that there are apples and oranges in the refrigerator. For example, a user asks "Is there any Telunsu in the refrigerator?" There is no ingredient called "Telunsu" in the refrigerator, but there is another drink called "Daily Fresh Words" in the refrigerator that belongs to the same category of milk. In this way, ingredient association requires the voice assistant to be able to infer from Telunsu that this is a drink belonging to the milk category, and "Daily Fresh Words" belongs to the same category of ingredients. When the voice assistant reports that there is no Telunsu, it must also report the same kind of Daily Fresh Words. This can better help users find the ingredients they want and improve the user experience.
[0004] At present, the text association method can be used in the following two ways: one is to query the word relationship table and query whether the ingredients required by the user are in a certain relationship based on the mapping relationship in the table. This method requires a separate table for each type of relationship, which is repetitive and lacks hierarchy. The second is the labeling method, that is, to attach various labels to each type of ingredient in the knowledge base, such as labeling apples as "fruit, temperate fruit" and so on, and labeling Telun soda as "Mengniu, milk, etc.". By comparing the labels, it is determined whether there is a common label or one is the label of another. Because the labels are parallel, it is not easy to set priorities for this method, and the degree of intelligence and work efficiency are low. Summary of the invention
[0005] One of the purposes of the present invention is to provide a text association method to solve the technical problems that the text data processed by the text association method in the prior art lacks hierarchy and priority setting, has low cost performance, and cannot accurately and efficiently give effective responses corresponding to the text data.
[0006] One of the objects of the present invention is to provide a refrigeration device.
[0007] In order to achieve one of the above-mentioned purposes of the invention, the present invention provides a text association method, comprising: identifying text data to obtain at least a first text intent and a first slot information; when the first text intent and the first slot information meet the formal conditions, traversing and matching to obtain a first text association rule corresponding to the text data; executing the first text association rule in a text knowledge graph to obtain first text association information; wherein the text knowledge graph records text entity attributes and / or association relationships between text entities.
[0008] As a further improvement of an embodiment of the present invention, the associative matching rule records the operation method and / or operation steps for retrieving different entities and the relationships between different entities in the text knowledge graph.
[0009] As a further improvement of an embodiment of the present invention, the text data includes at least one of original text data, voice text data and video text data.
[0010] As a further improvement of an embodiment of the present invention, the "identifying text data and obtaining at least a first text intent and a first slot information" specifically includes: based on a text intent classification model, identifying a first text intent corresponding to the text data; according to the first text intent, screening and extracting the slot information of the text data to obtain the first slot information.
[0011] As a further improvement of an embodiment of the present invention, the "identifying the first text intent corresponding to the text data based on a text intent classification model" specifically includes: constructing the text intent classification model; extracting text features corresponding to the text data, and inputting the text features into the text intent classification model to obtain the first text intent.
[0012] As a further improvement of an embodiment of the present invention, before the "when the first text intention and the first slot information meet the formal conditions, traverse and match to obtain the first text association rule corresponding to the text data", the method also includes: determining whether the first text intention falls within the preset text intention range; if so, querying the first slot database corresponding to the first text intention according to the first slot information, and determining whether the first slot information matches at least one of the slot data; if the first slot information does not match any of the slot data in the first slot database, determining that the first text intention and the first slot information meet the formal conditions.
[0013] As a further improvement of an embodiment of the present invention, the preset text intent range records all text intents that the device can support analysis, the first slot database records a number of slot data pointing to the contents contained in the device; the text knowledge graph includes a number of text entities corresponding to all the slot data respectively.
[0014] As a further improvement of an embodiment of the present invention, the "traversing and matching to obtain a first text association rule corresponding to the text data" specifically includes: querying the association matching rule according to the first text intent, and determining whether the first text intent matches the text intent in the first query result; if so, querying the slot information in the first query result according to the first slot information, and obtaining a second query result as the first text association rule.
[0015] As a further improvement of an embodiment of the present invention, the "executing the first text association rule in the text knowledge graph to obtain the first text association information" specifically includes: determining the first text entity and the first entity relationship corresponding to the first slot information according to the first text association rule; searching the text knowledge graph according to the first text entity and the first entity relationship to obtain the third graph entity corresponding to the first text entity; wherein the first entity relationship exists between the third graph entity and the first text entity; determining the second text entity and the second entity relationship according to the first text association rule; wherein the second text entity corresponds to several slot data of the content contained in the device; searching the text knowledge graph according to the second text entity and the second entity relationship in turn to obtain the fourth graph entity corresponding to the second text entity; wherein there is an association relationship between the fourth graph entity and the second text entity; determining the first text association information according to the third graph entity and the fourth graph entity.
[0016] As a further improvement of an embodiment of the present invention, the "searching the text knowledge graph according to the first text entity and the first entity relationship to obtain a third graph entity corresponding to the first text entity" specifically includes: querying the text knowledge graph according to the first text entity, and determining whether the first text entity matches at least one of the query results; if not, querying the text knowledge graph according to the first text entity to obtain a first graph entity; wherein the first graph entity corresponds to the first text entity; querying the text knowledge graph according to the first entity relationship and the first graph entity, and screening to obtain the third graph entity.
[0017] As a further improvement of an embodiment of the present invention, the "querying the text knowledge graph according to the first text entity to obtain the first graph entity" specifically includes: obtaining an alias attribute list for each text entity in the text knowledge graph; wherein the alias attribute list represents an alias or synonym of the entity, which includes a number of alias attribute values; traversing the alias attribute list, matching each alias attribute value with the first text entity in turn, and determining the first graph entity in the text knowledge graph according to the matching results.
[0018] As a further improvement of an embodiment of the present invention, the "searching the text knowledge graph according to the second text entity and the second entity relationship in turn to obtain a fourth graph entity corresponding to the second text entity" specifically includes: traversing the slot data of the content contained in the device to obtain a number of second text entities; querying the text knowledge graph according to each second text entity in turn, and determining whether the second text entity matches at least one of the query results; if not, traversing and searching the alias attribute list of the knowledge graph according to the second text entity to match and obtain the second graph entity; wherein the second graph entity corresponds to the second text entity; querying the text knowledge graph according to the second graph entity and the second entity relationship to filter and obtain the fourth graph entity.
[0019] As a further improvement of an embodiment of the present invention, the "confirming the first text association information based on the third graph entity and the fourth graph entity" specifically includes: determining whether the third graph entity and the fourth graph entity are equal; if so, filling in the text association response template corresponding to the first text association rule according to the third graph entity and the fourth graph entity to obtain the first text association information.
[0020] As a further improvement of an implementation mode of the present invention, the association relationship includes at least one of a parent-child relationship, a genus-species relationship, an attribute relationship, an inclusion relationship, and a subordinate relationship.
[0021] As a further improvement of an embodiment of the present invention, before "traversing the matching to obtain the first text association rule corresponding to the text data", the method also includes: determining the priority of each matching rule; using a domain-specific language, setting the execution order for each matching rule in the association matching rules in turn according to the priority, so as to set the priorities of several matching rules.
[0022] As a further improvement of an embodiment of the present invention, the "using a domain-specific language to set the execution order for each matching rule in the associative matching rules in sequence according to the priority" specifically includes: defining the associative matching rules in order from high to low priority, and the domain-specific language executes the matching operation in the order defined by the associative matching rules; and / or, setting priority keywords for the associative matching rules, and executing the matching operation in the priority order marked by the keywords.
[0023] To achieve one of the above-mentioned purposes of the invention, the present invention further provides a refrigeration device, comprising: a memory for storing executable instructions; and a processor for implementing the steps of any of the above-mentioned text association methods when running the executable instructions stored in the memory.
[0024] Compared with the prior art, the embodiments of the present invention have at least one of the following beneficial effects:
[0025] The present invention adopts a text association method. When the text intent and slot information of the text data meet the formal conditions, the matching association rules are traversed, and the hierarchical and relevance between entities in the text knowledge graph are used to help realize a more accurate query function and improve the accuracy of the association information; in addition, the expansion of the knowledge graph only needs to consider the newly added triple information, which greatly improves the reuse rate of historical work and reduces the workload of adding new text entities or entity relationships. Furthermore, based on the association matching rules, the granularity of the match can be controlled by the rule definition, and association can be performed from a more generalized or more refined perspective to meet different needs and improve the user experience effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a schematic diagram of the steps of a text association method in one embodiment of the present invention.
[0027] Figure 2 It is a partial schematic diagram of step S1 of the text association method in one embodiment of the present invention.
[0028] Figure 3 It is a partial schematic diagram of step S2 of the text association method in one embodiment of the present invention.
[0029] Figure 4 It is a partial schematic diagram of step S2 of the text association method in one embodiment of the present invention.
[0030] Figure 5 It is a partial schematic diagram of step S2 of the text association method in one embodiment of the present invention.
[0031] Figure 6 It is a partial schematic diagram of step S3 of the text association method in one embodiment of the present invention.
[0032] Figure 7 It is a partial schematic diagram of step S3 of the text association method in one embodiment of the present invention.
[0033] Figure 8 It is a partial schematic diagram of step S3 of the text association method in one embodiment of the present invention.
[0034] Fig. 9 It is a partial schematic diagram of step S3 of the text association method in one embodiment of the present invention.
[0035] Fig.10 It is a structural diagram of a text knowledge graph of a preferred embodiment of a text association method in one implementation of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be described in detail below in conjunction with the specific embodiments shown in the accompanying drawings. However, these embodiments do not limit the present invention, and any structural, methodological, or functional changes made by a person skilled in the art based on these embodiments are all within the scope of protection of the present invention.
[0037] It should be noted that the term "comprises" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In addition, the terms "first", "second", "third", "fourth", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0038] The so-called text association aims to automatically infer the response that is closest to the input text data. Take the food query association of the refrigerator voice assistant as an example. When the user makes a food request, the food the user mentioned does not exist in the refrigerator, but there are related ingredients. The refrigerator voice assistant can successfully identify this association and respond accordingly to better help users find the ingredients they want. Therefore, in the field of natural language processing, text association has a relatively important practical significance.
[0039] Based on this, the present invention provides a text association method, such as Figure 1 As shown, the specific steps include:
[0040] Step S1, identifying text data to obtain at least a first text intent and first slot information.
[0041] Step S2: when the first text intention and the first slot information meet the formal condition, traverse and match to obtain a first text association rule corresponding to the text data.
[0042] Step S3, executing the first text association rule in the text knowledge graph to obtain first text association information.
[0043] In this way, when the text intent and slot information of the text data meet the formal conditions, the matching association rules are traversed, and the hierarchy and correlation between entities in the text knowledge graph are used to help achieve more accurate query functions and improve the accuracy and adaptability of text association.
[0044] Among them, in one embodiment, the text knowledge graph records text entity attributes; in one embodiment, the text knowledge graph records the association relationship between text entities. In a preferred embodiment, the above two real-time methods can be included at the same time, that is, the text knowledge graph records text entity attributes and the association relationship between text entities.
[0045] In the text knowledge graph, the association relationship may include at least one of a parent-child relationship, a genus-species relationship, an attribute relationship, an inclusion relationship, and a subordinate relationship. In this way, by including multiple attribute relationships, the comprehensiveness and generalization ability of subsequent text associations can be improved.
[0046] In addition, the associative matching rules may record the operation methods and / or operation steps for retrieving different entities and the relationships between different entities in the text knowledge graph. For example, selecting the starting entity, determining the length of the reasoning path (similar to the process of obtaining another entity by executing a certain association relationship or several association relationships for an entity), and the associative matching rules may be adaptively defined according to actual needs.
[0047] In this way, by defining associative matching rules, they can be reused in the same application or different applications, and multiple rules can be combined for use, which is highly flexible.
[0048] Optionally, for step S1, the text data includes original text data, voice text data, and video text data.
[0049] In this way, by obtaining text data of different structural types, the first text data is made more complete, comprehensive and diversified; in addition, by connecting different types of text information together, the text content can be enriched from the aspects of multi-structure and multi-type of data.
[0050] like Figure 2 As shown, step S1 may specifically include:
[0051] Step S11: identifying a first text intent corresponding to the text data based on a text intent classification model.
[0052] Step S12: Filter and extract the slot information of the text data according to the first text intent to obtain the first slot information.
[0053] In this way, the slot information related to the first text intent can be extracted in a targeted manner, avoiding the extraction of too much unnecessary redundant information, improving work efficiency, and making the slot information finally extracted more accurate.
[0054] Furthermore, in one implementation, step S11 may further specifically include:
[0055] Step S111, constructing the text intent classification model.
[0056] Step S112: extract text features corresponding to the text data, and input the text features into the text intent classification model to obtain the first text intent.
[0057] In this way, by building a classification model, the semantic intent expressed by the input text can be automatically determined, which is conducive to achieving more accurate slot extraction in the future.
[0058] Exemplarily, in this embodiment, taking the food query association in the smart refrigerator as an example, when the user makes a food request, the association may be triggered only when certain preset conditions are met. For example, the requested ingredient does not exist in the current refrigerator, but there are other ingredients in the refrigerator that are related to the requested ingredient, or the intention issued by the user requires association. At this time, the association is of practical significance.
[0059] Based on this, Figure 3 As shown, before step S2, the text association method may further include:
[0060] Step P211, determining whether the first text intent is within a preset text intent range.
[0061] If so, jump to step P212, query the first slot database corresponding to the first text intent according to the first slot information, and determine whether the first slot information matches at least one slot data therein.
[0062] Step P213: If the first slot information does not match the slot data in the first slot database, it is determined that the first text intent and the first slot information meet the form condition.
[0063] In this way, by judging whether the text data meets the formal conditions before matching and executing the association rules, some redundant information can be filtered out, thereby improving the execution efficiency of the association matching rules and the accuracy of text association.
[0064] Among them, the preset text intent range records all text intents that the device can support analysis, the first slot database records a number of slot data pointing to the contents contained in the device; and the text knowledge graph includes a number of text entities corresponding to all slot data respectively.
[0065] It should be noted that in one implementation, whether the formal condition is met can be determined from two aspects. On the one hand, it is determined whether the text intent corresponding to the text data falls within the preset text intent range; on the other hand, it is determined whether the slot information corresponding to the text data is in the first slot database. Only when both of these aspects are met can the association matching rule be executed.
[0066] Specifically, in this embodiment, taking the smart refrigerator as an example, the preset text intent range records all text intents obtained after the intent recognition of all ingredients in the refrigerator, which can be understood as a major intent category, such as ingredient query, recipe recommendation, ingredient expiration judgment, etc. When executing rule matching later, the association rule to be executed will be further matched according to the intent subcategory corresponding to the text data, and the correspondence between the intent subcategory and the intent major category can be determined through a mapping table. Therefore, before executing the association rule matching, it is necessary to determine whether the major intent category corresponding to the text data is within the preset intent range. In addition, it is also necessary to determine whether the slot information corresponding to the text data exists in the refrigerator, such as "Is there an apple in the refrigerator?" At present, there is no slot information "apple" in the refrigerator, but there is "orange". The association relationship between apples and oranges can be established based on the knowledge graph later. In addition, the first slot database can correspond to the ingredients stored in the refrigerator. In other words, the slot information of the text data can be determined by querying the first slot database.
[0067] The text knowledge graph is a knowledge representation and organization method based on text data. It extracts information such as entities, relationships and attributes from the text, and stores and represents the associations between them in the form of a graph, thereby presenting the knowledge structure and semantic associations in the text data. Specifically, the text data is represented as a knowledge network and stored through the knowledge representation form of triple units (such as entity-relationship-entity, entity-attribute-attribute value, etc.). In the present invention, the text knowledge graph does not depend on the food information stored in the refrigerator. It can also contain several other text entities, several association relationships and several attribute values in addition to all the food information in the refrigerator.
[0068] In actual application, text association may have a priority, for example, in food association, the sub-category of food used for the query food may be searched first, and then the same category of food. Based on actual business needs, the present invention may also pre-set the priority of the association matching rule before defining the matching rule.
[0069] Specifically, if Figure 4 As shown, before the step of "traversing and matching to obtain a first text association rule corresponding to the text data" in step S2, the text association method may further include:
[0070] Step P221, determine the priority of each matching rule.
[0071] Step P222, using a domain specific language, sets the execution order for each matching rule in the associative matching rules in turn according to the priority, so as to set the priority of several matching rules.
[0072] In this way, by setting priorities for the association matching rules, the accuracy of the association matching can be improved and the response speed can be increased; it can also simplify the management and maintenance of the rules and support diverse association content.
[0073] Specifically, in one implementation, the associative matching rules are defined in order from high to low priority, and the domain-specific language performs matching operations in the order defined by the associative matching rules; in one implementation, priority keywords are set for the associative matching rules, and matching operations are performed in the order of priority marked by the keywords.
[0074] In a preferred embodiment, the above two embodiments may be included at the same time, that is, the order of matching rules and the priority keyword tags may be combined, and the priority may be determined according to the order of rules and taking the keyword tags into consideration.
[0075] The domain-specific language (DSL) is a computer programming language that is specifically targeted at a certain domain and has limited expressiveness. On the one hand, the sequential execution of the code corresponds to the control flow and execution order of the program. On the other hand, the strict order of the code can be set by setting priority keywords.
[0076] like Figure 5 As shown, in one embodiment, when the first text intention and the first slot information corresponding to the text data meet the preset conditions, the present invention provides a detailed step for the "traversing and matching to obtain the first text association rule corresponding to the text data" part in step S2, which may specifically include:
[0077] Step S21, querying the association matching rule according to the first text intent, and determining whether the first text intent matches the text intent in the first query result.
[0078] If yes, the process jumps to step S22, and searches for slot information in the first query result according to the first slot information to obtain a second query result as the first text association rule.
[0079] In this way, the association matching rules are matched by matching the text intent and the slot information, which is simple and easy to understand and can quickly locate the association matching rules that meet the conditions.
[0080] Among them, the first text intent can be understood as an intent subcategory under a certain intent category of the text data, which is used to query one of the conditions of the associative matching rule. For example, "Are there apples in the refrigerator?" The corresponding intent subcategory can be considered as "querying the existence of items", and the corresponding intent category can be considered as "item query". Therefore, in this embodiment, the main purpose of the text data is to query whether there are apples in the refrigerator, that is, the intent subcategory describes whether a certain item (apple) exists in a certain place (refrigerator); and the intent category more broadly covers the overall demand for querying items.
[0081] like Figure 6 As shown, in one implementation, step S3 may specifically include:
[0082] Step S31: determining the first text entity and the first entity relationship corresponding to the first slot information according to the first text association rule.
[0083] Step S32: searching the text knowledge graph according to the first text entity and the first entity relationship to obtain a third graph entity corresponding to the first text entity.
[0084] Step S33: determining a second text entity and a second entity relationship according to the first text association rule.
[0085] Step S34, searching the text knowledge graph according to the second text entity and the second entity relationship in turn, to obtain a fourth graph entity corresponding to the second text entity; wherein there is an association relationship between the fourth graph entity and the second text entity.
[0086] Step S35: determining the first text association information according to the third graph entity and the fourth graph entity.
[0087] Among them, the first entity relationship exists between the third graph entity and the first text entity; the second text entity corresponds to a number of slot data of the contents contained in the device.
[0088] In this way, the text knowledge graph is searched according to the associative matching rule to determine the associative information corresponding to the text data. This method is simple and easy to understand, and can achieve a more accurate entity query function according to the hierarchical relationship of each associated node in the knowledge graph, with high efficiency and strong hierarchy.
[0089] In one embodiment, for step S31, the first entity relationship may correspond to an association relationship between one entity and another entity in the text knowledge graph, such as "apple-parent category (fruit)", that is, the first association relationship is "parent category"; in another embodiment, the first entity relationship may also correspond to an entity in the text knowledge graph being an attribute value of another entity, such as "strawberry-taste (sweet)", that is, the first association relationship is the attribute value "taste" of strawberry.
[0090] On the one hand, for step S31, the associated entities and associated relationships of the information related to the text data in the text knowledge graph are queried based on the associative matching rules.
[0091] Based on this, Figure 7 As shown, in one implementation, step S32 may specifically include:
[0092] Step S321: query the text knowledge graph according to the first text entity, and determine whether the first text entity matches at least one of the query results.
[0093] If not, jump to step S322, query the text knowledge graph according to the first text entity, and obtain the first graph entity.
[0094] Step S323: query the text knowledge graph according to the first entity relationship and the first graph entity, and filter out the third graph entity.
[0095] In this way, by searching the knowledge graph according to the first text entity corresponding to the text data, another entity that satisfies the first entity relationship can be obtained, which helps to understand the knowledge or potential knowledge related to the text data more comprehensively and deeply.
[0096] Among them, the first graph entity corresponds to the first text entity. The first text entity corresponds to the slot information of the text data, and the first graph entity is the entity name corresponding to the first text entity in the text knowledge graph. Optionally, the first text entity and the first graph entity may be the same or different. Specifically, when what is recorded in the text knowledge graph is an alias or other replaceable noun of the first text entity, the first text entity and the first graph entity are not the same. Conversely, when what is recorded in the knowledge graph is the first text entity itself, the first text entity and the first graph entity are the same. For example, the first text entity is "fruit", and what is recorded in the text knowledge graph is "fruit". In essence, they represent the same type of thing, and the only difference is between Chinese and English. At this time, "fruit" can be understood as an alias for "fruit", and the two are the same.
[0097] Based on this, step S322 may further include:
[0098] Step S3221, obtaining an alias attribute list of each text entity in the text knowledge graph; wherein the alias attribute list represents an alias or synonym of the entity, which includes a plurality of alias attribute values.
[0099] Step S3222, traverse the alias attribute list, match each alias attribute value with the first text entity in turn, and determine the first graph entity in the text knowledge graph based on the matching results.
[0100] In this way, by traversing the alias attribute list of the entity, the first graph entity corresponding to the first text entity is matched, which has strong flexibility and can improve the generalization ability of text association.
[0101] Optionally, the alias of the entity in the knowledge graph may contain several (greater than or equal to 0) entities. When the entity has no alias and the first text entity does not exist in the text knowledge graph, the associative matching rule fails to execute and no associative information corresponding to the text data is found.
[0102] On the other hand, in order to limit the relevance of the content of subsequent text associations to the items currently stored in the refrigerator, for step S33, the associated entities and associated relationships of all food information stored in the current refrigerator in the text knowledge graph are queried based on the association matching rules.
[0103] Based on this, Figure 8 As shown, in one implementation, step S34 may specifically include:
[0104] Step S341, traverse the slot data of the content contained in the device to obtain a plurality of second text entities.
[0105] Step S342: query the text knowledge graph according to each second text entity in turn, and determine whether the second text entity matches at least one of the query results.
[0106] If not, jump to step S343, traverse and search the alias attribute list of the knowledge graph according to the second text entity, and match and obtain the second graph entity.
[0107] Step S344: query the text knowledge graph based on the second graph entity and the second entity relationship, and filter out the fourth graph entity.
[0108] In this way, by traversing the slot data of all items in the current refrigerator, the corresponding second graph entity is obtained according to the slot data matching, ensuring that the subsequent associative content of the text exists in the current refrigerator, making it have practical significance, and improving the accuracy of association and user experience.
[0109] Among them, the second graph entity corresponds to the second text entity; the slot data (that is, the second text entity) in step S341 may correspond to all items currently stored in the refrigerator, and the slot data may be stored in the first slot database, and the text knowledge graph is traversed and queried according to each second text entity and the corresponding entity relationship in turn to obtain information related to the current items in the refrigerator.
[0110] Similarly, the second text entity and the second graph entity may be the same or different. For details, please refer to the relationship between the first text entity and the first graph entity mentioned above, which will not be elaborated here. In addition, steps S321 to S323 can be understood as derivative steps of step S32; steps S3221 to S3222 can be understood as steps S322 or derivative steps of step S32.
[0111] In order to realize the associative content of the text data based on the food information currently stored in the refrigerator, such as Fig. 9 As shown, in one implementation method, the present invention provides detailed steps for step S35, which may specifically include:
[0112] Step S351, determining whether the third graph entity is equal to the fourth graph entity.
[0113] If so, jump to step S352, fill in the text association response template corresponding to the first text association rule according to the third graph entity and the fourth graph entity, and obtain the first text association information.
[0114] In this way, by giving the corresponding associative information through the text associative answer template, users can be provided with fast and accurate answers, improving the quality and professionalism of the answers. In addition, the style and expression can be unified, which is convenient for later maintenance and updating, and improves the user experience.
[0115] The text association answer template is a predefined structured text framework used to fill in and generate a specific type of text answer. Specifically, by comparing whether the associated entities of the food information stored in the refrigerator in the knowledge graph are equal to the associated entities of the text data in the knowledge graph, the first text entity corresponding to the text data and the second text entity in the refrigerator that meets the conditions are filled into the text association answer template to obtain the first text association information.
[0116] For example, if a user asks "Are there apples in the refrigerator?", and there are no apples in the refrigerator, but there are oranges, the corresponding text association answer template can be set to "The {first text entity} you are looking for is not found, but the similar ingredient {second text entity} is found in the refrigerator." That is, the first text association information is "The apples you are looking for are not found, but the similar ingredient oranges are found in the refrigerator."
[0117] It should be emphasized that there is no sequential execution order between the entirety of step S31 to step S32 and the entirety of step S33 to step S34. That is, step S33 to step S34 can be arranged in front of step S31 to step S32 as a whole, or can be arranged in between step S31 and step S32 as a whole; step S33 can also be arranged before step S31 or between step S31 and step S32, and there is no specific limitation on this.
[0118] For example, Fig.10 As shown in the figure, suppose the text data "Is there any fruit in the refrigerator?" is obtained, and there are apples in the refrigerator. The association matching rules defined by DSL are as follows:
[0119] report if:
[0120] intention==check if the food exists
[0121] userAsk:name==any;
[0122] refFood:parent class == userAsk.name;
[0123] answer:
[0124] "The {userAsk} you requested was not found, but the {refFood} belonging to {userAsk} was found in the refrigerator."
[0125] end
[0126] report if:
[0127] intention==check if the food exists
[0128] userAsk:name==any;
[0129] refFood:parent class == userAsk.parent class;
[0130] answer:
[0131] "You were not able to find {userAsk}, but a similar ingredient {refFood} was found in the fridge."
[0132] End
[0133] In the DSL code above:
[0134] intention, that is, the intention type of the current user's question. The reply content and words of different sub-types under the query of ingredients will be different; userAsk, refers to the ingredients that the user queries; refFood, refers to the ingredients in the refrigerator; name, refers to the name of the node; parent class, refers to a certain relationship or attribute of the node, that is, Figure 1 The content marked on the arrow line. The content after answer is the text association answer template corresponding to the association matching rule, where the variables in the curly braces can be filled with actual values according to the user's question and the ingredients in the refrigerator; end means that this association matching rule ends.
[0135] By identifying the above text data, the first text intention (corresponding to intention) is "query whether the food is available" and the first slot information is "fruit". On the one hand, the first graph entity corresponding to "fruit" is obtained by searching the text knowledge graph through the slot information. By traversing the alias attribute list of each entity node in the knowledge graph, it is determined that the alias attribute list of the "fruit" entity alias["fruit", "fruit", "fresh goods"] contains the first slot information, so it can be determined that the "fruit" in the user's inquiry corresponds to the "fruit" in the knowledge graph. Based on this, it can be determined that the "userAsk" in the rule corresponds to the "fruit" node in the knowledge graph, and "name" is a necessary attribute of a node, which identifies the unique identity. Its attribute value is "fruit", so the "name" of "userAsk" is also "fruit". By using the "any" keyword, it can be indicated that the matching rule will match all possible values of the "name" field, not limited to a specific value, so that a wide match of the field can be achieved, making the rule more general and flexible.
[0136] On the other hand, by querying the food information in the refrigerator, the second text entity is obtained as "apple". By querying the matching knowledge graph, the corresponding second graph entity is also "apple", which means that the "refFood" in the rule corresponds to the "apple" node in the knowledge graph. In the graph, "apple" has a second entity relationship of "parent class" pointing to "fruit", and a first entity relationship with the attribute value of "name" pointing to "fruit", so both point to "fruit", that is, the text association answer template corresponding to the first text association rule is matched and executed, and the corresponding first text association information is output: "The fruit you want is not found, but an apple belonging to fruit is found in the refrigerator."
[0137] It should be noted that in the above specific example, multiple association matching rules are executed in a forward-looking order. If the previous rule is matched and the text association information is output, the subsequent rules will no longer be executed. If all preset association matching rules cannot be matched, the default response is made that the queried ingredient is not found, thereby realizing the setting of business priority.
[0138] The present invention also provides a refrigeration device, comprising: a memory for storing executable instructions; and a processor for implementing any of the steps of the above-mentioned text association method when running the executable instructions stored in the memory.
[0139] To summarize, the present invention identifies the first text intent and the first slot information of the text data, queries to obtain the matching first text association rule, and uses the text knowledge graph to find the third graph entity corresponding to the first text entity in the first text association rule, and the fourth graph entity corresponding to the second text entity in the first text association rule, determines whether the third graph entity and the fourth graph entity are equal, and then outputs the corresponding first text association information according to the text association answer template.
[0140] In addition, this method utilizes the hierarchy and correlation between entities in the knowledge graph to achieve more accurate query functions and improve the accuracy of text association content. In addition, the knowledge graph can be updated by adding or deleting triple information, which greatly improves the reuse rate of historical work, reduces the workload of adding new text entities or entity relationships, and improves work efficiency. Furthermore, by using DSL to define association matching rules, it is concise and clear, the rules are highly readable and adaptable, and can be dynamically adjusted according to actual application scenarios. It is highly maintainable, meets different needs, and improves user experience.
[0141] It should be understood that although this specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each implementation mode may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
[0142] The series of detailed descriptions listed above are only specific descriptions of feasible implementation methods of the present invention. They are not intended to limit the scope of protection of the present invention. Any equivalent implementation methods or changes that do not deviate from the technical spirit of the present invention should be included in the scope of protection of the present invention.
Claims
1. A text association method, characterized in that: include: Recognize the text data to obtain at least a first text intent and first slot information; When the first text intention and the first slot information meet the formal condition, traverse and match to obtain a first text association rule corresponding to the text data; The first text association rule is executed in the text knowledge graph to obtain first text association information; wherein the text knowledge graph records text entity attributes and / or association relationships between text entities.
2. The text association method according to claim 1, characterized in that: The associative matching rules record the operation method and / or operation steps for retrieving different entities and the relationships between different entities in the text knowledge graph.
3. The text association method according to claim 1, characterized in that: The text data includes at least one of original text data, voice text data and video text data.
4. The text association method according to claim 1, characterized in that: The “identifying text data to obtain at least the first text intent and the first slot information” specifically includes: Based on the text intent classification model, identifying a first text intent corresponding to the text data; According to the first text intent, the slot information of the text data is screened and extracted to obtain the first slot information.
5. The text association method according to claim 4, characterized in that: The “identifying a first text intent corresponding to the text data based on a text intent classification model” specifically includes: Constructing the text intent classification model; A text feature corresponding to the text data is extracted, and the text feature is input into the text intent classification model to obtain the first text intent.
6. The text association method according to claim 1, characterized in that: Before the step of "when the first text intention and the first slot information meet the formal condition, traversing and matching to obtain a first text association rule corresponding to the text data", the method further includes: Determining whether the first text intent falls within a preset text intent range; If so, query the first slot database corresponding to the first text intent according to the first slot information, and determine whether the first slot information matches at least one slot data therein; If the first slot information does not match any slot data in the first slot database, it is determined that the first text intent and the first slot information meet the form condition.
7. The text association method according to claim 6, characterized in that: The preset text intent range records all text intents that the device can support analysis, and the first slot database records a number of slot data pointing to the contents contained in the device; the text knowledge graph includes a number of text entities corresponding to all the slot data respectively.
8. The text association method according to claim 1, characterized in that: The “traversing and matching to obtain a first text association rule corresponding to the text data” specifically includes: Querying the association matching rule according to the first text intent to determine whether the first text intent matches the text intent in the first query result; If so, the slot information in the first query result is queried according to the first slot information to obtain a second query result as the first text association rule.
9. The text association method according to claim 1, characterized in that: The “executing the first text association rule in the text knowledge graph to obtain the first text association information” specifically includes: Determine, according to the first text association rule, a first text entity and a first entity relationship corresponding to the first slot information; According to the first text entity and the first entity relationship, searching the text knowledge graph to obtain a third graph entity corresponding to the first text entity; wherein the first entity relationship exists between the third graph entity and the first text entity; Determine, according to the first text association rule, a second text entity and a second entity relationship; wherein the second text entity corresponds to a number of slot data of the content contained in the device; Searching the text knowledge graph according to the second text entity and the second entity relationship in turn to obtain a fourth graph entity corresponding to the second text entity; wherein there is an association relationship between the fourth graph entity and the second text entity; The first text association information is determined according to the third graph entity and the fourth graph entity.
10. The text association method according to claim 9, characterized in that: The “searching the text knowledge graph according to the first text entity and the first entity relationship to obtain a third graph entity corresponding to the first text entity” specifically includes: Querying the text knowledge graph according to the first text entity, and determining whether the first text entity matches at least one of the query results; If not, query the text knowledge graph according to the first text entity to obtain a first graph entity; wherein the first graph entity corresponds to the first text entity; According to the first entity relationship and the first graph entity, the text knowledge graph is queried to filter out the third graph entity.
11. The text association method according to claim 10, characterized in that: The “querying the text knowledge graph according to the first text entity to obtain the first graph entity” specifically includes: Obtaining an alias attribute list of each text entity in the text knowledge graph; wherein the alias attribute list represents an alias or synonym of the entity, and includes a plurality of alias attribute values; The alias attribute list is traversed, each alias attribute value is matched with the first text entity in turn, and the first graph entity in the text knowledge graph is determined according to the matching result.
12. The text association method according to claim 9, characterized in that: The "searching the text knowledge graph according to the second text entity and the second entity relationship in sequence to obtain a fourth graph entity corresponding to the second text entity" specifically includes: Traversing slot data of contents contained in the device to obtain a plurality of second text entities; Query the text knowledge graph according to each second text entity in turn, and determine whether the second text entity matches at least one of the query results; If not, traverse and search the alias attribute list of the knowledge graph according to the second text entity, and match and obtain the second graph entity; wherein the second graph entity corresponds to the second text entity; According to the second graph entity and the second entity relationship, the text knowledge graph is queried to filter out the fourth graph entity.
13. The text association method according to claim 9, characterized in that: The “confirming the first text association information according to the third graph entity and the fourth graph entity” specifically includes: Determining whether the third graph entity is equal to the fourth graph entity; If so, fill in the text association answer template corresponding to the first text association rule according to the third graph entity and the fourth graph entity to obtain the first text association information.
14. The text association method according to claim 1, characterized in that: The association relationship includes at least one of a parent-child relationship, a genus-species relationship, an attribute relationship, an inclusion relationship, and a subordinate relationship.
15. The text association method according to claim 1, characterized in that: Before "traversing and matching to obtain a first text association rule corresponding to the text data", the method further includes: Determine the priority of each matching rule; A domain specific language is used to set an execution order for each matching rule in the associative matching rules in turn according to the priority, so as to set the priority of a plurality of matching rules.
16. The text association method according to claim 15, characterized in that: The "using a domain specific language to sequentially set an execution order for each matching rule in the associative matching rule according to the priority" specifically includes: The associative matching rules are defined in order of priority from high to low, and the domain-specific language performs matching operations in the order defined by the associative matching rules; and / or, Priority keywords are set for the associative matching rules, and matching operations are performed in the order of priorities marked by the keywords.
17. A refrigeration device, characterized in that: include: A memory for storing executable instructions; The processor is used to implement the steps of the text association method described in any one of claims 1-16 when running the executable instructions stored in the memory.
