Document retrieval method and device, computer readable storage medium and electronic equipment

Through the use of text block retrieval and target text segmenter, the problem of low document retrieval accuracy in the existing technology is solved, and efficient semantic information matching and retrieval of unstructured documents is achieved.

CN118626593APending Publication Date: 2024-09-10GUANGDONG POWER GRID CO LTD +1

Patent Information

Application Number
CN202410815423.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In the existing technology, unstructured document data information extraction mainly extracts keywords and topics, which is difficult to reflect the complete semantic information of the document content, resulting in low document retrieval accuracy.

Method used

By receiving the user's document retrieval request, extract the document retrieval information, and perform retrieval based on text blocks. Use the target text segmenter set to perform text segmentation on the document, obtain target text blocks that match the document retrieval information, and return document information to ensure semantic information. Complete preservation and refined matching.

Benefits of technology

It improves the accuracy of document retrieval, avoids the influence of irrelevant text, achieves effective splitting and refined matching of document content, and improves retrieval accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626593A
    Figure CN118626593A
Patent Text Reader

Abstract

The invention discloses a document retrieval method and device, a computer readable storage medium and electronic equipment. Relates to the technical field of internet, and comprises the following steps: receiving a document retrieval request of a user, and extracting document retrieval information from the document retrieval request; based on the document retrieval information, retrieval is conducted in the multiple text blocks, target text blocks matched with the document retrieval information are obtained, the text blocks are text segments obtained by conducting text segmentation on the document according to a target text segmentation device set, and the target text segmentation device set comprises text segmentation devices matched with the document type of the document; and returning the document information corresponding to the target text block and the target text block to the user. The technical problem of low document search accuracy in related technologies is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Internet technology, and in particular to a document retrieval method, device, computer-readable storage medium and electronic device. Background Art

[0002] In large enterprises, there are a large number of unstructured documents of various types, with complex contents and different formats. In order to facilitate employees to search massive documents, information extraction is usually performed on document data to match the extracted information with the search statement during the search process. At present, in related technologies, traditional unstructured document data information extraction mainly extracts keywords and titles of documents, which is difficult to reflect the complete semantic information of the document content, resulting in low document retrieval accuracy during the document retrieval process.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] Embodiments of the present invention provide a document retrieval method, device, computer-readable storage medium, and electronic device to at least solve the technical problem of low document retrieval accuracy in the related art.

[0005] According to one aspect of an embodiment of the present invention, a document retrieval method is provided, comprising: receiving a document retrieval request from a user, and extracting document retrieval information from the document retrieval request; searching in multiple text blocks based on the document retrieval information to obtain a target text block that matches the document retrieval information, wherein the text block is a text fragment obtained by segmenting a document according to a target text segmenter set, and the target text segmenter set includes text segmenters that match the document type of the document; and returning the document information corresponding to the target text block and the target text block to the user.

[0006] Furthermore, the document retrieval method also includes: obtaining multiple documents and determining the document content of each document; for each document, determining the content description information of the document from the document; determining the document type of the document based on the content description information of the document; based on the document type of each document, determining the target text segmenter set corresponding to each document, and performing text segmentation on the document content of the document based on the target text segmenter set to obtain multiple text blocks corresponding to each document.

[0007] Furthermore, the document retrieval method also includes: determining a document format of the document; determining a content extraction method for the document according to the document format of the document; extracting content from the document according to the content extraction method, and determining the extracted content as the document content of the document.

[0008] Furthermore, the document retrieval method also includes: determining whether the document name of the document is in the target format; if the document name of the document is in the target format, determining the document name as the content description information of the document; if the document name of the document is not in the target format, determining the content in the target range in the document content as the content description information of the document.

[0009] Furthermore, the document retrieval method also includes: performing word segmentation processing on the content description information of the document to obtain multiple word segments; performing numerical conversion on the multiple word segments to obtain a numerical sequence composed of numerical values ​​corresponding to the multiple word segments; processing the numerical sequence according to the target classification model to obtain the document type corresponding to the document.

