Semantic rule generation method and apparatus, electronic device, and storage medium

By acquiring a set of statements and generating semantic rules based on semantic protocols and intent semantic classification models, the problem of time-consuming, labor-intensive, and inefficient semantic rule generation in existing technologies is solved, achieving efficient and accurate automatic generation of semantic rules and intent recognition.

CN115906871BActive Publication Date: 2026-06-05IFLYTEK CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
IFLYTEK CO LTD
Filing Date
2022-12-26
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing semantic rule generation methods are time-consuming, labor-intensive, and prone to errors, making it difficult to quickly generate effective semantic rules. In particular, when there is a lack of sufficient real user expectations, they cannot accurately identify user intent.

Method used

By acquiring the first set of statements and determining intent information based on a predefined semantic protocol, the intent semantic classification model and string matching algorithm are used for annotation, generating semantic rules, including a set of intent-annotated fragments and comprehensive matching degree calculation, filtering out low-scoring text, and merging identically annotated fragments to generate the final rules.

Benefits of technology

It enables the automatic generation of semantic rules, saving labor costs, improving generation efficiency and accuracy, and ensuring the accuracy of the question-and-answer system's answers and the efficiency of business updates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115906871B_ABST
    Figure CN115906871B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of human-computer interaction, and provides a semantic rule generation method and device, electronic equipment and a storage medium, the method acquires a first sentence set, and determines intention information of each first sentence in the first sentence set based on a semantic protocol; each first sentence is labeled based on the semantic protocol and the intention information of each first sentence, and a corresponding intention label segment set of each first sentence is obtained; based on the corresponding intention label segment set of each first sentence, automatic generation of semantic rules can be realized, the human cost required for generating semantic rules can be greatly saved without the help of domain experts to discover rules and summarize, the efficiency of generating semantic rules can be improved, the accuracy of user intention recognition results in downstream tasks such as intelligent question answering can be improved. Moreover, a large number of semantic rules can be generated by the method, which is not limited by manpower and experience, and the business updating efficiency and online efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of human-computer interaction technology, and in particular to a semantic rule generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the rapid development of the internet, people are increasingly favoring voice interaction for human-computer interaction. As one of the most convenient interaction methods, voice interaction systems are widely used in various smart terminal devices, such as televisions, mobile phones, vehicles, and robots. Understanding the user's intent and extracting key information has become crucial in these systems. In the early stages of designing such systems, without a large amount of labeled data, semantic rules are often used to cover common sentence structures to more quickly support user needs. Furthermore, for emerging concepts, especially in the automotive field where new functions often appear, models struggle to support them initially. Therefore, semantic rules are also an important component of the entire human-computer interaction system.

[0003] Semantic rules define a set of sentences for each intent slot value and are described using natural language, similar to regular expressions. For example:

