Document-based formula determination method and device, electronic equipment and storage medium
By segmenting documents and performing model recognition, formulas in documents are automatically extracted, solving the problems of low efficiency and poor accuracy in existing technologies, and achieving efficient and accurate formula extraction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2024-11-20
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, methods for automatically extracting formulas from documents are inefficient and inaccurate, making it difficult to meet the needs of business scenarios.
By acquiring the document to be processed, it is identified and segmented into text blocks, formula blocks, and table blocks. Semantic recognition models and relevance models are used to determine the formula description information, thereby determining the formula name and extracting the formula from the target block.
It enables automated and accurate identification and extraction of formulas from documents, improving efficiency and accuracy while reducing human intervention and error rates.
Smart Images

Figure CN119720996B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of document processing, and more particularly to a document-based formula determination method, apparatus, electronic device, and storage medium. Background Technology
[0002] Formulas, as an important tool, are widely used in daily work across various business scenarios. Formulas typically originate from the latest academic research findings, literature, or business documents, and their types and uses are extremely diverse. Taking the medical business scenario as an example, formulas encompass a wide range of aspects, including the calculation of physiological parameters, drug dosage adjustment plans, and disease risk assessment. Therefore, automatically determining formulas from academic research findings, literature, or business documents is extremely difficult.
[0003] Currently, most methods for extracting formulas from documents rely on manual processes, involving human analysis and review of document content to extract formulas.
[0004] Therefore, how to extract formulas from documents efficiently and automatically has become an urgent problem to be solved. Summary of the Invention
[0005] This application provides a document-based formula determination method, apparatus, electronic device, and storage medium for automatically extracting formulas from documents.
[0006] Firstly, this application provides a document-based formula determination method, comprising:
[0007] Obtain the document to be processed, and determine multiple document blocks from the document to be processed; among them, the document blocks include at least three types: text blocks, formula blocks, and table blocks;
[0008] If it is determined that there is formula description information in the text block, then determine the formula name corresponding to the formula description information;
[0009] The target block is determined from all document blocks based on the formula name, and the formula corresponding to the formula name is determined from the target block.
[0010] Optionally, the method described above, which determines the target block from all document blocks based on the formula name, includes:
[0011] The relevance information between the formula name and each document block is determined as the first relevance; wherein, the first relevance characterizes the degree of association between the document block and the formula name;
[0012] Based on the first relevance, the target block is determined from all document blocks.
[0013] Optionally, the method described above, based on a first relevance, determines the target block from all document blocks, including:
[0014] Based on the first relevance, at least one candidate block is determined from all document blocks;
[0015] The relevance information between the formula name and each candidate block is determined, which is called the second relevance; whereby the second relevance characterizes the degree of association between the candidate block and the formula name;
[0016] Based on the second relevance, the target block is determined from all document blocks.
[0017] Optionally, in the method described above, if it is determined that formula description information exists in the text block, then the formula name corresponding to the formula description information is determined, including:
[0018] Semantic recognition processing is performed on each text block to obtain the semantic information of the text block;
[0019] If the semantic information determines that there is formula description information in the text block, then the formula description information is extracted from the text block, and the formula name corresponding to the formula description information is determined.
[0020] Optionally, the method described above further includes:
[0021] If semantic information determines that there is no formula description information in the text block, then it is determined that there is no formula in the document to be processed.
[0022] Optionally, the method described above determines multiple document blocks from the document to be processed, including:
[0023] Based on the preset data format, the document to be processed is parsed to obtain a document block with the preset data format; the preset data format includes text format, formula format, and table format.
[0024] Optionally, the method described above, which parses the document to be processed according to a preset data format to obtain a document block of the preset data format, includes:
[0025] According to the preset data format, the document to be processed is parsed to obtain document data in the preset data format of the document to be processed; the document data includes text format data, formula format data, and table format data;
[0026] The document data is segmented into document blocks.
[0027] Optionally, the method described above involves segmenting the document data into document blocks, including:
[0028] Based on the preset number of characters to be segmented, the target segmentation point is determined from the document data; where the target segmentation point represents the position in the document data to be segmented.
[0029] Based on the target splitting points, the document data is split into document blocks.
[0030] Optionally, the method described above, which determines the target segmentation point from the document data based on a preset number of segmented characters, includes:
[0031] Candidate segmentation points are determined from the document data based on a preset number of characters to be segmented; the number of characters between any two candidate segmentation points is the preset number of characters to be segmented.
[0032] The target split point is determined based on the location of the candidate split points in the document data.
[0033] Optionally, the method described above, which determines the target segmentation point from the document data based on a preset number of segmented characters, includes:
[0034] Candidate segmentation points are determined from the document data based on a preset number of characters to be segmented; the number of characters between any two candidate segmentation points is the preset number of characters to be segmented.
[0035] The target split point is determined based on the location of the candidate split points in the document data.
[0036] Secondly, this application provides a document-based formula determination apparatus, comprising:
[0037] The acquisition unit is used to acquire the document to be processed and to identify multiple document blocks from the document to be processed; among them, the document blocks include at least three types: text blocks, formula blocks, and table blocks;
[0038] The first determining unit is used to determine the formula name corresponding to the formula description information if the determined text block contains formula description information;
[0039] The second determining unit is used to determine the target block from all document blocks based on the formula name, and to determine the formula corresponding to the formula name from the target block.
[0040] Thirdly, an electronic device is provided, comprising:
[0041] At least one processor, and a memory communicatively connected to the processor;
[0042] The memory stores computer-executed instructions;
[0043] The processor executes computer execution instructions stored in the memory to implement the method described in any of the first aspects.
[0044] Fourthly, a computer-readable storage medium is provided, wherein computer-executable instructions are stored therein, which, when executed by a processor, are used to implement the method described in any one of the first aspects.
[0045] Fifthly, a computer program product comprising a computer program that, when executed by a processor, implements the method described in any one of the first aspects.
[0046] The document-based formula determination method, apparatus, electronic device, and storage medium provided in this application acquire a document to be processed, process the document, determine multiple document blocks from the document to be processed, determine whether formula description information exists in the document blocks, and if formula description information exists, determine the corresponding formula name based on the formula description information, and determine the target block containing the formula from the document blocks based on the formula name, and determine the formula corresponding to the formula name from the target block. This achieves automatic identification of whether a formula exists in the document to be processed, identification of the formula name, and accurate determination of the formula based on the formula name, improving the efficiency of formula determination from the document and making the determined formula more accurate. Attached Figure Description
[0047] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0048] Figure 1 A flowchart illustrating a document-based formula determination method provided in this embodiment of the disclosure;
[0049] Figure 2 A flowchart illustrating a document-based formula determination method provided in this embodiment of the disclosure;
[0050] Figure 3 A flowchart illustrating a document-based formula determination method provided in this embodiment of the disclosure;
[0051] Figure 4 A flowchart illustrating a document-based formula determination method provided in this embodiment of the disclosure;
[0052] Figure 5 A structural block diagram of a document-based formula determination device provided in an embodiment of this disclosure;
[0053] Figure 6 A structural block diagram of a document-based formula determination device provided in an embodiment of this disclosure;
[0054] Figure 7 A structural block diagram of an electronic device provided in an embodiment of this disclosure;
[0055] Figure 8 This is a block diagram illustrating an electronic device according to an exemplary embodiment.
[0056] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0057] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0058] 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0059] First, let me explain the terms used in this application:
[0060] Dual-tower model: This is a model structure widely used in recommender systems. The dual-tower model consists of two independent towers. The dual-tower model vectorizes the input content at both ends of the dual-tower model and calculates the similarity between the input content at both ends.
[0061] BERT Model: BERT (Bidirectional Encoder Representations from Transformers) is a deep learning model based on Transformers, primarily used for Natural Language Processing (NLP) tasks.
[0062] Qwen2-72B Model: Qwen2-72B is a pre-trained and fine-tuned model of the Qwen2 large model. Qwen2 is the Alibaba Tongyi Qianwen large model.
[0063] Cue words: Model cue words refer to the role of AI models in guiding them to perform specific tasks or generate specific types of content. Cue words enhance the model's performance by providing specific instructions or questions, without requiring adjustments to the model's structure itself.
[0064] The cosine function is a type of trigonometric function.
[0065] GOT-OCR2_0 Open Source Multimodal Model: GOT-OCR 2.0 is a multimodal document recognition model that can handle various complex documents, from mathematical formulas in scientific papers to charts in business reports, and even musical scores in musical works, all of which can be accurately recognized and converted.
[0066] Markdown: A lightweight markup language primarily used for text formatting. Markdown syntax includes basic elements such as headings, paragraphs, lists, quotes, italics, and bold.
[0067] LaTeX provides a rich set of mathematical symbols and structures to support complex mathematical expressions. It is a typesetting system with a mathematical formula editor.
[0068] In various specific business scenarios, a variety of formulas are frequently used. These formulas help users complete tasks in different application scenarios. These formulas exist in complex and diverse forms, including mathematical expressions and calculation rules. They typically originate from academic research findings, literature, or business documents related to the corresponding business scenario, covering a wide range of topics. Taking the medical scenario as an example, the formula types include calculations of physiological parameters, drug dosage adjustment plans, and disease risk assessments, among many others. Therefore, determining the usable formulas from relevant documents for a specific business scenario is quite challenging.
[0069] Currently, discovering and identifying formulas from documents largely relies on manual identification by staff, which is inefficient, labor-intensive, and difficult to guarantee accuracy. It also requires time-consuming verification, further increasing the burden and workload on staff. With the development of large language models, they have been applied to the automatic identification and extraction of formulas, but the accuracy of the identified formulas is actually low, making direct application in business scenarios difficult. For both manual identification and large language models, there are three common scenarios where formula identification fails: the formula does not exist in the document, but it is identified through a delusion (i.e., a non-existent formula is identified); the formula exists in the document, but it is not identified; and the formula exists in the document, but is incorrect.
[0070] The document-based formula determination method provided in this application aims to solve the above-mentioned technical problems in the prior art.
[0071] The specific application scenario of this application is document processing, used to identify formula names within a document and determine the formulas corresponding to those names. The process involves acquiring a document to be processed, identifying multiple document blocks from it, including at least three types: text blocks, formula blocks, and table blocks. If a text block contains formula description information, the corresponding formula name is determined based on the description information. The target block containing the formula is then identified based on the formula name, and the corresponding formula is determined from the target block, thus achieving the effect of determining formulas from a document.
[0072] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.
[0073] Figure 1 This is a flowchart illustrating a document-based formula determination method provided in an embodiment of the present disclosure. The method can be executed by a document-based formula determination device.
[0074] like Figure 1 As shown, the method includes the following steps:
[0075] S101. Obtain the document to be processed and determine multiple document blocks from the document to be processed; wherein, the document blocks include at least three types: text blocks, formula blocks, and table blocks.
[0076] For example, a document to be processed is obtained. The document to be processed can be a relevant document in the current business scenario, such as academic research results, textbooks or business documents. Taking the medical field as an example, the document to be processed can be, for example, medical papers, clinical guidelines, etc.; taking the financial field as an example, the document to be processed can be, for example, market analysis reports, customer analysis reports, etc.
[0077] Multiple document blocks are identified from the document to be processed. For example, the document is parsed to identify its content, which may include text, mathematical formulas, and tables. The identified document is then segmented according to a preset percentage. For instance, if the document contains mathematical formulas, each individual formula is treated as a separate formula block. Similarly, if the document contains tables, each table is treated as a separate table block. A preset segmentation ratio of 10% is used to segment the text content, resulting in multiple text blocks. The proportion of characters in each text block relative to the total characters in the processed text is also set to the preset segmentation ratio. Each document block includes at least three types of blocks: text blocks, formula blocks, and table blocks.
[0078] The obtained document blocks are stored in a pre-set document block database.
[0079] S102. If it is determined that there is formula description information in the text block, then determine the formula name corresponding to the formula description information.
[0080] For example, after obtaining multiple document blocks determined from the document to be processed, semantic recognition processing is performed on the text blocks within the document blocks. If it is determined that formula description information exists in the text block, the formula name corresponding to the formula description information is determined. For example, a first semantic recognition model can be pre-set. The first semantic recognition model is used to recognize text blocks, determine whether formula description information exists in the document to be processed, and determine the formula name based on the formula description information. Based on the preset first semantic recognition model, semantic recognition is performed on the text blocks of the document to be processed to determine whether formula description information exists in the text blocks. If formula description information exists, the preset first semantic recognition model is used to recognize the formula description information to obtain the formula name corresponding to the formula description information. If no formula description information exists in the text block, it is determined that no formula exists in the document to be processed, and the formula determination process ends. Here, the preset first semantic recognition model can be the Qwen2-72B model; the formula description information can be, for example, the usage of the formula, a textual description of the formula, and the calculation rules of the formula, etc.
[0081] For any given scenario, the pre-defined first semantic recognition model needs to design a prompt word template for that scenario. This prompt word template enables the first semantic recognition model to recognize the formula description information of the text blocks in the document to be processed within that scenario, and to determine the formula name from the formula description information. For example, if the current business scenario is a medical scenario, the prompt word template would be:
[0082] " ### illustrate###
[0083] You are a medical formula name extraction robot. Your task is to read the following research papers and determine whether there are mathematical formulas or formula calculation rules used for diagnosing medical diseases. If so, please extract the formula names.
[0084] ### Output Requirements ###
[0085] 1. Please output the results using a JSON array format. All key-value pairs in the array must not contain any newline characters, and the values must be translated from English to Chinese. If the JSON format includes carriage returns and newline characters, the parser will report an error and cannot parse the data correctly. Therefore, when you need to include carriage returns and newline characters in JSON format, you need to process the text and escape the newline characters to other characters.
[0086] 2. Each formula needs to generate one corresponding JSON result. In the JSON, "is_exist" is used to store your judgment on whether the formula exists in the reference: formula name; "formula_name" is used to store the corresponding formula name.
[0087] 3. Please use json.loads() to verify the JSON array you output to ensure that the Python code can parse it correctly without any parsing errors.
[0088] ### References ###
[0089] ```
[0090] {Paper_TXT}
[0091] ```
[0092] ".
[0093] If the document to be processed is document A, then document A is identified according to the preset first semantic recognition model, and the recognition result is as follows:
[0094] "{"is_exist":"is",
[0095] “formula_name”:“La Roche Glaucoma Calculator”}.
[0096] That is, the document to be processed contains a formula, and the formula is named "La Roche Glaucoma Calculator".
[0097] S103. Determine the target block from all document blocks based on the formula name, and determine the formula corresponding to the formula name from the target block.
[0098] For example, if a text block contains formula description information, and the formula name corresponding to the formula description information is determined based on the formula description information, a target block is determined from all document blocks based on the formula name. For example, a pre-set formula location model can be used to determine the target block based on the formula name, i.e., to determine the location of the formula. The formula location model can be a pre-set large model. Based on the formula name and the pre-set large model, the relevance information between the formula name and each document block is determined, and the document block corresponding to the most relevant relevance information is determined as the target block. Here, the target block represents the document block in which the formula exists, and the relevance information represents the degree of association between the formula name and the document block obtained based on the pre-set formula location model. In this embodiment, the type of pre-set formula location model is not specifically limited.
[0099] After obtaining the target block, the formula corresponding to the formula name is determined from the target block. This can be achieved by pre-setting prompts for the formula determination model to meet the needs of the current business scenario. The formula determination model is used to determine the formula from the target block based on the formula name; that is, it performs semantic recognition on the target block based on the formula name and determines the formula corresponding to the formula name from the target block. Based on the target block, the formula is determined using the pre-set formula determination model to obtain the formula corresponding to the formula name. For example, if the current business scenario is a medical scenario, the formula determination model is used to determine medical formulas. The formula determination model can be a pre-set large model, such as the Qwen2-72B model. The prompts for the formula determination model in the current scenario are set as follows:
[0100] " ### illustrate###
[0101] You are a medical formula extraction robot. Your task is to read the following excerpt from a research paper, identify the calculation rules of the medical formulas, and extract the calculation rules by breaking them down into steps below.
[0102] 1. Extract the description of the calculation rules from the reference fragments according to the medical formula names.
[0103] 2. For each formula, further extract the factors or conditions involved in the formula calculation. The calculated factors or conditions must be complete and faithful to the original text.
[0104] 3. For each formula, further extract the scoring criteria for each factor or element involved in the calculation, clearly specifying the conditions under which this factor should be scored. Note that the conditions must have specific and unambiguous judgment criteria, and the scoring criteria for those factors must be refined to specify the conditions under which a certain number of points should be awarded.
[0105] 4. Finally, the calculation rules and derivation process for each formula are generated, that is, the relationship between the calculation factors and the derivation process are summarized.
[0106] ### Output Requirements ###
[0107] 1. Please output the results using a JSON array format. All key-value pairs in the array must not contain any newline characters, and the values must be translated from English to Chinese. If the JSON format includes carriage returns and newline characters, the parser will report an error and cannot parse the data correctly. Therefore, when you need to include carriage returns and newline characters in JSON format, you need to process the text and escape the newline characters to other characters.
[0108] 2. Each formula needs to generate one corresponding JSON result. In the JSON, "medical_formula_name" is used to store the formula name; "formulas_calculation_rules" is used to store the formula calculation rules and derivation process generated for this formula name.
[0109] 3. Please use json.loads() to verify the JSON array you output to ensure that the Python code can parse it correctly without any parsing errors.
[0110] The following is a sample output result using the "pro-QTc scoring" formula as an example:
[0111] {"medical_formula_name":"pro-QTc score", "formulas_calculation_rules":" The formula calculation is derived by summing up the scores for each of the following criteria. - If the patient is female, increase the pro-QTc score by 1 point. - Check for any diagnoses or conditions related to QT prolongation; if present, increase the pro-QTc score by 1 point. - If an electrolyte abnormality, such as a magnesium ion concentration below 1.7 mg / dL, is detected, increase the pro-QTc score by another 1 point. - Further adjust the score based on whether the patient is using medications known to prolong the QT interval; if so, increase the score by 1 point.
[0112] ### Formula Name to be Extracted ###
[0113] {formula_name}
[0114] ### Reference Excerpt ###
[0115] {paper_piece}”
[0116] If the document to be processed is document A, and the formula obtained from it is named "La Roche Glaucoma Calculator", and the target block of the document to be processed is determined, then based on the formula name, the model is determined, and the formula result determined from the target block is: [ {"medical_formula_name": "La Roche Glaucoma Calculator",
[0117] "formulas_calculation_rules": " The formula calculates the scoring criteria by summing the following conditions. - If the patient is 40 years of age or younger, the score is 0; 41-50 years old gets 1 point, 51-60 years old gets 2 points, 61-70 years old gets 3 points, 71-80 years old gets 4 points, 81-90 years old gets 5 points, and 91 years of age and above gets 6 points. - If the patient's intraocular pressure (IOP) is less than or equal to 12 mmHg, the score is 0 points; 13-15 mmHg gets 1 point, 16-18 mmHg gets 2 points, 19-21 mmHg gets 3 points, 22-25 mmHg gets 4 points, 26-29 mmHg gets 5 points, and 30 mmHg and above gets 6 points. - If the patient's central corneal thickness (CCT) is greater than 600μm, -3 points are awarded; 576-600μm, -2 points are awarded; 551-575μm, -1 point is awarded; 526-550μm, 0 points are awarded; 500-525μm, 1 point is awarded; 475-499μm, 2 points are awarded; 450-474μm, 3 points are awarded; 425-449μm, 4 points are awarded; 400-424μm, 5 points are awarded; and less than 400μm, 6 points are awarded. After summing the total scores using the formula, patients are categorized into the following risk groups. A score of 0-5 indicates low risk, and a reassessment is recommended after one year; a score of 6-18 indicates high risk, and a complete eye examination is recommended as soon as possible.
[0118] The formulas corresponding to the identified formula names and the combinations of formula names are stored in a pre-set formula database.
[0119] This application provides a method that, by acquiring a document to be processed and processing it, identifies multiple document blocks from the document, determines whether formula description information exists within each document block, and if so, identifies the corresponding formula name based on the formula description information. Then, based on the formula name, it identifies a target block containing the formula from the document blocks, and finally, it identifies the formula corresponding to the formula name from the target block. This method automatically identifies the presence of formulas in the document to be processed, recognizes the formula name, and accurately identifies the formula based on the formula name, thus improving the efficiency of formula identification from the document and making the identified formulas more accurate.
[0120] Figure 2 This is a flowchart illustrating a document-based formula determination method provided in an embodiment of this disclosure.
[0121] In this embodiment, determining the target block from all document blocks based on the formula name includes: determining the relevance information between the formula name and each document block, which is a first relevance; wherein, the first relevance characterizes the degree of association between the document block and the formula name; and determining the target block from all document blocks based on the first relevance.
[0122] like Figure 2 As shown, the method includes the following steps:
[0123] S201. Obtain the document to be processed, and determine multiple document blocks from the document to be processed; wherein, the document blocks include at least three types: text blocks, formula blocks, and table blocks.
[0124] For example, this step can refer to step S101 above, and will not be repeated here.
[0125] S202. If it is determined that there is formula description information in the text block, then determine the formula name corresponding to the formula description information.
[0126] For example, this step can refer to step S102 above, and will not be repeated here.
[0127] S203. Determine the relevance information between the formula name and each document block, which is the first relevance; wherein, the first relevance characterizes the degree of association between the document block and the formula name.
[0128] For example, if it is determined that a formula description exists in a text block, and the corresponding formula name is obtained based on the formula description, the relevance information between the formula name and each document block is determined as the first relevance. For instance, a relevance dual-tower model can be pre-set. The two towers of the relevance dual-tower model are respectively input to the query statement and the document block. The relevance dual-tower model is used to determine the relevance information between the formula name and each document block based on the query statement and the document block. Here, the query statement is obtained by converting the formula name, representing the formula corresponding to the query formula name; the pre-set relevance dual-tower model can be, for example, using the BERT model as the two towers of the dual-tower model, and training the dual-tower model to obtain the pre-set relevance dual-tower model.
[0129] For any business scenario, the model training process is as follows: using a pre-prepared dual-tower model training set, the dual-tower model is trained based on a preset dual-tower model loss function. The pre-prepared dual-tower model training set consists of at least one dual-tower model training document containing the formula specific to the current business scenario. For any dual-tower model training document within the training set, the document contains a query statement. The document block containing the formula And other document blocks in the training set document of the twin-tower model that do not contain the formula. , ,..., .
[0130] The preset loss function for the dual-tower model is:
[0131]
[0132] in, Characterize the loss function of the dual-tower model. ,Right now transpose and The product of Representation query statement After passing through the tower corresponding to the query statement, the query statement is generated through encoding. semantic vectors, The document block containing the characterization formula After passing through the tower corresponding to the document block, the document block containing the encoded formula is... The semantic vector. For the training set documents, the document blocks that do not contain formulas. The numbering of other document blocks, starting from 1; For the training set documents, the document blocks that do not contain formulas. The total number of other document blocks besides the one mentioned above. ,Right now transpose and The product of Representation query statement After passing through the tower corresponding to the query statement, the query statement is generated through encoding. semantic vectors, Characterizing the first Other document blocks After passing through the tower corresponding to the document block, other document blocks are generated through encoding. The semantic vector of e. , with e and The summation from 1 to n is compared, and the negative logarithm of the ratio is obtained, which is the preset loss function of the dual-tower model.
[0133] After obtaining the preset relevance dual-tower model for the current business scenario, the obtained formula name is converted into a query statement. Based on the query statement and document block, and using the preset relevance dual-tower model, the relevance information corresponding to each document block is obtained, which is the first relevance. For example, if the current business scenario is a medical scenario, and the document to be processed is document A, the formula name obtained from it is determined to be "La Roche glaucoma calculator". The formula name is converted into a query statement, such as "What are the calculation rules of the La Roche glaucoma calculator?" For any document block, the query statement and the document block are respectively input into the two towers of the dual-tower model. After encoding by the dual-tower model, the semantic vector corresponding to the query statement and the semantic vector corresponding to the document block are obtained. The cosine function is used to calculate the relevance information between the formula name and the document block, which is the first relevance information corresponding to the document block. The first relevance characterizes the degree of association between the document block and the formula name.
[0134] The advantage of this setup is that the dual-tower model is simple to calculate and suitable for calculating the relevance between a large number of document blocks and query statements. It can quickly obtain the degree of association between each document block and the formula name. By using a preset training set corresponding to the business scenario and the loss function of the dual-tower model, the dual-tower model can be trained to make the relevance calculation in the current business scenario more accurate.
[0135] S204. Based on the first relevance, determine the target block from all document blocks, and determine the formula corresponding to the formula name from the target block.
[0136] For example, the target block is determined from all document blocks based on a first relevance score. For instance, all first relevance scores can be sorted, and the document block corresponding to the highest first relevance score can be used as the target block. Then, based on a preset first semantic recognition model, the target block is identified to determine the formula corresponding to the formula name.
[0137] The beneficial effect of this setting is that the target block is determined based on the first relevance, making the determination of the target block more accurate. The formula corresponding to the formula name is determined from the target block, which facilitates the determination of the formula and reduces various errors that may occur in the formula determination process, reducing scenarios such as inaccurate determination, determination failure, and determination illusion.
[0138] In this embodiment, determining the target block from all document blocks based on the first relevance includes: determining at least one candidate block from all document blocks based on the first relevance; determining the relevance information between the formula name and each candidate block, which is a second relevance; wherein the second relevance characterizes the degree of association between the candidate block and the formula name; and determining the target block from all document blocks based on the second relevance.
[0139] Specifically, a first relevance threshold is preset. This threshold is used to determine candidate blocks, representing the minimum threshold at which a candidate block exists for a given first relevance. Based on the first relevance and the preset first relevance threshold, at least one candidate block is determined from all document blocks. For example, the relationship between the first relevance and the first relevance threshold is determined, and document blocks corresponding to first relevance values below the first relevance threshold are deleted. If all first relevance values are below the first relevance threshold, it is determined that the formula does not exist in the document to be processed, and the process of determining the formula ends. If there are first relevance values greater than the first relevance threshold, these first relevance values are sorted, and the document blocks corresponding to the top three first relevance values in the first relevance ranking are selected as candidate blocks. If the number of first relevance values greater than the first relevance threshold is less than three, the actual number is used for selection.
[0140] The relevance information between the formula name and each candidate block is determined as the second relevance. For example, a relevance single-tower model can be pre-set. For any candidate block, based on the formula name and the candidate block, the relevance relationship between the formula name and the candidate block is determined according to the pre-set relevance single-tower model. The input to the relevance single-tower model is the concatenation of the query statement and the candidate block. The relevance single-tower model is used to determine the target block from the candidate blocks based on the concatenation of the query statement and the candidate blocks. The pre-set single-tower model can be, for example, the BERT model. The pre-set relevance single-tower model is obtained by training the BERT single-tower model.
[0141] For any business scenario, the model training process is as follows: using a pre-prepared single-tower model training set, the single-tower model is trained based on a preset single-tower model loss function. The pre-prepared single-tower model training set consists of at least one single-tower model training document containing a formula specific to the current business scenario. For any single-tower model training document within the training set, the document must contain a query statement. The document block containing the formula and other document blocks in the training set documents of this single-tower model. , ,..., .
[0142] The preset loss function for the single-tower model is:
[0143]
[0144] in, The loss function characterizing the single-tower model. , The character represents the query statement With target block To splice, To input the concatenated result into the output of the single-tower model, we represent the relevance information between the query statement and the target block under the single-tower model. P(q) represents the set of all possible negative samples P(q) corresponding to the query statement q, i.e., the query statement The set of document blocks that are not the target block in the corresponding document block; Characterization obey Distribution; Characterization obey The expected value under the distribution. The formula represents the query statement. With target block The spliced result is input into a single-tower model to obtain the output of the result, and the negative logarithm is taken as the first value; obey The expected value under the distribution, multiplied by one minus the query statement. and non-target blocks The concatenated result is input into the single-tower model to obtain the output of the result, and the logarithm is taken as the second value; the loss function of the single-tower model is obtained by subtracting the second value from the first value.
[0145] After obtaining the preset relevance single-tower model for the current business scenario, for any candidate block, the query statement obtained by converting the formula name is concatenated with the candidate block. Based on the concatenation result and the preset relevance single-tower model, the relevance information between the formula name and the candidate block is obtained, which is the second relevance corresponding to the candidate block. For example, if the current business scenario is a medical scenario, and the document to be processed is document A, the formula name obtained from it is determined to be "La Roche glaucoma calculator". The formula name is converted into a query statement, such as "What are the calculation rules of the La Roche glaucoma calculator?". If the candidate block is a table block "Table 1: La Roche glaucoma calculator: Risk factors with corresponding numerical variables", the query statement is concatenated with the candidate block to obtain the concatenation result "[CLS] What are the calculation rules of the La Roche glaucoma calculator? [SEP] Table 1: La Roche glaucoma calculator: Risk factors with corresponding numerical variables", where [CLS] and [SEP] represent the concatenation function. The second relevance corresponding to each candidate block is obtained.
[0146] A second relevance threshold is preset. This threshold is used to determine the target block from the candidate blocks. The second relevance threshold represents the minimum threshold at which the target block exists, given the second relevance. Based on the second relevance and the preset second relevance threshold, the target block is determined from the candidate blocks. For example, the second relevance is sorted, and the maximum value in the second relevance is compared with the second relevance threshold. If the maximum value of the second relevance is less than the second relevance, it is determined that the formula does not exist in the document to be processed, and the formula determination process ends; if the maximum value of the second relevance is greater than the second relevance threshold, the candidate block corresponding to the maximum value of the second relevance is determined as the target block.
[0147] The advantage of this setting is that by comparing the relevance information using the first relevance threshold and the second relevance threshold, it can determine whether there is a formula in the document to be processed and identify the target block where the formula is located. This makes the identified target block more accurate and more likely to contain the formula. The relevance single-tower model is used to verify the relevance of the candidate blocks, which is more accurate and more suitable for the re-verification work of identifying the target block from the candidate blocks.
[0148] This application provides a method that, by acquiring a document to be processed and processing it, identifies multiple document blocks from the document, determines whether formula description information exists within each document block, and if so, identifies the corresponding formula name based on the formula description information. Then, based on the formula name, it identifies a target block containing the formula from the document blocks, and finally, it identifies the formula corresponding to the formula name from the target block. This method automatically identifies the presence of formulas in the document to be processed, recognizes the formula name, and accurately identifies the formula based on the formula name, thus improving the efficiency of formula identification from the document and making the identified formulas more accurate.
[0149] Figure 3 This is a flowchart illustrating a document-based formula determination method provided in an embodiment of this disclosure.
[0150] In this embodiment, if it is determined that there is formula description information in the text block, the formula name corresponding to the formula description information is determined, including: performing semantic recognition processing on each text block to obtain the semantic information of the text block; if it is determined that there is formula description information in the text block based on the semantic information, the formula description information is extracted from the text block, and the formula name corresponding to the formula description information is determined.
[0151] like Figure 3 As shown, the method includes the following steps:
[0152] S301. Obtain the document to be processed, and determine multiple document blocks from the document to be processed; wherein, the document blocks include at least three types: text blocks, formula blocks, and table blocks.
[0153] For example, this step can refer to step S101 above, and will not be repeated here.
[0154] S302. Perform semantic recognition processing on each text block to obtain the semantic information of the text block.
[0155] For example, semantic recognition processing is performed on each text block to obtain the semantic information of the text block. For instance, a second semantic recognition model can be preset to perform semantic recognition on the text blocks and obtain the semantic information corresponding to each text block. The preset second semantic recognition model can be the Qwen2-72B model.
[0156] The advantage of this setup is that semantic recognition processing is performed on each text block to obtain the semantic information corresponding to each text block. This allows for a better determination of the semantics of the document to be processed, making the process of determining whether a formula exists more accurate and precise.
[0157] S303. If it is determined from the semantic information that there is formula description information in the text block, then extract the formula description information from the text block and determine the formula name corresponding to the formula description information.
[0158] For example, if semantic information determines that any text block contains formula description information, such as the formula's usage method, calculation rules, or textual description, then the formula description information is extracted from the corresponding text block, and the corresponding formula name is determined based on the formula description information. For instance, a third semantic recognition model can be pre-set. This third semantic recognition model is used to determine the formula name corresponding to the formula description information. The pre-set third semantic recognition model could be the Qwen2-72B model.
[0159] The advantage of this setup is that it determines whether there is formula description information in the text block based on semantic information. If so, it extracts the formula description information from the corresponding text block and determines the corresponding formula name based on the formula description information, making the determination of the formula name more accurate and reliable.
[0160] In this embodiment, it is further included that if it is determined from semantic information that there is no formula description information in the text block, then it is determined that there is no formula in the document to be processed.
[0161] Specifically, if the semantic information determines that there is no formula description information in the text block, that is, there is no information such as the formula usage method, the formula operation rules, or the formula text description, then it is determined that there is no formula in the document to be processed, and the formula determination process ends.
[0162] The advantage of this setting is that if no formula description information is available, the formula determination process for the document to be determined will end, effectively reducing unnecessary waste and improving the efficiency of determining formulas from the document to be processed.
[0163] S304: Determine the target block from all document blocks based on the formula name, and determine the formula corresponding to the formula name from the target block.
[0164] For example, this step can refer to step S103 above, and will not be repeated here.
[0165] This application provides a method that, by acquiring a document to be processed and processing it, identifies multiple document blocks from the document, determines whether formula description information exists within each document block, and if so, identifies the corresponding formula name based on the formula description information. Then, based on the formula name, it identifies a target block containing the formula from the document blocks, and finally, it identifies the formula corresponding to the formula name from the target block. This method automatically identifies the presence of formulas in the document to be processed, recognizes the formula name, and accurately identifies the formula based on the formula name, thus improving the efficiency of formula identification from the document and making the identified formulas more accurate.
[0166] Figure 4This is a flowchart illustrating a document-based formula determination method provided in an embodiment of this disclosure.
[0167] In this embodiment, multiple document blocks are determined from the document to be processed, including: parsing the document to be processed according to a preset data format to obtain document blocks of the preset data format; wherein, the preset data format includes text format, formula format, and table format.
[0168] like Figure 4 As shown, the method includes the following steps:
[0169] S401. Obtain the document to be processed, and parse and process the document to be processed according to the preset data format to obtain a document block with the preset data format; wherein, the preset data format includes text format, formula format and table format; wherein, the document block includes at least three types of text block, formula block and table block.
[0170] For example, a document to be processed is acquired, and parsed according to a preset data format to obtain document blocks in the preset data format. For instance, a parsing model is pre-set to parse the document into document blocks of different preset data formats. The preset parsing model could be the GOT-OCR2_0 open-source multimodal model. The initial format of the document to be processed could be, for example, PDF. Based on the document and the preset parsing model, the text content in the document is parsed into a preset text format, such as TXT; mathematical formulas are parsed into a preset formula format, such as LaTeX; and tables are parsed into a preset table format, such as Markdown. The document is then parsed based on the preset parsing model and the preset data format to obtain document blocks in each preset data format.
[0171] The advantage of this setup is that it parses and processes the document to be processed, obtaining document blocks of various corresponding preset data formats. This makes it easier to process different content separately, making the use of the document content more flexible and facilitating the determination of formulas.
[0172] In this embodiment, the document to be processed is parsed according to a preset data format to obtain document blocks of the preset data format, including: parsing the document to be processed according to the preset data format to obtain document data of the preset data format in the document to be processed; wherein, the document data includes text format data, formula format data, and table format data; and segmenting the document data into document blocks.
[0173] Specifically, based on a preset data format and a preset parsing model, the document to be processed is parsed to obtain document data in the preset data format. The document data includes text format data, formula format data, and table format data. For example, the text content in the document to be processed is parsed into preset txt format text format data; the mathematical formula content in the document to be processed is parsed into preset LaTeX format formula format data; and the table content in the document to be processed is parsed into preset Markdown format table format data.
[0174] The document data is segmented into document blocks. For example, a pre-set segmentation ratio can be used to indicate how the document data should be segmented. The preset segmentation ratio could be, for example, 10%. The document data is then segmented into document blocks according to the preset segmentation ratio.
[0175] The advantages of this setup are that it parses the document to be processed according to a preset data format, unifying the content of the document into a pre-defined data format for easier processing and making the data in the document more standardized. Furthermore, it segments the content of the document into document blocks, making subsequent semantic recognition more efficient and allowing for more accurate identification of formulas and location of the formula blocks.
[0176] In this embodiment, the document data is segmented into document blocks, including: determining a target segmentation point from the document data according to a preset number of segmentation characters; wherein the target segmentation point represents the position to be segmented in the document data; and segmenting the document data according to the target segmentation point to obtain document blocks.
[0177] Specifically, a preset number of characters for segmentation is obtained. This preset number of characters is used to determine the target segmentation point from the document data. The target segmentation point is used to indicate how to cut the document data. The preset number of characters for segmentation can be, for example, 300. Based on the preset number of characters for segmentation, the target segmentation point is determined from the document data. Based on the target segmentation point, the document data is segmented at the target segmentation point to obtain document blocks.
[0178] The advantage of this setting is that it allows for more flexible segmentation operations, making it more suitable for segmenting text data, and also makes the determination of the target segmentation point more accurate, allowing for precise positioning of the target segmentation point.
[0179] In this embodiment, determining the target segmentation point from the document data according to the preset segmentation character count includes: determining candidate segmentation points from the document data according to the preset segmentation character count; wherein, the number of text characters between every two candidate segmentation points is the preset segmentation character count; and determining the target segmentation point according to the position of the candidate segmentation points in the document data.
[0180] Specifically, a preset number of characters for segmentation is obtained. Based on this preset number of characters, candidate segmentation points are determined from the document data, with the number of characters between any two candidate segmentation points being the preset number of characters for segmentation. The position of the target segmentation point is then determined based on the position of the candidate segmentation points in the document data. For example, if the candidate segmentation point is a period, that position is used as the target segmentation point; if the candidate segmentation point is not a period, the position of the nearest period is used as the target segmentation point.
[0181] The advantage of this setup is that by using preset segmentation points to determine candidate segmentation points, the document data can be roughly segmented into equal word counts. Furthermore, by using candidate segmentation points to determine the target segmentation point, the segmentation points can be made to preserve the semantic content of the original text, resulting in more complete semantic information in the segmented document blocks.
[0182] In this embodiment, determining the target segmentation point based on the position of the candidate segmentation point in the document data includes: determining the position of the candidate segmentation point in the document data and the paragraph in which the candidate segmentation point is located; if the position of the candidate segmentation point is not the starting position of the paragraph in which the candidate segmentation point is located, the starting position of the paragraph in which the candidate segmentation point is located is determined as the target segmentation point.
[0183] Specifically, if the document data is text data, the position of the candidate segmentation point in the text data and the paragraph in which the candidate segmentation point is located are determined. The position of the candidate segmentation point in the paragraph is identified. If the position of the candidate segmentation point is not the starting position of the paragraph in which the candidate segmentation point is located, that is, the candidate segmentation point is inside the paragraph in which the candidate segmentation point is located, then the starting position of the paragraph in which the candidate segmentation point is located is determined as the target segmentation point.
[0184] If the document data consists of formulas, the start and end positions of each mathematical formula are used as target split points, and the document is split accordingly. Each individual mathematical formula is treated as a separate document block. If multiple mathematical formulas are adjacent, their start and end positions are used as target split points, and these adjacent formulas are treated as a single document block. For example, if mathematical formula A is a single formula, its start and end positions are used as target split points, resulting in a separate document block for formula A. If mathematical formula A and mathematical formula B are adjacent, their start and end positions are used as target split points, resulting in a single document block for both formula A and formula B. If the document data consists of tables, the start and end positions of each table are used as target split points. Each individual table is treated as a separate document block. If multiple tables are adjacent, their start and end positions are determined as the target split points, thus treating these adjacent tables as a single document block. For example, if table A is a single formula, its start and end positions are determined as the target split points, and the table is split to obtain a single document block for table A. If table A and table B are adjacent, their start and end positions are determined as the target split points, and the table is split to obtain a single document block for tables A and B.
[0185] Table 1. La Roche Glaucoma Calculator: Risk Factors with Corresponding Numerical Variables
[0186]
[0187] Table 2 La Roche Glaucoma Calculator: Determining Glaucoma Risk and Management
[0188]
[0189] Table 1 is a tabular data of an exemplary document to be processed provided in an embodiment of this disclosure. As shown in Table 1, Table 1 is "La Roche Glaucoma Calculator: Risk Factors with Corresponding Numerical Variables".
[0190] Table 2 is a tabular data of an exemplary document to be processed provided in an embodiment of this disclosure. As shown in Table 2, Table 2 is "La Roche Glaucoma Calculator: Determining Glaucoma Risk and Management".
[0191] Table 1 and Table 2 are adjacent tables. Using a preset parsing model, Table 1 and Table 2 are parsed, and their content is segmented according to the above segmentation rules to obtain document blocks:
[0192] Table 1: La Roche Glaucoma Calculator: Risk Factors with Corresponding Numerical Variables | Scoring Criteria
[0193] Age (years) ≤ – – – – –
[0194] Intraocular pressure (mmHg) ≤ – – – – –
[0195] Central corneal thickness (μm) >600 576–600 551–575 526–550 500–525 475–499 450–474 425–449 400–424 <400 "
[0196] Table 2: La Roche Glaucoma Calculator: Determining Glaucoma Risk and Management. | Glaucoma Risk Categories Total Score Risk Management
[0197] Low risk It is recommended to reassess within one year.
[0198] High risk An ophthalmological evaluation needs to be completed as soon as possible. ...”.
[0199] The advantage of this setup is that it allows for the reselection of candidate segmentation points based on paragraphs, determining the target segmentation point, and placing the segmentation point at the paragraph boundary. This ensures the semantic integrity of each document block, making the document blocks more complete and facilitating semantic recognition. Separating formulas and tables into separate blocks also makes it easier to determine the document block where the formulas are located.
[0200] S402. If it is determined that there is formula description information in the text block, then determine the formula name corresponding to the formula description information.
[0201] For example, this step can refer to step S102 above, and will not be repeated here.
[0202] S403. Determine the target block from all document blocks based on the formula name, and determine the formula corresponding to the formula name from the target block.
[0203] For example, this step can refer to step S103 above, and will not be repeated here.
[0204] This application provides a method that, by acquiring a document to be processed and processing it, identifies multiple document blocks from the document, determines whether formula description information exists within each document block, and if so, identifies the corresponding formula name based on the formula description information. Then, based on the formula name, it identifies a target block containing the formula from the document blocks, and finally, it identifies the formula corresponding to the formula name from the target block. This method automatically identifies the presence of formulas in the document to be processed, recognizes the formula name, and accurately identifies the formula based on the formula name, thus improving the efficiency of formula identification from the document and making the identified formulas more accurate.
[0205] Figure 5 A structural block diagram of a document-based formula determination device provided in an embodiment of this disclosure.
[0206] For ease of explanation, only the parts relevant to the embodiments of this disclosure are shown, with reference to... Figure 5 The document-based formula determination device 500 includes: an acquisition unit 501, a first determination unit 502, and a second determination unit 503.
[0207] The acquisition unit 501 is used to acquire the document to be processed and to determine multiple document blocks from the document to be processed; wherein, the document blocks include at least three types: text blocks, formula blocks, and table blocks;
[0208] The first determining unit 502 is used to determine the formula name corresponding to the formula description information if the determined text block contains formula description information;
[0209] The second determining unit 503 is used to determine the target block from all document blocks based on the formula name, and to determine the formula corresponding to the formula name from the target block.
[0210] Figure 6 A structural block diagram of a document-based formula determination device provided in an embodiment of this disclosure.
[0211] exist Figure 5 Based on the illustrated embodiments, as Figure 6 As shown, the second determining unit 503 includes a relevance module 5031 and a target block module 5032.
[0212] The relevance module 5031 is used to determine the relevance information between the formula name and each document block, which is a first relevance; wherein, the first relevance characterizes the degree of association between the document block and the formula name.
[0213] The target block module 5032 is used to determine the target block from all document blocks based on the first relevance.
[0214] In one example, the first target block module 5032 includes:
[0215] A candidate block submodule is configured to determine at least one candidate block from all document blocks based on the first relevance.
[0216] The relevance submodule is used to determine the relevance information between the formula name and each candidate block, which is the second relevance; wherein, the second relevance characterizes the degree of association between the candidate block and the formula name;
[0217] The target block submodule is used to determine the target block from all document blocks based on the second relevance.
[0218] In one example, the first determining unit 502 includes:
[0219] The recognition module is used to perform semantic recognition processing on each of the text blocks to obtain the semantic information of the text blocks;
[0220] The formula name module is used to extract the formula description information from the text block and determine the formula name corresponding to the formula description information if it is determined from the semantic information that there is formula description information in the text block.
[0221] In one example, the first determining unit 502 further includes:
[0222] The existence module is used to determine that there is no formula in the document to be processed if it is determined from the semantic information that there is no formula description information in the text block.
[0223] In one example, retrieving unit 501 includes:
[0224] The parsing module is used to parse the document to be processed according to a preset data format to obtain a document block of the preset data format; wherein, the preset data format includes text format, formula format, and table format.
[0225] In one example, the parsing module includes:
[0226] The parsing submodule is used to parse the document to be processed according to a preset data format to obtain document data in the preset data format of the document to be processed; wherein, the document data includes text format data, formula format data, and table format data;
[0227] The segmentation module is used to segment the document data into document blocks.
[0228] In one example, the molecular cutting module is specifically used for:
[0229] Based on a preset number of characters to be segmented, a target segmentation point is determined from the document data; wherein, the target segmentation point represents the position in the document data to be segmented;
[0230] The document data is segmented based on the target segmentation point to obtain the document block.
[0231] In one example, the molecular cutting module is specifically used for:
[0232] Based on a preset number of characters to be segmented, a target segmentation point is determined from the document data; wherein, the target segmentation point represents the position in the document data to be segmented;
[0233] The document data is segmented based on the target segmentation point to obtain the document block.
[0234] In one example, the molecular cutting module is specifically used for:
[0235] Determine the position of the candidate segmentation point in the document data and the paragraph in which the candidate segmentation point is located;
[0236] If the position of the candidate segmentation point is not the starting position of the paragraph in which the candidate segmentation point is located, the starting position of the paragraph in which the candidate segmentation point is located is determined as the target segmentation point.
[0237] Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of the present disclosure. The electronic device may be a terminal device or a server, such as... Figure 7 As shown, the electronic device 700 includes: at least one processor 702; and a memory 701 communicatively connected to the at least one processor 702; wherein the memory stores instructions executable by the at least one processor 702, the instructions being executed by the at least one processor 702 to enable the at least one processor 702 to perform the document-based formula determination method of this disclosure.
[0238] The electronic device 700 also includes a receiver 703 and a transmitter 704. The receiver 703 is used to receive instructions and data sent by other devices, and the transmitter 704 is used to send instructions and data to external devices.
[0239] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0240] According to embodiments of this disclosure, this disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the electronic device to perform the scheme provided in any of the above embodiments.
[0241] Figure 8 This is a block diagram illustrating an electronic device according to an exemplary embodiment. The device may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.
[0242] Device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 811, input / output (I / O) interface 812, sensor component 814, and communication component 816.
[0243] Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0244] Memory 804 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0245] Power supply component 806 provides power to various components of device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 800.
[0246] Multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0247] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
[0248] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0249] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of device 800, changes in the position of device 800 or a component of device 800, the presence or absence of user contact with device 800, the orientation or acceleration / deceleration of device 800, and temperature changes of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0250] Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0251] In an exemplary embodiment, device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0252] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0253] A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of a terminal device, enable the terminal device to perform the aforementioned document-based formula determination method.
[0254] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0255] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0256] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0257] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0258] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0259] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0260] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0261] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0262] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A document-based formula determination method, comprising: Obtain the document to be processed, and determine multiple document blocks from the document to be processed; wherein, the document blocks include at least three types: text blocks, formula blocks, and table blocks; Semantic recognition is performed on the text blocks in the document block. If it is determined that there is formula description information in the text block, the formula name corresponding to the formula description information is determined. Based on the formula name and the preset model, the relevance information between the formula name and each document block is determined, which is the first relevance; based on the first relevance, a target block is determined from all document blocks, and the formula corresponding to the formula name is determined from the target block; the first relevance characterizes the degree of association between the document block and the formula name; The process of determining the target block from all document blocks based on the first relevance includes: Based on the first relevance, at least one candidate block is determined from all document blocks; The relevance information between the formula name and each candidate block is determined as the second relevance; wherein, the second relevance characterizes the degree of association between the candidate block and the formula name; The target block is determined from the candidate blocks based on the second relevance.
2. The method according to claim 1, characterized in that, Semantic recognition is performed on the text blocks in the document block. If it is determined that there is formula description information in the text block, the formula name corresponding to the formula description information is determined, including: Semantic recognition processing is performed on each of the text blocks to obtain the semantic information of the text blocks; If it is determined from the semantic information that there is formula description information in the text block, then the formula description information is extracted from the text block, and the formula name corresponding to the formula description information is determined.
3. The method according to claim 2, characterized in that, Also includes: If it is determined from the semantic information that there is no formula description information in the text block, then it is determined that there is no formula in the document to be processed.
4. The method according to claim 1, characterized in that, Multiple document blocks are determined from the document to be processed, including: The document to be processed is parsed according to a preset data format to obtain a document block of the preset data format; wherein, the preset data format includes text format, formula format, and table format.
5. The method according to claim 4, characterized in that, The document to be processed is parsed according to a preset data format to obtain a document block of the preset data format, including: The document to be processed is parsed according to a preset data format to obtain document data in the preset data format of the document to be processed; wherein, the document data includes text format data, formula format data, and table format data; The document data is segmented into document blocks.
6. The method according to claim 5, characterized in that, The document data is segmented into document blocks, including: Based on a preset number of characters to be segmented, a target segmentation point is determined from the document data; wherein, the target segmentation point represents the position in the document data to be segmented; The document data is segmented based on the target segmentation point to obtain the document block.
7. The method according to claim 6, characterized in that, Based on a preset number of characters to be segmented, the target segmentation point is determined from the document data, including: Candidate segmentation points are determined from the document data based on a preset number of characters to be segmented; wherein the number of characters between any two candidate segmentation points is the preset number of characters to be segmented. The target segmentation point is determined based on the position of the candidate segmentation points in the document data.
8. The method according to claim 7, characterized in that, Determining the target segmentation point based on the position of the candidate segmentation points in the document data includes: Determine the position of the candidate segmentation point in the document data and the paragraph in which the candidate segmentation point is located; If the position of the candidate segmentation point is not the starting position of the paragraph in which the candidate segmentation point is located, the starting position of the paragraph in which the candidate segmentation point is located is determined as the target segmentation point.
9. A document-based formula determination device, characterized in that, include: The acquisition unit is used to acquire a document to be processed and determine multiple document blocks from the document to be processed; wherein the document blocks include at least three types: text blocks, formula blocks, and table blocks; The first determining unit is used to perform semantic recognition on the text blocks in the document block. If it is determined that there is formula description information in the text block, then the formula name corresponding to the formula description information is determined. The second determining unit is configured to determine the relevance information between the formula name and each document block based on the formula name and the preset model, which is a first relevance; determine a target block from all document blocks based on the first relevance, and determine the formula corresponding to the formula name from the target block; the first relevance characterizes the degree of association between the document block and the formula name; The second determining unit is specifically used for: determining at least one candidate block from all document blocks based on the first relevance; determining the relevance information between the formula name and each candidate block as a second relevance; wherein the second relevance characterizes the degree of association between the candidate block and the formula name; and determining the target block from the candidate blocks based on the second relevance.
10. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 8.
12. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 8.
Citation Information
Patent Citations
Formula information extracting method and device of business document
CN108304383A
Interactive industrial document identification and analysis system based on deep learning
CN118135591A