A data query method, device, apparatus and storage medium

CN117668152BActive Publication Date: 2026-08-18HISENSE GRP HLDG CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211058102.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-08-18
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

[0002]在进行数据库查询时,现有技术大都仅利用意图和槽位信息从数据库中查询目标内容并返回查询结果,因此现有算法一般仅进行意图和槽位信息的联合训练

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117668152B_ABST
    Figure CN117668152B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of natural language processing, and in particular to a data query method and device, equipment and a storage medium, which comprise the following steps: obtaining target text to be recognized, recognizing an intention type of the target text, and extracting slot information contained in the target text; the slot information is combined two by two to obtain at least one slot information group; whether there is a preset semantic association relationship between the slot information in each slot information group is determined to determine a slot information relationship corresponding to the target text; data is queried based on the intention type, the slot information and the slot information relationship, and a query result corresponding to the target text is obtained; and the application can obtain more accurate results by jointly querying data based on the intention type, the slot information and the slot information relationship.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a data query method, apparatus, device and storage medium. Background Technology

[0002] When performing database queries, most existing technologies only utilize intent and slot information to retrieve target content from the database and return query results. Therefore, existing algorithms generally only perform joint training on intent and slot information. However, each slot type sometimes corresponds to more than one slot information. For example, for the target text "What are the GDP growth rate and per capita income of City B?", the slot information corresponding to the slot type "Indicator" is "GDP" and "Per Capita Income". When querying the database based solely on intent and slot information, it may result in the inability to extract the correct slot information, leading to the extraction of the wrong answer.

[0003] Furthermore, for example, if the target text is "What are the GDP growth rate and per capita income of City B in Province A?", the corresponding intent type is "questioning indicators." The target text includes the intent type "[questioning GDP growth rate and per capita income]" and the slot information "[Province A]" and "[City B]". When querying the database based on the intent type "[questioning GDP growth rate and per capita income]" and the slot information "[Province A]" and "[City B]", and the relationship between the slot information is uncertain, without refining the intent type for differentiation, it may result in query results corresponding to "GDP growth rate and per capita income of City B", "GDP growth rate and per capita income of Province A", and "GDP growth rate and per capita income of both Province A and City B", leading to redundant and ambiguous query results. Summary of the Invention

[0004] This application provides a data query method, apparatus, and device to at least solve the problems of incorrect and redundant answer extraction that occur when querying a database based solely on intent and slot information in related technologies.

[0005] Firstly, this application provides a data query method, the method comprising:

[0006] Obtain the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text;

[0007] The slot information is combined in pairs to obtain at least one slot information group;

[0008] Based on whether there is a preset semantic relationship between the slot information in each slot information group, the slot information relationship corresponding to the target text is determined.

[0009] Based on the intent type, the slot information, and the relationship between the slot information, a data query is performed to obtain the query results corresponding to the target text.

[0010] The preset semantic association relationship is determined based on a trained semantic understanding model, which is trained by the relationship between the sample text and the slot information corresponding to the sample text.

[0011] In the above implementation, the extracted slot information is combined in pairs to determine whether there is a preset semantic relationship between each pair of slot information groups. The preset semantic relationship is determined based on a trained semantic understanding model, which is trained by the sample text and the slot information relationship corresponding to the sample text.

[0012] In the prior art, data query is performed based solely on intent type and slot information. For example, if target text 1 and target text 2 have the same intent type and extracted slot information, the same data will be retrieved if the intent type is not distinguished. However, the present application embodiment uses intent type, slot information, and the relationship between slot information to perform data query, which can avoid the above problem and make the query results more accurate.

[0013] In one possible implementation, the semantic understanding model is trained in the following manner:

[0014] Obtain multiple sample texts;

[0015] Select sample text as input to the semantic understanding model to be trained. Based on the semantic understanding model, identify the sample intent type of the sample text, extract the information of each sample slot contained in the sample text, and the relationship between the sample slot information corresponding to the sample text.

[0016] A cross-entropy loss function is constructed based on the sample intent type, the sample slot information, and the relationship between the sample slot information, respectively.

[0017] The semantic understanding model is then adjusted using a target loss function determined based on the constructed cross-loss functions.

[0018] In the above implementation, in order to extract the slot information relationship of the target text, a target loss function is required based on the constructed intent type cross loss function, sample slot information cross entropy loss function, and sample slot information relationship cross entropy loss function.

[0019] In one possible implementation, the cross-entropy loss function corresponding to the sample slot information relationship is constructed as follows:

[0020] A first weighting coefficient is determined based on the number of sample slot information contained in the sample text; wherein, the first weighting coefficient is positively correlated with the number of sample slot information contained in the sample text.

[0021] The second weighting coefficient is determined based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type.

[0022] Based on the first weight coefficient, the second weight coefficient, and the sample slot information relationship, a cross-entropy loss function corresponding to the sample slot information relationship is constructed.

[0023] In the above implementation, the difficulty of extracting slot information relationships gradually increases with the increase of the number of slot information. Therefore, a first weight coefficient is set for it. Similarly, when there is a large amount of slot information of the same type, the slot relationship is difficult to extract. Therefore, a second weight coefficient is set for it.

[0024] In one possible implementation, determining the second weighting coefficient based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type includes:

[0025] Obtain at least one preset key slot type;

[0026] Determine the first number of sample slot information corresponding to each key slot type in the sample text, and the second number of sample slot information corresponding to each non-key slot information.

[0027] The second weighting coefficient is determined based on each first quantity and each second quantity.

[0028] In one possible implementation, determining the second weighting coefficient based on each first quantity and each second quantity includes:

[0029] If the sum of all the second quantities is equal to the first preset quantity, then the second weighting coefficient is determined to be β, where β is a preset value;

[0030] If the sum of the second quantities is not equal to the first preset quantity, then based on the first quantities and the quantitative relationship between the first quantities and the corresponding second quantities, the unbalance coefficient corresponding to the preset slot imbalance condition is determined, and the second weight coefficient is determined based on the unbalance coefficient.

[0031] In one possible implementation, the slot imbalance condition includes at least one;

[0032] The step of determining the second weighting coefficient of the loss function based on the unbalanced coefficient includes:

[0033] Determine the sum of the unbalance coefficients c corresponding to each of the aforementioned slot unbalance conditions;

[0034] Based on the sum of the unbalanced coefficients c, the second weighting coefficient is determined to be a-β. c , where 'a' is a preset value.

[0035] In one possible implementation, the slot imbalance condition includes at least one; then, based on the quantitative relationship between each first quantity and the corresponding second quantity, the unbalance coefficient when the preset slot imbalance condition is met is determined, including at least one of the following:

[0036] If each of the first quantities is a second preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient.

[0037] If the sum of the first quantities is greater than the third preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient; the third preset quantity is greater than the second preset quantity.

[0038] The ratios of each second quantity to the corresponding first quantity are determined respectively. If there is at least one target ratio among the ratios, it is determined that a slot imbalance condition is satisfied, and the product of the number of the target ratios and the second preset coefficient is used as the imbalance coefficient; wherein the target ratio is greater than the preset ratio.

[0039] Secondly, this application provides a data query device, the device comprising:

[0040] The identification and extraction module is used to acquire the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text;

[0041] The combination module is used to combine the slot information in pairs to obtain at least one slot information group.

[0042] The determination module is used to determine the slot information relationship corresponding to the target text based on whether there is a preset semantic relationship between the slot information in each slot information group.

[0043] The query module is used to perform data queries based on the intent type, the slot information, and the relationship between the slot information to obtain the query results corresponding to the target text.

[0044] The preset semantic association relationship is determined based on a trained semantic understanding model, which is trained by the relationship between the sample text and the slot information corresponding to the sample text.

[0045] Thirdly, this application provides a data query device, the device comprising:

[0046] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the first aspect described above.

[0047] Fourthly, this application provides a computer storage medium storing a computer program for causing a computer to perform the method described in the first aspect above.

[0048] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings. Attached Figure Description

[0049] Figure 1 This is a schematic diagram illustrating an application scenario of the first data query method provided in the embodiments of this application;

[0050] Figure 2 This is a schematic diagram illustrating an application scenario of the second data query method provided in the embodiments of this application;

[0051] Figure 3 This is a schematic diagram illustrating an application scenario for the third data query method provided in the embodiments of this application;

[0052] Figure 4 A schematic diagram of a terminal provided in an embodiment of this application;

[0053] Figure 5 This is a schematic diagram of the overall process of a data query method provided in an embodiment of this application;

[0054] Figure 6 This application provides a schematic diagram of the overall process for training a semantic understanding model.

[0055] Figure 7 This is a schematic diagram of the relationship between the target text slot information of the first type of sample provided in the embodiments of this application;

[0056] Figure 8 This is a schematic diagram illustrating the relationship between the target text slot information of the second type of sample provided in this application embodiment;

[0057] Figure 9 This is a schematic diagram illustrating the relationship between the target text slot information of the third type of sample provided in this application embodiment;

[0058] Figure 10 This is a schematic diagram illustrating the relationship between the target text slot information of the fourth type of sample provided in this application embodiment;

[0059] Figure 11 This is a schematic diagram of the first type of sample target text annotation provided in the embodiments of this application;

[0060] Figure 12 This is a schematic diagram of the second type of sample target text annotation provided in the embodiments of this application;

[0061] Figure 13 This is a schematic diagram illustrating the third type of sample target text annotation provided in the embodiments of this application;

[0062] Figure 14 This is a schematic diagram illustrating the fourth type of sample target text annotation provided in the embodiments of this application;

[0063] Figure 15 This is a schematic diagram of a semantic training model structure provided in an embodiment of this application;

[0064] Figure 16 This is a schematic diagram of an overall process for determining a second weighting coefficient, provided in an embodiment of this application.

[0065] Figure 17 This application provides a schematic diagram of the overall process for determining the second weighting coefficient based on the imbalance condition in an embodiment of the present application.

[0066] Figure 18 This is a schematic diagram illustrating the application of a semantic understanding model provided in an embodiment of this application;

[0067] Figure 19 A schematic diagram of a data query device provided in an embodiment of this application;

[0068] Figure 20 A diagram of a data query device provided in an embodiment of this application. Detailed Implementation

[0069] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. Unless otherwise specified, the embodiments and features in the embodiments of this application can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.

[0070] The terms "first" and "second" in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses. The term "multiple" in this application can mean at least two, for example, two, three, or more, and is not limited by the embodiments of this application.

[0071] The following describes some of the concepts involved in the embodiments of this application:

[0072] Intent: Intent is used to indicate the ultimate purpose that the target text to be identified wants to achieve. Each target text uniquely corresponds to one intent.

[0073] Intent type: This refers to the type of purpose that the target text to be identified wants to achieve. For example, the intent type corresponding to the target text "What are the GDP growth rate and per capita income of City B in Province A?" is "ask about indicators".

[0074] Slot information: A slot refers to the key information that the system needs to collect from the user. Slot information is the specific key information expressed by the user. For example, the target text "What are the GDP growth rate and per capita income of City B?" includes the slot information as [City B], [GDP], [growth rate], and [per capita income].

[0075] Semantic relevance: Semantic relevance is an inherent characteristic of sentence coherence. That is to say, if the words in a coherent sentence have semantic relevance, then there must be a semantic relationship between the words. Semantic relevance can include: subordinate relationship, parallel relationship, modification relationship, etc.

[0076] Slot information relationship: This is determined based on the semantic association between slot information in the text, representing whether there is a connection between two slot information under the corresponding intent type. In the embodiments of this application, if the semantic association between two slot information is a subordinate relationship, for example, when the intent is "ask about indicators" and the indicator is [GDP], [GDP of City B in Province A] refers to the GDP of City B in Province A, then it indicates that there is a slot information relationship between [Province A] and [City B]. If the two slot information is a parallel relationship, for example, [GDP of Province A and City B] refers to the GDP of Province A and the GDP of City B, then it indicates that there is no slot information relationship between [Province A] and [City B]. If the two slot information is a modifying relationship, for example, [GDP of City B], then it indicates that there is a slot information relationship between [City B] and [GDP].

[0077] The preferred embodiments of this application are described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit this application. Furthermore, the embodiments and features in the embodiments of this application can be combined with each other without conflict.

[0078] like Figure 1 The diagram illustrates an application scenario of a data query method provided in this application embodiment. This application scenario includes: a data query device 101 (which may be a server and / or terminal), a database 102, and at least one target text to be identified. Figure 1 The example targets text 103_1, 103_2, and 103_N. For each target text, intent type, slot information, and slot information relationships are extracted. This allows the data query device 101 to use the intent type, slot information, and slot information relationships to query data matching the target text in the database 102. Additionally, the database 102 may also store the data and programs required by the server 101 to execute the data query method; alternatively, the database 202 may be used only for data querying, while the database 204 may be used to store the data and programs required by the data query device 201 to execute the data query method. Figure 2 As shown; or, multiple databases can be set up for data retrieval, such as Figure 3 At least one database 302_1, 302_2, 302_N is shown, and database 304 is used to store the data and programs required by the data query device 301 to execute the data query method.