[0004] {Intent = Seat massage settings, Component = Driver's seat, Speed ​​= Fast} = Please help me increase the driver's seat massage speed | Increase the driver's seat massage speed | Make the seat massage faster for the driver | The driver's seat massage is too slow...

[0005] When a user matches the set of sentences on the right side of the equation, it becomes clear that the user's intended action is to set the seat massage function, the slot for the component is the driver's seat, and the speed is "fast." Traditional semantic rule generation methods typically require experts to read large amounts of data, discover patterns, and then summarize semantic rules. This approach is time-consuming, labor-intensive, and error-prone, often resulting in a limited number of semantic rules. Therefore, how to generate semantic rules effectively and quickly is crucial. Summary of the Invention

[0006] This invention provides a semantic rule generation method, apparatus, electronic device, and storage medium to address the deficiencies in the prior art.

[0007] This invention provides a semantic rule generation method, comprising:

[0008] Obtain the first statement set, and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol;

[0009] Based on the semantic protocol and the intent information of each first statement, each first statement is annotated to obtain a set of intent-annotated fragments corresponding to each first statement;

[0010] Based on the set of intent-annotated fragments corresponding to each first statement, semantic rules are generated.

[0011] The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents.

[0012] According to a semantic rule generation method provided by the present invention, the step of annotating each first statement based on the semantic protocol and the intent information of each first statement to obtain a set of intent-annotated fragments corresponding to each first statement includes:

[0013] Based on the semantic protocol and the intent information of each first statement, the candidate intent of each first statement is determined, and each first statement is labeled based on the semantic protocol to obtain a set of candidate labeled segments corresponding to each first statement.

[0014] Based on the candidate intents and the set of alternative labeled segments, a set of intent labeled segments corresponding to each first statement is obtained.

[0015] According to a semantic rule generation method provided by the present invention, the step of generating semantic rules based on the intent-annotated fragment set corresponding to each first statement includes:

[0016] Based on the set of intent annotation fragments corresponding to each first statement, determine multiple intent annotation texts corresponding to each first statement;

[0017] The score of each intent-annotated text is calculated based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol field corresponding to the candidate intent of each first statement in the intent semantic space.

[0018] Based on the scores of each intent-annotated text, the target annotation text and target intent corresponding to each first statement are determined, and the semantic rules are generated based on the target annotation text and target intent corresponding to each first statement.

[0019] According to a semantic rule generation method provided by the present invention, the step of generating the semantic rule based on the target labeled text and target intent corresponding to each first statement includes:

[0020] For each first statement corresponding to the target intent, filter out the target labeled text with a score less than a preset threshold to obtain the remaining text;

[0021] The intent-annotated segments are extracted from the remaining text, and the identical intent-annotated segments in the remaining text are merged. The merged result is used as the semantic rule of the target intent.

[0022] According to a semantic rule generation method provided by the present invention, the step of calculating a score for each intent-annotated text based on the comprehensive matching degree between intent-annotated fragments in each intent-annotated text and intent protocol fields in the intent semantic space includes:

[0023] Determine the word tagging information in the first sentence corresponding to each intent-annotated text and the judgment information on whether the intent-annotated fragments in each intent-annotated text contain other intent-annotated fragments;

[0024] The score of each intent-annotated text is calculated based on the comprehensive matching degree, word annotation information, and judgment information corresponding to the intent-annotated segments in each intent-annotated text.

[0025] According to a semantic rule generation method provided by the present invention, the step of annotating each first statement based on the semantic protocol to obtain a set of candidate annotated fragments corresponding to each first statement includes:

[0026] A string matching algorithm is used to match the word segmentation results in each first sentence with the labeled segments in the semantic protocol;

[0027] Based on the matching results, a set of candidate labeled segments is determined for each first statement.

[0028] According to a semantic rule generation method provided by the present invention, determining the intent information of each first statement in the first statement set based on a predefined semantic protocol includes:

[0029] Each first statement is input into the intent semantic classification model to obtain the intent information of each first statement output by the intent semantic classification model; the intent semantic classification model is trained based on the intent information corresponding to each second statement in the second statement set, and the intent information corresponding to each second statement is obtained based on the semantic protocol annotation;

[0030] Accordingly, the generation of semantic rules based on the set of intent-annotated fragments corresponding to each first statement includes:

[0031] Determine the set of intent-annotated fragments corresponding to each second statement;

[0032] The semantic rules are generated based on the set of intent-annotated fragments corresponding to each first statement and the set of intent-annotated fragments corresponding to each second statement.

[0033] The present invention also provides a semantic rule generation apparatus, comprising:

[0034] The acquisition module is used to acquire a first statement set and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol.

[0035] The annotation module is used to annotate each first statement based on the semantic protocol and the intent information of each first statement, so as to obtain a set of intent annotation fragments corresponding to each first statement;

[0036] The generation module is used to generate semantic rules based on the set of intent-annotated fragments corresponding to each first statement;

[0037] The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents.

[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the semantic rule generation method as described above.

[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the semantic rule generation method as described above.

[0040] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the semantic rule generation method as described above.

[0041] This invention provides a semantic rule generation method, apparatus, electronic device, and storage medium. The method first acquires a first set of statements and, based on a semantic protocol, determines the intent information of each statement in the first set. Then, based on the semantic protocol and the intent information of each statement, each statement is annotated to obtain a set of intent-annotated fragments corresponding to each statement. Finally, semantic rules are generated based on the set of intent-annotated fragments corresponding to each statement. This method enables automatic generation of semantic rules without relying on domain experts to discover and summarize patterns, significantly saving the human resources required for semantic rule generation and improving its efficiency. It helps improve the accuracy of user intent recognition results in downstream tasks such as intelligent question answering, thereby improving the accuracy of response information. This solves the problem in some special domains where there is a lack of sufficient real user expectations, making it impossible to train a high-precision intent recognition model, leading to difficulties in correctly recognizing user intent and providing accurate information to users. This ensures that the answers from the question-answering system are accurate and controllable. Moreover, this method can generate a large number of semantic rules without being limited by human resources or experience, thus improving business update and deployment efficiency. Attached Figure Description

[0042] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on the drawings described below without creative effort.

[0043] Figure 1 This is one of the flowcharts illustrating the semantic rule generation method provided by the present invention;

[0044] Figure 2 This is a schematic diagram of the candidate labeled fragment set in the semantic rule generation method provided by the present invention;

[0045] Figure 3 This is a schematic diagram of the structure of the intent semantic classification model in the semantic rule generation method provided by the present invention;

[0046] Figure 4 This is the second flowchart of the semantic rule generation device provided by the present invention;

[0047] Figure 5 This is the third flowchart of the semantic rule generation method provided by the present invention;

[0048] Figure 6 This is a schematic diagram of the semantic rule generation device provided by the present invention;

[0049] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0051] Existing methods for generating semantic rules mostly rely on manual summarization, which often requires domain experts to read large amounts of data, discover patterns, and summarize useful expressions. This process is time-consuming, labor-intensive, and the number of rules collected is limited. Therefore, this invention provides a semantic rule generation method.

[0052] Figure 1 This is a flowchart illustrating a semantic rule generation method provided in an embodiment of the present invention, such as... Figure 1 As shown, the method includes:

[0053] S1, Obtain the first statement set, and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol;

[0054] S2, based on the semantic protocol and the intent information of each first statement, each first statement is annotated to obtain a set of intent annotation fragments corresponding to each first statement;

[0055] S3 generates semantic rules based on the set of intent-annotated fragments corresponding to each first statement;

[0056] The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents.

[0057] Specifically, the semantic rule generation method provided in this embodiment of the invention is executed by a semantic rule generation device, which can be configured in a computer. The computer can be a local computer or a cloud computer. The local computer can be a computer, tablet, etc., and no specific limitation is made here.

[0058] First, step S1 is executed to obtain the first statement set. Based on a predefined semantic protocol, the intent information of each statement in the first statement set is determined. Since different products have different business requirements, this first statement set can consist of statements within a target domain. This target domain can be the business domain supported by the product to which the semantic rule generation method is applicable. Products to which the semantic rule generation method is applicable can be products with intelligent question-answering capabilities, such as smart speakers, vehicle cockpit domain controllers, televisions, mobile phones, and robots.

[0059] For smart speakers, the target domain can be one of the following: music, weather, reminders, calendar, stocks, or casual chat. For in-vehicle cockpit domain controllers, the target domain can be one of the following: air conditioning, body control, navigation, telephone, radio, music, weather, flights, or trains. No specific limitation is made here.

[0060] The first statement refers to the statement in the set of first statements. There can be one or more first statements. Each first statement corresponds to intent information, which is used to characterize the target intent contained in the first statement.

[0061] A semantic protocol is a predefined semantic protocol for a target domain. It can be used to represent the intent semantic space and the annotation rules for intents, in order to describe common functional intent expressions in the target domain. A semantic protocol can include intents, intent protocols, annotation fragments, and examples of annotation fragments. An intent is described by a unique intent protocol. Each intent protocol is represented by multiple intent protocol fields in the intent semantic space. Each intent protocol field is used to represent an intent dimension in the intent semantic space.

[0062] A tag fragment refers to the semantic value of each intent protocol field, i.e., the intent protocol field value. Tag fragments and tag fragment examples can constitute the tagging rules for an intent. Tag fragment examples can include a set of words that express the same meaning corresponding to the same tag fragment.

[0063] Taking the target domain as the body control domain supported by intelligent vehicles as an example, the semantic protocol of the body control domain can be represented by Table 1.

[0064] Table 1 Semantic Protocols in the Vehicle Control Domain

[0065]

[0066]

[0067] In Table 1, the multiple intent protocol fields in the intent semantic space may include: operation, mode, name, speed, and modevalue.

[0068] The intent information of each first statement can be represented by the intent protocol fields in the intent semantic space, which may include the intent protocol field values ​​in the intent semantic space corresponding to each word in the first statement.

[0069] The intent information of each first statement can be identified through an intent semantic classification model that conforms to a predefined semantic protocol; no specific limitations are made here.

[0070] Taking the first statement as "Please help me increase the massage speed of the driver's seat" as an example, the intent information of the first statement can be represented by Table 2.

[0071] Table 2 Intent Information Table for the First Statement

[0072] Intent Protocol Field Intent Protocol Field Value operation action_set mode mode_massage name device_driver_seat speed speed_plus modevalue chat

[0073] Then, step S2 is executed. First, a semantic protocol is used, combining the intent semantic space and intent annotation rules, to annotate each first statement by word. Each word in the first statement, after annotation, corresponds to a candidate annotation fragment. The candidate annotation fragments corresponding to all words in the first statement constitute the candidate annotation fragment set for each first statement. Then, using the intent information of each first statement, intent annotation fragments that match the intent information are selected from the candidate annotation fragment set corresponding to each first statement, forming the intent annotation fragment set for each first statement.

[0074] Finally, step S3 is executed to generate semantic rules using the set of intent annotation fragments corresponding to each first statement. Here, for first statements with the same candidate intent, the semantic rules for that candidate intent can be determined by merging the same intent annotation fragments; that is, the merged result is used as the semantic rules for that candidate intent.

[0075] The semantic rule generation method provided in this embodiment of the invention first obtains a first set of statements and, based on a predefined semantic protocol, determines the intent information of each statement in the first set. Then, based on the semantic protocol and the intent information of each statement, each statement is annotated to obtain a set of intent-annotated fragments corresponding to each statement. Finally, semantic rules are generated based on the set of intent-annotated fragments corresponding to each statement. This method enables automatic generation of semantic rules without relying on domain experts to discover and summarize patterns, significantly saving the human resources required for semantic rule generation and improving its efficiency. It helps improve the accuracy of user intent recognition results in downstream tasks such as intelligent question answering, thereby improving the accuracy of response information. This method solves the problem in some special domains where there is a lack of sufficient real user expectations, making it impossible to train a high-precision intent recognition model, leading to difficulties in correctly recognizing user intent and providing accurate information to users. It ensures that the answers from the question-answering system are accurate and controllable. Furthermore, this method can generate a large number of semantic rules without being limited by human resources or experience, thus improving business update efficiency and deployment efficiency.

[0076] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, which involves annotating each first statement based on the semantic protocol and the intent information of each first statement to obtain a set of intent-annotated fragments corresponding to each first statement, includes:

[0077] Based on the semantic protocol and the intent information of each first statement, the candidate intent of each first statement is determined, and each first statement is labeled based on the semantic protocol to obtain a set of candidate labeled segments corresponding to each first statement.

[0078] Based on the candidate intents and the set of alternative labeled segments, a set of intent labeled segments corresponding to each first statement is obtained.

[0079] Specifically, in this embodiment of the invention, when determining the set of intent annotation fragments corresponding to each first statement, the candidate intent of each first statement can be determined by matching it with each intent protocol in the semantic protocol based on the intent information of each first statement. It is understood that if a certain intent protocol field in the intent protocol corresponds to a definite intent protocol field value, then successful matching requires both consistency of the intent protocol field and consistency of the intent protocol field value; otherwise, only consistency of the intent protocol field is required.

[0080] For example, as shown in Table 1, the candidate intent for the first statement can be F = {seat_mode_speed_set,massage_mode_modevalue_set}.

[0081] Simultaneously, semantic protocols can be used to annotate each first statement, resulting in a set of candidate annotated segments for each first statement. The set P of candidate annotated segments can include P candidate annotated segments, i.e., P = {p1,...,p...} i ,...,p |P|}, where p i This represents the i-th candidate labeled segment.

[0082] For example, if the first sentence is "Please turn up the massage speed of the driver's seat," then the set of alternative labeled segments can be used. Figure 2 And as shown in Table 3.

[0083] Table 3. Set of alternative annotated segments for the first sentence (Part 1)

[0084]

[0085]

[0086] Furthermore, by combining the candidate intents and the set of alternative annotation fragments, a set of intent annotation fragments corresponding to each first statement is obtained. That is, the set of alternative annotation fragments is divided according to the candidate intents to obtain the set of intent annotation fragments. The set of intent annotation fragments can include IP addresses, i.e., IP = {IP1, ..., IP2}. i IP |IP| The corresponding candidate intentions are denoted as F = {f1,...,f}. i ,...,f |IP|} Let f represent the set of the i-th intention-annotated fragments. i This represents the corresponding i-th candidate intent.