[0010] Furthermore, the document retrieval method also includes: determining whether the length of the numerical sequence is less than a preset length; when the length of the numerical sequence is less than the preset length, padding the numerical sequence to obtain a target numerical sequence; generating an attention mask sequence corresponding to the target numerical sequence, wherein the attention mask sequence is used to guide the target classification model to focus on the target elements in the target numerical sequence when processing the target numerical sequence; processing the target numerical sequence and the attention mask sequence according to the target classification model to obtain the document type corresponding to the document.

[0011] Furthermore, the document retrieval method also includes: for each document, performing text segmentation processing on the document content according to a text segmenter that matches the document type to obtain multiple first text blocks; performing text segmentation processing on the remaining content in the document according to a universal text segmenter to obtain at least one second text block; and determining the first text block and the second text block corresponding to each document as multiple text blocks corresponding to each document.

[0012] According to another aspect of an embodiment of the present invention, a document retrieval device is also provided, including: a receiving module, used to receive a user's document retrieval request and extract document retrieval information from the document retrieval request; a retrieval module, used to search among multiple text blocks based on the document retrieval information to obtain a target text block that matches the document retrieval information, wherein the text block is a text fragment obtained by text segmenting the document according to a target text segmenter set, and the target text segmenter set includes text segmenters that match the document type of the document; a first processing module, used to return the document information corresponding to the target text block and the target text block to the user.

[0013] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above document retrieval method when running.

[0014] According to another aspect of an embodiment of the present invention, an electronic device is also provided, which includes one or more processors; a memory for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned document retrieval method when running.

[0015] In an embodiment of the present invention, a document retrieval method based on a text block in a document is adopted to perform document retrieval for a user, by receiving a document retrieval request from the user, extracting document retrieval information from the document retrieval request, and then performing retrieval in multiple text blocks based on the document retrieval information to obtain a target text block matching the document retrieval information, thereby returning the document information and the target text block corresponding to the target text block to the user. The text block is a text segment obtained by performing text segmentation on the document according to a target text segmenter set, and the target text segmenter set includes a text segmenter matching the document type.

[0016] In the above process, by segmenting the text of the document according to the target text segmenter set to obtain text fragments, the semantic information in the document is completely retained, avoiding the difficulty in reflecting the complete semantic information of the document content when extracting keywords and titles from the document for document retrieval in the related technology, affecting the retrieval accuracy. By searching in multiple text blocks based on the document retrieval information, the target text block matching the document retrieval information is obtained, and a refined matching process for each text block is achieved, avoiding the problem of being easily affected by non-related texts due to the large amount of complete content in the document when directly matching with the full text of the document, thereby effectively improving the accuracy of document retrieval. In addition, by segmenting the document based on the text segmenter matching the document type, the effective splitting of the document content is achieved, which can further improve the retrieval accuracy.

[0017] It can be seen that the solution provided by the present application achieves the purpose of performing document retrieval for users based on text blocks in the document, thereby achieving the technical effect of improving retrieval accuracy, and further solving the technical problem of low document retrieval accuracy in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0019] Figure 1 is a schematic diagram of an optional document retrieval method according to an embodiment of the present invention;

[0020] Figure 2is a schematic diagram of an optional method of obtaining multiple text blocks according to an embodiment of the present invention;

[0021] Figure 3 is a schematic diagram of an optional target classification model determined according to an embodiment of the present invention;

[0022] Figure 4 is a schematic diagram of an optional document retrieval device according to an embodiment of the present invention;

[0023] Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0027] Example 1

[0028] According to an embodiment of the present invention, an embodiment of a document retrieval method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0029] Figure 1 is a schematic diagram of an optional document retrieval method according to an embodiment of the present invention, such as Figure 1 As shown, the method comprises the following steps:

[0030] Step S101: receiving a document retrieval request from a user, and extracting document retrieval information from the document retrieval request.

[0031] Optionally, electronic devices, application systems, servers and other devices may be used as the execution subject of the present application. In this embodiment, the target retrieval system is used as the execution subject to execute the above document retrieval method.