[0079] The following description uses a data query device, terminal 10, as an example to illustrate the embodiment. It should be understood that... Figure 4 This is a schematic diagram of the structure of a terminal in an embodiment of this application. Figure 4 The terminal 10 shown is merely an example, and terminal 10 can have more than Figure 4 The more or fewer components shown can be combined into two or more components, or they can have different component configurations. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0080] Figure 4 The diagram illustrates a hardware configuration block diagram of terminal 10 according to an exemplary embodiment. Figure 4As shown, terminal 10 includes components such as radio frequency (RF) circuit 110, memory 120, display unit 130, camera 140, sensor 150, audio circuit 160, wireless Fidelity (Wi-Fi) module 170, processor 180, Bluetooth module 181, and power supply 180.

[0081] RF circuit 110 can be used to receive and transmit signals during information transmission or calls. It can receive downlink data from the base station and hand it over to processor 180 for processing; it can also send uplink data to the base station. Typically, RF circuits include, but are not limited to, devices such as antennas, at least one amplifier, transceivers, couplers, low-noise amplifiers, and duplexers.

[0082] The memory 120 can be used to store software programs and data. The processor 180 executes various functions of the terminal 10 and performs data processing by running the software programs or data stored in the memory 120. The memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. The memory 120 stores an operating system that enables the terminal 10 to run. In this application, the memory 120 may store the operating system and various applications, and may also store code that executes the methods described in the embodiments of this application.

[0083] The display unit 130 can be used to receive input digital or character information and generate signal inputs related to user settings and function control of the terminal 10. Specifically, the display unit 130 may include a touch screen 131 disposed on the front of the terminal 10, which can collect touch operations of the user on or near it, such as clicking a button, dragging a scroll box, etc.

[0084] The display unit 130 can also be used to display information input by the user or information provided to the user, as well as various menus of the terminal 10, forming a graphical user interface (GUI). Specifically, the display unit 130 may include a display screen 132 disposed on the front of the terminal 10. The display screen 132 may be configured as a liquid crystal display, a light-emitting diode, or the like. The display unit 130 can be used to display the various graphical user interfaces described in this application.

[0085] The touchscreen 131 can be placed over the display screen 132, or the touchscreen 131 and the display screen 132 can be integrated to realize the input and output functions of the terminal 10. After integration, it can be referred to as a touch display screen. In this application, the display unit 130 can display the application and the corresponding operation steps.

[0086] Camera 140 can be used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to processor 180 to be converted into a digital image signal.

[0087] Terminal 10 may also include at least one sensor 150, such as an accelerometer 151, a proximity sensor 152, a fingerprint sensor 153, and a temperature sensor 154. Terminal 10 may also be equipped with other sensors such as a gyroscope, barometer, hygrometer, thermometer, infrared sensor, light sensor, and motion sensor.

[0088] Audio circuit 160, speaker 161, and microphone 162 provide an audio interface between the user and terminal 10. Audio circuit 160 converts received audio data into electrical signals and transmits them to speaker 161, where speaker 161 converts them into sound signals for output. Terminal 10 can also be equipped with volume buttons for adjusting the volume of the sound signal. On the other hand, microphone 162 converts collected sound signals into electrical signals, which are then received by audio circuit 160, converted into audio data, and output to RF circuit 110 for transmission to, for example, another terminal, or to memory 120 for further processing. In this application, microphone 162 can acquire the user's voice.

[0089] Wi-Fi is a short-range wireless transmission technology. Terminal 10 can use Wi-Fi module 170 to help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access.

[0090] The processor 180 is the control center of the terminal 10, connecting various parts of the terminal through various interfaces and lines. It executes various functions and processes data by running or executing software programs stored in the memory 120 and calling data stored in the memory 120. In some embodiments, the processor 180 may include one or more processing units; the processor 180 may also integrate an application processor and a baseband processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the baseband processor mainly handles wireless communication. It is understood that the baseband processor may not be integrated into the processor 180. In this application, the processor 180 can run an operating system, applications, user interface display and touch response, and the processing methods described in the embodiments of this application.

[0091] Bluetooth module 181 is used to exchange information with other Bluetooth devices that also have Bluetooth modules via the Bluetooth protocol. For example, terminal 10 can establish a Bluetooth connection with a wearable terminal (such as a smartwatch) that also has a Bluetooth module through Bluetooth module 181, thereby exchanging data.

[0092] Terminal 10 also includes a power supply 180 (such as a battery) that supplies power to various components. The power supply can be logically connected to the processor 180 through a power management system, thereby enabling the management of charging, discharging, and power consumption. Terminal 10 may also be equipped with a power button for powering on and off the terminal, as well as locking the screen.

[0093] The data query method provided by the exemplary embodiments of this application will be described below with reference to the accompanying drawings and the application scenarios described above. It should be noted that the application scenarios described above are only shown to facilitate understanding of the spirit and principles of this application, and the embodiments of this application are not limited in any way in this respect.

[0094] To address the issue of low accuracy in existing technologies that rely solely on intent type and slot information for data querying, this application provides a data query method, such as... Figure 5 As shown, the method includes:

[0095] S501: Obtain the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text.

[0096] The data query method provided in this application embodiment is based on intent type, slot information, and slot information relationship. Before extracting the slot information relationship, it is first necessary to identify the intent type of the target text and extract the corresponding slot information in the target text based on the intent type.

[0097] S502: Combine the slot information in pairs to obtain at least one slot information group.

[0098] After extracting the slot information from the target text to be identified, the slot information is combined in pairs. For example, for the target text "What are the GDP growth rates of City B and Province A?", the slot information is first extracted to obtain the slot information [City B], [Province A], [GDP], and [growth rate]. The above slot information is then combined in pairs to obtain six slot information groups: [City B and Province A], [City B GDP], [City B growth rate], [Province A GDP], [Province A growth rate], and [GDP growth rate]. Depending on the slot information extraction method, different slot information may be obtained, and the slot information groups will also be different.

[0099] In one possible implementation, each slot information is numbered. The numbering method can be based on the order of the slot information in the target text to be identified, and this application embodiment does not make specific limitations. For example, according to the order of each slot information in "What are the GDP growth rates of City B and Province A", the slot information is numbered as follows: [City B] corresponds to number 1, [Province A] corresponds to number 2, [GDP] corresponds to number 3, and [growth rate] corresponds to number 4. Then, the numbers corresponding to each slot information are combined in pairs to obtain the slot information group number 12 for [City B and Province A], the slot information group number 13 for [City B GDP], the slot information group number 14 for [City B growth rate], the slot information group number 23 for [Province A GDP], the slot information group number 24 for [Province A growth rate], and the slot information group number 34 for [GDP growth rate].

