Data retrieval method and system based on semantic analysis

Through a data retrieval method based on semantic parsing and utilizing the weight vector of the relationship between intent and slot, the problem of users having difficulty writing query statements is solved, high accuracy and friendly interaction in data retrieval are achieved, and the user experience is improved.

CN120596540AActive Publication Date: 2025-09-05INSPUR GENERSOFT CO LTD

Patent Information

Application Number
CN202511113077.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-11
Publication Date
2025-09-05
Estimated Expiration
2045-08-11

AI Technical Summary

Technical Problem

Existing data retrieval systems require users to write specific query languages, making it difficult for non-technical personnel to accurately retrieve data. In addition, the intent and slots in natural language understanding do not match, reducing the accuracy of database queries and user experience.

Method used

A data retrieval method based on semantic parsing is adopted. The natural language query statement is parsed through the semantic parsing model, the relationship between the intent and the slot is identified, and a weight vector is generated to improve the accuracy of the slot output vector, thereby matching and retrieving data from the preset database.

Benefits of technology

It improves the accuracy of database queries and user experience, and ensures the accuracy and efficiency of data retrieval by mining the correlation between intent and slots.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120596540A_ABST
    Figure CN120596540A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of data retrieval, and provides a data retrieval method and system based on semantic analysis in order to solve the problems that existing database query is poor in accuracy and poor in user experience. The data retrieval method based on semantic analysis comprises the following steps: receiving a query statement of a natural language; based on a semantic analysis model, analyzing a corresponding relation between a query intention and a slot position of the query statement from the query statement to obtain a slot position output vector matched with the query intention; according to the slot position output vector, matching and retrieving corresponding data from a preset database; wherein the semantic analysis model comprises an input module, a vector generation module, a slot weighting module, an intention recognition module and a slot filling module. According to the method, the data matched with the query statement can be quickly and accurately retrieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of data retrieval, and in particular relates to a data retrieval method and system based on semantic analysis. Background Art

