Information query method and device, computer equipment, readable storage medium and program product

By storing the files to be queried in a structured vector database and generating parsing rules, the problem that traditional information retrieval methods are difficult to deal with complex queries is solved, efficient and accurate information retrieval is achieved, and the intelligence and user experience of queries are improved.

CN119884155APending Publication Date: 2025-04-25DALANG (SHANGHAI) INTELLIGENT TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510052548.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

Traditional information retrieval methods are difficult to handle complex queries, especially fuzzy semantic matching, resulting in inaccurate results or missing related information, making it difficult to meet complex and diverse user needs, and information query is inefficient.

Method used

Structured parsing rules are generated by storing the file to be queried in a structured vector database and aligning the semantic information of the file with the key names in the database. Then, the information query statement is analyzed, structured query instances are constructed, the target vector is filtered, and the query results are extracted through the generative language model.

Benefits of technology

It improves the efficiency and accuracy of information retrieval, can process complex semantic query statements, realizes accurate query and fuzzy semantic matching at low query cost, and improves the intelligence and user experience of query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119884155A_ABST
    Figure CN119884155A_ABST
Patent Text Reader

Abstract

The invention relates to an information query method and device, computer equipment, a computer readable storage medium and a computer program product, relates to the technical field of information retrieval, and can improve the information retrieval efficiency. The method comprises the following steps: acquiring a file to be subjected to information query, and storing the file into a structured vector database; a plurality of key names are arranged in the structured vector database; performing alignment operation on the semantic information of the file and at least one key name in a structured vector database to obtain a structured analysis rule; obtaining an information query statement; analyzing the information query statement according to the structured analysis rule to obtain a structured query instance formed by the query target and the query condition; according to a query condition in the structured query instance, screening corresponding vectors of the structured vector database to obtain a target vector; and based on the structured query instance, extracting an information query result corresponding to the query target from the file content corresponding to the target vector through the generative language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information retrieval technology, and in particular to an information query method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] With the rapid development of informatization and big data, more and more companies and organizations have begun to rely on intelligent systems to handle large amounts of queries and information retrieval, aiming to answer users' questions in an automated way and provide a more efficient information acquisition experience.

[0003] In traditional methods, intelligent system information retrieval relies on keyword matching or Boolean retrieval. This method is difficult to handle complex queries, especially fuzzy semantic matching, which can easily lead to inaccurate results or omission of relevant information. It is difficult to handle complex and diverse user needs, and the information query efficiency is low. Summary of the invention

[0004] Based on this, it is necessary to provide an information retrieval method, apparatus, computer equipment, computer-readable storage medium and computer program product that can improve information retrieval efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides an information retrieval method, comprising:

[0006] Acquire a file to be queried for information, and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0007] Aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0008] Get information query statement;

[0009] Parsing the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0010] According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain a target vector;

[0011] Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0012] In one embodiment, storing the file in a structured vector database comprises:

[0013] Extracting entry information of the file and converting the entry information into structured data;

[0014] A vectorization operation is performed on the structured data, and the vectorized structured data is saved in the structured vector database in the form of metadata.

[0015] In one embodiment, the step of screening the vectors in the structured vector database according to the query condition corresponding to the structured query instance to obtain the target vector includes:

[0016] If the semantic information of the information query statement matches the semantic information of any key name, then the logical operation condition and the filter field corresponding to the query condition are obtained to obtain a vector filter;

[0017] The vector filter is used to filter out vectors in the structured vector database that meet the query condition, and obtain the target vector.

[0018] In one embodiment, the step of screening the vectors in the structured vector database according to the query condition corresponding to the structured query instance to obtain the target vector includes:

[0019] If the semantic information of the information query statement does not match the semantic information of each key name, a vectorization operation is performed on the semantic information corresponding to the information query statement to obtain a query vector;

[0020] The query vector and the corresponding vectors of the entry information in the structured vector database are subjected to similarity calculation, and a vector having a similarity calculation result higher than a preset threshold value is selected from the corresponding vectors of the entry information as the target vector.

[0021] In one embodiment, the query statement for obtaining information includes:

[0022] Acquire a first information query sentence in voice form;

[0023] Obtaining a semantic correction word list corresponding to the file, and semantically correcting the information query statement in the voice form according to the semantic correction word list to obtain a second information query statement;

[0024] The second information query statement is semantically split to obtain a plurality of the information query statements.

[0025] In a second aspect, the present application also provides an information retrieval device, comprising:

[0026] A structured vector database generation module is used to obtain a file to be queried for information and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0027] A structured parsing rule generating module, used for aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0028] An information query statement acquisition module, used to acquire information query statements;