[0032] Optionally, in this embodiment, the target retrieval system can be applied to an electric power organization, the user can refer to an employee in the electric power organization, the document retrieval request can be used to retrieve the electric power industry system documents in the electric power organization, and the document retrieval information can be information associated with the document to be queried. For example, assuming that the document retrieval request is "please help me find the document introducing system A", then the document retrieval information can be "system A". For another example, assuming that the document retrieval request is "check which document records the sentence 'operation process B will be implemented in 2022'", then the document retrieval information can refer to "operation process B will be implemented in 2022". The target retrieval system can extract document retrieval information from the document retrieval request based on semantic recognition.

[0033] Optionally, the user may also mark the document retrieval information in the document retrieval request for extraction by the target retrieval system.

[0034] Step S102, based on the document retrieval information, search in multiple text blocks to obtain a target text block that matches the document retrieval information, wherein the text block is a text fragment obtained by segmenting the document according to a target text segmenter set, and the target text segmenter set includes a text segmenter that matches the document type of the document.

[0035] Optionally, a target retrieval system stores a plurality of text blocks, each of which is a text fragment obtained by performing text segmentation on a document according to a target text segmenter set, the target text segmenter set includes a plurality of text segmenters, and the target text segmenter set includes a text segmenter that matches the document type of the document. A text segmenter is a tool for segmenting text into separate paragraphs, sentences or words. For example, assuming that the document is a paper, the target text segmenter set corresponding to the document may include text segmenters such as abstract, keyword, and citation. The abstract text segmenter is used to identify and segment the abstract part from the document, the keyword text segmenter is used to identify and segment the keyword part from the document, and the citation text segmenter is used to identify and segment the citation part from the document, thereby treating the aforementioned abstract part, keyword part and citation part as text blocks respectively.

[0036] In some embodiments, a text splitter set can be encapsulated into a text splitter chain based on the Chain of Responsibility Pattern. The Chain of Responsibility Pattern is a behavioral design pattern in which multiple objects process requests in sequence according to their order in the chain. In this case, the text splitter chain contains multiple text splitters, each of which is responsible for processing a specific text splitting task. When a document reaches the chain, it will be passed to each text splitter in turn until all text splitters have completed processing.

[0037] After extracting the document retrieval information, the target retrieval system can search in the multiple text blocks obtained by segmentation to obtain the target text block that matches the document retrieval information. For example, the target retrieval system can determine the text block in which the document retrieval information appears most times in the text content as the target text block. For another example, the target retrieval system can determine the text block in which the document retrieval information accounts for the highest proportion in the text content as the target text block. For another example, the target retrieval system can perform vector conversion on the document retrieval information and each text block respectively, and then calculate the vector similarity between the vector of the document retrieval information and the vector of each text block, so as to determine the text block with the highest vector similarity as the target text block.

[0038] Step S103, returning the document information corresponding to the target text block and the target text block to the user.

[0039] Optionally, the document information corresponding to the target text block refers to the document information of the document to which the target text block belongs, and the document information may refer to the document name.

[0040] For example, after determining the target text block, the target retrieval system may return the document name of the document to which the target text block belongs and the text content of the target text block to the user.

[0041] Based on the scheme defined in the above steps S101 to S103, it can be known that in the embodiment of the present invention, a method of performing document retrieval for a user based on a text block in a document is adopted, by receiving a document retrieval request from a user, extracting document retrieval information from the document retrieval request, and then performing retrieval in multiple text blocks based on the document retrieval information to obtain a target text block matching the document retrieval information, thereby returning the document information and the target text block corresponding to the target text block to the user. Among them, the text block is a text fragment obtained by performing text segmentation on the document according to a target text segmenter set, and the target text segmenter set includes a text segmenter matching the document type.

[0042] It is easy to notice that in the above process, by segmenting the text of the document according to the target text segmenter set, the text fragments obtained can fully retain the semantic information in the document, avoiding the difficulty in reflecting the complete semantic information of the document content when extracting keywords and titles from the document for document retrieval in the related technology, affecting the retrieval accuracy. By searching in multiple text blocks based on the document retrieval information, the target text block matching the document retrieval information is obtained, and a refined matching process for each text block is realized, avoiding the problem of being easily affected by non-related texts when directly matching with the full text of the document due to the large amount of complete content of the document, thereby effectively improving the accuracy of document retrieval. In addition, by segmenting the document based on the text segmenter matching the document type, the effective splitting of the document content is achieved, which can further improve the retrieval accuracy.