[0100] S503: Determine the slot information relationship corresponding to the target text based on whether there is a preset semantic relationship between the slot information in each slot information group.

[0101] The preset semantic association relationship is determined based on a trained semantic understanding model, which is trained by the relationship between the sample text and the slot information corresponding to the sample text.

[0102] Before training the semantic understanding model, it is first necessary to obtain the sample texts used for training, along with the corresponding intent types, slot information, and slot relationships, such as... Figure 6 As shown, it includes 3 steps.

[0103] Step 1: Determine the intent type, slot information, and relationships between slot information in the sample text.

[0104] First, the intent type needs to be set. The corresponding intent types are different in different application fields. The intent type set in this application embodiment is "ask for indicator". In addition, the "ask for indicator" type can be further subdivided into: "ask for location indicator" such as "GDP of City B", "ask for multiple location indicator" such as "GDP of Province A and City B", "ask for multiple indicators" such as "ask for GDP and per capita income", "ask for indicator status" such as "GDP status", etc. The specific distinction can be made according to the actual situation, and no specific limitation is made here.

[0105] Set corresponding slots based on the intent type of "ask for indicators," such as [Location], [Indicator], and [Status]. [Location] can be divided into [Province], [City], and [District]; [Indicator] can be divided into [GDP] and [Per Capita Income]; and [Status] can be [Growth Rate].

[0106] The above implementation method yields the following four sample texts:

[0107] (1) What are the GDP growth rates of City B and Province A?

[0108] The sample text (1) includes an intent type of "asking about the status of location indicators", and its slot information includes: [Province A], [City B], [GDP], [Growth Rate], and the relationship between the slot information is as follows: Figure 7 As shown.

[0109] pass Figure 7 It can be seen that the slot information [Province A] and [City B] are semantically related to [GDP], and the slot information [GDP] is semantically related to [growth rate].

[0110] (2) What is the GDP growth rate of City B in Province A?

[0111] The sample text (1) includes an intent type of "asking about the status of location indicators", and its slot information includes: [Province A], [City B], [GDP], [Growth Rate], and the relationship between the slot information is as follows: Figure 8 As shown.

[0112] pass Figure 8 It can be seen that there is a semantic relationship between the slot information [Province A] and [City B], a semantic relationship between the slot information [City B] and [GDP], and a semantic relationship between the slot information [GDP] and [growth rate].

[0113] As can be seen from the above intent recognition and slot information extraction, the intent type and slot information in sample text (1) and sample text (2) are the same. If the relationship between slot information is not distinguished, the same query results may be obtained by querying data through sample text (1) and sample text (2) based solely on intent type and slot information.

[0114] Furthermore, without knowing the relationship between slot information, a new intent needs to be added to differentiate them. Therefore, the intent type of sample text (1) is "ask about the status of multiple location indicators".

[0115] (3) What are the GDP growth rate and per capita income of City B?

[0116] The intent type included in the sample text (1) is "asking about the status of location indicators", and its slot information includes: [City B], [GDP], [growth rate], [per capita income], and the relationship of the slot information is as follows: Figure 9 As shown.

[0117] pass Figure 9It can be seen that there is a semantic relationship between the slot information [City B] and [GDP] and [per capita income], and there is a semantic relationship between the slot information [GDP] and [growth rate].

[0118] (4) What are the GDP and per capita income growth rates of City B?

[0119] The intent type included in the sample text (1) is "asking about the status of location indicators", and its slot information includes: [City B], [GDP], [growth rate], [per capita income], and the relationship of the slot information is as follows: Figure 10 As shown.

[0120] pass Figure 10 It can be seen that the slot information [City B] and [GDP] are semantically related to [per capita income], and the slot information [per capita income] and [GDP] are semantically related to [growth rate].

[0121] As can be seen from the above intent recognition and slot information extraction, the intent type and slot information in sample text (3) and sample text (4) are the same. If the relationship of slot information is not distinguished, the same query results may be obtained by querying data through sample text (3) and sample text (4) based solely on intent type and slot information.

[0122] Moreover, without knowing the relationship between slot information, it is necessary to add a new intent to distinguish them. Thus, the intent type of sample text (3) is "ask about the status of location indicators", and the intent type of sample text (4) is "ask about the status of multiple location indicators".

[0123] Step 2: Obtain the sample text and label each sample text with the sample intent type, sample slot information, and sample slot information relationship.

[0124] To distinguish between target text and sample text, the following description of text sample annotation utilizes sample intent type, sample slot information, sample slot information relationship, and alternative sample slot information relationship grouping intent type, slot information, and slot information relationship.

[0125] After collecting the sample text, it needs to be formatted into a training format. The annotation includes the sample intent type, sample slot information, and the relationship between sample slot information. The sample intent type annotation is placed at the first position of the output, and the length of the sample slot information annotation is the length of the input sentence, that is, each word in the sentence is annotated. For example, for the sample text "What is the GDP growth rate and per capita income of City B?", if "GDP" is counted as 3 characters, the length of the sample text is 16; if "GDP" is counted as 3 characters, the length of the sample text is 14. The specific length can be determined according to the actual training situation.

[0126] The relationship labeling of sample slot information can be done according to the order of the sample slot information in the sample text. For example, if there are four slots, they can be labeled in the following order: slot 1 slot 2, slot 1 slot 3, slot 1 slot 4, slot 2 slot 3, slot 2 slot 4, and slot 3 slot 4. Among them, the semantic relationships include the relationship labels between locations, the relationship labels between locations and indicators, and the relationship labels between indicators and status. The rest are unrelated.

[0127] The following is a detailed implementation method for labeling the four sample texts in the above embodiments with sample intent type, sample slot information, and sample slot information relationships:

[0128] (1) What are the GDP growth rates of Province A and City B?

[0129] The sample text (1) is annotated with sample intent type, sample slot information, and the relationship between sample slot information, such as... Figure 11 As shown, the sample intent type of the sample text (1) is: asking about the status of the location indicator; the sample text (1) is extracted for sample slot information, and sorted according to the order of each sample slot information in the sample text (1) to obtain the sample slot information [1A Province], [2B City], [3 GDP], [4 Growth Rate], whose order is not specifically limited in this application embodiment.