[0029] An information query statement parsing module, used to parse the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0030] A vector screening module, used to screen the vectors in the structured vector database according to the query conditions in the structured query instance to obtain a target vector;

[0031] The information query module is used to extract the information query result corresponding to the query target from the file content corresponding to the target vector based on the structured query instance through a generative language model.

[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0033] Acquire a file to be queried for information, and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0034] Aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0035] Get information query statement;

[0036] Parsing the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0037] According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain a target vector;

[0038] Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0039] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0040] Acquire a file to be queried for information, and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0041] Aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0042] Get information query statement;

[0043] Parsing the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0044] According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain a target vector;

[0045] Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0046] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:

[0047] Acquire a file to be queried for information, and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0048] Aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0049] Get information query statement;

[0050] Parsing the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0051] According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain a target vector;

[0052] Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0053] The above-mentioned information query method, device, computer equipment, computer-readable storage medium and computer program product obtain a file to be queried for information and store the file in a structured vector database; a plurality of key names are set in the structured vector database; the semantic information of the file and at least one key name in the structured vector database are aligned to obtain a structured parsing rule; an information query statement is obtained; the information query statement is parsed according to the structured parsing rule to obtain a structured query instance consisting of a query target and query conditions corresponding to the key name; according to the query conditions in the structured query instance, the corresponding vector of the structured vector database is screened to obtain a target vector; based on the structured query instance, the information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0054] In the present application, the retrieval efficiency is greatly improved by standardizing the file data and storing it in a structured form; the structured parsing rules are obtained by aligning the file semantic information and the key names in the structured data, thereby ensuring the accurate mapping between the file to be queried and the structured vector database, and ensuring the accuracy of the query operation; by constructing a structured parsing process for information query statements, the mapping of complex semantic query statements on the content information of the structured vector database entries is realized; by structurally querying the query conditions of the query instance, the vector set is narrowed, and the query statement is matched with both accurate query and fuzzy semantic matching at a low query cost; through the intelligent processing of the generative language model, more complex query tasks can be handled, which improves the intelligence of the query and the user experience, thereby improving the efficiency of information query. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings used in the embodiments of the present application or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0056] Figure 1 An application environment diagram of an information query method in an embodiment;

[0057] Figure 2 A schematic diagram of a flow chart of an information query method in an embodiment;

[0058] Figure 3 A schematic diagram of a process for generating a structured vector database in an embodiment;

[0059] Figure 4 A schematic diagram of a process for generating a target vector in one embodiment;

[0060] Figure 5 is a structural block diagram of an information query device in an embodiment;

[0061] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0063] The information query method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal communicates with the server through the network. The data storage system can store data processed by the server. The data storage system can be integrated on the server, or it can be placed on the cloud or other network servers. Among them, the terminal can be but not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.

[0064] In an exemplary embodiment, Figure 2 As shown, an information query method is provided, which is applied to Figure 1 The server in the example is used to illustrate, including the following steps S202 to S212. Among them:

[0065] Step S202, obtaining a file to be queried for information, and storing the file in a structured vector database; a plurality of key names are set in the structured vector database.

[0066] The files to be queried refer to files provided by users or from which the system extracts data. These files can be in various formats, such as PDF, Word documents, Excel tables, etc. In this embodiment, the unstructured data can be converted into a structured form for subsequent retrieval.

[0067] A structured vector database is a way of storing data, where the data is organized in the form of vectors of tables, fields, and records. Each data item in a structured vector database is assigned one or more "key names", i.e., field names, which describe the specific properties of the data and refer to the identifiers of each data item in the structured vector database.

[0068] Exemplarily, the server first obtains the files to be queried from the source provided or specified by the user. These files may contain different types of unstructured information, such as documents, reports, spreadsheets, etc. The server uses document parsing tools (such as OCR, natural language processing, regular expressions, etc.) to parse these files and extract the information in them as structured data. For example, for a PDF file containing a project application, the server can extract fields such as project name, investment amount, participants, and project description.

[0069] Step S204: aligning the semantic information of the file with at least one key name in the structured vector database to obtain a structured parsing rule.

[0070] Among them, the semantic information of the file refers to the part of the file content that has practical meaning, which can be extracted through the natural language model. The extraction of semantic information is to understand the actual content of the file, not just to match the text word for word. The alignment operation refers to the process of matching and mapping the semantics in the file with the key names in the structured vector database. Through this alignment, the system can accurately map the semantic information in the file to specific fields in the structured vector database for subsequent queries and operations. Structured parsing rules are a set of rules generated based on the mapping relationship between file content and database key names.