[0043] It can be seen that the solution provided by the present application achieves the purpose of performing document retrieval for users based on text blocks in the document, thereby achieving the technical effect of improving retrieval accuracy, and further solving the technical problem of low document retrieval accuracy in related technologies.

[0044] In an optional embodiment, Figure 2 is a schematic diagram of an optional method of obtaining multiple text blocks according to an embodiment of the present invention, such as Figure 2 As shown, the target retrieval system can obtain multiple text blocks in the following manner: obtain multiple documents and determine the document content of each document; for each document, determine the content description information of the document from the document; determine the document type of the document based on the content description information of the document; based on the document type of each document, determine the target text segmenter set corresponding to each document, and perform text segmentation on the document content of the document based on the target text segmenter set to obtain multiple text blocks corresponding to each document.

[0045] Optionally, in this embodiment, the process of determining multiple text blocks can be implemented based on a distributed stream computing framework. Based on the characteristics of the distributed stream computing framework, the parallel features of the processing functions and operators in each link can be fully planned to improve the throughput of the process so that the system has better performance.

[0046] Optionally, the target retrieval system can consume document data streams from Kafka based on the Flink program. The consumed data includes but is not limited to the document name, document format and other meta-information of the document, as well as the document content. Using Flink's window mechanism and time processing function, continuous ingestion and preliminary processing of real-time data can be achieved.

[0047] Optionally, the target retrieval system may extract the text in the document by a relevant content extraction method to obtain the document content. Further, the target retrieval system may determine the document name or the content in the target range in the document as the content description information of the document.

[0048] Afterwards, the target retrieval system can determine the document type of the document based on the content description information of the document. For example, the content description information of the document is processed by a neural network model to determine the document type of the document. The target retrieval system has preset matching relationships between various document types and text segmenters. After determining the document type, the target retrieval system can determine the text segmenter that matches the document type based on the aforementioned matching relationship, thereby determining a target text segmenter set that matches the document type based on the text segmenter that matches the document type.

[0049] After determining the target text segmenter set, for each document, the target retrieval system can perform text segmentation on the document content of the document according to the target text segmenter set. For example, based on the chain of responsibility model, the text segmenter set is encapsulated into a text segmentation chain, and the text segmentation chain contains multiple text segmenters. Each text segmenter is responsible for processing a specific text segmentation task. When a document reaches the chain, it will be passed to each text segmenter in turn until all text segmenters are processed, thereby obtaining multiple text blocks corresponding to the document. That is, using different text segmenters in the text segmentation chain, the text is cut step by step, and finally, multiple text blocks with semantic information are generated. After completing the text segmentation processing for multiple documents, it is determined that multiple text blocks corresponding to each document are obtained.

[0050] It should be noted that by determining the document type based on the content description information of the document, the document type is determined based on a smaller portion of information corresponding to the document, thereby improving the efficiency of determining the document type and further improving the efficiency of determining the target text segmenter set.

[0051] In an optional embodiment, in the process of determining the document content of each document, the target retrieval system can determine the document format of the document, determine the content extraction method of the document according to the document format of the document, and then extract the content of the document according to the content extraction method, and determine the extracted content as the document content of the document.

[0052] In this embodiment, the file formats of the document are various, and the correct content extraction method needs to be adapted to obtain the correct and effective document content. Optionally, the target retrieval system can determine the document format of the document based on the aforementioned meta-information, and then determine the content extraction method. For example, for commonly used Word, Excel, PDF and other files, the content extraction method can be to call the parsing program in the Unstructured (i.e., unstructured data) library to parse the document to obtain the document content; for the content in the pictures such as document scans, design drawings, etc., the content extraction method can be to call OCR (Optical Character Recognition) to process the document to obtain the text content.

