Document-based formula determination method and device, electronic equipment and storage medium

CN119720996AActive Publication Date: 2025-03-28CHINA UNITED NETWORK COMM GRP CO LTD +2

Patent Information

Application Number
CN202411670550.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-28
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

The prior art is difficult to extract formulas from documents efficiently and automatically, resulting in low efficiency and poor accuracy.

Method used

By obtaining the pending document, multiple document blocks are determined, including text blocks, formula blocks and table blocks. If formula description information exists in the text block, the formula name is determined, and the target block is determined from the document block according to the formula name to obtain the corresponding formula.

Benefits of technology

Automatically identify and extract formulas in documents, improve efficiency and make the determined formulas more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720996A_ABST
    Figure CN119720996A_ABST
Patent Text Reader

Abstract

The invention provides a document-based formula determination method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a to-be-processed document, and determining a plurality of document blocks from the to-be-processed document; wherein the document blocks at least comprise three types of text blocks, formula blocks and table blocks; if it is determined that the formula description information exists in the text block, determining a formula name corresponding to the formula description information; and determining a target block from all the document blocks according to the formula name, and determining a formula corresponding to the formula name from the target block. The method is used for achieving the effect of accurately identifying and determining the formula from the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of document processing, and in particular to a document-based formula determination method, device, electronic device and storage medium. Background Art

[0002] As an important tool, formulas are widely used in daily work corresponding to various business scenarios. Formulas usually come from the latest academic research results, literature or business documents, and their types and uses are very wide. Taking the medical business scenario as an example, formulas include the calculation of physiological parameters, drug dosage adjustment schemes, and disease risk assessment. Therefore, it is very difficult to automatically determine formulas from academic research results, literature or business documents.

[0003] Currently, the method of extracting formulas from documents mostly relies on manual work, in which the document content is manually analyzed and the formula is extracted.

[0004] Therefore, how to extract formulas from documents efficiently and automatically has become a problem that needs to be solved urgently. Summary of the invention

[0005] The present application provides a document-based formula determination method, device, electronic device and storage medium for automatically extracting formulas from documents.

[0006] In a first aspect, the present application provides a document-based formula determination method, comprising:

[0007] Obtaining a document to be processed, and determining a plurality of document blocks from the document to be processed; wherein 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 the formula name corresponding to the formula description information is determined;

[0009] A target block is determined from all document blocks according to the formula name, and a formula corresponding to the formula name is determined from the target block.

[0010] Optionally, the method described above, determining the target block from all document blocks according to the formula name, includes:

[0011] Determine the correlation information between the formula name and each of the document blocks as a first correlation; wherein the first correlation represents the degree of association between the document block and the formula name;

[0012] According to the first correlation, a target block is determined from all document blocks.

[0013] Optionally, the method as described above, determining the target block from all document blocks according to the first relevance, includes:

[0014] Determine at least one candidate block from all document blocks according to the first relevance;

[0015] Determine the correlation information between the formula name and each candidate block as the second correlation; wherein the second correlation represents the degree of association between the candidate block and the formula name;

[0016] According to the second relevance, a target block is determined from all document blocks.

[0017] Optionally, in the above method, if it is determined that there is formula description information in the text block, determining the formula name corresponding to the formula description information includes:

[0018] Perform semantic recognition processing on each text block to obtain the semantic information of the text block;

[0019] If it is determined according to the semantic information that the text block contains formula description information, the formula description information is extracted from the text block, and a formula name corresponding to the formula description information is determined.

[0020] Optionally, the method as described above further comprises:

[0021] If it is determined according to the semantic information that there is no formula description information in the text block, it is determined that there is no formula in the document to be processed.

[0022] Optionally, the method as described above, determining a plurality of document blocks from the document to be processed, comprises:

[0023] According to a preset data format, the document to be processed is parsed to obtain a document block in the preset data format; wherein the preset data format includes a text format, a formula format, and a table format.

[0024] Optionally, the method described above, according to a preset data format, performs parsing processing on the document to be processed to obtain a document block in the preset data format, including:

[0025] According to a preset data format, the document to be processed is parsed and processed to obtain document data in a preset data format in the document to be processed; wherein 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 performs segmentation processing on the document data to segment the document data into document blocks, including:

[0028] According to a preset number of segmentation words, a target segmentation point is determined from the document data; wherein the target segmentation point represents a position to be segmented in the document data;

[0029] According to the target segmentation point, the document data is segmented to obtain document blocks.

[0030] Optionally, the method described above, according to a preset segmentation word count, determines a target segmentation point from the document data, including:

[0031] According to the preset segmentation word count, candidate segmentation points are determined from the document data; wherein the number of text words between every two candidate segmentation points is the preset segmentation word count;

[0032] The target segmentation point is determined according to the position of the candidate segmentation point in the document data.

[0033] Optionally, the method described above, according to a preset segmentation word count, determines a target segmentation point from the document data, including:

[0034] According to the preset segmentation word count, candidate segmentation points are determined from the document data; wherein the number of text words between every two candidate segmentation points is the preset segmentation word count;

[0035] The target segmentation point is determined according to the position of the candidate segmentation point in the document data.

[0036] In a second aspect, the present application provides a document-based formula determination device, comprising:

[0037] An acquisition unit is used to acquire a document to be processed and determine a plurality of document blocks from the document to be processed; wherein the document blocks include at least three types: text blocks, formula blocks, and table blocks;

[0038] A first determining unit, configured to determine a formula name corresponding to the formula description information if it is determined that the text block contains formula description information;

[0039] The second determining unit is used to determine a target block from all document blocks according to the formula name, and determine a formula corresponding to the formula name from the target block.

[0040] In a third aspect, an electronic device is provided, including:

[0041] at least one processor, and a memory in communication with the processor;

[0042] The memory stores computer-executable instructions;

[0043] The processor executes the computer-executable instructions stored in the memory to implement the method described in any one of the first aspects.

[0044] In a fourth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement any one of the methods described in the first aspect.

[0045] According to a fifth aspect, a computer program product comprises a computer program, wherein when the computer program is executed by a processor, the method described in any one of the first aspects is implemented.