[0071] Exemplarily, after extracting semantic information from the file to be queried through natural language processing technology, the server uses Schema Linking technology to accurately connect this information with the fields (key names) in the structured vector database. Schema Linking combines field name matching with semantic understanding to accurately map the meaning extracted from the natural language text to the preset field structure in the structured vector database. Specifically, Schema Linking will first analyze the key information in the query file and perform a preliminary match based on the similarity of the field names. This process relies on lexical similarity analysis and word vector technology in natural language processing to achieve a preliminary match by calculating the semantic similarity between the field name and the file content. However, simple name matching is often difficult to cover the complexity of the semantic level. Therefore, a semantic understanding model is further introduced in Schema Linking to further enhance the accuracy of the mapping based on context and semantic inference.

[0072] In one embodiment, Schema Linking not only relies on direct matching of field names, but also ensures that the actual concepts in the file corresponding to the database fields can be identified through means such as semantic expansion and entity recognition. For example, a field name is "implementation unit", and the file may mention "the owner of the project". Schema Linking can use the entity recognition technology of natural language processing to identify the semantic association between "implementation unit" and "the owner of the project", thereby completing the mapping. In a more specific embodiment, when the field names and semantic content are quite different, Schema Linking will infer the association between the two through context analysis and synonym and phrase recognition, and build a more accurate docking relationship.

[0073] Next, we use the Pydantic class model in Python to define the data type and format of each field. Pydantic is a Python library for data validation and data modeling. It can effectively ensure that structured data meets the predetermined format requirements during storage and query. The definition of the Pydantic class is the result of schema-linking. By defining the variable type, variable description, and optional subclass inheritance rules of a pydantic class, the index name of the field entry is bound to these additional information (variable type, variable description, and optional subclass inheritance rules) in a way that the generative language model can understand. While Schema Linking completes the docking relationship between the index name and semantic content of the field entry, it will also assign appropriate data types (such as integers, floating decimals, dates, etc.) and formats to each field according to the pre-defined Pydantic class, and display them in the format of the Pydantic class. This process not only ensures the accuracy of the data, but also provides a clear structure and specification for subsequent data storage and query. Through the above steps, the semantic information in the file to be queried is accurately docked with the structured database fields.

[0074] Optionally, in a specific embodiment, the server performs semantic information identification on the "project owner" in the file to obtain the semantic information identification result "the project implementation unit, that is, the unit specifically responsible for project development", and uses Schemalinking technology to perform field matching on the semantic information identification result and the key name in the structured vector database to complete the mapping relationship between the semantic information identification result "the project implementation unit, that is, the unit specifically responsible for project development" and the key name "implementation unit", and uses Pydantic to define and restrict the data type and format corresponding to the key name to obtain structured parsing rules.

[0075] Optionally, the generative language model reads the field names of the structured data in the structured vector database to be processed and parses them. The generative language model uses context information and the language knowledge learned during pre-training to understand the actual concepts represented by the field names. For example, the field "implementation unit" is understood as "the implementation unit of the project, and the unit specifically responsible for the project". By understanding the actual semantics of the field names, the generative language model can establish a direct mapping relationship between the fields in the structured vector database and the file content of the file to be queried.

[0076] The generative language model identifies the data type corresponding to the field based on the semantics of the field and imposes data type constraints on the identified field. In some specific embodiments, for numeric fields, it can identify whether it is an integer, a floating decimal, or a currency amount, etc.; for date fields, it can infer that the field should be a date format or a timestamp; for string fields, it can identify that the field content should be in a certain text format (such as an email, a phone number, etc.).

[0077] Optionally, the generative language model can intelligently adjust the application of rule constraints through adaptive learning of different query scenarios. For example, the value of a field is subject to specific business logic, such as the "customer's title" field may require the input value to be within a certain range, or the "transaction amount" field may meet certain minimum / maximum limits. The generative language model can intelligently identify these constraints and apply the corresponding rules based on the context of the query question.

[0078] In an exemplary embodiment, when performing information statement query parsing, the generative language model not only matches the field names in the query statement with the fields in the structured vector database through strong mapping, but also ensures that the field values ​​meet the type constraints.

[0079] Step S206, obtaining an information query statement.

[0080] Among them, the information query statement refers to the natural language expression used by the user to query specific information, which can be a request made by the user in the form of text or voice.

[0081] Step S208, parsing the information query statement according to the structured parsing rules to obtain a structured query instance consisting of the query target and query conditions corresponding to the key name.

[0082] The structured query instance is structured data parsed from the user's query statement, including the query target and query conditions.