[0130] The corresponding numbers of each sample slot information are combined in pairs to obtain sample slot information relationship groups 12, 13, 14, 23, 24, and 34. Based on the determination of the sample slot information relationship of sample text (1) in step 1 above, that is, the slot information groups with semantic association are numbered 13, 23, and 34, then the corresponding slot information group numbers are marked with 1, and the slot information groups with no semantic association are numbered 12, 14, and 24 are marked with 0, thus obtaining the sample slot information relationship number "010101" that can be used for training corresponding to sample text (1). In addition, the slot information groups with semantic association are numbered 13, 23, and 34 and marked with 0, and the slot information groups with no semantic association are numbered 12, 14, and 24 and marked with 1, or other symbols are used for marking. This application embodiment does not make specific limitations.

[0131] In one possible implementation, the slot information relationship group can be in the format shown in Table 1:

[0132] Table 1

[0133] Slot 1 Slot 2 Slot 3 Slot 4 Slot 1 12 13 14 Slot 2 23 24 Slot 3 34 Slot 4

[0134] The sample text (1) is formed into a format that can be used for training through steps 1 and 2.

[0135] (2) What is the GDP growth rate of City B in Province A?

[0136] The sample text (2) is annotated with sample intent type, sample slot information, and the relationship between sample slot information, such as... Figure 12 As shown, the sample type of the sample text (2) is: asking about the status of the location index; the sample text (2) is extracted for sample slot information, and sorted according to the order of each sample slot information in the sample text (2) to obtain the sample slot information [1A Province], [2B City], [3 GDP], [4 Growth Rate], whose order is not specifically limited in this application embodiment.

[0137] The corresponding numbers of each sample slot information are combined in pairs to obtain sample slot information relationship groups 12, 13, 14, 23, 24, and 34. Based on the determination of the slot information relationship of sample text (2) in step 1 above, that is, the slot information groups with semantic association are numbered 12, 23, and 34, then the corresponding slot information group numbers are marked with 1, and the slot information groups with no semantic association are numbered 13, 14, and 24 are marked with 0, thus obtaining the sample slot information relationship number "100101" that can be used for training corresponding to sample text (2). In addition, the sample slot information groups with semantic association are numbered 12, 23, and 34 and marked with 0, and the sample slot information groups with no semantic association are numbered 13, 14, and 24 and marked with 1, or other symbols are used for marking. This application embodiment does not make specific limitations.

[0138] The sample text (2) is formed into a format that can be used for training through steps 1 and 2.

[0139] (3) What are the GDP growth rate and per capita income of City B?

[0140] The sample text (3) is annotated with sample intent type, sample slot information, and the relationship between sample slot information, such as... Figure 13 As shown, the sample intent type of the sample text (3) is: asking about the status of the location indicator; the sample text (3) is extracted for sample slot information, and sorted according to the order of each sample slot information in the sample text (3) to obtain the sample slot information [1B City], [2 GDP], [3 Growth Rate], [4 Per Capita Income], whose order is not specifically limited in this application embodiment.

[0141] The corresponding numbers of each sample slot information are combined in pairs to obtain sample slot information relationship groups 12, 13, 14, 23, 24, and 34. Based on the determination of the sample slot information relationship of sample text (3) in step 1 above, that is, the sample slot information groups with semantic association are numbered 12, 14, and 23. Then, the corresponding sample slot information group numbers are marked with 1, and the sample slot information groups with no semantic association are marked with 0, resulting in the sample slot information relationship number "101100" that can be used for training corresponding to sample text (3). In addition, the sample slot information groups with semantic association are marked with 0, and the sample slot information groups with no semantic association are marked with 1, or other symbols are used for marking. This application embodiment does not make specific limitations.

[0142] The sample text (3) is formed into a format that can be used for training through steps 1 and 2.

[0143] (4) What are the GDP and per capita income growth rates of City B?

[0144] The sample text (4) is annotated with sample intent type, sample slot information, and the relationship between sample slot information, such as... Figure 14 As shown, the sample type of the sample text (4) is: asking about the status of the location index; the sample text (4) is extracted for sample slot information, and sorted according to the order of each sample slot information in the sample text (3) to obtain the sample slot information [1B City], [2 GDP], [3 per capita income], [4 growth rate], whose order is not specifically limited in this application embodiment.

[0145] The corresponding numbers of each slot information are combined in pairs to obtain sample slot information relationship groups 12, 13, 14, 23, 24, and 34. Based on the determination of the sample slot information relationship of sample text (4) in step 1 above, that is, the sample slot information groups with semantic association are numbered 12, 13, 24, and 34. Then, the corresponding sample slot information group numbers are marked with 1, and the sample slot information groups 14 and 23 without semantic association are marked with 0, thus obtaining the sample slot information relationship number "110011" that can be used for training corresponding to sample text (3). In addition, the sample slot information groups 12, 13, 24, and 34 with semantic association can be marked with 0, and the sample slot information groups 14 and 23 without semantic association can be marked with 1, or other symbols can be used for marking. This application embodiment does not make specific limitations.

[0146] The sample text (4) is formed into a format that can be used for training through steps 1 and 2.

[0147] After the sample text is labeled, the semantic understanding model can be trained, specifically as follows: Figure 6 Step 3 is shown.

[0148] Step 3: Train the semantic understanding model (BERT model).

[0149] The embodiments of this application use BERT, but other natural language processing models such as Long Short-Term Memory (LSTM) networks or other models can also be used. The specific type of semantic understanding model is not limited here.

[0150] In one possible implementation, the semantic understanding model is trained in the following manner:

[0151] Obtain multiple sample texts;

[0152] Select sample text as input to the semantic understanding model to be trained. Based on the semantic understanding model, identify the sample intent type of the sample text, extract the information of each sample slot contained in the sample text, and the relationship between the sample slot information corresponding to the sample text.

[0153] A cross-entropy loss function is constructed based on the sample intent type, the sample slot information, and the relationship between the sample slot information, respectively.

[0154] The semantic understanding model is then adjusted using a target loss function determined based on the constructed cross-loss functions.

[0155] Taking the BERT model as an example, its structure is as follows: Figure 15 As shown, the input includes the classification flag CLS, the input sample text, and the input slot information relationship groups (as shown in Table 1). h is the state of the last hidden layer, h0 is the state of the last hidden layer corresponding to the intent type, hn is the state of the last hidden layer corresponding to the slot information, n∈1…N, N is the length of the input sentence, hg is the state of the last hidden layer corresponding to the slot relationship, g∈N+1…G, GN is the number of slot information groups. For example, if there are 6 slot information groups and the sentence length is 15, then G is 21.

[0156] Intent type output y i y i =softmax(W i h0+b i ), where W i b is the weighting coefficient. i For bias terms;

[0157] Slot information output Among them W sb is the weighting coefficient. s For bias terms;

[0158] Slot information relationship output Among them W sr b is the weighting coefficient. sr For bias terms;

[0159] The target loss function is:

[0160] Where x is the input.

[0161] The loss function for existing joint training models of intent type and slot information generally uses the cross-entropy loss function. To optimize the joint training effect of intent type, slot information, and slot information relationship, the loss function for intent type and slot information will still use the cross-entropy function: CE(p,y)=CE(p t ) = -log(p t ),in Where p is a preset value.

[0162] In this embodiment, considering that the difficulty of extracting slot information relationships gradually increases with the increase of the number of slot information and that slot relationships are difficult to extract when there are many slot information, a first weight coefficient α is set for the cross-entropy function corresponding to the slot information relationship when constructing it. t And its setting of the second weighting coefficient β t Then, based on the first weight coefficient, the second weight coefficient, and the sample slot information relationship, a cross-entropy loss function -α corresponding to the sample slot information relationship is constructed. t β t log(p t ).

[0163] The determination of the first weighting coefficient α will be discussed below. t Second weighting coefficient β t The implementation method will be described.

[0164] 1. Determine the first weighting coefficient α t .

[0165] In one possible implementation, α is determined as follows: t :

[0166] A first weighting coefficient is determined based on the number of sample slot information contained in the sample text; wherein, the first weighting coefficient is positively correlated with the number of sample slot information contained in the sample text. In one possible implementation, the α is determined... t Includes at least one of the following:

[0167] When it is determined that the number of sample slot information is not greater than a first preset number, the first weighting coefficient is determined to be a first preset value.

[0168] When the number of sample slot information is determined to be greater than a first preset number and not greater than a second preset number, the first weighting coefficient is determined to be the second preset value.

[0169] When it is determined that the number of sample slot information is greater than the second preset number, the first weighting coefficient is determined to be the third preset value;

[0170] Wherein, the first preset value < the second preset value < the third preset value.

[0171] Wherein, the first preset value can be set to 0.5, the second preset value can be set to 0.8, the third preset value can be set to 1, the first preset quantity can be set to 6, and the second preset quantity can be set to 10. The specific formula is as follows. The embodiments of this application specify α. t The numerical value and the preset number of sample slot information are not limited; they can be in discrete form as shown in the following formula, or in the form of a continuous function, as long as α is guaranteed. t The value α increases as the number of sample slots increases, where α t The value of is between 0 and 1.

[0172]

[0173] 2. Determine the second weighting coefficient β t

[0174] In one possible implementation, β is determined by the following formula. t ;

[0175]

[0176] Where 'a' is set to 1, and 'β' ranges from 0 to 1, based on the above formula, this application embodiment sets key slot types and non-key slot types. Then, based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type, a second weighting coefficient is determined, including the following steps, specifically as follows: Figure 16 As shown:

[0177] S1601: Obtain at least one preset key slot type;

[0178] S1602: Determine the first number of sample slot information corresponding to each key slot type in the sample text, and the second number of sample slot information corresponding to each non-key slot information.

[0179] S1603: Determine the second weighting coefficient based on each first quantity and each second quantity.

[0180] Determining the second weighting coefficient β t During the process, key slot types are pre-defined, such as using "Indicator" as a key slot type. Multiple sample slot types can also be set as key slot types, such as using both "Indicator" and "Market" as key slot types. Non-key slot types can also include one or more. Each key slot type corresponds to a first number of sample slot information, and each non-key slot type corresponds to a second number of sample slot information.

[0181] Whether the slots are balanced or unbalanced is determined based on each first quantity and each second quantity, and the specific implementation method is as follows:

[0182] (1) Slot balance.

[0183] If the sum of all the second quantities is equal to the first preset quantity, then the second weighting coefficient is determined to be β, where β is a preset value;

[0184] The sum of the second quantities is used as the standard to distinguish between slot balance and slot imbalance. In this embodiment, the standard is set to the sum of the second quantities being 0, that is, there are no non-critical slot types in the sample text. Alternatively, the standard can be set to 1, that is, the number of non-critical slot types in the sample text is 1, and the number of slot information corresponding to the non-critical slot type is 1. The value of the standard is not specifically limited here.

[0185] (2) The slots are unbalanced.

[0186] If the sum of the second quantities is not equal to the first preset quantity, then based on the first quantities and the quantitative relationship between the first quantities and the corresponding second quantities, the unbalance coefficient corresponding to the preset slot imbalance condition is determined, and the second weight coefficient is determined based on the unbalance coefficient.

[0187] In this embodiment of the application, taking the absence of non-critical types (first preset quantity is 0) as an example, the unbalance coefficient when the preset slot unbalance condition is met is determined based on the quantity relationships between each first quantity and the corresponding second quantity, including at least one of the following:

[0188] (1) If each of the first quantities is a second preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient.

[0189] In this embodiment of the application, the second preset quantity is set to 0, that is, when the key slot type does not exist, it is determined that one of the slot imbalance conditions is met, and the imbalance coefficient is set to the first preset coefficient. The first preset coefficient can be set to 2 or other values.

[0190] For example, if the key slot type is set to "Indicator", and there is no slot information corresponding to "Indicator" in the sample text, then the slot is considered unbalanced, and the unbalance coefficient is 2.

[0191] (2) If the sum of the first quantities is greater than the third preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient; the third preset quantity is greater than the second preset quantity;

[0192] In this embodiment of the application, the third preset quantity is set to multiple (greater than the second preset quantity) to determine that one of the slot imbalance conditions is met. The corresponding unbalance coefficient is the first preset coefficient, which can be the same as (1) or different from (1). It can be set according to specific needs.

[0193] For example, if the key slot type is set to "Indicator", and there are multiple slot information corresponding to "Indicator" in the sample text (such as "GDP" and "Per Capita Income"), then the slots are considered unbalanced, and the unbalance coefficient is 2.

[0194] (3) Determine the ratio of each second quantity to the corresponding first quantity. If there is at least one target ratio among the ratios, determine that a slot imbalance condition is met, and use the product of the number of the target ratios and the second preset coefficient as the imbalance coefficient; wherein the target ratio is greater than the preset ratio.

[0195] In this embodiment, the target ratio is set to a value not less than 2. If at least one target ratio exists among the various ratios, it is determined that one of the slot imbalance conditions is met, and the second preset coefficient is the product of 1 and the number of target ratios. Alternatively, different second preset coefficients can be set for different target ratios. For example, when the target ratio is 2, the corresponding second preset coefficient is 1; when the target ratio is 3, the corresponding second preset coefficient is 2. In this case, the balance coefficient is obtained by summing the various second preset coefficients.

