Standard query, retrieval and question and answer method and system
Through systematic search and vectorization of standard text processing, combined with large model and fuzzy matching technology, the problem of cumbersome data processing and unfriendly interaction in the existing standard text search methods is solved, and efficient and accurate standard text query and question-and-answer functions are realized. .
Patent Information
- Application Number
- CN202411304275.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-03
AI Technical Summary
The existing standard text retrieval methods have problems such as high data processing workload, professional participation, unfriendly interaction, and unoptimized results feedback and maintenance and updates relying on manual labor.
By systematically searching, classifying and preprocessing standard texts, a pattern transformation model and vector database are constructed, and large models are used for vectorization processing and intent recognition. Combining fuzzy matching and embedding search technology, efficient query and question-and-answer standard texts are achieved.
Improves the efficiency and accuracy of standard search, reduces manual intervention, supports quick use and automatic updates, and enhances processing capabilities for ambiguity vocabulary and context understanding.
Smart Images

Figure CN119248917A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data preprocessing, and in particular to a method and system for implementing standard query, retrieval, and question-answering using a large model. Background Art
[0002] At present, standard query, retrieval, and question-answering methods generally adopt standard text retrieval methods based on knowledge graphs and keyword text retrieval methods based on hash tables.
[0003] The standard text retrieval method based on the knowledge graph combines standard text data with knowledge graph technology to improve the accuracy and relevance of standard text. To parse and process the standard text to be retrieved, first perform standard text entity recognition, manually identify entities (equipment, equipment parts, diagrams, tables, etc.) from the standard text data; perform relationship extraction, manually identify the relationship between each entity, and define the link structure of the knowledge graph; use semantic enhancement methods to enrich the semantic representation of text data, including adding contextual information, synonyms, type information, etc.; use the paths and relationships in the knowledge graph and the relevance algorithm to calculate the relevance between the query information and the standard text information, obtain the relevance score, and determine the retrieval feedback result based on the score.
[0004] A keyword text retrieval method based on a hash table pre-sets a keyword database; obtains the text to be retrieved, and determines each search term in the text by using a corresponding word segmentation method; determines a corresponding search strategy based on the text to be retrieved and the keyword database; searches in a preset keyword database based on the search strategy and the search terms in the text to be retrieved to determine whether the text to be retrieved contains the keywords in the search database, constructs a search tree using multiple key characters in the search database, uses different search strategies, and searches in the search database based on each character in the text to be retrieved to determine whether the text to be retrieved includes the keywords in the search database.
[0005] The shortcomings of existing standard text retrieval and query technologies are mainly concentrated in the following aspects: standard text data processing, retrieval information interaction, retrieval content feedback, and post-maintenance and update. The specific manifestations are as follows:
[0006] (1) Standard data processing is labor-intensive and requires the manual participation of professionals with prior knowledge. Most of the work is done manually.
[0007] (2) When interacting with the retrieval system, a specific language format is required to input retrieval information, which makes it difficult for users to quickly get started.
[0008] (3) When the results of the standard text retrieval are fed back, it is impossible to optimize the feedback content and feed back the specific content of the text.
[0009] (4) Later maintenance and updates: When performing later maintenance and updates on the system, professional personnel are still required to participate, and automatic and rapid updates cannot be achieved. Summary of the invention
[0010] In order to solve the above technical problems, the present invention provides a method and system for standard query, retrieval, and question answering to improve the efficiency and accuracy of standard retrieval.
[0011] The object of the present invention is achieved through the following technical solution, a method for standard query, retrieval, and question answering, comprising the following steps:
[0012] Step 1: Systematically search the standards, classify them according to the classification rules, and build a standard classification library;
[0013] Step 2: preprocess the standard text to obtain standard parsing data with logical relationships;
[0014] Step 3: Based on the user input content, a mode conversion model of the field is constructed through a standard document dataset of the corresponding field classification in the corresponding classification library, and special mode input data is generated through the mode conversion model;
[0015] Step 4: Pattern matching is performed on the special mode input data and the standard parsed data to obtain standard data that meets the mode requirements;
[0016] Step 5: vectorize the standard data text obtained in step 4 and store it in a database to build a vector database, and add a key value with an identification function to the standard data;
[0017] Step 6: Extract vector data corresponding to the standard data of the pattern from the standard vector database, and construct a vectorized database that conforms to the pattern;
[0018] Step 7: Construct a prompt word template that meets the standard usage application scenario;
[0019] Step 8: After the user inputs the text, the user input is vectorized to obtain the input text vector features;
[0020] Step 9: Search in the standard vector database to find the standard text segment that is most similar to the input text vector;
[0021] Step 10: Embed the user input and the standard text segment into the prompt word template, use the large model to realize intent recognition and context understanding, give an answer or generate an explanation, summary or related information list based on the complexity of the question entered by the user.
[0022] Preferably, in step 1, the standard classification criteria include: standard name, definition and determination of the knowledge category system used to classify the standard text.
[0023] Preferably, in step 2, the method for preprocessing the standard text is: parsing the standard text, extracting text, pictures, and table data, and logically linking the standard title, chapter title, section title, and article title information with the text, pictures, and table data.
[0024] Preferably, in step 3, a pattern conversion model of the field is constructed based on technologies such as knowledge classification and knowledge extraction.
[0025] Preferably, in step 4, a pattern matching tool such as Xerces or Trang is used to perform pattern matching between the special pattern input data and the standard parsed data.
[0026] Preferably, in step 5, the method for constructing a vector database is: slicing the standard data with a specific pattern according to a specific length, inputting the sliced data into the Embedding large model for feature extraction, and storing the extracted vectorized features in vector databases such as Faiss and Milvus.
[0027] Preferably, in step 7, a prompt word template that meets the standard usage application scenario is constructed by means of a thought chain.
[0028] Preferably, in step 8, the user input is vectorized through the Embedding model.
[0029] Preferably, in step 9, a search is performed in the standard vector database using a combination of fuzzy matching and embedding-based retrieval technology.
[0030] In addition to providing a method for standard query, retrieval, and question-answering, the present invention further provides a system for implementing the above method, the system comprising:
[0031] The standard classification module defines and determines the knowledge category system used to classify standard texts based on the standard name, and classifies the standards according to different systems.
[0032] Standard text preprocessing, parsing the standard text to obtain standard parsed data with logical relationships and pattern types.
[0033] The user input mode conversion module uses a domain-specific standard document dataset to construct a mode conversion model for the domain and generate input data for a dedicated mode based on the user input content.
[0034] The pattern matching module is used to perform pattern matching on the special pattern input data and the standard parsed data to obtain the standard data that meets the pattern requirements.
[0035] The vector database generation module is used to vectorize the standard data text and build a database, store the vectorized text into the constructed database, and add a key value with an identification function to the standard data. Through the identification value, the vector data corresponding to the standard data that meets the pattern is extracted from the standard vector database to form a vectorized database that meets the pattern.
[0036] The prompt word construction module is used to construct a prompt word template that meets the standard usage application scenario.
[0037] The feature vectorization module vectorizes the user input and obtains the input text vector features.
[0038] The knowledge base retrieval module uses a combination of fuzzy matching and embedding-based retrieval technology to search for the standard text segment most similar to the input text vector in the standard vector database.
[0039] The content stitching module uses a large model to perform intent recognition and context understanding, integrates user input with the background and knowledge in standard text segments, and directly gives answers or generates explanations, summaries, or related information lists based on the complexity of the questions entered by the user.
[0040] Compared with the prior art, the present invention has the following advantages:
[0041] The present invention provides a method for standard query, retrieval, and question-answering, which applies large model technology, data preprocessing technology, prompt word engineering technology, standard professional prior knowledge, etc., to accurately realize the retrieval and query functions of standard text content in the form of question and answer.
[0042] The present invention is aimed at personnel in the standards industry such as standard compilation, standard use, and standard management, and solves the problems faced by such personnel when performing tasks such as standard query, standard search, and standard comparison, such as inefficient search, inaccurate search, and reliance on prior knowledge.
[0043] The standard text parsing module of the present invention is based on rules, which can quickly and accurately structure the standard text and add logical links. The present invention constructs a knowledge base search module, and through the combination of different text retrieval methods, the search scope is expanded, and the accuracy of search results is improved. Through the pattern matching method, before semantic retrieval, the pattern matching method is first applied to perform format retrieval. In the two processes of standard text processing and user input processing, pattern conversion and pattern construction processes are respectively added to further improve the retrieval accuracy. Through the prompt word construction module, the prompt words that conform to the usage habits of the standard industry are constructed by combining the characteristics of the standard industry through the thinking chain method. By combining the large model tool with the standard industry, an answer is given or an explanation, summary or related information list is generated according to the complexity of the question input by the user, thereby improving the user experience, and having the advantages of friendly interaction, fast knowledge base construction, accurate retrieval results and high query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A flow chart of a method for standard query, retrieval, and question-answering in an embodiment of the present invention;
[0045] Figure 2 A method for constructing a standard classification framework in an embodiment of the present invention;
[0046] Figure 3 This is a result diagram of Example 1 of standard knowledge retrieval based on knowledge graph in an embodiment of the present invention;
[0047] Figure 4 This is a result diagram of Example 2 of standard knowledge retrieval based on knowledge graph in an embodiment of the present invention;
[0048] Figure 5 This is a result diagram of Example 3 of standard knowledge retrieval based on knowledge graph in an embodiment of the present invention;
[0049] Figure 6 This is a graph of the search results based on the hash table keywords in an embodiment of the present invention;
[0050] Figure 7 This is a schematic diagram of a standard original text in Example 1 of large model knowledge retrieval in an embodiment of the present invention;
[0051] Figure 8 This is a retrieval result diagram of example 1 of standard knowledge retrieval based on a large model in an embodiment of the present invention;
[0052] Fig. 9 This is a schematic diagram of the standard original text in Example 2 of large-scale standard knowledge retrieval in an embodiment of the present invention;
[0053] Fig.10 This is a retrieval result diagram of Example 2 of standard knowledge retrieval based on a large model in an embodiment of the present invention;
[0054] Fig.11 This is a schematic diagram of the standard original text of Example 3 of large model knowledge retrieval in an embodiment of the present invention;
[0055] Fig.12 This is a retrieval result diagram of Example 3 of standard knowledge retrieval based on a large model in an embodiment of the present invention;
[0056] Fig.13 This is a schematic diagram of the standard original text of Example 4 of large model knowledge retrieval in an embodiment of the present invention;
[0057] Fig.14 This is a retrieval result diagram of standard knowledge retrieval example 4 based on a large model in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0059] like Figure 1 As shown, the technical solution of the present invention provides a method for standard query, retrieval, and question answering, comprising the following steps:
[0060] Step 1: Systematically search the standards, classify them according to the classification rules, and build a standard classification library;
[0061] Step 2: preprocess the standard text to obtain standard parsing data with logical relationships;
[0062] Step 3: Based on the user input content, a mode conversion model of the field is constructed through a standard document dataset of the corresponding field classification in the corresponding classification library, and special mode input data is generated through the mode conversion model;
[0063] Step 4: Pattern matching is performed on the special mode input data and the standard parsed data to obtain standard data that meets the mode requirements;
[0064] Step 5: vectorize the standard data text obtained in step 4 and store it in a database to build a vector database, and add a key value with an identification function to the standard data;
[0065] Step 6: Extract vector data corresponding to the standard data of the pattern from the standard vector database, and construct a vectorized database that conforms to the pattern;
[0066] Step 7: Construct a prompt word template that meets the standard usage application scenario;
[0067] Step 8: After the user inputs the text, the user input is vectorized to obtain the input text vector features;
[0068] Step 9: Search in the standard vector database to find the standard text segment that is most similar to the input text vector;
[0069] Step 10: Embed the user input and the standard text segment into the prompt word template, use the large model to realize intent recognition and context understanding, give an answer or generate an explanation, summary or related information list based on the complexity of the question entered by the user.
[0070] In one embodiment of the present invention, a standard classification method for step 1 is provided, which is as follows: systematically collect standard text data related to a specific field or multiple fields, construct a standard classification module, define and determine a knowledge category system for classifying standard texts according to the standard name, classify the standards according to different systems, and use the classification method provided in this embodiment to perform classification. Figure 2 shown.
[0071] In one embodiment of the present invention, a preprocessing method for step 2 is provided. According to the requirements of GB / T 1.1-2020 "Guidelines for Standardization Work Part 1: Structure and Drafting Rules for Standardization Documents", a standard text preprocessing module is constructed to parse the standard text, extract text, pictures, tables and other data, and logically link the standard title, chapter title, section title, article title and other information with text, pictures, tables and other data. At the same time, a pattern is constructed according to the standard category, characteristics and format, etc., to obtain standard parsed data with logical relationships and pattern types.
[0072] In one embodiment of the present invention, a user input mode conversion method for step 3 is provided. For the user input content, a mode conversion model for the field is constructed using a standard document dataset in a specific field based on technologies such as knowledge classification and knowledge extraction. The model automatically reads the user input, intelligently generates more friendly and accurate description information for the standard file mode, and generates input data for the special mode.
[0073] In one embodiment of the present invention, in step 4, a pattern matching tool such as Xerces or Trang is used to perform pattern matching on the special pattern input data and the standard parsed data to obtain standard data that meets the pattern requirements.
[0074] In one embodiment of the present invention, in step 5, a vector database is generated, standard data with a specific pattern is sliced according to a specific length, the sliced data is input into the Embedding large model for feature extraction, and the extracted vectorized features are stored in vector databases such as Faiss and Milvus. In the process of constructing the standard vector database, a key value with an identification function is added.
[0075] In one embodiment of the present invention, in step 6, the pattern data is vectorized, and vector data corresponding to the pattern standard data is extracted from the standard vector database through the identification value to form a vectorized database that conforms to the pattern.
[0076] In one embodiment of the present invention, in step 7, a prompt word template that meets the standard application scenario is constructed by means of a chain of thought, simulating the human thinking process of solving such problems, decomposing complex problems into a series of logical steps, and guiding the model to think and solve them step by step. Clarify the specific problems in the standard usage scenario, and understand the background, knowledge and logic required for the problem through the professional experience of the standard industry; decompose the standard application task into several subtasks, design related prompt words in the subtasks, and each prompt word guides the completion of a subtask; provide sufficient contextual information in the prompt word to guide the model, from simple to complex, to gradually build a complete chain of thought, and then build a suitable prompt word template.
[0077] In one embodiment of the present invention, in step 8, the user input is vectorized through the Embedding model to obtain input text vector features.
[0078] In one embodiment of the present invention, step 9 specifically includes the following steps: knowledge base retrieval, constructing a knowledge base retrieval module, searching in a standard vector database using a combination of fuzzy matching and embedding-based retrieval technology to improve the search range and search accuracy, and searching for the standard text segment that is most similar to the input text vector.
[0079] In one embodiment of the present invention, in step 10, a large model is generated, and the user input and the standard text segment are embedded in the prompt word template. The large model is used to realize intent recognition and context understanding, integrate the user input and the background and knowledge in the standard text segment, and can directly give an answer or generate an explanation, summary or related information list based on the complexity of the question input by the user, thereby improving the user's experience. With the use of tools or systems built based on this method, the large model can continuously optimize its processing effect on the content, iterate and evolve, and improve accuracy by continuously learning the user's usage habits and user feedback.
[0080] The effects of the standard query, retrieval, and question-answering methods provided by the present invention are verified as follows: Figures 3 to 5 As shown in Figure 2, this is an example of standard knowledge retrieval based on knowledge graph. Since the standard knowledge retrieval method based on knowledge graph has extremely high requirements for standard data processing, it not only requires structural processing by domain experts, but also requires standard entities, attributes, and relationships. If they are not labeled, as in Example 2, this method cannot display the results. The retrieval feedback results of the standard knowledge retrieval method based on knowledge graph show that the human-computer interaction method is not friendly.
[0081] like Figure 6 As shown in the figure, the search results are based on the hash table keywords. Figures 7 to 14 As shown, the standard original texts and search results of 4 groups of examples using the invention of the present invention are shown. By comparing the present invention with the two traditional methods, it can be seen that the search based on keywords and knowledge graphs cannot understand deeper semantic information, and the feedback information is the similarity ranking result. In Example 1, it can be seen that in the large model retrieval method, the user's input is more inclined to daily language, and the human-computer interaction method is more friendly; in Examples 2 and 4, the large model can understand the details of the user's questions, obtain answers in complex table data, and reorganize them into natural language for external output; in Example 3, the large model method can re-edit the results into a table output instead of simply outputting a picture, and the user can make a deeper application of the table results.
[0082] In addition to providing a method for standard query, retrieval, and question-answering, the technical solution of the present invention further provides a system for implementing the above method, the system comprising:
[0083] The standard classification module defines and determines the knowledge category system used to classify standard texts based on the standard name, and classifies the standards according to different systems.
[0084] Standard text preprocessing, parsing the standard text to obtain standard parsed data with logical relationships and pattern types.
[0085] The user input mode conversion module uses a domain-specific standard document dataset to construct a mode conversion model for the domain and generate input data for a dedicated mode based on the user input content.
[0086] The pattern matching module is used to perform pattern matching on the special pattern input data and the standard parsed data to obtain the standard data that meets the pattern requirements.
[0087] The vector database generation module is used to vectorize the standard data text and build a database, store the vectorized text into the constructed database, and add a key value with an identification function to the standard data. Through the identification value, the vector data corresponding to the standard data that meets the pattern is extracted from the standard vector database to form a vectorized database that meets the pattern.
[0088] The prompt word construction module is used to construct a prompt word template that meets the standard usage application scenario.
[0089] The feature vectorization module vectorizes the user input and obtains the input text vector features.
[0090] The knowledge base retrieval module uses a combination of fuzzy matching and embedding-based retrieval technology to search for the standard text segment most similar to the input text vector in the standard vector database.
[0091] The content stitching module uses a large model to perform intent recognition and context understanding, integrates user input with the background and knowledge in standard text segments, and directly gives answers or generates explanations, summaries, or related information lists based on the complexity of the questions entered by the user.
[0092] Compared with the standard text retrieval method based on knowledge graph, the present invention is convenient and fast in the early standard text preprocessing process, does not require the intervention of more industry standard knowledge, and the workload of data processing is much less. There is no need for excessive manual intervention. Most of the work can be automated through code writing to complete data processing, while the construction of knowledge graph requires practitioners with certain experience to identify entities and relationships and manually annotate these data; the text retrieval method based on knowledge graph requires manual dynamic updating to reflect the latest knowledge and information, while the present invention only needs to upload knowledge documents and the system will automatically complete the knowledge update; the text retrieval method based on knowledge graph requires users to adapt to the query language and interface of the knowledge graph when inputting retrieval information, and they need to invest energy in learning, which is not friendly to first-time users. The present invention can realize the retrieval of standard text by using the daily communication language of users, so it can be quickly started.
[0093] Compared with the keyword retrieval method based on hash table, the present invention can realize extended query and improve the relevance of retrieval through semantic understanding of context, while the method based on hash table focuses on keyword retrieval; when processing ambiguous words, slang and new words, the present invention can make use of the language understanding ability of the large model, while the keyword method of hash table wants to identify these ambiguous words, but when constructing the hash table, these words are added to the hash table as key values, which may result in omissions; when constructing the keyword hash table, manual data processing operations are required to match the keywords with the content in the text, which is a very time-consuming and labor-intensive task, while the present invention, when processing text data, has simple steps and clear logic, and most of the work can be completed automatically with the help of code.
[0094] The above are preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A method for standard query, retrieval, and question answering, characterized in that: The method comprises the following steps: Step 1: Systematically search the standards, classify them according to the classification rules, and build a standard classification library; Step 2: preprocess the standard text to obtain standard parsing data with logical relationships; Step 3: Based on the user input content, a mode conversion model of the field is constructed through a standard document dataset of the corresponding field classification in the corresponding classification library, and special mode input data is generated through the mode conversion model; Step 4: Pattern matching is performed on the special mode input data and the standard parsed data to obtain standard data that meets the mode requirements; Step 5: vectorize the standard data text obtained in step 4, store it in a database, build a vector database, and add a key value with an identification function to the standard data; Step 6: Extract vector data corresponding to the standard data of the pattern from the standard vector database, and construct a vectorized database that conforms to the pattern; Step 7: Construct a prompt word template that meets the standard usage application scenario; Step 8: After the user inputs the text, the user input is vectorized to obtain the input text vector features; Step 9: Search in the standard vector database to find the standard text segment that is most similar to the input text vector; Step 10: Embed the user input and the standard text segment into the prompt word template, use the large model to realize intent recognition and context understanding, give an answer or generate an explanation, summary or related information list based on the complexity of the question entered by the user.
2. A standard query, retrieval, question-answering method as claimed in claim 1, characterized in that: In step 1, the standards for standard classification include: standard name, definition and determination of the knowledge category system used to classify standard texts.
3. A standard query, retrieval, question-answering method as claimed in claim 2, characterized in that: In step 2, the method of preprocessing the standard text is: parsing the standard text, extracting text, pictures, and table data, and logically linking the standard title, chapter title, section title, and article title information with the text, pictures, and table data.
4. A standard query, retrieval, question-answering method as claimed in claim 3, characterized in that: In step 3, a pattern conversion model in this field is constructed based on technologies such as knowledge classification and knowledge extraction.
5. A standard query, retrieval, question-answering method as claimed in claim 4, characterized in that: In step 4, pattern matching tools such as Xerces and Trang are used to perform pattern matching on the special pattern input data and the standard parsed data.
6. A standard query, retrieval, question-answering method as claimed in claim 5, characterized in that: In step 5, the method for constructing a vector database is: slicing the standard data with a specific pattern according to a specific length, inputting the sliced data into the Embedding large model for feature extraction, and storing the extracted vectorized features in vector databases such as Faiss and Milvus.
7. A standard query, retrieval, question-answering method as claimed in claim 6, characterized in that: In step 7, a prompt word template that meets the standard usage application scenario is constructed by means of a thought chain.
8. A standard query, retrieval, question-answering method as claimed in claim 7, characterized in that: In step 8, the user input is vectorized through the Embedding model.
9. A standard query, retrieval, question-answering method as claimed in claim 8, characterized in that: In step 9, a search is performed in the standard vector database by combining fuzzy matching with an embedding-based retrieval technology.
10. A standard query, retrieval, and question-answering system, characterized in that: The system is used to implement the standard query, retrieval, and question-answering method according to any one of claims 1 to 9, and the system comprises: The standard classification module defines and determines the knowledge category system used to classify standard texts based on the standard name, and classifies the standards according to different systems; Standard text preprocessing: parsing the standard text to obtain standard parsing data with logical relationships and pattern types; The user input mode conversion module uses a standard document dataset in a specific field to construct a mode conversion model in the field and generate input data in a dedicated mode based on the user input content; A pattern matching module is used to perform pattern matching between the special pattern input data and the standard parsed data to obtain standard data that meets the pattern requirements; The vector database generation module is used to vectorize the standard data text and build a database, store the vectorized text into the constructed database, and add a key value with an identification function to the standard data. Through the identification value, the vector data corresponding to the standard data that meets the pattern is extracted from the standard vector database to form a vectorized database that meets the pattern. A prompt word construction module is used to construct a prompt word template that meets the standard usage application scenario; The feature vectorization module performs vectorization processing on user input to obtain input text vector features; The knowledge base retrieval module uses a combination of fuzzy matching and embedding-based retrieval technology to search for the standard text segment that is most similar to the input text vector in the standard vector database; The content stitching module uses a large model to perform intent recognition and context understanding, integrates user input with the background and knowledge in standard text segments, and directly gives answers or generates explanations, summaries, or related information lists based on the complexity of the questions entered by the user.