[0083] After receiving the information query statement, the server determines the specific field (i.e., key name) in the structured vector database to which the information query statement is mapped according to the structured parsing rules, and determines the key name corresponding to the corresponding query target through the semantic information of the information query statement. The remaining key names will be determined as the key names corresponding to the query conditions. Further, the query logic of the query conditions corresponding to the remaining key names is determined, and the obtained query target and query logic are structured to obtain a structured query instance.

[0084] Step S210: According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain the target vector.

[0085] The target vector is the vector corresponding to the database entry or file that meets the query condition after the screening operation. According to the query condition specified in the structured query instance, the system extracts the vectors that meet the condition from the database and returns these vectors as the query results.

[0086] Exemplarily, according to the key name corresponding to the query condition, the vectors corresponding to the structured vector database are screened to obtain candidate vectors related to the key name; according to the logical relationship corresponding to the key name in the query condition, the candidate vectors are logically checked and screened, and the candidate vectors that meet the logical relationship are determined as the final target vector.

[0087] Step S212: Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

[0088] The generative language model refers to a model that uses deep learning technology, which can be based on a large-scale pre-trained language model, to generate or extract natural language output. The information query result is the specific data extracted from the file content corresponding to the target vector, which can be an answer in the form of natural language expression.

[0089] Exemplarily, the generative language model identifies relevant information in the target vector by parsing the target and conditions in the structured query instance. Based on the target and conditions, the model extracts the content corresponding to the query target from the file content corresponding to the target vector and returns the query result in the form of natural language.

[0090] Optionally, the generative language model not only extracts information, but also converts the extracted data into a natural language response that the user can understand. The natural language response may include a description of the target field, a summary or explanation of the data, etc.

[0091] In the above information query method, a file to be queried is obtained and stored in a structured vector database; a plurality of key names are set in the structured vector database; semantic information of the file and at least one key name in the structured vector database are aligned to obtain a structured parsing rule; an information query statement is obtained; the information query statement is parsed according to the structured parsing rule to obtain a structured query instance consisting of a query target and query conditions corresponding to the key name; according to the query conditions in the structured query instance, the corresponding vector of the structured vector database is screened to obtain a target vector; based on the structured query instance, an information query result corresponding to the query target is determined according to the target vector through a generative language model. In this embodiment, the file data is converted into standardized form and stored in a structured form, which greatly improves the retrieval efficiency; the structured parsing rules are obtained by aligning the file semantic information and the key names in the structured data, which ensures the accurate mapping between the file to be queried and the structured vector database, and ensures the accuracy of the query operation; by constructing a structured parsing process for information query statements, the mapping of complex semantic query statements on the content information of the structured vector database entries is achieved; by structuring the query conditions of the query instance, the file set is narrowed down, and the effect of taking into account both accurate query and fuzzy semantic matching of the query statement at a low query cost is achieved; through the intelligent processing of the generative language model, more complex query tasks can be handled, which improves the intelligence of the query and the user experience, thereby improving the efficiency of information query.

[0092] In an exemplary embodiment, in step S202, storing the file in a structured vector database includes: extracting entry information of the file and converting the entry information into structured data; performing vectorization operations on the structured data, and saving the vectorized structured data in the form of metadata to obtain a structured vector database.

[0093] Among them, entry information refers to a record or data entry in a file. It can be a specific data item contained in the file, such as project name, total investment amount, participants, etc. This information is unstructured and is converted into structured data through data extraction and conversion technology. Structured data refers to data organized in a certain format, in the form of tables and field-value pairs. Structured data has predefined fields (key names), and each field contains a specific type (such as integers, floating numbers, strings, etc.). Metadata is data that describes data and is used to identify and manage background information of data. In a specific implementation, metadata refers to the storage form of structured data in a database.

[0094] First, the entry information is extracted from the file to be queried through data extraction technology (such as one or more of OCR, text analysis, regular expressions, etc.). Once the entry information is extracted, the server converts it into structured data. Further, the structured data is converted into a vector representation. Vectorization technology converts information such as text and numbers into multidimensional numerical arrays so that they can be effectively processed in vector space. The purpose of this process is to convert structured data into a form that can calculate similarity or perform further analysis. Through vectorization, the system can perform more sophisticated operations such as retrieval, classification, and clustering on the data. The vectorized structured data will be stored as metadata in a structured vector database.

[0095] In this embodiment, by extracting entry information from the file and converting it into structured data, the data combined with vectorized operations is stored in a structured vector database in the form of metadata, enabling efficient query, retrieval and analysis. This not only improves data management and query efficiency, but also provides the system with flexible scalability and powerful data processing capabilities.