[0046] The document-based formula determination method, device, electronic device and storage medium provided by the present application obtain the document to be processed, process the document to be processed, determine multiple document blocks from the document to be processed, determine whether there is formula description information in the document block, and if there is formula description information, determine the corresponding formula name according to the formula description information, and determine the target block containing the formula from the document block according to the formula name, and determine the formula corresponding to the formula name from the target block. Automatic identification of whether there is a formula in the document to be processed and identification of the formula name are achieved, as well as accurate determination of the formula according to the formula name, thereby improving the efficiency of determining the formula from the document and making the determined formula more accurate. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] Figure 1 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure;

[0049] Figure 2 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure;

[0050] Figure 3 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure;

[0051] Figure 4 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure;

[0052] Figure 5 A structural block diagram of a document-based formula determination device provided in an embodiment of the present disclosure;

[0053] Figure 6 A structural block diagram of a document-based formula determination device provided in an embodiment of the present disclosure;

[0054] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present disclosure;

[0055] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment.

[0056] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present 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, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0059] First, the terms involved in this application are explained:

[0060] Twin Tower Model: It is a model structure widely used in recommendation systems. The twin tower model consists of two independent towers. The twin tower model vectorizes the input content at both ends of the twin tower model and calculates the similarity of the input content at both ends.

[0061] ‌‌BERT model‌‌: BERT (Bidirectional Encoder Representations from Transformers) is a Transformer-based deep learning model, mainly used for natural language processing (‌NLP) tasks.

[0062] Qwen2-72B model: Qwen2-72B is a pre-trained and instruction fine-tuning model of the Qwen2 large model. Qwen2 is the Alitong Yi Qianwen large model.

[0063] Prompt words: Model prompt words are used in AI models to guide the model to perform specific tasks or generate specific types of content. Prompt words enhance the model's performance by inputting specific instructions or questions to the model without adjusting the model structure itself.

[0064] ‌Cosine function: 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 a variety of complex documents, from mathematical formulas in scientific papers to charts in business reports to musical scores in musical works, all of which can be accurately recognized and converted.

[0066] Markdown: A lightweight markup language mainly used for text formatting. The syntax of markdown includes basic elements such as title, paragraph, list, quote, italic, bold, etc.

[0067] latex: provides rich 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, various corresponding formulas are often used. Formulas help users complete corresponding tasks in various application scenarios. These formulas exist in complex and diverse forms, which may be mathematical expressions or calculation rules. Formulas usually come from academic research results, literature or business documents in corresponding business scenarios, covering a wide range. Taking medical scenarios as an example, there are many types of formulas, including calculation of physiological parameters, drug dosage adjustment schemes, and disease risk assessment. Therefore, it is difficult to determine the usable formulas from the relevant documents of the corresponding business scenarios.

[0069] At present, the discovery and determination of formulas from documents mostly rely on manual recognition by staff, which is inefficient and labor-intensive, and it is difficult to ensure accuracy. It takes time to verify, which increases the burden and consumption of staff. With the development of large language models, large language models have also been applied to the automatic recognition and extraction of formulas, but the accuracy of the actual determined formulas is low and difficult to be directly applied in business scenarios. For manual recognition and large language models, there are three common forms of formula determination failure: the formula does not exist in the document, but it is hallucinated, that is, the non-existent formula is determined; the formula exists in the document, but it is not determined; the formula exists in the document, but it is wrong.

[0070] The document-based formula determination method provided in this application is intended to solve the above technical problems in the prior art.

[0071] The specific application scenario of this application is a document, which is used to process the document, identify the formula name in the document, and determine the formula corresponding to the name from the document. Obtain the document to be processed, determine multiple document blocks from the document to be processed, including at least three types of text blocks, formula blocks, and table blocks. If there is formula description information in the text block, determine the corresponding formula name based on the formula description information, determine the target block where the formula is located based on the formula name, and determine the corresponding formula from the target block, thereby completing the effect of determining the formula from the document.

[0072] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0073] Figure 1 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure is provided, and the method can be executed by a document-based formula determination device.

[0074] like Figure 1 As shown, the method comprises the following steps:

[0075] S101, obtaining a document to be processed, and determining a plurality of 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] Exemplarily, documents to be processed are obtained. The documents to be processed may be relevant documents in the current business scenario, such as academic research results, textbooks, or business documents. Taking the medical field as an example, the documents to be processed may be, for example, medical papers, clinical guidelines, etc.; taking the financial field as an example, the documents to be processed may be, for example, market analysis reports, customer analysis reports, etc.

[0077] Determine multiple document blocks from the document to be processed, for example, parse the document to be processed and identify the content in the document to be processed, the document to be processed includes text content, mathematical formula content, table content, etc. The identified document to be processed is segmented according to a preset percentage. For example, if there is a mathematical formula in the document to be processed, the mathematical formula content in the document to be processed after identification is treated as an independent formula block according to each separate mathematical formula, that is, the mathematical formula content in the document to be processed can be determined as at least one formula block. If there is a table in the document to be processed, the table content in the document to be processed is treated as an independent table block according to each table, that is, the table content in the document to be processed can be determined as at least one table block. The segmentation ratio is preset to 10%, and then the text content of the document to be processed is segmented according to the preset segmentation ratio to obtain multiple text blocks, and the ratio of the number of characters in each text block to the total number of characters in the text to be processed is the preset segmentation ratio. Among them, the document block includes at least three types: text block, formula block, and table block.

[0078] The obtained document blocks are stored in a preset document block database.

[0079] S102: If it is determined that there is formula description information in the text block, determine the formula name corresponding to the formula description information.

[0080] Exemplarily, after obtaining a plurality of document blocks determined from the document to be processed, semantic recognition processing is performed on the text blocks in the document blocks. 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. For example, a first semantic recognition model may be pre-set, and the first semantic recognition model is used to recognize the text block, determine whether there is formula description information in the document to be processed, and determine the formula name according to the formula description information. Based on the preset first semantic recognition model, semantic recognition is performed on the text block of the document to be processed, and it is determined whether there is formula description information in the text block. If there is formula description information, the formula description information is recognized using the preset first semantic recognition model according to the formula description information, and the formula name corresponding to the formula description information is obtained. If there is no formula description information in the text block, it is determined that there is no formula in the document to be processed, and the formula determination process is terminated. Among them, the preset first semantic recognition model may be the Qwen2-72B model; the formula description information may be, for example, the usage of the formula, the text description of the formula, and the calculation rules of the formula.