[0196] If the sample text contains a key slot type [Indicator], the number of sample slot information corresponding to [Indicator] is 1; a non-key slot type [Province], the number of sample slot information corresponding to [Province] is 2; and a non-key slot type [City], the number of sample slot information corresponding to [Province] is 3, then the ratio of the number of sample slot information corresponding to [Province] to the number of sample slot information corresponding to [Indicator] is calculated as 2:1 = 2, which determines that one of the slot imbalance conditions is met; the ratio of the number of sample slot information corresponding to [City] to the number of sample slot information corresponding to [Indicator] is 3:1 = 3, which determines that one of the slot imbalance conditions is met. Then the product of the number of the target ratios and the second preset coefficient is used as the imbalance coefficient, that is, the imbalance coefficient is: 2*1 = 2.

[0197] After determining the unbalance coefficient, the second weighting coefficient when the slots are unbalanced can be determined based on the unbalance coefficient. This can be achieved through the following implementation method: Figure 17 As shown:

[0198] S1701: Determine the sum of the unbalance coefficients c corresponding to the unbalance conditions of each slot that are satisfied.

[0199] S1702: Based on the sum of the unbalanced coefficients c, determine the second weighting coefficient as b, where b is a-β. c , where 'a' is a preset value.

[0200] The first weighting coefficient α can be determined through the above implementation method. t Second weighting coefficient β t .

[0201] S504: Perform a data query based on the intent type, the slot information, and the relationship between the slot information to obtain the query result corresponding to the target text.

[0202] The trained semantic understanding model obtained in step 3 of S503 is used to identify the target text to be identified, such as... Figure 18 As shown, the target text is input into the semantic understanding model to obtain the intent type, slot information results and slot information relationships. Data is then queried using the above output results to obtain the query results corresponding to the target text, and the query results are returned to the client.

[0203] By combining intent type, slot information, and the relationship between slot information when performing data queries, more accurate results can be obtained.

[0204] Based on the same inventive concept, embodiments of this application provide a data query device 1900, such as... Figure 19 As shown, the device includes:

[0205] The identification and extraction module 1901 is used to acquire the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text;

[0206] The combination module 1902 is used to combine the slot information in pairs to obtain at least one slot information group.

[0207] The determination module 1903 is used to determine the slot information relationship corresponding to the target text based on whether there is a preset semantic association relationship between the slot information in each slot information group.

[0208] The query module 1904 is used to perform data queries based on the intent type, the slot information, and the relationship between the slot information to obtain the query results corresponding to the target text.

[0209] The preset semantic association relationship is determined based on a trained semantic understanding model, which is trained by the relationship between the sample text and the slot information corresponding to the sample text.

[0210] In one possible implementation, the apparatus further includes a training module for determining that the semantic understanding model was trained in the following manner:

[0211] Obtain multiple sample texts;

[0212] Select sample text as input to the semantic understanding model to be trained. Based on the semantic understanding model, identify the sample intent type of the sample text, extract the information of each sample slot contained in the sample text, and the relationship between the sample slot information corresponding to the sample text.

[0213] A cross-entropy loss function is constructed based on the sample intent type, the sample slot information, and the relationship between the sample slot information, respectively.

[0214] The semantic understanding model is then adjusted using a target loss function determined based on the constructed cross-loss functions.

[0215] In one possible implementation, the training module is used to determine the cross-entropy loss function corresponding to the sample slot information relationship constructed in the following manner:

[0216] A first weighting coefficient is determined based on the number of sample slot information contained in the sample text; wherein, the first weighting coefficient is positively correlated with the number of sample slot information contained in the sample text.

[0217] The second weighting coefficient is determined based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type.

[0218] Based on the first weight coefficient, the second weight coefficient, and the sample slot information relationship, a cross-entropy loss function corresponding to the sample slot information relationship is constructed.

[0219] In one possible implementation, the training module is used to determine a second weighting coefficient based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type, including:

[0220] Obtain at least one preset key slot type;

[0221] Determine the first number of sample slot information corresponding to each key slot type in the sample text, and the second number of sample slot information corresponding to each non-key slot information.

[0222] The second weighting coefficient is determined based on each first quantity and each second quantity.

[0223] In one possible implementation, the training module is configured to determine the second weight coefficient based on each first quantity and each second quantity, including:

[0224] If the sum of all the second quantities is equal to the first preset quantity, then the second weighting coefficient is determined to be β, where β is a preset value;

[0225] If the sum of the second quantities is not equal to the first preset quantity, then based on the first quantities and the quantitative relationship between the first quantities and the corresponding second quantities, the unbalance coefficient corresponding to the preset slot imbalance condition is determined, and the second weight coefficient is determined based on the unbalance coefficient.

[0226] In one possible implementation, the training module for determining slot imbalance conditions includes at least one;

[0227] The step of determining the second weighting coefficient of the loss function based on the unbalanced coefficient includes:

[0228] Determine the sum of the unbalance coefficients c corresponding to each of the aforementioned slot unbalance conditions;

[0229] Based on the sum of the unbalanced coefficients c, the second weighting coefficient is determined to be a-β. c , where 'a' is a preset value.

[0230] In one possible implementation, the training module is used to determine, based on at least one slot imbalance condition, the unbalance coefficient when the preset slot imbalance condition is met, according to each first quantity and the quantitative relationship between each first quantity and the corresponding second quantity, including at least one of the following:

[0231] If each of the first quantities is a second preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient.

[0232] If the sum of the first quantities is greater than the third preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient; the third preset quantity is greater than the second preset quantity.

[0233] The ratios of each second quantity to the corresponding first quantity are determined respectively. If there is at least one target ratio among the ratios, it is determined that a slot imbalance condition is satisfied, and the product of the number of the target ratios and the second preset coefficient is used as the imbalance coefficient; wherein the target ratio is greater than the preset ratio.

[0234] Based on the same inventive concept, embodiments of this application also provide a data query device, such as... Figure 20 As shown, the device includes at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to perform any of the data query methods in the above embodiments.

[0235] The following reference Figure 20 This application describes a data query device 180 according to such an embodiment. Figure 20 The data query device 180 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0236] like Figure 20 As shown, the data query device 180 is presented in the form of a general-purpose data query device. The components of the data query device 180 may include, but are not limited to: at least one processor 181, at least one memory 182, and a bus 183 connecting different system components (including memory 182 and processor 181).

[0237] The processor 181 is used to read and execute instructions from the memory 182, so that the at least one processor can execute the data query method provided in the above embodiments.

[0238] Bus 183 represents one or more of several bus structures, including a memory bus or memory controller, peripheral bus, processor, or local bus using any of the various bus structures.

