Intention recognition method and device, electronic equipment and storage medium
By generating a simul pool and adjusting intent recognition methods, the accuracy of intelligent customer service robots in identifying intents in different business scenarios is solved, and the rich and accurate identification of user intentions is achieved, which is suitable for a variety of business scenarios.
Patent Information
- Application Number
- CN202411025202.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-12-17
AI Technical Summary
Existing intelligent customer service robots are difficult to accurately identify special intentions in different business scenarios, and the process of artificially preconfigured general intentions is complicated, so it is impossible to accurately identify user intentions.
By generating a simile pool, a set of similes that matches business needs is determined, and candidate intentions are adjusted according to the scene prompt information to achieve accurate identification of user intentions. The method includes combining analytes from analyte pool, screening matching combinations, and adjusting intentions to meet business needs and scenario characteristics.
It realizes rich and accurate identification of user intentions, is suitable for any business scenario, is universal, can identify various user intentions, and improves the accuracy and adaptability of intention recognition.
Smart Images

Figure CN119150884A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to an intent recognition method, device, electronic device and storage medium. Background Art
[0002] Currently, the application of intelligent customer service robots is becoming more and more widespread. Intelligent customer service robots recognize the intention of users through dialogue with users, determine the intention of users, and provide answers to users' questions. For example, in related technologies, for each business scenario, a general intention related to the business scenario is manually pre-configured. During the dialogue between the intelligent customer service robot and the user, the user's intention can be determined from the pre-configured general intention through semantic analysis.
[0003] However, different business scenarios involve different intents, so the process of artificially pre-configuring several general intents for each business scenario is more complicated; and in the intent recognition projects of different businesses, in addition to general intents, there are also specific intents. Currently, this method cannot achieve accurate recognition of specific intents.
[0004] In summary, how to accurately identify user intentions is an urgent problem to be solved. Summary of the invention
[0005] The present application provides an intent recognition method, device and storage medium for accurately recognizing user intent.
[0006] In a first aspect, the present application provides an intention recognition method. The method comprises:
[0007] Determine the semantic elements that match the business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes a plurality of semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent;
[0008] Selecting a subset of semantic elements that meet preset conditions from the semantic element set;
[0009] According to the scenario prompt information corresponding to the business demand, the candidate intent corresponding to each semantic element combination in the semantic element combination subset is adjusted to obtain the target intent that meets the business demand.
[0010] In the intent recognition method provided in the embodiment of the present application, a semantic element pool is first generated, and the semantic elements in the semantic element pool cover a wide range. According to business needs, a semantic element set is determined from the semantic element pool, and the scope of the required semantic elements is narrowed down according to the business scenario. It is determined which semantic elements may be involved in the intent recognition process of the business scenario, and the candidate intents that these semantic elements may constitute. Each candidate intent is a language structure that expresses the meaning after at least two semantic elements are combined, which can preliminarily express the user's business needs, which is relatively accurate, and these candidate intents are generated based on the semantic element pool, which is relatively rich. On this basis, after further screening out semantic element combinations that meet the preset conditions from the semantic element set, the candidate intents corresponding to the screened semantic element combinations are adjusted according to the scenario prompt information corresponding to the user's business needs. At this time, the target intent obtained not only meets the user's business needs, but also fits the current business scenario. In summary, the target intent finally identified by the intent recognition method in this application is richer and more accurate.
[0011] In addition, this method can be applied to any business scenario. In different business scenarios, it can accurately identify various user intentions based on different business needs and scenario prompt information, and is universal.
[0012] In a second aspect, the present application provides an intention recognition device. The device includes:
[0013] A matching module, used to determine the semantic elements that match the business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes a plurality of semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent;
[0014] A selection module, used to select a subset of semantic element combinations that meet preset conditions from the semantic element set;
[0015] The adjustment module is used to adjust the candidate intent corresponding to each semantic element combination in the semantic element combination subset according to the scenario prompt information corresponding to the business demand, so as to obtain the target intent that meets the business demand.
[0016] Optionally, the device further comprises:
[0017] The construction module is used to construct the semantic element pool in the following manner:
[0018] Obtain at least one meaning item corresponding to each word in a preset dictionary, and the interpretation of each word when it is used as a different meaning item;
[0019] Constructing a word group through the synonymy relationship and antonymy relationship between the definitions, wherein the word group includes a first word and a second word;
[0020] The meanings of the first vocabulary are split to obtain the semantic elements contained in the meanings, and the increase and decrease operation relationship between the semantic elements is obtained by comparing the semantic elements contained in the meanings of the related first vocabulary; the related first vocabulary refers to: different first vocabulary containing meanings with similar or opposite meanings;
[0021] Based on the increase and decrease operation relationship between the semantic elements, the semantic elements included in the second vocabulary are determined, and the semantic elements included in each of the first vocabulary and the second vocabulary form the semantic element pool.
[0022] Optionally, the building block is specifically used for:
[0023] For each second vocabulary, the semantic elements included in the second vocabulary are determined according to the semantic elements included in the first vocabulary related to the second vocabulary and the semantic element increase and decrease operation relationship.
[0024] Optionally, if a part of speech exists in the interpretation, the part of speech is used as a semantic element.
[0025] Optionally, the matching module is specifically used for:
[0026] Randomly combining the semantic elements to obtain semantic element combinations, and determining a first acceptability of each semantic element combination according to a target semantic element vector of the semantic elements in each semantic element combination;
[0027] In response to the first acceptability of the semantic element combination being greater than a first preset threshold, the semantic element combination is combined into the semantic element set.
[0028] Optionally, the matching module is further used to determine the target sememe vector of each sememe in the following manner:
[0029] Randomly vectorize the sememe to obtain an initial sememe vector corresponding to the sememe;
[0030] Acquire a first preset corpus related to the semantic element, wherein the first preset corpus includes: at least one first sentence, and a second sentence generated by performing word replacement on the at least one first sentence;
[0031] According to the semantic relationship between the first sentence and the second sentence and the second acceptability, the initial semantic element vector is adjusted to a target semantic element vector that conforms to the context.
[0032] Optionally, the scenario prompt information includes: scenario prompt words with business scenario characteristics;
[0033] The adjustment module is specifically used for:
[0034] Acquire a second preset corpus related to the candidate intent;
[0035] Inputting the second preset corpus into the trained identity indicator detection model and the named entity recognition model to obtain identity feature words and named entity feature words in the second preset corpus;
[0036] Based on the similarity between the identity feature words and the named entity feature words and the scene prompt words, the second preset corpus is adjusted to generate the corresponding target intent.
[0037] Optionally, the adjustment module is specifically used for:
[0038] The identity feature words and named entity feature words whose similarity with the scene prompt words of the same type is less than a first threshold are used as candidate transfer words;
[0039] The candidate transition word in the second preset corpus is replaced by the scene prompt word having the smallest similarity with the candidate transition word, so as to generate a target intent corresponding to the candidate intent.
[0040] Optionally, if there are multiple target intentions generated, the device further includes:
[0041] A processing module is used to screen the multiple target intentions and execute corresponding services based on the selected target intentions; wherein the screening method adopted is at least one of the following:
[0042] In response to a screening operation triggered for the plurality of target intents, selecting a target intent that meets the screening requirements from the plurality of target intents;
[0043] The deep learning model is used to respectively determine the evaluation parameters corresponding to each of the target intentions; based on the evaluation parameters of each of the target intentions, a target intention is selected from multiple target intentions; the evaluation information includes at least one of acceptability and diversity.
[0044] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a processor and a memory in communication with the processor, wherein the memory stores computer-executable instructions, the instructions being executed by the processor so that the processor can execute the intent recognition method described in any one of the first aspects above.
[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the intention recognition method described in any one of the first aspects above.
[0046] In the fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor can read the computer program from the computer-readable storage medium, and when the processor executes the computer program, it can implement the intention recognition method described in any one of the first aspects above. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of an application scenario provided in an embodiment of the present application;
[0048] Figure 2 A flowchart of an intent recognition method provided in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of a flow chart of generating a semantic element pool provided in an embodiment of the present application;
[0050] Figure 4 A schematic diagram of a flow chart of generating a semantic element vector provided in an embodiment of the present application;
[0051] Figure 5 Another flowchart of the method for identifying intent provided in an embodiment of the present application;
[0052] Figure 6 A schematic diagram of the structure of an intention recognition device provided in an embodiment of the present application;
[0053] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to better understand the solutions provided by the embodiments of the present application, some technical concepts involved in the embodiments of the present application are first introduced.
[0055] 1. Pre-trained language model (bidirectional encoder representation from transformers, BERT) is a natural language processing technology that is trained based on text data to learn the general rules and structure of language. This model is usually pre-trained in an unsupervised environment to learn the general characteristics of language, such as lexical, syntactic and semantic features. The pre-trained model can be fine-tuned according to specific tasks to achieve specific functions such as text classification and sentiment analysis.
[0056] The masked language model (MLM) is a pre-training task in BERT that aims to predict masked real words. The model learns the correct word sequence distribution, thereby improving the generalization ability of the model. Unlike the traditional unidirectional language model or the shallow concatenation of two unidirectional language models for pre-training, MLM can generate deep bidirectional language representations.
[0057] 2. Sense: refers to a specific meaning of a word. For polysemous words, a word may have multiple senses, and each sense corresponds to a specific meaning of the word in a different context. For example, the word "bank" can mean "bank" (financial institution) or "side of a river". These two meanings are two different senses of "bank".
[0058] Semantic element: It is the smallest unit of meaning that constitutes the meaning of a word. It is a more basic semantic component than a meaning item. A meaning item can be further decomposed into a group of semantic elements. Semantic elements are used to describe the inseparable semantic features of a meaning item. For example, in the meaning item of "bank", the possible semantic elements include "financial institution", "providing deposit services", "loan", etc.
[0059] For a word, the word may correspond to one or more meanings, and each meaning can be further decomposed into one or more semantic elements. For example, the modern Chinese interpretation of the word "book" includes: ① cost works, ② letters, ③ documents, etc. Among them, "cost works", "letters", and "documents" are different meanings of the word "book". For the meaning of "cost works", the corresponding semantic elements include "cost" and "works"; for the meaning of "letter", the corresponding semantic elements include "letter", etc. For another example, the modern Chinese interpretation of "clothes" includes: clothes and apparel. The semantic elements corresponding to "clothes" include "clothes", "apparel", etc.
[0060] In addition, the "first" and "second" mentioned in the embodiments of the present application are only used for distinction. For example, the first preset corpus and the second preset corpus are only used to distinguish two different elements, and are not used to limit the size, content, order, timing, priority or importance of the corpus.
[0061] In the relevant technology, the implementation of intelligent customer service robots can usually be divided into two parts: intent recognition and solution generation. Among them, the implementation of intent recognition requires the intelligent customer service robot to identify the conversation with the user and associate the conversation with the specific intent knowledge point. For example, if a user initiates a conversation with the intelligent customer service robot "How to print an invoice", the intelligent customer service robot can recognize that the user's intention is to ask how to print the invoice, and associate the conversation with the "print invoice" intention. Then, in the solution generation step, the intelligent customer service robot obtains the solution corresponding to the "print invoice" intention and outputs it to the user. For another example, if a user initiates a conversation with the intelligent customer robot "I will repay at five o'clock", the intelligent customer service robot can associate the conversation with the "repayment time" intention and record the user's repayment time in the system.
[0062] It can be seen that it is particularly important for intelligent customer service robots to accurately identify user intentions and associate them with specific intention points when providing services. When building an intention recognition system, current intelligent customer service robots usually set up an intention library and establish corresponding execution plans for the intentions in the intention library. When a user talks to an intelligent customer service robot, the neural network model is used to identify the user's conversation intention and guide it to the corresponding intention in the intention library.
[0063] In related technologies, for each business scenario, an intent library related to the business scenario is manually pre-configured, and the intents contained in the intent library can be understood as general intents. However, different business scenarios involve different intents, so the process of manually pre-configuring several general intents for each business scenario is more complicated; and in the intent recognition projects of different businesses, in addition to general intents, there are also special intents. Currently, this method cannot achieve accurate recognition of special intents.
[0064] In order to solve the above technical problems, the embodiments of the present application provide an intent recognition method, device, electronic device and storage medium. In the intent recognition method provided in the embodiments of the present application, a semantic element pool is first generated, and the semantic elements in the semantic element pool cover a wide range. According to business needs, a semantic element set is determined from the semantic element pool, and the scope of the required semantic elements is narrowed according to the business scenario. It is determined which semantic elements may be involved in the intent recognition process of the business scenario, and the candidate intents that these semantic elements may constitute. Each candidate intent is a language structure that expresses the meaning after at least two semantic elements are combined. It can preliminarily express the user's business needs, which is relatively accurate, and these candidate intents are generated based on the semantic element pool, which is relatively rich. On this basis, after further screening out the semantic element combination that meets the preset conditions from the semantic element set, according to the scene prompt information corresponding to the user's business needs, the candidate intent corresponding to the screened semantic element combination is adjusted. At this time, the target intent obtained not only meets the user's business needs, but also fits the current business scenario. In summary, the target intent finally identified by the intent recognition method in this application is richer and more accurate.
[0065] In addition, this method can be applied to any business scenario. In different business scenarios, it can accurately identify various user intentions based on different business needs and scenario prompt information, and is universal.
[0066] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0067] like Figure 1 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario diagram includes a terminal device 101 and a server 102.
[0068] In the embodiment of the present application, the terminal device 101 includes but is not limited to mobile phones, tablet computers, laptop computers, desktop computers, e-book readers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals and other devices; the terminal device may be installed with a client related to intent recognition, which may be software (such as a browser, intent recognition software, business software, etc.), or a web page, a small program, etc. The server 102 is a background server corresponding to the software or web page, small program, etc., or a server specifically used for intent recognition, which is not specifically limited in the present application. The server 102 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0069] It should be noted that the intention recognition method in each embodiment of the present application can be executed by an electronic device, which may be a terminal device 101 or a server 102, that is, the method can be executed by the terminal device 101 or the server 102 alone, or can be executed jointly by the terminal device 101 and the server 102.
[0070] In an optional implementation, the terminal device 101 and the server 102 may communicate via a communication network.
[0071] In an optional implementation, the communication network is a wired network or a wireless network.
[0072] It should be noted that Figure 1 The figure is only an example. In fact, the number of terminal devices and servers is not limited and is not specifically limited in the embodiments of the present application.
[0073] In an embodiment of the present application, when there are multiple servers, the multiple servers can be combined into a blockchain, and the servers are nodes on the blockchain; as in the intent recognition method disclosed in the embodiment of the present application, the relevant data involved can be stored on the blockchain, for example, a semantic element pool, a semantic element set, a semantic element combination subset, scene prompt information, etc.
[0074] In addition, the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving and other scenarios.
[0075] The following describes the intent recognition method provided by the exemplary embodiment of the present application in combination with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this regard.
[0076] See also Figure 2 , shows a flow chart of an intention recognition method provided in an embodiment of the present application, with an electronic device as the execution subject, and the specific implementation process of the method is as follows S201 to S203:
[0077] S201: Determine semantic elements that match business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes multiple semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent.
[0078] In an embodiment of the present application, the electronic device can generate semantic elements based on a preset dictionary. The preset dictionary can be a dictionary of different languages, such as Chinese, English, German, etc., without specific limitation. For the convenience of description, the embodiment of the present application takes the modern Chinese dictionary as an example of the preset dictionary. An example of a vocabulary entry in a modern Chinese dictionary is as follows: "Jianghe: 1. Yangtze River and Yellow River. 2. Refers to large rivers. 3. Mountains and rivers. 4. Rivers and lakes, generally refers to all parts of the world." Among them, serial numbers 1 to 4 represent the 4 meanings corresponding to the word.
[0079] The electronic device can obtain the meanings of words in the preset dictionary, split the meanings at the semantic element level, and build a semantic element pool. The specific implementation is as follows: Figure 3 As shown, the specific steps are as follows S301 to S304:
[0080] S301: Obtain at least one meaning item corresponding to each word in a preset dictionary, and the interpretation of each word when it is used as a different meaning item.
[0081] The electronic device can obtain the meanings corresponding to the vocabulary. If a vocabulary corresponds to multiple meanings, the multiple meanings are obtained. For example, for the aforementioned vocabulary "book", the meanings ① cost of writings, ② letters, and ③ documents can be obtained. A meaning is an interpretation of a word. The meanings may be similar or different. As an example, "Yangtze River and Yellow River" are similar to "big rivers" in meaning, but different from "jianghu".
[0082] S302: constructing a word group through the synonymy relationship and antonymy relationship between the definitions, where the word group includes a first word and a second word.
[0083] In the embodiment of the present application, the electronic device constructs a word group based on the acquired word interpretations by analyzing the synonymy and antonymy relationships between the interpretations. The word group includes not only the original words, but also words with similar or opposite meanings. Specifically, different words with similar or opposite meanings are referred to as related words.
[0084] The following is a simple example to illustrate the word group construction process:
[0085] In the process of constructing word clusters, first, the electronic device will analyze each meaning of "book" and determine the vocabulary related to it. Through the semantic similarity algorithm or the preset synonym / antonym dictionary, it will find the vocabulary with similar or opposite meaning to each meaning, and then combine these vocabulary to form a word cluster.
[0086] For example, the word "book" mentioned above can be used to obtain the meanings ① cost of works, ② letters, and ③ documents. The synonyms of "book" include "books", "documents", "works", "novels", "letters", "emails", "documents", "reports", "files", etc., and the antonyms include "blank pages", "wordless books", "verbal messages", "telephone", "blank documents", "paperless records", etc., so the above synonyms related to books can be constructed into a word group (such as a synonym group), and the antonyms related to books can be constructed into a word group (such as an antonym group), or the synonyms and antonyms related to books can be constructed into a word group, which is not specifically limited in this article.
[0087] In this way, the electronic device can construct a word group that includes the original vocabulary and its semantically related vocabulary, and the construction of the word group increases the contextual richness of the vocabulary.
[0088] In step S302, a plurality of word groups may be constructed, wherein the words in each word group have similar and / or opposite meanings.
[0089] In addition, in the embodiment of the present application, the first vocabulary refers to the vocabulary that needs to be pre-divided into meanings, and the second vocabulary refers to the vocabulary that does not need to be pre-divided into meanings. Each word group may contain a part of the first vocabulary and a part of the second vocabulary. Next, the following process may be performed:
[0090] S303: Split the meanings of the first vocabulary to obtain semantic elements contained in the meanings, and obtain the increase and decrease operation relationship between the semantic elements by comparing the semantic elements contained in each meaning in the related first vocabulary; the related first vocabulary refers to: different first vocabulary containing meanings with similar or opposite meanings.
[0091] Sememes are the basic semantic features or conceptual components that make up the meaning of a word. They can help us understand the subtle differences of a word in different contexts.
[0092] Specifically, when splitting the meaning items, we first need to conduct a fine-grained analysis on each meaning item to identify the core features that constitute the meaning of the meaning item, namely the sememes. On this basis, the identified sememes are further refined to capture more semantic details.
[0093] Optionally, the sense splitting can be done manually or through a BERT model. When implemented based on the BERT model, each sense of the first word can be input into the BERT model, and the model splits the sense into a combination of semantic elements for expression, thereby obtaining a semantic element list conjecture.
[0094] For example, for the meaning of the word "book" "cost works", the meaning can be split into the combination of the semantic element "cost" and the semantic element "works". For another example, for the meaning of the word "novel" "works that specialize in describing stories about people", the meaning can be split into the combination of the semantic element "describing stories about people" and the semantic element "works". For another example, for the meaning of the word "river" "Yangtze River and Yellow River", the meaning can be split into the combination of the semantic element "Yangtze River" and the semantic element "Yellow River".
[0095] Optionally, during the splitting process, if a part of speech exists in the interpretation of a certain meaning, the part of speech can be used as a semantic element.
[0096] For example, the word "white" is both an adjective and a verb. For the meaning of the word "white" "adjective, light color, close to the color of snow", it can be split into the semantic element "adjective" that indicates the part of speech. And for the other meaning of the word "white" "verb, making something colorless or bright", it can be split into the semantic element "verb" that indicates the part of speech.
[0097] Furthermore, by comparing the semantic elements contained in each meaning in the relevant first vocabulary, the combination of semantic elements can be expressed as an increase and decrease operation relationship of semantic elements. Continuing with the above example, the word "book" can be expressed as "book: [+cost, +works]", and the word "novel" can be expressed as "novel: [+description of character stories, +works]". Among them, "+" indicates the existence of the semantic element. Further, the increase and decrease operation relationship of the semantic elements of these two words can be compared, for example, word A: [+C, +M], word B: [+C, +N], then the increase and decrease operation relationship of the semantic elements between word A and word B is as follows: word A = word B-semantic element N + semantic element M; word B = word A-semantic element M + semantic element N.
[0098] Specifically, if all the semantic elements of two words are different: word A: [E, F, G], word B: [H, I, J], then the increase and decrease operation relationship of the semantic elements between word A and word B is as follows: word A = word B-semantic element H-semantic element I-semantic element J + semantic element E + semantic element F + semantic element G; word B = word A-semantic element E-semantic element F-semantic element G + semantic element H + semantic element I + semantic element J.
[0099] For the case where both words have multiple meanings, multiple combinations of semantic element operations can be formed. For example, word A: Sense 1, noun, M of C; Sense 2, verb, D. Then the semantic element list of word A's Sense 1 is guessed: [+noun, +C, +M], and the semantic element list of Sense 2 is guessed: [+verb, +D]. Word B: Sense 1, noun, N of C; Sense 2, adjective, E. Then the semantic element list of word B's Sense 1 is guessed: [+noun, +C, +N], and the semantic element list of Sense 2 is guessed: [+adjective, +E].
[0100] The semantic comparison operation between senses can be:
[0101] Word A meaning 1 - Word A meaning 2
[0102] Word A meaning 1 - Word B meaning 1
[0103] Word A meaning 1 - Word B meaning 2
[0104] Word A meaning 2 - Word B meaning 1
[0105] Word A meaning 2 - Word B meaning 2
[0106] Word B meaning 1-word B meaning 2
[0107] Among them, word A meaning 1-word A meaning 2 can be expressed as: word A meaning 1 = word A meaning 2 + noun
[0108] +C+M-verb-D.
[0109] Obviously, the above example takes the synonymy relationship between word A and a certain meaning of word B as an example. Conversely, if the antonymy relationship exists between word A and a certain meaning of word B, then word A meaning 1 - word B meaning 1 can be expressed as: word A meaning 1 = - word B meaning 1 = - [word B meaning 1 + noun + C + N - noun - CM].
[0110] The comparison operations between other meanings are similar and will not be elaborated here.
[0111] S304: Determine the semantic elements included in the second vocabulary based on the increase and decrease operation relationship between the semantic elements, and form a semantic element pool with the semantic elements included in each of the first vocabulary and the second vocabulary.
[0112] In S303, by comparing the semantic elements included in each meaning of the first vocabulary with a synonymous relationship and / or antonym relationship, the increase and decrease operation relationship between the semantic elements is obtained, and then based on the increase and decrease operation relationship between the semantic elements, the semantic elements included in the second vocabulary that has not been split can be directly derived. An optional implementation is as follows:
[0113] For each second vocabulary, the semantic elements included in the second vocabulary are determined according to the semantic elements included in the first vocabulary related to the second vocabulary and the semantic element increase and decrease operation relationship.
[0114] Specifically, for each second word, its semantic element is determined based on the semantic element of the first word related to it. For example, the meaning of the first word "happy" is "indicating a state of feeling happy or satisfied", and the semantic elements obtained by splitting this meaning are "feeling happy", "satisfied", and "state", that is, the semantic element list of happiness is guessed: [+feeling happy, +satisfied, +state], and the meaning of the second word "happy" is "indicating a state of being happy and excited", that is, happy and happy both indicate a certain state, but the difference is that the specific states they indicate are not quite the same. Through the operation of adding and subtracting semantic elements, happy = happy-feeling happy-satisfied+happy+excited, so the semantic element list of happy can be determined as: [+happy, +excited, +state]. Other words are similar, and the same can be said.
[0115] In the above implementation, according to the synonym-antonym relationship between words, the semantic elements of words and their operational relationship are analyzed, which can deepen the understanding of semantics, accurately capture the subtle differences between words, and enhance the accuracy and contextual adaptability of natural language processing. On this basis, only some words are split, and by summarizing the operational relationship, the semantic elements contained in other unsplit words can be quickly obtained, thereby improving the efficiency of semantic element pool construction.
[0116] Through the above steps S301 to S304, the electronic device forms a semantic element pool with the acquired semantic elements.
[0117] In addition, considering that under normal circumstances, due to the limited interpretation of words in the dictionary, the semantic elements obtained after a word is split are also relatively limited. In order to make the generated semantic element pool richer, the electronic device can also derive semantic elements based on the combination of at least one semantic element obtained by splitting, so as to fully explore potential semantic elements. In the specific implementation process, the derivation of semantic elements can be achieved by comparing the at least one semantic element mentioned above. Compare the semantic element differences between the combinations of semantic elements corresponding to two meanings with similar meanings, determine the different semantic elements in the two meanings, and derive semantic elements based on the different semantic elements in the two meanings to derive semantic elements that do not exist in the current words.
[0118] For example, there are currently the following words: man, woman, boy, girl. The combinations of semantic elements obtained after the meanings of these words are split and the comparison operations between the combinations of semantic elements can be expressed as follows:
[0119] man: [+adult,+male]
[0120] woman: [+adult, +female]
[0121] Boy: [-adult, +male]
[0122] Girl: [-adult, +female]
[0123] Among them, "+" means including this semantic element, and "-" means excluding this semantic element. It can be seen that the two words "boy" and "girl" do not include the semantic element "adult", that is, "boy" and "girl" do not belong to adult, and the semantic element "minor" can be derived based on the comparison operation between the combinations of semantic elements, and so on.
[0124] As another example, there are currently the following words: river, river, lake, and sea. If these four words are only viewed superficially, they all represent different types of water bodies. By expressing these words as a combination of semantic elements and performing a comparison operation on the combination of semantic elements, the semantic element "strip-shaped water body" (corresponding to "river" and "river"), the semantic element "surface-shaped water body" (corresponding to "lake" and "sea"), the semantic element "fast flow" (corresponding to "river"), the semantic element "slow flow" (corresponding to "river"), the semantic element "non-flowing" (corresponding to "lake"), and so on can be derived. These semantic elements usually require word comparison to be obtained.
[0125] In the above implementation, semantic features of vocabulary can be systematically identified and supplemented through semantic component derivation, the accuracy and richness of semantic expression can be enhanced, a solid foundation can be provided for semantic analysis and lexical relationship reasoning, and the semantic components contained in the semantic component pool can be enriched.
[0126] The semantic element pool is obtained by deriving semantic elements from the dictionary, and includes a relatively rich set of semantic elements. Generating intents based on the semantic element pool can make the generated corpus richer and contain more information. It is worth noting that the semantic elements included in the semantic element pool are relatively complex and diverse, and when building an intelligent voice robot, the corpus required to build a business scenario may only use part of the semantic elements in the semantic element pool. Therefore, the electronic device determines the semantic element set required for the business needs from the semantic element pool according to the semantic elements required by the business needs.
[0127] After constructing the semantic element pool, the semantic element screening based on the semantic element pool in this application can be applied to different business scenarios. In each business scenario, the semantic element that matches the business needs can be determined from the semantic element pool based on the user's own business needs.
[0128] For example, in scenario A, the semantic elements that match the user's business needs are semantic element 1, semantic element 2, semantic element 3, and semantic element 4; in scenario B, the semantic elements that match the user's business needs are semantic element 5, semantic element 6, semantic element 7, semantic element 8, semantic element 9, semantic element 10...
[0129] For the semantic elements that match the business needs determined from the semantic element pool, multiple semantic element combinations can be generated by combining these semantic elements. Each semantic element combination corresponds to a candidate intent. Each candidate intent can be understood as a language structure that expresses the meaning after the semantic elements in the corresponding semantic element combination are combined.
[0130] Specifically, take the business scenario of banks urging customers to repay their debts as an example. Because the communication with customers in this business scenario may mainly involve matters such as when to repay, the repayment time, the repayment amount, and the repayment method, a set of semantic elements is obtained from the semantic element pool according to the business scenario. The semantic element set may include semantic elements related to the business scenario such as repayment, time, place, and method. These semantic elements together constitute the key semantic elements in the business scenario of banks urging customers to repay their debts, helping the intelligent voice robot to accurately understand the needs of customers and provide appropriate service responses, such as confirming the repayment time, verifying the repayment amount, asking about the repayment method, and providing repayment location information.
[0131] For another example, take the business scenario of flight rebooking, because the communication with customers in this business scenario may mainly involve key information such as flight information changes, rebooking fees, rebooking policies, and the time and destination of the new flight. Based on this business scenario, the set of semantic elements obtained from the semantic element pool may include semantic elements related to the business scenario, such as flight, time, location, rebooking, fees, and methods. These semantic elements together constitute the key semantic elements in the business scenario of "flight rebooking", helping customer service personnel or automated systems to accurately understand customer needs and provide appropriate service responses, such as querying available flights, confirming rebooking fees, and explaining rebooking policies.
[0132] In actual application, the customer clicks on the relevant interface in the client, enters the language name as Chinese, and sets the business requirement to urge repayment, and then initializes the semantic element pool. After the initialization is completed, the semantic element names and possible semantic element combinations that match the business requirement can be presented on the interface. Because the scenario is limited to urging repayment, when obtaining semantic elements, only the semantic elements and semantic element combinations corresponding to the scenario are obtained.
[0133] For example, the semantic elements displayed in the interface include: semantic element 1 repayment, semantic element 2 time, semantic element 3 method. In addition, different combinations of semantic elements and the result table of the combined intentions are also displayed. For example: semantic element 1 repayment + semantic element 2 time: repayment of five points. Element 1 repayment + semantic element 3 method: repayment shortcut. Element 2 time + semantic element 3 method: five-point shortcut. Element 2 time + semantic element 1 repayment: five-point repayment. Element 3 method + semantic element 1 repayment: shortcut repayment. Element 3 method + semantic element 2 repayment: five-point shortcut.
[0134] It should be noted that the business scenarios listed above are just simple examples. In addition, other business scenarios are also applicable to the embodiments of the present application and will not be described one by one here.
[0135] The following is a brief description of the generation process of semantic element combination:
[0136] When generating a sememe set based on the sememes obtained from the sememe pool, the sememes can be vectorized to generate a target sememe vector, and then the sememes can be combined based on the target sememe vector to generate a sememe set. An optional implementation is as follows:
[0137] First, the acquired semantic elements are randomly combined to obtain semantic element combinations, and the first acceptability of each semantic element combination is determined according to the target semantic element vector of the semantic element in each semantic element combination; then, semantic element combinations whose first acceptability is greater than a first preset threshold are formed into a semantic element set.
[0138] The target semantic element vector may refer to a matrix or list storing semantic element information, and the form of the stored information is not specifically limited. Operations between semantic elements can be realized through the target semantic element vector, and the operation method may include addition and subtraction operations between semantic elements. For example, a sentence with complete meaning can be generated through the target semantic element vectors corresponding to several semantic elements.
[0139] By combining several semantic elements, a sentence with complete meaning can be generated, and this sentence with complete meaning can be called an intention. For example, by combining the semantic elements "repayment", "time", and "method", sentences such as "repayment in five points", "repayment by shortcut", and "repayment by five points shortcut" can be obtained. These sentences represent actions with clear meanings and can be considered as a clear intention. It should be understood that an intention is not necessarily a complete sentence, as long as it expresses a clear meaning, and the embodiments of the present application do not make specific limitations.
[0140] In an embodiment of the present application, intents can be generated by randomly combining semantic element vectors corresponding to semantic elements to generate as many intents as possible. Since it is a random combination between semantic elements, some combinations that do not conform to grammar may not express a clear meaning. The first acceptance of the generated combination of semantic elements can be defined, and the first acceptance indicates the acceptability of the semantic combination of semantic elements. If the first acceptance of the combination of semantic elements is greater than the first preset threshold, it can be considered that the acceptance of the semantic combination of this semantic element is relatively large, and the semantic combination can be used as an intent. On the contrary, if the first acceptance of the combination of semantic elements is less than the first preset threshold, it can be considered that the acceptance of the semantic combination of this semantic element is relatively low, so as to delete some unreasonable combinations of semantic elements. For example, taking the semantic elements of "repayment", "time" and "method", the combinations of semantic elements that may be generated by random combination are as follows:
[0141] "Repayment" + "Time": Five points for repayment
[0142] "Repayment" + "Method": Repayment shortcut
[0143] "When" + "How": Five shortcuts
[0144] "Time" + "Repayment": Repayment at 5 o'clock
[0145] "Method" + "Repayment": Quick way to repay
[0146] "How" + "When": Five shortcuts
[0147] From the combination of the above semantic elements, it can be seen that the first acceptance of the combinations of "five points for repayment", "repayment shortcut", and "five-point shortcut" is relatively low. Several combinations can be deleted, and the remaining "five points for shortcut", "five-point repayment", and "shortcut repayment" can be used as intentions. The first acceptance can be set as a score, and the combination of semantic elements with a first acceptance score greater than a first preset threshold is set as an intention. Of course, there are many ways to determine whether the combination of semantic elements is reasonable, which will not be described in detail in the embodiments of the present application.
[0148] See also Figure 4 , the target semantic vector in the above process is generated by the following steps S401 to S403:
[0149] S401: Randomly vectorize the sememe to obtain an initial sememe vector corresponding to the sememe.
[0150] In this process, the electronic device generates an n-dimensional initial semantic element vector based on the semantic element, wherein the value of n can be flexibly set according to experience or demand.
[0151] For example, if the dimension is set to 100, the process of randomly generating a 100-dimensional initial sememe vector from a sememe can be as follows:
[0152] First, the dimension of the vector space is set to 100; then, a random initial value is assigned to each dimension of the vector of the sememe, which is generally uniformly distributed in the range of -1 to 1, and a 100-dimensional initial sememe vector corresponding to the sememe can be obtained.
[0153] Since the initial semantic element vector is randomly initialized, it may not be accurate to directly use the initial semantic element vector to generate the intent. For example, if the semantic element is "method", which is a general concept, directly using "method" to generate the intent without specifying which method it is may make the sentence unclear. Therefore, the electronic device can correct the semantic element according to the initial semantic element vector so that it conforms to the specific context. The correction process is as follows S402~S403:
[0154] S402: Acquire a first preset corpus related to semantic elements, the first preset corpus comprising: at least one first sentence, and a second sentence generated by replacing words in the at least one first sentence;
[0155] In the embodiment of the present application, the first preset corpus includes at least one first sentence, and a second sentence generated after replacing words in the at least one sentence.
[0156] The first preset corpus may specifically include multiple sentences: (1) a correct sentence, i.e., the first sentence in the embodiment of the present application; (2) a word that remains correct after replacing one / several words in the sentence, i.e., a second sentence in the embodiment of the present application; (3) a sentence in which one / several words in the replaced sentence are acceptable but the acceptability is reduced, i.e., another second sentence in the embodiment of the present application, wherein the acceptability refers to the degree of acceptance of a sentence by a native speaker in terms of grammar and semantics. In order to distinguish it from the above, the acceptability here may be recorded as the second acceptability, which is specifically used to indicate the acceptability of the meaning of the sentence after the words are replaced; (4) a sentence in which one / several words in the replaced sentence are incorrect, i.e., another second sentence in the embodiment of the present application.
[0157] The first preset corpus may also include annotation information, which includes a second acceptability score of the second sentence after word replacement of the first sentence, specifically: overall sentence acceptability (0-5), words incompatible with other words in the sentence & the number of other words incompatible with the word & compatibility (1-5), and whether the replacement word and the replaced word have the same part of speech (or part of speech distance 0-5).
[0158] S403: According to the semantic relationship between the first sentence and the second sentence and the second acceptability, the initial semantic element vector is adjusted to a target semantic element vector that conforms to the context.
[0159] The semantic relationship can indicate whether the semantics of the first sentence and the second sentence are similar or not, etc. The second acceptability of the second sentence can reflect whether the semantics of the second sentence are smooth. By using the semantic relationship and the second acceptability of the first sentence and the second sentence, and by replacing words in the sentence, after correcting the initial semantic element vector, all semantic elements and the corresponding target semantic element vectors can be stored in a separate semantic element vector library (table).
[0160] Specifically, the initial semantic element vector corresponding to the semantic element can be substituted into the sentence of the preset corpus by word replacement, and the sentence of the preset corpus is replaced with a word, and the second acceptability of the replaced sentence is obtained. Since the sentence of the preset corpus is a sentence that conforms to a specific context, its meaning is relatively complete. If the second acceptability of the sentence after the initial semantic element vector replaces the word in the sentence obviously decreases, it can be considered that the meaning of the semantic element corresponding to the initial semantic element vector is quite different from the meaning of the replaced word. If the second acceptability of the sentence after the initial semantic element vector replaces the word in the sentence does not decrease obviously, and the semantics are similar to those of the sentence before replacement, it can be considered that the meaning of the semantic element corresponding to the initial semantic element vector is similar to the meaning of the replaced word, and the replaced word may be more in line with the context. Therefore, the semantic element can be modified to the replaced word. Accordingly, the initial semantic element vector can be corrected to obtain the target semantic element vector corresponding to the semantic element.
[0161] For example, for the semantic element "method", the preset corpus contains "I still use the shortcut method to repay" and "I plan to repay over the counter", and the semantic element "method" can be modified to "shortcut method", "over the counter method", etc. Accordingly, the electronic device corrects the initial semantic element vector according to "shortcut method" and "over the counter method" to obtain the target semantic element vector.
[0162] It should be understood that a semantic element may be replaced by multiple semantic elements, and multiple target semantic element vectors may be associated with the semantic element. The electronic device can establish a mapping relationship between the semantic element and multiple target semantic element vectors, and store the mapping relationship in a semantic element vector library. In actual application, a most commonly used target semantic element vector among multiple target semantic element vectors can be selected as the target semantic element vector corresponding to the semantic element to participate in the calculation, without specific limitation.
[0163] The electronic device generates a target semantic element vector through the above steps S401 to S403, and constructs a semantic element vector library with the obtained target semantic element vectors for use in the semantic element combination or other tasks listed above, which is not specifically limited herein.
[0164] S202: Selecting a subset of semantic element combinations that meet preset conditions from the semantic element set.
[0165] In this step, the preset condition is related to the user's business needs. For example, the user can filter out some semantic element combinations from the semantic element set to form a semantic element combination subset, then the preset condition can be understood as the semantic element combination selected by the user; for another example, the user can exclude some semantic element combinations from the semantic element set, and the remaining semantic element combinations can form a semantic element combination subset, then the preset condition can be understood as the semantic element combination not selected by the user.
[0166] In addition, the user can exclude unnecessary semes according to the current business needs. Correspondingly, the combination of the remaining semes in the seme set can constitute the seme combination subset. Then the preset condition can be understood as the semes not selected by the user.
[0167] Still taking the case where the semantic elements displayed in the above interface include: semantic element 1 repayment, semantic element 2 time, semantic element 3 method as an example, there are five semantic element combinations displayed. If the user excludes: semantic element 1: repayment + semantic element 2: time: repayment five points. semantic element 2: time + semantic element 3: method: five points shortcut method. Then the remaining three semantic element combinations can form the semantic element combination subset.
[0168] S203: According to the scenario prompt information corresponding to the business demand, the candidate intent corresponding to each semantic element combination in the semantic element combination subset is adjusted to obtain the target intent that meets the business demand.
[0169] Optionally, the scenario prompt information includes: scenario prompt words with business scenario characteristics; the scenario prompt words may be pre-input by the user, or pre-collected and stored by the electronic device, which is not specifically limited in this document.
[0170] Based on this, the candidate intent corresponding to each semantic element combination in the semantic element combination subset can be adjusted. An optional adjustment process is as follows:
[0171] First, obtain the second preset corpus related to the candidate intent; because the combination of semantic elements generated according to the combination of semantic elements is not a complete sentence. For example, the aforementioned intents "shortcut five o'clock", "repay at five o'clock", "shortcut repayment", these are not completely matched with the user's business needs. It is also necessary to further determine the second preset corpus based on these intents. The second preset corpus includes the corpus of the first customer (referring to the historical customer) in the actual business scenario, and the second preset corpus is a complete sentence. For example, according to "repay at five o'clock", a complete sentence "text1: I will repay your company at five o'clock", "text2: Don't worry, I will definitely repay at five o'clock", "text3: Don't worry, I will definitely repay at five o'clock". For example, according to "shortcut repayment", a complete sentence "text4: I still repay by shortcut", "text5: You send me a shortcut repayment link, I repay quickly", and so on is generated.
[0172] If the second customer (i.e., the user in the previous text) wants to use the second preset corpus, the second preset corpus is not completely compatible with the business needs of the second customer. In some cases, the second preset corpus of the first customer needs to be migrated to meet the current business needs of the second customer. Migration can be to replace identity feature words, named entity feature words, etc. in the second preset corpus. The specific replacement process is as follows:
[0173] The second preset corpus is input into the trained identity indication detection model and named entity recognition model to obtain the identity feature words and named entity feature words in the second preset corpus; then, based on the similarity between the obtained identity feature words and named entity feature words and the above-mentioned scene prompt words, the second preset corpus is adjusted to generate the corresponding target intent.
[0174] Each second preset corpus can be adjusted in the above manner. Of course, before this step, the user can also select the typical second preset corpus that he thinks needs to be migrated to the company. For example, the customer selects typical data applicable to the company from the 5 texts listed above, such as text1 and text2 as the transferable classes. Next, only text1 and text2 can be adjusted.
[0175] For example, the identity feature words can be the identity feature words of the first customer, such as "your company", "our customers", "their bank", and similar words. Named entity feature words can be similar words such as "five o'clock", "shortcut", "repayment", "pay back", and similar words. The model identifies the identity feature words and named entity feature words and determines whether they are in line with the current context, and replaces some identity feature words and named entity feature words according to business needs to generate a target intent that is more in line with the business needs of the second customer. For example, the identity feature words in "text1: I will repay your company at five o'clock" are replaced to generate "text1': I will repay your bank at five o'clock". For example, the named entity feature words in "text2: Don't worry, I will definitely repay you at five o'clock" are replaced to generate "text2': Don't worry, I will definitely repay you before I get off work", and so on.
[0176] In an embodiment of the present application, the extraction and replacement of feature words can be realized by a model. An identity indication detection model and a named entity recognition model are constructed respectively to extract identity feature words and named entity feature words in a preset corpus. The identity indication detection model is used to extract identity feature words, and the named entity recognition model is used to extract named entity words. In one implementation, the identity indication detection model and the named entity recognition model are pre-trained language models BERT.
[0177] After extracting identity feature words through the identity indication detection model, we can further obtain the scene prompt words corresponding to the business needs, calculate the similarity between the identity feature words and the scene prompt words, and consider how to replace them based on the calculation results.
[0178] Specifically, the scene prompt words in the embodiments of the present application can also be divided into two categories: identity feature words and named entity feature words. If the similarity between the identity feature words obtained based on the second preset corpus and the scene prompt words of the same type is lower than a certain threshold, it is considered that the two feature words are quite different, and the extracted identity feature words need to be replaced according to the scene prompt words of the business scenario to generate the target intent. Similarly, after the named entity words are extracted through the named entity recognition model, the similarity with the scene prompt words in the business needs can also be calculated. If the similarity between the named entity words obtained based on the second preset corpus and the scene prompt words of the same type is lower than a certain threshold, it is considered that the two feature words are quite different, and the extracted named entity words need to be replaced according to the scene prompt words of the business scenario to finally generate the target intent.
[0179] When analyzing whether to replace based on a threshold, an optional implementation is as follows:
[0180] Identity feature words and named entity feature words whose similarity with scene prompt words of the same type is less than a first threshold are taken as candidate transfer words; then, the candidate transfer words in the second preset corpus are replaced by the scene prompt words with the smallest similarity with the candidate transfer words to generate a target intent corresponding to the candidate intent.
[0181] The first threshold is a similarity threshold in this application, and the setting of the threshold can be flexibly adjusted according to actual needs or experience, and is not specifically limited in this article. For example, if the similarity value ranges from 0 to 1, the threshold can be set to 0.5, 0.3, 0.6, and so on.
[0182] For example, if there is an identity feature word A in the scene feature words, and there are multiple identity feature words in the second preset corpus, namely, identity feature word B1, identity feature word B2, and identity feature word B3. After respectively calculating the similarity between identity feature word A and these three identity feature words, the three identity feature words whose similarity with identity feature word A is less than the first threshold can be used as candidate transfer words, for example, including identity feature words B1 and identity feature words B2, and identity feature word B2 in the second preset corpus can be replaced with identity feature word A.
[0183] Similarly, the named entity feature words are replaced in a similar way, which will not be repeated here.
[0184] Among them, the training process of the identity indication detection model is as follows:
[0185] S1. Load a pre-trained language model, for example: roberta.
[0186] S2. Send the labeled identity indicator word data to the pre-trained language model, and specify the training task as a sequence labeling task (task = 'sequence labeling').
[0187] Text: How can we, the customers, express our dissatisfaction to your agents?
[0188] Label: [We are the customers, you are the agents]
[0189] S3. The trained model is denoted as model_identity_sign.
[0190] Similarly, the training of the named entity recognition model is similar to the above process, and the repeated parts will not be repeated here.
[0191] In another optional implementation, if multiple target intents are generated, the multiple target intents can be screened and corresponding services can be executed based on the selected target intent, such as debt collection, hotel reservation, flight rescheduling, etc.
[0192] When multiple target intentions are screened, at least one of the following screening methods is used:
[0193] Screening method 1: In response to a screening operation triggered for multiple target intents, a target intent that meets the screening requirements is selected from the multiple target intents.
[0194] This method is mainly triggered by the user. For example, if the user thinks that one of the two target intents generated does not meet the actual needs, the target intent can be excluded and the remaining target intent can be used as the final intent. Of course, the target intent that meets the actual needs can also be directly selected from the two target intents. The selection method is not specifically limited in this article.
[0195] Screening method two: using a deep learning model to determine the evaluation parameters corresponding to each target intent; based on the evaluation parameters of each target intent, selecting a target intent from multiple target intents; the evaluation information includes at least one of acceptability and diversity.
[0196] Specifically, the second screening method involves using a deep learning model to evaluate and select target intents, where the model will evaluate each target intent from at least one of the aspects of acceptability and diversity to generate a final score, i.e., the evaluation parameter. For example, if only one aspect is evaluated, the score of that aspect can be used as the final score. If both aspects are evaluated, the average of the scores of the two aspects can be used as the final score.
[0197] Among them, the acceptability is the same as the first acceptability and the second acceptability mentioned above, indicating whether the target intention can be accepted in the grammatical and semantic dimensions. The degree of acceptance can be directly scored through the model to obtain a score representing the acceptability.
[0198] In addition, the model will also consider providing a variety of options to meet the needs of different users. The diversity score of intent specifically refers to the number and quality of different sub-intents that can be identified in a given target intent. For example, "I will repay your bank at 5 o'clock". Two sub-intents can be identified in this target intent, such as the repayment time "5 o'clock" and the repayment method "repay at the bank". The model can be used to directly score and obtain a score that represents diversity.
[0199] In this way, deep learning models can help users make smarter decisions, not only limited to selecting the most likely intent, but also ensuring a rich and personalized user experience.
[0200] See also Figure 5 , shows another flow chart of the intention recognition method provided in an embodiment of the present application, and the flow chart is introduced below in conjunction with a specific example.
[0201] S51. The customer clicks on the interface. The language name is entered as Chinese, the scenario is urging repayment, and the semantic element pool is initialized. After the initialization is completed, all semantic element names and semantic element vectors are displayed on the interface. For example: semantic element 1: semantic element vector 1; semantic element 2: semantic element vector 2; semantic element 3: semantic element vector 3... Because the scenario is limited to urging repayment, when obtaining semantic elements, only the semantic elements and semantic element vectors corresponding to the scenario are obtained.
[0202] S52. The interface displays different combinations of semantic elements and the result table of the combined intentions. For example: semantic element 1 repayment + semantic element 2 time: repayment of five points. Element 1 repayment + semantic element 3 method: repayment shortcut. Element 2 time + semantic element 3 method: five-point shortcut. Element 2 time + semantic element 1 repayment: five-point repayment. Element 3 method + semantic element 1 repayment: shortcut repayment. Element 3 method + semantic element 2 repayment: five-point shortcut.
[0203] S53. Eliminate unnecessary semantic elements or combinations. Example: Eliminate: semantic element 1: repayment + semantic element 2: time: repayment five points. Element 2: time + semantic element 3: method: five points shortcut.
[0204] S54, the remaining semantic elements and their combinations, and the combination results are displayed. Example: The remaining combination methods: semantic element 2: time + semantic element 1: repayment: five o'clock repayment. Element 3: method + semantic element 1: repayment: quick repayment. Element 3: method + semantic element 2: repayment: quick five o'clock repayment.
[0205] S55. The remaining combinations are taken as intentions. For example, the combination of the semantic elements is directly taken as the intention, then the combination of the three semantic elements formed in step S54 can be regarded as three intentions in the initial intention library;
[0206] S56, the interface displays each intention in S55 and typical annotation data of other customers for the intention. Examples of typical annotation data are as follows. Typical annotation data of "5 o'clock repayment": text1: I will repay your company at 5 o'clock. text2: Don't worry, I will definitely repay you at 5 o'clock. text3: Don't worry, I will definitely repay you at 5 o'clock. Typical annotation data of "Quick repayment": text4: I will still use the quick repayment method. text5: You send me the quick repayment link, and I will repay quickly.
[0207] S57, select typical annotated data to be migrated. Example: The customer selects typical data applicable to the company from the typical annotated data in S56, and selects text1 and text2 as typical annotated data to be migrated.
[0208] S58. The model migrates the typical annotated data selected by the customer, using identity feature words and named entities that meet current business needs. Example: The migration process of text1 and text2:
[0209] text1: I will repay your company at 5 o'clock (company→bank)→text1': I will repay your bank at 5 o'clock.
[0210] text2: Don't worry, I will definitely pay you back at 5 o'clock (5 o'clock → before getting off work) → text2': Don't worry, I will definitely pay you back before getting off work.
[0211] S59, review and screen the migrated new data. This process can be implemented based on the model.
[0212] See also Figure 6 Based on the same inventive concept, the embodiment of the present application further provides an intention recognition device 600. The device 600 includes:
[0213] The matching module 601 is used to determine the semantic elements that match the business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes multiple semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent;
[0214] A selection module 602 is used to select a subset of semantic elements that meet preset conditions from the semantic element set;
[0215] The adjustment module 603 is used to adjust the candidate intent corresponding to each semantic element combination in the semantic element combination subset according to the scenario prompt information corresponding to the business demand, so as to obtain the target intent that meets the business demand.
[0216] Optionally, the device 600 further includes:
[0217] The construction module 604 is used to construct a semantic element pool in the following manner:
[0218] Obtain at least one meaning item corresponding to each word in the preset dictionary, and the interpretation of each word when it is used as a different meaning item;
[0219] Through the synonymy and antonymy relations between the definitions, word groups are constructed, and the word groups include the first word and the second word;
[0220] The meanings of the first vocabulary are split to obtain the semantic elements contained in the meanings, and the increase and decrease operation relationship between the semantic elements is obtained by comparing the semantic elements contained in each meaning of the related first vocabulary; the related first vocabulary refers to: different first vocabulary containing meanings with similar or opposite meanings;
[0221] Based on the increase and decrease operation relationship between semantic elements, the semantic elements included in the second vocabulary are determined, and the semantic elements included in each of the first vocabulary and the second vocabulary form a semantic element pool.
[0222] Optionally, the construction module 604 is specifically used for:
[0223] For each second vocabulary, the semantic elements included in the second vocabulary are determined according to the semantic elements included in the first vocabulary related to the second vocabulary and the semantic element increase and decrease operation relationship.
[0224] Optionally, if part of speech exists in the meaning, it is used as a semantic element.
[0225] Optionally, the matching module 601 is specifically used for:
[0226] Randomly combining the sememes to obtain a sememe combination, and determining the first acceptability of each sememe combination according to the target sememe vector of the sememe in each sememe combination;
[0227] In response to the first acceptability of the semantic element combination being greater than a first preset threshold, the semantic element combination is grouped into a semantic element set.
[0228] Optionally, the matching module 601 is further configured to determine a target sememe vector of each sememe in the following manner:
[0229] Randomly vectorize the sememe to obtain the initial sememe vector corresponding to the sememe;
[0230] Acquire a first preset corpus related to semantic elements, the first preset corpus comprising: at least one first sentence, and a second sentence generated by replacing words in the at least one first sentence;
[0231] According to the semantic relationship between the first sentence and the second sentence and the second acceptability, the initial semantic element vector is adjusted to a target semantic element vector that conforms to the context.
[0232] Optionally, the scenario prompt information includes: scenario prompt words with business scenario characteristics;
[0233] The adjustment module 603 is specifically used for:
[0234] Obtaining a second preset corpus related to the candidate intent;
[0235] Inputting the second preset corpus into the trained identity indicator detection model and the named entity recognition model to obtain identity feature words and named entity feature words in the second preset corpus;
[0236] Based on the similarity between the identity feature words and the named entity feature words and the scene prompt words, the second preset corpus is adjusted to generate the corresponding target intent.
[0237] Optionally, the adjustment module 603 is specifically used for:
[0238] The identity feature words and named entity feature words whose similarity with the scene prompt words of the same type is less than a first threshold are used as candidate transfer words;
[0239] The candidate transfer words in the second preset corpus are replaced with the scene prompt words with the smallest similarity to the candidate transfer words, so as to generate the target intent corresponding to the candidate intent.
[0240] Optionally, if there are multiple generated target intentions, the device 600 further includes:
[0241] The processing module 605 is used to screen multiple target intents and execute corresponding services based on the selected target intents; wherein the screening method used is at least one of the following:
[0242] In response to a filtering operation triggered for multiple target intents, a target intent that meets the filtering requirements is selected from the multiple target intents;
[0243] A deep learning model is used to determine evaluation parameters corresponding to each target intent; based on the evaluation parameters of each target intent, a target intent is selected from multiple target intents; and the evaluation information includes at least one of acceptability and diversity.
[0244] In the intention recognition device provided in the embodiment of the present application, the construction module first generates a semantic element pool, and the semantic elements in the semantic element pool cover a wide range. The matching module then determines the semantic element set from the semantic element pool according to business needs, narrows the scope of the required semantic elements according to the business scenario, determines which semantic elements may be involved in the intention recognition process of the business scenario, and the candidate intentions that these semantic elements may constitute. Each candidate intention is a language structure that expresses the meaning after at least two semantic elements are combined, which can preliminarily express the user's business needs and is relatively accurate. Moreover, these candidate intentions are generated based on the semantic element pool, which is relatively rich. On this basis, after the selection module further selects the semantic element combination that meets the preset conditions from the semantic element set, the adjustment module adjusts the candidate intention corresponding to the selected semantic element combination according to the scene prompt information corresponding to the user's business needs. At this time, the obtained target intent not only meets the user's business needs, but also fits the current business scenario. In summary, the target intent finally identified by the intent recognition device in this application is richer and more accurate.
[0245] In addition, the device can be applied to any business scenario. In different business scenarios, it can accurately identify the user's various intentions based on different business needs and scenario prompt information, and is universal.
[0246] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which includes at least one processor 701 and a memory 702 that is communicatively connected to the at least one processor. The memory stores instructions executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method in any of the above embodiments.
[0247] The specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present application. Figure 7 In the example, the processor 701 and the memory 702 are connected via a bus 700. Figure 7 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 700 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0248] The computing device in the embodiment of the present application may further include a communication interface 703 , which is, for example, a network port, and the computing device may receive data or send data through the communication interface 703 .
[0249] Among them, the processor 701 is the control center of the computing device, which can use various interfaces and lines to connect various parts of the entire device, and through running or executing instructions stored in the memory 702 and calling data stored in the memory 702, various functions of the computing device and processing data, thereby monitoring the computing device as a whole. Optionally, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0250] Optionally, the processor 701 may specifically be a general-purpose processor, such as a central processing unit, an application-specific integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC), may be one or more integrated circuits for controlling program execution, may be a hardware circuit developed using a field programmable gate array (English: Field Programmable Gate Array, referred to as: FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the intent recognition method disclosed in conjunction with the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0251] By designing and programming the processor 701, the code corresponding to the intent recognition method introduced in the aforementioned embodiment can be solidified into the chip, so that the chip can execute the steps of the aforementioned intent recognition method during operation. How to design and program the processor 701 is a technology well known to those skilled in the art and will not be repeated here.
[0252] Optionally, in an embodiment of the present application, the memory 702 stores instructions that can be executed by at least one processor 701, and at least one processor 701 can execute the steps included in the aforementioned intention recognition method by executing the instructions stored in the memory 702. The memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 702 may include at least one type of storage medium, for example, it may include flash memory, hard disk, multimedia card, card-type memory, random access memory (Random Access Memory, RAM), static random access memory (Static Random Access Memory, SRAM), programmable read-only memory (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic memory, disk, optical disk, etc. The memory 702 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this. The memory 702 in the embodiment of the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and / or data. The number of memories 702 is one or more. Figure 7 However, it should be noted that the memory 702 is not a mandatory functional module, so Figure 7 Shown by dotted lines.
[0253] Based on the same inventive concept, the embodiment of the present application provides a computer storage medium, which stores computer program instructions, and the computer program instructions are used to execute the method in any of the above embodiments. In the specific implementation process, the computer readable storage medium includes: a universal serial bus flash drive (USB), a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other storage media that can store program codes.
[0254] In some possible implementations, various aspects of the intent identification method provided by the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computing device, the program code is used to enable the computing device to execute the steps of the intent identification method according to various exemplary implementations of the present application described above in this specification.
[0255] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0256] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0257] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0258] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0259] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a universal serial bus flash disk (Universal Serial Bus flash disk), a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a disk or an optical disk, and other media that can store program codes.
[0260] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for identifying intent, It is characterized in that include: Determine the semantic elements that match the business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes a plurality of semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent; Selecting a subset of semantic elements that meet preset conditions from the semantic element set; According to the scenario prompt information corresponding to the business demand, the candidate intent corresponding to each semantic element combination in the semantic element combination subset is adjusted to obtain the target intent that meets the business demand.
2. The method according to claim 1, It is characterized in that The semantic element pool is constructed in the following way: Obtain at least one meaning item corresponding to each word in a preset dictionary, and the interpretation of each word when it is used as a different meaning item; Constructing a word group through the synonymy relationship and antonymy relationship between the definitions, wherein the word group includes a first word and a second word; The meanings of the first vocabulary are split to obtain the semantic elements contained in the meanings, and the increase and decrease operation relationship between the semantic elements is obtained by comparing the semantic elements contained in the meanings of the related first vocabulary; the related first vocabulary refers to: different first vocabulary containing meanings with similar or opposite meanings; Based on the increase and decrease operation relationship between the semantic elements, the semantic elements included in the second vocabulary are determined, and the semantic elements included in each of the first vocabulary and the second vocabulary form the semantic element pool.
3. The method according to claim 2, It is characterized in that The determining of the semantic elements included in the second vocabulary based on the increase and decrease operation relationship between the semantic elements includes: For each second vocabulary, the semantic elements included in the second vocabulary are determined according to the semantic elements included in the first vocabulary related to the second vocabulary and the semantic element increase and decrease operation relationship.
4. The method according to claim 2, It is characterized in that If a part of speech exists in the interpretation, the part of speech is taken as a semantic element.
5. The method according to claim 1, It is characterized in that The combining of the sememes to obtain a sememe set includes: Randomly combining the semantic elements to obtain semantic element combinations, and determining a first acceptability of each semantic element combination according to a target semantic element vector of the semantic elements in each semantic element combination; In response to the first acceptability of the semantic element combination being greater than a first preset threshold, the semantic element combination is combined into the semantic element set.
6. The method according to claim 5, It is characterized in that The target sememe vector for each sememe is determined as follows: Randomly vectorize the sememe to obtain an initial sememe vector corresponding to the sememe; Acquire a first preset corpus related to the semantic element, wherein the first preset corpus includes: at least one first sentence, and a second sentence generated by performing word replacement on the at least one first sentence; According to the semantic relationship between the first sentence and the second sentence and the second acceptability, the initial semantic element vector is adjusted to a target semantic element vector that conforms to the context.
7. The method according to claim 1, It is characterized in that The scene prompt information includes: scene prompt words with business scene characteristics; The adjusting, according to the scenario prompt information corresponding to the business requirement, the candidate intent corresponding to each of the semantic element combinations in the semantic element combination subset to generate a target intent that meets the business requirement includes: Acquire a second preset corpus related to the candidate intent; Inputting the second preset corpus into the trained identity indicator detection model and the named entity recognition model to obtain identity feature words and named entity feature words in the second preset corpus; Based on the similarity between the identity feature words and the named entity feature words and the scene prompt words, the second preset corpus is adjusted to generate the corresponding target intent.
8. The method according to claim 7, It is characterized in that The adjusting the second preset corpus based on the similarity between the identity feature words and the named entity feature words and the scene prompt words to generate the corresponding target intent includes: The identity feature words and named entity feature words whose similarity with the scene prompt words of the same type is less than a first threshold are used as candidate transfer words; The candidate transition word in the second preset corpus is replaced by the scene prompt word having the smallest similarity with the candidate transition word, so as to generate a target intent corresponding to the candidate intent.
9. The method according to any one of claims 1 to 8, It is characterized in that If there are multiple target intentions generated, the method further includes: After screening the multiple target intentions, the corresponding business is executed based on the selected target intention; wherein the screening method adopted is at least one of the following: In response to a screening operation triggered for the plurality of target intents, selecting a target intent that meets the screening requirements from the plurality of target intents; The deep learning model is used to respectively determine the evaluation parameters corresponding to each of the target intentions; based on the evaluation parameters of each of the target intentions, a target intention is selected from multiple target intentions; the evaluation information includes at least one of acceptability and diversity.
10. An intention recognition device, It is characterized in that include: A matching module, used to determine the semantic elements that match the business requirements from the semantic element pool, and combine the semantic elements to obtain a semantic element set; wherein the semantic element set includes a plurality of semantic element combinations, each semantic element combination includes at least two semantic elements, and each semantic element combination corresponds to a candidate intent; A selection module, used to select a subset of semantic element combinations that meet preset conditions from the semantic element set; The adjustment module is used to adjust the candidate intent corresponding to each semantic element combination in the semantic element combination subset according to the scenario prompt information corresponding to the business demand, so as to obtain the target intent that meets the business demand.
11. An electronic device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 9 when executed by a processor.
13. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 9 when being executed by a processor.