[0081] For any scenario, the preset first semantic recognition model needs to design a prompt word template for the scenario. The prompt word template is used to enable the first semantic recognition model to recognize the formula description information of the text block of the document to be processed in the scenario, and determine the formula name from the formula description information. For example, if the current business scenario is a medical scenario, the prompt word template is:

[0082] " ### illustrate###

[0083] You are a robot for extracting medical formula names. Your task is to read the following papers and determine whether there are mathematical formulas or formula calculation rules for diagnosing medical diseases. If so, please extract the formula name.

[0084] ### Output Requirements###

[0085] 1. Please use the JSON array format to request the output result. The value content of all keys in the array cannot contain any line breaks, and the value content needs to be translated from English into Chinese. If the JSON format contains carriage returns and line breaks, the parser will report an error and cannot parse the data correctly. Therefore, when we need to include carriage returns and line breaks in the JSON format, we need to process the text and escape the carriage returns and line breaks into other characters.

[0086] 2. Each formula needs to generate a corresponding json result. In the json, "is_exist" is used to store your judgment on whether the formula exists in the reference: the 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 be parsed normally without any parsing exceptions.

[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:

[0094] "{"is_exist":"yes",

[0095] "formula_name":"La Roche Glaucoma Calculator"}".

[0096] That is, there is a formula in the document to be processed, and the formula is named "La Roche Glaucoma Calculator".

[0097] S103. Determine a target block from all document blocks according to the formula name, and determine a formula corresponding to the formula name from the target block.

[0098] Exemplarily, if there is formula description information in the text block, and the formula name corresponding to the formula description information is determined based on the formula description information. According to the formula name, the target block is determined from all document blocks. For example, a formula positioning model may be pre-set, and the formula positioning model is used to determine the target block according to the formula name, that is, to determine the location of the formula. The formula positioning model may be a preset large model. According to the formula name, based on the preset large model, the correlation information between the formula name and each document block is determined, and the document block corresponding to the most relevant correlation information is determined as the target block. Among them, the target block represents the document block where the formula exists, and the correlation information represents the degree of association between the formula name and the document block obtained based on the preset formula positioning model. In this embodiment, the type of the preset formula positioning model is not specifically limited.

[0099] After obtaining the target block, the formula corresponding to the formula name is determined from the target block. It can be that the prompt words of the formula determination model are pre-set so that the formula determination model meets the needs of the current business scenario. The formula determination model is used to determine the formula from the target block according to the formula name, that is, according to the formula name, the target block is semantically recognized and the formula corresponding to the formula name is determined from the target block. According to the target block, based on the preset formula determination model, the formula is determined to obtain the formula corresponding to the formula name. For example, the current business scenario is a medical scenario, and the formula determination model is used to determine the medical formula. The formula determination model can be a preset large model, for example, the Qwen2-72B model. The prompt words of the formula determination model of the current scenario are set as:

[0100] " ### illustrate###

[0101] You are a medical formula extraction robot. Your task is to read the following paper and find out the calculation rules of the medical formula. The calculation rules of the formula are extracted step by step according to the following steps.

[0102] 1. Extract calculation rule descriptions from reference fragments according to medical formula names.

[0103] 2. Each formula further extracts the factors or conditions involved in the formula calculation. The calculation factors or conditions must be complete and faithful to the original text.

[0104] 3. Each formula further extracts the scoring criteria for each factor or factor involved in the calculation, and it is necessary to clarify under what conditions the factor is scored. Note that the conditions must have specific judgment criteria and be unambiguous, and the scoring criteria that need to be scored must be refined to the point where the conditions are met and the score is given.

[0105] 4. Finally, the calculation rules and derivation process of each formula are generated, that is, the relationship and derivation process between the calculation factors are summarized.

[0106] ### Output Requirements###

[0107] 1. Please use the JSON array format to request the output result. The value content of all keys in the array cannot contain any line breaks, and the value content needs to be translated from English into Chinese. If the JSON format contains carriage returns and line breaks, the parser will report an error and cannot parse the data correctly. Therefore, when we need to include carriage returns and line breaks in the JSON format, we need to process the text and escape the carriage returns and line breaks into other characters.

[0108] 2. Each formula needs to generate a 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 by you for this formula name.

[0109] 3. Please use json.loads() to verify the json array you output to ensure that the python code can be parsed normally without any parsing exceptions.

[0110] Taking the "pro-QTc score" formula as an example, the output result reference example is given as follows:

[0111] {"medical_formula_name":"pro-QTc score", "formulas_calculation_rules":"**The formula calculation is a cumulative sum of the following scoring criteria for each condition**: - If the patient is female, the pro-QTc score is increased by 1 point. - The patient is checked for any diagnosis or condition associated with QT prolongation, if so, the pro-QTc score is increased by 1 point. - If electrolyte abnormalities are detected, such as magnesium concentration less than 1.7 mg / dL, the pro-QTc score is increased by another 1 point. - The score is further adjusted based on whether the patient is taking medications known to prolong the QT interval, if so, the score is increased by 1 point."}

[0112] ### Name of the formula to be extracted###

[0113] {formula_name}

[0114] ### References###

[0115] {paper_piece}”

[0116] If the document to be processed is document A, and the formula name obtained from it is determined to be "La Roche Glaucoma Calculator", and the target block of the document to be processed is determined, then according to the formula name, the model is determined based on the formula, and the formula result is determined from the target block as: [{"medical_formula_name": "La Roche Glaucoma Calculator",

[0117] "formulas_calculation_rules": "**The formula calculates the score by adding up the following criteria**: - If the patient is 40 years old or younger, the score is 0; 41-50 years old get 1 point, 51-60 years old get 2 points, 61-70 years old get 3 points, 71-80 years old get 4 points, 81-90 years old get 5 points, and 91 years and older get 6 points. - If the patient's intraocular pressure (IOP) is less than or equal to 12 mmHg, the score is 0; 13-15 mmHg get 1 point, 16-18 mmHg get 2 points, 19-21 mmHg get 3 points, 22-25 mmHg get 4 points, 26-29 mmHg get 5 points, and 30 mmHg and above get 6 points. - If the patient's central corneal thickness (CCT) is greater than 600μm, -3 points are assigned; 576-600μm is assigned -2 ​​points, 551-575μm is assigned -1 point, 526-550μm is assigned 0 points, 500-525μm is assigned 1 point, 475-499μm is assigned 2 points, 450-474μm is assigned 3 points, 425-449μm is assigned 4 points, 400-424μm is assigned 5 points, and less than 400μm is assigned 6 points. **After the formula summarizes the total score, the patient is divided into the following risk categories**: 0-5 points are low risk, and re-evaluation is recommended after 1 year; 6-18 points are high risk, and a complete eye examination is recommended as soon as possible. "}].

