Data processing method and device, equipment and computer medium
By determining and sorting document fragments from the document fragment library and using a large language model to process the target sorting results, the problems of low recall efficiency and duplicate document fragments in the prior art are solved, which significantly improves the accuracy and reliability of the answer results.
Patent Information
- Application Number
- CN202411366342.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-01-14
AI Technical Summary
In the existing data recall methods, the amount of recalled content is too large and cannot be inputted to the large language model, resulting in low recall efficiency and possible duplicate document fragments, which in turn affects the accuracy and reliability of the answer results.
By determining the initial document fragment from the document fragment library, sorting according to the relevance and similarity of the problem information, determining the target document, and using the large language model to process the target sorting results to generate answer results, the input information to the large language model is added Analysis and sorting process.
It improves the accuracy and reliability of the answer results generated based on the large language model, reduces the redundancy and irrelevant information of the recalled content, and improves the relevance of the recalled content.
Smart Images

Figure CN119311823A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of data recall, and in particular, relates to a data processing method, device, equipment and computer medium. Background Art
[0002] Conventional data recall methods usually use the questions input by the user as query conditions and return a set of document fragments that are highly relevant to the questions. These document fragments have certain similarities and correlations with the questions. However, a single fragment may not be able to fully answer the user's question, so the contextual content of the document where the fragment is located will be attached. In related technologies, the recall result is generally determined based on the full text of the document where the document fragment is located, but this will cause the following problems: the amount of recalled content is too large, the amount of input data of LLM has an upper limit, and all the recalled content cannot be input into LLM (LargeLanguage Model, referred to as large language model) to generate the final recall result, and there may be duplications in the document fragments in the final recall result, that is, multiple document fragments in the final recall result come from the same document, which in turn causes the problem of low recall efficiency. Summary of the invention
[0003] The embodiment of the present application provides an implementation scheme different from the related art to solve the technical problem in the related art that the answer results generated based on LLM are not accurate and reliable enough.
[0004] In a first aspect, the present application provides a data processing method, comprising:
[0005] In response to obtaining the input question information, determining at least one initial document fragment corresponding to the question information from a document fragment library;
[0006] sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment;
[0007] For each of the initial document fragments, determining a target document to which the initial document fragment belongs, and obtaining at least one target document;
[0008] Sorting the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result;
[0009] The target ranking result is processed using a preset large language model to obtain an answer result corresponding to the question information.
[0010] In a second aspect, the present application provides a data processing device, including:
[0011] a determining unit, configured to determine, in response to obtaining the input question information, at least one initial document fragment corresponding to the question information from a document fragment library;
[0012] A sorting unit, configured to sort the at least one initial document fragment according to relevance to the question information, to obtain a first sorting result for each of the initial document fragments;
[0013] The determining unit is further configured to determine, for each of the initial document fragments, a target document to which the initial document fragment belongs, and obtain at least one target document;
[0014] The sorting unit is further configured to sort the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result;
[0015] The processing unit is used to process the target ranking result by using a preset large language model to obtain an answer result corresponding to the question information.
[0016] In a third aspect, the present application provides an electronic device, including:
[0017] Processor; and
[0018] A memory, configured to store executable instructions of the processor;
[0019] The processor is configured to execute the first aspect or any method in any possible implementation manner of the first aspect by executing the executable instructions.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the computer program implements the first aspect, or any method in any possible implementation manner of the first aspect.
[0021] The present application provides a method for determining, in response to obtaining input question information, at least one initial document fragment corresponding to the question information from a document fragment library; sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment; determining, for each initial document fragment, a target document to which the initial document fragment belongs to obtain at least one target document; sorting the at least one target document based on the similarity between each initial document fragment and the question information and the first sorting result of each initial document fragment to obtain a target sorting result; and processing the target sorting result using a preset large language model to obtain an answer result corresponding to the question information. Compared with the related art, the method has an additional process of analyzing and sorting the input information of the large language model, which can improve the accuracy and reliability of the answer results generated based on the LLM. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0023] Figure 1a A basic flow chart of a knowledge base question and answer based on RAG technology provided in one embodiment of the present application;
[0024] Figure 1b A schematic diagram of the structure of a system provided in one embodiment of the present application;
[0025] Figure 2a A flowchart of a data processing method provided in one embodiment of the present application;
[0026] Figure 2b A schematic diagram of a method for determining a target ranking result provided in an embodiment of the present application;
[0027] Figure 2c A schematic diagram of display locations of recall results and answer results provided in an embodiment of the present application;
[0028] Figure 3 A schematic diagram of the structure of a data processing device provided in one embodiment of the present application;
[0029] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, but cannot be understood as limiting the present application.
[0031] The terms "first" and "second" etc. in the specification, claims and drawings of the embodiments of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0032] First, some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0033] RAG is a model architecture for natural language processing that combines retrieval and generation technologies. RAG combines an information retrieval component with a text generation model. RAG actually mounts a knowledge base outside of LLM. When a user asks a question, RAG retrieves the content of the external knowledge base and inserts relevant content fragments into the context prompt. Then, LLM generates corresponding answers based on the context of the conversation, the original prompt, and related knowledge. RAG's approach can greatly expand the knowledge scope of LLM, making it simple, lightweight, and low-cost, and is currently the mainstream direction for knowledge base question answering.
[0034] Markdown is a lightweight markup language used to write plain text documents and can be converted to HTML format. Markdown allows users to write documents in a plain text format that is easy to read and write. By adding some simple tags such as asterisks, pound signs, square brackets and parentheses, the text can be presented in different styles. The original intention of the design of this markup language is to achieve "easy to read and easy to write". Its syntax is influenced by a variety of markup languages, especially the format of plain text emails and HTML. The core feature of Markdown is simplicity, using simple symbols and characters to mark styles, organize structures and add links.
[0035] LLM (Large Language Model) refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. Large language models can handle a variety of natural language tasks, such as text classification, question-answering, and dialogue, and are an important path to artificial intelligence. Currently, large language models use a Transformer architecture and pre-training objectives (such as Language Modeling) similar to small models. The difference from small models is the increase in model size, training data, and computing resources.
[0036] BeautifulSoup is a Python library that can extract data from HTML or XML files. It can implement idiomatic document navigation, search, and modify documents through converters. BeautifulSoup will save hours or even days of work.
[0037] The API debugging platform allows developers to select the interface to be debugged in the debugging platform and enter the corresponding API key and request parameters to debug. This can reduce the development costs of developers and allow them to quickly get started and complete development.
[0038] In the related art, in some open R&D platforms provided for R&D personnel, the official documents of the open R&D platforms generally have original data in markdown format, which is mixed with a large number of HTML tags for special front-end rendering and display, as well as other miscellaneous data. However, this information is useless to LLM. Keeping this data will only lead to low content density and poor content relevance of the information retrieved, recalled, and provided to LLM, which will eventually lead to inaccurate and unreliable answers generated by LLM.
[0039] The inventor discovered through research that the specific Figure 1a As shown in the figure, the basic process of knowledge base question answering based on RAG technology is as follows:
[0040] 1. Load data (local data or online data)
[0041] 2. Convert unstructured data into text
[0042] 3. Develop and select a text segmentation strategy and choose a text splitter
[0043] 4. Split long content into chunks
[0044] 5. Vectorize the segmented text blocks into embeddings
[0045] 6. Store embeddings in a vector database
[0046] 7. Use vector similarity for retrieval
[0047] 8-9. Vectorize user queries into embeddings
[0048] 10. Use vector similarity for retrieval. Specifically, similar vector retrieval can be performed based on the vector database.
[0049] 11. Remove relevant text blocks
[0050] 12. Select the Prompt template
[0051] 13. Combine into Prompt (query + prompt template + related text block)
[0052] 14. Calling LLM
[0053] 15. Generate answers
[0054] In actual scenarios, when the open R&D platform recalls and displays the corresponding content based on the questions input by relevant personnel, the recall results are fragments, which means that the document used as the source data needs to be segmented into several fragments in advance. Each fragment is an independent piece of content, but in the actual document, semantically related pieces of content may not be segmented into the same fragment. Therefore, the recalled fragments may lack context, resulting in poor results in generating answers based on LLM.
[0055] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0056] The solution of this application is applicable to the open R&D platform. Figure 1b A schematic diagram of a system structure provided for an exemplary embodiment of the present application, the structure includes: a terminal device and a server, the aforementioned terminal device has a display screen for displaying relevant pages of the open R&D platform, some of the relevant pages include an input box for relevant personnel to input question information, and the relevant personnel can enter the question information in the input box to obtain the corresponding answer result. The server can be used to feed back the corresponding answer result to the terminal device according to the aforementioned question information for display by the terminal device.
[0057] In addition, the aforementioned servers are also used to:
[0058] In response to obtaining the input question information, determining at least one initial document fragment corresponding to the question information from a document fragment library;
[0059] sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment;
[0060] For each of the initial document fragments, determining a target document to which the initial document fragment belongs, and obtaining at least one target document;
[0061] Sorting the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result;
[0062] The target ranking result is processed using a preset large language model to obtain an answer result corresponding to the question information.
[0063] The execution principles and interaction processes of the various components in the system embodiment, such as the terminal device and the server, can be found in the description of the following method embodiments.
[0064] Figure 2a A flowchart of a data processing method provided for an exemplary embodiment of the present application is provided. The method may be applicable to a server. The method at least includes the following steps S201-S204:
[0065] S201, in response to obtaining input question information, determining at least one initial document fragment corresponding to the question information from a document fragment library;
[0066] Optionally, in the aforementioned at least one initial document segment, different initial document segments may be from the same document or from different documents. Each initial document segment is obtained by splitting the document.
[0067] Optionally, the initial document fragment corresponding to the question information refers to: a document fragment in the document fragment library whose similarity with the question information is greater than a preset similarity. The preset similarity can be set by relevant personnel.
[0068] Optionally, the initial document fragment corresponding to the question information refers to a document fragment in the document fragment library, whose matching degree with the question information is greater than a preset matching degree, and the aforementioned preset matching degree can be set by relevant personnel.
[0069] S202, sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment;
[0070] Specifically, the at least one initial document fragment may be sorted in descending order according to the similarity with the question information, to obtain a first sorting result of each initial document fragment.
[0071] Optionally, the first sorting result of the aforementioned initial document fragment may refer to a sorting sequence number;
[0072] S203, for each of the initial document fragments, determining a target document to which the initial document fragment belongs, and obtaining at least one target document;
[0073] Specifically, different initial document fragments may belong to the same target document or to different target documents.
[0074] S204, sorting the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result;
[0075] In some optional embodiments of the present application, in S204, based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments, the at least one target document is sorted to obtain a target sorting result, including the following S2041-S2044:
[0076] S2041. For each target document in the at least one target document, obtain at least one target document segment belonging to the target document in the at least one initial document segment;
[0077] S2042: for each of the target document segments, based on the second ranking result of the target document segment and the similarity between the target document segment and the question information, determine the score information corresponding to the target document segment;
[0078] In some optional embodiments of the present application, the second sorting result is a sorting sequence number, the first sorting result is negatively correlated with the score information corresponding to the target document fragment, and the similarity is positively correlated with the score information corresponding to the target document fragment.
[0079] Optionally, in the aforementioned S2042, based on the second ranking result of the target document fragment and the similarity between the target document fragment and the question information, determining the score information corresponding to the target document fragment includes:
[0080] Calculate the quotient of 1 and the first ranking result of the target document fragment; and use the product of the quotient and the similarity between the target document fragment and the question information as the score information corresponding to the target document fragment.
[0081] In some optional embodiments of the present application, the aforementioned S2042 may be specifically implemented by the following formula:
[0082]
[0083] Among them, S1 is the score information corresponding to the target document fragment, order is the second sorting result of the target document fragment, and score is the similarity between the target document fragment and the question information.
[0084] Further, see Figure 2b As shown, the aforementioned at least one initial document fragment refers to Figure 2b The target document is Figure 2b The original text 1, original text 2, and original text 3 in the above method are as follows. Through the above method, the total score corresponding to original text 1 is 0.92, the total score corresponding to original text 2 is 0.93, and the total score corresponding to original text 3 is 0.15. The target ranking result is original text 2, original text 1, and original text 3.
[0085] S2043, determining a total score of the target document according to the score information of each target document segment;
[0086] Optionally, the sum of the score information of each target document segment may be used as the total score of the target document.
[0087] S2044. Sort the at least one target document according to the total score of each target document to obtain a target sorting result.
[0088] Specifically, the at least one target document is sorted in descending order of total scores to obtain a target sorting result.
[0089] S205: Using a preset large language model, the target ranking result is processed to obtain an answer result corresponding to the question information.
[0090] Optionally, in the aforementioned S205, the target ranking result is processed using a preset large language model to obtain an answer result corresponding to the question information, including: inputting the target ranking result and the question information into the large language model to obtain an answer result corresponding to the question information.
[0091] Among them, the aforementioned large language model can be trained through sample data.
[0092] In some optional embodiments of the present application, the method further includes: sending the answer result to a client, so that the client displays the answer result.
[0093] The client may refer to a terminal corresponding to the question information, that is, the client and the input device of the question information are the same device.
[0094] In some optional embodiments of the present application, the target document is obtained by the following preprocessing method: obtaining document information of the document to be processed, the document information including at least one of the following information: document-related links, document directory, and document content; cleaning the document information to obtain the target document corresponding to the document to be processed.
[0095] The document to be processed is the source data for determining the answer result corresponding to the question information after the input question information is obtained.
[0096] Optionally, the aforementioned document directory may specifically refer to the level of the document on the document directory tree. When the document title is delayed update message, the document directory may be: server API / message / message card / delayed update message card.
[0097] Optionally, the aforementioned document content may include the document title and the content under the title.
[0098] In some optional embodiments of the present application, cleaning the document information includes at least one of the following:
[0099] Deleting the first content to be deleted, deleting the second content to be deleted, and adjusting the objects in the document information that do not conform to the preset format to objects that conform to the preset format;
[0100] The first content to be deleted includes at least one of the following: an image link in the document information that does not conform to a preset image link format, a video link in the document information that does not conform to a preset video link format, and a prompt label in the document information that does not conform to preset requirements;
[0101] The second content to be deleted includes at least one of the following: a document external resource link in the document information, a debugger button in the document information, and continuous line breaks in the document information.
[0102] In some optional embodiments of the present application, deleting the first content to be deleted includes: using the document information of the document to be processed, the document format of the document to be processed, and the first content to be deleted as input parameters of a preset data processing tool, running the data processing tool, and deleting the first content to be deleted.
[0103] In some optional embodiments of the present application, the image link corresponding to the img tag is an image link that does not conform to a preset image link format. This type of image link has no effect when placed in a source data document, and a large number of characters can be reduced by removing it.
[0104] In some optional embodiments of the present application, the aforementioned data processing tool may be a BeautifulSoup library, wherein BeautifulSoup is a Python library that can extract data from files such as HTML or XML.
[0105] In some optional embodiments of the present application, the video link corresponding to the md-video tag is a video link that does not conform to a preset video link format and has no effect when placed in a source data document. Removing it can reduce a large number of characters.
[0106] In some optional embodiments of the present application, the prompt label that does not meet the preset requirements is: a prompt label that does not correspond to any prompt content, and the prompt label that does not correspond to any prompt content may refer to an md-alert label that does not correspond to any prompt text.
[0107] In some optional embodiments of the present application, the document external resource link may refer to a link in the img syntax of markdown, which has no effect when placed in the source data document and can reduce a large number of characters after being removed.
[0108] In some optional embodiments of the present application, the aforementioned debugger button refers to a call-up button of the API debugger, which has no meaning for the content and can be removed.
[0109] In some optional embodiments of the present application, regarding the aforementioned continuous line breaks, after removing a large amount of useless data, a large number of blank lines may be generated in the document, so it is necessary to further compress the content to remove the continuous line breaks.
[0110] In some optional embodiments of the present application, the aforementioned preset format may be a markdown format, and an html table is an object that does not conform to the preset format. In this case, the BeautifulSoup library may be used to adjust the table in the document information that does not conform to the preset format to a table that conforms to the preset format.
[0111] For example, the format part of an HTML table is very long, resulting in extremely low information density. A large number of lines of content may only describe one line of table header and two lines of table content. In this case, you can use Python's BeautifulSoup library to convert the HTML table into a markdown table format through certain code logic.
[0112] In some optional embodiments of the present application, deleting the second content to be deleted includes the following S01-S03:
[0113] S01. Obtain a preset regular expression format; specifically, the format of the regular expression is the same as the format of the second content to be deleted.
[0114] S02, acquiring, from the document information of the document to be processed, second content to be deleted in the regular expression format;
[0115] S03: Delete the second content to be deleted.
[0116] In some optional embodiments of the present application, each of the initial document fragments is fed back as a recall result to a client corresponding to the question information, so that the client displays the recall result.
[0117] Accordingly, the aforementioned to-be-processed document is the source data for determining the corresponding recall result when the input question is obtained. Optionally, the aforementioned answer result can be regarded as a summary and conclusion of the recall result.
[0118] In some optional embodiments of the present application, the display positions of the answer results and the recall results can be found in Figure 2c shown.
[0119] Through the above scheme, the document pieces most relevant to the question information can be placed in front, thereby improving the relevance of the recalled content.
[0120] Through the solution of this application, after data cleaning of the document, the relevance of the recalled content is greatly improved, the accuracy of the answer results generated based on LLM is improved, and after re-recall and re-scoring, the accuracy and relevance of the answers generated by LLM are improved.
[0121] The present application provides a method for determining, in response to obtaining input question information, at least one initial document fragment corresponding to the question information from a document fragment library; sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment; determining, for each initial document fragment, a target document to which the initial document fragment belongs to obtain at least one target document; sorting the at least one target document based on the similarity between each initial document fragment and the question information and the first sorting result of each initial document fragment to obtain a target sorting result; and processing the target sorting result using a preset large language model to obtain an answer result corresponding to the question information. Compared with the related art, the method has an additional process of analyzing and sorting the input information of the large language model, which can improve the accuracy and reliability of the answer results generated based on the LLM.
[0122] Figure 3 A schematic diagram of the structure of a data processing device provided for an exemplary embodiment of the present application; wherein the device comprises:
[0123] A determination unit 31 is configured to determine at least one initial document fragment corresponding to the question information from a document fragment library in response to obtaining the input question information;
[0124] A sorting unit 32, configured to sort the at least one initial document fragment according to the relevance to the question information, to obtain a first sorting result of each initial document fragment;
[0125] The determining unit 31 is further configured to determine, for each of the initial document fragments, a target document to which the initial document fragment belongs, and obtain at least one target document;
[0126] The sorting unit 32 is further configured to sort the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result;
[0127] The processing unit 33 is used to process the target ranking result by using a preset large language model to obtain an answer result corresponding to the question information.
[0128] In some optional embodiments of the present application, the device is also used to: send the answer result to the client, so that the client displays the answer result.
[0129] In some optional embodiments of the present application, when the aforementioned device is used to sort the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result, it is specifically used to:
[0130] For each target document in the at least one target document, obtaining at least one target document segment belonging to the target document in the at least one initial document segment;
[0131] For each of the target document segments, based on the second ranking result of the target document segment and the similarity between the target document segment and the question information, determine the score information corresponding to the target document segment;
[0132] Determining the total score of the target document according to the score information of each target document segment;
[0133] The at least one target document is sorted according to the total score of each target document to obtain a target sorting result.
[0134] In some optional embodiments of the present application, the second sorting result is a sorting sequence number, the second sorting result is negatively correlated with the score information corresponding to the target document fragment, and the similarity is positively correlated with the score information corresponding to the target document fragment.
[0135] In some optional embodiments of the present application, the target document is obtained by the following preprocessing method: obtaining document information of the document to be processed, the document information including at least one of the following information: document-related links, document directory, and document content; cleaning the document information to obtain the target document corresponding to the document to be processed.
[0136] In some optional embodiments of the present application, when the aforementioned device is used to clean the document information, it is specifically used to perform at least one of the following:
[0137] Deleting the first content to be deleted, deleting the second content to be deleted, and adjusting the objects in the document information that do not conform to the preset format to objects that conform to the preset format;
[0138] The first content to be deleted includes at least one of the following: an image link in the document information that does not conform to a preset image link format, a video link in the document information that does not conform to a preset video link format, and a prompt label in the document information that does not conform to preset requirements;
[0139] The second content to be deleted includes at least one of the following: a document external resource link in the document information, a debugger button in the document information, and continuous line breaks in the document information.
[0140] In some optional embodiments of the present application, when the aforementioned device is used to delete the first content to be deleted, it is specifically used to: use the document information of the document to be processed, the document format of the document to be processed, and the first content to be deleted as input parameters of a preset data processing tool, run the data processing tool, and delete the first content to be deleted.
[0141] In some optional embodiments of the present application, when the aforementioned device is used to delete the second content to be deleted, it is specifically used to:
[0142] Get the preset regular expression format;
[0143] Acquire, from the document information of the document to be processed, the second content to be deleted in the regular expression format;
[0144] The second content to be deleted is deleted.
[0145] In some optional embodiments of the present application, the method further includes: feeding back each of the initial document fragments as a recall result to a client corresponding to the question information, so that the client displays the recall result.
[0146] The present application provides a method for determining, in response to obtaining input question information, at least one initial document fragment corresponding to the question information from a document fragment library; sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment; determining, for each initial document fragment, a target document to which the initial document fragment belongs to obtain at least one target document; sorting the at least one target document based on the similarity between each initial document fragment and the question information and the first sorting result of each initial document fragment to obtain a target sorting result; and processing the target sorting result using a preset large language model to obtain an answer result corresponding to the question information. Compared with the related art, the method has an additional process of analyzing and sorting the input information of the large language model, which can improve the accuracy and reliability of the answer results generated based on the LLM.
[0147] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions may refer to the method embodiment. To avoid repetition, no further description is given here. Specifically, the device may perform the above method embodiment, and the above and other operations and / or functions of each module in the device are the corresponding processes in each method in the above method embodiment, respectively, and no further description is given here for the sake of brevity.
[0148] The above describes the device of the embodiment of the present application from the perspective of the functional module in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, and can also be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method applied in conjunction with the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or a combination of hardware and software modules in the decoding processor to perform. Optionally, the software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory, and completes the steps in the above method embodiment in conjunction with its hardware.
[0149] Figure 4 is a schematic block diagram of an electronic device provided in an embodiment of the present application, and the electronic device may include:
[0150] The memory 401 and the processor 402, the memory 401 is used to store the computer program and transmit the program code to the processor 402. In other words, the processor 402 can call and run the computer program from the memory 401 to implement the method in the embodiment of the present application.
[0151] For example, the processor 402 may be configured to execute the above method embodiments according to instructions in the computer program.
[0152] In some embodiments of the present application, the processor 402 may include but is not limited to:
[0153] General-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0154] In some embodiments of the present application, the memory 401 includes but is not limited to:
[0155] Volatile memory and / or non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM) or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0156] In some embodiments of the present application, the computer program may be divided into one or more modules, which are stored in the memory 401 and executed by the processor 402 to complete the method provided by the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0157] like Figure 4 As shown, the electronic device may also include:
[0158] The transceiver 403 may be connected to the processor 402 or the memory 401 .
[0159] The processor 402 may control the transceiver 403 to communicate with other devices, specifically, to send information or data to other devices, or to receive information or data sent by other devices. The transceiver 403 may include a transmitter and a receiver. The transceiver 403 may further include an antenna, and the number of antennas may be one or more.
[0160] It should be understood that the various components in the electronic device are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0161] The present application also provides a computer storage medium on which a computer program is stored, and when the computer program is executed by a computer, the computer can perform the method of the above method embodiment. In other words, the present application embodiment also provides a computer program product containing instructions, and when the instructions are executed by a computer, the computer can perform the method of the above method embodiment.
[0162] When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integration. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (digital video disc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.
[0163] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments applied for herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0164] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the module is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0165] The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. For example, each functional module in each embodiment of the present application may be integrated into a processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0166] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data processing method, characterized in that: include: In response to obtaining the input question information, determining at least one initial document fragment corresponding to the question information from a document fragment library; sorting the at least one initial document fragment according to the relevance to the question information to obtain a first sorting result of each initial document fragment; For each of the initial document fragments, determining a target document to which the initial document fragment belongs, and obtaining at least one target document; Sorting the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result; The target ranking result is processed using a preset large language model to obtain an answer result corresponding to the question information.
2. The method according to claim 1, characterized in that The method further comprises: The answer result is sent to the client, so that the client displays the answer result.
3. The method according to claim 1, characterized in that Sorting the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result, including: For each target document in the at least one target document, obtaining at least one target document segment belonging to the target document in the at least one initial document segment; For each of the target document segments, based on the second ranking result of the target document segment and the similarity between the target document segment and the question information, determine the score information corresponding to the target document segment; Determining the total score of the target document according to the score information of each target document segment; The at least one target document is sorted according to the total score of each target document to obtain a target sorting result.
4. The method according to claim 3, characterized in that in, The second sorting result is a sorting sequence number, the second sorting result is negatively correlated with the score information corresponding to the target document segment, and the similarity is positively correlated with the score information corresponding to the target document segment.
5. The method according to claim 1, characterized in that The target document is obtained by the following preprocessing method: Acquire document information of a document to be processed, wherein the document information includes at least one of the following information: a link related to the document, a document directory, and document content; The document information is cleaned to obtain a target document corresponding to the document to be processed.
6. The method according to claim 5, characterized in that Cleaning the document information includes at least one of the following: Deleting the first content to be deleted, deleting the second content to be deleted, and adjusting the objects in the document information that do not conform to the preset format to objects that conform to the preset format; The first content to be deleted includes at least one of the following: an image link in the document information that does not conform to a preset image link format, a video link in the document information that does not conform to a preset video link format, and a prompt label in the document information that does not conform to preset requirements; The second content to be deleted includes at least one of the following: a document external resource link in the document information, a debugger button in the document information, and continuous line breaks in the document information.
7. The method according to claim 6, characterized in that The deleting the first content to be deleted includes: The document information of the document to be processed, the document format of the document to be processed, and the first content to be deleted are used as input parameters of a preset data processing tool, and the data processing tool is run to delete the first content to be deleted.
8. The method according to claim 6, characterized in that The deleting the second content to be deleted includes: Get the preset regular expression format; Acquire, from the document information of the document to be processed, the second content to be deleted in the regular expression format; The second content to be deleted is deleted.
9. The method according to claim 1, characterized in that: The method further includes: feeding back each of the initial document fragments as a recall result to a client corresponding to the question information, so that the client displays the recall result.
10. A data processing device, characterized in that: include: a determining unit, configured to determine, in response to obtaining the input question information, at least one initial document fragment corresponding to the question information from a document fragment library; A sorting unit, configured to sort the at least one initial document fragment according to relevance to the question information, to obtain a first sorting result for each of the initial document fragments; The determining unit is further configured to determine, for each of the initial document fragments, a target document to which the initial document fragment belongs, and obtain at least one target document; The sorting unit is further configured to sort the at least one target document based on the similarity between each of the initial document fragments and the question information and the first sorting result of each of the initial document fragments to obtain a target sorting result; The processing unit is used to process the target ranking result by using a preset large language model to obtain an answer result corresponding to the question information.
11. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 9 by executing the executable instructions.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Information processing method and device based on large model, electronic equipment and storage medium
CN120429415A