Document searching method and device, electronic equipment and storage medium
By performing multi-path analysis and operation on document search requests, the shortcomings of a single-path search method are solved, efficient and accurate document search in diverse scenarios are achieved, and the comprehensiveness and accuracy of search results are improved.
Patent Information
- Application Number
- CN202510537646.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-19
AI Technical Summary
The document search method using a single search path in the prior art cannot effectively deal with diverse document search scenarios, resulting in insufficient comprehensiveness and accuracy of search results.
By analyzing the document search request, multiple search paths are determined, and corresponding document search operations are performed separately, combining the final results to generate comprehensive search results.
It realizes efficient and accurate document search in various search scenarios, significantly improving the comprehensiveness and accuracy of search results.
Smart Images

Figure CN120508631A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a document search method, device, electronic device, and storage medium. Background Art
[0002] Document search refers to the process of finding specific information required by a user within a collection of documents. Its core goal is to quickly and accurately locate documents relevant to the user's query. Document search is unique in that it targets unstructured data, typically in the form of rich text files such as PDF, Word, and HTML. Compared to structured data, unstructured data has no fixed format and is therefore more difficult to query. Existing document search technologies tend to employ a semantic matching search strategy, specifically converting documents into vectorized representations and matching the semantic vectors with the search keywords entered by the user to achieve document search.
[0003] However, in practice, document search scenarios are diverse, including but not limited to meticulous screening of file categories, precise location of file creation or publication time, specific queries on file senders, in-depth searches for file authors, and direct searches for file titles. Faced with these diverse search needs, a single search path is insufficient in practice. Summary of the Invention
[0004] The present application provides a document search method, device, electronic device and storage medium to solve the technical problem that the document search method using a single search path in the prior art cannot well cope with diversified document search scenarios.
[0005] In a first aspect, the present application provides a document search method, the method comprising:
[0006] Obtaining a document search request, and parsing the document search request to determine multiple search paths;
[0007] Executing corresponding document search operations according to the multiple search paths respectively to obtain document search results for each of the search paths;
[0008] A final document search result is determined based on the document search results of the multiple search paths.
[0009] In a possible implementation, parsing the document search request to determine multiple search paths includes:
[0010] parsing the document search request, classifying information in the document search request, and determining multiple search paths based on the classification;
[0011] The document search request is parsed, information in the document search request is classified, and multiple search paths are determined based on the classification, including:
[0012] Inputting the document search request as a first prompt word into a search request disassembly model, wherein the search request disassembly model processes the document search request based on a classification rule to obtain multiple search paths;
[0013] Alternatively, the document search request is filled into a preset first prompt word template to obtain a first prompt word, wherein the first prompt word template defines classification rules for different search paths; the first prompt word is input into a search request decomposition model to obtain multiple search paths.
[0014] In a possible implementation, the multiple search paths include a first search path based on text semantics, and performing a corresponding document search operation according to the first search path to obtain document search results of the first search path includes:
[0015] Generating search keywords at different levels according to the document search request;
[0016] The following processing is performed for each document in the document library:
[0017] extracting text content at different levels from the document;
[0018] Perform semantic matching on the search keywords at the same level with the corresponding text content to obtain semantic matching results between the documents at different levels and the document search request;
[0019] Determining a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request;
[0020] According to the final semantic matching result between each document in the document library and the document search request, the document search results of the first search path are determined from the document library.
[0021] In a possible implementation, generating search keywords at different levels according to the document search request includes:
[0022] generating a first-level search keyword and a second-level search keyword according to the document search request;
[0023] Extracting text content at different levels from the document includes:
[0024] Extracting summary text of the document, and determining the summary text as first-level text content;
[0025] Dividing the document into blocks, and determining each text block as second-level text content;
[0026] The semantic matching of the search keywords at the same level with the corresponding text content to obtain semantic matching results between the documents at different levels and the document search request includes:
[0027] Performing semantic matching on the first-level search keyword and the first-level text content to obtain a semantic matching result between the document at the first level and the document search request;
[0028] The second-level search keyword is semantically matched with the second-level text content to obtain a semantic matching result between the document at the second level and the document search request.
[0029] In a possible implementation, determining a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request includes:
[0030] The semantic matching results between the document and the document search request at different levels are weighted and summed to obtain a final semantic matching result between the document and the document search request.
[0031] In a possible implementation, the multiple search paths include a second search path based on text semantics, and performing a corresponding document search operation according to the second search path to obtain document search results of the second search path includes:
[0032] Extracting the target document title to be searched from the document search request;
[0033] The following processing is performed for each document in the document library:
[0034] Get the document title of the document;
[0035] Performing semantic matching between the document title and the target document title to obtain a semantic matching result between the document and the document search request;
[0036] According to the semantic matching result, the document search results of the second search path are determined from the document library.
[0037] In a possible implementation, the multiple search paths include a third search path based on text semantics, and performing a corresponding document search operation according to the third search path to obtain document search results of the third search path includes:
[0038] Extracting a target document category to be searched from the document search request;
[0039] The following processing is performed for each document in the document library:
[0040] Obtaining the document category of the document;
[0041] Performing semantic matching on the document category of the document and the target document category to obtain a semantic matching result between the document and the document search request;
[0042] According to the semantic matching result, the document search result of the third search path is determined from the document library.
[0043] In one possible implementation, the multiple search paths include a fourth search path based on document metadata, and performing a corresponding document search operation according to the fourth search path to obtain document search results of the fourth search path includes:
[0044] Extracting metadata of a target document to be searched from the document search request;
[0045] Get the metadata set for each document in the document library;
[0046] The document in the document library whose metadata set contains the metadata of the target document is determined as the document search result of the fourth search path.
[0047] In a possible implementation, determining the final document search results based on the document search results of the multiple search paths includes:
[0048] The document search results of the multiple search paths and the document search request are input into a document ranking model to obtain a document search result list output by the document ranking model.
[0049] In one possible implementation, the document search operation is performed in the following manner to obtain the document search results:
[0050] Performing a document search operation according to the document search request and a pre-built document information library to obtain the document search results;
[0051] The document information library at least includes the document title, document summary, and document category of the stored document;
[0052] The document title, document summary, and document category of the stored document are obtained in the following manner:
[0053] Inputting the incoming document as a third prompt word into a document information extraction model, wherein the document information extraction model processes the incoming document based on a document classification rule to obtain a document category of the incoming document, processes the incoming document based on a title rule to obtain a document title of the incoming document, and processes the incoming document based on a summary rule to obtain a document summary of the incoming document;
[0054] Alternatively, the incoming document is filled into a preset third prompt word template to obtain a third prompt word, wherein the third prompt word template defines the document classification rule, the title rule and the summary rule; the third prompt word is input into the document information extraction model to obtain the document title, document summary and document category of the incoming document.
[0055] In a second aspect, the present application provides a document search device, the device comprising:
[0056] The acquisition module is used to obtain document search requests;
[0057] A search request disassembly module, configured to parse the document search request to determine multiple search paths;
[0058] A search module, configured to perform corresponding document search operations according to the multiple search paths, respectively, to obtain document search results for each of the search paths;
[0059] The result determination module is configured to determine a final document search result based on the document search results of the multiple search paths.
[0060] In a possible implementation, the search request disassembly module is specifically configured to:
[0061] parsing the document search request, classifying information in the document search request, and determining multiple search paths based on the classification;
[0062] The document search request is parsed, information in the document search request is classified, and multiple search paths are determined based on the classification, including:
[0063] Inputting the document search request as a first prompt word into a search request disassembly model, wherein the search request disassembly model processes the document search request based on a classification rule to obtain multiple search paths;
[0064] Alternatively, the document search request is filled into a preset first prompt word template to obtain a first prompt word, wherein the first prompt word template defines classification rules for different search paths; the first prompt word is input into a search request decomposition model to obtain multiple search paths.
[0065] In a possible implementation, the search module includes:
[0066] A keyword decomposition unit, configured to generate search keywords at different levels according to the document search request;
[0067] The text content decomposition unit is used to perform the following processing on each document in the document library: extracting text content of different levels from the document;
[0068] A content matching unit, configured to perform semantic matching between search keywords at the same level and corresponding text content, and obtain semantic matching results between the documents at different levels and the document search request;
[0069] A first determining unit, configured to determine a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request;
[0070] The second determining unit is configured to determine the document search results of the first search path from the document library according to a final semantic matching result between each document in the document library and the document search request.
[0071] In a possible implementation, the keyword decomposition unit is specifically configured to:
[0072] generating a first-level search keyword and a second-level search keyword according to the document search request;
[0073] The text content disassembly unit is specifically used to:
[0074] Extracting summary text of the document, and determining the summary text as first-level text content;
[0075] Dividing the document into blocks, and determining each text block as second-level text content;
[0076] The content matching unit is specifically configured to:
[0077] Performing semantic matching on the first-level search keyword and the first-level text content to obtain a semantic matching result between the document at the first level and the document search request;
[0078] The second-level search keyword is semantically matched with the second-level text content to obtain a semantic matching result between the document at the second level and the document search request.
[0079] In a possible implementation manner, the first determining unit is specifically configured to:
[0080] The semantic matching results between the document and the document search request at different levels are weighted and summed to obtain a final semantic matching result between the document and the document search request.
[0081] In a possible implementation, the multiple search paths include a second search path based on text semantics, and the search module includes:
[0082] A first title extraction unit, configured to extract the title of a target document to be searched from the document search request;
[0083] The second title extraction unit is configured to perform the following processing on each document in the document library: obtaining the document title of the document;
[0084] a title matching unit, configured to perform semantic matching between the document title of the document and the target document title, and obtain a semantic matching result between the document and the document search request;
[0085] A third determining unit is configured to determine, from the document library, document search results of the second search path according to the semantic matching result.
[0086] In a possible implementation, the multiple search paths include a third search path based on text semantics, and the search module includes:
[0087] A first category extraction unit, configured to extract a target document category to be searched from the document search request;
[0088] The second category extraction unit is configured to perform the following processing on each document in the document library: obtaining the document category of the document;
[0089] a category matching unit, configured to perform semantic matching between the document category of the document and the target document category to obtain a semantic matching result between the document and the document search request;
[0090] The fourth determining unit is configured to determine the document search results of the third search path from the document library according to the semantic matching result.
[0091] In a possible implementation, the multiple search paths include a fourth search path based on document metadata, and the search module includes:
[0092] A first metadata extraction unit, configured to extract metadata of a target document to be searched from the document search request;
[0093] A second metadata extraction unit is used to obtain a metadata set of each document in the document library;
[0094] The fifth determining unit is configured to determine, in the document library, a document whose metadata set contains the metadata of the target document as a document search result of the fourth search path.
[0095] In a possible implementation, the result determination module is specifically configured to:
[0096] The document search results of the multiple search paths and the document search request are input into a document ranking model to obtain a document search result list output by the document ranking model.
[0097] In a possible implementation, the search module is specifically configured to:
[0098] Performing a document search operation according to the document search request and a pre-built document information library to obtain the document search results;
[0099] The document information library at least includes the document title, document summary, and document category of the stored document;
[0100] The device also includes: a document information library construction module for
[0101] Inputting the incoming document as a third prompt word into a document information extraction model, wherein the document information extraction model processes the incoming document based on a document classification rule to obtain a document category of the incoming document, processes the incoming document based on a title rule to obtain a document title of the incoming document, and processes the incoming document based on a summary rule to obtain a document summary of the incoming document;
[0102] Alternatively, the incoming document is filled into a preset third prompt word template to obtain a third prompt word, wherein the third prompt word template defines the document classification rule, the title rule and the summary rule; the third prompt word is input into the document information extraction model to obtain the document title, document summary and document category of the incoming document.
[0103] In a third aspect, the present application provides an electronic device comprising: a processor and a memory, wherein the processor is configured to execute a document search program stored in the memory to implement the document search method described in any one of the first aspects.
[0104] In a fourth aspect, the present application provides a storage medium storing one or more programs, which can be executed by one or more processors to implement the document search method described in any one of the first aspects.
[0105] The above-mentioned technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application parses the document search request to determine multiple search paths; performs corresponding document search operations according to the multiple search paths to obtain document search results for each search path; determines the final document search results based on the document search results of the multiple search paths, and provides a document search service architecture that is compatible with multiple search paths. This architecture can meet the needs of searches in various scenarios, and at the same time, by executing multiple search paths in parallel, it can recall potential related documents more widely, thereby significantly improving the comprehensiveness and accuracy of the search results, and providing users with more accurate and efficient document search services. BRIEF DESCRIPTION OF THE DRAWINGS
[0106] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0107] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0108] One or more embodiments are exemplarily illustrated by pictures in the corresponding drawings. These exemplifications do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements. Unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0109] Figure 1 A flowchart of an embodiment of a document search method provided in an embodiment of the present application;
[0110] Figure 2 A flowchart of another document search method provided in an embodiment of the present application;
[0111] Figure 3 A flowchart of another document search method provided in an embodiment of the present application;
[0112] Figure 4 A flowchart of another document search method provided in an embodiment of the present application;
[0113] Figure 5 A flowchart of another document search method provided in an embodiment of the present application;
[0114] Figure 6 A block diagram of an embodiment of a document search device provided in an embodiment of the present application;
[0115] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0116] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0117] The disclosure below provides many different embodiments or examples for implementing different structures of the present application. In order to simplify the disclosure of the present application, the components and settings of specific examples are described below. Of course, these are merely examples and are not intended to limit the present application. In addition, the present application may repeat reference numbers and / or letters in different examples. Such repetition is for the purpose of simplicity and clarity and does not in itself indicate the relationship between the various embodiments and / or settings discussed.
[0118] In order to solve the technical problem that the document search method using a single search path in the prior art cannot cope well with diversified document search scenarios, the present application provides a document search method, device, electronic device and storage medium, which can provide a document search service architecture that is compatible with multiple search paths. This architecture can meet the needs of searches in various scenarios and provide users with more accurate and efficient document search services.
[0119] Figure 1 A flowchart of an embodiment of a document search method provided in an embodiment of the present application.
[0120] like Figure 1 As shown, the process includes the following steps:
[0121] Step 101: Obtain a document search request, and parse the document search request to determine multiple search paths.
[0122] A document search request is used to trigger the execution subject of an embodiment of the present application to perform a document search. It typically describes key information about the document that the user wishes to search for. In one embodiment, the document search request can be an instruction expressed in natural language, for example, "Help me search for documents related to machine learning that Xiao Ming sent yesterday." In actual applications, users can input a document search request expressed in natural language to the execution subject of an embodiment of the present application through an input box on the display interface, voice input, or other interactive methods.
[0123] A search path refers to the direction and strategy for guiding document searches. Different search paths correspond to different document search operations. Specifically, in actual applications, document searches are not limited to content searches alone; they are often closely linked to factors such as the sender, sending time, and content classification. For example, in the example above, "Help me search for documents about machine learning sent by Xiao Ming yesterday" involves three search paths: the sending time of the file (e.g., yesterday), the sender of the file (e.g., Xiao Ming), and the subject content of the file (e.g., machine learning). For the two search paths of sending time and sender, a detailed search can be performed directly in the document's metadata (i.e., data describing the document's attributes) using keywords (e.g., specific date and Xiao Ming). For the search path of subject content, a deeper semantic search can be performed based on keywords (e.g., machine learning).
[0124] Based on this, in step 101, after obtaining a document search request, the document search request is first parsed to determine multiple clear and specific search paths for clearly guiding subsequent document search operations. In one embodiment of the present application, the document search request is parsed to determine multiple search paths. To parse the document search request, the information in the document search request is classified, and multiple search paths are determined based on the classification.
[0125] In one embodiment, parsing a document search request to determine multiple search paths includes inputting the document search request as a first prompt into a search request decomposition model to obtain multiple search paths. The search request decomposition model decomposes the document search request based on multiple pre-defined search paths and classification rules for different search paths to obtain the multiple search paths. The search paths and classification rules for different search paths are described in detail below.
[0126] In another embodiment of the present application, before inputting the document search request as the first prompt word into the search request decomposition model, the following steps may be performed: entering the document search request into a preset first prompt word template to obtain the first prompt word, and inputting the obtained first prompt word into the search request decomposition model to obtain multiple search paths. The first prompt word template defines multiple search paths and classification rules for different search paths. For example, the first prompt word template is:
[0127] Role positioning: You are an intelligent assistant proficient in query processing. Now you are required to perform detailed analysis and classification of received document search requests.
[0128] Task Description: Given a query request, decompose it into multiple search paths as appropriate based on your judgment. If the query meets one of the conditions of a specific search, it will be classified into the corresponding path category; otherwise, it will be classified as a content search by default.
[0129] In one embodiment of the present application, the classification rules may include:
[0130] Time search (time_search): If the query contains specific time information, you need to search for time.
[0131] Author search (author_search): If the query is for the author of the document, you need to search by author.
[0132] Sender search (sender_search): If the query involves the sender of the document, you need to search by sender.
[0133] Title search (title_search): If the query focuses on the title of the document, you need to search for the title.
[0134] Content classification search (content_classify_search): If the query is to search based on the content classification of the document, such as a specific topic or category.
[0135] Content search (content_search): If the query does not meet the conditions of the five specific searches mentioned above, it will be considered a content search by default, that is, searching for specific content in the document.
[0136] In one embodiment of the present application, the output format may also be limited, for example:
[0137] You need to output keywords in JSON format. Based on the six classification rules in the above example, the JSON can contain the following six keys:
[0138] "time_search": If the query requires searching by time, relevant information is provided under this key;
[0139] "author_search": If the query requires searching by author, provide relevant information under this key;
[0140] "sender_search": If the query requires searching by sender, provide relevant information under this key;
[0141] "title_search": If the query requires searching by title, provide relevant information under this key;
[0142] "content_classify_search": If the query requires a search by content classification, provide relevant information under this key;
[0143] "content_search": If the query is the default content search, relevant information is provided under this key.
[0144] The above examples illustrate six search paths that can be defined in the first prompt word template: time search, author search, sender search, title search, content category search, and content search, as well as the classification rules for each of these six search paths. Other search paths can be expanded and are not limited in this application.
[0145] As an optional implementation, the search request decomposition model described above can be implemented using a large language model. Compared to traditional models, using a large language model to decompose search paths has the following advantages, including but not limited to:
[0146] (1) Rapid deployment and modification. For example, in the first prompt word template in the above example, six search paths are designed. However, in actual applications, the search paths may be changed and upgraded at any time based on user feedback and improvements. In this case, only the first prompt word template needs to be adjusted.
[0147] (2) Multi-task parallelism: Query conditions can be extracted and classified simultaneously, thus reducing the transmission of errors.
[0148] Step 102: Execute corresponding document search operations according to the multiple search paths to obtain document search results for each search path.
[0149] As described in step 101, different search paths correspond to different search operations. Therefore, in step 102, the corresponding document search operations are executed based on the multiple search paths extracted from the document search request, obtaining document search results for each search path. This enables multi-path search and recall, with different search paths focusing on different search directions. This multi-path search and recall significantly improves the recall and precision of document searches.
[0150] In one embodiment, the plurality of search paths include at least two of the following search paths: content search, title search, content category search, author search, sender search, time search, and other search paths.
[0151] As for how to perform the corresponding document search operation under each search path, it will be explained in different embodiments below and will not be described in detail here.
[0152] Step 103: Determine a final document search result based on the document search results of the multiple search paths.
[0153] In one embodiment, the document search results of multiple search paths are merged into a final document search result, thereby significantly improving the comprehensiveness and accuracy of the document search result.
[0154] As an example, document search results from multiple search paths are sorted according to a set sorting rule to produce an ordered list of document search results. This approach aims to reorder the results after a multi-path search, placing documents most relevant to the user's document search needs at the top of the search results list. This approach not only greatly improves the user experience, allowing users to find the documents they truly need more quickly and conveniently, but also further enhances the accuracy and relevance of search results.
[0155] The ranking rules can be a comprehensive evaluation framework that integrates multiple evaluation factors, such as user relevance, information quality, user experience, and diversity. These evaluation factors usually do not exist in isolation, but are intertwined and jointly influence the position of each document in the final search result list.
[0156] User relevance is the foundation of the entire ranking process. This evaluation factor involves assessing how well each document matches the user's needs. Documents with higher relevance are more likely to be ranked higher in the search results list.
[0157] Information quality is a consideration of the document's content. High-quality documents should be accurate, complete, and timely, and they should be able to meet the user's query needs. This means that during the sorting process, priority is given to documents that are information-rich, accurate, and timely.
[0158] User experience focuses on the readability and usability of a document. A document with a clear structure, concise language, and easy-to-understand content tends to attract users' attention more quickly and help them find the information they need quickly. Therefore, when sorting, consider the document's reading experience to ensure that users can easily access the content they need.
[0159] Diversity requires displaying information from diverse sources and covering diverse aspects while maintaining relevance and quality. This not only enriches search results but also meets users' demand for diverse information and enhances the search experience.
[0160] As an optional implementation, document search results from multiple search paths and document search requests are input into a document ranking model. The document ranking model can then sort the document search results from multiple search paths based on the sorting rules in the example above, outputting a list of document search results. This implementation aims to use a large model to perform re-ranking after multiple searches, which is more efficient and convenient.
[0161] Furthermore, as an optional implementation, the above sorting rules are defined in the prompt word template of the document sorting model.
[0162] For example, the prompt words of the document ranking model are designed as follows:
[0163] Role positioning: You are a professional text sorting assistant, focusing on understanding and meeting users' document search needs.
[0164] Task Description: Your current task is to sort a set of matching content based on a given document search query {query}. This set of matching content is represented by key-value pairs, namely {match_list:match_content1->SOURCE1,match_content2->SOURCE2,...,match_contentN->SOURCEN}. match_list represents the list of documents that match the document search query, match_contentX represents the matching document content, and SOURCEX represents the source or identifier of the content.
[0165] Sorting rules:
[0166] User relevance: Evaluate each matching piece of content for its relevance to the search request from a user's perspective. The more relevant the content is to the user's actual needs, the higher it should be ranked.
[0167] Information quality: Consider factors such as content accuracy, completeness, and timeliness. High-quality information should be displayed first.
[0168] User experience: Consider how easy it is for users to read and understand the content. For example, information with a clear structure and concise language is easier for users to accept.
[0169] Diversity: While maintaining relevance and quality, try to display information from different sources and covering different aspects to meet the diverse needs of users.
[0170] Output requirements: Based on the above sorting rules, please output a list representing the relative order of matching content. Each element in the list should correspond to a matching content identifier (such as SOURCEX), and the order of the elements should reflect the degree of match between the content and the search query, sorted from highest to lowest.
[0171] As the examples above demonstrate, using a large model for post-multi-path search re-ranking can deeply explore the potential connections between document search requests and document content. This capability enables the large model to comprehensively consider multiple dimensions during the re-ranking process, including document relevance, information quality, timeliness, and user experience, thereby generating a more accurate and comprehensive ranking result. Furthermore, compared to traditional rule-matching methods, large-model re-ranking not only reduces the complexity and subjectivity of manually set rules, but also significantly improves ranking efficiency and accuracy. In summary, using a large model for post-multi-path search re-ranking can accurately capture user needs and quickly filter the most desirable content from a massive volume of documents.
[0172] The technical solution provided by the embodiment of the present application parses the document search request to determine multiple search paths; performs corresponding document search operations according to the multiple search paths to obtain document search results for each search path; determines the final document search results based on the document search results of the multiple search paths, and provides a document search service architecture that is compatible with multiple search paths. This architecture can meet the needs of searches in various scenarios, and by executing multiple search paths in parallel, it can more widely recall potential related documents, thereby significantly improving the comprehensiveness and accuracy of the search results, and providing users with more accurate and efficient document search services.
[0173] The above generally explains the document search method provided in the embodiments of the present application. The following describes the search process under different search paths through different embodiments.
[0174] Figure 2 A flowchart of another document search method provided in an embodiment of the present application. Figure 2 The process shown in Figure 1 Based on the process shown, the description is based on the first search path based on text semantics, and the corresponding document search operation is performed according to the first search path to obtain the document search results of the first search path. Here, the first search path based on text semantics refers to content search. Figure 2 As shown, the process includes the following steps:
[0175] Step 201: Generate search keywords at different levels according to a document search request.
[0176] Step 202: Perform the following processing for each document in the document library: extract text content at different levels from the document; perform semantic matching between search keywords at the same level and corresponding text content to obtain semantic matching results between documents at different levels and document search requests; determine the final semantic matching results between the document and the document search request based on the semantic matching results between the document at different levels and the document search request.
[0177] Step 203: Determine the document search results of the first search path from the document library according to the final semantic matching result between each document in the document library and the document search request.
[0178] For ease of understanding, steps 201 to 203 are described in a unified manner below:
[0179] First, step 201 aims to expand the search keywords in the document search request to introduce more and more standardized keywords to improve the recall rate of the search. It should be noted here that this expansion is not a simple increase in the number of keywords, but a targeted expansion based on different levels. In other words, search keywords of different levels are generated according to the document search request. The reason why the hierarchical nature of the search keywords is emphasized here is that it is not enough to perform semantic expansion only at the same level. Such an approach easily regards all search keywords as equivalent, thereby ignoring the possible differences in summary and detail between them. In fact, some summary search keywords are more suitable for overall matching, while detailed keywords are more suitable for fine-grained extraction.
[0180] Based on this, in the embodiment of the present application, search keywords of different levels are generated according to the document search request, and for the search keywords of different levels, text content of different levels is extracted from the document, and these contents are semantically matched with the search keywords of the corresponding levels. For example, a text block is a specific document content, and its semantic granularity is more detailed, so it is more suitable to add detailed search keywords for matching, while a text summary is a highly concise and abstract content, so it is more suitable to add summary search keywords for matching. In this way, semantic matching results between documents at different levels and document search requests can be obtained. These results not only reflect the degree of fit between the document and the search request at different granularities, but also provide a strong basis for determining the final semantic matching results.
[0181] Specifically, in step 202, the following processing is performed on each document in the document library: text content at different levels is extracted from the document; search keywords at the same level are semantically matched with corresponding text content to obtain semantic matching results between documents at different levels and document search requests; based on the semantic matching results between documents at different levels and document search requests, the final semantic matching results between the document and the document search request are determined.
[0182] In one embodiment, generating different levels of search keywords based on a document search request includes generating first-level search keywords and second-level search keywords based on the document search request. Here, the first-level search keywords may be summary search keywords, and the second-level search keywords may be detailed search keywords.
[0183] As an optional implementation, a large language model is used to generate search keywords at different levels based on a document search request. Optionally, the document search request is input as a second prompt word into a keyword expansion model. The keyword expansion model expands the search keywords of the document search request based on preset expansion rules for search keywords at different levels, thereby obtaining search keywords at different levels.
[0184] Alternatively, the document search request is fed into a preset second prompt word template to obtain a second prompt word, wherein the second prompt word template defines expansion rules for search keywords at different levels. The second prompt word is then input into a keyword expansion model to obtain search keywords at different levels.
[0185] For example, the second prompt word template is:
[0186] Role: You are an intelligent assistant that excels at processing query requests. You will be responsible for identifying summary search keywords and detailed search keywords in user query requests.
[0187] Task Description: Given a query request, list summary search keywords and detailed search keywords based on your judgment.
[0188] In one embodiment of the present application, the expansion rules may include:
[0189] Expanding rules: Summary search keywords focus on overall concepts or themes, while detailed search keywords focus on specific entities, details, or specific terms.
[0190] In one embodiment of the present application, the output format may also be limited, for example:
[0191] Output the search keywords in JSON format. The JSON contains two keys:
[0192] "high_level_keywords": represents summary search keywords;
[0193] "low_level_keywords": represents detailed search keywords.
[0194] For example, assuming the document search request is "Help me find documents related to Journey to the West", keyword expansion of this document search request can obtain summary search keywords: Four Great Classics, Ancient Chinese Novels, etc., as well as expanded detailed search keywords: Sun Wukong, Zhu Bajie, Tang Monk, Wu Cheng'en, etc.
[0195] In one embodiment, extracting different levels of text content from a document includes: extracting summary text from the document and determining the summary text as first-level text content; and dividing the document into blocks and determining each text block as second-level text content. The first-level text content is the summary text content of the document, and the second-level text content is the detailed text content of the document.
[0196] As an optional implementation method, a large language model is used to generate summary text of a document, such as abstract text. Specifically, first select a large language model suitable for generating summary text, such as BERT, GPT, etc. Compared with traditional models, large language models have powerful semantic understanding and text generation capabilities. Then, the document is preprocessed, including but not limited to processing operations such as removing stop words, punctuation normalization, and text segmentation to improve the model's ability to understand the content of the document. Subsequently, the preprocessed document is input into the large language model, and the model's generation ability is used to generate the document's summary text. Among them, a length limit (such as the number of words or sentences) can be set for the summary text to ensure that the generated summary text is both concise and comprehensive. Finally, the generated summary text can also be post-processed, such as merging repeated information, adjusting the order of sentences to improve readability, and ensuring the grammatical and semantic correctness of the summary text.
[0197] As an optional implementation method, when segmenting a document, the segmentation criteria can first be determined based on the content and structure of the document. For example, the segmentation criteria can be determined based on factors such as paragraphs, chapters, changes in themes, and the frequency of keyword appearances. For example, for news reports, segmentation can be performed by paragraphs or event developments; for academic papers, segmentation can be performed by chapters such as introduction, methods, results, and discussion. Subsequently, the document can be segmented into multiple text blocks based on the determined segmentation criteria by writing scripts or using existing text processing tools. Optionally, the preliminarily segmented text blocks can also be adjusted. For example, if two adjacent text blocks are highly related in content, it can be considered to merge them into a larger text block, and this embodiment of the present application does not impose any restrictions on this.
[0198] Through the above two optional implementation methods, text content at different levels can be effectively extracted from the document, providing an implementation basis for subsequent document search tasks.
[0199] In one embodiment, semantic matching is performed on search keywords of the same level with corresponding text content to obtain semantic matching results between documents at different levels and document search requests. The specific implementation includes: semantic matching is performed on first-level search keywords with first-level text content to obtain semantic matching results between documents at the first level and document search requests; semantic matching is performed on second-level search keywords with second-level text content to obtain semantic matching results between documents at the second level and document search requests.
[0200] Specifically, the first-level search keywords, i.e., summary search keywords, are semantically matched with the document's abstract text to obtain semantic matching results between the document and the document search request at the first level, i.e., the overall level. The second-level search keywords, i.e., detailed search keywords, are semantically matched with the text blocks in the document to obtain semantic matching results between the document and the document search request at the detailed level.
[0201] Among them, semantic matching not only considers the literal similarity in the title, but also digs deeper into the semantic association between the two, such as synonym replacement, concept overlap, etc. This comparison method is more intelligent and flexible than simple string matching, and can more accurately reflect the actual association between the document and user needs. As an optional implementation method, when semantically matching the first-level search keyword with the summary text of the document, a first vector representation of the first-level search keyword is generated, and a second vector representation of the summary text of the document is generated. The similarity between the first vector representation and the second vector representation is determined, and the similarity is determined as the semantic matching result between the document at the first level, that is, the overall level, and the document search request.
[0202] For example, a pre-trained large model (such as BERT, GPT, etc.) is used to convert the first-level search keywords and the summary text of the document into vector representations, which capture key information and semantic features.
[0203] For example, when determining the similarity between the first vector representation and the second vector representation, it can be achieved by using a measurement method such as cosine similarity, Euclidean distance, etc. A higher similarity value indicates a higher degree of semantic matching between the first-level search keyword and the summary text of the document.
[0204] Similarly, when semantically matching the second-level search keyword with the second-level text content, a third vector representation of the second-level search keyword is generated, and a fourth vector representation of each text block of the document is generated. The similarity between the third vector representation and the fourth vector representation is determined, and the similarity is determined as the semantic matching result between the document at the second level, that is, at the detail level, and the document search request.
[0205] Wherein, the document includes multiple text blocks. When determining the similarity between the third vector representation and the fourth vector representation, the similarity between the fourth vector representation and the third vector representation of each text block can be determined separately, and then the average value of the multiple similarities is determined as the semantic matching result between the document at the second level, that is, the detail level and the document search request.
[0206] In one embodiment, the specific implementation of determining the final semantic matching result between the document and the document search request based on the semantic matching results between the document at different levels and the document search request includes: performing weighted summation processing on the semantic matching results between the document at different levels and the document search request to obtain the final semantic matching result between the document and the document search request.
[0207] This embodiment uses a weighted summation mechanism to balance the semantic matching results between document search requests and documents at both the overall and detailed levels. This approach effectively compensates for the shortcomings of traditional methods that only focus on semantic matching at a single level. Specifically, while traditional methods are good at capturing fine-grained information in articles, such as matching specific words, phrases, or local context, they often ignore the overall information structure and topic clues of the article. This lack of overall information directly leads to two significant problems:
[0208] Insufficient recall: Due to the failure to fully extract the overall information of the article, some documents containing important summary content or global perspectives may be missed, thereby reducing the comprehensiveness and accuracy of the search results.
[0209] Reduced matching ranking accuracy: When faced with multiple similar documents, relying solely on the matching scores of local information blocks can lead to extreme situations where a document with only a small amount of content highly relevant to the search query is mistakenly placed at the top due to its high local score. This ranking mechanism is clearly not sophisticated enough to accurately reflect the overall relevance of the document to the search query.
[0210] In contrast, the method proposed in this embodiment not only improves the recall rate and ensures the accurate presentation of more relevant documents by comprehensively considering the overall and detailed information of the document, but also significantly improves the accuracy of matching sorting, making the returned document list more in line with the user's search intentions and needs.
[0211] Finally, in step 203, based on the final semantic matching result between each document in the document library and the document search request, the document search results of the first search path are determined from the document library.
[0212] As an optional implementation, the documents in the document library are sorted from highest to lowest semantic match results. The top-ranked documents, those with higher semantic match scores, are considered more relevant and a better match for the document search request. Therefore, in the first search path, these high-scoring documents are selected as document search results and presented to the user in descending order of scores.
[0213] In summary, Figure 2 The process shown generates search keywords at different levels based on the document search request. Based on these search keywords, the process extracts text content at different levels from the document and semantically matches this content with the search keywords at the corresponding level. This method generates semantic matching results between documents at different levels and the document search request. These results not only reflect the degree of fit between the document and the search request at different granularities but also provide a strong basis for determining the final semantic matching results, thereby improving the recall and precision of document searches.
[0214] Figure 3 This is a flowchart of another embodiment of a document search method provided in an embodiment of the present application. Figure 3 The process shown in Figure 1 Based on the process shown in FIG, the second search path based on text semantics is described, and the corresponding document search operation is performed according to the second search path to obtain the document search results of the first search path. Here, the second search path based on text semantics refers to the title search. Figure 3 As shown, the process includes the following steps:
[0215] Step 301: Extract the target document title to be searched from the document search request.
[0216] Step 302: Perform the following processing for each document in the document library: obtain the document title of the document; perform semantic matching between the document title and the target document title to obtain a semantic matching result between the document and the document search request.
[0217] Step 303: Determine document search results of the second search path from the document library based on the semantic matching result.
[0218] For ease of understanding, steps 301 to 303 are described in a unified manner below:
[0219] The document title is the most detailed summary of the document content. The document title can be used to efficiently and accurately locate the document that the user needs.
[0220] In step 301, the target document title to be searched is first parsed from the document search request submitted by the user. For example, if the document search request submitted by the user is "Help me find a document named xxx", executing step 301 on the document search request will result in the target document title being: xxx.
[0221] In step 302, each document in the document library is processed one by one to obtain the title of each document and semantically match it with the target document title. As for how to semantically match the target document title with the document title, please refer to the relevant description above and will not be repeated here.
[0222] Finally, in step 303, based on the semantic matching result obtained in step 302, documents that meet the user's needs are selected from the document library as the second search path, that is, the document search result of the title search.
[0223] Optionally, in step 303, a variety of sorting algorithms and filtering mechanisms may be used to sort and filter the documents initially selected from the document library based on the semantic matching results, so that the returned document list is comprehensive and can meet the actual needs of the user.
[0224] Figure 3 The process shown builds a document search process based on semantic matching of document titles. This process achieves accurate response and efficient satisfaction of user document search requests by accurately extracting the target document titles to be searched and the document titles of documents in the document library and performing semantic matching.
[0225] Figure 4 This is a flowchart of another document search method provided in an embodiment of the present application. Figure 4 The process shown in Figure 1Based on the process shown, the description is based on the third search path based on text semantics, and the corresponding document search operation is performed according to the third search path to obtain the document search results of the first search path. Here, the third search path based on text semantics refers to content classification search. Figure 4 As shown, the process includes the following steps:
[0226] Step 401: Extract the target document category to be searched from the document search request.
[0227] Step 402: Perform the following processing for each document in the document library: obtain the document category of the document; perform semantic matching between the document category and the target document category to obtain a semantic matching result between the document and the document search request.
[0228] Step 403: Determine document search results of the third search path from the document library based on the semantic matching result.
[0229] For ease of understanding, steps 401 to 403 are described in a unified manner below:
[0230] Document categories provide a highly general and refined summary of document content, improving document search efficiency. Specifically, when users need to find documents of a specific type, they can narrow their search by selecting the corresponding document category, avoiding the tedious search within a vast document library. This category-based document search significantly reduces search time and improves work efficiency.
[0231] In step 401, the target document category to be searched is first parsed from the document search request submitted by the user. For example, if the document search request submitted by the user is "help me find documents in the news category", executing step 401 on the document search request will result in the target document category being: news.
[0232] In step 402, each document in the document library is processed one by one to obtain the document category of each document and semantically match it with the target document category. In order to accurately obtain the document category, any of the following methods can be used:
[0233] One approach is to count the keywords in each category contained in the document. Using text analysis technology, we can identify and count the keywords that appear frequently in the document and are closely related to a specific category, thereby preliminarily determining the category of the document.
[0234] Another approach is to leverage existing document category annotations. During document creation or organization, documents are often annotated to clarify their domain or subject matter. This annotation information can be directly read and utilized to quickly and accurately determine the document's category.
[0235] Furthermore, documents can be intelligently identified based on their category characteristics. By training a large number of categorized documents using machine learning or deep learning algorithms, a model capable of identifying document category characteristics can be constructed. This model can then be used to predict the category of new documents, achieving automated and intelligent document classification.
[0236] As for how to semantically match the target document category with the document category, please refer to the relevant description above and will not be repeated here.
[0237] Finally, in step 403, based on the semantic matching results obtained in step 402, documents that meet the user's needs are selected from the document library as the third search path, i.e., the document search results for the content classification search. Optionally, in step 403, various sorting algorithms and filtering mechanisms can be used to sort and filter the documents initially selected from the document library based on the semantic matching results, so that the returned document list is both comprehensive and tailored to the user's actual needs.
[0238] Figure 4 The process shown builds a document search process based on semantic matching of document categories. This process achieves accurate response and efficient satisfaction of user document search requests by accurately extracting the target document category to be searched and the document category of the documents in the document library and performing semantic matching.
[0239] Figure 5 This is a flowchart of another document search method provided in an embodiment of the present application. Figure 5 The process shown in Figure 1 Based on the process shown in FIG, the fourth search path based on document metadata is described, and the corresponding document search operation is performed according to the fourth search path to obtain the document search results of the fourth search path. Here, the fourth search path based on document metadata includes author search, sender search, time search, etc. Figure 5 As shown, the process includes the following steps:
[0240] Step 501: Extract metadata of the target document to be searched from the document search request.
[0241] Step 502: Obtain the metadata set of each document in the document library.
[0242] Step 503: Determine the document in the document library whose metadata set contains the metadata of the target document as the document search result of the fourth search path.
[0243] For ease of understanding, steps 501 to 503 are described in a unified manner below:
[0244] Document metadata, as data describing document characteristics and attributes, such as the document's publishing time, author, sender, etc., provides important clues for document search and location.
[0245] In step 501, the document search request submitted by the user is parsed to extract metadata of the target document to be searched. This metadata may include key attributes such as the document's publication date, author name, and sender information. By accurately extracting document metadata from the document search request, we can more accurately understand the user's needs and lay the foundation for subsequent search processes.
[0246] In step 502, each document in the document library is traversed to collect its metadata. This metadata collection includes all possible attribute information in the document, such as publication date, author name, file size, sender email address, etc. Through step 502, a complete metadata database can be built for the documents in the document library, providing data support for subsequent metadata matching.
[0247] Finally, in step 503, a matching algorithm is used to compare the metadata set in the document library with the target document metadata. By deeply mining the correlation between the two, documents with a high match to the target document metadata can be identified. These documents are determined as document search results under the fourth search path.
[0248] Figure 5 The process shown here builds a document search process based on document metadata. By accurately extracting metadata and comprehensively acquiring metadata datasets, this process not only improves the accuracy and relevance of search results but also provides users with a more convenient and efficient search experience.
[0249] In one embodiment, a document information library can be pre-built. This library contains information on multiple documents in the document library across multiple dimensions, including but not limited to document titles, document summaries, and document categories. When performing a document search, a document search operation can be performed based on the document search request and this pre-built library to obtain document search results. This pre-generated and stored document information can be directly accessed during a document search, improving document search efficiency.
[0250] In one embodiment, when constructing the aforementioned document information database, a single document information extraction model (e.g., a large language model) can be used to concurrently complete the three tasks of title extraction, summary generation, and document classification for incoming documents. These three tasks complement each other in practice: summary generation can be performed simultaneously with title generation / extraction, and titles are closely related to document classification. Therefore, combining these three tasks effectively avoids semantic mismatches caused by using different models.
[0251] As an optional implementation method, the incoming document is filled into the preset third prompt word template to obtain the third prompt word, wherein the third prompt word template defines the document classification rules, title rules and summary rules; the third prompt word is input into the document information extraction model to obtain the document title, document summary and document category of the incoming document.
[0252] Optionally, the third prompt word template is designed as follows:
[0253] Role positioning: You are a good summarizer.
[0254] Task description: Given a document, please classify it and summarize its title and abstract;
[0255] In one embodiment of the present application, document classification rules may include:
[0256] Classification refers to the type of document, which can be official documents, financial reports, resumes, contracts, medical records, etc.
[0257] In one embodiment of the present application, the title rules may include:
[0258] If the document itself has a title, just return the title. If the title does not exist, generate a new title.
[0259] In one embodiment of the present application, summary rules may include:
[0260] The abstract should be 300 words
[0261] Output format:
[0262] Output keywords in JSON format. The JSON contains three keys:
[0263] "title" represents the title;
[0264] "classification" represents the classification of the document;
[0265] "abstract" represents the document abstract.
[0266] As another optional implementation method, the incoming document is input as the third prompt word into the document information extraction model, and the document information extraction model processes the incoming document based on the document classification rules of the above example to obtain the document category of the incoming document, and processes the incoming document based on the title rule to obtain the document title of the incoming document, and processes the incoming document based on the summary rule to obtain the document summary of the incoming document.
[0267] The embodiments provided in this application utilize large models for document processing, achieving higher accuracy than traditional methods. Furthermore, they can simultaneously generate multiple tasks, including title extraction, summary generation, and article classification. The summary can also generate titles, which are closely related to article categories. Therefore, combining these three tasks effectively avoids semantic mismatches caused by using different models.
[0268] Figure 6 This is a block diagram of an embodiment of a document search device provided in an embodiment of the present application. Figure 6 As shown, the device includes:
[0269] An acquisition module 61 is used to acquire a document search request;
[0270] A search request disassembly module 62 is used to parse the document search request to determine multiple search paths;
[0271] A search module 63 is configured to perform corresponding document search operations according to the multiple search paths, respectively, to obtain document search results for each of the search paths;
[0272] The result determination module 64 is configured to determine a final document search result based on the document search results of the multiple search paths.
[0273] In a possible implementation, the search request disassembly module 62 is specifically configured to:
[0274] parsing the document search request, classifying information in the document search request, and determining multiple search paths based on the classification;
[0275] The document search request is parsed, information in the document search request is classified, and multiple search paths are determined based on the classification, including:
[0276] Inputting the document search request as a first prompt word into a search request disassembly model, wherein the search request disassembly model processes the document search request based on a classification rule to obtain multiple search paths;
[0277] Alternatively, the document search request is filled into a preset first prompt word template to obtain a first prompt word, wherein the first prompt word template defines classification rules for different search paths; the first prompt word is input into a search request decomposition model to obtain multiple search paths.
[0278] In a possible implementation, the search module 63 includes:
[0279] A keyword decomposition unit, configured to generate search keywords at different levels according to the document search request;
[0280] The text content decomposition unit is used to perform the following processing on each document in the document library: extracting text content of different levels from the document;
[0281] A content matching unit, configured to perform semantic matching between search keywords at the same level and corresponding text content, and obtain semantic matching results between the documents at different levels and the document search request;
[0282] A first determining unit, configured to determine a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request;
[0283] The second determining unit is configured to determine the document search results of the first search path from the document library according to a final semantic matching result between each document in the document library and the document search request.
[0284] In a possible implementation, the keyword decomposition unit is specifically configured to:
[0285] generating a first-level search keyword and a second-level search keyword according to the document search request;
[0286] The text content disassembly unit is specifically used to:
[0287] Extracting summary text of the document, and determining the summary text as first-level text content;
[0288] Dividing the document into blocks, and determining each text block as second-level text content;
[0289] The content matching unit is specifically configured to:
[0290] Performing semantic matching on the first-level search keyword and the first-level text content to obtain a semantic matching result between the document at the first level and the document search request;
[0291] The second-level search keyword is semantically matched with the second-level text content to obtain a semantic matching result between the document at the second level and the document search request.
[0292] In a possible implementation manner, the first determining unit is specifically configured to:
[0293] The semantic matching results between the document and the document search request at different levels are weighted and summed to obtain a final semantic matching result between the document and the document search request.
[0294] In a possible implementation, the multiple search paths include a second search path based on text semantics, and the search module 63 includes:
[0295] A first title extraction unit, configured to extract the title of a target document to be searched from the document search request;
[0296] The second title extraction unit is configured to perform the following processing on each document in the document library: obtaining the document title of the document;
[0297] a title matching unit, configured to perform semantic matching between the document title of the document and the target document title, and obtain a semantic matching result between the document and the document search request;
[0298] A third determining unit is configured to determine, from the document library, document search results of the second search path according to the semantic matching result.
[0299] In a possible implementation, the multiple search paths include a third search path based on text semantics, and the search module 63 includes:
[0300] A first category extraction unit, configured to extract a target document category to be searched from the document search request;
[0301] The second category extraction unit is configured to perform the following processing on each document in the document library: obtaining the document category of the document;
[0302] a category matching unit, configured to perform semantic matching between the document category of the document and the target document category to obtain a semantic matching result between the document and the document search request;
[0303] The fourth determining unit is configured to determine the document search results of the third search path from the document library according to the semantic matching result.
[0304] In a possible implementation, the multiple search paths include a fourth search path based on document metadata, and the search module 63 includes:
[0305] A first metadata extraction unit, configured to extract metadata of a target document to be searched from the document search request;
[0306] A second metadata extraction unit is used to obtain a metadata set of each document in the document library;
[0307] The fifth determining unit is configured to determine, in the document library, a document whose metadata set contains the metadata of the target document as a document search result of the fourth search path.
[0308] In a possible implementation, the result determination module 64 is specifically configured to:
[0309] The document search results of the multiple search paths and the document search request are input into a document ranking model to obtain a document search result list output by the document ranking model.
[0310] In a possible implementation, the search module is specifically configured to:
[0311] Performing a document search operation according to the document search request and a pre-built document information library to obtain the document search results;
[0312] The document information library at least includes the document title, document summary, and document category of the stored document;
[0313] The device also includes: a document information library construction module for
[0314] Inputting the incoming document as a third prompt word into a document information extraction model, wherein the document information extraction model processes the incoming document based on a document classification rule to obtain a document category of the incoming document, processes the incoming document based on a title rule to obtain a document title of the incoming document, and processes the incoming document based on a summary rule to obtain a document summary of the incoming document;
[0315] Alternatively, the incoming document is filled into a preset third prompt word template to obtain a third prompt word, wherein the third prompt word template defines the document classification rule, the title rule and the summary rule; the third prompt word is input into the document information extraction model to obtain the document title, document summary and document category of the incoming document.
[0316] like Figure 7 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0317] Memory 113, for storing computer programs;
[0318] In one embodiment of the present application, the processor 111 is configured to execute a program stored in the memory 113 to implement the document search method provided by any of the aforementioned method embodiments, including:
[0319] Obtaining a document search request, parsing the document search request to determine multiple search paths;
[0320] According to the multiple search paths, corresponding document search operations are performed respectively to obtain document search results of each search path;
[0321] Determine final document search results based on the document search results of the multiple search paths.
[0322] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the document search method provided in any of the aforementioned method embodiments are implemented.
[0323] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0324] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, or of course, by hardware. Based on this understanding, the above technical solution, in essence, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or certain parts of the embodiment.
[0325] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an", and "" as used herein may also be meant to include plural forms. The terms "comprise", "include", "contain", and "have" are inclusive and therefore specify the presence of the stated features, steps, operations, elements, and / or parts, but do not exclude the presence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be performed in the specific order described or illustrated, unless the order of execution is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0326] The above are merely specific embodiments of the present application to enable those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but rather is intended to conform to the widest scope consistent with the principles and novel features of the present application.
Claims
1. A document search method, characterized in that: The method comprises: Obtaining a document search request, and parsing the document search request to determine multiple search paths; Executing corresponding document search operations according to the multiple search paths respectively to obtain document search results for each of the search paths; A final document search result is determined based on the document search results of the multiple search paths.
2. The method according to claim 1, characterized in that The parsing of the document search request to determine multiple search paths includes: parsing the document search request, classifying information in the document search request, and determining multiple search paths based on the classification; The document search request is parsed, information in the document search request is classified, and multiple search paths are determined based on the classification, including: Inputting the document search request as a first prompt word into a search request disassembly model, wherein the search request disassembly model processes the document search request based on a classification rule to obtain multiple search paths; Alternatively, the document search request is filled into a preset first prompt word template to obtain a first prompt word, wherein the first prompt word template defines classification rules for different search paths; the first prompt word is input into a search request decomposition model to obtain multiple search paths.
3. The method according to claim 1, characterized in that The multiple search paths include a first search path based on text semantics. According to the first search path, performing a corresponding document search operation to obtain document search results of the first search path includes: Generating search keywords at different levels according to the document search request; The following processing is performed for each document in the document library: extracting text content at different levels from the document; Perform semantic matching on the search keywords at the same level with the corresponding text content to obtain semantic matching results between the documents at different levels and the document search request; Determining a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request; According to the final semantic matching result between each document in the document library and the document search request, the document search results of the first search path are determined from the document library.
4. The method according to claim 3, characterized in that Generating search keywords at different levels according to the document search request includes: generating a first-level search keyword and a second-level search keyword according to the document search request; Extracting text content at different levels from the document includes: Extracting summary text of the document, and determining the summary text as first-level text content; Dividing the document into blocks, and determining each text block as second-level text content; The semantic matching of the search keywords at the same level with the corresponding text content to obtain semantic matching results between the documents at different levels and the document search request includes: Performing semantic matching on the first-level search keyword and the first-level text content to obtain a semantic matching result between the document at the first level and the document search request; The second-level search keyword is semantically matched with the second-level text content to obtain a semantic matching result between the document at the second level and the document search request.
5. The method according to claim 3, characterized in that Determining a final semantic matching result between the document and the document search request based on semantic matching results between the document at different levels and the document search request includes: The semantic matching results between the document and the document search request at different levels are weighted and summed to obtain a final semantic matching result between the document and the document search request.
6. The method according to claim 1, characterized in that The multiple search paths include a second search path based on text semantics, and performing a corresponding document search operation according to the second search path to obtain document search results of the second search path includes: Extracting the target document title to be searched from the document search request; The following processing is performed for each document in the document library: Get the document title of the document; Performing semantic matching between the document title and the target document title to obtain a semantic matching result between the document and the document search request; According to the semantic matching result, the document search results of the second search path are determined from the document library.
7. The method according to claim 1, characterized in that The multiple search paths include a third search path based on text semantics, and performing a corresponding document search operation according to the third search path to obtain document search results of the third search path includes: Extracting a target document category to be searched from the document search request; The following processing is performed for each document in the document library: Obtaining the document category of the document; Performing semantic matching on the document category of the document and the target document category to obtain a semantic matching result between the document and the document search request; According to the semantic matching result, the document search result of the third search path is determined from the document library.
8. The method according to claim 1, characterized in that The multiple search paths include a fourth search path based on document metadata, and performing a corresponding document search operation according to the fourth search path to obtain document search results of the fourth search path includes: Extracting metadata of a target document to be searched from the document search request; Get the metadata set for each document in the document library; The document in the document library whose metadata set contains the metadata of the target document is determined as the document search result of the fourth search path.
9. The method according to claim 1, characterized in that Determining a final document search result based on the document search results of the multiple search paths includes: The document search results of the multiple search paths and the document search request are input into a document ranking model to obtain a document search result list output by the document ranking model.
10. The method according to claim 1, characterized in that Perform a document search operation in the following manner to obtain the document search results: Performing a document search operation according to the document search request and a pre-built document information library to obtain the document search results; The document information library at least includes the document title, document summary, and document category of the stored document; The document title, document summary, and document category of the stored document are obtained in the following manner: Inputting the incoming document as a third prompt word into a document information extraction model, wherein the document information extraction model processes the incoming document based on a document classification rule to obtain a document category of the incoming document, processes the incoming document based on a title rule to obtain a document title of the incoming document, and processes the incoming document based on a summary rule to obtain a document summary of the incoming document; Alternatively, the incoming document is filled into a preset third prompt word template to obtain a third prompt word, wherein the third prompt word template defines the document classification rule, the title rule and the summary rule; the third prompt word is input into the document information extraction model to obtain the document title, document summary and document category of the incoming document.
11. A document search device, characterized in that: The device comprises: The acquisition module is used to obtain document search requests; A search request disassembly module, configured to parse the document search request to determine multiple search paths; A search module, configured to perform corresponding document search operations according to the multiple search paths, respectively, to obtain document search results for each of the search paths; The result determination module is configured to determine a final document search result based on the document search results of the multiple search paths.
12. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the document search method according to any one of claims 1 to 10.
Citation Information
Cited By
PDF document content processing method and device, equipment, storage medium and program product
CN120930593A
PDF document content processing method, device, equipment, storage medium and program product
CN120930593B