[0118] The formulas and formula name combinations corresponding to the determined formula names are stored in a pre-set formula database.

[0119] The present application provides a method of obtaining a document to be processed, processing the document to be processed, determining multiple document blocks from the document to be processed, determining whether there is formula description information in the document block, and if there is formula description information, determining the corresponding formula name according to the formula description information, and determining a target block containing the formula from the document block according to the formula name, and determining the formula corresponding to the formula name from the target block. Automatic identification of whether there is a formula in the document to be processed and identification of the formula name are achieved, as well as accurate determination of the formula according to the formula name, thereby improving the efficiency of determining the formula from the document and making the determined formula more accurate.

[0120] Figure 2 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure.

[0121] In this embodiment, a target block is determined from all document blocks according to a formula name, including: determining correlation information between the formula name and each document block, which is a first correlation; wherein the first correlation represents the degree of association between the document block and the formula name; and determining the target block from all document blocks according to the first correlation.

[0122] like Figure 2 As shown, the method comprises the following steps:

[0123] S201. Obtain a document to be processed, and determine a plurality of 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] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0125] S202: If it is determined that there is formula description information in the text block, determine the formula name corresponding to the formula description information.

[0126] Exemplarily, this step may refer to the above-mentioned step S102 and will not be described in detail.

[0127] S203: Determine the correlation information between the formula name and each document block, which is a first correlation; wherein the first correlation represents the degree of association between the document block and the formula name.

[0128] Exemplarily, if it is determined that there is formula description information in the text block, and the corresponding formula name is obtained according to the formula description information. The correlation information between the formula name and each document block is determined as the first correlation. For example, a correlation twin-tower model can be pre-set, and the twin towers of the correlation twin-tower model respectively input the query statement and the document block, and the correlation twin-tower model is used to determine the correlation information between the formula name and each document block according to the query statement and the document block. Among them, the query statement is obtained by converting the formula name, and represents the formula corresponding to the query formula name; the preset correlation twin-tower model can be, for example, using the BERT model as the two towers of the twin-tower model, and training the twin-tower model to obtain the preset correlation twin-tower model.

[0129] For any business scenario, the model training process is to use the pre-prepared dual-tower model training set to train the dual-tower model based on the preset dual-tower model loss function. The pre-prepared dual-tower model training set is at least one dual-tower model training set document containing a formula in the current business scenario. For any dual-tower model training set document in the dual-tower model training set, the dual-tower model training set document contains a query statement. , the document block where the formula is located , and other document blocks that do not contain formulas in the dual-tower model training set document , ,..., .

[0130] The default loss function of the twin tower model is:

[0131]

[0132] in, Characterize the loss function of the twin tower model. ,Right now The transpose of The product of Characterizing query statements After the query statement corresponds to the tower, the query statement generated by encoding The semantic vector of The document block where the formula is located After passing through the tower corresponding to the document block, the document block where the formula generated by encoding is located The semantic vector of . The document block containing non-formulas in the training set documents The numbers of other document blocks outside the , start from 1; The document block containing non-formulas in the training set documents The total number of document blocks other than . ,Right now The transpose of The product of Characterizing query statements After the query statement corresponds to the tower, the query statement generated by encoding The semantic vector of Characterization Other Document Blocks After passing through the tower corresponding to the document block, other document blocks generated by encoding The semantic vector of e , with e and The negative logarithm of the ratio obtained by comparing the cumulative values ​​from 1 to n is the loss function of the preset twin-tower model.

[0133] After obtaining the preset relevance dual-tower model of the current business scenario, the obtained formula name is converted into a query statement, and according to the query statement and the document block, based on 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, if the document to be processed is document A, the formula name obtained is determined to be "La Roche Glaucoma Calculator", and the formula name is converted into a query statement, for example, "What is the calculation rule 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, and 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, and the cosine function is used to calculate the two, and the calculation result is the relevance information between the formula name and the document block, which is the first relevance information corresponding to the document block, and the first relevance represents the degree of association between the document block and the formula name.

[0134] The beneficial effect of this setting is that the twin-tower model is simple to calculate and is suitable for calculating the correlation between more document blocks and query statements. It can quickly obtain the degree of association between each document block and the formula name in the document. By using the preset training set corresponding to the business scenario and the loss function of the twin-tower model to train the twin-tower model, the twin-tower model can be more accurate in calculating the correlation in the current business scenario.

[0135] S204: Determine a target block from all document blocks according to the first relevance, and determine a formula corresponding to the formula name from the target block.

[0136] Exemplarily, the target block is determined from all document blocks according to the first relevance. For example, all first relevances may be sorted, and the document block corresponding to the largest first relevance may be used as the target block. The target block is identified based on a preset first semantic recognition model to determine the formula corresponding to the formula name.

[0137] The beneficial effect of such a setting is that the target block is determined according to the first correlation, so that the determination of the target block is more accurate, and the formula corresponding to the formula name is determined from the target block, which facilitates the determination of the formula, reduces the various errors that may occur in the formula determination process, and reduces the scenarios of inaccurate determination, determination failure, and determination hallucination.

[0138] In this embodiment, according to the first relevance, the target block is determined from all the document blocks, including: according to the first relevance, at least one candidate block is determined from all the document blocks; the correlation information between the formula name and each candidate block is determined as the second relevance; wherein the second relevance represents the degree of association between the candidate block and the formula name; according to the second relevance, the target block is determined from all the document blocks.