[0096] In an exemplary embodiment, step S210 filters the vectors in the structured vector database according to the query conditions corresponding to the structured query instance to obtain the target vector, including: if the semantic information of the information query statement matches the semantic information of any key name, then obtaining the logical operation conditions and filter fields corresponding to the query conditions to obtain a vector filter; through the vector filter, filtering out the vectors in the structured vector database that meet the query conditions to obtain the target vector.

[0097] Among them, the query condition is the restrictive requirement specified in the user query, which is used to filter data. For example, "the amount is greater than 5 million yuan" or "contains 'Deputy Director of the Science and Technology Innovation Center'". The query condition helps the system limit the range of results returned. The logical operation condition is an operator used to filter data in the database, such as "equal to", "greater than", "less than", etc. The logical operation condition defines how to compare the values ​​between the query field and the database field, and then filter the records that meet the conditions.

[0098] For example, Figure 3 As shown, the processing may include step S302 of parsing the query target and query conditions from the information query statement provided by the user, step S304 of determining the logical operation conditions and filter fields related to the query conditions by analyzing the query conditions, and step S306 of combining the query conditions with the logical operation conditions and filter fields to construct a vector filter for filtering database records.

[0099] Step S302: parse the query target and query conditions from the information query statement provided by the user.

[0100] The query target in the query statement is associated with the field (key name) in the structured vector database. For example, in the query statement "find projects with a total investment amount greater than 5 million yuan", the query target is "project" and the query condition is "total investment amount greater than 5 million yuan".

[0101] Step S304, by analyzing the query conditions, determining the logical operation conditions and screening fields related to the query conditions.

[0102] The logical operation condition is the operator specified in the query, such as "equal to", "greater than", "less than", etc. The filter field refers to the database field (i.e., key name) on which the query condition acts. For example, the query condition: "Total investment amount is greater than 5 million yuan" determines the logical operation condition: "greater than" and the filter field: "Total project investment" (corresponding to the key name in the structured vector database).

[0103] Step S306: The server combines the query condition with the logical operation condition and the filter field to construct a vector filter for filtering database records.

[0104] The server searches for target vectors that meet the query criteria based on the definition of the filter to complete an exact match.

[0105] In this embodiment, by parsing the query conditions in the information query statement, a vector filter is generated, and the target vectors that meet the conditions are filtered out in the structured vector database through the vector filter. This process not only improves the accuracy and efficiency of the query, but also enhances the system's ability to handle complex queries and supports multi-condition queries.

[0106] In an exemplary embodiment, step S210 screens the vectors in the structured vector database according to the query conditions corresponding to the structured query instance to obtain the target vector, including: if the semantic information of the information query statement does not match the semantic information of each key name, then vectorize the semantic information corresponding to the information query statement to obtain the query vector; perform similarity calculation on the query vector and the corresponding vector of the key name in the structured vector database, and select the vector whose similarity calculation result is higher than a preset threshold in the corresponding vector of the entry information as the target vector.

[0107] The query vector is a numerical representation obtained by converting the semantic information of the query statement into a vector representation.

[0108] Specifically, the server uses natural language processing technology to analyze the user's information query statement and determine whether the information query statement explicitly involves the key name in the database. When the information query statement does not involve the key name, the server will vectorize the semantic information of the query statement. In a specific embodiment, the user inputs the information query statement "find projects related to new energy", but the information query statement does not involve the specific key name in the structured vector database, so the information query statement is vectorized. Next, the server calculates the similarity between the query vector and the vector corresponding to each database key name, and can use algorithms such as cosine similarity and Euclidean distance to measure the similarity between the query vector and the entry information vector. The higher the similarity, the closer the semantics of the entry is to the query statement. According to the calculated similarity calculation result, the corresponding vector of the entry whose similarity with the query vector is higher than the preset threshold is selected as the target vector.

[0109] In this embodiment, by vectorizing the query statement and calculating the similarity between the query vector and the vector corresponding to the key name of the structured vector database, a target vector with a similarity higher than a preset threshold is selected as the query result, so that the system can process fuzzy queries and semantic-based queries, improves the intelligence level and accuracy of the query, and enhances the system's processing capabilities for natural language queries.

[0110] In an exemplary embodiment, step S206 of obtaining an information query statement includes: obtaining a first information query statement in a voice form; obtaining a semantic correction vocabulary corresponding to the file, and performing semantic correction on the information query statement in a voice form according to the semantic correction vocabulary to obtain a second information query statement; and performing semantic splitting on the second information query statement to obtain multiple information query statements.