[0087] If the first statement is "Please increase the massage speed of the driver's seat," and the candidate intent is seat_mode_speed_set, then the intent-labeled fragment set is IP. seat_mode_speed_set ={1-12}; When the candidate intent is `massage_mode_modevalue_set`, the intent annotation fragment set is IP. massage_mode_modevalue_set ={1-9}.

[0088] In this embodiment of the invention, by combining the candidate intent of each first statement and the set of candidate labeled fragments corresponding to each first statement obtained by labeling each first statement, the candidate intent and the labeling results can be fused to obtain the set of intent labeled fragments corresponding to each first statement, which facilitates the subsequent generation of semantic rules for intent classes.

[0089] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, wherein generating semantic rules based on the intent-annotated fragment set corresponding to each first statement includes:

[0090] Based on the set of intent annotation fragments corresponding to each first statement, determine multiple intent annotation texts corresponding to each first statement;

[0091] The score of each intent-annotated text is calculated based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol field corresponding to the candidate intent of each first statement in the intent semantic space.

[0092] Based on the scores of each intent-annotated text, the target annotation text and target intent corresponding to each first statement are determined, and the semantic rules are generated based on the target annotation text and target intent corresponding to each first statement.

[0093] Specifically, when generating semantic rules, we can first determine multiple intent-annotated texts corresponding to each first statement based on the set of intent-annotated fragments corresponding to each first statement. That is, we annotate the set of intent-annotated fragments corresponding to each first statement in each first statement. Since there are multiple correspondences between the words in the first statement and the candidate annotated fragments, we can obtain multiple intent-annotated texts corresponding to each first statement.