[0139] Specifically, a first relevance threshold is pre-set, and the first relevance threshold is used to determine the candidate blocks. The first relevance threshold represents the minimum threshold for the existence of the candidate blocks for the first relevance. According to the first relevance, based on the preset first relevance threshold, at least one candidate block is determined from all the document blocks. For example, the size relationship between the first relevance and the first relevance threshold is determined, and the document blocks corresponding to the first relevance lower than the first relevance threshold are deleted; if all the first relevances are lower than the first relevance threshold, it is determined that there is no formula in the document to be processed, and the process of determining the formula is terminated; if there is a first relevance greater than the first relevance threshold, the first relevance greater than the first relevance threshold is sorted, and the document blocks corresponding to the first three first relevances in the first relevance sequence are used as candidate blocks. If the number of first relevances greater than the first relevance threshold is less than three, selection is performed according to the actual number.

[0140] Determine the correlation information between the formula name and each candidate block as the second correlation. For example, a correlation single tower model can be pre-set, and for any candidate block, the correlation relationship between the formula name and the candidate block is determined based on the preset correlation single tower model according to the formula name and the candidate block. Among them, the input of the correlation single tower model is the concatenation of the query statement and the candidate block, and the correlation single tower model is used to determine the target block from the candidate block according to the concatenation of the query statement and the candidate block. The preset single tower model can be, for example, a BERT model, and the BERT single tower model is trained to obtain a preset correlation single tower model.

[0141] For any business scenario, the model training process is to use the pre-prepared single-tower model training set to train the single-tower model based on the preset single-tower model loss function. The pre-prepared single-tower model training set is at least one single-tower model training set document containing a formula in the current business scenario. For any single-tower model training set document in the single-tower model training set, the single-tower model training set document contains a query statement. , the document block where the formula is located , and other document blocks in the single tower model training set document , ,..., .

[0142] The preset single tower model loss function is:

[0143]

[0144] in, Characterize the loss function for the single tower model. , Representation of the query With target block To splice, The output of the single tower model obtained by inputting the concatenated result into the single tower model represents the correlation information between the query statement and the target block under the single tower model. P(q) represents the set of all possible negative samples corresponding to the query statement q, that is, the query statement A set of document blocks that are not target blocks in the corresponding document blocks; Characterization obey Distribution of Characterization obey The formula represents the query statement With target block The result of the splicing is input into the single tower model to obtain the output of the result, and the negative logarithm is taken as the first value; obey The expectation under the distribution of is multiplied by one minus the query statement With non-target blocks The result of the splicing 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 correlation single-tower model of the current business scenario, for any candidate block, the query statement obtained by converting the formula name is spliced ​​with the candidate block. According to the splicing result, based on the preset correlation single-tower model, the correlation information between the formula name and the candidate block is obtained, which is the second correlation corresponding to the candidate block. For example, if the current business scenario is a medical scenario, if the document to be processed is document A, the formula name obtained from it is determined to be "La Roche Glaucoma Calculator", and the formula name is converted into a query statement, for example, "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 spliced ​​with the candidate block, and the splicing result is "[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 splicing function. The second correlation corresponding to each candidate block is obtained.

[0146] A second relevance threshold is preset, and the second relevance threshold is used to determine the target block from the candidate blocks. The second relevance threshold represents the minimum threshold for the existence of the target block for the second relevance. According to the second relevance, based on the preset second relevance threshold, the target block is determined from the candidate blocks. For example, the second relevance is sorted, and the magnitude relationship between the maximum value in the second relevance and the second relevance threshold is compared. If the maximum value of the second relevance is less than the second relevance, it is determined that there is no formula in the document to be processed, and the process of determining the formula ends; if the maximum value of the second relevance is greater than the second relevance threshold, the candidate block corresponding to the second relevance maximum value is determined as the target block.

[0147] The beneficial effect of such a setting is that by using the first relevance threshold and the second relevance threshold, the relevance information is compared to determine whether there is a formula in the document to be processed, and the target block where the formula is located is determined, so that the determined target block is more accurate and has a higher possibility of containing the formula. The relevance of the candidate block is verified using the relevance single tower model, which is highly accurate and more suitable for re-verification of the target block from the candidate blocks.

[0148] The present application provides a method of obtaining a document to be processed, processing the document to be processed, determining multiple document blocks from the document to be processed, determining whether there is formula description information in the document block, and if there is formula description information, determining the corresponding formula name according to the formula description information, and determining a target block containing the formula from the document block according to the formula name, and determining the formula corresponding to the formula name from the target block. Automatic identification of whether there is a formula in the document to be processed and identification of the formula name are achieved, as well as accurate determination of the formula according to the formula name, thereby improving the efficiency of determining the formula from the document and making the determined formula more accurate.

[0149] Figure 3 A flowchart of a document-based formula determination method provided in an embodiment of the present disclosure.

[0150] In this embodiment, if it is determined that formula description information exists 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 based on the semantic information that formula description information exists in the text block, 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 comprises the following steps:

[0152] S301, obtaining a document to be processed, and determining a plurality of 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] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0154] S302: Perform semantic recognition processing on each text block to obtain semantic information of the text block.

[0155] Exemplarily, semantic recognition processing is performed on each text block to obtain semantic information of the text block. For example, a second semantic recognition model can be pre-set, and the second semantic recognition model is used to perform semantic recognition on the text block to obtain semantic information corresponding to each text block. The preset second semantic recognition model can be a Qwen2-72B model.

[0156] The beneficial effect of this setting is that semantic recognition processing is performed on each text block to obtain the semantic information corresponding to each text block, which can better determine the semantics of the document to be processed, making the process of determining whether there is a formula more accurate and more precisely determining whether there is a formula in the document to be processed.

[0157] S303: If it is determined according to the semantic information that there is formula description information in the text block, the formula description information is extracted from the text block, and a formula name corresponding to the formula description information is determined.

[0158] Exemplarily, if it is determined based on semantic information that there is formula description information in any text block, such as how to use the formula, the calculation rules of the formula, the text description of the formula, etc., 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 example, a third semantic recognition model can be pre-set, and the third semantic recognition model is used to determine the formula name corresponding to the formula description information based on the formula description information. The preset third semantic recognition model can be a Qwen2-72B model.