[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

[0003] Existing data retrieval systems typically require users to use specific query languages ​​(such as SQL) for searches. Crafting accurate queries is difficult for non-technical personnel, and query failures and performance issues (such as lengthy search events) are common during query writing. Using natural language queries to query data in data retrieval systems can provide user-friendly interactions. However, in natural language understanding tasks, the intent of a sentence is strongly correlated with the slots within it (a slot is a semantically meaningful information structure that needs to be automatically filled). For example, a statement with the intent "invoice query" is likely to contain a document number, and slot information is closely related to its position within the sentence. Existing technologies simply mechanically calculate the probability and position of different slots in the corresponding intent within a dataset. This results in a mismatch between intent and slots, reducing the accuracy of database queries and the user experience. Summary of the Invention

[0004] In order to solve the above technical problems, the present invention provides a data retrieval method and system based on semantic analysis, which can quickly and accurately retrieve data matching a query statement.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions: A first aspect of the present invention provides a data retrieval method based on semantic parsing.

[0006] In one or more embodiments, a data retrieval method based on semantic parsing is provided, comprising: Receive natural language query statements; Based on the semantic parsing model, the query statement is parsed to obtain a corresponding relationship between the query intent and the slot of the query statement, and a slot output vector matching the query intent is obtained; According to the slot output vector, matching and retrieving corresponding data from a preset database; The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module, and a slot filling module; The input module is used to convert the query statement into an input sequence; the vector generation module is used to generate an embedding vector by embedding the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector; the intent recognition module is used to output the intent label and its probability based on the intent hidden vector; the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot based on the intent hidden vector; and the slot filling module is used to obtain a slot output vector based on the weight vector and the slot hidden vector.

[0007] As an embodiment, the slot weighting module is used to: Rearrange the intent hidden vector into a multi-dimensional tensor according to the set size; Perform convolution on this tensor to obtain the same number of weighted vectors as the maximum length of the query statement; Perform softmax calculation on the weighted vector to form a probability map, and construct a feature vector based on the probability map. The feature vector has the same length as the intent hidden vector and the number of feature vectors is the same as the maximum length of the sentence. The feature vector is multiplied element-wise with the slot hidden vector to weight the slot type and position to obtain the weight vector of the relationship between intent and slot.

[0008] As an implementation method, the intent recognition module includes an intent classifier and a softmax layer. The intent hidden vector outputs an intent label through the intent classifier, and then the probability of each intent label is obtained through the softmax layer.

[0009] As an embodiment, the slot filling module includes a BiLSTM layer, which is used to semantically encode the weight vector and the slot hidden vector. Each forward and reverse LSTM layer generates an output vector respectively, and then the vectors are spliced ​​to obtain a semantic output vector.

[0010] As an embodiment, the slot filling module further includes a decoder layer, which is used to decode the semantic output vector to obtain a slot output vector.

[0011] As an implementation method, the slots of the query statement include slots for field names, slots for field values, slots for nodes, and slots for relationships between nodes.

[0012] As an implementation method, before training the semantic parsing model, in the process of constructing training samples, the query statement is decomposed into an input sequence containing several tokens, and each token in the training sample set is labeled using the compromise BIOE labeling method; labels starting with "B-" and "E-" represent the first and last token labels of each entity; labels starting with "I-" represent the internal token labels of the entity; "O" represents a non-entity label; and the "E-" label represents the labeling details.

[0013] As an implementation mode, the database is formed by extracting and processing at least two types of metadata respectively through structured information, and obtaining corresponding fields for matching and storage.

[0014] A second aspect of the present invention provides a data retrieval system based on semantic parsing.

[0015] In one or more embodiments, a data retrieval system based on semantic parsing includes: A query statement receiving module, which is used to receive a query statement in a natural language; A statement semantic parsing module, which is used to parse the query statement based on the semantic parsing model to obtain the corresponding relationship between the query intent and the slot of the query statement, and obtain a slot output vector that matches the query intent; A data matching and retrieval module is used to match and retrieve corresponding data from a preset database according to the slot output vector; The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module, and a slot filling module; The input module is used to convert the query statement into an input sequence; the vector generation module is used to generate an embedding vector by embedding the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector; the intent recognition module is used to output the intent label and its probability based on the intent hidden vector; the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot based on the intent hidden vector; and the slot filling module is used to obtain a slot output vector based on the weight vector and the slot hidden vector.

[0016] A third aspect of the present invention provides an electronic device.

[0017] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps of the data retrieval method based on semantic parsing as described above are implemented.

[0018] Compared with the prior art, the present invention has the following beneficial effects: The present invention performs semantic parsing on natural language query statements based on a semantic parsing model. During the semantic parsing process, the intention hidden vector is used to construct a weight vector of the relationship between the intention and the slot, and the correlation between the actual intention and the slot is mined, thereby improving the accuracy of the slot output vector. Then, the corresponding data is accurately matched and retrieved from the preset database, thereby improving the accuracy of database queries and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

[0020] Figure 1 1 is a flow chart of a data retrieval method based on semantic parsing according to an embodiment of the present invention; Figure 2 is a schematic diagram of a semantic parsing model according to an embodiment of the present invention; Figure 3 is a schematic diagram of a slot weighting module according to an embodiment of the present invention; Figure 4 Schematic diagram of the structure of a data retrieval system based on semantic parsing according to an embodiment of the present invention; Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described below with reference to the accompanying drawings and embodiments.

[0022] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.

[0023] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.

[0024] Figure 1 is a flow chart of a data retrieval method based on semantic parsing in an embodiment of the present invention. Figure 1 The data retrieval method based on semantic analysis in this embodiment may include the following steps S101 to S103.

[0025] The specific implementation process of steps S101 to S103 is as follows: Step S101: receiving a natural language query statement.

[0026] For example, a query sentence "Please play my motherland" in natural language input by a user is received. Here, a corresponding query sentence can be received according to actual conditions.

[0027] Step S102: Based on the semantic parsing model, the corresponding relationship between the query intent and the slot of the query statement is parsed from the query statement to obtain a slot output vector that matches the query intent.

[0028] In data query scenarios, user query statements have distinct characteristics. For example, "file number 123456" is a statement that a user might enter when searching based on field content in a relational database, and "querying for files generated by the fourth phase of the engineering project voucher" is a statement that a user might enter when searching based on graph relationships in a graph database. By analyzing a large number of user query statements, we can find that: When users perform data retrieval, the verbs in the input query statements (such as: query, find, search) are mostly meaningless situational words, while the statements contain a large number of nouns\field names (file number, file), auxiliary words (for, of), and field values ​​('123456'). It is necessary to use word slot extraction in the natural language understanding task to extract the corresponding field names and field values ​​for subsequent standardization processing.

[0029] When users query data based on fields, their query often includes field names and values, such as "file number" and "123456." When users query data based on relationships in a graph database, they often include the name of the relationship, such as "generate." Natural language understanding tasks require identifying the user's search intent to determine whether to use a relational database or a graph database for subsequent queries.

[0030] Through intent recognition and word slot extraction, various entities in the user's query statements are obtained. After extracting the entities, subsequent query standardization can be performed and the large model can be used to generate SQL and Cypher statements based on the query requirements.

[0031] The following is a design of slot annotation based on the query statement features. The query statement slots include slots for field names, slots for field values, slots for nodes, and slots for relationships between nodes.

[0032] The slots for field names are labeled as B-field, I-field, and E-field, corresponding to the start, content, and end of the field name. The slots for field values ​​are labeled as B-field value, I-field value, and E-field value, corresponding to the start, content, and end of the field value. The slots for nodes are labeled as B-node, I-node, and E-node, and the slots for relationships between nodes are labeled as B-relationship, I-relationship, and E-relationship. To distinguish the final query target, the structural particle before the query target is labeled as Ot to distinguish it from other meaningless particles. Tables 1 and 2 provide the corresponding slot labels.

[0033] Table 1 Slot marking example 1;

[0034] Table 2 Slot marking example 2;

[0035] Combine Figure 2 The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module and a slot filling module.

[0036] The input module is used to convert the query statement into an input sequence. In the input module, the query statement is decomposed into an input sequence containing n tokens. .

[0037] The vector generation module is used to generate an embedding vector by performing an embedding operation (such as word embedding, sentence embedding, and position embedding) on ​​the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector.

[0038] It should be noted here that the vector generation module can be implemented using the BERT model, and those skilled in the art can also use other existing models to implement it.

[0039] The intent recognition module is used to output intent labels and their probabilities based on the intent hidden vector. Specifically, the intent recognition module includes an intent classifier and a softmax layer. The intent hidden vector outputs the intent label through the intent classifier, and then the probability of each intent label is obtained through the softmax layer.

[0040] In an embodiment of the present invention, the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot according to the intent hidden vector.

[0041] like Figure 3 As shown, the slot weighting module is used to: Rearrange the intent hidden vector into a multi-dimensional tensor according to the set size; Perform convolution on this tensor to obtain the same number of weighted vectors as the maximum length of the query statement; Perform softmax calculation on the weighted vector to form a probability map, and construct a feature vector based on the probability map. The feature vector has the same length as the intent hidden vector and the number of feature vectors is the same as the maximum length of the sentence. The feature vector is multiplied element-wise with the slot hidden vector to weight the slot type and position to obtain the weight vector of the relationship between intent and slot.

[0042] For example, the hidden size of the vector generation module is set to 768 by default, so that the length of the feature vector expressing the sentence intent is 768. In the intent recognition branch, this feature vector is rearranged into a 32×24 tensor of fixed size and a convolution calculation with a channel number of 50 is performed on this tensor to obtain the same number of weighted vectors as the maximum length of the sentence (e.g., 50). The calculated result is then subjected to softmax calculation to form a probability map. After being flattened into 50 feature vectors of length 768, this feature vector is multiplied element-by-element with the slot feature vector output by the slot filling module to weight the slot type and position in the slot filling module.

[0043] The specific formula of the vector generation module is: ; , ; P⊙B; in is the number of output channels, which is the same as the maximum length of the statement; is the number of input channels, which is set to 1 in this embodiment; k is the convolution kernel size, which is set to 3 in this embodiment; Hiding vector for intent; is a multi-dimensional tensor; is the eigenvector; is the weight coefficient, is the bias vector; B is the slot hidden vector; R is a real number.

[0044] In the embodiment of the present invention, the slot filling module is configured to obtain a slot output vector according to a weight vector and a slot hidden vector.

[0045] For example, the slot filling module includes a BiLSTM layer, which is used to semantically encode the weight vector and the slot hidden vector. Each forward and backward LSTM layer generates an output vector, which is then concatenated to obtain a semantic output vector. To improve model accuracy, the embodiment of the present invention provides two BiLSTM layers. Each BiLSTM layer has a forward and backward LSTM layer for bidirectional encoding of the training sequence, thereby further highlighting the meaning of each token in the context.

[0046] The slot filling module further includes a decoder layer (eg, a CRF layer, i.e., a conditional random field layer), which is used to decode the semantic output vector to obtain a slot output vector.

[0047] Before training the semantic parsing model, during the training sample construction process, the query sentence is broken down into an input sequence consisting of several tokens. Each token in the training sample set is annotated using the compromise BIOE annotation method. Labels beginning with "B-" and "E-" represent the first and last token labels of each entity; labels beginning with "I-" represent internal token labels of an entity; "O" represents a non-entity label; and "E-" labels indicate annotation details. This annotation detail provides more refined entity boundary recognition capabilities. Examples of the three annotation methods are shown in Table 3.

[0048] As shown in Table 3, "Guangzhou" and "Singapore" are primary entities in the text and are essential key information for the entire query; "car" is a secondary entity in the text. The BIOE annotation method not only ensures that "Guangzhou" and "Singapore" are complete entities, preserving the accuracy of key information, but also uses the existing "B-" tag for the secondary entity "car," reducing computational complexity.

[0049] Table 3 Examples of BIO, BIOE, and BIOES labeling methods;

[0050] For example, if a user enters a natural language query "Please play my motherland", the model will split the query into a sequence of tokens (i.e., identifiers) ,in is the sentence classification marker at the beginning of the sequence, is the sentence separator at the end of the sequence, m is the total number of tokens in the original query. In Chinese questions, each Chinese character is recorded as a token; in English questions, each word is recorded as a token. For convenience, let ,in n Indicates the total number of tokens (including and ).sequence After word embedding, sentence embedding and position embedding operations, an embedding vector is generated Then it is encoded through the Transformer layer to generate the intent hidden vector and slot hidden vector , After the softmax layer and intent classifier, the intent label can be output as Then, according to Get the weight vector of the "intention-slot" relationship , and the slot hidden vector The two are input together into the BiLSTM layer for semantic encoding, and each forward and reverse LSTM layer generates an output vector respectively. and , and finally, after vector splicing, we get the output vector ,in Finally, after passing through the decoder CRF layer, the final slot output vector is obtained: .

[0051] In one or more embodiments, the semantic parsing model may select a pre-trained base model for intent recognition and slot filling, and use the training set to perform a new training on the base model, that is, the fine-tuning process; then use the verification set to adjust the parameters of the fine-tuned model, that is, the fine-tuning optimization process; finally, use the test set to evaluate the optimized model.

[0052] The fine-tuning process of the semantic parsing model in the embodiment of the present invention includes two subtasks: intent recognition and slot filling task: (1) Sentence-level intent recognition, that is, text classification task, from the intent label set To predict which intent the input sequence belongs to, m I is the number of intent tags. (2) Token-level slot filling, i.e. sequence labeling task, from the slot tag set Assign the correct slot label to each token in m S The number of slot labels.

[0053] Table 4 shows the experimental comparison results of the semantic parsing model of the embodiment of the present invention and the traditional BBLC (i.e., Bert-BiLSTM-CRF) model.

[0054] Table 4 Experimental comparison results of the semantic parsing model of the embodiment of the present invention and the traditional BBLC model;

[0055] As can be seen from Table 4, the semantic parsing model of the embodiment of the present invention effectively improves the performance of semantic understanding problems.

[0056] Step S103: According to the slot output vector, corresponding data is matched and retrieved from a preset database.

[0057] In an embodiment of the present invention, the database is formed by extracting and processing at least two types of metadata, respectively, and obtaining corresponding fields for matching and storage.

[0058] The metadata here includes but is not limited to image, text, audio, and video metadata.

[0059] The structured information extraction process is as follows: Image data: Preprocessing involves first using a trained document orientation recognition model to correct the orientation, then performing OCR to extract text information based on the clarity of the image text, or other existing methods to extract text. After inputting the text information and prompt words into the large model, the large model will generate a result. After processing the result, the corresponding information can be automatically entered into the database. If the fields required in the database are 'Payer's Name', 'Payer's Account Number', 'Payer's Bank', 'Payer's Name', 'Payer's Account Number', and 'Payer's Bank', The prompt words for the large model are: Please extract key fields such as 'payer's account name', 'payer's account number', 'payer's bank', 'payee's account name', 'payee's account number', and 'payee's bank' from the following text based on semantic information.

[0060] Audio data: Use the whisper model to convert audio data into text. The subsequent steps are similar to those for images.

[0061] Video data: Extract video subtitles and organize and summarize the subtitle text information. The subsequent steps are similar to those for images.

[0062] After extracting the metadata information, the big model is used to generate field attributes. Field attribute generation involves summarizing the metadata content with the big model content and generating field attributes and content that can distinguish the data from other similar data and potentially be used for retrieval. For example, the field attributes of a bank receipt image include payee, receiving bank, payer, and paying bank, while the field content is the specific content of the receipt image.

[0063] Based on a pre-designed form structure, formatted data extracted through various deep learning algorithms and large models is entered into corresponding fields in the table. This approach can significantly save manpower and resources, and the formatted data can be adapted to various search methods, such as full-text search, conditional filter search, relational database search, and graph database search.

[0064] like Figure 4 As shown, the data retrieval system based on semantic parsing provided by the embodiment of the present invention can be implemented in software. The data retrieval system based on semantic parsing includes the following software modules: a query statement receiving module 401, a statement semantic parsing module 402 and a data matching retrieval module 403.

[0065] The following is an introduction to the functions of each software module in the data retrieval system based on semantic parsing: A query statement receiving module 401 is configured to receive a query statement in a natural language; A statement semantic parsing module 402 is configured to parse the query statement based on a semantic parsing model to determine the correspondence between the query intent and the slots of the query statement, and obtain a slot output vector that matches the query intent. A data matching and retrieval module 403 is configured to match and retrieve corresponding data from a preset database according to the slot output vector; The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module, and a slot filling module; The input module is used to convert the query statement into an input sequence; the vector generation module is used to generate an embedding vector by embedding the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector; the intent recognition module is used to output the intent label and its probability based on the intent hidden vector; the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot based on the intent hidden vector; and the slot filling module is used to obtain a slot output vector based on the weight vector and the slot hidden vector.

[0066] It should be noted here that the query statement receiving module 401, statement semantic analysis module 402 and data matching retrieval module 403 in the embodiment of the present invention correspond one-to-one to the various steps in the above-mentioned semantic analysis-based data retrieval method, and their specific implementation process is the same, which will not be repeated here.

[0067] The structure of the electronic device according to the embodiment of the present invention is described in detail below. Figure 5 The schematic diagram of the structure of the electronic device provided in the embodiment of the present invention can be understood as follows: Figure 5 Only exemplary structures of the electronic device are shown, not all structures. Part or all of the shown structures may be implemented as needed.

[0068] The electronic device provided in the embodiment of the present invention includes: at least one processor 501, a memory 502, a user interface 503 and at least one network interface 504. The various components in the data retrieval system based on semantic parsing are coupled together through a bus system 505. It can be understood that the bus system 505 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not described in detail. Figure 3 Various buses are labeled as bus system 505.

[0069] The user interface 503 may include a display, a keyboard, a mouse, a trackball, a click wheel, keys, buttons, a touch pad or a touch screen.

[0070] It will be appreciated that the memory 502 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. The memory 502 in the embodiments of the present invention can store data to support the operation of the terminal. Examples of such data include any computer program used to operate on the terminal, such as an operating system and application programs. The operating system includes various system programs, such as a framework layer, a core library layer, and a driver layer, which are used to implement various basic services and handle hardware-based tasks. The application program may include various application programs.

[0071] In some embodiments, the semantic parsing-based data retrieval system provided by the embodiments of the present invention can be implemented using a combination of software and hardware. As an example, the semantic parsing-based data retrieval system provided by the embodiments of the present invention can be a processor in the form of a hardware decoding processor, which is programmed to execute the semantic parsing-based data retrieval method provided by the embodiments of the present invention. For example, the processor in the form of a hardware decoding processor can be one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0072] As an example, the processor 501 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0073] As an example of a hardware implementation of the semantic parsing-based data retrieval system provided in an embodiment of the present invention, the device provided in an embodiment of the present invention can be directly executed by a processor 501 in the form of a hardware decoding processor. For example, the semantic parsing-based data retrieval method provided in an embodiment of the present invention can be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0074] The memory 502 in the embodiment of the present invention is used to store various types of data to support the operation of the data retrieval system based on semantic parsing, or to store data for executing Figure 1 Examples of such data include any executable instructions for operating on a semantic parsing-based data retrieval system, such as executable instructions. The program for implementing the semantic parsing-based data retrieval method of the present invention may be included in the executable instructions.

