Method, device and medium for identifying implication relationship and method, device and medium for identifying intention
By acquiring sentence vectors and performing syntactic component analysis, similarity and inclusion relationships are determined, solving the problem of low accuracy in implication relationship identification in existing technologies and achieving more accurate implication relationship identification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-21
- Publication Date
- 2026-03-20
AI Technical Summary
The accuracy of implication relationship identification results in existing technologies is low, mainly because they rely solely on the similarity between premise statements and hypothesis statements for judgment, resulting in limited information.
By obtaining the statement vectors of the premise statement and the candidate statement, syntactic component analysis is performed to determine the similarity and inclusion relationship of the same syntactic components, and the implication relationship is identified by using the similarity and inclusion relationship.
It improves the accuracy of implication relation identification by providing richer evidence to determine the implication relations between premise statements and candidate statements through fine-grained syntactic component analysis and multi-angle comparison.
Smart Images

Figure CN116306580B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of natural language processing, and in particular to a method and device for recognizing entailment, a method and device for recognizing intention, an apparatus and a medium. BACKGROUND
[0002] Recognizing Textual Entailment (RTE) belongs to the natural language inference task and has been applied in the fields of machine reading comprehension, text similarity matching, text summarization, dialogue question answering, etc. Generally, given two sentences: a premise (P) sentence and a hypothesis (H) sentence, if the content of the H sentence can be inferred from the P sentence, it is considered that the P sentence and the H sentence have an entailment relationship; if the content opposite to the H sentence can be inferred from the P sentence, it is considered that the P sentence and the H sentence have a contradiction relationship; if the P sentence and the H sentence are irrelevant, it is considered that the P sentence and the H sentence have a neutral relationship. In the related art, only the similarity between the premise sentence and the hypothesis sentence is usually used to determine whether the two have an entailment relationship. Since the information used in the entailment relationship recognition is relatively single, the accuracy of the entailment relationship recognition result is low. Therefore, how to improve the accuracy of the entailment relationship recognition result has become one of the hot issues in the field of natural language processing technology. SUMMARY
[0003] The present application provides a method and device for recognizing entailment, a method and device for recognizing intention, an apparatus and a medium, which can improve the accuracy of the entailment relationship recognition result.
[0004] In a first aspect, the present application provides a method for recognizing entailment, which comprises: obtaining a premise sentence and a candidate sentence, and determining a first sentence vector of the premise sentence and a second sentence vector of the candidate sentence, the candidate sentence being a sentence to be determined whether it has an entailment relationship with the premise sentence; performing syntactic component analysis on the first sentence vector to obtain a first component vector corresponding to each syntactic component in the first sentence vector; performing syntactic component analysis on the second sentence vector to obtain a second component vector corresponding to each syntactic component in the second sentence vector; determining the similarity and the inclusion relationship of the first component vector and the second component vector of the same syntactic component, the inclusion relationship being used to reflect the overlapping relationship between the semantic ranges of the two component vectors; and determining the entailment relationship recognition result between the premise sentence and the candidate sentence according to the similarity and the inclusion relationship of the first component vector and the second component vector of each syntactic component.
[0005] In a second aspect, the present application provides an intention recognition method, comprising: obtaining a dialogue sentence sequence, the dialogue sentence sequence comprising a plurality of dialogue sentences; selecting, from a plurality of candidate dialogue sentences in a preset sentence library, a matching sentence having an entailment relationship with each dialogue sentence; wherein the entailment relationship between the dialogue sentence and the candidate dialogue sentence is obtained by using the entailment relationship recognition method in any one of the embodiments of the present application; and determining a target intention of each dialogue sentence according to a preset intention mapping relationship and the matching sentence of each dialogue sentence, the intention mapping relationship comprising a mapping relationship between each candidate dialogue sentence in the preset sentence library and a preset intention.
[0006] In a third aspect, the present application provides an entailment relationship recognition device, comprising: an obtaining module, configured to obtain a premise sentence and a candidate sentence, and determine a first sentence vector of the premise sentence and a second sentence vector of the candidate sentence, the candidate sentence being a sentence to be determined whether having an entailment relationship with the premise sentence; an analyzing module, configured to perform syntactic component analysis on the first sentence vector to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector; the analyzing module is further configured to perform syntactic component analysis on the second sentence vector to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector; a determining module, configured to determine a similarity and a containment relationship of the first component sub-vector and the second component sub-vector of the same syntactic component, the containment relationship being used to reflect an overlapping relationship between semantic ranges of two component sub-vectors; and a recognition module, configured to determine an entailment relationship recognition result between the premise sentence and the candidate sentence according to the similarity and the containment relationship of the first component sub-vector and the second component sub-vector of each syntactic component.
[0007] In a fourth aspect, the present application provides an intention recognition device, comprising: an obtaining module, configured to obtain a dialogue sentence sequence, the dialogue sentence sequence comprising a plurality of dialogue sentences; a selecting module, configured to select, from a plurality of candidate dialogue sentences in a preset sentence library, a matching sentence having an entailment relationship with each dialogue sentence; wherein the entailment relationship between the dialogue sentence and the candidate dialogue sentence is obtained by using the entailment relationship recognition method in any one of the embodiments of the present application; and a determining module, configured to determine a target intention of each dialogue sentence according to a preset intention mapping relationship and the matching sentence of each dialogue sentence, the intention mapping relationship comprising a mapping relationship between each candidate dialogue sentence in the preset sentence library and a preset intention.
[0008] In a fifth aspect, the present application provides an electronic device, comprising: at least one processor; and a memory communicatively connected with the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the entailment relationship identification method or the intention identification method.
[0009] In a sixth aspect, the present application provides a computer readable storage medium, having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the entailment relationship identification method or the intention identification method.
[0010] According to the embodiments provided in the present application, firstly, the premise sentence and the candidate sentence are acquired, and the first sentence vector of the premise sentence and the second sentence vector of the candidate sentence are determined, so as to convert the premise sentence and the candidate sentence into a data form which is easier for the electronic device to process, thereby providing a basis for subsequent entailment relationship identification; secondly, the first sentence vector is subjected to syntactic component analysis to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector, and the second sentence vector is subjected to syntactic component analysis to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector, by which the first sentence vector and the second sentence vector are divided in a more fine-grained manner, so that analysis and processing can be performed on the component sub-vectors with smaller granularity, which helps to improve the delicacy and accuracy of analysis; then, the similarity and the containment relationship between the first component sub-vector and the second component sub-vector of the same syntactic component are determined, so that the first component sub-vector and the second component sub-vector can be analyzed and compared from the two aspects of similarity and containment relationship, thereby providing a rich variety of basis for subsequent entailment relationship identification; finally, the similarity and the containment relationship can be used to more accurately determine the entailment relationship identification result between the premise sentence and the candidate sentence, thereby improving the identification accuracy of the entailment relationship.
[0011] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent to those skilled in the art through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0012] The accompanying drawings are included to provide a further understanding of the present application, and constitute a part of the specification, which together with the embodiments of the present application serve to explain the present application, and do not constitute a limitation of the present application. The above and other features and advantages will become more apparent to those skilled in the art through the description of the detailed example embodiments, with reference to the accompanying drawings, in which:
[0013] Figure 1A flowchart of a method for identifying a logical relationship provided by an embodiment of the present application is shown in FIG. 1.
[0014] Figure 2 A schematic diagram of a working process of a method for identifying a logical relationship provided by an embodiment of the present application is shown in FIG. 2.
[0015] Figure 3 A flowchart of a training method of a model for identifying a logical relationship provided by an embodiment of the present application is shown in FIG. 3.
[0016] Figure 4 A flowchart of a method for identifying an intent provided by an embodiment of the present application is shown in FIG. 4.
[0017] Figure 5 A schematic diagram of a working process of a method for identifying an intent provided by an embodiment of the present application is shown in FIG. 5.
[0018] Figure 6 A block diagram of a device for identifying a logical relationship provided by an embodiment of the present application is shown in FIG. 6.
[0019] Figure 7 A block diagram of a device for identifying an intent provided by an embodiment of the present application is shown in FIG. 7.
[0020] Figure 8 A block diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 8. DETAILED DESCRIPTION
[0021] In order for those skilled in the art to better understand the technical solutions of the present application, the exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered only as exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.
[0022] In the case of no conflict, each embodiment of the present application and each feature in the embodiments can be combined with each other.
[0023] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0024] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. "Coupled" or "connected" or similar terms are not restricted to physical or mechanical connections or associations, but can also include electrical connections, whether direct or indirect.
[0025] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present application, and will not be interpreted in an overly literal or overly formal sense unless expressly so defined herein.
[0026] In the related art, whether there is an implication relationship between the two is usually determined only by the similarity between the premise sentence and the hypothesis sentence, and the identification accuracy of the implication relationship is low due to the single information used.
[0027] In view of this, the embodiments of the present application provide an implication relationship identification method, an intent identification method, an apparatus, a device and a medium.
[0028] In the embodiments of the present application, first, the premise sentence and the candidate sentence are obtained, and the first sentence vector of the premise sentence and the second sentence vector of the candidate sentence are determined, so as to convert the premise sentence and the candidate sentence into a data form that is easier for the electronic device to process, thereby providing a basis for subsequent implication relationship identification; second, the first sentence vector is subjected to syntactic component analysis to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector, and the second sentence vector is subjected to syntactic component analysis to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector, by which operation, the first sentence vector and the second sentence vector are divided in a more fine-grained manner, so that analysis and processing can be performed on the component sub-vectors with smaller granularity, which helps to improve the delicacy and accuracy of the analysis; then, the similarity and the containment relationship of the first component sub-vector and the second component sub-vector of the same syntactic component are determined, so that the first component sub-vector and the second component sub-vector can be analyzed and compared from the two angles of similarity and containment relationship, thereby providing a variety of bases for subsequent implication relationship identification; finally, according to the similarity and the containment relationship, the implication relationship identification result between the premise sentence and the candidate sentence can be more accurately determined, thereby improving the identification accuracy of the implication relationship.
[0029] The implication relationship recognition method and intent recognition method of this application embodiments can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The methods can be implemented by a processor calling computer-readable program instructions stored in memory. Servers can be independent physical servers, server clusters consisting of multiple servers, or cloud servers capable of cloud computing.
[0030] In a first aspect, embodiments of this application provide a method for identifying implication relationships.
[0031] Figure 1 A flowchart illustrating an implication relationship identification method provided in an embodiment of this application. (Refer to...) Figure 1 The method for identifying implication relationships includes:
[0032] In step S11, the premise statement and the candidate statement are obtained, and the first statement vector of the premise statement and the second statement vector of the candidate statement are determined.
[0033] Implication refers to a semantic subordinate relationship between two statements. Given a premise statement and a hypothetical statement, if the content of the hypothetical statement can be inferred from the premise statement, then an implication relationship exists between them. For example, statement A is "He is a boy," and statement B is "He is a minor." Statement B can be inferred from statement A; therefore, an implication relationship exists between statements A and B. Here, statement A is the premise statement, and statement B is the hypothetical statement.
[0034] In some optional implementations, the candidate statement is a statement whose implication relationship with the premise statement is yet to be determined. In other words, it is not currently clear whether there is an implication relationship between the candidate statement and the premise statement, and it needs to be processed by the implication relationship identification method of this application embodiment before it can be determined whether the candidate statement and the premise statement have an implication relationship.
[0035] It should be noted that the number of candidate statements can be one or more, and this application embodiment does not limit this. When there are multiple candidate statements, the corresponding implication relationship identification processing can be performed for each candidate statement (parallel processing or serial processing can be used).
[0036] In some optional implementation manners, after the premise statement and the candidate statement are acquired, the premise statement and the candidate statement can be encoded by a text encoding mode, so as to obtain respective corresponding statement vectors, to facilitate processing by various electronic devices.
[0037] In some optional implementation manners, determining the first statement vector of the premise statement and the second statement vector of the candidate statement comprises: performing word segmentation on the premise statement and the candidate statement respectively to obtain a first word segmentation result corresponding to the premise statement and a second word segmentation result corresponding to the candidate statement; encoding the first word segmentation result corresponding to the premise statement to obtain the first statement vector of the premise statement; and encoding the second word segmentation result corresponding to the candidate statement to obtain the second statement vector of the candidate statement. The first word segmentation result can include one or more first words, and the second word segmentation result can also include one or more second words. The first word segmentation result is encoded, that is, each first word in the first word segmentation result is encoded. Similarly, the second word segmentation result is encoded, that is, each second word in the second word segmentation result is encoded.
[0038] Exemplarily, the premise statement is first subjected to word segmentation processing to obtain at least one first word corresponding to the premise statement. Then, each first word is subjected to Token Embedding, Segment Embedding and Positional Embedding, and after the three types of encoding are concatenated, Raw Embedding is obtained. The Raw Embedding is processed by using a multi-head attention mechanism to obtain a text representation form that can represent the semantic relationship between the premise statement and the candidate statement, that is, the first statement vector. The second statement vector of the candidate statement can also be obtained in a similar manner, which will not be described here.
[0039] It should be noted that the function of converting the statement into the statement vector can be realized by a corresponding encoding model, and the embodiments of the present application do not limit this.
[0040] It should be further noted that in some optional implementation manners, after the premise statement and the candidate statement are acquired, before the first statement vector of the premise statement and the second statement vector of the candidate statement are determined, the premise statement and the candidate statement are also subjected to deletion of coincident words. Through this processing, the data amount of subsequent processing can be reduced, resource consumption can be reduced, and recognition efficiency can be improved.
[0041] For example, the premise sentence is "My cat ate dried fish yesterday", the candidate sentence is "My cat ate something", the overlapping text of the two is "My cat", so "My cat" can be deleted to obtain "ate dried fish yesterday" and "ate something", and the two can be encoded respectively to obtain the first sentence vector and the second sentence vector.
[0042] In step S12, the first sentence vector is analyzed for syntactic components to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector.
[0043] In any one sentence, there is a certain combination relationship between words. According to different relationships, the sentence can be divided into different constituent components, which are syntactic components. For example, for a Chinese composed sentence, the syntactic components usually include subject, predicate, object, dynamic, attribute, adverb, complement, and center.
[0044] The first sentence vector is analyzed for syntactic components, that is, the corresponding relationship between each component in the first sentence vector and the syntactic component is analyzed, so that the first sentence vector is split into a first component sub-vector (which can be one or more) corresponding to each syntactic component according to the corresponding relationship.
[0045] For example, the first sentence vector is analyzed for syntactic components to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector, including: analyzing the first sentence vector for syntactic components to determine each syntactic component in the first sentence vector; and splitting the first sentence vector into a first component sub-vector corresponding to each syntactic component according to each syntactic component in the first sentence vector.
[0046] For example, after obtaining the first sentence vector for the premise sentence "I like art", the first sentence vector can be split into three first component sub-vectors through syntactic component analysis, which are a first first component sub-vector corresponding to the subject "I", a second first component sub-vector corresponding to the predicate "like", and a third first component sub-vector corresponding to the object "art".
[0047] In step S13, the second sentence vector is analyzed for syntactic components to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector.
[0048] In some optional implementations, the second sentence vector is analyzed for syntactic components to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector, including: analyzing the second sentence vector for syntactic components to determine each syntactic component in the second sentence vector; and splitting the second sentence vector into a second component sub-vector corresponding to each syntactic component according to each syntactic component in the second sentence vector.
[0049] It should be noted that when performing syntax analysis on the first sentence vector and the second sentence vector, the syntax component granularity should be the same or similar, so that the first component sub-vector and the second component sub-vector corresponding to the same syntax component can be determined more conveniently in subsequent analysis.
[0050] For example, the premise sentence is "I bought a large basket of Chinese cabbage", and the candidate sentence is "I bought vegetables". When performing syntax component analysis, for the premise sentence, "a large basket of Chinese cabbage" is uniformly taken as the object (i.e. "a large basket of Chinese cabbage" is not further split into the determiner "a large basket" and the noun "Chinese cabbage"), and for the candidate sentence, "vegetables" is taken as the object, so that the first component sub-vector corresponding to "a large basket of Chinese cabbage" and the second component sub-vector corresponding to "vegetables" correspond to the same syntax component (object).
[0051] In step S14, the similarity and the containment relationship of the first component sub-vector and the second component sub-vector of the same syntax component are determined.
[0052] The containment relationship is used to reflect the overlapping relationship between the semantic ranges of the two component sub-vectors, and can specifically represent the overlapping relationship between the semantic range represented by the first component sub-vector and the semantic range represented by the second component sub-vector. For example, for "electronic device" and "computer", the semantic range of "electronic device" includes all devices composed of electronic components such as integrated circuits, transistors, and electron tubes, and having certain functions, and "computer" is also composed of multiple electronic components and has certain computing power. Therefore, the semantic range of "electronic device" is greater than the semantic range of "computer" (i.e. the semantic range of the computer falls within the semantic range of the electronic device), so that "electronic device" and "computer" have a containment relationship, and the containment relationship means that "electronic device" contains "computer". For example, for "electronic device" and "book", the semantics expressed by the two are completely different, and there is no overlapping part, so that the two do not have a containment relationship.
[0053] Considering that the component sub-vectors corresponding to the same syntax component are more comparable, in step S14, the similarity and the containment relationship are determined for the first component sub-vector and the second component sub-vector of the same syntax component.
[0054] In some optional implementations, the similarity between the first component sub-vector and the second component sub-vector of the same syntactic component is obtained according to a preset similarity algorithm. For a syntactic component in the form of a sub-vector, the syntactic component is determined by a module and a direction, and therefore, for the first component sub-vector and the second component sub-vector of the same syntactic component, the similarity between the first component sub-vector and the second component sub-vector can be determined by the similarity between the module and the direction of the first component sub-vector and the second component sub-vector.
[0055] Exemplarily, the similarity algorithm includes a cosine similarity algorithm, a similarity algorithm based on Euclidean distance, a similarity algorithm based on Manhattan distance, and the like, and the embodiments of the present application do not limit this.
[0056] In some optional implementations, a syntactic component can be split into one or more sememes corresponding to the syntactic component in the form of sememe splitting, and whether the two syntactic components have a containing relationship can be determined by comparing the sememes of the two syntactic components. The sememe refers to a unit of meaning in a language. For example, for “sister”, the following sememes can be obtained by sememe splitting: [relative] [sibling] [older] [female]; for example, for “victory”, the following sememes can be obtained by sememe splitting: [competition] [defeat the opponent].
[0057] Further, for a syntactic component in the form of a sub-vector, the sememes of the syntactic component can be represented by sememe units (i.e., sememes corresponding to the vector form), and the sememe units can be obtained by singular value decomposition of the sub-vector. In other words, the sub-vector is further split into sememe units with smaller granularity, and whether the corresponding sub-vectors have a containing relationship is determined by comparing the sememe units.
[0058] In some optional implementations, determining the containing relationship between the first component sub-vector and the second component sub-vector of the same syntactic component includes: performing sememe splitting on the first component sub-vector and the second component sub-vector of the same syntactic component respectively to obtain first sememe units corresponding to each sememe in the first component sub-vector and second sememe units corresponding to each sememe in the second component sub-vector; determining sememe difference information between the first component sub-vector and the second component sub-vector according to the first sememe units corresponding to each sememe in the first component sub-vector and the second sememe units corresponding to each sememe in the second component sub-vector; and determining the containing relationship between the first component sub-vector and the second component sub-vector according to the sememe difference information between the first component sub-vector and the second component sub-vector.
[0059] In some optional implementation, determining the containment relationship between the first component sub-vector and the second component sub-vector of the same syntactic component includes: performing semantic element decomposition on the first component sub-vector and the second component sub-vector of the same syntactic component respectively to obtain first semantic element units corresponding to respective semantic elements in the first component sub-vector and second semantic element units corresponding to respective semantic elements in the second component sub-vector; determining semantic element difference information between the first component sub-vector and the second component sub-vector according to the first semantic element units corresponding to respective semantic elements in the first component sub-vector, the second semantic element units corresponding to respective semantic elements in the second component sub-vector, and the similarity between the first component sub-vector and the second component sub-vector; and determining the containment relationship between the first component sub-vector and the second component sub-vector according to the semantic element difference information between the first component sub-vector and the second component sub-vector.
[0060] In some optional implementation, performing semantic element decomposition on the first component sub-vector and the second component sub-vector of the same syntactic component respectively to obtain first semantic element units corresponding to respective semantic elements in the first component sub-vector and second semantic element units corresponding to respective semantic elements in the second component sub-vector includes: performing singular value decomposition (SVD) on the first component sub-vector to obtain the first semantic element units corresponding to respective semantic elements in the first component sub-vector; and performing singular value decomposition on the second component sub-vector to obtain the second semantic element units corresponding to respective semantic elements in the second component sub-vector.
[0061] For example, for a syntactic component of a verb nature, singular value decomposition can be performed from the dimensions of time, aspect, state, and the like, so as to split the component sub-vector corresponding to the syntactic component into a plurality of semantic element units.
[0062] For example, for a syntactic component of a noun nature, singular value decomposition can be performed from the dimensions of life degree, belonging category, shape, size, and the like, so as to split the component sub-vector corresponding to the syntactic component into a plurality of semantic element units.
[0063] Exemplarily, for the first component vector X and the second component vector Y, on one hand, the similarity between the two is calculated by a preset similarity algorithm, and a similarity s (s≤1) is obtained; on the other hand, the first component vector X is singular value decomposed, and the obtained decomposition results x1, x2, …, xn can be regarded as n first sememe units (n≥1), and similarly, the second component vector Y is singular value decomposed, and the obtained decomposition results y1, y2, …, ym can be regarded as m second sememe units (m≥1). Wherein, xi (indicating the i th first sememe unit) and yj (indicating the j th second sememe unit) can be the same, which is only for convenience of representation. For example, x2 and y4 can both represent [integrated circuit]. In some optional implementation, the difference information between the first component vector X and the second component vector Y can be represented as (x1+x2+…+xn)-(y1+y2+…+ym). Through the difference information, whether the first component vector X and the second component vector Y have a containing relationship can be determined. Exemplarily, if the sememe units reserved in the difference information all belong to the sememe units of the first component vector, it indicates that the semantic range of the second component vector is greater than that of the first component vector, and therefore, the second component vector contains the first component vector. Conversely, similar description is not expanded here.
[0064] For example, the first component vector corresponds to "cat", and the second component vector corresponds to "animal", cat = [can move independently] [need to eat] [feline] [can emit meow sound], animal = [can move independently] [need to eat], and the difference information between the two corresponds to [feline] [can emit meow sound]. Therefore, it can be known that the semantic range of animal is greater than that of cat, and therefore, the second component vector contains the first component vector.
[0065] In some optional implementation, taking the second component vector as a reference vector (or taking the first component vector as a reference vector), since the similarity between the first component vector and the second component vector is s, X can be represented as s*(y1+y2+…+ym), and therefore, the difference information between the first component vector X and the second component vector Y can be represented as s*(y1+y2+…+ym)-(y1+y2+…+ym). Through the difference information, whether the first component vector X and the second component vector Y have a containing relationship can also be determined by using a similar method.
[0066] In step S15, according to the similarity and the containing relationship between the first component vector and the second component vector of each syntactic component, the recognition result of the entailment relationship between the premise sentence and the candidate sentence is determined.
[0067] If the similarity between the first component vector and the second component vector is high and the two have a containment relationship, it is considered that the first component vector and the second component vector corresponding to the syntactic component have a containment relationship. For the entire premise sentence and the candidate sentence, if most of the syntactic components have a corresponding containment relationship, it is considered that the premise sentence and the candidate sentence have a containment relationship.
[0068] For example, if the total number of syntactic components is k, the number of syntactic components with a similarity greater than a preset similarity threshold is p, and the number of syntactic components with a containment relationship is p (i.e., the number of second component vectors containing the first component vector is p), when p / k*100% is greater than or equal to a first preset proportion threshold, it is determined that the premise sentence and the candidate sentence have a containment relationship.
[0069] For example, different weights can also be set for different syntactic components to represent the influence of each syntactic component on the containment relationship identification. First, the weights and the similarity of each syntactic component are calculated to obtain the sum of the weighted similarities. When the sum of the weighted similarities is greater than a preset total similarity threshold, and the proportion of the number of syntactic components with a containment relationship to the total number of syntactic components is greater than a second preset proportion threshold, it is determined that the premise sentence and the candidate sentence have a containment relationship.
[0070] It should be noted that the above method of determining the containment relationship identification result according to the similarity and the containment relationship between the first component vector and the second component vector of each syntactic component is only an example, and the embodiments of the present application are not limited thereto.
[0071] In the embodiment of the present application, first, the premise sentence and the candidate sentence are obtained, and the first sentence vector of the premise sentence and the second sentence vector of the candidate sentence are determined, so as to convert the premise sentence and the candidate sentence into a data form which is easier for the electronic device to process, thereby providing a basis for subsequent entailment relationship identification; second, the first sentence vector is analyzed in terms of syntactic components to obtain first component sub-vectors corresponding to each syntactic component in the first sentence vector, and the second sentence vector is analyzed in terms of syntactic components to obtain second component sub-vectors corresponding to each syntactic component in the second sentence vector, by which the first sentence vector and the second sentence vector are divided in a more fine-grained manner, so that analysis and processing can be performed on the component sub-vectors with smaller granularity, which helps to improve the delicacy and accuracy of analysis; then, the similarity and the containment relationship between the first component sub-vectors and the second component sub-vectors of the same syntactic component are determined, so that the first component sub-vectors and the second component sub-vectors can be analyzed and compared from the two angles of similarity and containment relationship, thereby providing a variety of basis for subsequent entailment relationship identification; finally, the similarity and the containment relationship can be used to more accurately determine the entailment relationship identification result between the premise sentence and the candidate sentence, thereby improving the identification accuracy of the entailment relationship.
[0072] Figure 2 A working process diagram of an entailment relationship identification method provided in the embodiment of the present application is shown in FIG. 1. Referring to FIG. 1, Figure 2 , first, the premise sentence and the candidate sentence are obtained, and the premise sentence and the candidate sentence are encoded respectively to obtain the first sentence vector corresponding to the premise sentence and the second sentence vector corresponding to the candidate sentence. Then, the first sentence vector and the second sentence vector are analyzed in terms of syntactic components to obtain a plurality of first component sub-vectors corresponding to the first sentence vector and a plurality of second component sub-vectors corresponding to the second sentence vector. For example, the first sentence vector corresponds to the first component sub-vector 11, the first component sub-vector 12, …, the first component sub-vector 1n; the second sentence vector corresponds to the second component sub-vector 11, the second component sub-vector 22, …, the second component sub-vector 2n (here, for the convenience of description, it is assumed that the number of component sub-vectors of the two is the same, and the component sub-vectors at the same position correspond to the same syntactic component).
[0073] Further, for the first component sub-vectors and the second component sub-vectors of the same syntactic component, the similarity between the two is calculated based on a similarity algorithm. For example, the first component sub-vector 11 and the second component sub-vector 21 correspond to the same syntactic component, and based on the two, the similarity 1 can be obtained, similarly, the similarity 2 between the first component sub-vector 12 and the second component sub-vector 22, …, the similarity n between the first component sub-vector 1n and the second component sub-vector 2n.
[0074] In addition, each first component molecular vector is subjected to semantic element decomposition, and for each first component molecular vector, one or more first semantic element units corresponding to the first component molecular vector can be obtained. Similarly, each second component molecular vector is also subjected to semantic element decomposition, and one or more second semantic element units corresponding to each second component molecular vector can be obtained. For example, the first component molecular vector 11 is subjected to semantic element decomposition, and the first semantic element unit 111, the first semantic element unit 112, …, and the first semantic element unit 11a can be obtained. The other first component molecular vectors are similar, and will not be described here. The second component molecular vector 21 is subjected to semantic element decomposition, and the second semantic element unit 211, the second semantic element unit 212, …, and the second semantic element unit 21d can be obtained. The other second component molecular vectors are similar, and will not be described here.
[0075] Further, for the first component molecular vector and the second component molecular vector corresponding to the same syntactic component, the difference information between the first component molecular vector and the second component molecular vector can be determined according to the semantic element units, and then whether the first component molecular vector and the second component molecular vector have a containing relationship can be determined according to the difference information. For example, for the first component molecular vector 11 and the second component molecular vector 21, the difference information between the first component molecular vector and the second component molecular vector can be determined according to the semantic element units as follows: (first semantic element unit 111+first semantic element unit 112+…+first semantic element unit 11a)-(second semantic element unit 211+second semantic element unit 212+…+second semantic element unit 21d). According to the difference information, whether the first component molecular vector and the second component molecular vector have a containing relationship can be determined. Similarly, the similarity and the containing relationship of the first component molecular vector and the second component molecular vector corresponding to each syntactic component can be obtained.
[0076] For example, if the total number of syntactic components is k, the number of first component molecular vectors and second component molecular vectors corresponding to the same syntactic component and having a similarity greater than a preset similarity threshold is p1, and the number of syntactic components having a containing relationship is p2 (i.e., the number of second component molecular vectors containing the first component molecular vectors corresponding to the same syntactic component is p2), when p1 / k*100% is greater than or equal to a third preset proportion threshold and p2 / k*100% is greater than or equal to a fourth preset proportion threshold, it is determined that the entailment relationship recognition result of the premise sentence and the candidate sentence has an entailment relationship.
[0077] It should be noted that the above method of determining the entailment relationship recognition result according to the similarity and the containing relationship of the first component molecular vector and the second component molecular vector of each syntactic component is only an example, and embodiments of the present application do not limit the same.
[0078] In some optional implementations, the above entailment relationship recognition method can be implemented in a modeling manner, i.e., an entailment relationship recognition model can be used to recognize the entailment relationship between the premise sentence and the candidate sentence, so as to obtain the corresponding entailment relationship recognition result.
[0079] Figure 3 A training method flowchart of an implication relationship identification model is provided for the embodiments of the present application. Referring to Figure 3 , the training method comprises:
[0080] In step S31, an initial implication relationship identification model is constructed.
[0081] In some optional implementations, according to the word segmentation function, encoding function, similarity calculation function, inclusion relationship determination function and the like possessed by the implication relationship identification model, corresponding network levels can be constructed through a neural network, and these network levels can be connected together, so as to obtain the initial implication relationship identification model.
[0082] In step S32, training data is obtained.
[0083] In some optional implementations, the training data comprises training texts and expected training results.
[0084] Exemplarily, the training texts comprise: sentence 1; sentence 2; sentence 3; …; and the expected training results are represented in the form of labels: the expected labels are [{“root”:1},{“-1”:0.8},{“-1”:0.8,“-2”:0.6}……], wherein “:” represents a key-value pair, the key represents a premise sentence relative to the current candidate sentence, and the value represents the probability of the implication relationship between the premise sentence and the current candidate sentence. For example, “root” indicates that the current sentence is the first sentence, and there is no premise sentence, “-1” indicates the probability of the implication relationship of the current candidate sentence with the adjacent sentence on the left side, and “-2” indicates the probability of the implication relationship of the current candidate sentence with the second sentence on the left side.
[0085] In step S33, the training data is input into the initial implication relationship identification model for iterative training, and in the case that a preset stopping condition is met, a trained implication relationship identification model is obtained.
[0086] In some optional implementations, through the processing of the implication relationship identification model, the obtained implication relationship identification result comprises actual labels: [{“root”:1},{“-1”:0.7},{“-1”:0.8,“-2”:0.5},……], by comparing the actual labels and the expected labels, based on a preset loss function, a loss value can be calculated, when the loss value is less than a preset loss threshold, it is considered that the model has been effectively trained, thus the training is stopped, a trained implication relationship identification model is obtained, and the implication relationship identification model can be used to accurately and efficiently identify whether there is an implication relationship between sentences.
[0087] In a second aspect, the embodiments of the present application provide an intent recognition method.
[0088] Figure 4 A flowchart of the intent recognition method provided by the embodiments of the present application is shown in FIG. 4. Referring to FIG. 4, Figure 4 The intent recognition method comprises the following steps:
[0089] In step S41, a dialogue sentence sequence is obtained.
[0090] In some optional implementations, the dialogue sentence sequence comprises a plurality of dialogue sentences.
[0091] In some optional implementations, the plurality of dialogue sentences in the dialogue sentence sequence are arranged based on a dialogue order of the client and the server.
[0092] Exemplarily, the dialogue sentence sequence is a sequence of dialogue sentences generated by a user through a client and an agent through a server in a process of business handling, business consultation, etc., wherein part of the sentences are dialogue sentences of the user, which can reflect the intent of the user, and part of the sentences are dialogue sentences of the agent, which can reflect the intent of the agent.
[0093] In step S42, a matching sentence having an entailment relationship with each dialogue sentence is selected from a plurality of candidate dialogue sentences in a preset sentence library.
[0094] The entailment relationship between the dialogue sentence and the candidate dialogue sentence is obtained by using the entailment relationship recognition method of any one of the embodiments of the present application.
[0095] In some optional implementations, a large number of candidate dialogue sentences are set in the preset sentence library, which can include dialogues of different roles (e.g., user, agent) in different business scenarios, so as to cover various dialogue situations as much as possible and ensure that the dialogue sentences in the dialogue sentence sequence can all find matching sentences in the preset sentence library.
[0096] Exemplarily, for a dialogue sentence, first, the role, business scenario, etc. of the dialogue sentence are determined, and the candidate dialogue sentences matching the role and the business scenario are screened from the preset sentence library, so as to reduce the number of candidate dialogue sentences to be determined for the entailment relationship; then, for the screened candidate dialogue sentences, it is determined whether the dialogue sentence has an entailment relationship with these candidate dialogue sentences, and the candidate dialogue sentence having the entailment relationship is determined as the matching sentence of the dialogue sentence.
[0097] For example, when the entailment relationship between the dialogue sentence and the candidate dialogue sentence is represented by an entailment relationship probability, the candidate dialogue sentence corresponding to the maximum value is selected from the entailment relationship probabilities between the dialogue sentence and each candidate dialogue sentence, as the matching sentence of the dialogue sentence.
[0098] In step S43, the target intent of each dialogue sentence is determined according to the preset intent mapping relationship and the matching sentence of each dialogue sentence.
[0099] The intent is an abstract concept, and the intent can represent the purpose of the user's speech.
[0100] In some optional implementations, the intent mapping relationship includes a mapping relationship between each candidate dialogue sentence of the preset sentence library and a preset intent. The preset intent can represent the intent of the candidate dialogue sentence with the mapping relationship.
[0101] For example, according to the preset intent mapping relationship and the matching sentence of each dialogue sentence, the target intent of each dialogue sentence is determined, including: according to the intent mapping relationship, determining the preset intent corresponding to each matching sentence; the preset intent corresponding to the matching sentence is taken as the target intent of the dialogue sentence corresponding to the matching sentence.
[0102] In some optional implementations, after determining the target intent of each dialogue sentence according to the preset intent mapping relationship and the matching sentence of each dialogue sentence, the method further includes:
[0103] determining the syntactic association relationship between the dialogue sentences, the syntactic association relationship being used to represent the logical relationship between the dialogue sentences in syntax; determining the intent association relationship between the target intents according to the syntactic association relationship between the dialogue sentences and the target intents of each dialogue sentence, the intent association relationship being used to represent the logical relationship between the intents; obtaining an intent logical tree according to the intent association relationship between the target intents; determining whether the dialogue sentences of the server conform to the expected dialogue logic according to the intent logical tree. In other words, after obtaining the target intents of each dialogue sentence and the intent association relationship thereof, part of the target intents can be combined to obtain an intent logical tree with a tree structure.
[0104] In some optional implementations, the syntactic association relationship includes at least one of a transition relationship, a hypothesis relationship, a condition relationship, a cause-effect relationship, a parallel relationship, a connection relationship, a progressive relationship, and a selection relationship; and the intent association relationship includes at least one of a transition relationship, a hypothesis relationship, a condition relationship, a cause-effect relationship, a parallel relationship, a connection relationship, a progressive relationship, and a selection relationship.
[0105] For example, for the sentences "If it rains tomorrow" and "Remind me to bring an umbrella", the condition relationship exists between them in the syntactic logic, that is, only when the condition of raining tomorrow is met, the operation of reminding to bring an umbrella will be executed. Further, the intent corresponding to "If it rains tomorrow" is "determine whether it will rain tomorrow", and the intent corresponding to "Remind me to bring an umbrella" is to remind to carry an umbrella. The condition relationship also exists between the two intents, that is, in the case of raining tomorrow, the operation of reminding to carry an umbrella will be executed.
[0106] In some optional implementations, the intent logic tree can also be scored by a preset logic scoring system, and whether the agent adopts reasonable logic in the conversation with the customer can be determined according to the score. In the logic scoring system, a complete set of intent association relationships can be embedded or obtained in advance. By comparing the intent logic tree with the set of intent association relationships, it can be determined whether the intent logic tree is reasonable, and a corresponding score can be given.
[0107] In the embodiment of the application, first, a dialogue sentence sequence is obtained, the dialogue sentence sequence includes a plurality of dialogue sentences, and it is clear which dialogue sentences need to be identified for intent; second, a matching sentence having an entailment relationship with each dialogue sentence is selected from a plurality of candidate dialogue sentences in a preset sentence library, the entailment relationship between the sentences is applied to the intent identification scenario, and a new intent identification method is provided; finally, according to a preset intent mapping relationship and the matching sentence of each dialogue sentence, a target intent of each dialogue sentence is determined, and the intent mapping relationship includes a mapping relationship between each candidate dialogue sentence in the preset sentence library and a preset intent. Through this step, the target intent of each dialogue sentence is clear, and an intent identification result is obtained, so that the intent identification result can be used for further analysis and processing.
[0108] Figure 5 A working process diagram of an intent identification method provided by the embodiment of the application is shown. Referring to Figure 5 , the customer and the agent have a conversation in the process of handling the business, and a dialogue sentence sequence is generated, including dialogue sentence 1, dialogue sentence 2, …, dialogue sentence n, and the intents of these dialogue sentences (i.e., the target intents of the dialogue sentences) need to be identified.
[0109] In some optional implementations, the preset sentence library includes m candidate dialogue sentences (including candidate dialogue sentence 1, candidate dialogue sentence 2, candidate dialogue sentence 3, …, candidate dialogue sentence m), and each candidate dialogue sentence corresponds to a preset intent. For example, candidate dialogue sentence 1 corresponds to preset intent A, candidate dialogue sentence 2 corresponds to preset intent B, candidate dialogue sentence 3 corresponds to preset intent C, and so on. Figure 1 That is, the intent implied by candidate dialogue sentence 1 is preset intent A. Figure 1 .
[0110] Exemplarily, for dialogue sentence 1, first, the entailment relationship identification method of any one of the embodiments of the application is used to determine that the candidate dialogue sentence having an entailment relationship with dialogue sentence 1 in the preset sentence library is candidate dialogue sentence 3, and the candidate dialogue sentence 3 is taken as the matching sentence of dialogue sentence 1. Since candidate dialogue sentence 3 corresponds to preset intent C, it is determined that the target intent of dialogue sentence 1 is preset intent C. Figure 3 Figure 3 Based on similar manners, it can be obtained that the target intent of the dialogue sentence 2 is the preset intent m, the target intent of the dialogue sentence n is the preset intent Figure 1 .
[0111] It can be understood that the above-mentioned various method embodiments mentioned in the present application can be combined with each other to form combined embodiments without deviating from the principle logic. Limited by the length of the article, the present application will not be described again. Those skilled in the art can understand that in the above-mentioned method of the specific embodiment, the specific execution order of each step should be determined according to its function and possible internal logic.
[0112] In a third aspect, the embodiments of the present application provide a containment relationship identification device.
[0113] Figure 6 A block diagram of a containment relationship identification device provided by the embodiments of the present application.
[0114] With reference to Figure 6 The embodiments of the present application provide a containment relationship identification device, which comprises:
[0115] The acquisition module 601 is configured to acquire a premise sentence and a candidate sentence, and determine a first sentence vector of the premise sentence and a second sentence vector of the candidate sentence, wherein the candidate sentence is a sentence to be determined whether it has a containment relationship with the premise sentence.
[0116] The analysis module 602 is configured to perform syntactic component analysis on the first sentence vector to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector.
[0117] The analysis module 602 is further configured to perform syntactic component analysis on the second sentence vector to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector.
[0118] The determination module 603 is configured to determine the similarity and the containment relationship of the first component sub-vector and the second component sub-vector of the same syntactic component, wherein the containment relationship is used to reflect the overlapping relationship between the semantic ranges of the two component sub-vectors.
[0119] The identification module 604 is configured to determine the containment relationship identification result between the premise sentence and the candidate sentence according to the similarity and the containment relationship of the first component sub-vector and the second component sub-vector of each syntactic component.
[0120] In some optional implementations, when determining the first sentence vector of the premise sentence and the second sentence vector of the candidate sentence, the acquisition module 601 performs the following steps:
[0121] The premise sentence and the candidate sentence are segmented respectively to obtain a first segmentation result corresponding to the premise sentence and a second segmentation result corresponding to the candidate sentence; the first segmentation result corresponding to the premise sentence is encoded to obtain a first sentence vector of the premise sentence; and the second segmentation result corresponding to the candidate sentence is encoded to obtain a second sentence vector of the candidate sentence.
[0122] In some optional implementations, when the analysis module 602 performs syntactic component analysis on the first sentence vector to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector, the following steps are performed:
[0123] performing syntactic component analysis on the first sentence vector to determine each syntactic component in the first sentence vector; splitting the first sentence vector into a first component sub-vector corresponding to each syntactic component according to the each syntactic component in the first sentence vector; and / or,
[0124] When the analysis module 602 performs syntactic component analysis on the second sentence vector to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector, the following steps are performed: performing syntactic component analysis on the second sentence vector to determine each syntactic component in the second sentence vector; and splitting the second sentence vector into a second component sub-vector corresponding to each syntactic component according to the each syntactic component in the second sentence vector.
[0125] In some optional implementations, the similarity between the first component sub-vector and the second component sub-vector of the same syntactic component is obtained according to a preset similarity algorithm.
[0126] In some optional implementations, when the determination module 603 determines the inclusion relationship between the first component sub-vector and the second component sub-vector of the same syntactic component, the following steps are performed: performing semantic element splitting on the first component sub-vector and the second component sub-vector of the same syntactic component respectively to obtain a first semantic element unit corresponding to each semantic element in the first component sub-vector and a second semantic element unit corresponding to each semantic element in the second component sub-vector; determining semantic difference information between the first component sub-vector and the second component sub-vector according to the first semantic element unit corresponding to each semantic element in the first component sub-vector and the second semantic element unit corresponding to each semantic element in the second component sub-vector; and determining the inclusion relationship between the first component sub-vector and the second component sub-vector according to the semantic difference information between the first component sub-vector and the second component sub-vector.
[0127] In some optional implementations, when the determination module 603 performs semantic element splitting on the first component sub-vector and the second component sub-vector of the same syntactic component respectively to obtain a first semantic element unit corresponding to each semantic element in the first component sub-vector and a second semantic element unit corresponding to each semantic element in the second component sub-vector, the following steps are performed:
[0128] The first component sub-vector is singular value decomposed to obtain a first semantic unit corresponding to each semantic in the first component sub-vector; and the second component sub-vector is singular value decomposed to obtain a second semantic unit corresponding to each semantic in the second component sub-vector.
[0129] According to the embodiments provided in the present application, first, the obtaining module 601 obtains the premise sentence and the candidate sentence, and determines the first sentence vector of the premise sentence and the second sentence vector of the candidate sentence, so as to convert the premise sentence and the candidate sentence into a data form which is easier for the electronic device to process, thereby providing a basis for subsequent entailment relationship recognition; second, the analysis module 602 performs syntactic component analysis on the first sentence vector to obtain a first component sub-vector corresponding to each syntactic component in the first sentence vector, and performs syntactic component analysis on the second sentence vector to obtain a second component sub-vector corresponding to each syntactic component in the second sentence vector, so that the first sentence vector and the second sentence vector are divided into more fine-grained component sub-vectors, thereby the analysis and processing can be performed on the component sub-vectors with smaller granularity, which helps to improve the delicacy and accuracy of the analysis; then, the determining module 603 determines the similarity and the containment relationship between the first component sub-vector and the second component sub-vector of the same syntactic component, so that the first component sub-vector and the second component sub-vector can be analyzed and compared from the two aspects of the similarity and the containment relationship, thereby providing a rich and diverse basis for subsequent entailment relationship recognition; finally, the recognition module 604 can more accurately determine the entailment relationship recognition result between the premise sentence and the candidate sentence according to the similarity and the containment relationship, thereby improving the recognition accuracy of the entailment relationship.
[0130] In a fourth aspect, the embodiments of the present application provide an intent recognition device.
[0131] Figure 7 A block diagram of an intent recognition device provided by the embodiments of the present application is provided.
[0132] With reference to Figure 7 The intent recognition device 700 provided by the embodiments of the present application includes:
[0133] The obtaining module 701 is configured to obtain a dialogue sentence sequence, the dialogue sentence sequence including a plurality of dialogue sentences.
[0134] The selecting module 702 is configured to select a matching sentence having an entailment relationship with each dialogue sentence from a plurality of candidate dialogue sentences in a preset sentence library; wherein the entailment relationship between the dialogue sentence and the candidate dialogue sentence is obtained by using the entailment relationship recognition method of any one of the embodiments of the present application.
[0135] The determining module 703 is configured to determine a target intent of each dialogue sentence according to a preset intent mapping relationship and a matching sentence of each dialogue sentence. The intent mapping relationship includes a mapping relationship between each candidate dialogue sentence of the preset sentence library and a preset intent.
[0136] In some optional implementations, a plurality of dialogue sentences in the dialogue sentence sequence are arranged based on a dialogue order of the client and the server. After the determining module 703 determines the target intent of each dialogue sentence according to the preset intent mapping relationship and the matching sentence of each dialogue sentence, the following steps are further performed:
[0137] A syntactic association relationship between each dialogue sentence is determined. The syntactic association relationship is used to represent a logical relationship between the dialogue sentences in syntax. An intent association relationship between the target intents is determined according to the syntactic association relationship between the dialogue sentences and the target intent of each dialogue sentence. An intent logic tree is obtained according to the intent association relationship between the target intents. Whether the dialogue sentence of the server conforms to an expected dialogue logic is determined according to the intent logic tree.
[0138] In some optional implementations, the syntactic association relationship includes at least one of a transition relationship, a hypothesis relationship, a condition relationship, a cause-effect relationship, a parallel relationship, a connection relationship, a progressive relationship, and a selection relationship. The intent association relationship includes at least one of the transition relationship, the hypothesis relationship, the condition relationship, the cause-effect relationship, the parallel relationship, the connection relationship, the progressive relationship, and the selection relationship.
[0139] In the embodiments of the present application, first, the dialogue sentence sequence is obtained by the obtaining module 701. The dialogue sentence sequence includes a plurality of dialogue sentences, and it is clear which dialogue sentences need to be intent-identified. Second, the matching sentence having an entailment relationship with each dialogue sentence is selected from the plurality of candidate dialogue sentences of the preset sentence library by the selecting module 702. The entailment relationship between the sentences is applied to the intent identification scene, thereby providing a new intent identification manner. Finally, the determining module 703 determines the target intent of each dialogue sentence according to the preset intent mapping relationship and the matching sentence of each dialogue sentence. The intent mapping relationship includes a mapping relationship between each candidate dialogue sentence of the preset sentence library and a preset intent. Through this step, the target intent of each dialogue sentence is clear, and an intent identification result is obtained, so that the intent identification result can be used for further analysis and processing.
[0140] In addition, the present application also provides an electronic device and a computer readable storage medium, which can be used to implement any one of the entailment relationship identification methods or the intent identification methods provided by the present application. The corresponding technical solutions and descriptions are described in the method part and are not repeated here.
[0141] Figure 8A block diagram of an electronic device is provided for embodiments of the present application.
[0142] With reference to Figure 8 The electronic device provided by the embodiments of the present application comprises: at least one processor 801; at least one memory 802, and one or more I / O interfaces 803 connected between the processor 801 and the memory 802; wherein the memory 802 stores one or more computer programs executable by the at least one processor 801, and the one or more computer programs are executed by the at least one processor 801 to enable the at least one processor 801 to perform the above-mentioned implication relationship identification method or the intention identification method.
[0143] The embodiments of the present application also provide a computer readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processing core, implements the above-mentioned implication relationship identification method or the intention identification method. The computer readable storage medium can be a volatile or non-volatile computer readable storage medium.
[0144] The embodiments of the present application also provide a computer program product comprising computer readable code, or a non-volatile computer readable storage medium carrying computer readable code, when the computer readable code is run in the processor of the electronic device, the processor in the electronic device performs the above-mentioned implication relationship identification method or the intention identification method.
[0145] Those skilled in the art can understand that all or some of the steps in the above disclosed method, the functions of the modules / units in the system and the device can be implemented as software, firmware, hardware and their appropriate combinations. In the hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component can have multiple functions, or one function or step can be performed by several physical components in cooperation. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software can be distributed on a computer readable storage medium, which can include computer storage media (or non-transitory media) and communication media (or transitory media).
[0146] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0147] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0148] Computer readable program instructions for carrying out operations of the present application can be assembly instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate array (FPGA), or programmable logic array (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present application.
[0149] The computer program product described herein can be embodied in a specific manner by hardware, software, or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), and the like.
[0150] The various aspects of the present application are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present application. It will be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer readable program instructions.
[0151] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can be a computer- readable storage medium having no data storage cycles that change state. The instructions can be executed by one or more processors of a computer, other programmable data processing apparatus, or other devices to produce a computer-implemented process such that the instructions which execute via the one or more processors of the computer or other programmable data processing devices create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. The computer program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0152] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0153] The flow and block diagrams in the drawings show architectural, functional, and operational aspects of possible implementations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flow and block diagrams can represent a module, a segment, or a portion of instructions which comprise one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may
[0154] Example embodiments have been disclosed and, although specific terms are employed, they are used in a generic and descriptive sense only and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that features, characteristics or aspects described with reference to a particular embodiment can be used alone or in combination with other embodiments. Accordingly, it will be understood that various changes in form and details can be made without departing from the scope of the present application as set forth in the following claims.
Claims
1. A method for identifying implication relationships, characterized in that, include: Obtain the premise statement and the candidate statement, and determine the first statement vector of the premise statement and the second statement vector of the candidate statement, wherein the candidate statement is a statement whose implication relationship with the premise statement is to be determined; Perform syntactic component analysis on the first statement vector to obtain the first component sub-vectors corresponding to each syntactic component in the first statement vector; Perform syntactic component analysis on the second statement vector to obtain the second component sub-vectors corresponding to each syntactic component in the second statement vector; The similarity and inclusion relationship between the first component sub-vector and the second component sub-vector with the same syntactic components are determined, wherein the inclusion relationship is used to reflect the overlap between the semantic ranges of the two component sub-vectors; Based on the similarity between the first component vector and the second component vector of each syntactic component and the inclusion relationship, the implication relationship identification result between the premise statement and the candidate statement is determined.
2. The method according to claim 1, characterized in that, The step of performing syntactic component analysis on the first statement vector to obtain the first component sub-vectors corresponding to each syntactic component in the first statement vector includes: Perform syntactic component analysis on the first statement vector to determine each syntactic component of the first statement vector; Based on each syntactic component in the first statement vector, the first statement vector is split into first component sub-vectors corresponding to each syntactic component; and / or, The step of performing syntactic component analysis on the second statement vector to obtain the second component sub-vectors corresponding to each syntactic component in the second statement vector includes: Perform syntactic component analysis on the second statement vector to determine each syntactic component in the second statement vector; Based on each syntactic component in the second statement vector, the second statement vector is split into second component sub-vectors corresponding to each syntactic component.
3. The method according to claim 1, characterized in that, Determining the inclusion relationship between the first component subvector and the second component subvector that share the same syntactic components includes: Semantic component decomposition is performed on the first component subvector and the second component subvector with the same syntactic component to obtain the first semantic component unit corresponding to each semantic component in the first component subvector and the second semantic component unit corresponding to each semantic component in the second component subvector. Based on the first semantic unit corresponding to each semantic element in the first component vector and the second semantic unit corresponding to each semantic element in the second component vector, determine the semantic difference information between the first component vector and the second component vector; Based on the semantic difference information between the first component vector and the second component vector, the inclusion relationship between the first component vector and the second component vector is determined.
4. The method according to claim 3, characterized in that, The step of performing semantic component decomposition on the first component sub-vector and the second component sub-vector of the same syntactic component to obtain the first semantic component unit corresponding to each semantic component in the first component sub-vector and the second semantic component unit corresponding to each semantic component in the second component sub-vector includes: Singular value decomposition is performed on the first component subvector to obtain the first semantic element unit corresponding to each semantic element in the first component subvector. Singular value decomposition is performed on the second component vector to obtain the second semantic element unit corresponding to each semantic element in the second component vector.
5. An intent recognition method, characterized in that, include: Obtain a sequence of dialogue statements, wherein the sequence of dialogue statements includes multiple dialogue statements; Select matching statements that have an implication relationship with each of the dialogue statements from a plurality of candidate dialogue statements in a preset statement library; wherein, the implication relationship between the dialogue statement and the candidate dialogue statement is obtained by the implication relationship identification method as described in any one of claims 1-4; Based on the preset intent mapping relationship and the matching statement of each of the dialogue statements, the target intent of each of the dialogue statements is determined. The intent mapping relationship includes the mapping relationship between each candidate dialogue statement in the preset statement library and the preset intent.
6. The method according to claim 5, characterized in that, The multiple dialogue statements in the dialogue statement sequence are arranged based on the dialogue order between the client and the server; After determining the target intent of each dialogue statement based on the preset intent mapping relationship and the matching statement of each dialogue statement, the method further includes: Determine the syntactic relationships between the various dialogue statements, wherein the syntactic relationships are used to represent the logical syntactic relationships between the dialogue statements; Based on the syntactic relationships between the dialogue statements and the target intent of each dialogue statement, determine the intent relationships between the target intents; Based on the intent relationships between the target intents, an intent logic tree is obtained; Based on the intent logic tree, determine whether the server's dialogue statements conform to the expected dialogue logic.
7. An implication relationship identification device, characterized in that, include: The acquisition module is used to acquire premise statements and candidate statements, and determine a first statement vector of the premise statements and a second statement vector of the candidate statements, wherein the candidate statements are statements whose implication relationship with the premise statements is to be determined; The analysis module is used to perform syntactic component analysis on the first statement vector to obtain the first component sub-vectors corresponding to each syntactic component in the first statement vector; The analysis module is also used to perform syntactic component analysis on the second statement vector to obtain the second component sub-vectors corresponding to each syntactic component in the second statement vector; The determination module is used to determine the similarity and inclusion relationship between the first component sub-vector and the second component sub-vector with the same syntactic components, wherein the inclusion relationship is used to reflect the overlap relationship between the semantic ranges of the two component sub-vectors; The identification module is used to determine the implication relationship identification result between the premise statement and the candidate statement based on the similarity between the first component vector and the second component vector of each syntactic component and the inclusion relationship.
8. An intent recognition device, characterized in that, include: The acquisition module is used to acquire a sequence of dialogue statements, which includes multiple dialogue statements; The selection module is used to select matching statements that have an implication relationship with each of the dialogue statements from a plurality of candidate dialogue statements in a preset statement library; wherein the implication relationship between the dialogue statement and the candidate dialogue statement is obtained by the implication relationship identification method as described in any one of claims 1-4. The determination module is used to determine the target intent of each dialogue statement based on a preset intent mapping relationship and the matching statement of each dialogue statement. The intent mapping relationship includes the mapping relationship between each candidate dialogue statement in the preset statement library and the preset intent.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the implication relationship identification method as described in any one of claims 1-4, or the intent identification method as described in any one of claims 5-6.
10. A 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 implication relationship identification method as described in any one of claims 1-4, or the intent identification method as described in any one of claims 5-6.
Citation Information
Patent Citations
Word embedding semantic mapping-based event phrase learning method and apparatus
CN107180026A
Method and device for recognizing text implication relations
CN111666405A