[0159] The beneficial effect of such a setting is that it is determined whether there is formula description information in the text block based on the semantic information. If so, the formula description information is extracted from the corresponding text block, and the corresponding formula name is determined based on the formula description information, so that the determination of the formula name is more accurate and more reliable.

[0160] In this embodiment, the method further includes: if it is determined according to the semantic information that no formula description information exists in the text block, then it is determined that no formula exists in the document to be processed.

[0161] Specifically, if it is determined based on semantic information that there is no formula description information in the text block, that is, there is no related information such as how to use the formula, the formula's calculation rules, and the formula's 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 beneficial effect of such a setting is that if there is no formula description information, the formula determination process of the document to be determined is terminated, which effectively reduces unnecessary waste and improves the efficiency of determining the formula from the document to be processed.

[0163] S304, determining a target block from all document blocks according to the formula name, and determining a formula corresponding to the formula name from the target block.

[0164] Exemplarily, this step may refer to the above-mentioned step S103 and will not be described in detail.

[0165] The present application provides a method of obtaining a document to be processed, processing the document to be processed, determining multiple document blocks from the document to be processed, determining whether there is formula description information in the document block, and if there is formula description information, determining the corresponding formula name according to the formula description information, and determining a target block containing the formula from the document block according to the formula name, and determining the formula corresponding to the formula name from the target block. Automatic identification of whether there is a formula in the document to be processed and identification of the formula name are achieved, as well as accurate determination of the formula according to the formula name, thereby improving the efficiency of determining the formula from the document and making the determined formula more accurate.

[0166] Figure 4 A flowchart of a document-based formula determination method provided in an embodiment of the present 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 in 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 comprises the following steps:

[0169] S401. Obtain a document to be processed, parse and process the document to be processed according to a preset data format, and obtain a document block in the preset data format; wherein the preset data format includes a text format, a formula format, and a table format; wherein the document block includes at least three types: a text block, a formula block, and a table block.

[0170] Exemplarily, a document to be processed is obtained, and the document to be processed is parsed according to a preset data format to obtain a document block in a preset data format. For example, a parsing model is pre-set, and the parsing model is used to parse the document to be processed, and the document to be processed is parsed into document blocks in different preset data formats. The preset parsing model can be a GOT-OCR2_0 open source multimodal model. The initial format of the document to be processed can be, for example, a PDF format. According to the document to be processed, based on the preset parsing model, the text content in the document to be processed is parsed into a preset text format, such as a txt format; the mathematical formula content in the document to be processed is parsed into a preset formula format, such as a latex format; and the table format in the document to be processed is parsed into a preset table format, such as a markdown format. The document to be processed is parsed based on the preset parsing model and the preset data format to obtain document blocks in each preset data format.

[0171] The beneficial effect of such arrangement is that the document to be processed is parsed to obtain document blocks of corresponding preset data formats, which facilitates separate processing of different contents, makes the use of the content of the document to be processed more flexible, and facilitates the determination of formulas therefrom.

[0172] In this embodiment, the document to be processed is parsed according to a preset data format to obtain a document block in the preset data format, including: according to the preset data format, the document to be processed is parsed to obtain document data in 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; the document data is segmented to divide the document data into document blocks.

[0173] Specifically, according to the preset data format and based on the preset parsing model, the document to be processed is parsed to obtain document data in the preset data format in the document to be processed, and 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 text format data in the preset txt format; the mathematical formula content in the document to be processed is parsed into formula format data in the preset latex format; the table content in the document to be processed is parsed into table format data in the preset markdown format.

[0174] The document data is segmented into document blocks. For example, a segmentation ratio may be preset. The segmentation ratio is used to indicate the segmentation of the document data. The preset segmentation ratio may be, for example, 10%. The document data is segmented into document blocks according to the preset segmentation ratio.

[0175] The beneficial effect of such a setting is that the documents to be processed are parsed according to the preset data format, so that the contents in the documents to be processed are unified into the preset data format according to their respective preset data formats, which is convenient for processing and makes the data of the documents to be processed more standardized. The contents of the documents to be processed are segmented and processed, so that the contents are subdivided into document blocks, so that the subsequent semantic recognition is more efficient, and it can more accurately identify whether there is a formula and locate the formula block where the formula is located.

[0176] In this embodiment, the document data is segmented and processed into document blocks, including: determining a target segmentation point from the document data according to a preset segmentation word count; wherein the target segmentation point represents a 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 segmentation word count is obtained, and the preset segmentation word count is used to determine a target segmentation point from the document data, and the target segmentation point is used to indicate that the document data is to be segmented. The preset segmentation word count may be, for example, 300. According to the preset segmentation word count, the target segmentation point is determined from the document data, and according to the target segmentation point, the document data is segmented at the target segmentation point to obtain document blocks.

[0178] The beneficial effect of such a setting is that segmenting the document data according to the preset segmentation word count can make the segmentation operation more flexible and more suitable for segmenting text data, and also make the determination of the target segmentation point more accurate and can accurately locate the target segmentation point.

[0179] In this embodiment, a target segmentation point is determined from the document data according to a preset number of segmentation words, including: determining candidate segmentation points from the document data according to the preset number of segmentation words; wherein the number of text words between every two candidate segmentation points is the preset number of segmentation words; and determining the target segmentation point according to the position of the candidate segmentation point in the document data.

[0180] Specifically, a preset segmentation word count is obtained, and candidate segmentation points are determined from the document data according to the preset segmentation word count, and the number of text words between every two candidate segmentation points is the preset segmentation word count. The position of the target segmentation point is determined according to the position of the candidate segmentation point in the document data. For example, if the position of the candidate segmentation point is a period, the position of the candidate segmentation point is used as the target segmentation point; if the position of the candidate segmentation point is not a period, the position of the period closest to the candidate segmentation point is used as the target segmentation point.

[0181] The beneficial effect of this setting is that by using preset segmentation points to determine candidate segmentation points, the document data can be roughly segmented into equal numbers of words, and the candidate segmentation points are used to determine the target segmentation points, so that the segmentation points do not destroy the semantic content of the original text, making the semantic information of the segmented document blocks more complete.

