Information search method, electronic device, and storage medium
Patent Information
- Application Number
- CN202610967652.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-30
- Publication Date
- 2026-10-27
AI Technical Summary
因此,在这种情况下,如果对生成的PDF文件中的一些内容进行核对或者查找,则会导致核对错误、查找效率低等问题
Smart Images

Figure CN122986142A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more particularly to information retrieval methods, electronic devices, and storage media. Background Technology
[0002] With the development of electronic document technology, the PDF document format has been widely used. Traditional PDF readers typically employ an exact-matching retrieval mechanism for searching and matching.
[0003] With the development of artificial intelligence (AI) technology, uncontrollable errors can be introduced when generating, processing, and searching PDF files due to the inherent capabilities of AI models. For example, during document recognition, AI models may modify text content, such as correcting formatting and typos, and may also alter the layout. Therefore, in such cases, verifying or searching within the generated PDF file can lead to errors and low search efficiency. Thus, a solution is needed to improve the efficiency and accuracy of information retrieval. Summary of the Invention
[0004] This disclosure provides information retrieval methods, electronic devices, and storage media.
[0005] According to a first aspect of this disclosure, an information retrieval method is provided. The method specifically includes: acquiring a file to be queried and target information; calculating the character similarity and word order similarity between the file to be queried and the target information; when both character similarity and word order similarity meet preset threshold conditions, weighting and fusing the character similarity and word order similarity according to preset weights to obtain a comprehensive similarity; and determining the search results from the file to be queried based on the comprehensive similarity.
[0006] Calculating the character similarity and word order similarity between a query file and target information according to at least one embodiment of this disclosure includes: calculating the character similarity between characters in the query file and characters in the target information using a first similarity algorithm; and calculating the word order similarity between word sequences in the query file and word sequences in the target information using a second similarity algorithm.
[0007] According to at least one embodiment of this disclosure, the character similarity between characters in a query file and characters in target information is calculated using a first similarity algorithm, including: converting the text content of the page of the query file into a first character sequence; and converting the target information into a second character sequence; determining the larger of the number of elements in the first character sequence and the number of elements in the second character sequence; calculating the minimum number of single-character editing operations required to convert the second character sequence into the first character sequence to obtain an edit distance value; and calculating the character similarity based on the edit distance value and the larger number of elements.
[0008] According to at least one embodiment of this disclosure, the word order similarity between a word sequence in a query file and a word sequence in target information is calculated using a second similarity algorithm, including: performing word segmentation on the text content of the page of the query file to obtain a first word set; and performing word segmentation on the target information to obtain a second word set; calculating the intersection size and the union size of the first word set and the second word set; and determining the word order similarity based on the ratio of the intersection size to the union size; wherein the word segmentation includes the steps of removing stop words, punctuation marks, and stemming, and the word set does not contain the order of word items.
[0009] According to at least one embodiment of this disclosure, obtaining a file to be queried and target information includes: using a cosine similarity algorithm to find at least one alternative page related to the target information from the file to be queried; and obtaining paragraph identifiers and page numbers related to the target information from the alternative pages.
[0010] According to at least one embodiment of this disclosure, a cosine similarity algorithm is used to find at least one candidate page related to target information from a file to be queried, including: converting the target information into a first vector and converting the page content in the file to be queried into a second vector; calculating the cosine similarity between the first vector and the second vector; and selecting at least one page with a cosine similarity greater than a preset cosine threshold as a candidate page.
[0011] According to at least one embodiment of this disclosure, when at least one of character similarity and word order similarity does not meet a preset threshold condition, the user is prompted that no exact matching content was found, and the user is provided with the K candidate results with the highest similarity for selection, where K is an integer greater than 0.
[0012] According to at least one embodiment of this disclosure, determining the search result from the file to be queried based on comprehensive similarity includes: comparing the comprehensive similarity with a preset matching threshold, and determining a valid match when the comprehensive similarity is greater than or equal to the matching threshold; sorting all matching results according to the comprehensive similarity, and selecting the top M results as the search result; wherein the search result contains at least one of the matching page number, paragraph content, and similarity score; and M is an integer greater than 0.
[0013] According to a second aspect of this disclosure, an electronic device is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, such that the processor performs a first aspect of any embodiment of this disclosure.
[0014] According to a third aspect of this disclosure, a readable storage medium is provided, wherein executable instructions are stored therein, which, when executed by a processor, are used to implement a first aspect of any embodiment of this disclosure.
[0015] According to a fourth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a first aspect of any embodiment of this disclosure. Attached Figure Description
[0016] The accompanying drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0017] Figure 1 This is a flowchart illustrating the information retrieval method provided in an embodiment of this disclosure.
[0018] Figure 2 This is a flowchart illustrating a similarity calculation method as exemplified by an embodiment of the present disclosure.
[0019] Figure 3 This is a flowchart illustrating the character similarity calculation method provided in an embodiment of this disclosure.
[0020] Figure 4 This is a flowchart illustrating the word order similarity calculation method provided in the embodiments of this disclosure.
[0021] Figure 5 This is a flowchart illustrating the method for processing a queried file provided in an embodiment of this disclosure.
[0022] Figure 6 This is a flowchart illustrating the alternative page selection method provided in an embodiment of the present disclosure.
[0023] Figure 7 This is a flowchart illustrating the search result retrieval method provided in this embodiment of the disclosure.
[0024] Figure 8 This is a schematic block diagram of an information retrieval device according to one embodiment of the present disclosure.
[0025] Figure 9 This is a schematic block diagram of an electronic device according to one embodiment of the present disclosure. Detailed Implementation
[0026] The present disclosure will now be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are for illustrative purposes only and are not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the present disclosure are shown in the accompanying drawings.
[0027] It should be noted that, where there is no conflict, the embodiments and features described in this disclosure can be combined with each other. The technical solutions of this disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0028] Figure 1 This is a schematic flowchart illustrating the information retrieval method provided in an embodiment of this disclosure. For example... Figure 1 The method shown includes steps S101 to S104. This method can be executed by the server. This solution can be used not only to query for errors in a file, but also to find content that a user wants to find (e.g., searching for keywords).
[0029] Specifically, Figure 1 The method shown includes step S101: obtaining the file to be queried and target information.
[0030] It's important to note that the "file to be queried" here refers to an electronic document for which content (which could be the user's desired content or content where errors occurred during document processing) needs to be retrieved or searched. It is typically a PDF file containing structured or unstructured text content. This file may have been processed by an artificial intelligence model (meaning some content or formatting has changed). In practice, the file to be queried is parsed into structured data containing page numbers and paragraph structure information to facilitate subsequent information retrieval. The "target information" refers to the text content the user hopes to find in the file to be queried. This can be a complete sentence, paragraph, or keyword phrase, entered by the user or automatically generated by the system (e.g., for error checking).
[0031] In one alternative approach, the system retrieves the file to be queried via a file upload interface and receives the target information through a text input box. The file to be queried is first parsed using Node.js, extracting the plain text content of each page while retaining page numbers and paragraph structure information, forming structured data storage. For example, a page of PDF content might be parsed into JSON format: {"page":5,"paragraphs":["First paragraph content...","Second paragraph content..."]}. This structured storage facilitates subsequent precise paragraph matching and searching.
[0032] Step S102: Calculate the character similarity and word order similarity between the file to be queried and the target information.
[0033] It should be noted that the character similarity mentioned here refers to a numerical value calculated using a similarity algorithm (such as the edit distance algorithm, the Damerau-Levenshtein Distance algorithm, etc.), reflecting the degree of similarity between the query file and the target information at the character sequence level. This algorithm is sensitive to character-level differences, and the similarity calculation result can range from [0,1], with larger values indicating higher character-level similarity. The word order similarity mentioned here refers to a numerical value calculated using another similarity algorithm (such as the overlap coefficient algorithm, the Jaccard similarity algorithm, etc.), reflecting the degree of similarity between the query file and the target information at the term set level. This similarity algorithm is insensitive to changes in word order, and the similarity calculation result can range from [0,1], with larger values indicating higher term overlap.
[0034] In PDF text processing scenarios, content changes often involve both character-level differences and word order changes. A single-dimensional similarity assessment cannot fully reflect the semantic relationship between the query text and the target information. For example, when a text processing system (a text processing system combining OCR and artificial intelligence) transforms "payment period is thirty days" into "payment period is 30 days," the character-level changes are significant, but the semantics remain consistent. Conversely, when "the client should pay upon receipt of the goods" is adjusted to "the client should pay upon receipt of the goods," the word order changes significantly, but the core meaning remains unchanged. By simultaneously calculating both types of similarity, a more comprehensive assessment of the text matching degree can be achieved.
[0035] Step S103: When both character similarity and word order similarity meet the preset threshold conditions, the character similarity and word order similarity are weighted and fused according to the preset weights to obtain the comprehensive similarity.
[0036] It should be noted that the threshold conditions mentioned here refer to the pre-set similarity thresholds corresponding to the two algorithms, which are used to determine whether the character similarity and word order similarity meet the standard for effective matching. For example, the pre-set threshold can be a value greater than or equal to 0.7.
[0037] In practical applications, a dual verification mechanism is introduced, whereby weighted fusion calculation is only performed when both character similarity and word order similarity meet the minimum criteria for a valid match. This design avoids the risk of misjudgment based on a single similarity metric, ensuring the reliability of the matching results.
[0038] The weighted fusion process linearly combines two similarities according to preset weights to obtain a comprehensive similarity that reflects the overall matching confidence. It's important to note that the weight values can be dynamically adjusted based on the characteristics of different business scenarios, allowing the system to optimize the matching strategy for specific application scenarios. For example, in scenarios with high requirements for character accuracy, character similarity can be given higher weight; while in scenarios that focus more on semantic consistency, the weight ratio of word order similarity can be increased. The combination of dual threshold verification and weighted fusion enables the system to maintain a high recall rate while controlling the false positive rate, achieving a balance between accuracy and robustness.
[0039] Step S104: Determine the search results from the file to be queried based on the comprehensive similarity.
[0040] The final search result is determined based on the overall similarity value. The system compares the overall similarity with a preset matching threshold (e.g., 0.75). When the overall similarity is greater than or equal to the threshold, it is considered a valid match, and the matching position (including page number and paragraph identifier) is recorded.
[0041] In its implementation, the system sorts all candidate paragraphs based on their overall similarity and selects the top-ranked results as the final search outcome. The system returns the matching page number, paragraph content, and similarity score, and automatically navigates to the matching location and highlights the relevant paragraph in the PDF reader interface. Furthermore, it supports exporting a matching report that compares the algorithm results with the original text, allowing users to verify the accuracy of the matching results.
[0042] Based on the above-mentioned publicly available solutions, the dual verification mechanism of character similarity and word order similarity effectively solves the problem of inaccurate search results caused by diverse expression changes in the text processing process. For example, character-level differences (such as number format conversion and typos) and word order changes (such as sentence reconstruction and synonym replacement) significantly improve the matching accuracy in the text processing scenarios of artificial intelligence models.
[0043] In one or more embodiments of this disclosure, such as Figure 2 This is a flowchart illustrating a similarity calculation method as exemplified by an embodiment of this disclosure. Figure 2 As shown, step S102, calculating the character similarity and word order similarity between the query file and the target information, includes: Step S1021: Calculating the character similarity between characters in the query file and characters in the target information using a first similarity algorithm. Step S1022: Calculating the word order similarity between word sequences in the query file and word sequences in the target information using a second similarity algorithm.
[0044] In practical applications, the candidate text in the file to be queried and the target information are respectively regarded as character sequences, and a first similarity algorithm is applied for comparison. When selecting the first similarity algorithm, a relevant algorithm that is highly sensitive to character-level differences and can accurately detect insertion, deletion, and substitution operations in character sequences is selected. For example, in a contract review scenario, when the target information is "the payment term is 30 days" and the corresponding text in the file to be queried is "the payment term is thirty days", the first similarity algorithm can identify the content with character-level differences but the same meaning between "30" and "thirty", and can use the first similarity algorithm to quantify the degree of this difference.
[0045] In an optional solution, an edit distance algorithm can be selected as the implementation of the first similarity algorithm. The edit distance algorithm measures the difference by calculating the minimum number of single-character edit operations required to convert one character sequence into another, and then obtains a similarity score in the range of 0-1 through normalization processing. For example, converting "30 days" to "thirty days" requires 2 substitution operations. If the maximum character length is 5, the calculated character similarity = 1-(2 / 5) = 0.6.
[0046] It should be noted that the first similarity algorithm is not limited to the edit distance algorithm. Other algorithms that meet the requirement of being sensitive to character-level differences can also be used as the implementation of the first similarity algorithm, such as Damerau-Levenshtein distance, Longest Common Subsequence, etc. All these algorithms can effectively capture differences at the character sequence level and provide a reliable basis for character similarity calculation.
[0047] In practical applications, word segmentation processing is performed on the target information and the candidate text in the file to be queried to decompose the text into basic term units, and then a second similarity algorithm is applied to compare the similarity degree of the two term sets. This algorithm is robust to word order changes and can identify content with consistent semantics but different expression forms. For example, in a legal document scenario, when the target information is "Party A shall make payment after receiving the goods" and the corresponding text in the file to be queried is "Party A shall make payment after receiving the goods", although the word order has changed, the second similarity algorithm can still identify the term overlap. Therefore, the selection of the second similarity algorithm needs to consider its insensitivity to word order changes.
[0048] In one alternative approach, the Jaccard algorithm can be chosen as the second similarity algorithm. The Jaccard algorithm measures similarity by calculating the ratio of the intersection size to the union size of two term sets. Continuing with the legal document example above, the term sets obtained after word segmentation have high overlap, and the Jaccard similarity may reach above 0.85, indicating that despite changes in word order, the core content is highly consistent. Similarly, the second similarity algorithm is not limited to the Jaccard algorithm. Other algorithms that meet the requirement of insensitivity to word order changes can also be used as implementations of the second similarity algorithm, such as the Sørensen-Dice coefficient and the overlap coefficient. These algorithms can all effectively assess the degree of overlap at the term set level, providing diverse options for word order similarity calculation.
[0049] Based on the publicly available solutions described above, an effective dual verification mechanism is formed by simultaneously utilizing two algorithms. Fusion is only performed when both algorithms meet threshold conditions, effectively filtering out the risk of misjudgment from a single algorithm and significantly improving the reliability of the matching results. The system can also automatically adjust the matching focus according to different business scenarios. In scenarios with high character accuracy requirements, such as contract review, the first algorithm is prioritized; in scenarios with high semantic consistency requirements, such as academic citations, the second algorithm is prioritized, ensuring that the matching strategy accurately matches business needs.
[0050] In one or more embodiments of this disclosure, such as Figure 3 This is a flowchart illustrating the character similarity calculation method provided in an embodiment of this disclosure. Figure 3 As shown, step S1021, which calculates the character similarity between the characters in the query file and the characters in the target information using a first similarity algorithm, includes: Step S301: Converting the text content of the page in the query file into a first character sequence; and converting the target information into a second character sequence. Step S302: Determining the larger of the number of elements in the first character sequence and the number of elements in the second character sequence. Step S303: Calculating the minimum number of single-character editing operations required to convert the second character sequence into the first character sequence, and obtaining the edit distance value. Step S304: Calculating the character similarity based on the edit distance value and the larger number of elements. Wherein, character similarity = 1 - (edit distance value / larger number of elements); where single-character editing operations include insertion, deletion, and replacement operations, and the cost of replacement operation is 2.
[0051] It should be noted that the edit distance value mentioned here refers to the minimum number of single-character edit operations required to convert the second character sequence into the first character sequence, reflecting the degree of difference between the two character sequences. The larger the edit distance value, the greater the difference between the sequences.
[0052] The single-character edit operation referred to herein refers to the basic operation types allowed when calculating the edit distance, including an insertion operation (adding a character to the sequence), a deletion operation (removing a character from the sequence), and a replacement operation (replacing one character in the sequence with another character). The cost of the replacement operation refers to the cost value counted for performing one replacement operation when calculating the edit distance. In an optional solution, the cost of the replacement operation may be set to 2, which is higher than the cost of the insertion and deletion operations (for example, may be set to 1), so as to reflect the feature that the replacement operation has a greater impact on text semantics.
[0053] In practical applications, the text content of the candidate page in the file to be queried is converted into a first character sequence. After the file to be queried is parsed by Node.js, structured data including page numbers and paragraph structures contained in the candidate page is generated. When it is determined that character-level matching needs to be performed on the candidate page, the text content (or a specific paragraph) of the candidate page is extracted and converted into an ordered character sequence. For example, for a page containing the text "the payment term is thirty days", it is converted into the first character sequence: ["pay", "money", "term", "limit", "is", "three", "ten", "days"].
[0054] At the same time, the target information is converted into a second character sequence. For example, when the user inputs "the payment term is 30 days" as the target information, the system converts it into the second character sequence: ["pay", "money", "term", "limit", "is", "3", "0", "days"].
[0055] This character sequence conversion process retains the original character information and order of the text, preparing for subsequent precise character-level comparison. It should be noted that the character sequence conversion process does not perform any normalization processing (such as case conversion, full-width and half-width conversion, etc.), so as to avoid interfering with the original text, which is not conducive to the subsequent search of the target information.
[0056] After the character sequence conversion is completed, the larger value among the number of elements of the two sequences is calculated and determined. Specifically, the number of elements contained in the first character sequence and the second character sequence is counted respectively, and then the maximum value of the two is taken as the larger element count.
[0057] Continuing the above example: the number of elements of the first character sequence ["pay", "money", "term", "limit", "is", "three", "ten", "days"] = 8. The number of elements of the second character sequence ["pay", "money", "term", "limit", "is", "3", "0", "days"] = 8. The larger element count = max(8,8) = 8.
[0058] In another example, if the first character sequence is ["He", "Tong", "Bian", "Hao", ":", "A", "1", "2", "3"] (with 9 elements) and the second character sequence is ["He", "Tong", "Bian", "Hao", ":", "A", "1", "2"] (with 8 elements), then the larger element count = max(9, 8) = 9.
[0059] The purpose of determining the larger element count is to provide a basis for the subsequent normalization of the edit distance value. Using the larger element count for normalization instead of a fixed length can ensure that the similarity score is comparable across texts of different lengths.
[0060] Next, calculate the minimum number of single-character edit operations required to convert the second character sequence (obtained by converting the target information) into the first character sequence (obtained by converting the file to be queried).
[0061] In a specific implementation, a dynamic programming algorithm is used to calculate the edit distance value. For example, the edit distance calculation has a special setting: the cost of a substitution operation is 2, while the cost of insertion and deletion operations is 1. Thus, when calculating the edit distance value, it can be reflected that a substitution operation (such as substituting "thirty" for "30") usually has a greater impact on the text semantics than an insertion or deletion operation.
[0062] Continuing the example of the contract review scenario: the first character sequence (original text): ["Fu", "Kuan", "Qi", "Xian", "Wei", "San", "Shi", "Tian"]. The second character sequence (target): ["Fu", "Kuan", "Qi", "Xian", "Wei", "3", "0", "Tian"]. It is necessary to substitute "San" with "3" and "Shi" with "0", totaling 2 substitution operations. Since the cost of each substitution operation is 2, the total edit distance value = 2 × 2 = 4.
[0063] In the example of the OCR scenario: the first character sequence (original text): ["He", "Tong", "Bian", "Hao", ":", "A", "1", "2", "3"], the second character sequence (target): ["He", "Tong", "Bian", "Hao", ":", "A", "1", "2"]. It is necessary to insert "3" at the end of the target sequence, totaling 1 insertion operation. Since the cost of the insertion operation is 1, the total edit distance value = 1.
[0064] This setting enables the edit distance to better reflect the degree of influence of text changes on semantics, and is particularly effective when dealing with problems such as number format changes and character deletions that may be introduced by artificial intelligence models.
[0065] Further, the character similarity is calculated according to the edit distance value and the larger element count, and the calculation formula is: character similarity = 1 - (edit distance value / larger element count).
[0066] As in the contract review scenario example mentioned above, the edit distance value = 4 (2 replacements, each costing 2), the number of larger elements = 8, and the character similarity = 1 - (4 / 8) = 0.5.
[0067] As shown in the OCR scenario example above, the edit distance value = 1 (1 insertion), the number of larger elements = 9, and the character similarity = 1 - (1 / 9) ≈ 0.89.
[0068] A higher similarity score indicates a higher degree of similarity. In practical applications, the system performs this calculation for each candidate paragraph in the file to be queried, obtaining the corresponding character similarity score.
[0069] Based on the publicly available solutions described above, normalization using a larger number of elements ensures the comparability of similarity scores between texts of different lengths. In scenarios where AI processing may lead to variations in text length (such as missing OCR characters or AI-added content), this method avoids similarity assessment biases caused by differences in text length, significantly improving matching accuracy. Furthermore, it enables edit distance calculation to more accurately reflect the impact of different types of character changes on text semantics. By comprehensively utilizing a larger number of elements and edit distance values, the ability to detect character-level changes and the matching accuracy of information retrieval methods in practical applications are significantly improved.
[0070] In one or more embodiments of this disclosure, such as Figure 4 This is a flowchart illustrating the word order similarity calculation method provided in an embodiment of this disclosure. Figure 4 As shown, step S1022, which calculates the word order similarity between the word sequence in the query file and the word sequence in the target information using the second similarity algorithm, includes: Step 401: performing word segmentation on the text content of the page in the query file to obtain a first term set; and performing word segmentation on the target information to obtain a second term set. Step 402: calculating the intersection and union of the first term set and the second term set. Step 403: determining the word order similarity based on the ratio of the intersection size to the union size; wherein, the word segmentation includes the steps of removing stop words, punctuation marks, and stemming, and the term set does not include the order of the terms.
[0071] It should be noted that the word sequence referred to herein refers to a sequence of words arranged in order in a text. The word sequence is the input of word segmentation processing, but is not used as the basis for final calculation, because the second similarity algorithm is insensitive to changes in word order. The first term set referred to herein refers to a term set obtained by performing word segmentation processing on the text content of a specific page in the file to be queried, without considering the word order. The first term set represents the term representation form of the candidate matching content in the file to be queried. The second term set referred to herein refers to a term set obtained by performing word segmentation processing on the target information, without considering the word order. The second term set represents the term representation form of the content that the user intends to find.
[0072] In practical applications, word segmentation processing is first performed on the text. After the file to be queried is parsed by Node.js, structured data including page numbers and paragraph structures contained in the candidate pages is obtained. When it is determined that term-level matching needs to be performed on the candidate pages, the text content (or a specific paragraph) of the candidate pages is extracted, and a complete word segmentation processing procedure is executed.
[0073] The procedure of word segmentation processing may include: basic word segmentation, stop word removal, punctuation removal, stemming, and the like.
[0074] For example, in a contract review scenario, the page text of the file to be queried is "Party A shall make the payment within thirty days after receiving the goods." Correspondingly, the target information is "Party A shall make the payment within 30 days after receiving the goods".
[0075] The word segmentation processing procedure is as follows: first perform basic word segmentation, and segment a piece of text in the file to be queried: ["Party A", "shall", "within", "receive", "goods", "after", "thirty", "days", "inside", "make payment", "."]. The target information is segmented into: ["Party A", "receive", "goods", "after", "30", "days", "shall", "make payment"].
[0076] After removing stop words and punctuation and performing stemming, the following are finally obtained: the first term set: {"Party A", "receive", "goods", "thirty", "days", "make payment"}, and the second term set: {"Party A", "receive", "goods", "30", "days", "make payment"}.
[0077] The term set does not contain the arrangement order of terms, which is the key design for the second similarity algorithm to be insensitive to changes in word order. For example, in a legal document scenario, when the original text is "Party A shall make the payment after receiving the goods" and the target information is "Party A shall make the payment after receiving the goods", although the word order changes, the term sets highly overlap, and the semantic consistency can still be identified.
[0078] After word segmentation, calculate the intersection and union of the two word sets. Intersection size calculation: count the number of words that appear in both the first and second word sets. Union size calculation: count the total number of unique words appearing in either word set.
[0079] Based on the contract review scenario example described above, the first term set is: {"Party A", "Received", "Goods", "Thirty", "Days", "Payment"}, and the second term set is: {"Party A", "Received", "Goods", "30", "Days", "Payment"}. The calculated intersection is: {"Party A", "Received", "Goods", "Days", "Payment"}, with an intersection size of 5. The calculated union is: {"Party A", "Received", "Goods", "Thirty", "Days", "Payment", "30"}, with a union size of 7.
[0080] Finally, word order similarity is calculated based on the ratio of intersection size to union size. The formula is: word order similarity = intersection size / union size.
[0081] For example, in a contract review scenario, the intersection size is 5, the union size is 7, and the word order similarity is approximately 5 / 7 ≈ 0.714.
[0082] This Jaccard similarity-based calculation method is completely insensitive to word order changes and can effectively identify semantically identical content with different expressions. It should be noted that by removing stop words and punctuation, it can focus more on matching key semantic terms; and through stemming, it can identify semantically related terms with different forms, further improving the robustness of the matching.
[0083] In practical applications, the system performs the above calculation for each candidate paragraph in the query file to obtain the corresponding word order similarity, which serves as an important basis for subsequent fusion decisions. For example, in legal document scenarios, even if the AI adjusts the word order of "Party A should pay after receiving the goods" to "Party A should pay after receiving the goods", the calculated word order similarity result is still close to 1.0, indicating a high degree of semantic consistency.
[0084] Based on the aforementioned publicly available solutions, by representing text as a set of terms regardless of word order and calculating similarity based on the ratio of intersection to union, the system becomes insensitive to changes in word order. This significantly improves the adaptability of information retrieval methods to word order changes and synonym substitutions in practical applications, thereby increasing search efficiency and accuracy.
[0085] In one or more embodiments of this disclosure, such as Figure 5 This is a flowchart illustrating the method for processing a queried file provided in an embodiment of this disclosure. Figure 5As shown, step S101, obtaining the file to be queried and the target information, includes: Step S1011: Using a cosine similarity algorithm, finding at least one alternative page related to the target information from the file to be queried. Step S1012: Obtaining the paragraph identifier and page number related to the target information from the alternative pages.
[0086] In practical applications, performing detailed matching across the entire text of PDF documents exceeding 100 pages is computationally expensive. By first identifying candidate pages semantically relevant to the target information, the computationally intensive matching operations can be limited to a small number of candidate pages, significantly improving overall retrieval efficiency. One alternative approach is to utilize the cosine similarity algorithm to evaluate the semantic relevance between the target information and each page in the query file. This algorithm can quickly calculate the similarity between texts with low time complexity, making it suitable for the initial screening of large-scale documents. When the target information is "payment period is 30 days," pages containing "payment period is 30 days" will receive higher cosine similarity scores and will thus be selected as candidate pages.
[0087] It should be noted that besides the cosine similarity algorithm, there are other similar algorithms, such as the BM25 algorithm, latent semantic indexing, and word vector averaging. In practical applications, users can selectively use other algorithms as needed.
[0088] After identifying candidate pages, the system retrieves paragraph identifiers and page numbers relevant to the target information from these pages, providing structured data support for subsequent paragraph-level matching. Specifically, the parsed document retains page numbers and paragraph structure information. This structured representation allows the system to further locate specific paragraphs within the page, achieving more refined matching.
[0089] Page numbers indicate the macroscopic location of the matched content within the document being queried, enabling quick navigation to the relevant page. Since pages often contain many paragraphs, paragraph markers are used for precise positioning within the page.
[0090] Taking a contract review scenario as an example, when the target information is "payment period is 30 days", page 5 is selected as a candidate page through cosine similarity (because it contains "payment period is 30 days"). The paragraph structure of this page is obtained: page 5 contains 3 paragraphs. The paragraph identifier "5-2" (the second paragraph on page 5) and the page number 5 are recorded as the basis for subsequent matching.
[0091] Based on the publicly available solutions mentioned above, by introducing a page-level positioning mechanism, the search scope for subsequent fine-grained matching can be narrowed down from the full text to at least a few candidate pages. This strategy of first coarsely screening and then refining significantly reduces computational complexity, enabling the retrieval of documents with more than 100 pages to be completed in a short time (e.g., within seconds), thus solving the problem of low efficiency in large-scale document processing.
[0092] In one or more embodiments of this disclosure, such as Figure 6 This is a flowchart illustrating the alternative page selection method provided in an embodiment of this disclosure. Figure 6 As shown, step S1011, which uses the cosine similarity algorithm to find at least one candidate page related to the target information from the file to be queried, includes: Step S601: Converting the target information into a first vector and converting the page content in the file to be queried into a second vector. Step S602: Calculating the cosine similarity between the first vector and the second vector. Step S603: Selecting at least one page with a cosine similarity greater than a preset cosine threshold as a candidate page.
[0093] In practical applications, the target information is converted into a first vector, while the content of each page in the query file is converted into a corresponding second vector. This vector conversion process can be based on the TF-IDF algorithm, achieved by constructing a global vocabulary and calculating term weights. Specifically, stop words and punctuation are removed, retaining only terms with actual semantic value. Then, the term frequency (TF) and inverse document frequency (IDF) of each term are calculated, where IDF = log(total number of pages / number of pages containing the term). The final TF-IDF value is used as the weight of the vector dimension. For example, in a contract review scenario, when the target information is "payment period is 30 days" and the query file is a 100-page contract document, the term "payment" has a frequency of 1 in the target information and appears on page 80 of the 100-page contract. Therefore, its IDF value is log(100 / 80) = 0.097, and its TF-IDF value is 1 × 0.097 = 0.097. By filling the corresponding dimensions with the TF-IDF values of all terms, the system generates a first vector of target information and a second vector for each page.
[0094] After vector transformation, the cosine similarity between the first vector and each second vector is calculated. The calculation process includes: first, calculating the dot product of the two vectors, i.e., the sum of the products of their corresponding dimensions; then, calculating the Euclidean magnitudes of the two vectors respectively; finally, dividing the dot product by the product of the magnitudes of the two vectors to obtain the cosine similarity value. Continuing with the contract review example mentioned earlier, if the first vector is [0.097,0.097,0.097,0.097,0,...,0], and the second vector on page 5 is [0.08,0.08,0,0.08,0.1,...,0], then the dot product is 0.0233, the vector magnitudes are 0.194 and 0.15 respectively, and the cosine similarity is approximately 0.80. Cosine similarity calculation has the advantage of high computational efficiency, especially suitable for rapid screening of large-scale documents. In a 100-page PDF document, this calculation can be completed within milliseconds, providing efficient support for subsequent fine-grained matching.
[0095] The candidate page is selected based on the calculated cosine similarity value, mainly using two strategies.
[0096] The first method is the sorting and selection method, which involves sorting all pages in descending order of their cosine similarity values and selecting the top N pages as candidate pages. The value of N can range from 1 to 5 and is dynamically adjusted based on the total number of pages in the document being queried: for short documents (<20 pages), N=1-2; for medium-sized documents (20-100 pages), N=3; for long documents (>100 pages), N=4-5. For example, in a 100-page contract document, the top 3 pages with the highest cosine similarity (e.g., page 5 with 0.85, page 42 with 0.32, and page 78 with 0.28) might be selected as candidate pages.
[0097] The second method is threshold selection, which involves setting a preset cosine threshold T (e.g., T = 0.3-0.5) and selecting all pages with a cosine similarity ≥ T as candidate pages. The threshold T can be dynamically adjusted according to the business scenario; in high-precision scenarios (such as legal documents), T = 0.5, and in high-recall scenarios (such as preliminary searches), T = 0.3. The N value can also be dynamically adjusted. As the total number of pages in the document increases, the target content may be scattered across more pages. Appropriately increasing the N value can improve the matching recall rate while avoiding the introduction of too many irrelevant pages. In OCR combined with AI scenarios, when the target information is "Contract Number: A123" and the original text is "Contract Number: A12", despite the missing characters, the cosine similarity can still reach 0.75 due to the high overlap of the core terms "contract" and "number", making this page correctly selected as a candidate page.
[0098] Based on the publicly available solutions described above, it is known that cosine similarity calculation can identify semantically related content that differs in its expression. This effectively solves the problem of balancing efficiency and accuracy in large-scale document retrieval, providing a high-quality candidate page set for information retrieval methods.
[0099] In one or more embodiments of this disclosure, the method further includes: when at least one of character similarity and word order similarity does not meet a preset threshold condition, prompting the user that no exact match was found, and providing the user with the K candidate results with the highest similarity for selection, where K is an integer greater than 0. That is, when neither character similarity nor word order similarity meets the preset threshold condition, or when character similarity does not meet the preset threshold condition, but word order similarity does; or when word order similarity does not meet the preset threshold condition, but character similarity does, the user can be directly prompted that no exact match was found. Alternatively, the user can be provided with the K candidate results with the highest similarity for selection.
[0100] In one alternative, when character similarity and / or word order similarity do not meet the preset threshold conditions, a downgraded matching strategy can be initiated. The downgraded matching strategy includes: adjusting the similarity threshold according to the business scenario type, or using only the higher of character similarity or word order similarity as the matching basis. When the matching result still cannot be determined after adopting the downgraded matching strategy, the user is prompted that no exact matching content was found, and the user is provided with the K candidate results with the highest similarity for selection, where K is an integer greater than 0.
[0101] Specifically, when the system detects that character similarity and / or word order similarity do not meet the preset threshold conditions (e.g., character similarity < 0.7 and word order similarity < 0.7, or one of them is less than 0.7), it first attempts to initiate a downgraded matching strategy. The downgraded matching strategy includes two implementation methods: the first is to adjust the similarity threshold according to the type of business scenario. For example, in a contract review scenario, the system may appropriately lower the character similarity threshold because matching key numbers and terms in the contract text is crucial; while in an academic citation scenario, the system may pay more attention to word order similarity and appropriately lower its threshold requirement. This threshold adjustment is based on an understanding of the characteristics of different business scenarios, enabling the system to adapt to the matching needs of specific scenarios.
[0102] The second downgraded matching strategy uses only the higher of character similarity and word order similarity as the matching criterion. Specifically, it compares the numerical values of character similarity and word order similarity, selecting the higher one to compare with the corresponding threshold. For example, when the target information is "payment period is 30 days," while the original text is "payment period is thirty days," the character similarity may be low (due to the difference between "30" and "thirty"), but the word order similarity is high (due to the high degree of word overlap). In this case, the system uses the higher word order similarity to compare with the threshold and determines it as a match. As another example, in legal document scenarios, when AI adjusts "Party A should pay after receiving the goods" to "Party A should pay after receiving the goods," the character similarity may be low (due to the change in word order), but the word order similarity is close to 1.0, still accurately identifying a match.
[0103] If a match still cannot be determined after employing a downgraded matching strategy, the system prompts the user with "No exact match found" and provides the K most similar candidate results for the user to choose from. It should be noted that this K value can be dynamically adjusted based on the business scenario. For example, in high-risk scenarios such as contract review, K is typically 1-2; in scenarios such as initial search, K may be 3-5. Each candidate result is accompanied by detailed similarity data to help the user make a judgment.
[0104] Based on the publicly available solutions described above, the degradation matching strategy enables the system to adapt to matching requirements with varying degrees of text changes. Furthermore, by adjusting the matching strategy according to the type of business scenario, the system can meet the specific needs of different domains.
[0105] In one or more embodiments of this disclosure, such as Figure 7 This is a flowchart illustrating the search result retrieval method provided in an embodiment of this disclosure. Figure 7 As shown, step S104, which involves determining the search results from the file to be queried based on comprehensive similarity, includes: Step S1041: Comparing the comprehensive similarity with a preset matching threshold; when the comprehensive similarity is greater than or equal to the matching threshold, it is determined to be a valid match. Step S1042: Sort all matching results according to the comprehensive similarity, and select the top M results as the search results; wherein, the search results contain at least one of the following: matching page number, paragraph content, and similarity score; M is an integer greater than 0.
[0106] As mentioned earlier, after calculating the overall similarity using weighted averages, it is compared with a preset matching threshold. The matching threshold is typically set to 0.75, but can be adjusted according to the business scenario: in high-precision scenarios such as contract review, the matching threshold can be increased to 0.8; in high-recall scenarios such as preliminary search, the matching threshold can be decreased to 0.7. When the overall similarity is greater than or equal to the matching threshold, the system determines it as a valid match. For example, in a contract review scenario, when the target information is "payment period is 30 days" and the original document to be queried is "payment period is thirty days", if the overall similarity = 0.84 (greater than the 0.75 threshold), the system determines it as a valid match; while in an OCR scenario, when the target information is "contract number: A123" and the recognition result is "contract number: A12", if the overall similarity = 0.65 (less than the 0.75 threshold), it is determined as an invalid match.
[0107] Subsequently, all matching results are sorted based on overall similarity, and the top M results are selected as the final search results. The value of M can be dynamically adjusted according to business scenarios and user needs. For example, in a scenario of precise contract clause search, M is usually 1, returning only the most matching results; in a scenario of academic citation verification, M can be set to any number from 3 to 5 for user selection. The final search results must contain at least one of the matching page number, paragraph content, or similarity score to ensure that users can understand detailed matching information from the search results. For example, the search result can be represented as "Page 5, Paragraph 2: 'The payment period is thirty days, calculated from the date of receipt of goods.', Overall similarity 0.84".
[0108] In practical applications, these search results can be returned in a structured data format for easy front-end display and subsequent processing. Furthermore, the search results can also include decomposed data on character similarity and word order similarity, enabling users to understand the basis for the matching.
[0109] In a PDF reader with a user interface, the system can automatically navigate to and highlight matching paragraphs based on search results. For example, by using the PDF reader's API, the matching page number and paragraph position can be passed to the reader, which can then locate the corresponding page and use a highlighting tool to mark the matching paragraph.
[0110] In addition, it supports exporting matching reports. These reports include not only basic matching information but also three key components: the contextual information of the matched paragraphs (to provide users with contextual understanding), similarity decomposition data (to show users the specific values and calculation basis of character similarity and word order similarity), and an analysis of the types of text modifications that may have been performed during the file processing by the AI model.
[0111] Based on the publicly available solution described above, the search results include multi-dimensional information such as page numbers, paragraph content, and similarity scores, providing users with a complete matching view. Furthermore, users can locate specific paragraph positions using a PDF reader and highlight them, allowing them to intuitively view the matched content without manual location.
[0112] Based on any of the above embodiments, this disclosure also provides an information retrieval device. Figure 8 This is a schematic block diagram of an information retrieval device according to one embodiment of the present disclosure. Figure 8 As shown, the information search device includes: an acquisition module 801, used to acquire the file to be searched and the target information; a calculation module 802, used to calculate the character similarity and word order similarity between the file to be searched and the target information; a weighted processing module 803, used to perform weighted fusion of the character similarity and word order similarity according to preset weights when both the character similarity and word order similarity meet preset threshold conditions, to obtain a comprehensive similarity; and a search module 804, used to determine the search results from the file to be searched based on the comprehensive similarity.
[0113] The calculation module 802 is also used to calculate the character similarity between the characters in the query file and the characters in the target information using a first similarity algorithm; and to calculate the word order similarity between the word sequence in the query file and the word sequence in the target information using a second similarity algorithm.
[0114] The calculation module 802 is also used to convert the text content of the page of the file to be queried into a first character sequence; and to convert the target information into a second character sequence; to determine the larger number of elements between the number of elements in the first character sequence and the number of elements in the second character sequence; to calculate the minimum number of single-character editing operations required to convert the second character sequence into the first character sequence, and to obtain the edit distance value; and to calculate the character similarity based on the edit distance value and the larger number of elements.
[0115] The calculation module 802 is also used to perform word segmentation on the text content of the page of the file to be queried to obtain a first term set; and to perform word segmentation on the target information to obtain a second term set; calculate the intersection size and the union size of the first term set and the second term set; and determine the word order similarity based on the ratio of the intersection size to the union size; wherein, the word segmentation includes the steps of removing stop words and punctuation marks and performing stemming, and the term set does not contain the order of the terms.
[0116] The acquisition module 801 is used to acquire the file to be queried and the target information, including: using the cosine similarity algorithm to find at least one alternative page related to the target information from the file to be queried; and acquiring the paragraph identifier and page number related to the target information in the alternative page.
[0117] The acquisition module 801 is used to convert the target information into a first vector and convert the page content in the file to be queried into a second vector; calculate the cosine similarity between the first vector and the second vector; and select at least one page with a cosine similarity greater than a preset cosine threshold as a candidate page.
[0118] The calculation module 802 is also used to prompt the user that no exact matching content was found when at least one of the character similarity and word order similarity does not meet the preset threshold condition, and to provide the user with the K candidate results with the highest similarity for selection, where K is an integer greater than 0.
[0119] The search module 804 is used to compare the overall similarity with a preset matching threshold. When the overall similarity is greater than or equal to the matching threshold, it is determined to be a valid match. All matching results are sorted according to the overall similarity, and the top M results are selected as the search results. The search results contain at least one of the following: matching page number, paragraph content, and similarity score. M is an integer greater than 0.
[0120] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0121] The execution subject of the information retrieval method in the specific embodiments of this disclosure can be an electronic device such as a server (including a local server or a cloud computing platform).
[0122] Therefore, based on any of the above embodiments, this disclosure also provides an electronic device that can execute the information search method of any of the embodiments described above.
[0123] Figure 9 This is a schematic block diagram of an electronic device according to one embodiment of the present disclosure.
[0124] The hardware architecture of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnect buses and bridges, depending on the specific application of the hardware and overall design constraints. Bus 1100 connects various circuits, including one or more processors 1200, memory 1300, and / or hardware modules. Bus 1100 can also connect various other circuits 1400, such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.
[0125] Bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, this diagram uses only one connection line, but this does not imply that there is only one bus or one type of bus.
[0126] This disclosure also provides a readable storage medium storing a computer program that, when executed by a processor, is used to implement the methods described above. A "readable storage medium" can be any means capable of containing, storing, communicating, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples of a readable storage medium include: an electrical connection with one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable read-only memory (CDROM), etc.
[0127] This disclosure also provides a computer program product, the methods of which can be implemented wholly or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented wholly or partially as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, all or part of the processes or functions of this disclosure are performed.
[0128] Computer programs or instructions can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The readable storage medium can be any available medium capable of access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; an optical medium, such as a digital video optical disc; or a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or it can include both volatile and non-volatile types of storage media.
[0129] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0130] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0131] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0132] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0133] In the description of this specification, the references to terms such as "one embodiment / mode," "some embodiments / modes," "example," "specific example," or "some examples," etc., refer to specific features, structures, or characteristics described in connection with that embodiment / mode or example, which are included in at least one embodiment / mode or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment / mode or example. Moreover, the specific features, structures, or characteristics described may be combined in any suitable manner in one or more embodiments / modes or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments / modes or examples described in this specification, as well as the features of different embodiments / modes or examples.
[0134] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0135] Those skilled in the art should understand that the above embodiments are merely for illustrating the present disclosure and are not intended to limit the scope of the disclosure. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of the present disclosure.
Claims
1. An information retrieval method, characterized in that, The method includes: Retrieve the file to be queried and target information; Calculate the character similarity and word order similarity between the file to be queried and the target information; When both the character similarity and the word order similarity meet the preset threshold conditions, the character similarity and the word order similarity are weighted and fused according to the preset weights to obtain a comprehensive similarity. The search results are determined from the file to be queried based on the comprehensive similarity.
2. The information retrieval method according to claim 1, characterized in that, The calculation of the character similarity and word order similarity between the file to be queried and the target information includes: The character similarity between the characters in the file to be queried and the characters in the target information is calculated using a first similarity algorithm. The word order similarity between the word sequence in the query file and the word sequence in the target information is calculated using a second similarity algorithm.
3. The information retrieval method according to claim 2, characterized in that, The step of calculating the character similarity between the characters in the file to be queried and the characters in the target information using the first similarity algorithm includes: The text content of the page of the file to be queried is converted into a first character sequence; and the target information is converted into a second character sequence. Determine the larger of the number of elements in the first character sequence and the number of elements in the second character sequence; Calculate the minimum number of single-character edit operations required to convert the second character sequence into the first character sequence, and obtain the edit distance value; The character similarity is calculated based on the edit distance value and the number of larger elements.
4. The information retrieval method according to claim 2, characterized in that, The step of calculating the word order similarity between the word sequence in the query file and the word sequence in the target information using the second similarity algorithm includes: The text content of the page of the file to be queried is segmented into words to obtain a first term set; and the target information is segmented into words to obtain a second term set. Calculate the size of the intersection and the size of the union of the first term set and the second term set; The word order similarity is determined based on the ratio of the intersection size to the union size.
5. The information retrieval method according to claim 1, characterized in that, The process of obtaining the file to be queried and the target information includes: Using the cosine similarity algorithm, at least one alternative page related to the target information is found from the file to be queried; Obtain the paragraph identifiers and page numbers related to the target information from the candidate pages.
6. The information retrieval method according to claim 5, characterized in that, The step of using the cosine similarity algorithm to find at least one alternative page related to the target information from the file to be queried includes: The target information is converted into a first vector, and the page content in the file to be queried is converted into a second vector; Calculate the cosine similarity between the first vector and the second vector; At least one page whose cosine similarity is greater than a preset cosine threshold is selected as the candidate page.
7. The information retrieval method according to claim 2, characterized in that, Also includes: When at least one of the character similarity and the word order similarity does not meet the preset threshold condition, the user is prompted that no exact matching content was found, and the user is provided with the K candidate results with the highest similarity for selection, where K is an integer greater than 0.
8. The information retrieval method according to claim 1, characterized in that, The process of determining the search results from the file to be queried based on the comprehensive similarity includes: The overall similarity is compared with a preset matching threshold. When the overall similarity is greater than or equal to the matching threshold, it is determined to be a valid match. All matching results are sorted according to the comprehensive similarity, and the top M results are selected as the search results; wherein, the search results contain at least one of the matching page number, paragraph content, and similarity score; and M is an integer greater than 0.
9. An electronic device, characterized in that, include: The memory stores execution instructions; as well as A processor that executes execution instructions stored in the memory, causing the processor to perform the method of any one of claims 1 to 8.
10. A readable storage medium storing executable instructions that, when executed by a processor, implement the method of any one of claims 1 to 8.