[0053] In some embodiments, after extracting content from a document according to a content extraction method, the target retrieval system may also process formatting tags in the extracted content, such as font style tags in Word, cell tags in Excel, etc., clean these tags, and segment the content to split it into multiple texts, thereby determining the processed content as document content.

[0054] It should be noted that, through the above process, the document content can be accurately determined.

[0055] In an optional embodiment, in the process of determining the content description information of a document from the document, the target retrieval system can determine whether the document name of the document is in the target format, and then determine the document name as the content description information of the document if the document name is in the target format, and then determine the content in the target range in the document content as the content description information of the document if the document name is not in the target format.

[0056] Optionally, in this embodiment, the target format may refer to a text format. For example, if the document name is "A Rules and Regulations", the document name is the target format. If the document name is "2023.2", the document name is not the target format.

[0057] In the case where the document name is in the target format, it is determined that the document name contains the subject information of the document, and the document name can be determined as the content description information of the document. In the case where the document name is not in the target format, it is determined that the document name does not contain the subject information of the document, so the content in the target range in the document content can be determined as the content description information of the document. For example, N words are intercepted from the document content. The content in the front of the document is likely to contain the document title or summary description. In this embodiment, N can be taken as 300, that is, the target range is the first 300 words of the document content, so as to cover the subject description of documents such as specifications, systems, and papers.

[0058] It should be noted that by giving priority to determining the document name as the content description information of the document when certain conditions are met, the efficiency of determining the content description information of the document is improved. By determining the document content description information from the document content when certain conditions are not met, the accuracy of the content description information is ensured.

[0059] In an optional embodiment, in the process of determining the document type of a document based on the content description information of the document, the target retrieval system can perform word segmentation processing on the content description information of the document to obtain multiple word segments, and then perform numerical conversion on the multiple word segments to obtain a numerical sequence composed of numerical values ​​corresponding to the multiple word segments, and then process the numerical sequence according to the target classification model to obtain the document type corresponding to the document.

[0060] Optionally, in this embodiment, the content description information of the document can be processed by the target classification model to determine the document type of the document. In order to improve the processing effect of the target category model, the content description information of the document can be preprocessed first, so that the data obtained after the preprocessing (i.e., the numerical sequence) is input into the target classification model.

[0061] In some embodiments, the target search system may use a word segmenter to segment the content description information to obtain multiple word segments, and then use the word segmenter to convert the multiple word segments into numerical values ​​to obtain a numerical sequence composed of numerical values ​​corresponding to the multiple word segments, wherein different word segments correspond to different numerical values.

[0062] Afterwards, the target retrieval system can input the numerical sequence into the target classification model to obtain the document type output by the target classification model. Optionally, in this embodiment, the target classification model is a neural network model, for example, the target classification model is an XLNet (eXtreme Language Modeling) model, which is a generalized autoregressive pre-trained language model.

[0063] It should be noted that by determining the document type based on the target classification model, the efficiency and accuracy of determining the document type are improved, and by converting the content description information into a numerical sequence and then inputting it into the target classification model, the model processing efficiency and effect can be further improved.

[0064] In an optional embodiment, in the process of processing the numerical sequence according to the target classification model to obtain the document type corresponding to the document, the target retrieval system can determine whether the length of the numerical sequence is less than a preset length, and then fill the numerical sequence when the length of the numerical sequence is less than the preset length to obtain the target numerical sequence, and then generate an attention mask sequence corresponding to the target numerical sequence, so as to process the target numerical sequence and the attention mask sequence according to the target classification model to obtain the document type corresponding to the document. The attention mask sequence is used to guide the target classification model to focus on the target element in the target numerical sequence when processing the target numerical sequence.

[0065] Optionally, in natural language processing tasks, it is usually necessary to convert data into a sequence of fixed length so that it can be input into the model for training and prediction. Therefore, it is necessary to perform padding operations on text sequences of different lengths. In this embodiment, the target retrieval system can determine whether the length of the numerical sequence of the document is less than a preset length, so that when the length of the numerical sequence is less than the preset length, the numerical sequence is padded to obtain a target numerical sequence, for example, by padding the end of the numerical sequence with 0. It should be emphasized that the numerical sequence will not be greater than the preset length, but will only be less than or equal to the preset length.