[0182] In this embodiment, the target segmentation point is determined based on the position of the candidate segmentation point in the document data, including: determining the position of the candidate segmentation point in the document data and the paragraph where the candidate segmentation point is located; if the position of the candidate segmentation point is not the starting position of the paragraph where the candidate segmentation point is located, the starting position of the paragraph where 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 where the candidate segmentation point is located are determined, and 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 where the candidate segmentation point is located, that is, the candidate segmentation point is inside the paragraph where the candidate segmentation point is located, then the starting position of the paragraph where the candidate segmentation point is located is determined as the target segmentation point.

[0184] If the document data is formula data, the starting position and the ending position of the mathematical formula are determined as target segmentation points, and the mathematical formula is segmented, that is, each separate mathematical formula is regarded as a separate document block. If multiple mathematical formulas are adjacent, the starting position and the ending position of the multiple mathematical formulas are determined as target segmentation points, that is, the multiple adjacent mathematical formulas are regarded as a document block. For example, if mathematical formula A is a separate formula, the starting position and the ending position of mathematical formula A are determined as target segmentation points, and the mathematical formula is segmented to obtain mathematical formula A as a separate document block. If mathematical formula A is adjacent to mathematical formula B, the starting position of mathematical formula A and the ending position of mathematical formula B are determined as target segmentation points, and the mathematical formula A and mathematical formula B are segmented to obtain mathematical formula A and mathematical formula B as a document block. If the document data is table data, the starting position and the ending position of the table are determined as target segmentation points. That is, each separate table is regarded as a separate document block. If multiple tables are adjacent, the starting position and the ending position of these multiple tables are determined as the target segmentation points, that is, these multiple adjacent tables are regarded as a document block. For example, if Table A is a separate formula, the starting position and the ending position of Table A are determined as the target segmentation points, and it is segmented to obtain Table A as a separate document block. If Table A is adjacent to Table B, the starting position of Table A and the ending position of Table B are determined as the target segmentation points, and they are segmented to obtain Table A and Table B as one document block.

[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 table data of an exemplary document to be processed provided by an embodiment of the present disclosure. As shown in Table 1, Table 1 is "La Roche Glaucoma Calculator: Risk Factors with Corresponding Numerical Variables".

[0190] Table 2 is a table data of an exemplary document to be processed provided by an embodiment of the present 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. Table 1 and Table 2 are parsed using the preset parsing model, and the table contents are segmented according to the above segmentation processing rules to obtain document blocks:

[0192] “Table 1: La Roche Glaucoma Calculator: Risk Factors with Corresponding Numerical Variables|Score Criteria\n|−3\n|−2\n|−1\n|0\n|+1\n|+2\n|+3\n|+4\n|+5\n|+6\n|

[0193] |Age (years)\n|—\n|—\n|—\n|≤40\n|41–50\n|51–60\n|61–70\n|71–80\n|81–90\n|≥91\n|

[0194] |Intraocular pressure (mmHg)\n|—\n|—\n|—\n|≤12\n|13–15\n|16–18\n|19–21\n|22–25\n|26–29\n|≥30\n|

[0195] |Central corneal thickness (μm)\n|>600\n|576–600\n|551–575\n|526–550\n|500–525\n|475–499\n|450–474\n|425–449\n|400–424\n|<400\n|”

[0196] Table 2: La Roche Glaucoma Calculator: Determining Glaucoma Risk and Management. |Glaucoma Risk Category\n|Total Score(s)\n|Risk Management\n|

[0197] |Low risk\n|0–5\n|Reassessment recommended within 1 year\n|

[0198] |High risk\n|6–18\n|Ophthalmological evaluation required as soon as possible\n| ...”.

[0199] The beneficial effect of this setting is that the candidate segmentation points are reselected according to the paragraphs, and the target segmentation points are determined so that the segmentation points are at the boundaries of the paragraphs, thereby ensuring the semantic integrity of each document block, making the document block more complete and facilitating semantic recognition. Formulas and tables are divided into separate blocks, which also makes it more convenient to subsequently determine the document block where the formula is located.

[0200] S402: If it is determined that there is formula description information in the text block, determine the formula name corresponding to the formula description information.

[0201] Exemplarily, this step may refer to the above-mentioned step S102 and will not be described in detail.

[0202] S403: Determine a target block from all document blocks according to the formula name, and determine a formula corresponding to the formula name from the target block.

[0203] Exemplarily, this step may refer to the above-mentioned step S103 and will not be described in detail.

[0204] The present application provides a method of obtaining a document to be processed, processing the document to be processed, determining multiple document blocks from the document to be processed, determining whether there is formula description information in the document block, and if there is formula description information, determining the corresponding formula name according to the formula description information, and determining a target block containing the formula from the document block according to the formula name, and determining the formula corresponding to the formula name from the target block. Automatic identification of whether there is a formula in the document to be processed and identification of the formula name are achieved, as well as accurate determination of the formula according to the formula name, thereby improving the efficiency of determining the formula from the document and making the determined formula more accurate.

[0205] Figure 5 A structural block diagram of a document-based formula determination device provided in an embodiment of the present disclosure.

[0206] For the sake of convenience, only the parts related to the embodiments of the present disclosure are shown. 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 determine a plurality of 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] A first determining unit 502 is used to determine a formula name corresponding to the formula description information if it is determined that there is formula description information in the text block;

[0209] The second determining unit 503 is used to determine a target block from all document blocks according to the formula name, and 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 the present disclosure.

[0211] exist Figure 5 Based on the embodiment shown, Figure 6 As shown, the second determination unit 503 includes a correlation module 5031 and a target block module 5032 .

[0212] A relevance module 5031 is used to determine the relevance information between the formula name and each of the document blocks, which is a first relevance; wherein the first relevance represents 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 according to the first relevance.

[0214] In one example, the first target block module 5032 includes:

[0215] A candidate block submodule, configured to determine at least one candidate block from all document blocks according to the first relevance;

[0216] A correlation submodule, used to determine the correlation information between the formula name and each of the candidate blocks, which is a second correlation; wherein the second correlation represents 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 according to the second relevance.

[0218] In one example, the second determining unit 502 includes:

[0219] A recognition module, used for performing semantic recognition processing on each of the text blocks to obtain semantic information of the text block;

