Archive query system and method based on large model
By introducing text error correction model and entity recognition technology into the archive query system, the problems of inefficiency and insufficient accuracy in traditional archive query methods are solved, and more efficient and accurate archive query is achieved.
Patent Information
- Application Number
- CN202510322672.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-19
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When facing a large number of unstructured text files, traditional archive query methods are inefficient and insufficient inaccurate. Especially when user input is inaccurate, they cannot return results that match the user's real query intention.
A large model-based archive query system is adopted, and by obtaining user query statements, the pre-trained text error correction model is called for error detection and correction, entity recognition, and the query entity set is matched with the nodes in the graph database to obtain the query results.
Effectively identify and correct user input errors, improve the accuracy of query statements, and avoid unrelated or mismatched query results caused by input errors, thereby improving the accuracy of overall query results.
Smart Images

Figure CN119848074A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of archive query, and in particular to an archive query system and method based on a large model. Background Art
[0002] In the information age, archive management and query have become an important part of daily work in all walks of life. With the gradual increase in the number and complexity of archives, traditional archive query methods often have problems such as low efficiency and lack of accuracy, which has caused great trouble to users. Especially when faced with a large number of unstructured text archives, how to quickly and accurately perform archive query has become a difficult problem that needs to be solved urgently. With the development of natural language processing (NLP) technology, semantic query has gradually become an important means to solve this problem. It can understand the intention of user input, rather than just relying on superficial keyword matching, thereby achieving more intelligent and accurate archive query.
[0003] However, users may enter inaccurate query statements due to spelling errors, irregular grammar or ambiguous expressions. The system will not be able to return results that match the user's actual query intent when using these inaccurate query statements, resulting in low query accuracy and poor user experience. Summary of the invention
[0004] The purpose of the present invention is to solve the problem of low query accuracy mentioned in the above background technology, and to propose an archive query system and method based on a large model.
[0005] In a first aspect of the present invention, a large model-based archive query method is provided, wherein the archive is stored in a graph database in the form of a knowledge graph; the method comprises: Get the user's query statement; Calling a pre-trained text error correction model to perform error detection and correction on the query statement; the text error correction model includes a detection sub-model and a correction sub-model; If there is an error, the query statement is displayed to the user for confirmation to obtain the correct query statement; According to the correct query statement, entity recognition is performed to obtain a query entity set; The query entity set is matched with the nodes in the graph database to obtain a query result.
[0006] Preferably, the detection sub-model includes an encoding module, a feature fusion module, an overall judgment module and a position identification module; wherein: The encoding module is used to embed the semantics, phonetic symbols and shapes of the query sentence to obtain semantic features, phonetic features and visual features; The feature fusion module is used to perform weighted fusion on the semantic features, speech features and visual features to obtain a word encoding sequence of the query statement; The overall judgment module is used to process the word encoding sequence using a fully connected network to obtain a classification probability that the query statement is correct; The position identification module is used to use a conditional random field to identify the character encoding sequence and obtain an identification sequence if the classification probability is less than a preset threshold; the identification sequence includes a correct character identification and an incorrect character identification.
[0007] Preferably, the encoding module includes a semantic encoding submodule, a phonetic encoding submodule and an image encoding submodule; wherein: The semantic encoding submodule is used to extract semantic information from the query statement using the Transformer architecture to obtain semantic features; The speech coding submodule is used to embed the pinyin of each word to obtain a pinyin embedding sequence; and to perform convolution processing on the pinyin embedding sequence using a convolution layer to obtain speech features; The image encoding submodule is used to perform convolution processing on the image of each word using a residual network and an attention mechanism, obtain an embedding vector of each word after layer normalization and pooling, and combine them to obtain visual features.
[0008] Preferably, the feature fusion module includes a character feature extraction layer, a fully connected layer and a weighted fusion layer; wherein: The character feature extraction layer is used to extract multiple first feature vectors corresponding to each character from the semantic features, voice features and visual features of the query sentence; and concatenate the multiple first feature vectors to obtain a second feature vector; The fully connected layer is used to perform a linear operation on the second feature vector and obtain weights of different features using a sigmoid function; The weighted fusion layer is used to perform weighted summation on multiple first feature vectors of each word to obtain a coding vector for each word; and to combine the coding vectors of each word to obtain a word coding sequence of the query statement.
[0009] Preferably, the correction sub-model includes a sample generation module, a mask shielding module, a word prediction module and a filling confirmation module; wherein: The sample generation module is used to determine the error position and the correct position of the query statement according to the identification sequence; perform synonym conversion on the words in the correct position to obtain multiple reference samples of the query statement; The mask shielding module is used to use mask marks to shield typos in the query sentence and its reference samples to obtain a marked shielded sentence; The word prediction module is used to predict each masked sentence using the pre-trained RoBERTa model to obtain a candidate list of wrong word positions; the candidate list includes candidate words and their probability scores; The filling confirmation module is used to calculate the comprehensive score of each candidate word according to a preset evaluation rule, and select the candidate word with the highest comprehensive score to fill in the corresponding wrong character position to obtain a corrected query statement.
[0010] Preferably, the filling confirmation module includes an edit distance calculation module and a comprehensive scoring module; wherein: The edit distance calculation module is used to take the pinyin of the target candidate word and the pinyin of the wrong character as a character string and calculate the Levenshtein distance between the two as the edit distance; The comprehensive scoring module is used to calculate the comprehensive score of the target candidate word according to the edit distance and the probability score of the target candidate word: , Among them, S i is the comprehensive score of the target candidate word i; P i is the probability score of the target candidate word i; L i is the edit distance between the target candidate word and the wrong character; α, β, b are constants.
[0011] Preferably, if there is an error, a confirmation is displayed to the user, and obtaining a correct query statement includes: The corrected query statement is filled into a preset interactive template and fed back to the user, so that the user can confirm that the corrected query statement is a correct query statement or re-enter the correct query statement.
[0012] A second aspect of the present invention provides a file query system based on a large model, wherein the files are stored in a graph database in the form of a knowledge graph; the system comprises: A query receiving module is used to obtain the user's query statement; A query correction module, used to call a pre-trained text error correction model to perform error detection and correction on the query statement; the text error correction model includes a detection sub-model and a correction sub-model; An interactive confirmation module is used to echo confirmation to the user if there is an error, so as to obtain a correct query statement; An entity recognition module, used to perform entity recognition according to the correct query statement to obtain a query entity set; The data retrieval module is used to match the query entity set with the nodes in the graph database to obtain the query result.
[0013] Beneficial effects of the present invention: The present invention proposes a large model-based archive query method, which includes: obtaining a user's query statement; calling a pre-trained text error correction model to perform error detection and correction on the query statement; the text error correction model includes a detection sub-model and a correction sub-model; if an error exists, echoing confirmation to the user to obtain a correct query statement; performing entity recognition based on the correct query statement to obtain a query entity set; matching the query entity set with nodes in a graph database to obtain a query result.
[0014] By introducing a text error correction model, we can effectively identify and correct user input errors, thereby improving the accuracy of query statements. This can avoid irrelevant or mismatched query results caused by input errors, thereby improving the accuracy of the overall query results. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The present invention will be further described below in conjunction with the accompanying drawings.
[0016] Figure 1 A flowchart of a large model-based archive query method is provided for an embodiment of the present invention; Figure 2 An architectural diagram of a text error correction model is provided for an embodiment of the present invention; Figure 3 An architectural diagram of a large-model-based archive query system is provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] The embodiment of the present invention provides a file query method based on a large model. Figure 1 , Figure 1 A flowchart of a large model-based archive query method provided by an embodiment of the present invention. The method comprises the following steps: S101, obtaining a user's query statement.
[0019] S102, calling a pre-trained text error correction model to perform error detection and correction on the query statement.
[0020] S103: If there is an error, a confirmation is displayed to the user to obtain a correct query statement.
[0021] S104: Perform entity recognition based on the correct query statement to obtain a query entity set.
[0022] S105, matching the query entity set with the nodes in the graph database to obtain the query result.
[0023] The text error correction model includes a detection sub-model and a correction sub-model. The detection sub-model is used to detect whether the query statement is wrong. If it is correct, it will enter the data retrieval stage. If it is wrong, the wrong position will be marked and submitted to the correction sub-model. The correction sub-model is used to correct the wrong position in the query statement.
[0024] The large-model-based archive query method provided by the embodiment of the present invention can effectively identify and correct user input errors by introducing a text error correction model, thereby improving the accuracy of the query statement. This can avoid irrelevant or mismatched query results caused by input errors, thereby improving the accuracy of the overall query results.
[0025] In one embodiment, see Figure 2 , Figure 2 An architectural diagram of a text error correction model provided for an embodiment of the present invention.
[0026] The detection sub-model includes an encoding module, a feature fusion module, an overall judgment module and a position identification module; among which: The encoding module is used to embed the semantics, phonetic symbols and shapes of the query sentence respectively to obtain semantic features, phonetic features and visual features.
[0027] The feature fusion module is used to perform weighted fusion of semantic features, speech features and visual features to obtain a word encoding sequence of the query statement.
[0028] The overall judgment module is used to process the word encoding sequence using a fully connected network to obtain the classification probability that the query statement is correct.
[0029] The position identification module is used to identify the character encoding sequence using the conditional random field if the classification probability is less than a preset threshold, and obtain an identification sequence. The identification sequence includes correct character identification and wrong character identification, which correspond to the text sequence of the query statement one by one.
[0030] By encoding each type of information (semantics, phonetics, images) independently and fusing these features in the subsequent processing, multiple sources of information are effectively integrated. In this way, the model can not only understand the semantics of the text, but also recognize the input through phonetic information, and further enhance the understanding of the input content through character image processing, making the query detection results more accurate.
[0031] In one implementation, the encoding module includes a semantic encoding submodule, a phonetic encoding submodule and an image encoding submodule; wherein: The semantic encoding submodule is used to extract semantic information from query statements using the Transformer architecture to obtain semantic features. Specifically, for the input query statement, the text sequence after word segmentation is X={x1, x2, ..., xn}, where n is the length of the text. First, each element of X is mapped to a vector to obtain the text embedding sequence ; Then use it as the input H0 of the Transformer network; the output expression of the subsequent Transformer layer is: ; Take the output H of the last layer M As a semantic feature Transformer can capture long-distance dependencies and process complex grammatical and semantic information. By encoding text sequences through Transformer, rich semantic features in query statements can be extracted.
[0032] The speech coding submodule is used to embed the pinyin of each word to obtain a pinyin embedding sequence; the convolution layer is used to convolve the pinyin embedding sequence to obtain speech features; specifically, for the pinyin sequence Y={y1, y2, ..., yn} of the query sentence. First, each element of Y is mapped to a vector to obtain a pinyin embedding sequence ; Then use the convolution layer with a window size of 3 and a padding of 1 to perform convolution processing to obtain the speech features The formula is: . Conv represents the convolution operation.
[0033] The image encoding submodule is used to perform convolution processing on the image of each word using the residual network and attention mechanism, obtain the embedding vector of each word after layer normalization and pooling, and combine them to obtain the visual features. Specifically, for any word target, obtain its image from the font file ; A residual network with five layers of residual blocks can be used for convolution operations, and a CBAM (Convolutional Block Attention Module) is added between the fourth and fifth residual blocks. The feature map obtained by convolution is layer normalized and globally averaged pooled to obtain the embedding vector of the word . Combine the embedding vectors of each word to get the visual features .
[0034] In one implementation, the feature fusion module includes a character feature extraction layer, a fully connected layer, and a weighted fusion layer; wherein: The character feature extraction layer is used to extract multiple first feature vectors corresponding to each character from the semantic features, voice features and visual features of the query sentence. The multiple first feature vectors corresponding to character i are .
[0035] And concatenate multiple first eigenvectors to get the second eigenvector : . concat represents the concatenation operation.
[0036] The fully connected layer calculates the second eigenvector and uses the sigmoid function to obtain the weights of different features. The specific calculation process is as follows: , Among them, W t 、b t , W p 、b p , W v 、b v is a learnable parameter; CT i , CP i 、CV i They are the weights of semantic features, phonetic features, and visual features respectively.
[0037] The weighted fusion layer is used to perform weighted summation on multiple first feature vectors of each word to obtain the encoding vector of each word; the encoding vector calculation process of word i is as follows: ; The encoding vectors of each word are combined to obtain the word encoding sequence of the query statement.
[0038] This implementation method integrates and weights multi-dimensional features, and the final character encoding vector contains information from multiple aspects such as semantics, phonetics, and vision. Such feature representation can not only accurately reflect the meaning and phonetics of each character, but also handle differences in fonts or shapes, allowing the model to better understand complex query statements.
[0039] In one embodiment, the correction sub-model includes a sample generation module, a mask shielding module, a word prediction module and a filling confirmation module; wherein: The sample generation module is used to determine the error position and the correct position of the query statement according to the identification sequence; perform synonym conversion on the words in the correct position to obtain multiple reference samples of the query statement.
[0040] The mask shielding module is used to use mask tags to shield typos in query sentences and reference samples to obtain marked shielded sentences.
[0041] The word prediction module is used to predict each masked sentence using the pre-trained RoBERTa model to obtain a candidate list of wrong word positions. The candidate list includes candidate words and their probability scores.
[0042] The filling confirmation module is used to calculate the comprehensive score of each candidate word according to the preset evaluation rules, and select the candidate word with the highest comprehensive score to fill in the corresponding wrong character position to obtain the corrected query statement.
[0043] This embodiment uses synonymous conversion to generate multiple reference samples, providing rich samples for subsequent predictions, which enables the model to predict words from multiple angles and improves the accuracy of correction.
[0044] In one embodiment, the filling confirmation module includes an edit distance calculation module and a comprehensive scoring module; wherein: The edit distance calculation module is used to take the pinyin of the target candidate word and the pinyin of the wrong character as character strings, and calculate the Levenshtein distance between the two as the edit distance.
[0045] The comprehensive scoring module is used to calculate the comprehensive score of the target candidate word based on the edit distance and the probability score of the target candidate word: , Among them, S i is the comprehensive score of the target candidate word i; P i is the probability score of the target candidate word i; L i is the edit distance between the target candidate word and the wrong character; α, β, b are constants, and α, βϵ(0, 1), b is less than 0.
[0046] This embodiment balances the similarity in pinyin and the relevance of semantic context by comprehensively considering the edit distance and probability score, ensuring that the corrected words are contextually reasonable and closer to the user's original input, thereby improving the accuracy of the query.
[0047] In one embodiment, step S103 includes: Fill the corrected query statement into the preset interactive template and give feedback to the user. For example, the interactive template can be designed as "Do you want to query []?" Fill in the corrected query statement in []. This allows the user to confirm that the corrected query statement is correct or re-enter the correct query statement.
[0048] The embodiment of the present invention provides a file query system based on a large model. Figure 3 , Figure 3 The following is an architecture diagram of a large-model-based archive query system provided by an embodiment of the present invention. The system includes: The query receiving module is used to obtain the user's query statement.
[0049] The query correction module is used to call the pre-trained text error correction model to perform error detection and correction on query statements.
[0050] The interactive confirmation module is used to echo confirmation to the user if there is an error, so as to obtain the correct query statement.
[0051] The entity recognition module is used to perform entity recognition based on the correct query statement to obtain the query entity set.
[0052] The data retrieval module is used to match the query entity set with the nodes in the graph database to obtain the query results.
[0053] Among them, the text error correction model includes a detection sub-model and a correction sub-model.
[0054] The large-model-based archive query system provided by the embodiment of the present invention can effectively identify and correct user input errors by introducing a text error correction model, thereby improving the accuracy of query statements. This can avoid irrelevant or mismatched query results caused by input errors, thereby improving the accuracy of the overall query results.
[0055] The above is a detailed description of an embodiment of the present invention, but the content is only a preferred embodiment of the present invention and cannot be considered to limit the scope of implementation of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.
Claims
1. A file query method based on a large model, characterized in that: The archive is stored in a graph database in the form of a knowledge graph; the method comprises: Get the user's query statement; Calling a pre-trained text error correction model to perform error detection and correction on the query statement; the text error correction model includes a detection sub-model and a correction sub-model; If there is an error, the query statement is displayed to the user for confirmation to obtain the correct query statement; According to the correct query statement, entity recognition is performed to obtain a query entity set; The query entity set is matched with the nodes in the graph database to obtain a query result.
2. The archive query method based on a large model according to claim 1, characterized in that: The detection sub-model includes a coding module, a feature fusion module, an overall judgment module and a position identification module; wherein: The encoding module is used to embed the semantics, phonetic symbols and shapes of the query sentence to obtain semantic features, phonetic features and visual features; The feature fusion module is used to perform weighted fusion on the semantic features, speech features and visual features to obtain a word encoding sequence of the query statement; The overall judgment module is used to process the word encoding sequence using a fully connected network to obtain a classification probability that the query statement is correct; The position identification module is used to identify the character encoding sequence using a conditional random field to obtain an identification sequence if the classification probability is less than a preset threshold; the identification sequence includes a correct character identification and an incorrect character identification.
3. The archive query method based on a large model according to claim 2 is characterized in that: The encoding module includes a semantic encoding submodule, a phonetic encoding submodule and an image encoding submodule; wherein: The semantic encoding submodule is used to extract semantic information from the query statement using the Transformer architecture to obtain semantic features; The speech coding submodule is used to embed the pinyin of each word to obtain a pinyin embedding sequence; and to perform convolution processing on the pinyin embedding sequence using a convolution layer to obtain speech features; The image encoding submodule is used to perform convolution processing on the image of each word using a residual network and an attention mechanism, obtain an embedding vector of each word after layer normalization and pooling, and combine them to obtain visual features.
4. The archive query method based on a large model according to claim 3 is characterized in that: The feature fusion module includes a character feature extraction layer, a fully connected layer and a weighted fusion layer; wherein: The character feature extraction layer is used to extract multiple first feature vectors corresponding to each character from the semantic features, voice features and visual features of the query sentence; and concatenate the multiple first feature vectors to obtain a second feature vector; The fully connected layer is used to perform a linear operation on the second feature vector and obtain weights of different features using a sigmoid function; The weighted fusion layer is used to perform weighted summation on multiple first feature vectors of each word to obtain a coding vector for each word; and to combine the coding vectors of each word to obtain a word coding sequence of the query statement.
5. The archive query method based on a large model according to claim 2 is characterized in that: The correction sub-model includes a sample generation module, a mask shielding module, a word prediction module and a filling confirmation module; wherein: The sample generation module is used to determine the error position and the correct position of the query statement according to the identification sequence; perform synonym conversion on the words in the correct position to obtain multiple reference samples of the query statement; The mask shielding module is used to use mask marks to shield typos in the query sentence and its reference samples to obtain a marked shielded sentence; The word prediction module is used to predict each masked sentence using the pre-trained RoBERTa model to obtain a candidate list of wrong word positions; the candidate list includes candidate words and their probability scores; The filling confirmation module is used to calculate the comprehensive score of each candidate word according to a preset evaluation rule, and select the candidate word with the highest comprehensive score to fill in the corresponding wrong character position to obtain a corrected query statement.
6. The archive query method based on a large model according to claim 5 is characterized in that: The filling confirmation module includes an edit distance calculation module and a comprehensive scoring module; wherein: The edit distance calculation module is used to take the pinyin of the target candidate word and the pinyin of the wrong character as a character string and calculate the Levenshtein distance between the two as the edit distance; The comprehensive scoring module is used to calculate the comprehensive score of the target candidate word according to the edit distance and the probability score of the target candidate word: , Among them, S i is the comprehensive score of the target candidate word i; P i is the probability score of the target candidate word i; L i is the edit distance between the target candidate word and the wrong character; α, β, b are constants.
7. The archive query method based on a large model according to claim 1 is characterized in that: If there is an error, the user is prompted for confirmation, and the correct query statement includes: The corrected query statement is filled into a preset interactive template and fed back to the user, so that the user can confirm that the corrected query statement is a correct query statement or re-enter the correct query statement.
8. A file query system based on a large model, characterized in that: The archive is stored in a graph database in the form of a knowledge graph; the system comprises: A query receiving module is used to obtain the user's query statement; A query correction module, used to call a pre-trained text error correction model to perform error detection and correction on the query statement; the text error correction model includes a detection sub-model and a correction sub-model; An interactive confirmation module is used to echo confirmation to the user if there is an error, so as to obtain a correct query statement; An entity recognition module, used to perform entity recognition according to the correct query statement to obtain a query entity set; The data retrieval module is used to match the query entity set with the nodes in the graph database to obtain the query result.
Citation Information
Patent Citations
Chinese spelling error correction method and device based on multiple representations and multiple pre-training models
CN113627158A
Server and text error correction method
CN113836935A
Text error correction method and device based on character pronunciation and character pattern similarity
CN115017890A
Text processing method and device, electronic equipment and storage medium
CN117725933A
Method and device for predicting and enhancing query instruction of electric power customer service system
CN118152428A