[0066] Afterwards, the target retrieval system can generate an attention mask sequence corresponding to the target numerical sequence. For example, traverse the elements in the target numerical sequence, if the element is greater than 0, the corresponding position in the attention mask sequence is set to 1.0, if the element is less than or equal to 0, the corresponding position in the attention mask sequence is set to 0.0, for example, if the target numerical sequence is [1, 2, 5, 4, 0, 0], the attention mask sequence can be [1.0, 1.0, 1.0, 1.0, 0.0, 0.0].

[0067] Furthermore, the target numerical sequence and the attention mask sequence can be input into the target classification model together to obtain the document type corresponding to the document.

[0068] Optionally, when the length of the numerical sequence is equal to a preset length, an attention mask sequence corresponding to the numerical sequence is directly generated, and then the numerical sequence and the attention mask sequence corresponding to the numerical sequence are processed according to the target classification model to obtain the document type corresponding to the document.

[0069] In some embodiments, Figure 3is a schematic diagram of an optional target classification model according to an embodiment of the present invention, such as Figure 3 As shown, the target classification model can be trained based on the sample set. The sample set includes multiple samples and the true labels corresponding to each sample, wherein a sample can refer to a sample target value sequence and a sample attention mask sequence corresponding to the content description information of a sample document, and the true label can refer to the document type of the sample document to which the sample belongs.

[0070] Optional, such as Figure 3 As shown, the target retrieval system can divide the sample set into a training set and a test set in a ratio of 8:2, so as to train the initial classification model through the training set to obtain the trained initial classification model, and then use the test set to test the trained initial classification model, and if the test passes, the trained initial classification model is determined as the target classification model. Optionally, during the training process, the learning rate can be set to 2e-5, and the binary cross entropy loss function can be used as the loss function used when training the initial classification model.

[0071] It should be noted that in some cases, the input sequence may contain padding elements that are irrelevant to the model. Therefore, by generating an attention mask sequence corresponding to the target numerical sequence and inputting the attention mask sequence into the target classification model, the model can ignore these padding elements and only focus on the actual valid input, thereby improving the model processing efficiency and output accuracy.

[0072] In an optional embodiment, the target text segmenter set includes a text segmenter that matches the document type of the document and a universal text segmenter, wherein the universal text segmenter refers to a text segmenter that is suitable for multiple document types, wherein in the process of performing text segmentation on the document content of the document according to the target text segmenter set to obtain multiple text blocks corresponding to each document, the target retrieval system can perform text segmentation processing on the document content for each document according to the text segmenter that matches the document type of the document to obtain multiple first text blocks, and perform text segmentation processing on the remaining content in the document according to the universal text segmenter to obtain at least one second text block, thereby determining the first text block and the second text block corresponding to each document as multiple text blocks corresponding to each document.

[0073] Since a text segmenter that matches the document type may not necessarily cover all text contents of a document, in this embodiment, the target text segmenter set includes not only text segmenters that match the document type of the document, but also general text segmenters, which may be recursive segmenters.

[0074] For example, assuming that the document is a paper, the target text segmenter set corresponding to the document may include abstracts, keywords, citations, and general text segmenters. The abstract text segmenter is used to identify and segment the abstract part from the document, the keyword text segmenter is used to identify and segment the keyword part from the document, and the citation text segmenter is used to identify and segment the citation part from the document, so that the aforementioned abstract part, keyword part, and citation part are respectively used as the first text block. Afterwards, a general text segmenter is used to perform text segmentation processing on the remaining content in the document content (at this time, the document content no longer includes the abstract, keywords, and citation parts) to obtain at least one second text block. Thus, the first text block and the second text block corresponding to the document are determined as multiple text blocks corresponding to the document.

[0075] It should be noted that by segmenting the document content into text blocks with complete semantics, the system can hit a more complete result during search queries, thereby improving retrieval accuracy. In addition, by adding a general text segmenter to the target text segmenter set, the comprehensiveness of text segmentation can be effectively improved to avoid omission of document content.