[0239] The memory 182 may include a readable medium in the form of volatile memory, such as random access memory (RAM) 1821 and / or cache memory 1822, and may further include read-only memory (ROM) 1323.

[0240] The memory 182 may also include a program / utility 1825 having a set (at least one) of program modules 1324, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.

[0241] The data query device 180 can also communicate with one or more external devices 184 (e.g., keyboard, pointing device, etc.), one or more devices that enable a user to interact with the data query device 180, and / or any device that enables the data query device 180 to communicate with one or more other data query devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 185. Furthermore, the data query device 180 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 186. Network adapter 186 communicates with other modules used for the data query device 180 via bus 183. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the data query device 180, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0242] In some possible implementations, various aspects of the data query method provided in this application can also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps of a data query method according to various exemplary embodiments of this application as described above.

[0243] In addition, this application also provides a computer-readable storage medium storing a computer program for causing a computer to perform the method described in any of the above embodiments.

[0244] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0245] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0246] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0247] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A data query method, characterized in that, The method includes: Obtain the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text; The slot information is combined in pairs to obtain at least one slot information group; Based on whether there is a preset semantic relationship between the slot information in each slot information group, the slot information relationship corresponding to the target text is determined. Based on the intent type, the slot information, and the relationship between the slot information, a data query is performed to obtain the query results corresponding to the target text. The preset semantic association relationship is determined based on a trained semantic understanding model. The semantic understanding model is trained using sample text and the corresponding slot information relationship. The semantic understanding model uses a target loss function to adjust parameters. The target loss function is constructed based on the cross-entropy loss function corresponding to the sample slot information relationship. The cross-entropy loss function corresponding to the sample slot information relationship is constructed based on a first weight coefficient, a second weight coefficient, and a standard cross-entropy loss function. The first weight coefficient is obtained based on the number of sample slot information contained in the sample text, and the first weight coefficient is positively correlated with the number of sample slot information contained in the sample text. The second weight coefficient is determined based on whether the slot information in the sample text is balanced. If the sum of the second quantities of sample slot information corresponding to each non-key slot information in the sample text is equal to the first preset quantity, it is determined to be balanced; otherwise, it is determined to be unbalanced.

2. The method as described in claim 1, characterized in that, The semantic understanding model is trained in the following way: Obtain multiple sample texts; Select sample text as input to the semantic understanding model to be trained. Based on the semantic understanding model, identify the sample intent type of the sample text, extract the information of each sample slot contained in the sample text, and the relationship between the sample slot information corresponding to the sample text. A cross-entropy loss function is constructed based on the sample intent type, the sample slot information, and the relationship between the sample slot information, respectively. The semantic understanding model is then adjusted using a target loss function determined based on the constructed cross-loss functions.

3. The method as described in claim 2, characterized in that, The cross-entropy loss function corresponding to the sample slot information relationship is constructed as follows: The second weighting coefficient is determined based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type. Based on the first weight coefficient, the second weight coefficient, and the sample slot information relationship, a cross-entropy loss function corresponding to the sample slot information relationship is constructed.

4. The method as described in claim 3, characterized in that, The step of determining the second weighting coefficient based on the slot type to which each sample slot information belongs and the number of sample slot information corresponding to each slot type includes: Obtain at least one preset key slot type; Determine the first number of sample slot information corresponding to each key slot type in the sample text, and the second number of sample slot information corresponding to each non-key slot information. The second weighting coefficient is determined based on each first quantity and each second quantity.

5. The method as described in claim 4, characterized in that, The step of determining the second weighting coefficient based on each first quantity and each second quantity includes: If the sum of all the second quantities is equal to the first preset quantity, then the second weighting coefficient is determined to be β, where β is a preset value; If the sum of the second quantities is not equal to the first preset quantity, then based on the first quantities and the quantitative relationship between the first quantities and the corresponding second quantities, the unbalance coefficient corresponding to the preset slot imbalance condition is determined, and the second weight coefficient is determined based on the unbalance coefficient.

6. The method as described in claim 5, characterized in that, The slot imbalance condition includes at least one; The step of determining the second weighting coefficient of the loss function based on the unbalanced coefficient includes: Determine the sum of the unbalance coefficients c corresponding to each of the aforementioned slot unbalance conditions; Based on the sum of the unbalanced coefficients c, the second weighting coefficient is determined as follows: , where 'a' is a preset value.

7. The method as described in claim 5, characterized in that, The slot imbalance condition includes at least one; then, based on the quantity relationship between each first quantity and the corresponding second quantity, the unbalance coefficient when the preset slot imbalance condition is met is determined, including at least one of the following: If each of the first quantities is a second preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient. If the sum of the first quantities is greater than the third preset quantity, it is determined that a slot imbalance condition is met, and the corresponding imbalance coefficient is the first preset coefficient; the third preset quantity is greater than the second preset quantity. The ratios of each second quantity to the corresponding first quantity are determined respectively. If there is at least one target ratio among the ratios, it is determined that a slot imbalance condition is satisfied, and the product of the number of the target ratios and the second preset coefficient is used as the imbalance coefficient; wherein the target ratio is greater than the preset ratio.

8. A data query device, characterized in that, The device includes: The identification and extraction module is used to acquire the target text to be identified, identify the intent type of the target text, and extract the slot information contained in the target text; The combination module is used to combine the slot information in pairs to obtain at least one slot information group. The determination module is used to determine the slot information relationship corresponding to the target text based on whether there is a preset semantic relationship between the slot information in each slot information group. The query module is used to perform data queries based on the intent type, the slot information, and the relationship between the slot information to obtain the query results corresponding to the target text. The preset semantic association relationship is determined based on a trained semantic understanding model. The semantic understanding model is trained using sample text and the corresponding slot information relationship. The semantic understanding model uses a target loss function to adjust parameters. The target loss function is constructed based on the cross-entropy loss function corresponding to the sample slot information relationship. The cross-entropy loss function corresponding to the sample slot information relationship is constructed based on a first weight coefficient, a second weight coefficient, and a standard cross-entropy loss function. The first weight coefficient is obtained based on the number of sample slot information contained in the sample text, and the first weight coefficient is positively correlated with the number of sample slot information contained in the sample text. The second weight coefficient is determined based on whether the slot information in the sample text is balanced. If the sum of the second quantities of sample slot information corresponding to each non-key slot information in the sample text is equal to the first preset quantity, it is determined to be balanced; otherwise, it is determined to be unbalanced.

9. A data query device, characterized in that, The device includes: At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-7.

10. A computer storage medium, characterized in that, The computer storage medium stores a computer program that enables the computer to perform the method as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Systems and methods for slot relation extraction for machine learning task-oriented dialogue systems

    US10970493B1