[0075] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, the computer program including a computer program for executing Figure 1 In such an embodiment, the computer program can be downloaded and installed from a network via the communication portion and / or installed from a removable medium. When the computer program is executed by the central processing unit, the various functions defined in the apparatus of the present application are performed.

[0076] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products of the embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0077] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A data retrieval method based on semantic analysis, characterized in that: include: Receive natural language query statements; Based on the semantic parsing model, the query statement is parsed to obtain a corresponding relationship between the query intent and the slot of the query statement, and a slot output vector matching the query intent is obtained; According to the slot output vector, matching and retrieving corresponding data from a preset database; The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module, and a slot filling module; The input module is used to convert the query statement into an input sequence; the vector generation module is used to generate an embedding vector by embedding the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector; the intent recognition module is used to output the intent label and its probability based on the intent hidden vector; the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot based on the intent hidden vector; and the slot filling module is used to obtain a slot output vector based on the weight vector and the slot hidden vector.

2. A data retrieval method based on semantic analysis as claimed in claim 1, characterized in that: The slot weighting module is used to: Rearrange the intent hidden vector into a multi-dimensional tensor according to the set size; Perform convolution on this tensor to obtain the same number of weighted vectors as the maximum length of the query statement; Perform softmax calculation on the weighted vector to form a probability map, and construct a feature vector based on the probability map. The feature vector has the same length as the intent hidden vector and the number of feature vectors is the same as the maximum length of the sentence. The feature vector is multiplied element-wise with the slot hidden vector to weight the slot type and position to obtain the weight vector of the relationship between intent and slot.