[0076] It can be seen that the solution provided by the present application achieves the purpose of performing document retrieval for users based on text blocks in the document, thereby achieving the technical effect of improving retrieval accuracy, and further solving the technical problem of low document retrieval accuracy in related technologies.

[0077] Example 2

[0078] According to an embodiment of the present invention, an embodiment of a document retrieval device is provided, wherein: Figure 4 is a schematic diagram of an optional document retrieval device according to an embodiment of the present invention, such as Figure 4 As shown, the device comprises:

[0079] The receiving module 401 is used to receive a document retrieval request from a user and extract document retrieval information from the document retrieval request;

[0080] A retrieval module 402 is used to search in multiple text blocks based on the document retrieval information to obtain a target text block that matches the document retrieval information, wherein the text block is a text segment obtained by segmenting the document according to a target text segmentation set, and the target text segmentation set includes a text segmentation that matches the document type of the document;

[0081] The first processing module 403 is used to return the document information corresponding to the target text block and the target text block to the user.

[0082] It should be noted that the above-mentioned receiving module 401, retrieval module 402 and first processing module 403 correspond to steps S101 to S103 in the above-mentioned embodiment. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned embodiment 1.

[0083] Optionally, the document retrieval device also includes: an acquisition module, used to acquire multiple documents and determine the document content of each document; a first determination module, used to determine the content description information of the document from the document for each document; a second determination module, used to determine the document type of the document based on the content description information of the document; a second processing module, used to determine the target text segmenter set corresponding to each document based on the document type of each document, and perform text segmentation on the document content of the document based on the target text segmenter set to obtain multiple text blocks corresponding to each document.

[0084] Optionally, the acquisition module also includes: a first determination submodule, used to determine the document format of the document; a second determination submodule, used to determine the content extraction method of the document according to the document format of the document; an extraction module, used to extract content from the document according to the content extraction method, and determine the extracted content as the document content of the document.

[0085] Optionally, the first determination module also includes: a judgment submodule, used to judge whether the document name of the document is in the target format; a third determination submodule, used to determine the document name as the content description information of the document when the document name is in the target format; and a fourth determination submodule, used to determine the content in the target range in the document content as the content description information of the document when the document name is not in the target format.

[0086] Optionally, the second determination module also includes: a first processing sub-module, used to perform word segmentation processing on the content description information of the document to obtain multiple word segments; a second processing sub-module, used to perform numerical conversion on the multiple word segments to obtain a numerical sequence composed of numerical values ​​corresponding to the multiple word segments; and a third processing sub-module, used to process the numerical sequence according to the target classification model to obtain the document type corresponding to the document.

[0087] Optionally, the third processing submodule also includes: a judgment unit, used to judge whether the length of the numerical sequence is less than a preset length; a first processing unit, used to fill the numerical sequence when the length of the numerical sequence is less than the preset length to obtain a target numerical sequence; a generation unit, used to generate an attention mask sequence corresponding to the target numerical sequence, wherein the attention mask sequence is used to guide the target classification model to focus on the target elements in the target numerical sequence when processing the target numerical sequence; a second processing unit, used to process the target numerical sequence and the attention mask sequence according to the target classification model to obtain the document type corresponding to the document.

[0088] Optionally, the second processing module also includes: a fourth processing sub-module, used for performing text segmentation processing on the document content for each document according to a text segmenter that matches the document type, to obtain multiple first text blocks; a fifth processing sub-module, used for performing text segmentation processing on the remaining content in the document according to a universal text segmenter, to obtain at least one second text block; and a fifth determination sub-module, used for determining the first text blocks and the second text blocks corresponding to each document as multiple text blocks corresponding to each document.

[0089] Example 3

[0090] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned document retrieval method when running.

[0091] Example 4

[0092] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, wherein: Figure 5 is a schematic diagram of an optional electronic device according to an embodiment of the present invention, such as Figure 5 As shown, the electronic device includes one or more processors; a memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the above-mentioned document retrieval method when running.

[0093] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0094] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0095] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0096] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed over multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0097] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0098] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc., which can store program code.