[0094] For example, each first statement corresponds to T intent-annotated texts T = {t1,...,t} i ...,t |T|}, for each intent-annotated text, the candidate intent TF = {f1,...,f} i ,...,f |T|}, t i f represents the text labeled with the i-th intent. i This represents the candidate intent corresponding to the i-th intent annotation text.

[0095] Subsequently, based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol field corresponding to the candidate intent of each first statement in the intent semantic space, the score S = {s1, ..., s2} of each intent annotation text can be calculated. i ..., s |T|}s iThis represents the score of the i-th intent annotation text. For example, if the candidate intent of the first statement has 5 intent protocol fields, and only 4 of the intent annotation fragments in a certain intent annotation text match the above 5 intent protocol fields, then the overall matching degree can be considered to be 0.8.

[0096] Here, the overall matching degree corresponding to each intent annotation text can be directly used as the score of each intent annotation text, or it can be combined with other parameters to determine the score of each intent annotation text. No specific limitation is made here.

[0097] Finally, based on the scores of each intent annotation text, the intent annotation text with the highest score among the multiple intent annotation texts corresponding to each first statement can be selected as its corresponding target annotation text. The candidate intent corresponding to the target annotation text is the target intent. Furthermore, based on the target intent corresponding to each first statement, intent annotation fragments are extracted from the target annotation texts corresponding to each first statement with the same target intent to generate semantic rules.

[0098] In this embodiment of the invention, the target annotation text and the target intent are obtained by filtering the scores of multiple intent annotation texts corresponding to each first statement, and semantic rules corresponding to the target intent are generated using the target annotation text and the target intent. This can make the generated semantic rules more accurate and more in line with the semantic protocol.