[0111] Among them, the first information query statement refers to the information query statement obtained in the form of voice; the second query statement refers to the information query statement in text form obtained after semantic correction of the first information query statement; the semantic correction vocabulary refers to the vocabulary used to correct homophones, semantic correction vocabulary and abbreviations appearing in the information query statement in voice form, further expanding the scope of the query vocabulary and improving the system's understanding ability.

[0112] For example, Figure 4 As shown, the processing process may include step S402, after obtaining the first information query statement in speech form, identifying the keywords in the first information query statement and replacing them with corresponding words in the structured vector database according to the semantic correction vocabulary, and step S404, based on the second information query statement obtained after semantic correction, splitting the query statement into multiple independent query statements through semantic splitting technology.

[0113] Step S402, after obtaining the first information query statement in voice form, the server identifies the keywords in the first information query statement and replaces them with corresponding words in the structured vector database according to the semantic correction vocabulary (such as replacing "investment" with "total investment amount").

[0114] Step S404, based on the second information query statement obtained after semantic correction, the server splits the query statement into multiple independent query statements through semantic splitting technology. The purpose of semantic splitting is to split complex query conditions into simpler and clearer query tasks, thereby improving the efficiency and accuracy of the query. In a specific embodiment, the second information query statement is "Find projects with a total investment amount greater than 5 million yuan, and the projects involve the field of new energy". Through semantic splitting, the system splits the original query into two independent queries, the information query statement "Find projects with a total investment amount greater than 5 million yuan" and the information query statement "Find projects involving the field of new energy. These split information query statements can be executed independently, thereby increasing the flexibility and accuracy of the query.

[0115] Optionally, after splitting the query statement, the server can perform independent structured vector database retrieval for each split query, or combine these query results under certain conditions. This split helps to accurately obtain relevant data from different dimensions and avoids information loss caused by over-simplification in the query.

[0116] In this embodiment, after obtaining a voice query statement and converting it into text, the query statement is semantically modified using a semantic modification vocabulary to ensure that the vocabulary in the query statement is consistent with the database field. Then, the complex query statement is decomposed into multiple independent queries through semantic splitting technology, thereby improving query accuracy and efficiency.

[0117] In an exemplary embodiment, step S212 extracts information query results corresponding to the query target from the file content corresponding to the target vector based on the structured query instance through a generative language model, including: generating query result prompt words based on the structured query instance and the target vector; and extracting information query results corresponding to the query target from the file content corresponding to the target vector based on the query target and the query result prompt words by the generative language model.

[0118] Among them, the query result prompt word is used to guide the generative language model to extract contextual prompts of relevant data from the file content corresponding to the target vector.

[0119] Among them, the generative language model is a model built based on deep learning technology, especially large-scale pre-trained language models, which can generate or extract natural language output. The generative language model generates natural language answers that meet the query requirements based on the query target and context information by parsing the input information. The query result prompt word refers to the guiding information generated based on the structured query instance and the target vector, which helps the generative language model extract information related to the query target from the file content corresponding to the target vector. These prompt words act as context clues for the generative model during the extraction process.

[0120] Specifically, the server constructs query result prompt words for guiding the generative language model based on the query target and query conditions in the structured query instance. The role of the prompt words is to provide a clear context for the generative language model and guide it to extract information related to the query target from the file content corresponding to the target vector. In a specific embodiment, for the information query sentence "find projects with a total investment amount greater than 5 million yuan", the query result prompt words can be: "Based on the provided database, list the names, investment amounts and related information of projects with a total investment amount greater than 5 million yuan."

[0121] After that, the server combines the query result prompt word with the structured query instance and inputs it into the generative language model. Based on the generated query result prompt word, the generative language model extracts specific data related to the query target from the file content corresponding to the target vector and returns it to the user in the form of natural language. By understanding the context of the prompt word and the query target, the generative language model can accurately locate the relevant information in the file content corresponding to the target vector and generate natural language query results.

[0122] Optionally, when the information query involves multiple conditions, the generative language model can combine and output the query results according to the query conditions to ensure the completeness and accuracy of the query.

[0123] In this embodiment, by generating query result prompt words and combining with a generative language model, information related to the query target is extracted from the file content of the target vector. This process improves the system's ability to handle complex queries, supports multi-condition queries, and ensures the accuracy and intelligence of the query results. By generating query results in natural language, the system can provide users with easy-to-understand answers, improving the intelligence level of queries and user experience.

[0124] In order to enable those skilled in the art to better understand the above steps, the embodiment of the present application is illustrated below by using an example, but it should be understood that the embodiment of the present application is not limited to this.