[0099] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A document retrieval method, characterized in that: include: Receiving a document retrieval request from a user, and extracting document retrieval information from the document retrieval request; Based on the document retrieval information, a search is performed in a plurality of text blocks to obtain a target text block matching the document retrieval information, wherein the text block is a text segment obtained by performing text segmentation on the document according to a target text segmenter set, and the target text segmenter set includes a text segmenter matching the document type of the document; The document information corresponding to the target text block and the target text block are returned to the user.

2. The method according to claim 1, characterized in that The multiple text blocks are obtained in the following manner: Obtain multiple documents and determine the document content of each document; For each document, determining content description information of the document from the document; Determining the document type of the document according to the content description information of the document; According to the document type of each document, a target text segmenter set corresponding to each document is determined, and the document content of the document is segmented according to the target text segmenter set to obtain multiple text blocks corresponding to each document.

3. The method according to claim 2, characterized in that Determine the document content of each document, including: determining a document format of the document; Determining a method for extracting content from the document according to a document format of the document; Content is extracted from the document according to the content extraction method, and the extracted content is determined as the document content of the document.

4. The method according to claim 2, characterized in that: Determining content description information of the document from the document includes: Determining whether the document name of the document is in the target format; In case the document name of the document is in the target format, determining the document name as content description information of the document; In the case that the document name of the document is not in the target format, the content at the target range in the document content is determined as the content description information of the document.

5. The method according to claim 2, characterized in that: Determining the document type of the document according to the content description information of the document includes: Performing word segmentation processing on the content description information of the document to obtain multiple word segments; Performing numerical conversion on the multiple participles to obtain a numerical sequence consisting of numerical values ​​corresponding to the multiple participles; The numerical sequence is processed according to a target classification model to obtain a document type corresponding to the document.

6. The method according to claim 5, characterized in that The numerical sequence is processed according to the target classification model to obtain the document type corresponding to the document, including: Determining whether the length of the numerical sequence is less than a preset length; When the length of the numerical sequence is less than the preset length, padding the numerical sequence to obtain a target numerical sequence; Generate an attention mask sequence corresponding to the target numerical sequence, wherein the attention mask sequence is used to guide the target classification model to focus on the target elements in the target numerical sequence when processing the target numerical sequence; The target numerical sequence and the attention mask sequence are processed according to the target classification model to obtain a document type corresponding to the document.

7. The method according to claim 2, characterized in that The target text segmenter set includes a text segmenter matching the document type of the document and a universal text segmenter, wherein the universal text segmenter refers to a text segmenter applicable to multiple document types, wherein the document content of the document is segmented according to the target text segmenter set to obtain multiple text blocks corresponding to each document, including: For each document, performing text segmentation processing on the document content according to a text segmenter matched with the document type of the document to obtain a plurality of first text blocks; Performing text segmentation processing on the remaining content in the document content according to the universal text segmenter to obtain at least one second text block; The first text block and the second text block corresponding to each document are determined as a plurality of text blocks corresponding to each document.

8. A document retrieval device, characterized in that: include: A receiving module, used to receive a document retrieval request from a user and extract document retrieval information from the document retrieval request; A retrieval module, configured to search in a plurality of text blocks based on the document retrieval information to obtain a target text block matching the document retrieval information, wherein the text block is a text segment obtained by performing text segmentation on a document according to a target text segmentation set, wherein the target text segmentation set includes a text segmentation that matches a document type of the document; The first processing module is used to return the document information corresponding to the target text block and the target text block to the user.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the document retrieval method described in any one of claims 1 to 7 when running.

10. An electronic device, characterized in that: The electronic device includes one or more processors; A memory for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to run the programs, wherein the programs are configured to execute the document retrieval method described in any one of claims 1 to 7 when run.

Citation Information

Patent Citations

  • Text classification and model training method, system and device and storage medium

    CN114896396A

  • Document retrieval method and device and electronic equipment

    CN114925174A

  • Self-adaptive text segmentation method and device for inputting large model

    CN118152568A

  • Document processor

    JP1995110824A

Cited By

  • Text generation method and device, electronic equipment and computer readable storage medium

    CN119647406A