[0099] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, which generates the semantic rules based on the target labeled text and target intent corresponding to each first statement, includes:

[0100] For each first statement corresponding to the target intent, filter out the target labeled text with a score less than a preset threshold to obtain the remaining text;

[0101] The intent-annotated segments are extracted from the remaining text, and the identical intent-annotated segments in the remaining text are merged. The merged result is used as the semantic rule of the target intent.

[0102] Specifically, in the process of generating semantic rules, the target labeled text with scores lower than a preset threshold can be filtered out from the target labeled text corresponding to each first statement with the target intent, resulting in the remaining text. The preset threshold can be set as needed, for example, it can be set to 1.

[0103] When the target intent is seat_mode_speed_set, the target annotation text and its score corresponding to each first statement with the target intent are shown in Table 4. When the preset threshold is set to 1, the target annotation text with a score of 0.53 in Table 4 needs to be filtered out to obtain the remaining text.

[0104] Table 4. Target annotation text and its score table corresponding to the first statement of each target intent.

[0105]

[0106]

[0107] Subsequently, the intent-annotated segments can be extracted from the remaining text, as shown in Table 5.

[0108] Table 5. Intent-annotated fragments in the remaining text

[0109]

[0110]

[0111] The identical intent-annotated segments in the remaining text are merged, and the merged result is used as the semantic rule for the target intent, as shown in Table 6.

[0112] Table 6 Semantic Rules Table

[0113]

[0114] In this embodiment of the invention, filtering out target labeled text with scores lower than a preset threshold can prevent it from affecting the generated semantic rules and improve the accuracy of the semantic rules.

[0115] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, which calculates the score of each intent-annotated text based on the comprehensive matching degree between the intent-annotated fragments in each intent-annotated text and the intent protocol field in the intent semantic space, includes:

[0116] Determine the word tagging information in the first sentence corresponding to each intent-annotated text and the judgment information on whether the intent-annotated fragments in each intent-annotated text contain other intent-annotated fragments;

[0117] The score of each intent-annotated text is calculated based on the comprehensive matching degree, word annotation information, and judgment information corresponding to the intent-annotated segments in each intent-annotated text.

[0118] Specifically, when calculating the score of each intent-annotated text, we can first determine the word annotation information in the first sentence corresponding to each intent-annotated text and the judgment information on whether the intent-annotated fragments in each intent-annotated text contain other intent-annotated fragments. Each word in the first sentence corresponding to the intent-annotated text has a corresponding word annotation information. The word annotation information is used to indicate whether the corresponding word is annotated. A value of 0 indicates that it is not annotated, and a value of 1 indicates that it is annotated.

[0119] The text defines whether each intent annotation fragment contains other intent annotation fragments. This determination information refers to the result of judging whether any given intent annotation fragment in the intent annotation text contains other intent annotation fragments. Figure 2 For example, if the intent tag segment labeled 1 does not contain any other intent tag segments, the judgment information is 0; if the intent tag segment labeled 2 contains intent tag segments labeled 1 and 3, the judgment information is 1.

[0120] Furthermore, based on the comprehensive matching degree, word tagging information, and judgment information corresponding to the intent-annotated segments in each intent-annotated text, the score of each intent-annotated text can be calculated using the following formula:

[0121]

[0122] Where Score is the score of the intent-annotated text, IM(θ) represents the overall matching degree of the intent-annotated segment in the intent-annotated text, and f(w i ) represents the word tagging information of the i-th word in the first sentence corresponding to the intended tagging text, |W| represents the total number of characters in the first sentence corresponding to the intended tagging text, h(p j ) indicates whether the j-th intent tag fragment in the intent tag text contains judgment information about other intent tag fragments. α is prior knowledge, and its value can be set as needed, for example, α = 0.01.

[0123] Table 7 shows the scores for each intention annotation text of the first statement.

[0124] Table 7 Scoring table for each intention annotation text of the first statement.

[0125]

[0126]

[0127]

[0128]

[0129] As shown in Table 7, one or more of the two intent annotation texts with a score of 1.02 can be selected as the target annotation text, and the corresponding candidate intent seat_mode_speed_set can be used as the target intent.

[0130] It is understandable that the judgment information h(p) regarding whether the j-th intent annotation fragment in the intent annotation text contains other intent annotation fragments is needed. jThis can be determined when annotating each first statement, meaning the judgment information of the candidate annotation fragments in the candidate annotation fragment set is consistent with the judgment information of the intent annotation fragments in the intent annotation text. That is, if candidate annotation fragment p... k From the alternative labeled fragment p i Compared with the alternative labeled fragment p j If the composition is such that the judgment information for the candidate labeled segment is s′, then... k =(s′) i +s′ j )+1,s′ i and s′ j These are the candidate labeled segments p i Compared with the alternative labeled fragment p j The initial value of each judgment information is 0. Therefore, Table 3 becomes Table 8.

[0131] Table 8. Set of alternative annotated segments for the first statement (Part II)

[0132]