[0125] In an exemplary embodiment, first, the system extracts entry information from the file provided by the user and converts it into structured data. The process includes extracting structured data from various file formats (such as PDF, Word, Excel, etc.) through OCR and text analysis technology, and the data is organized and stored through predefined fields (key names). These fields include specific information such as project name and total investment amount, and each field has a clear data type and structure. The structured data is further vectorized to convert text, numbers and other data into multi-dimensional vector form and stored in a structured vector database to provide efficient support for subsequent queries.

[0126] After obtaining the file to be queried and converting it into a structured vector database, the system matches the semantic information of the file with the key name in the structured vector database through alignment operations. Through schemalinking technology, the system can map the semantic description in the file (such as project description, investment target, etc.) to the corresponding field in the database, and constrain the data structure and form of structured data through Pydantic. This alignment constraint process provides clear rules for query parsing, ensuring that the query statement can be accurately mapped to the target field in the structured vector database.

[0127] When a user submits a query request, the system receives the user's query statement and determines its form. If the query statement is voice input, the system will convert the voice into a text query through voice recognition technology. The system then uses the semantic correction word list to correct homophones, abbreviations, etc. in the query statement to ensure that the query vocabulary is consistent with the database field.

[0128] Next, the system parses the query statement based on the structured query instance and extracts the query target and query conditions. The query target corresponds to the key name field in the structured vector database, and the query condition specifies the key name filtering logic. The generated structured query instance will help the system determine the specific query tasks and operations, ensuring that the query conditions are correctly applied to the fields in the database.

[0129] When the semantic information of the information query statement includes the key name in the structured vector database, the system builds a vector filter based on the structured query instance and filters out the target vectors that meet the query conditions in the structured vector database. The filter filters the data by applying the logical operations in the query conditions and extracts the vectors that meet the user's needs.

[0130] When the system obtains the target vector, based on the structured query instance, the generative language model is used to extract the query results from the file content corresponding to the target vector. After receiving the prompt words of the query target and query conditions, the generative language model will intelligently extract specific information related to the query target from the target vector. After the natural language generation processing of the model, this information is returned to the user in the form of natural language.

[0131] In a specific embodiment, in order to achieve structured output of information retrieval results, the use of information retrieval methods should be supported at three levels: First, it should support JSON parsing and function-call functions. This means that the generation layer can understand and process structured data formats so that complex queries and data interactions can be converted into processable structured outputs. For the service layer, during the deployment phase, the service framework supports structured parsing to ensure that the loaded model can correctly handle structured requests from the application layer. For example, frameworks such as vllm, lmdeploy, and tensorrt-llm support global structured parsing using third-party tools (such as LM Enforcer, Outlines, etc.), or use type parsing libraries such as Pydantic to handle each request through custom adaptation. For the application layer, the output format can be specified when the model is called, which can be achieved through Pydantic, JSON Schema, or TypedDict. Developers can use these tools to explicitly specify the expected output format at the application layer to ensure that the output is consistent with the query requirements.

[0132] In this embodiment, by combining structured query instances with generative language models, the system can not only handle traditional precise query tasks, but also intelligently understand and respond to complex and ambiguous query requirements, thereby enhancing the adaptability and scalability of the system.

[0133] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0134] Based on the same inventive concept, the embodiment of the present application also provides an information query device for implementing the above-mentioned information query method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in one or more information query device embodiments provided below can refer to the limitations on the information query method above, and will not be repeated here.

[0135] In an exemplary embodiment, Figure 5 As shown, an information query device is provided, including: a structured vector database generation module 510, a structured parsing rule generation module 520, an information query statement acquisition module 530, an information query statement parsing module 540, a vector screening module 550 and an information query module 560, wherein:

[0136] The structured vector database generation module 510 is used to obtain a file to be queried for information and store the file in a structured vector database; the structured vector database is provided with a plurality of key names;

[0137] A structured parsing rule generating module 520, configured to align the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule;

[0138] An information query statement acquisition module 530 is used to acquire an information query statement;

[0139] An information query statement parsing module 540 is used to parse the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name;

[0140] A vector screening module 550, configured to screen corresponding vectors in the structured vector database according to the query conditions in the structured query instance to obtain a target vector;

[0141] The information query module 560 is used to extract the information query result corresponding to the query target from the file content corresponding to the target vector through a generative language model based on the structured query instance.

[0142] In one embodiment, the structured vector database generation module 510 is also used to extract entry information of the file and convert the entry information into structured data; the structured data includes a key name and description information corresponding to the key name; vectorize the structured data, and save the vectorized structured data in the form of metadata to the structured vector database.