[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 according to the semantic information that the text block contains formula description information.

[0221] In one example, the second 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 according to the semantic information that there is no formula description information in the text block.

[0223] In one example, the acquisition 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 in the preset data format; wherein the preset data format includes a text format, a formula format, and a table format.

[0225] In one example, the parsing module includes:

[0226] A parsing submodule, used for parsing the document to be processed according to a preset data format to obtain document data in 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;

[0227] The segmentation submodule is used to segment the document data into document blocks.

[0228] In one example, the molecular module is specifically used to:

[0229] Determine a target segmentation point from the document data according to a preset segmentation word count; wherein the target segmentation point represents a position in the document data to be segmented;

[0230] The document data is segmented according to the target segmentation point to obtain the document blocks.

[0231] In one example, the molecular module is specifically used to:

[0232] Determine a target segmentation point from the document data according to a preset segmentation word count; wherein the target segmentation point represents a position in the document data to be segmented;

[0233] The document data is segmented according to the target segmentation point to obtain the document blocks.

[0234] In one example, the molecular module is specifically used to:

[0235] Determine the position of the candidate segmentation point in the document data and the paragraph where the candidate segmentation point is located;

[0236] If the position of the candidate segmentation point is not the starting position of the paragraph where the candidate segmentation point is located, the starting position of the paragraph where the candidate segmentation point is located is determined as the target segmentation point.

[0237] Figure 7 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 7As 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, and the instructions are executed by the at least one processor 702 so that the at least one processor 702 can execute the document-based formula determination method disclosed herein.

[0238] The electronic device 700 further includes a receiver 703 and a transmitter 804. 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 an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0240] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0241] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment, which device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0242] Device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 811 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0243] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0244] The memory 804 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The 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 memory, flash memory, magnetic disk or optical disk.

[0245] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0246] The 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 touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0247] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the 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 button, volume button, start button, and lock button.

[0249] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The 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, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0250] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can 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, the 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 above methods.

[0252] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0253] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a terminal device, enables the terminal device to execute the above-mentioned document-based formula determination method.

[0254] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0255] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0256] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0257] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0258] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0259] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, 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. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0260] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0261] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0262] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A document-based formula determination method, comprising: Acquire a document to be processed, and determine a plurality of document blocks from the document to be processed; wherein the document blocks include at least three types: text blocks, formula blocks, and table blocks; If it is determined that the text block contains formula description information, then determining the formula name corresponding to the formula description information; A target block is determined from all document blocks according to the formula name, and a formula corresponding to the formula name is determined from the target block.

2. The method according to claim 1, characterized in that Determine the target block from all document blocks according to the formula name, including: Determine the correlation information between the formula name and each of the document blocks as a first correlation; wherein the first correlation represents the degree of association between the document block and the formula name; The target block is determined from all document blocks according to the first relevance.

3. The method according to claim 2, characterized in that Determining the target block from all document blocks according to the first relevance includes: Determining at least one candidate block from all document blocks according to the first relevance; Determine the correlation information between the formula name and each of the candidate blocks as a second correlation; wherein the second correlation represents the degree of association between the candidate block and the formula name; The target block is determined from all document blocks according to the second correlation.

4. The method according to claim 1, characterized in that: If it is determined that the text block contains formula description information, then determining a formula name corresponding to the formula description information includes: Performing semantic recognition processing on each of the text blocks to obtain semantic information of the text block; If it is determined according to the semantic information that formula description information exists in the text block, the formula description information is extracted from the text block, and a formula name corresponding to the formula description information is determined.

5. The method according to claim 4, characterized in that Also includes: If it is determined according to the semantic information that no formula description information exists in the text block, it is determined that no formula exists in the document to be processed.

6. The method according to claim 1, characterized in that Determining a plurality of document blocks from the document to be processed includes: According to a preset data format, the document to be processed is parsed to obtain a document block in the preset data format; wherein the preset data format includes a text format, a formula format, and a table format.

7. The method according to claim 6, characterized in that According to a preset data format, the document to be processed is parsed to obtain a document block in the preset data format, including: According to a preset data format, the document to be processed is parsed to obtain document data in a preset data format in 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.

8. The method according to claim 7, characterized in that The document data is segmented into document blocks, including: Determine a target segmentation point from the document data according to a preset segmentation word count; wherein the target segmentation point represents a position in the document data to be segmented; The document data is segmented according to the target segmentation point to obtain the document blocks.

9. The method according to claim 8, characterized in that Determining a target segmentation point from the document data according to a preset segmentation word count includes: According to a preset segmentation word count, candidate segmentation points are determined from the document data; wherein the number of text words between every two candidate segmentation points is the preset segmentation word count; The target segmentation point is determined according to the position of the candidate segmentation point in the document data.

10. The method according to claim 9, characterized in that Determining the target segmentation point according to the position of the candidate segmentation point in the document data includes: Determine the position of the candidate segmentation point in the document data and the paragraph where the candidate segmentation point is located; If the position of the candidate segmentation point is not the starting position of the paragraph where the candidate segmentation point is located, the starting position of the paragraph where the candidate segmentation point is located is determined as the target segmentation point.

11. A document-based formula determination device, characterized in that: include: An acquisition unit, used for acquiring a document to be processed, and determining a plurality of document blocks from the document to be processed; wherein the document blocks include at least three types: text blocks, formula blocks, and table blocks; A first determining unit, configured to determine a formula name corresponding to the formula description information if it is determined that the text block contains formula description information; The second determining unit is used to determine a target block from all document blocks according to the formula name, and determine a formula corresponding to the formula name from the target block.

12. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 10 when executed by a processor.

14. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 10 when being executed by a processor.

Citation Information

Patent Citations

  • Formula information extracting method and device of business document

    CN108304383A

  • Formula main body positioning method, apparatus and device, and computer readable storage medium

    CN111400491A

  • Correlation method and device for entities in text, electronic equipment and storage medium

    CN112633000A

  • Retrieval method and device for engineering field design calculation formula

    CN114266228A

  • Document segmentation method, electronic equipment and computer readable storage medium

    CN117688926A

Cited By

  • Data processing method and device, medium, electronic equipment and program product

    CN121031550A