[0133] In this embodiment of the invention, by combining comprehensive matching degree, word tagging information, and judgment information, the scores of each intent-tagged text can be calculated to be more accurate and reliable.

[0134] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, wherein each first statement is annotated based on the semantic protocol to obtain a set of candidate annotated segments corresponding to each first statement, includes:

[0135] A string matching algorithm is used to match the word segmentation results in each first sentence with the labeled segments in the semantic protocol;

[0136] Based on the matching results, a set of candidate labeled segments is determined for each first statement.

[0137] Specifically, when annotating each first statement, a string matching algorithm can be used to match the word segmentation results in each first statement with the annotated segments in the semantic protocol. This process can be implemented using an Aho-Corasick automaton. Subsequently, based on the matching results, a set of candidate annotated segments corresponding to each first statement is determined; that is, the annotated segments in the semantic protocol obtained through matching can be used as the candidate annotated segment set.

[0138] In this embodiment of the invention, a string matching algorithm can be used to achieve rapid annotation, thereby improving the efficiency of semantic rule generation.

[0139] Based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention, wherein determining the intent information of each first statement in the first statement set based on a predefined semantic protocol, includes:

[0140] Each first statement is input into the intent semantic classification model to obtain the intent information of each first statement output by the intent semantic classification model; the intent semantic classification model is trained based on the intent information corresponding to each second statement in the second statement set, and the intent information corresponding to each second statement is obtained based on the semantic protocol annotation;

[0141] Accordingly, the generation of semantic rules based on the set of intent-annotated fragments corresponding to each first statement includes:

[0142] Determine the set of intent-annotated fragments corresponding to each second statement;

[0143] The semantic rules are generated based on the set of intent-annotated fragments corresponding to each first statement and the set of intent-annotated fragments corresponding to each second statement.

[0144] Specifically, when determining the intent information of the first statement, an intent semantic classification model can be introduced. The structure of the intent semantic classification model can be as follows: Figure 3 As shown, this intent semantic classification model uses a first encoder (Input Encoder) to encode the first statement (Input), and a second encoder (Label Encoder) to encode the labeled segments (Labels) in the semantic protocol. The encoded results are passed through an attention layer. Using the attention mechanism, the weight of each labeled segment to the first statement is calculated. Then, the representation of the first statement is obtained by weighted summing of different labeled segments. Finally, the intent information of the first statement is obtained through the fully connected layers corresponding to each labeled segment.

[0145] Here, BERT can be used as the encoder to encode the annotation fragments in the first statement and the semantic protocol. Each annotation fragment can include operation, mode, name, speed, and modevalue, and the corresponding fully connected layers are FC1, FC2, FC3, FC4, and FC5, respectively.

[0146] The input to the intent semantic classification model can be the character vectors of each word in the first sentence, and the dimension of the character vectors can be 100.

[0147] During training, the intent semantic classification model uses intent information corresponding to each second statement in the second statement set as training samples. In the cold start phase, a string matching algorithm can be used to match the word segmentation results in each second statement with the labeled segments in the semantic protocol. Based on the matching results, a set of candidate labeled segments corresponding to each second statement is determined. Then, with the help of the semantic protocol, the intent information corresponding to each second statement is obtained through manual annotation.

[0148] The intent information corresponding to the second statement can be represented by Table 9.

[0149] Table 9 shows the intent information corresponding to the second statement.

[0150]

[0151]

[0152] The loss function used during training of the intent semantic classification model can be:

[0153]

[0154] Where N represents the number of second statements in the second statement set, M represents the number of intent protocol fields in the semantic protocol, and K m Indicates the number of values ​​in the intent protocol field. This represents the prediction result of the intent semantic classification model. This indicates the intent information corresponding to the second statement.

[0155] Because of the existence of the second statement, when generating semantic rules based on the set of intent-annotated fragments corresponding to each first statement, the set of intent-annotated fragments corresponding to each second statement can be determined manually first. Then, semantic rules can be generated using both the set of intent-annotated fragments corresponding to each first statement and the set of intent-annotated fragments corresponding to each second statement. In this way, utilizing the set of intent-annotated fragments corresponding to each second statement to increase the corpus for generating semantic rules can improve the accuracy and reliability of the generated semantic rules.

[0156] In this embodiment of the invention, the intent information of each first statement is determined using an intent semantic classification model, which can greatly improve the efficiency of intent information determination and thus improve the efficiency of semantic rule generation. Furthermore, this intent semantic classification model can use the intent information corresponding to each second statement in the second statement set obtained during the cold start phase as training samples, ensuring the quality and quantity of training samples and improving the accuracy of the intent semantic classification model.

[0157] like Figure 4 and Figure 5As shown, based on the above embodiments, the semantic rule generation method provided in this embodiment of the invention includes:

[0158] For the second statement in the second statement set, a cold start phase is performed, which involves using a string matching algorithm to determine the set of candidate labeled segments for each second statement, and then manually labeling the intent information and intent labeled segments for each second statement.

[0159] For the first statement in the first statement set, the normal model prediction stage is performed, which involves obtaining the intent information of each first statement using the intent semantic classification model, determining the candidate intent of each first statement based on the semantic protocol and the intent information of each first statement, labeling each first statement using a string matching algorithm based on the semantic protocol, and obtaining a set of candidate labeled segments corresponding to each first statement; and obtaining a set of intent labeled segments corresponding to each first statement based on the candidate intent and the set of candidate labeled segments.

