A slot information extraction method and device, electronic equipment and storage medium
By combining exact matching, fuzzy matching, and sequence labeling modes, and utilizing AC automata and tree structures to optimize slot information extraction, the problems of long response time and nested entity output are solved, thus improving the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-08
- Publication Date
- 2026-03-31
AI Technical Summary
Existing slot information extraction methods have excessively long response times, poor user experience, and cannot effectively solve the problem of selecting and outputting nested entities.
A combination of exact matching, fuzzy matching, and sequence labeling modes is used, along with the AC automaton algorithm and tree structures (such as prefix trees, interval trees, and multi-way trees) to extract slot information, optimize response time, and solve the selection and output of nested entities.
It shortens the response time for user input, improves the user experience, and effectively solves the problem of selecting and outputting nested entities.
Smart Images

Figure CN115186077B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device and storage medium for extracting slot information. Background Technology
[0002] When using chatbots, it is generally necessary to extract key information from the user's input query through slot information extraction, so as to control the jump of the dialogue logic and identify the keywords in the dialogue.
[0003] Currently, there are two most commonly used methods for slot information extraction: First, rule-based and dictionary-based methods. This method uses regular expressions or other rules to match strings that conform to a pattern, using these as the slot extraction results. Its drawback is that it requires the user-input keywords to be completely consistent with the pre-stored vocabulary, and when the vocabulary is large, the processing speed of the regular expressions increases almost linearly, which can easily lead to excessively long server response times to user input, resulting in a very poor user experience. Second, sequence labeling methods. This method assigns a label to each word in a sentence according to requirements, typically using IOB2 or IOBES standards. This method cannot solve the problem of selecting and outputting nested entities. Summary of the Invention
[0004] In view of this, the present disclosure provides a slot information extraction method, apparatus, electronic device, and computer-readable storage medium to solve the problems of excessively long response time to user input, poor user experience, and inability to solve the selection and output of nested entities in existing slot information extraction methods.
[0005] A first aspect of this disclosure provides a method for extracting slot information, including:
[0006] Obtain the content to be identified and determine the slot scene category corresponding to the content to be identified;
[0007] Determine the slot information extraction strategy corresponding to the slot scene category. The slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode.
[0008] Based on the slot information extraction strategy, slot information corresponding to the slot scene category is extracted from the content to be identified, and the slot information is output.
[0009] A second aspect of this disclosure provides a slot information extraction device, comprising:
[0010] The content acquisition module is configured to acquire the content to be identified and determine the slot scene category corresponding to the content to be identified.
[0011] The strategy determination module is configured to determine the slot information extraction strategy corresponding to the slot scene category. The slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode.
[0012] The information extraction module is configured to extract slot information corresponding to the slot scene category from the content to be identified based on the slot information extraction strategy, and output the slot information.
[0013] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.
[0014] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0015] Compared with the prior art, the beneficial effects of this disclosure include at least the following: by acquiring the content to be identified, determining the slot scene category corresponding to the content to be identified; determining the slot information extraction strategy corresponding to the slot scene category, wherein the slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode; and based on the slot information extraction strategy, extracting the slot information corresponding to the slot scene category from the content to be identified and outputting the slot information, which can not only shorten the response time to user input and improve the user experience, but also effectively solve the problem of selecting and outputting nested entities. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this disclosure;
[0018] Figure 2 This is a schematic flowchart of a slot information extraction method provided in an embodiment of this disclosure;
[0019] Figure 3 This is a schematic diagram of a method for constructing an interval tree in the slot information extraction method provided in this embodiment of the disclosure;
[0020] Figure 4 This is a schematic diagram of a multi-branch tree construction method in the slot information extraction method provided in this embodiment of the disclosure;
[0021] Figure 5 This is a schematic diagram of the structure of a slot information extraction device provided in an embodiment of this disclosure;
[0022] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0023] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.
[0024] A method and apparatus for extracting slot information according to an embodiment of the present disclosure will now be described in detail with reference to the accompanying drawings.
[0025] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this disclosure. The application scenario may include a terminal device 101, a server 102, and a network 103.
[0026] Terminal device 101 can be hardware or software. When terminal device 101 is hardware, it can be various electronic devices with a microphone and speaker that support human-computer interaction, including but not limited to smartphones, tablets, laptops, and desktop computers; when terminal device 101 is software, it can be installed in the aforementioned electronic devices. Terminal device 101 can be implemented as multiple software programs or software modules, or as a single software program or software module; this disclosure does not limit this. Furthermore, various applications can be installed on terminal device 101, such as data processing applications, instant messaging tools, social platform software, search applications, etc.
[0027] Server 102 can be a server that provides various services, such as a human-computer dialogue server that answers questions entered by terminal devices with which it has established a communication connection. This human-computer dialogue server can receive and analyze requests sent by terminal devices and generate processing results. Server 102 can be a single server, a server cluster consisting of several servers, or a cloud computing service center; this embodiment of the disclosure does not impose any limitations on these aspects.
[0028] It should be noted that the server 102 can be either hardware or software. When the server 102 is hardware, it can be various electronic devices that provide various services to the terminal device 101. When the server 102 is software, it can be multiple software programs or software modules that provide various services to the terminal device 101, or it can be a single software program or software module that provides various services to the terminal device 101. This disclosure does not impose any limitations on this aspect.
[0029] Network 103 can be a wired network using coaxial cable, twisted pair, and fiber optic connection, or it can be a wireless network that enables interconnection of various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), and Infrared. This disclosure does not limit the scope of the network.
[0030] In this embodiment, server 102 can establish a communication connection with terminal device 101 via network 103 to receive the content to be identified input by terminal device 101. Then, the slot scene category corresponding to the content to be identified is determined; next, the slot information extraction strategy corresponding to the slot scene category is determined. The slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode; then, based on the slot information extraction strategy, the slot information corresponding to the slot scene category is extracted from the content to be identified and the slot information is output. This not only shortens the response time to user input and improves the user experience, but also effectively solves the problem of selecting and outputting nested entities.
[0031] It should be noted that the specific types, quantities, and combinations of terminal device 101, server 102, and network 103 can be adjusted according to the actual needs of the application scenario, and this disclosure embodiment does not impose any restrictions on this.
[0032] Figure 2 This is a schematic flowchart of a slot information extraction method provided in an embodiment of this disclosure. Figure 2 The method for extracting slot information can be derived from... Figure 1 Server 102 executes. For example... Figure 2 As shown, the method for extracting slot information includes:
[0033] Step S201: Obtain the content to be identified and determine the slot scene category corresponding to the content to be identified.
[0034] The content to be identified typically refers to the chat questions and answers or queries entered by the user during a human-computer interaction with the chatbot. This content can be in the form of voice or text.
[0035] Slot scenario categories typically refer to the application scenario category corresponding to the intent of the user's input. Intent refers to the type of information the user is asking for. For example, if the user's input is "Book a flight from Shanghai to Hainan tomorrow afternoon," the server can identify the user's intent as "book a flight," and the application scenario category corresponding to this intent is "book a flight scenario." As another example, if the user's input is "Recommend tourist attractions in District B of City A," the server can identify the user's intent as "attraction recommendation," and the application scenario category corresponding to this intent is "attraction recommendation scenario."
[0036] As an example, the correspondence between intents and application scenario categories can be predefined.
[0037] Users can input their questions or queries (i.e., content to be identified) through a terminal device (such as a smartphone) and send the content to a server (such as a human-computer dialogue server). When the server receives the content, it can identify the intent corresponding to the content, and then determine the application scenario category corresponding to that intent, thus determining the slot scenario category corresponding to the content.
[0038] Step S202: Determine the slot information extraction strategy corresponding to the slot scene category. The slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode.
[0039] As an example, semantic slots corresponding to each slot scenario category can be predefined, along with the slot information extraction mode for each type of semantic slot. Taking the slot scenario category of "booking flight tickets" as an example, the semantic slots corresponding to "booking flight tickets" can include: "City Name: ()," "Airport Address: ()," "Time: ()," "Quantity: ()," "Seat Location: ()," etc. Then, the semantic slots corresponding to each slot scenario category can be classified to obtain the classification results, and the slot information extraction strategy corresponding to the slot scenario category can be determined based on the classification results.
[0040] The slot information extraction modes mainly include precise extraction mode, fuzzy extraction mode, and sequence labeling extraction mode. For example, for general, non-fixed pattern semantic slots such as name and location, the corresponding slot information extraction mode is sequence labeling extraction mode.
[0041] Step S203: Based on the slot information extraction strategy, extract the slot information corresponding to the slot scene category from the content to be identified, and output the slot information.
[0042] Slot information refers to the content that needs to be filled into the parentheses of the various semantic slots mentioned above. For example, the semantic slot "City Name: ()" could have city names such as "Shanghai", "Hainan", and "Sichuan" as its corresponding slot information.
[0043] The technical solution provided in this disclosure involves obtaining the content to be identified, determining the slot scene category corresponding to the content, determining the slot information extraction strategy corresponding to the slot scene category, wherein the slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode; based on the slot information extraction strategy, the slot information corresponding to the slot scene category is extracted from the content to be identified and the slot information is output. This not only improves the response speed to user input, shortens the response time, and enhances the user experience, but also effectively solves the problem of selecting and outputting nested entities.
[0044] In some embodiments, determining a slot information extraction strategy corresponding to a slot scene category includes:
[0045] Obtain at least one semantic slot corresponding to the slot scene category;
[0046] Determine the slot type for each semantic slot, which can be any one of precise slot, fuzzy slot, or general slot;
[0047] If the slot type of each semantic slot corresponding to the slot scene category is an exact slot, then the slot information extraction strategy corresponding to the slot scene category is the exact matching mode.
[0048] If the slot type of each semantic slot corresponding to the slot scene category is a fuzzy slot, then the slot information extraction strategy corresponding to the slot scene category is the fuzzy matching mode.
[0049] If the slot type of the semantic slot corresponding to the slot scene category includes precise slots and fuzzy slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of precise matching mode and fuzzy matching mode.
[0050] If the slot type of the semantic slot corresponding to the slot scene category includes general slots and precise slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode and precise matching mode.
[0051] If the slot type of the semantic slot corresponding to the slot scene category includes general slots and fuzzy slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode and fuzzy matching mode.
[0052] If the slot type of the semantic slot corresponding to the slot scene category includes general slot, precise slot, and fuzzy slot, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode, precise matching mode, and fuzzy matching mode.
[0053] In some embodiments, determining the slot type for each semantic slot includes:
[0054] Obtain response performance parameter values, the application domain corresponding to the semantic slot, and the pattern matching requirements corresponding to the semantic slot;
[0055] Based on the response performance parameter values, application domain, and pattern matching requirements, determine the slot type corresponding to each semantic slot.
[0056] Generally, each slot scenario category usually corresponds to one or more semantic slots.
[0057] Response performance parameters generally refer to the speed and duration of the dialogue server's response to the user's input.
[0058] Application areas include, but are not limited to, industrial manufacturing, services, agriculture, aerospace, and smart technology. Each of these areas can be further subdivided into more specific sub-sectors. For example, the services sector can be further subdivided into areas closely related to people's daily lives, such as clothing, food, housing, and transportation; financial services; and e-commerce.
[0059] Pattern matching requirements typically refer to the matching patterns required to extract slot information corresponding to semantic slots. Matching patterns generally include exact matching, fuzzy matching, and object-fixed pattern matching.
[0060] In one embodiment, the target domain for extracting slot information using the exact matching mode can be predefined. Generally, the target domain refers to a highly specialized field with relatively few technical terms used. For example, the real estate sector or the financial sector.
[0061] As an example, after determining the application domain corresponding to a semantic slot, it is determined whether the application domain belongs to the target domain. If the application domain belongs to the target domain and the response performance parameter value (such as response time) meets the preset first response performance condition (such as response time within 10ms), then the slot type of the semantic slot is determined to be an exact slot.
[0062] As another example, if it is determined that the response performance parameter value (such as response time) of a certain semantic slot meets the preset second response performance condition (such as the response time can be relaxed to 10ms~50ms), and its pattern matching requirement is to find the string that matches the semantic slot in the content to be identified approximately (not precisely), then the slot type of the semantic slot can be determined to be a fuzzy slot.
[0063] As another example, if a semantic slot is generic and the pattern matching requirement is that there is no fixed pattern, then that semantic slot can be identified as a generic slot. For example, semantic slots such as name and location are generic slots.
[0064] In an exemplary embodiment, if a certain slot scene category corresponds to 5 semantic slots, these 5 semantic slots can be numbered as semantic slots A, B, C, D, and E respectively. If, according to the above steps, semantic slots A, B, C, D, and E are determined to be precise slots, then the slot information extraction strategy corresponding to this slot scene category is precise matching mode. If, according to the above steps, semantic slots A, B, C, D, and E are determined to be fuzzy slots, then the slot information extraction strategy corresponding to this slot scene category is fuzzy matching mode. If, according to the above steps, semantic slots A, B, and C are precise slots, and semantic slots D and E are fuzzy slots, then the slot information extraction strategy corresponding to this slot scene category is a combination of precise matching mode and fuzzy matching mode. If, according to the above steps, semantic slots A and B are general slots, and semantic slots C, D, and E are precise slots, then the slot information extraction strategy corresponding to this slot scene category is a combination of sequence labeling mode and precise matching mode. If, based on the above steps, semantic slots A and B are determined to be general slots, and semantic slots C, D, and E are fuzzy slots, then the slot information extraction strategy corresponding to the scene category of that slot is a combination of sequence labeling mode and fuzzy matching mode. If, based on the above steps, semantic slot A is determined to be a general slot, semantic slots B and C are precise slots, and semantic slots D and E are fuzzy slots, then the slot information extraction strategy corresponding to the scene category of that slot is a combination of sequence labeling mode, precise matching mode, and fuzzy matching mode.
[0065] In some embodiments, the slot information extraction strategy is an exact matching mode.
[0066] Based on the slot information extraction strategy, slot information corresponding to the slot scene category is extracted from the content to be identified, and the slot information is output, including:
[0067] Based on the AC automaton algorithm and a preset prefix tree, multi-modal string matching is performed on the content to be identified to obtain the first character sequence that is successfully matched.
[0068] Based on the first character sequence, determine the first slot information corresponding to each precise slot of the slot scene category, and output the first slot information.
[0069] Exact matching primarily addresses the issue of retrieving header information from user-input content to be identified.
[0070] The AC (Aho-Corasick automaton) algorithm, based on the finite automaton multi-mode algorithm, replaces the pattern set with a pattern matching machine in the preprocessing stage, hence the name AC automaton.
[0071] As an example, a prefix tree can be pre-built based on a series of keywords stored in the vocabulary. The common prefixes of strings are used to minimize unnecessary string comparisons and improve query efficiency. Then, the user-input content to be recognized is obtained, and each character in the content is traversed. Based on the AC automaton algorithm, multi-modal string matching is performed on the pre-built prefix tree. When an EOT special character (i.e., the end-of-text symbol) is matched, a successful match is achieved, and the first character sequence is obtained. Next, the standard keyword corresponding to this first character sequence (i.e., the first slot information) is found and output.
[0072] In some embodiments, determining the first slot information corresponding to the precise slot based on the first character sequence, and outputting the first slot information, includes:
[0073] Determine whether there is any overlap in the slot intervals between the first slot information of the precise slot;
[0074] If there is an overlap between the slot intervals of the first slot information, an interval tree is constructed, and the first slot information is filtered based on the interval tree to obtain the second slot information, and the second slot information is output.
[0075] Combination Figure 3 As an example, when using exact matching to extract slot information, the extracted slot information may have overlapping slot intervals. For instance, if the user inputs "book a train ticket from Shanghai South to Hainan", when using exact matching to extract the first slot information corresponding to the semantic slot "city name", it is found that "Shanghai" and "Hainan" in the extracted first slot information "Shanghai South" have an overlap (i.e., there is an overlap in slot intervals). Then, the first slot information can be filtered by constructing an interval tree, that is, continue matching, and finally match the correct result "to Hainan" for the city "Hainan", thus obtaining the second slot information "Shanghai" and "Hainan".
[0076] Compared to the traditional exhaustive search method, the embodiments of this disclosure filter slot information with overlapping slot intervals by constructing an interval tree, which can reduce the complexity of interval overlap judgment, facilitate the output of correct slot information, and improve the response speed of question and answer, and shorten the response time.
[0077] In some embodiments, the slot information extraction strategy is a fuzzy matching mode.
[0078] Based on the slot information extraction strategy, slot information corresponding to the slot scene category is extracted from the content to be identified, and the slot information is output, including:
[0079] Find the longest consecutive matching string in the content to be identified that matches the keywords stored in the preset trie;
[0080] Find the non-continuous matching strings in the content to be identified that do not match the keywords stored in the trie;
[0081] Calculate the first similarity between the longest consecutive matching string and the content to be identified;
[0082] Calculate the second similarity between the non-continuous matching string and the content to be identified;
[0083] Based on the first and second similarities, the third slot information corresponding to each fuzzy slot is determined.
[0084] The longest consecutive matching string refers to the longest consecutive matching substring in the content to be identified that does not contain "garbage" elements and matches the keywords in the trie continuously. Here, "garbage" elements usually refer to elements that have no value in some sense, such as blank lines, whitespace characters, etc.
[0085] A non-continuous matching string is a string consisting of a set of non-continuous matching substrings.
[0086] The fuzzy matching mode employs a dynamic programming strategy, the specific process of which is as follows:
[0087] As an example, assuming the keyword "Shanghai South Railway Station" is pre-stored in the trie, and the user inputs "book a train ticket from Shanghai South Railway Station to Hainan," then when extracting the slot information corresponding to the semantic slot "city name" using fuzzy matching, we can iterate through each character of the input to find the longest continuous matching string "Shanghai" that matches the keyword "Shanghai South Railway Station." Simultaneously, we can find the non-continuous matching string "Shanghai South Railway Station." Then, we calculate the first similarity between the longest continuous matching string and the input, i.e., the first similarity between "Shanghai" and "Shanghai South Railway Station"; and the second similarity between the non-continuous matching string and the input, i.e., the second similarity between "Shanghai South Railway Station" and "Shanghai South Railway Station." The first and second similarities can be cosine similarities. For example, if the calculated first similarity is 85% and the second similarity is 90%, then the third slot information corresponding to the semantic slot "city" is "Shanghai South Railway Station."
[0088] A non-continuous matching string consists of multiple non-continuous matching substrings, with a maximum character interval of 1 between the multiple non-continuous matching substrings.
[0089] In the example above, the non-contiguous matching string "Shanghai's South Station" is a string composed of the non-contiguous matching substrings "Shanghai", "of", and "South Station". "Shanghai" matches "Shanghai" continuously in the keyword "Shanghai South Station", and "South Station" matches "South Station" continuously in the keyword "Shanghai South Station". In "Shanghai's South Station", "Shanghai" and "South Station" are separated by one character "of", that is, the interval is 1 character.
[0090] In some embodiments, the slot information extraction strategy is a combination of sequence labeling mode, exact matching mode, and fuzzy matching mode.
[0091] Based on the slot information extraction strategy, slot information corresponding to the slot scene category is extracted from the content to be identified, and the slot information is output, including:
[0092] Based on the exact matching mode, the exact slot information corresponding to the exact slot is extracted from the content to be identified;
[0093] Based on the fuzzy matching mode, the fuzzy slot information corresponding to the fuzzy slot is extracted from the content to be identified;
[0094] Based on the sequence labeling pattern, extract the general slot information corresponding to the general slot from the content to be identified;
[0095] Output precise slots and their corresponding precise slot information, fuzzy slots and their corresponding fuzzy slot information, and general slots and their corresponding general slot information.
[0096] For sequence labeling modes, the existing IOB2 and IOBES slot information extraction methods can be referenced, and will not be elaborated here.
[0097] As an example, suppose a certain slot scene category corresponds to 5 semantic slots, numbered A, B, C, D, and E respectively. Slot A is a general slot, slots B and C are precise slots, and slots D and E are fuzzy slots. Then, based on sequence labeling, the general slot information 'a' corresponding to semantic slot A can be extracted from the content to be identified. Based on the aforementioned precise matching mode, the precise slot information 'b' and 'c' corresponding to semantic slots B and C respectively can be extracted from the content to be identified. Based on the aforementioned fuzzy matching mode, the fuzzy slot information 'd' and 'e' corresponding to semantic slots D and E respectively can be extracted from the content to be identified. Then, the output is: Semantic slot A: general slot information 'a', Semantic slot B: precise slot information 'b', Semantic slot C: precise slot information 'c', Semantic slot D: fuzzy slot information 'd', Semantic slot E: fuzzy slot information 'e'.
[0098] In some embodiments, the output includes precise slots and their corresponding precise slot information, fuzzy slot information corresponding to fuzzy slots, and general slots and their corresponding general slot information, including:
[0099] Determine whether there is any overlap in the slot intervals between precise slot information, fuzzy slot information, and general slot information;
[0100] If there is an overlap between the slot intervals of precise slot information, fuzzy slot information, and general slot information, a multi-branch tree is constructed and the precise slot information, fuzzy slot information, and general slot information are filtered based on the multi-branch tree to obtain the final slot information corresponding to the slot scene category, and the final slot information is output.
[0101] In some embodiments, a multi-branch tree is constructed and the precise slot information, fuzzy slot information, and general slot information are filtered based on the multi-branch tree to obtain the final slot information corresponding to the slot scene category, including:
[0102] The precise slot information, fuzzy slot information, and general slot information are divided into one target slot information and multiple other slot information;
[0103] Construct the root node of the multi-way tree and add the target slot information to the multi-way tree;
[0104] Read information from another slot one by one, compare the slot range of the currently read other slot information with the node range of the leaf node of the multi-way tree, and get the comparison result;
[0105] If the comparison result shows that there is an intersection between the slot interval and the node interval, then add a child node to the parent node of the leaf node to widen the current slot interval of the multi-way tree.
[0106] If the comparison result shows that there is no intersection between the slot interval and the node interval, then add a child node at the leaf node to deepen the current slot interval of the multi-way tree;
[0107] Returns the traversal path from the root node to all leaf nodes of the multi-way tree, and outputs the final slot combination information corresponding to the traversal path.
[0108] As an example, suppose there is overlap in slot intervals among general slot information a, precise slot information b, precise slot information c, fuzzy slot information d, and fuzzy slot information e. Then, the precise slot information, fuzzy slot information, and general slot information can be divided into one target slot information and multiple other slot information. For example, suppose precise slot information b is classified as the target slot information, and general slot information a, precise slot information c, fuzzy slot information d, and fuzzy slot information e are classified as other slot information. Construct a ROOT (root node), add the target slot information to the child0 leaf node of the multi-way tree; then, following the order of general slot information a → precise slot information c → fuzzy slot information d → fuzzy slot information e, read one other slot information at a time, and compare the slot interval of the currently read other slot information with the node intervals of all leaf nodes of the multi-way tree to obtain the comparison result. If the comparison result shows that the slot interval of the target slot information intersects with the node interval of the leaf node of the multi-way tree, then add a child node to the parent node of the leaf node to widen the current slot interval of the multi-way tree; if the comparison result shows that the slot interval and the node interval do not intersect, then add a child node at the leaf node to deepen the current slot interval of the multi-way tree; finally, return the traversal path from the root node to all leaf nodes, and each path represents a set of final slot combination information.
[0109] All entities of the above general slot information a, precise slot information b, precise slot information c, fuzzy slot information d, and fuzzy slot information e can be sorted (e.g., using char_offset sorting). The slot information with the largest total entity length is output first, and this slot information with the largest total entity length is determined as the target slot information and added to the multi-branch tree.
[0110] Combination Figure 4First, construct the root node. If Shanghai is ranked first according to the entity sorting result, add "Shanghai" to the leaf node child0 of the multi-way tree and store Shanghai and its interval [1,2] in this node. Next, read the next entity "Hainan" with its interval [2,3], which overlaps with the interval of "Shanghai". Then, add a child node child1 to the parent node and add "Hainan" to the leaf node child1, storing Hainan and its interval in this node. After that, read the next entity "Beijing" with its interval [4,5], which does not overlap with the intervals of "Shanghai" and "Hainan". Then, add a child node child2 to both the leaf nodes child0 and child1, storing Beijing and its interval in the leaf node child2. After that, read the next entity "Sichuan" with its interval [6,7], which does not overlap with the intervals of "Shanghai", "Hainan", and "Beijing". Then, add a child node child3 to both the leaf nodes child0 and child1. Continue reading all entities in this way. Finally, the traversal path from the root node to all leaf nodes is returned, and each path represents a set of final slot information. For example, the path child0→child2→child3 represents the slot information for the combination of Shanghai, Beijing, and Sichuan; the path child1→child2→child3 represents the slot information for the combination of Hainan, Beijing, and Sichuan.
[0111] If there is an overlapping range in the slot results, the current slot range of the multi-way tree is widened, that is, a new child node is added to the parent node (such as adding child1); if there is no overlapping range in the slot results, the current slot range of the multi-way tree is deepened, that is, a new child node is added to the leaf node (such as adding child2).
[0112] The technical solution provided in this disclosure replaces traditional regular expressions with a prefix tree structure and the AC automaton algorithm, further improving recall by adding fuzzy matching, and effectively solving the selection and output problem of nested entities by constructing interval trees and multi-branch trees. Specifically, interval trees are used to determine whether there is overlap between slot intervals of different slot information, effectively solving the problems of slot loss and optimal non-overlapping slot combinations. Multi-branch trees store multiple possible combinations of nested slot information, efficiently outputting the permutation and combination results of slots. In complex scenarios (such as intelligent human-computer dialogue service scenarios), the tree structure can be used to fuse multiple slot information extracted by exact matching mode, fuzzy matching mode, and sequence labeling mode, thereby obtaining the optimal slot combination and efficiently merging and outputting valid slot results.
[0113] In practical applications, the exact matching mode can also be combined with the fuzzy matching mode to ensure the accuracy of information extraction by setting a higher threshold.
[0114] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.
[0115] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.
[0116] Figure 5 This is a schematic diagram of a slot information extraction device provided in an embodiment of this disclosure. Figure 5 As shown, the slot information extraction device includes:
[0117] The content acquisition module 501 is configured to acquire the content to be identified and determine the slot scene category corresponding to the content to be identified;
[0118] The strategy determination module 502 is configured to determine the slot information extraction strategy corresponding to the slot scene category. The slot information extraction strategy is one or a combination of exact matching mode or fuzzy matching mode, or a combination of sequence labeling mode and exact matching mode, or a combination of sequence labeling mode and fuzzy matching mode, or a combination of sequence labeling mode, exact matching mode and fuzzy matching mode.
[0119] The information extraction module 503 is configured to extract slot information corresponding to the slot scene category from the content to be identified based on the slot information extraction strategy, and output the slot information.
[0120] In some embodiments, the strategy determination module 502 includes:
[0121] The slot acquisition unit is configured to acquire at least one semantic slot corresponding to the slot scene category;
[0122] The type determination unit is configured to determine the slot type of each semantic slot, which can be any one of a precise slot, a fuzzy slot, or a generic slot.
[0123] The first determining unit is configured such that if the slot type of each semantic slot corresponding to the slot scene category is an exact slot, then the slot information extraction strategy corresponding to the slot scene category is the exact matching mode.
[0124] The second determining unit is configured such that if the slot type of each semantic slot corresponding to the slot scene category is a fuzzy slot, then the slot information extraction strategy corresponding to the slot scene category is a fuzzy matching mode.
[0125] The third determining unit is configured such that if the slot type of the semantic slot corresponding to the slot scene category includes precise slots and fuzzy slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of precise matching mode and fuzzy matching mode.
[0126] The fourth determining unit is configured such that if the slot type of the semantic slot corresponding to the slot scene category includes general slots and precise slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode and precise matching mode.
[0127] The fifth determining unit is configured such that if the slot type of the semantic slot corresponding to the slot scene category includes general slots and fuzzy slots, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode and fuzzy matching mode.
[0128] The sixth determining unit is configured such that if the slot type of the semantic slot corresponding to the slot scene category includes general slot, precise slot and fuzzy slot, then the slot information extraction strategy corresponding to the slot scene category is a combination of sequence labeling mode, precise matching mode and fuzzy matching mode.
[0129] In some embodiments, the type determination unit described above may be specifically configured as follows:
[0130] Obtain response performance parameter values, the application domain corresponding to the semantic slot, and the pattern matching requirements corresponding to the semantic slot;
[0131] Based on the response performance parameter values, application domain, and pattern matching requirements, determine the slot type corresponding to each semantic slot.
[0132] In some embodiments, the slot information extraction strategy is an exact matching mode. The information extraction module 503 includes:
[0133] The matching unit is configured to perform multi-modal string matching on the content to be identified based on the AC automaton algorithm and a preset prefix tree to obtain the first character sequence that is successfully matched.
[0134] The output unit is configured to determine the first slot information corresponding to each precise slot of the slot scene category based on the first character sequence, and output the first slot information.
[0135] In some embodiments, the above-mentioned output unit may be specifically configured as follows:
[0136] Determine whether there is any overlap in the slot intervals between the first slot information of the precise slot;
[0137] If there is an overlap between the slot intervals of the first slot information, an interval tree is constructed, and the first slot information is filtered based on the interval tree to obtain the second slot information, and the second slot information is output.
[0138] In some embodiments, the slot information extraction strategy is a fuzzy matching mode. The information extraction module 503 includes:
[0139] The first search unit is configured to find the longest consecutive matching string in the content to be identified that matches the keywords stored in the preset trie.
[0140] The second search unit is configured to find non-continuous matching strings in the content to be identified that do not match the keywords stored in the trie.
[0141] The first calculation unit is configured to calculate the first similarity between the longest consecutive matching string and the content to be identified;
[0142] The second calculation unit is configured to calculate the second similarity between the non-continuous matching string and the content to be identified;
[0143] The determining unit is configured to determine the third slot information corresponding to each fuzzy slot based on the first similarity and the second similarity.
[0144] In some embodiments, a non-continuous matching string consists of multiple non-continuous matching substrings, and the maximum character interval between the multiple non-continuous matching substrings is 1.
[0145] In some embodiments, the slot information extraction strategy is a combination of sequence labeling mode, exact matching mode, and fuzzy matching mode. Information extraction module 503 includes:
[0146] The first extraction unit is configured to extract precise slot information corresponding to precise slots from the content to be identified based on the precise matching mode.
[0147] The second extraction unit is configured to extract fuzzy slot information corresponding to the fuzzy slot from the content to be identified based on the fuzzy matching mode.
[0148] The third extraction unit is configured to extract the general slot information corresponding to the general slot from the content to be identified based on the sequence labeling mode;
[0149] The information output unit is configured to output precise slots and their corresponding precise slot information, fuzzy slot information corresponding to fuzzy slots, and general slots and their corresponding general slot information.
[0150] In some embodiments, the information output unit described above may be specifically configured as follows:
[0151] Determine whether there is any overlap in the slot intervals between precise slot information, fuzzy slot information, and general slot information;
[0152] If there is an overlap between the slot intervals of precise slot information, fuzzy slot information, and general slot information, a multi-branch tree is constructed and the precise slot information, fuzzy slot information, and general slot information are filtered based on the multi-branch tree to obtain the final slot information corresponding to the slot scene category, and the final slot information is output.
[0153] In some embodiments, a multi-branch tree is constructed and the precise slot information, fuzzy slot information, and general slot information are filtered based on the multi-branch tree to obtain the final slot information corresponding to the slot scene category, including:
[0154] The precise slot information, fuzzy slot information, and general slot information are divided into one target slot information and multiple other slot information;
[0155] Construct the root node of the multi-way tree and add the target slot information to the multi-way tree;
[0156] Read information from another slot one by one, compare the slot range of the currently read other slot information with the node range of the leaf node of the multi-way tree, and get the comparison result;
[0157] If the comparison result shows that there is an intersection between the slot interval and the node interval, then add a child node to the parent node of the leaf node to widen the current slot interval of the multi-way tree.
[0158] If the comparison result shows that there is no intersection between the slot interval and the node interval, then add a child node at the leaf node to deepen the current slot interval of the multi-way tree;
[0159] Returns the traversal path from the root node to all leaf nodes of the multi-way tree, and outputs the final combination slot information corresponding to the traversal path.
[0160] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.
[0161] Figure 6 This is a schematic diagram of the electronic device 6 provided in an embodiment of this disclosure. Figure 6 As shown, the electronic device 6 of this embodiment includes a processor 601, a memory 602, and a computer program 603 stored in the memory 602 and executable on the processor 601. When the processor 601 executes the computer program 603, it implements the steps in the various method embodiments described above. Alternatively, when the processor 601 executes the computer program 603, it implements the functions of each module / unit in the various device embodiments described above.
[0162] Electronic device 6 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 6 may include, but is not limited to, processor 601 and memory 602. Those skilled in the art will understand that... Figure 6 This is merely an example of electronic device 6 and does not constitute a limitation on electronic device 6. It may include more or fewer components than shown, or different components.
[0163] The processor 601 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0164] The memory 602 can be an internal storage unit of the electronic device 6, such as a hard disk or RAM of the electronic device 6. The memory 602 can also be an external storage device of the electronic device 6, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 6. The memory 602 can also include both internal and external storage units of the electronic device 6. The memory 602 is used to store computer programs and other programs and data required by the electronic device.
[0165] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0166] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0167] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be included within the protection scope of this disclosure.
Claims
1. A slot information extraction method, characterized by, The method comprises the following steps: acquiring to-be-recognized content, and determining a slot scene category corresponding to the to-be-recognized content; determining a slot information extraction strategy corresponding to the slot scene category, the slot information extraction strategy being one of an exact matching mode or a fuzzy matching mode or a combination thereof, or being a combination of a sequence labeling mode and the exact matching mode, or being a combination of the sequence labeling mode and the fuzzy matching mode, or being a combination of the sequence labeling mode, the exact matching mode and the fuzzy matching mode; extracting slot information corresponding to the slot scene category from the to-be-recognized content based on the slot information extraction strategy, and outputting the slot information; determining a slot information extraction strategy corresponding to the slot scene category comprises: acquiring at least one semantic slot corresponding to the slot scene category; determining a slot type of each semantic slot, the slot type being any one of an exact slot, a fuzzy slot or a general slot; if the slot types of the semantic slots corresponding to the slot scene category include the general slot, the exact slot and the fuzzy slot, the slot information extraction strategy corresponding to the slot scene category is a combination of the sequence labeling mode, the exact matching mode and the fuzzy matching mode; extracting slot information corresponding to the slot scene category from the to-be-recognized content based on the slot information extraction strategy, and outputting the slot information comprises: extracting exact slot information corresponding to the exact slot from the to-be-recognized content based on the exact matching mode; extracting fuzzy slot information corresponding to the fuzzy slot from the to-be-recognized content based on the fuzzy matching mode; extracting general slot information corresponding to the general slot from the to-be-recognized content based on the sequence labeling mode; judging whether there is an overlap between slot intervals of the exact slot information, the fuzzy slot information and the general slot information; if there is an overlap between the slot intervals of the exact slot information, the fuzzy slot information and the general slot information, constructing a multi-ary tree and filtering the exact slot information, the fuzzy slot information and the general slot information based on the multi-ary tree to obtain final slot information corresponding to the slot scene category, and outputting the final slot information.
2. The method of claim 1, wherein, After determining the slot type of each semantic slot, the method further comprises: if the slot types of each semantic slot corresponding to the slot scene category are all exact slots, the slot information extraction strategy corresponding to the slot scene category is the exact matching mode; if the slot types of each semantic slot corresponding to the slot scene category are all fuzzy slots, the slot information extraction strategy corresponding to the slot scene category is the fuzzy matching mode; if the slot types of the semantic slots corresponding to the slot scene category include the exact slot and the fuzzy slot, the slot information extraction strategy corresponding to the slot scene category is a combination of the exact matching mode and the fuzzy matching mode; if the slot types of the semantic slots corresponding to the slot scene category include the general slot and the exact slot, the slot information extraction strategy corresponding to the slot scene category is a combination of the sequence labeling mode and the exact matching mode; If the slot type of the semantic slot corresponding to the slot scene category includes a general slot and a fuzzy slot, the slot information extraction strategy corresponding to the slot scene category is a combination of a sequence labeling mode and a fuzzy matching mode.
3. The method of claim 2, wherein, The slot type of each semantic slot is determined, including: Obtaining a response performance parameter value, an application field corresponding to the semantic slot, and a pattern matching requirement corresponding to the semantic slot; According to the response performance parameter value, the application field and the pattern matching requirement, the slot type corresponding to each semantic slot is determined.
4. The method of claim 2, wherein, The slot information extraction strategy is an accurate matching mode; Based on the slot information extraction strategy, the slot information corresponding to the slot scene category is extracted from the to-be-identified content, and the slot information is output, including: Based on the AC automatic machine algorithm and the preset prefix tree, multi-mode string matching is performed on the to-be-identified content to obtain a first character sequence that matches successfully; According to the first character sequence, the first slot information corresponding to each accurate slot of the slot scene category is determined, and the first slot information is output.
5. The method of claim 4, wherein, According to the first character sequence, the first slot information corresponding to the accurate slot is determined, and the first slot information is output, including: Determine whether there is an overlap between the slot intervals of the first slot information of the accurate slot; If there is an overlap between the slot intervals of the first slot information, construct an interval tree, filter the first slot information based on the interval tree, obtain second slot information, and output the second slot information.
6. The method of claim 2, wherein, The slot information extraction strategy is a fuzzy matching mode; Based on the slot information extraction strategy, the slot information corresponding to the slot scene category is extracted from the to-be-identified content, and the slot information is output, including: Find the longest continuous matching string in the to-be-identified content that continuously matches the keywords stored in the preset dictionary tree; Find the non-continuous matching string in the to-be-identified content that non-continuously matches the keywords stored in the dictionary tree; Calculate the first similarity between the longest continuous matching string and the to-be-identified content; Calculate the second similarity between the non-continuous matching string and the to-be-identified content; According to the first similarity and the second similarity, the third slot information corresponding to each fuzzy slot is determined.
7. The method of claim 6, wherein, The non-continuous matching string is composed of a plurality of non-continuous matching substrings, and the maximum character interval between the plurality of non-continuous matching substrings is 1.
8. The method of claim 1, wherein, Construct a multi-way tree and filter the accurate slot information, fuzzy slot information and general slot information based on the multi-way tree to obtain the final slot information corresponding to the slot scene category, including: Divide the accurate slot information, fuzzy slot information and general slot information into a target slot information and a plurality of other slot information; Construct a root node of a multi-way tree, and add the target slot information to the multi-way tree; Read one of the other slot information in turn, compare the slot interval of the other slot information currently read with the node interval of the leaf node of the multi-way tree to obtain a comparison result; If the comparison result is that the slot interval and the node interval have intersection, a child node is added to a parent node of the leaf node to widen a current slot interval of the multi-way tree; If the comparison result is that the slot interval and the node interval have no intersection, a child node is added to the leaf node to deepen the current slot interval of the multi-way tree; An iteration path of the root node to all leaf nodes of the multi-way tree is returned, and final combined slot information corresponding to the iteration path is output.
9. A slot information extracting apparatus characterized by comprising: The device is used to implement the method in any one of claims 1-8, and the device comprises: a content acquisition module configured to acquire to-be-identified content, and determine a slot scene category corresponding to the to-be-identified content; a strategy determination module configured to determine a slot information extraction strategy corresponding to the slot scene category, the slot information extraction strategy being one or a combination of an accurate matching mode or a fuzzy matching mode, or being a combination of a sequence labeling mode and the accurate matching mode, or being a combination of the sequence labeling mode and the fuzzy matching mode, or being a combination of the sequence labeling mode, the accurate matching mode and the fuzzy matching mode; an information extraction module configured to extract, based on the slot information extraction strategy, slot information corresponding to the slot scene category from the to-be-identified content, and output the slot information.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor implements the steps of the method in any one of claims 1-8 when executing the computer program.
11. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: The computer program, when executed by the processor, implements the steps of the method in any one of claims 1-8.
Citation Information
Patent Citations
Data processing method, device and equipment and storage medium
CN111611793A