3. The data retrieval method based on semantic analysis according to claim 1, characterized in that: The intent recognition module includes an intent classifier and a softmax layer. The intent hidden vector outputs the intent label through the intent classifier, and then the probability of each intent label is obtained through the softmax layer.

4. The data retrieval method based on semantic analysis according to claim 1, characterized in that: The slot filling module includes a BiLSTM layer, which is used to semantically encode the weight vector and the slot hidden vector. Each forward and reverse LSTM layer generates an output vector respectively, and then the vectors are spliced ​​to obtain a semantic output vector.

5. The data retrieval method based on semantic analysis according to claim 4, characterized in that: The slot filling module further includes a decoder layer, which is used to decode the semantic output vector to obtain a slot output vector.

6. The data retrieval method based on semantic analysis according to claim 1, characterized in that: The slots of a query statement include slots for field names, slots for field values, slots for nodes, and slots for relationships between nodes.

7. The data retrieval method based on semantic analysis according to claim 1, characterized in that: Before training the semantic parsing model, during the construction of training samples, the query statement is decomposed into an input sequence containing several tokens. Each token in the training sample set is annotated using the compromise BIOE annotation method; labels starting with "B-" and "E-" represent the first and last token labels of each entity; labels starting with "I-" represent internal token labels of the entity; "O" represents non-entity labels; and "E-" labels represent annotation details.