[0160] For the set of intent annotation fragments corresponding to the first statement and the second statement, determine multiple intent annotation texts corresponding to each first statement and the second statement.

[0161] The score of each intent-annotated text is calculated based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol fields corresponding to the candidate intents of each first and second statement in the intent semantic space.

[0162] Based on the scores of each intent-annotated text, the target annotated text corresponding to each first statement and second statement is determined.

[0163] When generating semantic rules based on the target labeled text and target intent corresponding to each first statement and second statement, the target labeled text with a score lower than a preset threshold is first filtered out to obtain the remaining text; then the intent labeled fragments in the remaining text are extracted, and the same intent labeled fragments in the remaining text are merged, and the merged result is used as the semantic rule of the target intent.

[0164] like Figure 6 As shown, based on the above embodiments, this embodiment of the invention provides a semantic rule generation apparatus, including:

[0165] The acquisition module 61 is used to acquire the first statement set and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol;

[0166] The annotation module 62 is used to annotate each first statement based on the semantic protocol and the intent information of each first statement, so as to obtain a set of intent annotation fragments corresponding to each first statement;

[0167] The generation module 63 is used to generate semantic rules based on the set of intent-annotated fragments corresponding to each first statement;

[0168] The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents.

[0169] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the annotation module is specifically used for:

[0170] Based on the semantic protocol and the intent information of each first statement, the candidate intent of each first statement is determined, and each first statement is labeled based on the semantic protocol to obtain a set of candidate labeled segments corresponding to each first statement.

[0171] Based on the candidate intents and the set of alternative labeled segments, a set of intent labeled segments corresponding to each first statement is obtained.

[0172] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the generation module is specifically used for:

[0173] Based on the set of intent annotation fragments corresponding to each first statement, determine multiple intent annotation texts corresponding to each first statement;

[0174] The score of each intent-annotated text is calculated based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol field corresponding to the candidate intent of each first statement in the intent semantic space.

[0175] Based on the scores of each intent-annotated text, the target annotation text and target intent corresponding to each first statement are determined, and the semantic rules are generated based on the target annotation text and target intent corresponding to each first statement.

[0176] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the generation module is specifically used for:

[0177] For each first statement corresponding to the target intent, filter out the target labeled text with a score less than a preset threshold to obtain the remaining text;

[0178] The intent-annotated segments are extracted from the remaining text, and the identical intent-annotated segments in the remaining text are merged. The merged result is used as the semantic rule of the target intent.

[0179] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the generation module is specifically used for:

[0180] Determine the word tagging information in the first sentence corresponding to each intent-annotated text and the judgment information on whether the intent-annotated fragments in each intent-annotated text contain other intent-annotated fragments;

[0181] The score of each intent-annotated text is calculated based on the comprehensive matching degree, word annotation information, and judgment information corresponding to the intent-annotated segments in each intent-annotated text.

[0182] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the annotation module is specifically used for:

[0183] A string matching algorithm is used to match the word segmentation results in each first sentence with the labeled segments in the semantic protocol;

[0184] Based on the matching results, a set of candidate labeled segments is determined for each first statement.

[0185] Based on the above embodiments, the semantic rule generation apparatus provided in this embodiment of the invention, wherein the acquisition module is specifically used for:

[0186] Each first statement is input into the intent semantic classification model to obtain the intent information of each first statement output by the intent semantic classification model; the intent semantic classification model is trained based on the intent information corresponding to each second statement in the second statement set, and the intent information corresponding to each second statement is obtained based on the semantic protocol annotation;

[0187] Accordingly, the generation module is specifically used for:

[0188] Determine the set of intent-annotated fragments corresponding to each second statement;

[0189] The semantic rules are generated based on the set of intent-annotated fragments corresponding to each first statement and the set of intent-annotated fragments corresponding to each second statement.

[0190] Specifically, the functions of each module in the semantic rule generation device provided in this embodiment correspond one-to-one with the operation flow of each step in the above method embodiment, and the achieved effect is also the same. For details, please refer to the above embodiments, and this will not be repeated in this embodiment.

[0191] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute the semantic rule generation method provided in the above embodiments. This method includes: acquiring a first set of statements, and determining the intent information of each first statement in the first set based on a predefined semantic protocol; annotating each first statement based on the semantic protocol and the intent information of each first statement to obtain a set of intent annotation fragments corresponding to each first statement; and generating semantic rules based on the set of intent annotation fragments corresponding to each first statement; wherein the semantic protocol is used to characterize the intent semantic space and the intent annotation rules.

[0192] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0193] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the semantic rule generation method provided in the above embodiments. The method includes: obtaining a first statement set, and determining the intent information of each first statement in the first statement set based on a predefined semantic protocol; annotating each first statement based on the semantic protocol and the intent information of each first statement to obtain a set of intent annotation fragments corresponding to each first statement; and generating semantic rules based on the set of intent annotation fragments corresponding to each first statement; wherein the semantic protocol is used to characterize the intent semantic space and the intent annotation rules.