[0143] In one embodiment, the vector screening module 550 is also used to obtain the logical operation conditions and screening fields corresponding to the query conditions if the semantic information of the information query statement matches the semantic information of any key name, and obtain a vector filter; through the vector filter, the vectors in the structured vector database that meet the query conditions are screened out to obtain the target vector.

[0144] In one embodiment, the vector screening module 550 is also used to perform vectorization operation on the semantic information corresponding to the information query statement to obtain a query vector if the semantic information of the information query statement does not match the semantic information of each key name; perform similarity calculation on the query vector and the corresponding vector of the entry information in the structured vector database, and select a file whose similarity calculation result is higher than a preset threshold in the corresponding vector of the entry information as the target vector.

[0145] In one embodiment, the information query statement acquisition module 530 is also used to acquire a first information query statement in speech form; acquire a semantic correction vocabulary corresponding to the file, and perform semantic correction on the information query statement in speech form according to the semantic correction vocabulary to obtain a second information query statement; and perform semantic splitting on the second information query statement to obtain a plurality of the information query statements.

[0146] In one embodiment, the information query module 560 generates a query result prompt word based on the structured query instance and the target vector; the generative language model extracts the information query result corresponding to the query target from the file content corresponding to the target vector according to the query target and the query result prompt word.

[0147] Each module in the above information query device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0148] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Figure 6As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store structured data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an information query method is implemented.

[0149] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0150] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0151] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0152] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0153] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with relevant regulations.

[0154] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data comply with relevant regulations.

[0155] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0156] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0157] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. An information query method, characterized in that: The method comprises: Acquire a file to be queried for information, and store the file in a structured vector database; the structured vector database is provided with a plurality of key names; Aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule; Get information query statement; Parsing the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name; According to the query condition in the structured query instance, the corresponding vectors in the structured vector database are screened to obtain a target vector; Based on the structured query instance, an information query result corresponding to the query target is extracted from the file content corresponding to the target vector through a generative language model.

2. The method according to claim 1, characterized in that The storing the file into the structured vector database comprises: Extracting entry information of the file and converting the entry information into structured data; A vectorization operation is performed on the structured data, and the vectorized structured data is saved in the structured vector database in the form of metadata.

3. The method according to claim 1, characterized in that The step of screening the vectors in the structured vector database according to the query condition corresponding to the structured query instance to obtain the target vector includes: If the semantic information of the information query statement matches the semantic information of any of the key names, then obtaining the logical operation condition and the filter field corresponding to the query condition to obtain a vector filter; The vector filter is used to filter out vectors in the structured vector database that meet the query condition, and obtain the target vector.

4. The method according to claim 1, characterized in that: The step of screening the vectors in the structured vector database according to the query condition corresponding to the structured query instance to obtain the target vector includes: If the semantic information of the information query statement does not match the semantic information of each key name, a vectorization operation is performed on the semantic information corresponding to the information query statement to obtain a query vector; The query vector and the corresponding vectors of the entry information in the structured vector database are subjected to similarity calculation, and a vector having a similarity calculation result higher than a preset threshold value is selected from the corresponding vectors of the entry information as the target vector.

5. The method according to claim 1, characterized in that The information acquisition query statement includes: Acquire a first information query sentence in voice form; Obtaining a semantic correction word list corresponding to the file, and semantically correcting the information query statement in the voice form according to the semantic correction word list to obtain a second information query statement; The second information query statement is semantically split to obtain a plurality of the information query statements.

6. The method according to claim 1, characterized in that The extracting, based on the structured query instance and through a generative language model, the information query result corresponding to the query target from the file content corresponding to the target vector comprises: Generate a query result prompt word based on the structured query instance and the target vector; The generative language model determines the information query result corresponding to the query target according to the query target, the query result prompt word, and the target vector.

7. An information query device, characterized in that: The device comprises: A structured vector database generation module is used to obtain a file to be queried for information and store the file in a structured vector database; the structured vector database is provided with a plurality of key names; A structured parsing rule generating module, used for aligning the semantic information of the file with at least one of the key names in the structured vector database to obtain a structured parsing rule; An information query statement acquisition module, used to acquire information query statements; An information query statement parsing module, used to parse the information query statement according to the structured parsing rule to obtain a structured query instance consisting of a query target and a query condition corresponding to the key name; A vector screening module, used to screen corresponding vectors in the structured vector database according to the query conditions in the structured query instance to obtain a target vector; The information query module is used to extract the information query result corresponding to the query target from the file content corresponding to the vector based on the structured query instance through a generative language model.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.