8. The data retrieval method based on semantic analysis according to claim 1, characterized in that: The database is formed by extracting and processing at least two types of metadata through structured information, and obtaining corresponding fields for matching and storage.

9. A data retrieval system based on semantic analysis, characterized in that: include: A query statement receiving module, which is used to receive a query statement in a natural language; A statement semantic parsing module, which is used to parse the query statement based on the semantic parsing model to obtain the corresponding relationship between the query intent and the slot of the query statement, and obtain a slot output vector that matches the query intent; A data matching and retrieval module is used to match and retrieve corresponding data from a preset database according to the slot output vector; The semantic parsing model includes an input module, a vector generation module, a slot weighting module, an intent recognition module, and a slot filling module; The input module is used to convert the query statement into an input sequence; the vector generation module is used to generate an embedding vector by embedding the input sequence, and then encode it to generate an intent hidden vector and a slot hidden vector; the intent recognition module is used to output the intent label and its probability based on the intent hidden vector; the slot weighting module is used to obtain a weight vector of the relationship between the intent and the slot based on the intent hidden vector; and the slot filling module is used to obtain a slot output vector based on the weight vector and the slot hidden vector.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the data retrieval method based on semantic parsing as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Intelligent semantic retrieval method based on cultural relic knowledge graph

    CN111522910A

  • Semantic matching method and device for power transformer knowledge questions and answers

    CN113919366A

  • Embedded multi-intention recognition and slot filling model based on knowledge fusion

    CN115238691A

  • Artificial intelligence-based intention recognition model training method and related equipment

    CN116644335A

  • Medical question-answering system based on improved named entity recognition and construction method thereof

    CN116719913A

Cited By

  • Intelligent dialogue method based on natural language query database

    CN121278060A