[0194] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the semantic rule generation method provided in the above embodiments. The method includes: acquiring a first statement set, and determining the intent information of each first statement in the first statement set based on a predefined semantic protocol; annotating each first statement based on the semantic protocol and the intent information of each first statement to obtain a set of intent annotation fragments corresponding to each first statement; and generating semantic rules based on the set of intent annotation fragments corresponding to each first statement; wherein the semantic protocol is used to characterize the intent semantic space and the intent annotation rules.

[0195] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0196] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0197] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A semantic rule generation method, characterized in that, include: Obtain the first statement set, and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol; Based on the semantic protocol and the intent information of each first statement, each first statement is annotated to obtain a set of intent-annotated fragments corresponding to each first statement; Semantic rules are generated based on the set of intent annotation fragments corresponding to each first statement; for first statements with the same candidate intent, the semantic rules of the candidate intent are determined by merging the same intent annotation fragments. The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents; the candidate intent of each first statement is determined by matching it with each intent protocol in the semantic protocol based on the intent information of each first statement.

2. The semantic rule generation method according to claim 1, characterized in that, Based on the semantic protocol and the intent information of each first statement, each first statement is annotated to obtain a set of intent-annotated fragments corresponding to each first statement, including: Based on the semantic protocol and the intent information of each first statement, the candidate intent of each first statement is determined, and each first statement is labeled based on the semantic protocol to obtain a set of candidate labeled segments corresponding to each first statement. Based on the candidate intents and the set of alternative labeled segments, a set of intent labeled segments corresponding to each first statement is obtained.

3. The semantic rule generation method according to claim 1, characterized in that, The generation of semantic rules based on the set of intent-annotated fragments corresponding to each first statement includes: Based on the set of intent annotation fragments corresponding to each first statement, determine multiple intent annotation texts corresponding to each first statement; The score of each intent-annotated text is calculated based on the comprehensive matching degree between the intent annotation fragments in each intent annotation text and the intent protocol field corresponding to the candidate intent of each first statement in the intent semantic space. Based on the scores of each intent-annotated text, the target annotation text and target intent corresponding to each first statement are determined, and the semantic rules are generated based on the target annotation text and target intent corresponding to each first statement.

4. The semantic rule generation method according to claim 3, characterized in that, The generation of semantic rules based on the target labeled text and target intent corresponding to each first statement includes: For each first statement corresponding to the target intent, filter out the target labeled text with a score less than a preset threshold to obtain the remaining text; The intent-annotated segments are extracted from the remaining text, and the identical intent-annotated segments in the remaining text are merged. The merged result is used as the semantic rule of the target intent.

5. The semantic rule generation method according to claim 3, characterized in that, The score for each intent-annotated text is calculated based on the comprehensive matching degree between the intent-annotated fragments in each intent-annotated text and the intent protocol fields in the intent semantic space, including: Determine the word tagging information in the first sentence corresponding to each intent-annotated text and the judgment information on whether the intent-annotated fragments in each intent-annotated text contain other intent-annotated fragments; The score of each intent-annotated text is calculated based on the comprehensive matching degree, word annotation information, and judgment information corresponding to the intent-annotated segments in each intent-annotated text.

6. The semantic rule generation method according to claim 2, characterized in that, Based on the semantic protocol, each first statement is annotated to obtain a set of candidate annotated segments corresponding to each first statement, including: A string matching algorithm is used to match the word segmentation results in each first sentence with the labeled segments in the semantic protocol; Based on the matching results, a set of candidate labeled segments is determined for each first statement.

7. The semantic rule generation method according to any one of claims 1-6, characterized in that, The determination of intent information for each first statement in the first statement set based on a predefined semantic protocol includes: Each first statement is input into the intent semantic classification model to obtain the intent information of each first statement output by the intent semantic classification model; the intent semantic classification model is trained based on the intent information corresponding to each second statement in the second statement set, and the intent information corresponding to each second statement is obtained based on the semantic protocol annotation; Accordingly, the generation of semantic rules based on the set of intent-annotated fragments corresponding to each first statement includes: Determine the set of intent-annotated fragments corresponding to each second statement; The semantic rules are generated based on the set of intent-annotated fragments corresponding to each first statement and the set of intent-annotated fragments corresponding to each second statement.

8. A semantic rule generation device, characterized in that, include: The acquisition module is used to acquire a first statement set and determine the intent information of each first statement in the first statement set based on a predefined semantic protocol. The annotation module is used to annotate each first statement based on the semantic protocol and the intent information of each first statement, so as to obtain a set of intent annotation fragments corresponding to each first statement; The generation module is used to generate semantic rules based on the set of intent annotation fragments corresponding to each first statement; for first statements with the same candidate intent, the semantic rules of the candidate intent are determined by merging the same intent annotation fragments. The semantic protocol is used to characterize the semantic space of intents and the annotation rules of intents; the candidate intent of each first statement is determined by matching it with each intent protocol in the semantic protocol based on the intent information of each first statement.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the semantic rule generation method as described in any one of claims 1-7.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the semantic rule generation method as described in any one of claims 1-7.