Intention recognition method and device, electronic equipment, storage medium and computer program product
By using word-tick and correcting intent types based on corpus subword weight combinations in intent recognition, the problem of inaccurate intent recognition is solved, and the accuracy and user experience of intent recognition are improved.
Patent Information
- Application Number
- CN202411322342.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-14
AI Technical Summary
Existing large-scale model intention recognition technology is inaccurate intent recognition in complex contexts, resulting in inference delay and inference errors, and the accuracy of intent recognition results is not high.
By combining subword weights in the corpus, word cutting and intent type are generated, and weight coefficients of general corpus and private network corpus are combined to improve the accuracy of word cutting results and intent recognition.
Improve the accuracy of intention recognition, reduce the delay caused by useless reasoning of large language models, and dynamically adjust the intent processing methods to improve user experience.
Smart Images

Figure CN119312804A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an intent recognition method, device, electronic device, storage medium and computer program product. Background Art
[0002] With the development of artificial intelligence technology, in order to continuously improve user experience, artificial intelligence needs to recognize the intent of user input text during the interaction with users. Most existing intent recognition technologies use large model intention recognition technology to capture the meaning of the conversation in the context of interaction with users, but there is a problem of inaccurate intent recognition. Summary of the invention
[0003] To solve related technical problems, the embodiments of the present application provide an intent recognition method, device, electronic device, storage medium and computer program product.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] The present application provides a method for identifying intent, the method comprising:
[0006] Segmenting the first text based on a first vocabulary to obtain a segmentation result; the first vocabulary is obtained by combining different subwords based on the weights of the subwords in the corpus;
[0007] The intention type of the first text is determined or modified based on at least the word segmentation result.
[0008] In the above scheme, the method further comprises:
[0009] Determining the frequency of subwords and weight coefficients of subwords in the corpus;
[0010] Determining the weight of the subword in the corpus based on the word frequency of the subword in the corpus and the weight coefficient of the subword;
[0011] The first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
[0012] In the above solution, the corpus includes a general corpus and a private network corpus; and determining the weight coefficient of the subword in the corpus includes:
[0013] Determining a weight coefficient of a subword in the general corpus as a first weight coefficient;
[0014] Determining a weight coefficient of a subword corresponding to a second text in the private network corpus as a second weight coefficient; wherein the second weight coefficient is greater than the first weight coefficient;
[0015] The weight coefficient of the subword corresponding to the set field in the private network corpus is determined as a third weight coefficient; the third weight coefficient is determined based on the highest word frequency of the corpus, the total number of subwords in the general corpus and the total number of subwords in the private network corpus; the third weight coefficient is greater than the first weight coefficient.
[0016] In the above solution, the corpus includes a general corpus and a private network corpus; the method further includes:
[0017] Determine a second vocabulary, the second vocabulary including all subwords in the corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus;
[0018] Determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list;
[0019] Different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to a first threshold, thereby obtaining the first vocabulary.
[0020] In the above solution, the weight of each subword is determined based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list, including:
[0021] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is greater than 0, the weight of the subword is determined based on the first value and the second value; the first value is the product of the second word frequency of the subword, the total number of subwords in the general corpus and the third value; the second value is the product of the first word frequency of the subword and the total number of subwords in the private network corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0022] When the first word frequency of the subword is equal to 0 and the second word frequency of the subword is greater than 0, determining the weight of the subword based on the second word frequency of the subword and a third value; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0023] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is equal to 0, the weight of the subword is determined based on a fourth value and a fifth value; the fourth value is the product of the first word frequency of the subword and the total number of subwords in the general corpus; the fifth value is the product of the highest word frequency of the corpus and the total number of subwords in the private network corpus.
[0024] In the above solution, the determining or correcting the intention type of the first text at least based on the word segmentation result includes:
[0025] Calculating the similarity between the word segmentation result and the first information, and determining or correcting the intent type of the first text based on the similarity; the first information includes database-related text corresponding to the first intent type and / or the second intent type; and / or
[0026] Based on the classification result of the word segmentation result, the intention type of the first text is determined or modified.
[0027] In the above solution, the determining or correcting the intention type of the first text at least based on the word segmentation result includes one or more of the following:
[0028] Determining or modifying the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type;
[0029] Determining or correcting the intent type of the first text based on a second similarity between the word segmentation result and text related to the database corresponding to the second intent type;
[0030] When the first similarity is less than a second threshold, or the classification result of the word segmentation result is a non-set task, the intent type of the first text is determined or corrected based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type.
[0031] In the above solution, the determining or correcting the intent type of the first text based on the first similarity between the word segmentation result and the text related to the database corresponding to the first intent type includes:
[0032] When the first similarity is greater than or equal to a second threshold, determining the intent type of the first text to be a first intent type; or
[0033] When the first similarity is less than a second threshold, the intent type of the first text is modified from the first intent type to the second intent type.
[0034] In the above solution, determining or correcting the intent type of the first text based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type includes:
[0035] When the second similarity is greater than or equal to a third threshold, determining the intent type of the first text to be a third intent type; or
[0036] When the second similarity is less than the third threshold, determining the intent type of the first text as the fourth intent type; wherein,
[0037] The third intention type and the fourth intention type are different and both belong to the second intention type.
[0038] In the above solution, the determining or correcting the intention type of the first text at least based on the word segmentation result includes:
[0039] Determining a classification result of the word segmentation result;
[0040] When the classification result is a setting task, determining the intent type of the first text is a fifth intent type; or
[0041] In the case where the classification result is a non-set task, the intent type of the first text is corrected from the fifth intent type to the second intent type; wherein,
[0042] The fifth intention type corresponds to one or more set tasks.
[0043] In the above scheme, the method further comprises:
[0044] When it is determined that the intent type of the first text is the third intent type, a query is performed based on a set path, and the time when the event occurred or the time period when the event occurred in the first text to determine the cause of the event in the first text; the set path includes one or more of the following: a mobile network side path, a service platform side path, and a client side network path.
[0045] The present application also provides an intention recognition device, the device comprising:
[0046] A word segmentation module, configured to segment the first text based on a first word list to obtain a word segmentation result; the first word list is obtained by combining different subwords based on the weights of the subwords in the corpus;
[0047] An intention recognition module is used to determine or modify the intention type of the first text based at least on the word segmentation result.
[0048] The embodiment of the present application also provides an electronic device, including: a processor and a communication interface; wherein,
[0049] The processor is used to segment the first text based on the first vocabulary to obtain a segmentation result; determine or modify the intention type of the first text at least based on the segmentation result; the first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
[0050] An embodiment of the present application further provides an electronic device, comprising a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is used to execute the steps of any one of the methods described above when running the computer program.
[0051] An embodiment of the present application further provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above methods are implemented.
[0052] An embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0053] In the intent recognition method, device, electronic device, storage medium, and computer program product provided in the embodiments of the present application, a first text is segmented based on a first vocabulary to obtain a segmentation result; the first vocabulary is obtained by combining different subwords based on the weights of subwords in a corpus; and the intent type of the first text is determined or corrected at least based on the segmentation result. The above scheme segments the first text based on the first vocabulary to obtain a segmentation result, which can improve the accuracy of the segmentation result, and at least determine or correct the intent type of the first text based on the segmentation result, which can accurately evaluate and correct the intent type of the first text, thereby improving the accuracy of intent recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A process of obtaining a vocabulary table applicable to the embodiments of the present application in the related art;
[0055] Figure 2 This is a flow chart of an intent recognition method according to an embodiment of the present application;
[0056] Figure 3 A map of paths set for embodiments of the present application;
[0057] Figure 4 This is a schematic diagram of the overall process of the embodiment of the present application;
[0058] Figure 5 This is a schematic diagram of obtaining a first vocabulary based on the improved BPE algorithm in an embodiment of the present application;
[0059] Figure 6 This is a schematic diagram of the processing flow of the post-classification evaluation module of the embodiment of the present application;
[0060] Figure 7 A schematic diagram of a process for obtaining word segmentation results in an embodiment of the present application;
[0061] Figure 8 This is a schematic diagram of the processing flow of the intention processing module in the embodiment of the present application;
[0062] Fig. 9 This is a schematic diagram of the front-end interface of the legal search intent embodiment of the present application;
[0063] Fig.10 This is a schematic diagram of the front-end interface of the illegal search intent embodiment of the present application;
[0064] Fig.11 This is a schematic diagram of the question-and-answer intent front-end interface of an embodiment of the present application;
[0065] Fig.12 This is a schematic diagram of the analytical intent processing flow in an embodiment of the present application;
[0066] Fig.13 This is a schematic diagram of the structure of the intention recognition device according to an embodiment of the present application;
[0067] Fig.14 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0068] With the development of artificial intelligence technology, in order to continuously improve user experience, artificial intelligence needs to recognize the intent of user input text during the interaction with users.
[0069] The existing technical solutions for identifying the intent of user input text are as follows:
[0070] Rule recognition: Determine the intent category of the user input text through manual rule definition;
[0071] Keyword recognition: Determine the intent category of the user input text by matching the keyword group of the user input text;
[0072] Machine learning algorithm recognition: Use machine learning algorithms (such as support vector machines and random forests) to extract text features (such as bag-of-words models and TF-IDF (term frequency-inverse document frequency) of user input text, and train classifiers based on text features to determine the intent category to which the user input text belongs.
[0073] Large model recognition: Through the classification capability of the Large Language Model (LLM), the intent recognition task is structured as a text classification task to determine the intent category to which the user input text belongs.
[0074] Before performing intent recognition on user input text, it is usually necessary to segment the user input text based on a word list. The existing word list acquisition method can be to obtain the word list based on the word segmentation algorithm. Commonly used word segmentation algorithms include the Byte-Pair Encoding (BPE) algorithm and the Byte-level Byte-pair Encoding (BBPE) algorithm. The BPE algorithm is calculated based on the frequency of characters; the BBPE algorithm is at the byte level, and first converts the characters into 1 to 4 bytes in length through the UTF-8 (Unicode Transformation Format-8) encoding method. The other processes are the same as the BPE algorithm.
[0075] Figure 1 The process of obtaining a vocabulary using the BPE algorithm or the BBPE algorithm is shown. Based on the text in the general corpus, an initial vocabulary is determined, and the initial vocabulary is processed using the BPE algorithm or the BBPE algorithm to finally obtain a general vocabulary corresponding to the general corpus, which can be used to segment the user input text. Among them, the general corpus is a general domain corpus based on a public data set. For example, a text in the general corpus is "Check the running status of UPF (User Plane Function), including CPU (Central Processing Unit), memory, system logs, etc., to check whether there are obvious abnormalities or fault signs; check network resources, including bandwidth usage, memory usage, CPU usage, etc., to see if the limit has been reached, resulting in service degradation."
[0076] Taking the BPE algorithm as an example, the steps of the BPE algorithm are as follows:
[0077] Step 1: Split all the texts in the general corpus, take each character as a subword, count the word frequency, sort from high to low according to the word frequency, and get the initial word list. The initial word list is shown in Table 1 below, where s represents subwords and f represents word frequency. It should be understood that Table 1 only includes some subwords and is only an example.
[0078] Table 1
[0079] Subword(s) Word frequency (f) check 4 Inspection 3 C 2 ... ...
[0080] Step 2: Merge high-frequency continuous subword pairs, iteratively update the initial vocabulary, i.e., update the vocabulary, and obtain a general vocabulary.
[0081] Specifically, updating the vocabulary includes: adding new subwords; subtracting the word frequencies of other subwords that are reduced due to the newly merged subwords; and when the word frequency of a subword is 0, deleting the subword from the vocabulary.
[0082] Taking the first iteration as an example, the sub-words with the highest frequencies, namely "查" and "检", frequently appear as the combination "检查" in the general corpus. Add the new sub-word "检查" as shown in Table 2 below, and update the word list. In Table 2, s represents the sub-word and f represents the word frequency. It should be understood that Table 2 shows the process of updating the word list, not the updated word list obtained from the first iteration. Table 2 is only for illustration.
[0083] Table 2
[0084]
[0085]
[0086] Continue the iteration until the preset word list size (for example, the preset word list size is 151643) is reached or the frequency of the next highest-frequency sub-word pair is 1, to obtain the general word list.
[0087] In the above related technical solutions, the method of large model recognition has become a current research hotspot because it can better capture the meaning of conversations in complex contexts. The existing methods of large model recognition are to construct the recognition of user intentions through text classification tasks and evaluate the model effect based on an evaluation data set before recognizing the user intentions to ensure the accuracy of intention recognition; or, to construct segmented domain modules and task interfaces, and use the trained large model to match the user input text with the corresponding descriptions of the domain modules and task interfaces to determine the user intentions. However, the existing methods of large model recognition do not review the rationality of the online classification results. If the classification results or matching results are incorrect, it will cause unnecessary inference delays and inference errors in the large model in actual applications, and ultimately the accuracy of the intention recognition results is not high.
[0088] Based on this, in various embodiments of the present application, segment the first text based on the first word list to obtain a segmentation result; the first word list is obtained by combining different sub-words based on the weights of the sub-words in the corpus; determine or correct the intention type of the first text at least based on the segmentation result. In the above solution, segment the first text based on the first word list to obtain a segmentation result, which can improve the accuracy of the segmentation result, and determine or correct the intention type of the first text at least based on the segmentation result, which can accurately evaluate and correct the intention type of the first text and improve the accuracy of intention recognition.
[0089] The following further describes the present application in detail with reference to the drawings and embodiments.
[0090] The embodiments of the present application provide an intention recognition method, which is applied to an electronic device. The electronic device may have a display screen or a display function, or may be connected to a display screen; the electronic device includes a terminal and / or a device with a display screen or a display function. As Figure 2As shown, including:
[0091] Step 201: segment a first text based on a first vocabulary to obtain a segmentation result.
[0092] The first word list is obtained by combining different subwords based on the weights of the subwords in the corpus. The first text is the text to be recognized for intent, which can be the text input by the user in real time.
[0093] Here, the way of segmenting the first text based on the first vocabulary may be to traverse the subwords of the first vocabulary, group together the characters in the first text that are the same as the subwords in the first vocabulary, and complete the segmentation.
[0094] For example, the first text is "Query all projects and their corresponding service models", and the segmentation result obtained by segmenting the first text based on the first vocabulary is ["query", "all", "project", "and", "its", "corresponding", "of", "service model"].
[0095] Before segmenting the first text based on the first word list, the first word list needs to be obtained. Based on this, in one embodiment, the intention recognition method further includes:
[0096] Determining the frequency of subwords and weight coefficients of subwords in the corpus;
[0097] Determining the weight of the subword in the corpus based on the word frequency of the subword in the corpus and the weight coefficient of the subword;
[0098] The first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
[0099] The frequency of a subword in the corpus represents the number of times the corresponding subword appears in the corpus. The weight coefficient of the subword in the corpus can be set according to actual needs to distinguish the importance of the subword.
[0100] Based on the frequency of the subwords in the corpus and the weight coefficient of the subwords, the weight of the subwords in the corpus is determined, including:
[0101] The weight of the subword in the corpus is determined based on the set rules, the frequency of the subword in the corpus, and the weight coefficient of the subword. For example, the product of the frequency of the subword in the corpus and the third value is used as the weight of the subword in the corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword. It should be understood that the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword, and the same subword can appear multiple times in the same corpus, and the same subword can also appear in different corpora.
[0102] The first vocabulary can be obtained by combining different subwords based on the weights of the subwords in the corpus. The method can be to iteratively combine the subwords that can be combined together in the corpus in descending order of weight to obtain the first vocabulary.
[0103] In this embodiment, different sub-words are combined based on the weights of the sub-words in the corpus. This can solve the problem of inaccurate intent recognition caused by inaccurate segmentation results obtained by segmenting the general vocabulary obtained based on the traditional BPE algorithm, thereby improving the accuracy of the first vocabulary, thereby improving the accuracy of the segmentation results and the accuracy of intent recognition.
[0104] In one embodiment, the corpus includes a general corpus and a private network corpus; wherein the general corpus is a general domain corpus based on a public data set; the private network corpus is an operation and maintenance corpus of a private network, such as a private network operation and maintenance corpus of the fifth generation mobile communication technology (5G, 5th-Generation Mobile Communication Technology). Determining the weight coefficient of the subword in the corpus includes:
[0105] Determining a weight coefficient of a subword in the general corpus as a first weight coefficient;
[0106] Determining a weight coefficient of a subword corresponding to a second text in the private network corpus as a second weight coefficient; wherein the second weight coefficient is greater than the first weight coefficient;
[0107] The weight coefficient of the subword corresponding to the set field in the private network corpus is determined as a third weight coefficient; the third weight coefficient is determined based on the highest word frequency of the corpus, the total number of subwords in the general corpus and the total number of subwords in the private network corpus; the third weight coefficient is greater than the first weight coefficient.
[0108] Among them, the general corpus includes general corpus. The second text includes wireless communication operation and maintenance corpus and private network general fields; the private network general fields do not have fields with completely repeated content, and the private network general fields are fields in the private network corpus other than the set fields. The set fields include private network key database fields, private network key alarm fields, and private network key indicator fields.
[0109] For example, general corpus: "For such a simple problem, we may be able to omit the class definition and only focus on the efficiency of the CPU_walk method that calculates the continuous positions after each random step"; wireless communication operation and maintenance corpus: "Check the running status of UPF, including CPU, memory, system log, etc., to check whether there are obvious abnormalities or fault signs; check network resources, including bandwidth usage, memory usage, CPU usage, etc., to see if the limit is reached and service degradation occurs"; private network key database fields: "CPU usage"; private network key alarm fields: "CPU usage too high alarm"; private network general fields: "CPU model, memory size, average memory usage, peak memory usage".
[0110] Here, the first weight coefficient, the second weight coefficient and the third weight coefficient can be set based on actual needs, and the weight coefficients of the subwords in the corpus can also be determined based on Table 3. It should be understood that the values of the weight coefficients in Table 3 are only examples and do not constitute a limitation on the first weight coefficient, the second weight coefficient and the third weight coefficient.
[0111] Table 3
[0112]
[0113] In Table 3, the first weight coefficient is 0, the second weight coefficient is 1, and the third weight coefficient is f max is the highest word frequency in the corpus (i.e., the highest word frequency of the subwords contained in the corpus), L p is the total number of subwords in the private network corpus, L z is the total number of subwords in the general corpus.
[0114] In this embodiment, the corpus includes a general corpus and a private network corpus. The weight coefficients of sub-words corresponding to different corpora and different fields are different, and the second weight coefficient is greater than the first weight coefficient, and the third weight coefficient is greater than the first weight coefficient, so that the weight coefficient of the sub-words in the private network corpus is greater than the weight coefficient of the sub-words in the general corpus, ensuring that the sub-words of professional nouns in important private network corpora can be combined together first, further improving the accuracy of the first vocabulary.
[0115] In one embodiment, the corpus includes a general corpus and a private network corpus; and the intent identification method further includes:
[0116] Determine a second vocabulary, the second vocabulary including all subwords in the corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus;
[0117] Determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list;
[0118] Different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to a first threshold, thereby obtaining the first vocabulary.
[0119] For example, the second vocabulary is shown in Table 4. It should be understood that Table 4 only shows part of the content and is only an example.
[0120] Table 4
[0121] Subword First word frequency Second word frequency use 0 7 P 1 6 U 1 6 C 1 5 Rate 1 4 occupy 0 4 … … …
[0122] Here, based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list, the weight of each subword can be determined by multiplying the second word frequency of each subword in the second word list by a third value to obtain the weight of each subword; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword; or,
[0123] Divide the product of the first word frequency of each subword in the second vocabulary and the total number of subwords in the general corpus by the product of the highest word frequency in the corpus and the total number of subwords in the private network corpus to obtain the weight of each subword; or
[0124] The weight of each subword is obtained by dividing the product of the second word frequency of each subword in the second vocabulary, the third value and the total number of subwords in the general corpus by the product of the first word frequency of each subword in the second vocabulary and the total number of subwords in the private network corpus; the third value is determined based on the number of times the subword appears in the corpus and the corresponding weight coefficient of the subword.
[0125] In one embodiment, determining the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second vocabulary includes:
[0126] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is greater than 0, the weight of the subword is determined based on the first value and the second value; the first value is the product of the second word frequency of the subword, the total number of subwords in the general corpus and the third value; the second value is the product of the first word frequency of the subword and the total number of subwords in the private network corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0127] When the first word frequency of the subword is equal to 0 and the second word frequency of the subword is greater than 0, determining the weight of the subword based on the second word frequency of the subword and a third value; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0128] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is equal to 0, the weight of the subword is determined based on a fourth value and a fifth value; the fourth value is the product of the first word frequency of the subword and the total number of subwords in the general corpus; the fifth value is the product of the highest word frequency of the corpus and the total number of subwords in the private network corpus.
[0129] Among them, the third numerical value is determined based on the number of times the subword appears in the corpus and the corresponding weight coefficient of the subword, that is, the third numerical value is determined based on the number of times the subword appears in the general corpus and the first weight coefficient, and / or the number of times the subword appears in the private network corpus and the second weight coefficient and / or the third weight coefficient.
[0130] Specifically, taking the first weight coefficient as 0 as an example, the weight of each subword is determined by the following formula:
[0131]
[0132] Where W is the weight of any subword, f(P) is the second word frequency of the subword, and f(Z) is the first word frequency of the subword. is the third value, w i is the weight coefficient corresponding to the number of occurrences of the subword in the private network corpus, L z is the total number of subwords in the general corpus, L p is the total number of subwords in the private network corpus, f max is the highest frequency word in the corpus.
[0133] In this embodiment, the method of determining the weight of each sub-word based on the first word frequency, the second word frequency and the weight coefficient of each sub-word in the second word list is clearly defined, so as to improve the efficiency of determining the weight of each sub-word and thus improve the efficiency of obtaining the first word list.
[0134] After determining the weight of each subword, different subwords are combined based on the weight of each subword, and the second vocabulary is updated based on the combined subwords until the number of subwords in the second vocabulary is greater than or equal to the first threshold, thereby obtaining the first vocabulary.
[0135] Among them, the first threshold can be set according to actual needs.
[0136] Here, different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words, including:
[0137] The consecutive subwords with the highest weights are combined together as new subwords, and the second vocabulary is updated based on the new subwords; consecutive subwords can be understood as subwords that can be combined together, or adjacent subwords in the second vocabulary.
[0138] Specifically, the consecutive subwords with the highest weights are combined together as new subwords and added to the second vocabulary, the first word frequency and the second word frequency of the consecutive subwords are respectively subtracted from the first word frequency and the second word frequency of the new subword, and when the first word frequency and the second word frequency of the subword are both 0, the subword is deleted from the second vocabulary; the weight of each subword in the second vocabulary is recalculated, and the step of combining the consecutive subwords with the highest weights together as new subwords and adding them to the second vocabulary is returned to continue.
[0139] In this embodiment, it is clear that the corpus includes a general corpus and a private network corpus, and the second vocabulary is updated to finally obtain the first vocabulary. This method can solve the problem that the general vocabulary obtained according to the traditional BPE algorithm process is biased towards the general corpus. For example, in the traditional method, the zona suffix of the English word Arizona may be a subword in the first vocabulary, but the frequency of independent occurrence of zona is very low. It is also possible that the subwords "C" and "PE" are recorded in the first vocabulary obtained by the traditional method, but "CPE (Customer Premises Equipment)" is a commonly used word in private network operation and maintenance. Here, different subwords can be combined based on the weight of each subword, and the second vocabulary can be updated based on the combined subwords, so that the subwords included in the first vocabulary are more in line with the vocabulary of the application scenario, thereby improving the accuracy of the first vocabulary, thereby improving the accuracy of the word segmentation results and the accuracy of intent recognition.
[0140] Step 202: Determine or modify the intention type of the first text at least based on the word segmentation result.
[0141] Here, determining or correcting the intention type of the first text at least based on the word segmentation result can be understood as determining whether the intention type of the first text is accurate at least based on the word segmentation result, and correcting the intention type of the first text when the intention type of the first text is inaccurate.
[0142] In this embodiment, the accuracy of the intention type of the first text can be evaluated and corrected, thereby improving the accuracy of intention recognition.
[0143] In one embodiment, determining or correcting the intention type of the first text at least based on the word segmentation result includes:
[0144] Calculating the similarity between the word segmentation result and the first information, and determining or correcting the intent type of the first text based on the similarity; the first information includes database-related text corresponding to the first intent type and / or the second intent type; and / or
[0145] Based on the classification result of the word segmentation result, the intention type of the first text is determined or modified.
[0146] Here, determining or correcting the intention type of the first text at least based on the word segmentation result includes:
[0147] When the intent type of the first text is the first intent type or the second intent type, calculating the similarity between the word segmentation result and the first information, and determining or correcting the intent type of the first text based on the similarity; the first information includes database-related text corresponding to the first intent type and / or the second intent type;
[0148] When the intention type of the first text is the fifth intention type, the intention type of the first text is determined or corrected based on the classification result of the word segmentation result.
[0149] Among them, the first intent type may be a retrieval intent, the second intent type may be a reasoning intent, and the fifth intent type may be a task intent.
[0150] In this embodiment, the intent types of different first texts are clarified, and at least the intent types of the first texts are determined or modified in different ways based on the word segmentation results, which can improve the accuracy of the intent types of the first texts, that is, improve the accuracy of intent recognition.
[0151] In one embodiment, determining or modifying the intention type of the first text at least based on the word segmentation result includes one or more of the following:
[0152] Determining or modifying the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type;
[0153] Determining or correcting the intent type of the first text based on a second similarity between the word segmentation result and text related to the database corresponding to the second intent type;
[0154] When the first similarity is less than a second threshold, or the classification result of the word segmentation result is a non-set task, the intent type of the first text is determined or corrected based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type.
[0155] The second threshold may be set based on actual needs.
[0156] Specifically, when the intention type of the first text is the first intention type, based on a first similarity between the word segmentation result and a text related to the database corresponding to the first intention type, determining or correcting the intention type of the first text;
[0157] When the intention type of the first text is the second intention type, the intention type of the first text is determined or corrected based on a second similarity between the word segmentation result and a text related to the database corresponding to the second intention type.
[0158] Here, the first similarity and / or the second similarity may be obtained by a cosine similarity algorithm.
[0159] Taking the first similarity as an example, the cosine similarity algorithm performs word embedding calculations on the fields of the word segmentation results and the fields of the text related to the database corresponding to the first intent type to generate a high-dimensional vector matrix, and then calculates the first similarity using the following formula:
[0160]
[0161] Among them, sim is the first similarity, which represents the cosine value of the angle between A and B; A is the high-dimensional vector matrix corresponding to the word segmentation result, and B is the high-dimensional vector matrix corresponding to the database-related text corresponding to the first intent type. It should be understood that the closer the first similarity is to 1, the more similar the word segmentation result is to the database-related text corresponding to the first intent type.
[0162] Taking the example of determining or correcting the intent type of the first text based on the first similarity between the word segmentation result and the database-related text corresponding to the first intent type, the intent type of the first text can also be determined or corrected based on the deep structured speech model (DSSM, DeepStructured Semantic Model). Specifically, the loss function of the model is constructed based on the first similarity, and the model is trained. In actual applications, the word segmentation result and the database-related text corresponding to the first intent type are input into the trained model, and the intent type of the first text is determined or corrected based on whether there is a matching field between the model output result, i.e., the word segmentation result and the database-related text corresponding to the first intent type.
[0163] In this embodiment, the similarity between the word segmentation result and the first information is explicitly calculated, and the intention type of the first text is determined or corrected based on the similarity, thereby improving the efficiency and accuracy of determining the intention type of the first text.
[0164] In one embodiment, determining or correcting the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type includes:
[0165] When the first similarity is greater than or equal to a second threshold, determining the intent type of the first text to be a first intent type; or
[0166] When the first similarity is less than a second threshold, the intent type of the first text is modified from the first intent type to the second intent type.
[0167] In this embodiment, the method of determining or correcting the intention type of the first text in different situations is further clarified, thereby improving the efficiency and accuracy of determining the intention type of the first text.
[0168] In one embodiment, determining or correcting the intent type of the first text based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type includes:
[0169] When the second similarity is greater than or equal to a third threshold, determining the intent type of the first text to be a third intent type; or
[0170] When the second similarity is less than the third threshold, determining the intent type of the first text as the fourth intent type; wherein,
[0171] The third intention type and the fourth intention type are different and both belong to the second intention type.
[0172] The third threshold can be set according to actual needs. The third intent type can be an analytical intent, and the fourth intent type can be a question-answering intent.
[0173] In this embodiment, the second intention type is subdivided, and different intention types of the first text are clearly determined in different situations, which further improves the accuracy of the intention type of the first text.
[0174] In one embodiment, determining or correcting the intention type of the first text at least based on the word segmentation result includes:
[0175] Determining a classification result of the word segmentation result;
[0176] When the classification result is a setting task, determining the intent type of the first text is a fifth intent type; or
[0177] In the case where the classification result is a non-set task, the intent type of the first text is corrected from the fifth intent type to the second intent type; wherein,
[0178] The fifth intention type corresponds to one or more set tasks.
[0179] The set task can be set in advance and is a task that is authorized to be executed and / or executable. For example, the set task includes one or more of the following: indicator download, page transfer, parameter modification, and other tasks.
[0180] Here, the classification result of the word segmentation result may be determined by inputting the word segmentation result into a trained classification model to obtain the classification result of the word segmentation result.
[0181] In this embodiment, the classification result based on the word segmentation result is clearly defined to determine or correct the intention type of the first text. When the classification result is a non-set task, the intention type of the first text can be corrected from the fifth intention type to the second intention type, thereby improving the efficiency and accuracy of determining the intention type of the first text.
[0182] In one embodiment, the intention recognition method further includes:
[0183] When it is determined that the intent type of the first text is the third intent type, a query is performed based on a set path, and the time when the event occurred or the time period when the event occurred in the first text to determine the cause of the event in the first text; the set path includes one or more of the following: a mobile network side path, a service platform side path, and a client side network path.
[0184] Here, the event occurrence time or event occurrence time period in the first text may be obtained directly from the first text or through an interactive method.
[0185] Set the path map, such as Figure 3 shown. Figure 3 It is shown that the mobile network side path can initiate queries to the wireless network management platform, core network management platform, transmission network management platform, and other network devices; specifically, the wireless network management platform can query RSRP network coverage indicator alarms, traffic indicators, transmission control protocol (TCP) packet loss and other network quality indicator alarms; the core network management platform can query core network link alarms and UPF performance indicators; the transmission network management platform can query related alarms; other network devices can query related alarms. The service platform side path can query the package operation status, and can query whether there is any arrears or excess traffic. The client-side network path can obtain terminal logs, terminal alarms, and terminal information such as manufacturer and fault range through information extraction and active inquiry. It should be understood that Figure 3 This is only an example and does not constitute a limitation on the set path.
[0186] In this embodiment, the path is considered to include a mobile network side path, a service platform side path, and a client side network path, and the time when the event occurred or the time period when the event occurred in the first text is clarified, so that the cause of the event in the first text can be determined in a more detailed and targeted manner, which is beneficial to subsequent processing.
[0187] The following is a further detailed description of this application in conjunction with application examples. The intent recognition method of this application can be applied to the network operation and maintenance management platform of the communication private network, the industry network management platform, and the platform that needs to provide fault diagnosis capabilities. Take the industry network management platform for fully automated fault diagnosis as an example, the overall process diagram is as follows: Figure 4 As shown, including:
[0188] The text determination module is used to determine or input a first text; the first text is a text related to the user's natural language.
[0189] The intent classification module is used to perform initial intent recognition on the first text.
[0190] Specifically, the first text is input into the trained industry network language model to obtain the intent type of the first text. For example, the first text "Help me check the http (Hypertext Transfer Protocol) response delay of terminal xxx yesterday" corresponds to a search intent; the first text "Help me check the cause of a certain campus network delay problem" corresponds to a reasoning intent; the first text "Help me change the platform http response delay threshold" corresponds to a task intent.
[0191] The training process of the industry network language model is to take the user input question as the first text, determine the label of the intent type corresponding to the user input question, and perform model training in the form of a tuple of {natural language description, i.e., user input question: label}.
[0192] The form of the label that determines the intent type corresponding to the user input question can be in the form of a multiple-choice question, as follows:
[0193] """Below is the question entered by the user. Please select the question type based on the content of the question.
[0194] "'{User input question}"'
[0195] A. Retrieval type
[0196] B. Reasoning
[0197] C. Task-based
[0198] The contents of the binary form are shown in Table 5 below.
[0199] Table 5
[0200]
[0201] At least before the intent classification and post-evaluation module, the first vocabulary list needs to be obtained based on the improved BPE algorithm.
[0202] Specifically, Figure 5 A schematic diagram of obtaining a first vocabulary based on the improved BPE algorithm is shown. Based on the texts in the general corpus and the private network corpus, a second vocabulary is determined, and the second vocabulary is processed using the improved BPE algorithm to finally obtain the first vocabulary.
[0203] The process of determining a second vocabulary based on the texts in the general corpus and the private network corpus and processing the second vocabulary using the improved BPE algorithm includes:
[0204] Determine a second vocabulary, the second vocabulary including all subwords in the general corpus and the private network corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus;
[0205] Determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list;
[0206] Different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to the first threshold.
[0207] The second vocabulary may further include a third value and a weight for each sub-word; the third value is determined based on the number of occurrences of the sub-word in the corpus and the corresponding weight coefficient of the sub-word.
[0208] The first weight coefficient is 0, the second weight coefficient is 1, and the third weight coefficient is f max =7 as an example, the second vocabulary is shown in Tables 6 and 7 below, Table 6 is the initial second vocabulary, Table 7 is the second vocabulary after one iteration, and the decimal values in Tables 6 and 7 are retained to two decimal places. It should be understood that Tables 6 and 7 only show part and are only examples.
[0209] Table 6
[0210] Subword First word frequency Second word frequency The third value Weight use 0 7 24.96 174.72 P 1 6 23.96 100.83 U 1 6 23.96 100.83 C 1 5 22.96 80.52 Rate 1 4 21.96 61.61 occupy 0 4 21.96 61.61 … … … … …
[0211] Table 7
[0212] Subword First word frequency Second word frequency The third value Weight use 0 7 24.96 174.72 PU 1 5 22.96 80.52 C 1 5 22.96 80.52 Rate 1 4 21.96 61.61 occupy 0 4 21.96 61.61 P 0 1 1 1 U 0 1 1 1 … … … … …
[0213] The final first vocabulary is shown in Table 8. It should be understood that Table 8 only shows a part and is only an example.
[0214] Table 8
[0215] Subword First word frequency Second word frequency The third value Weight CPU usage 0 1 9.98 9.98 … … … … …
[0216] The intention classification post-evaluation module is used to determine or modify the intention type of the first text; the intention classification post-evaluation module processing flow diagram is as follows Figure 6 As shown, including:
[0217] In the case where the intent type of the first text is the first intent type, i.e., the retrieval intent, segmenting the first text based on the first vocabulary to obtain a segmentation result; calculating a first similarity between the segmentation result and a text related to a database corresponding to the first intent type, and determining that it is illegal when the first similarity is less than a second threshold, that is, correcting the intent type of the first text from the first intent type to the second intent type, and determining or correcting the intent type of the first text based on the second similarity between the segmentation result and the text related to the database corresponding to the second intent type;
[0218] When the first similarity is greater than or equal to the second threshold, it is determined to be legal, that is, the intent type of the first text is determined to be the first intent type, and the database field and database table corresponding to the word segmentation result are determined, and the database field is embedded, that is, the database field corresponding to the word segmentation result is replaced with the corresponding field in the first text, and the output of the intent classification evaluation module is obtained. The database field embedding method is shown in Table 9 below.
[0219] Table 9
[0220]
[0221] Taking the first text "Query all projects and their corresponding service modes" as an example, the segmentation result is ["query", "all", "project", "and", "its", "corresponding", "of", "service mode"], and the database fields corresponding to the segmentation result are determined to be [["project", "ProjectID"], ["service mode", "ProjectServiceMode"]] and the database table is Db1.table1. After the database fields are embedded, they are output in the form of JS key-value pair data (json, JavaScript Object Notation) as [{"intention classification": "retrieval type intention", "database table": "Db1.table1", "input": "Query all ProjectIDs and their corresponding ProjectServiceMode"}].
[0222] When the intent type of the first text is the second intent type, i.e., reasoning intent, the first text is segmented based on the first vocabulary to obtain segmentation results; the segmentation results are encoded by a neural network embedding layer to obtain a vector matrix of the segmentation results, and based on the second similarity between the vector matrix of the segmentation results and the database-related text corresponding to the second intent type (the vector form of the text recording the industry network operation and maintenance case), the intent is segmented based on the second similarity.
[0223] Specifically, when the second similarity is greater than or equal to the third threshold, the intent type of the first text is determined to be the third intent type, namely, analytical intent; when the second similarity is less than the third threshold, the intent type of the first text is determined to be the fourth intent type, namely, question-and-answer intent; wherein, both analytical intent and question-and-answer intent belong to reasoning intent.
[0224] Taking the determination that the intent type of the first text is the third intent type as an example, the output of the intent classification and post-evaluation module is [{"intent classification":"analytical intent","input":"agv (Automated Guided Vehicle) has a large delay, please analyze the cause","similar cases":"Case 1, Case 23, Case 123"}], or, [{"intent classification":"analytical intent","input":"agv has a large delay, please analyze the cause","similar cases":[1, 23, 132]}].
[0225] In the case where the intent type of the first text is the fifth intent type, i.e., task-based intent, segmenting the first text based on the first vocabulary to obtain a segmentation result; determining a classification result of the segmentation result; in the case where the classification result is not a set task, determining that it is illegal, i.e., correcting the intent type of the first text from the fifth intent type to the second intent type, and determining or correcting the intent type of the first text based on a second similarity between the segmentation result and a text related to the database corresponding to the second intent type;
[0226] When the classification result is a set task, it is determined to be legal, that is, the intent type of the first text is determined to be the fifth intent type, and the instruction corresponding to the set task is determined, and the data is structured to obtain the output of the intent classification evaluation module. After the data is structured, it is output in json format, for example [{"intent classification":"task-type intent","instruction":"indicator download","input":"first text"}].
[0227] Here, a flow chart of segmenting the first text based on the first vocabulary to obtain the segmentation result is shown as follows: Figure 7 shown. Figure 7 A first text is input in the first word list, where the first text may be in a string form, such as "Hello, please help me...", and the first text is segmented based on the first word list and converted into a digitally encoded segmentation result.
[0228] The intent processing module is used to perform corresponding processing for different intent types; the processing flow diagram of the intent processing module is as follows: Figure 8 As shown, including:
[0229] Specifically, when it is determined that the intent type of the first text is a retrieval intent, Text to SQL (text2sql for short) is performed, that is, the output of the evaluation module after intent classification is converted into a structured query language (SQL) instruction, and the SQL instruction is checked for legality, that is, whether the SQL instruction contains an illegal field setting. If it does not contain an illegal field setting, it is determined to be legal, and a query is performed in the corresponding database table according to the SQL instruction, and the result is returned to the front-end display model for display. Fig. 9 A schematic diagram of the front-end interface for legal retrieval intent is shown.
[0230] In the case of illegal fields, the illegality is determined and the illegality reason is added to the output content of the intent classification and evaluation module. The processing flow of the question-answering intent is input in JSON format, and the industry network language model responds and is displayed in the front-end display module. Fig.10 A schematic diagram of the front-end interface for illegal search intent is shown. The illegal fields are set to, for example, "update" or "delete".
[0231] When it is determined that the intent type of the first text is a question-answering intent, the industry network language model is used to respond based on the output of the intent classification and evaluation module, and the question-answering result is directly displayed through the front-end display module. Fig.11 A schematic diagram of the question-and-answer intent front-end interface is shown.
[0232] When it is determined that the intent type of the first text is analytical intent, the fault time is first extracted; the fault time includes the time when the fault occurs or the time period during which the fault occurs;
[0233] Specifically, the failure time is extracted from the output of the intent classification and post-evaluation module. If the failure time is not extracted from the output of the intent classification and post-evaluation module, an interactive question-and-answer session is established to allow users to supplement it.
[0234] When the time or time period of the fault is determined, the trained industry network language model is used, or the industry network language model is directly guided to perform fault troubleshooting based on the set path, and information is summarized to determine the content related to the network status at the fault time, which can be displayed through the front-end display module; the trained industry network language model is obtained by assisting the industry network language model training based on the set path;
[0235] Based on the relevant content of the network status at the time of the fault and similar cases in the output of the evaluation module after intent classification, analysis and decision-making are carried out, and the cause of the fault and root cause analysis are summarized. A fault report can be formed and the complete conclusion is sent to the front-end display module in the form of a portable file format (PDF, Portable Document Format) for display.
[0236] When the time or time period of a fault cannot be determined, analysis and decision making are made directly based on similar cases in the output of the evaluation module after intent classification, and the analysis results are displayed through the front-end display module.
[0237] Fig.12 A schematic diagram of the analytical intent processing flow is shown. Specifically, the first text "AGV stops and starts, and does not respond after receiving instructions. Please check the cause" is input into the industry network language model. It is determined that the first text is an analytical intent. If the fault time is not extracted, an interaction "Please provide the specific time when the problem occurred. In addition, please tell me whether the fault occurred on all terminal devices in the park" is initiated to the user. The user replies "The fault occurred on September 21. The AGV fault only occurred in one workshop, and no abnormalities occurred in AGVs in other workshops. In addition, PDA (Personal Digital Assistant) tablets and 5G mobile phone users can use them normally." The industry network language model extracts the fault time based on the text replied by the user. If the time extraction is successful, troubleshooting is performed based on the set path. During the troubleshooting process, the industry network language model can query the relevant network management platform database to obtain the content related to the network status at the fault time, and output it synchronously in stages; finally, a fault summary is given based on similar cases and the content related to the network status at the fault time in the output of the evaluation module after intent classification, and output and display it through the front-end display model;
[0238] In the case of time extraction failure, a fault summary is given based on similar cases in the output of the intent classification and evaluation module, and the output is displayed through the front-end display model.
[0239] When it is determined that the intent type of the first text is a task-based intent, the instruction corresponding to the task set in the output of the intent classification evaluation module is directly executed, and it may not be displayed through the front-end display module.
[0240] The intent recognition method provided in the present application obtains a first vocabulary based on an improved BPE algorithm, which can ensure the integrity of the segmentation of key fields of the private network and realize the priority segmentation of proper names of a small corpus in a vertical field, thereby improving the efficiency and accuracy of intent recognition; the improved BPE algorithm balances the frequency and importance of subwords, prioritizes aggregation of specific corpora, and allows low-frequency and high-importance phrases to be aggregated earlier in iterations, while non-private network high-frequency phrases still have a higher weight and a greater chance of aggregation, thereby achieving the accuracy of the first vocabulary; the intent post-classification evaluation module can compensate for intent recognition errors, improve intent recognition accuracy, reduce the delay caused by useless reasoning of the large language model, and dynamically adjust the intent processing method to improve user experience; and it is proposed to prompt the large language model based on a set path to actively obtain fault-related information from which channels to assist the large language model in making judgments. The large language model can also provide more accurate analysis results by asking users questions or querying the database, thereby further improving user experience on the premise of improving intent recognition accuracy.
[0241] In order to implement an intention recognition method provided in an embodiment of the present application, an intention recognition device is also provided in an embodiment of the present application, such as Fig.13 As shown, the device comprises:
[0242] The word segmentation module 1301 is used to segment the first text based on a first word list to obtain a word segmentation result; the first word list is obtained by combining different subwords based on the weights of the subwords in the corpus;
[0243] The intention identification module 1302 is used to determine or modify the intention type of the first text based on at least the word segmentation result.
[0244] In one embodiment, the device further comprises:
[0245] A first determination module, used to determine the frequency of a subword and a weight coefficient of a subword in the corpus;
[0246] A second determination module, configured to determine the weight of a subword in the corpus based on the word frequency of the subword in the corpus and the weight coefficient of the subword;
[0247] A combining module is used to combine different sub-words based on the weights of the sub-words in the corpus to obtain the first vocabulary.
[0248] In one embodiment, the corpus includes a general corpus and a private network corpus; the first determination module is specifically used to determine the weight coefficient of the subword in the general corpus as the first weight coefficient;
[0249] Determining a weight coefficient of a subword corresponding to a second text in the private network corpus as a second weight coefficient; wherein the second weight coefficient is greater than the first weight coefficient;
[0250] The weight coefficient of the subword corresponding to the set field in the private network corpus is determined as a third weight coefficient; the third weight coefficient is determined based on the highest word frequency of the corpus, the total number of subwords in the general corpus and the total number of subwords in the private network corpus; the third weight coefficient is greater than the first weight coefficient.
[0251] In one embodiment, the corpus includes a general corpus and a private network corpus; the device further includes:
[0252] A third determination module is used to determine a second vocabulary, the second vocabulary including all subwords in the corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus;
[0253] The second determination module is further used to determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second vocabulary;
[0254] The combination module is further used to combine different sub-words based on the weight of each sub-word, and update the second vocabulary based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to the first threshold, thereby obtaining the first vocabulary.
[0255] In one embodiment, the second determination module is specifically used to determine the weight of the subword based on the first value and the second value when the first word frequency of the subword is greater than 0 and the second word frequency of the subword is greater than 0; the first value is the product of the second word frequency of the subword, the total number of subwords in the general corpus and the third value; the second value is the product of the first word frequency of the subword and the total number of subwords in the private network corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0256] When the first word frequency of the subword is equal to 0 and the second word frequency of the subword is greater than 0, determining the weight of the subword based on the second word frequency of the subword and a third value; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0257] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is equal to 0, the weight of the subword is determined based on a fourth value and a fifth value; the fourth value is the product of the first word frequency of the subword and the total number of subwords in the general corpus; the fifth value is the product of the highest word frequency of the corpus and the total number of subwords in the private network corpus.
[0258] In one embodiment, the intention recognition module 1302 is specifically used to calculate the similarity between the word segmentation result and the first information, and determine or modify the intention type of the first text based on the similarity; the first information includes database-related text corresponding to the first intention type and / or the second intention type; and / or
[0259] Based on the classification result of the word segmentation result, the intention type of the first text is determined or modified.
[0260] In one embodiment, the intention recognition module 1302 is specifically used for one or more of the following:
[0261] Determining or modifying the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type;
[0262] Determining or correcting the intent type of the first text based on a second similarity between the word segmentation result and text related to the database corresponding to the second intent type;
[0263] When the first similarity is less than a second threshold, or the classification result of the word segmentation result is a non-set task, the intent type of the first text is determined or corrected based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type.
[0264] In one embodiment, the intention recognition module 1302 is specifically configured to determine that the intention type of the first text is the first intention type when the first similarity is greater than or equal to a second threshold; or
[0265] When the first similarity is less than a second threshold, the intent type of the first text is modified from the first intent type to the second intent type.
[0266] In one embodiment, the intention recognition module 1302 is specifically configured to determine that the intention type of the first text is a third intention type when the second similarity is greater than or equal to a third threshold; or
[0267] When the second similarity is less than the third threshold, determining the intent type of the first text as the fourth intent type; wherein,
[0268] The third intention type and the fourth intention type are different and both belong to the second intention type.
[0269] In one embodiment, the intention recognition module 1302 is specifically used to determine the classification result of the word segmentation result;
[0270] When the classification result is a setting task, determining the intent type of the first text is a fifth intent type; or
[0271] In the case where the classification result is a non-set task, the intent type of the first text is corrected from the fifth intent type to the second intent type; wherein,
[0272] The fifth intention type corresponds to one or more set tasks.
[0273] In one embodiment, the device further comprises:
[0274] The fourth determination module is used to determine the cause of the event in the first text based on a set path and the time when the event occurred or the time period when the event occurred in the first text, when it is determined that the intent type of the first text is the third intent type; the set path includes one or more of the following: a mobile network side path, a service platform side path, and a client side network path.
[0275] In actual application, the word segmentation module 1301, the intention recognition module 1302, the first determination module, the second determination module, the combination module, the third determination module and the fourth determination module can be implemented by a processor in the intention recognition device.
[0276] It should be noted that: the above-mentioned embodiment provides an intention recognition device, and only uses the division of the above-mentioned program modules as an example to illustrate when performing intention recognition. In actual applications, the above-mentioned processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the processing described above. In addition, the intention recognition device and the intention recognition method embodiment provided in the above-mentioned embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0277] Based on the hardware implementation of the above program modules, and in order to implement an intention recognition method provided in an embodiment of the present application, an embodiment of the present application further provides an electronic device, such as Fig.14 As shown, the electronic device 1400 includes:
[0278] Communication interface 1401, capable of exchanging information with other network nodes;
[0279] The processor 1402 is connected to the communication interface 1401 to implement information exchange with other network nodes, and is used to execute the method provided by one or more technical solutions when running a computer program. The computer program is stored in the memory 1403.
[0280] Specifically, the processor 1402 is used to segment the first text based on the first vocabulary to obtain a segmentation result; determine or correct the intention type of the first text at least based on the segmentation result; and the first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
[0281] In one embodiment, the processor 1402 is further configured to determine the frequency of a subword in the corpus and a weight coefficient of the subword;
[0282] Determining the weight of the subword in the corpus based on the word frequency of the subword in the corpus and the weight coefficient of the subword;
[0283] The first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
[0284] In one embodiment, the corpus includes a general corpus and a private network corpus; the processor 1402 is specifically configured to determine the weight coefficient of the subword in the general corpus as the first weight coefficient;
[0285] Determining a weight coefficient of a subword corresponding to a second text in the private network corpus as a second weight coefficient; wherein the second weight coefficient is greater than the first weight coefficient;
[0286] The weight coefficient of the subword corresponding to the set field in the private network corpus is determined as a third weight coefficient; the third weight coefficient is determined based on the highest word frequency of the corpus, the total number of subwords in the general corpus and the total number of subwords in the private network corpus; the third weight coefficient is greater than the first weight coefficient.
[0287] In one embodiment, the corpus includes a general corpus and a private network corpus; the processor 1402 is further configured to determine a second vocabulary, the second vocabulary including all subwords in the corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus;
[0288] Determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list;
[0289] Different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to a first threshold, thereby obtaining the first vocabulary.
[0290] In one embodiment, the processor 1402 is specifically configured to determine the weight of the subword based on a first value and a second value when the first word frequency of the subword is greater than 0 and the second word frequency of the subword is greater than 0; the first value is the product of the second word frequency of the subword, the total number of subwords in the general corpus, and a third value; the second value is the product of the first word frequency of the subword and the total number of subwords in the private network corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0291] When the first word frequency of the subword is equal to 0 and the second word frequency of the subword is greater than 0, determining the weight of the subword based on the second word frequency of the subword and a third value; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword;
[0292] When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is equal to 0, the weight of the subword is determined based on a fourth value and a fifth value; the fourth value is the product of the first word frequency of the subword and the total number of subwords in the general corpus; the fifth value is the product of the highest word frequency of the corpus and the total number of subwords in the private network corpus.
[0293] In one embodiment, the processor 1402 is specifically used to calculate the similarity between the word segmentation result and the first information, and determine or modify the intention type of the first text based on the similarity; the first information includes database-related text corresponding to the first intention type and / or the second intention type; and / or
[0294] Based on the classification result of the word segmentation result, the intention type of the first text is determined or modified.
[0295] In one embodiment, the processor 1402 is specifically configured to do one or more of the following:
[0296] Determining or modifying the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type;
[0297] Determining or correcting the intent type of the first text based on a second similarity between the word segmentation result and text related to the database corresponding to the second intent type;
[0298] When the first similarity is less than a second threshold, or the classification result of the word segmentation result is a non-set task, the intent type of the first text is determined or corrected based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type.
[0299] In one embodiment, the processor 1402 is specifically configured to determine that the intention type of the first text is the first intention type when the first similarity is greater than or equal to a second threshold; or
[0300] When the first similarity is less than a second threshold, the intent type of the first text is modified from the first intent type to the second intent type.
[0301] In one embodiment, the processor 1402 is specifically configured to determine that the intention type of the first text is a third intention type when the second similarity is greater than or equal to a third threshold; or
[0302] When the second similarity is less than the third threshold, determining the intent type of the first text as the fourth intent type; wherein,
[0303] The third intention type and the fourth intention type are different and both belong to the second intention type.
[0304] In one embodiment, the processor 1402 is specifically configured to determine a classification result of the word segmentation result;
[0305] When the classification result is a setting task, determining the intent type of the first text is a fifth intent type; or
[0306] In the case where the classification result is a non-set task, the intent type of the first text is corrected from the fifth intent type to the second intent type; wherein,
[0307] The fifth intention type corresponds to one or more set tasks.
[0308] In one embodiment, the processor 1402 is also used to determine the cause of the event in the first text by querying based on a set path and the time when the event occurred or the time period when the event occurred in the first text when determining that the intent type of the first text is the third intent type; the set path includes one or more of the following: a mobile network side path, a service platform side path, and a client side network path.
[0309] It should be noted that the specific processing process of the processor 1402 can be understood by referring to the above method.
[0310] Of course, in actual application, the various components in the electronic device 1400 are coupled together through the bus system 1404. It can be understood that the bus system 1404 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 1404 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Fig.14Various buses are labeled as bus system 1404.
[0311] The memory 1403 in the embodiment of the present application is used to store various types of data to support the operation of the electronic device 1400. Examples of such data include: any computer program used to operate on the electronic device 1400.
[0312] The method disclosed in the above embodiment of the present application can be applied to the processor 1402, or implemented by the processor 1402. The processor 1402 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of the hardware in the processor 1402 or an instruction in the form of software. The above-mentioned processor 1402 may be a general-purpose processor, a digital signal processor (DSP, DigitalSignal Processor), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The processor 1402 can implement or execute the 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. In combination with the steps of the method disclosed in the embodiment of the present application, it can be directly embodied as a hardware decoding processor to execute, or it can be executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, which is located in the memory 1403, and the processor 1402 reads the information in the memory 1403 and completes the steps of the above method in combination with its hardware.
[0313] In an exemplary embodiment, the electronic device 1400 may be implemented by one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to execute the aforementioned method.
[0314] It can be understood that the memory 1403 of the embodiment of the present application can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), synchronous static random access memory (SSRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM, SyncLink Dynamic Random Access Memory), and direct RAMbus random access memory (DRRAM, Direct Rambus Random Access Memory).The memory 1403 described in the embodiments of the present application is intended to include but is not limited to these and any other suitable types of memories.
[0315] In an exemplary embodiment, the embodiment of the present application further provides an electronic device, including a processor and a memory for storing a computer program that can be run on the processor, wherein the processor is used to execute the steps of any of the above methods when running the computer program.
[0316] The embodiment of the present application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, for example, including a memory 1403 storing a computer program, and the computer program can be executed by a processor 1402 of an electronic device 1400 to complete the steps of the aforementioned method. The computer-readable storage medium can be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface storage, optical disk, or CD-ROM.
[0317] An embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of any of the above methods when executed by a processor.
[0318] It should be noted that: "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. The term "and / or" herein is only a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "one or more" herein represents any combination of at least two of any one or more of a plurality of items. For example, including one or more of A, B, and C can represent including any one or at least two or more elements selected from the set consisting of A, B, and C.
[0319] In addition, the technical solutions described in the embodiments of the present application can be combined arbitrarily without conflict.
[0320] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
Claims
1. A method for intention recognition, characterized in that: The method comprises: Segmenting the first text based on a first vocabulary to obtain a segmentation result; the first vocabulary is obtained by combining different subwords based on the weights of the subwords in the corpus; The intention type of the first text is determined or modified based on at least the word segmentation result.
2. The method according to claim 1, characterized in that The method further comprises: Determining the frequency of subwords and weight coefficients of subwords in the corpus; Determining the weight of the subword in the corpus based on the word frequency of the subword in the corpus and the weight coefficient of the subword; The first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
3. The method according to claim 2, characterized in that The corpus includes a general corpus and a private network corpus; the step of determining the weight coefficient of the subword in the corpus includes: Determining a weight coefficient of a subword in the general corpus as a first weight coefficient; Determining a weight coefficient of a subword corresponding to a second text in the private network corpus as a second weight coefficient; wherein the second weight coefficient is greater than the first weight coefficient; The weight coefficient of the subword corresponding to the set field in the private network corpus is determined as a third weight coefficient; the third weight coefficient is determined based on the highest word frequency of the corpus, the total number of subwords in the general corpus and the total number of subwords in the private network corpus; the third weight coefficient is greater than the first weight coefficient.
4. The method according to any one of claims 1 to 3, characterized in that: The corpus includes a general corpus and a private network corpus; the method further includes: Determine a second vocabulary, the second vocabulary including all subwords in the corpus, a first word frequency and a second word frequency of each subword; the first word frequency represents the word frequency of the subword in the general corpus, and the second word frequency represents the word frequency of the subword in the private network corpus; Determine the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list; Different sub-words are combined based on the weight of each sub-word, and the second vocabulary is updated based on the combined sub-words until the number of sub-words in the second vocabulary is greater than or equal to a first threshold, thereby obtaining the first vocabulary.
5. The method according to claim 4, characterized in that The step of determining the weight of each subword based on the first word frequency, the second word frequency and the weight coefficient of each subword in the second word list includes: When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is greater than 0, the weight of the subword is determined based on the first value and the second value; the first value is the product of the second word frequency of the subword, the total number of subwords in the general corpus and the third value; the second value is the product of the first word frequency of the subword and the total number of subwords in the private network corpus; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword; When the first word frequency of the subword is equal to 0 and the second word frequency of the subword is greater than 0, determining the weight of the subword based on the second word frequency of the subword and a third value; the third value is determined based on the number of occurrences of the subword in the corpus and the corresponding weight coefficient of the subword; When the first word frequency of the subword is greater than 0 and the second word frequency of the subword is equal to 0, the weight of the subword is determined based on a fourth value and a fifth value; the fourth value is the product of the first word frequency of the subword and the total number of subwords in the general corpus; the fifth value is the product of the highest word frequency of the corpus and the total number of subwords in the private network corpus.
6. The method according to any one of claims 1 to 3 and 5, characterized in that: The determining or correcting the intention type of the first text at least based on the word segmentation result includes: Calculating the similarity between the word segmentation result and the first information, and determining or correcting the intent type of the first text based on the similarity; the first information includes database-related text corresponding to the first intent type and / or the second intent type; and / or Based on the classification result of the word segmentation result, the intention type of the first text is determined or modified.
7. The method according to any one of claims 1 to 3 and 5, characterized in that: The determining or modifying the intention type of the first text at least based on the word segmentation result includes one or more of the following: Determining or modifying the intent type of the first text based on a first similarity between the word segmentation result and a text related to a database corresponding to the first intent type; Determining or correcting the intent type of the first text based on a second similarity between the word segmentation result and text related to the database corresponding to the second intent type; When the first similarity is less than a second threshold, or the classification result of the word segmentation result is a non-set task, the intent type of the first text is determined or corrected based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type.
8. The method according to claim 7, characterized in that The determining or correcting the intent type of the first text based on the first similarity between the word segmentation result and the text related to the database corresponding to the first intent type includes: When the first similarity is greater than or equal to a second threshold, determining the intent type of the first text to be a first intent type; or When the first similarity is less than a second threshold, the intent type of the first text is modified from the first intent type to the second intent type.
9. The method according to claim 7, characterized in that: The determining or correcting the intent type of the first text based on the second similarity between the word segmentation result and the text related to the database corresponding to the second intent type includes: When the second similarity is greater than or equal to a third threshold, determining the intent type of the first text to be a third intent type; or When the second similarity is less than the third threshold, determining the intent type of the first text as the fourth intent type; wherein, The third intention type and the fourth intention type are different and both belong to the second intention type.
10. The method according to any one of claims 1 to 3, 5, 8 to 9, characterized in that: The determining or correcting the intention type of the first text at least based on the word segmentation result includes: Determining a classification result of the word segmentation result; When the classification result is a setting task, determining the intent type of the first text is a fifth intent type; or In the case where the classification result is a non-set task, the intent type of the first text is corrected from the fifth intent type to the second intent type; wherein, The fifth intention type corresponds to one or more set tasks.
11. The method according to any one of claims 1 to 3, 5, 8 to 9, characterized in that: The method further comprises: When it is determined that the intent type of the first text is the third intent type, a query is performed based on a set path, and the time when the event occurred or the time period when the event occurred in the first text to determine the cause of the event in the first text; the set path includes one or more of the following: a mobile network side path, a service platform side path, and a client side network path.
12. An intention recognition device, characterized in that: The device comprises: A word segmentation module, configured to segment the first text based on a first word list to obtain a word segmentation result; the first word list is obtained by combining different subwords based on the weights of the subwords in the corpus; An intention recognition module is used to determine or modify the intention type of the first text based at least on the word segmentation result.
13. An electronic device, characterized in that: include: Processor and communication interface; wherein, The processor is used to segment the first text based on the first vocabulary to obtain a segmentation result; determine or modify the intention type of the first text at least based on the segmentation result; the first vocabulary is obtained by combining different sub-words based on the weights of the sub-words in the corpus.
14. An electronic device, characterized in that: comprising a processor and a memory for storing a computer program capable of being executed on the processor, Wherein, when the processor is used to run the computer program, it executes the steps of the method described in any one of claims 1 to 11.
15. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
16. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.