OFD layout drift automatic correction method and system based on multi-flexible interpolation description

The ideal coordinate values ​​of the OFD template are automatically calculated through multiple flexible interpolation description algorithms, which solves the problem of OFD format document drift, improves correction efficiency and accuracy, and ensures the aesthetics of the document.

CN118193463BActive Publication Date: 2024-09-03BEIJING CSSCA TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410600722.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-15
Publication Date
2024-09-03
Estimated Expiration
2044-05-15

AI Technical Summary

Technical Problem

In the existing technology, the template design of OFD layout documents is not accurate enough or the length of the layout data content exceeds expectations, causing page objects to drift, affecting the readability and neatness of the document. In addition, manual correction is inefficient and prone to omissions or inaccuracies.

Method used

Using a method based on multi-flexible interpolation description, by acquiring and parsing OFD template and document data, extracting text and path object coordinates, generating coordinate sequences, using the preset multi-flexible interpolation description algorithm to calculate ideal coordinate values, automatically correcting templates, and generating correction documents , without manual intervention.

Benefits of technology

It improves the speed and quality of drift correction, ensures clean and beautiful documents, achieves efficient and accurate drift correction, and reduces manual adjustment time and errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118193463B
    Figure CN118193463B
Patent Text Reader

Abstract

The present application relates to an automatic correction method and system for OFD layout drift based on multi-flexible interpolation description, which is applied to the field of document processing technology. The method includes: obtaining a target OFD template and target OFD document data; extracting text objects, text object coordinates, path objects and path object coordinates of the target OFD template; extracting text data from the target OFD document data. Binding the text data with the text object coordinates to generate text coordinates, and connecting them in series to form a text coordinate sequence; connecting the path coordinates in series to form a path coordinate sequence. Generate a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence; generate an ideal coordinate value based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used; perform drift correction on the target OFD template according to the ideal coordinate value to generate a corrected document. The present application has the effect of improving adjustment efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of document processing, and in particular to an OFD format drift automatic correction method and system based on multi-flexible interpolation description. Background Art

[0002] OFD is an open document format standard for office applications. It has the advantages of openness, security, and permission control. It is widely used in formatted document generation in scenarios such as bank bills and electronic invoices.

[0003] However, due to inaccurate template design or the unexpected length of the template data content, the generated OFD layout documents often have drift problems, that is, the page objects are offset from the expected position, affecting the readability and neatness of the document.

[0004] At present, manual correction is generally used to adjust the format, that is, manually pay attention to adjust the position of each drifting object or the size of the font. Due to the huge workload, manual correction takes a long time and is prone to omissions or inaccurate corrections, making the overall adjustment efficiency low. Summary of the invention

[0005] In order to improve the adjustment efficiency, the present application provides an OFD format drift automatic correction method and system based on multi-flexible interpolation description.

[0006] In a first aspect, the present application provides an OFD layout drift automatic correction method based on multi-flexible interpolation description, which adopts the following technical solution:

[0007] An OFD layout drift automatic correction method based on multi-flexible interpolation description, comprising:

[0008] Obtain target OFD template and target OFD document data;

[0009] Extracting text objects, text object coordinates, path objects and path object coordinates of the target OFD template;

[0010] Extracting text data from the target OFD document data;

[0011] Binding the text data to the text object based on the text object coordinates to generate text coordinates, and connecting them in series to form a text coordinate sequence;

[0012] Connecting the path object coordinates in series to generate a path coordinate sequence;

[0013] generating a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence;

[0014] Generate ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used;

[0015] The target OFD template is drift-corrected according to the ideal coordinate values ​​to generate a correction document.

[0016] By adopting the above technical solution, without human intervention, the algorithm is used to automatically calculate the ideal distribution of text objects in the target OFD template and automatically complete the drift correction, thereby improving the speed and quality of drift correction, ensuring the neatness and beauty of the document, and thus achieving efficient and accurate drift correction.

[0017] Optionally, extracting the text object, text object coordinates, path object and path object coordinates of the target OFD template includes:

[0018] Parsing the page object layer of the target OFD template to determine the text object and path object of the target OFD template;

[0019] Obtaining the coordinate origin of the target OFD template;

[0020] The text object coordinates and the path object coordinates are determined based on the coordinate origin.

[0021] Optionally, 3. the generating a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence includes:

[0022] Get the X coordinate value of the text coordinate;

[0023] Arrange the text coordinates in ascending order according to the X coordinate values ​​to generate a text coordinate sequence to be used;

[0024] Obtain the X coordinate value of the path coordinate;

[0025] The path coordinates are arranged in ascending order according to the X coordinate values ​​to generate a path coordinate sequence to be used.

[0026] Optionally, the generating the ideal coordinate value based on the preset multi-flexible interpolation description algorithm and the coordinate sequence to be used includes:

[0027] Calculating the text coordinate sequence to be used and the path coordinate sequence to be used based on the preset multi-flexible interpolation description algorithm to generate an objective function;

[0028] determining a target adjustment value based on the target function;

[0029] Ideal coordinate values ​​are determined based on the target adjustment values.

[0030] Optionally, the method further includes:

[0031] Obtaining distribution characteristics of the target OFD template;

[0032] Dividing the target OFD template into a plurality of document modules based on the distribution characteristics, and determining the number of the document modules;

[0033] Document modules with the same distribution characteristics are considered as a drift correction group.

[0034] Optionally, after the document modules having the same distribution characteristics are regarded as a drift correction group, the method further includes:

[0035] Obtaining drift correction data and result scores of the drift correction team;

[0036] Determining whether the drift correction of the correction document is accurate based on the result score;

[0037] If the drift correction of the correction document is accurate, storing the drift correction data;

[0038] If the drift correction of the correction document is inaccurate, drift correction is performed based on the drift correction result.

[0039] Optionally, after performing drift correction on the target OFD template according to the ideal coordinate value and generating a correction document, the method further includes:

[0040] Monitoring the calibration document to determine whether new drift content appears;

[0041] If there is a newly added drifting content, obtaining the location distribution characteristics of the location of the newly added drifting content;

[0042] Determining whether the location distribution feature is an existing distribution feature;

[0043] If it is an existing distribution feature, drift correction is performed on the newly added drift content based on the drift correction data;

[0044] If it is not an existing distribution feature, drift correction is performed based on the newly added drift content.

[0045] In the second aspect, the present application provides an OFD layout drift automatic correction system based on multi-flexible interpolation description, which adopts the following technical solution:

[0046] An OFD layout drift automatic correction system based on multi-flexible interpolation description, comprising:

[0047] A target document acquisition module is used to acquire a target OFD template and target OFD document data;

[0048] An object coordinate extraction module, used to extract text objects, text object coordinates, path objects and path object coordinates of the target OFD template;

[0049] A document data extraction module, used to extract text data from the target OFD document data;

[0050] A text sequence generation module, used for binding the text data with the text object based on the text object coordinates, generating text coordinates, and connecting them in series to form a text coordinate sequence;

[0051] A path sequence generation module, used to connect the path object coordinates in series to generate a path coordinate sequence;

[0052] A standby sequence generation module, used to generate a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence;

[0053] An ideal coordinate generation module, used to generate ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used;

[0054] The correction document generation module is used to perform drift correction on the target OFD template according to the ideal coordinate value to generate a correction document.

[0055] By adopting the above technical solution, without human intervention, the algorithm is used to automatically calculate the ideal distribution of text objects in the target OFD template and automatically complete the drift correction, thereby improving the speed and quality of drift correction, ensuring the neatness and beauty of the document, and thus achieving efficient and accurate drift correction.

[0056] In a third aspect, the present application provides an electronic device, which adopts the following technical solution:

[0057] An electronic device comprises a processor, wherein the processor is coupled to a memory;

[0058] The processor is used to execute the computer program stored in the memory, so that the electronic device executes the computer program of the OFD format drift automatic correction method based on multi-flexible interpolation description as described in any one of the first aspects.

[0059] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution:

[0060] A computer-readable storage medium stores a computer program that can be loaded by a processor and execute the OFD format drift automatic correction method based on multi-flexible interpolation description as described in any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1It is a flowchart of an OFD format drift automatic correction method based on multi-flexible interpolation description provided in an embodiment of the present application.

[0062] Figure 2 It is a structural block diagram of an OFD layout drift automatic correction system based on multi-flexible interpolation description provided in an embodiment of the present application.

[0063] Figure 3 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] The present application is further described in detail below in conjunction with the accompanying drawings.

[0065] The embodiment of the present application provides an automatic correction method for OFD layout drift based on multiple flexible interpolation descriptions, which can be executed by an electronic device, which can be a server or a terminal device, wherein the server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The terminal device can be a smart phone, a tablet computer, a desktop computer, etc., but is not limited thereto.

[0066] Figure 1 A flowchart of an OFD format drift automatic correction method based on multi-flexible interpolation description provided in an embodiment of the present application.

[0067] like Figure 1 As shown, the main process of the method is described as follows (steps S101 to S108):

[0068] Step S101, obtaining a target OFD template and target OFD document data.

[0069] In this embodiment, the target OFD template is the template for drift correction, such as a company's invoice template, which consists of two parts: static content such as fixed tables and headers, and dynamic memory such as variable amounts and customer names. The target OFD layout document is business data. For example, there is a field named UserName in the template, and the corresponding UserName value in the layout document is Zhang Lei, where Zhang Lei is the business data, that is, the data to be filled in or replaced in the target OFD template.

[0070] Step S102: extracting text objects, text object coordinates, path objects and path object coordinates of the target OFD template.

[0071] For step S102, parse the page object layer of the target OFD template to determine the text objects and path objects of the target OFD template; obtain the coordinate origin of the target OFD template; determine the text object coordinates and path object coordinates based on the coordinate origin.

[0072] In this embodiment, the page object layer of the target OFD template is <page>< / page> an element. Similarly, the page object contains text objects and path objects, and there are corresponding coordinates in the element attributes of the text objects and path formations. When extracting, first extract the text objects and path objects. Among them, the text objects are text contents such as "Zhang San, a certain company in City A, 18,000 yuan", etc. Each individual text object corresponds to a coordinate (x, y), that is, each text object corresponds to a text object coordinate, and the path object is a line in the target OFD template. Similarly, each path object corresponds to a path object coordinate. When determining the coordinates, it is necessary to draw and extract based on the zero-point coordinate, that is, the coordinate origin, according to constraint information such as font, font size, character spacing, line spacing, and border position. The selection of the coordinate origin is the display area of the drawing board to be drawn, generally understood as the upper left corner of the visible area printed on the paper. If there is a custom "bleed area (area added to prevent cutting errors)", the "bleed area" also needs to be excluded, and the upper left corner after exclusion is set as the coordinate origin.

[0073] Step S103, extract the text data in the target OFD document data.

[0074] In this embodiment, perform data extraction on the target OFD document data to extract the text data to be used. There may be useless descriptive text in the target OFD document data. To make the subsequent binding faster, it is necessary to extract and process the useful document data in advance.

[0075] Step S104, bind the text data with the text objects based on the text object coordinates, generate text coordinates, and concatenate them to form a text coordinate sequence.

[0076] In this embodiment, bind the text data with the text object coordinates to generate text coordinates. That is, fill the text data into the corresponding positions in sequence, and update the text content corresponding to the current text object coordinate to the content corresponding to the text data. For example, the text object coordinates are (2, 3), (3, 3), and the text data is "Zhang Lei". When filling, fill "Zhang" into the empty position of (2, 3) and fill "Lei" into the empty position of (3, 3), that is, supplement the valid content into the target OFD template, so that the text objects in the finally generated OFD template are valid text objects. Concatenate these valid text object coordinates into a text coordinate sequence, which is the actually usable OFD document.

[0077] Step S105, connecting the path object coordinates in series to generate a path coordinate sequence.

[0078] In this embodiment, the path object and the path object coordinates are bound in the same manner as the text data to generate a path coordinate sequence.

[0079] Step S106: Generate a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence.

[0080] For step S106, obtain the X coordinate value of the text coordinate; arrange the text coordinates in ascending order according to the X coordinate value to generate a text coordinate sequence to be used; obtain the X coordinate value of the path coordinate; arrange the path coordinates in ascending order according to the X coordinate value to generate a path coordinate sequence to be used.

[0081] In this embodiment, the text coordinate sequence and the path coordinate sequence are arranged in ascending order according to the X coordinate value of each coordinate, that is, the one with the smallest X value is arranged in the first place and the one with the largest X value is arranged in the last place, to generate a coordinate sequence to be used, that is, to generate a text coordinate sequence to be used and a path coordinate sequence to be used respectively. Take the text coordinate sequence as an example, text object 1: (200, 500), text object 2: (100, 600), text object 3: (150, 550), after being sorted according to the X value, text object 2: (100, 600), text object 3: (150, 550), text object 1: (200, 500), and the text coordinate sequence to be used is [(100, 600), (150, 550), (200, 500)].

[0082] Step S107 , generating ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used.

[0083] With respect to step S107, the coordinate sequence to be used is calculated based on a preset multi-flexible interpolation description algorithm to generate an objective function; a target adjustment value is determined based on the objective function; and an ideal coordinate value is determined based on the target adjustment value.

[0084] In this embodiment, for the obtained coordinate sequence, a preset multi-flexible interpolation description algorithm is applied to perform data fitting to obtain an interpolation description function y=f(x) that reflects the overall distribution law of the text object. The core formula of the MLID algorithm is: y=f(x)=Sum(ai*x^bi)(i=0,...,n); wherein n is the number of interpolation clauses, ai is the interpolation coefficient, and bi is the cardinality. The number of interpolation clauses n in this application is automatically set according to the number of path objects in the page. The number of path objects here is different from the second text object converted above. The path object here is the number of lines on the page. The value of the line is automatically identified when analyzing the document. Since each path object may affect the layout of the format, their number directly determines how many clauses are needed to construct an accurate interpolation description function.

[0085] The preset multi-flexible interpolation description algorithm determines the values ​​of each parameter ai and bi in the interpolation description function y=f(x) through least squares fitting, so that the objective function Q(a,b)=Σ(yi-f(xi))^2 is minimized, where (xi,yi) is the coordinate point in the coordinate sequence. Then, the heuristic optimization algorithm is used to find the optimal combination of (a,b) in the search space. Specifically, a set of initial (a,b) values ​​is randomly generated as the initial population, and then iterative optimization is performed until the termination condition is met. The current optimal solution is output. The obtained interpolation description function y=f(x) is then defined as the objective function, with the goal of minimizing the total deviation distance from the text coordinates to the objective function, and the ideal Y coordinate value of each text object is solved through the optimization algorithm. , The calculation formula is =f(xi)(i=1,...,m), where m is the number of text objects and xi is the X coordinate value of the i-th text object. Finally, common unconstrained optimization algorithms such as gradient descent and coordinate descent are used to solve. Taking gradient descent as an example, its iterative formula is: (t+1)= (t)-η* J / , where η is the learning rate, J is the objective function, and the calculation formula of J is J=Σ(yi- )^2.

[0086] Specifically, the interpolation coefficients ai and the cardinality bi are calculated by minimizing the objective function Q(a,b). This process involves using the least squares method to estimate the parameters of the function y=f(x) so that the sum of the squares of the differences between the actual coordinate points (xi,yi) and the coordinate points predicted by the interpolation description function is as small as possible. At the code implementation level, a heuristic optimization technique is used to find the optimal solution in the possible value space of the parameters, that is, a set of initial parameter values ​​is generated through the path object coordinates, and then the algorithm gradually adjusts these parameters in the iterative process until an optimal combination is found so that the objective function reaches the minimum value, thereby most accurately reflecting the distribution law of text objects on the OFD page. The entire calculation process is automatically performed by the computer, ensuring that the interpolation function can adapt to complex page layouts while retaining the structural accuracy of the document. a and b are the value clusters of ai and bi, which are the parameters used to construct the interpolation description function y=f(x) in the preset multi-flexible interpolation description algorithm. In the process of minimizing Q, a set of ai and bi values ​​is sought, which can minimize the sum of the squares of the differences between all observed points (xi, yi) and f(xi) predicted by the model. It should be noted that each template page corresponds to an objective function, which is set between 0.01 and 0.1. The staff needs to manually specify it according to the performance of the machine. The lower the value of the objective function, the better. However, the lower the value, the more it affects the convergence speed. If it is a server, you can directly specify 0.01. If it is a terminal for personal use, you need to set it according to the actual performance of the terminal.

[0087] Step S108, performing drift correction on the target OFD template according to the ideal coordinate values ​​to generate a correction document.

[0088] In this embodiment, the ideal coordinate values ​​ŷi of each text object obtained above are used to adjust the coordinates of the text object in the target OFD template accordingly, and then the page object layer is reorganized according to the OFD standard, and the OFD document file after drift correction is output, that is, the final corrected document is generated.

[0089] The following is an example to illustrate:

[0090] Assume that the text coordinates of the following three text objects are extracted, and two lines are used as path objects, so n = 2 (two items, representing two lines):

[0091] The x- and y-coordinates of the text object are:

[0092] Text object 1 (1.0, 1.5);

[0093] Text object 2 (2.0, 3.5);

[0094] Text object 3 (3.0, 6.5);

[0095] Use the preset multi-flexible interpolation description algorithm to fit a polynomial interpolation description function. In this example, a quadratic function is selected as the interpolation description function:

[0096] y=f(x)=a0+a1*x+a2*x^2;

[0097] We need to find the best values ​​of a0, a1, and a2 to minimize the objective function Q(a, b). Through the optimization process, we get the following parameter values:

[0098] a0 (constant term of quadratic function) = 0.1;

[0099] a1 (linear term coefficient) = 0.5;

[0100] a2 (quadratic term coefficient) = 0.2;

[0101] Therefore, the interpolation describing function will be y=0.1+0.5*x+0.2*x^2.

[0102] Assuming the x coordinate is 1.0, the calculation formula for the Y coordinate of optimized text object 1 is:

[0103] =f(1.0)=0.1+0.5*1.0+0.2*1.0^2=0.8;

[0104] Calculated The value is the ideal Y coordinate of text object 1 after calculation by the interpolation description function. Then, all the ideal values ​​are calculated according to the above calculation steps, and the position of each text object is adjusted according to the calculated ideal Y coordinate, and the corrected OFD document is output.

[0105] In this embodiment, the distribution characteristics of the target OFD template are obtained; the target OFD template is divided into a plurality of document modules based on the distribution characteristics, and the number of document modules is determined; and the document modules with the same distribution characteristics are regarded as a drift correction group.

[0106] In order to improve the convenience of operation and improve the overall drift correction efficiency, the entire target OFD template is divided into multiple document modules. Document modules with the same distribution characteristics are regarded as a drift group, and the document modules are sorted according to the number of document modules in each group. The larger the number, the higher the frequency of use. After the drift correction process is completed, the accurate corrected data needs to be stored so that the same solution can be used for drift correction when the same situation occurs, thereby improving the convenience of selection in subsequent use.

[0107] In this embodiment, the drift correction data and result scores of the drift correction team are obtained; whether the drift correction of the correction document is accurate is determined based on the result scores; if the drift correction of the correction document is accurate, the drift correction data is stored; if the drift correction of the correction document is inaccurate, drift correction is performed based on the drift correction results.

[0108] The drift correction data with accurate drift correction is stored. When documents with the same distribution characteristics appear in the future, the successful drift correction data can be directly used for correction processing, thereby reducing the processing pressure of the computer and improving the overall correction efficiency. If the drift correction of the corrected document is inaccurate, the above drift correction method will be used to re-correct the process until the actual needs are met.

[0109] In this embodiment, the correction document is monitored to determine whether new drift content appears; if new drift content appears, the position distribution characteristics of the location of the new drift content are obtained; it is determined whether the position distribution characteristics are existing distribution characteristics; if they are existing distribution characteristics, drift correction is performed on the new drift content based on the drift correction data; if they are not existing distribution characteristics, drift correction is performed based on the new drift content.

[0110] In order to improve the efficiency of drift correction, when performing drift correction on a correction document with newly added drift content, it is only necessary to perform correction processing on the newly added part, and judge the position distribution characteristics of the newly added drift inner cylinder to see whether they are the same as the existing distribution characteristics. If they are the same, then directly use the drift correction data corresponding to the existing distribution characteristics for correction. If they are different, then use the above-mentioned drift correction method to drift correct the newly added drift content. The specific drift correction method will not be repeated here again.

[0111] It should be noted that the fitting interpolation description function algorithm used in this application can be replaced by the Loess or IBK algorithm according to actual needs. If the Loess algorithm is used, a more complex local weighted regression calculation of the text object coordinates is required, rather than simply applying a global function. Correspondingly, if a completely different regression method is adopted, new steps may need to be introduced, such as adjusting weights, selecting neighborhood sizes, etc. This will depend on the specific non-parametric regression algorithm selected. The replacement algorithm here and the changes made according to the algorithm need to be added and adjusted according to actual needs, and no specific restrictions are made here.

[0112] Figure 2 A structural block diagram of an OFD format drift automatic correction system 200 based on multi-flexible interpolation description provided in an embodiment of the application.

[0113] like Figure 2As shown, the OFD layout drift automatic correction system 200 based on multi-flexible interpolation description mainly includes:

[0114] A target document acquisition module 201 is used to acquire a target OFD template and target OFD document data;

[0115] The object coordinate extraction module 202 is used to extract the text object, text object coordinates, path object and path object coordinates of the target OFD template;

[0116] The document data extraction module 203 is used to extract text data from the target OFD document data;

[0117] A text sequence generation module 204 is used to bind text data to text objects based on text object coordinates, generate text coordinates, and connect them in series to form a text coordinate sequence;

[0118] A path sequence generation module 205 is used to connect the path object coordinates in series to generate a path coordinate sequence;

[0119] A standby sequence generating module 206, used to generate a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence;

[0120] An ideal coordinate generation module 207, used to generate ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and a coordinate sequence to be used;

[0121] The correction document generation module 208 is used to perform drift correction on the target OFD template according to the ideal coordinate values ​​to generate a correction document.

[0122] As an optional implementation of this embodiment, the object coordinate extraction module 202 is specifically used to parse the page object layer of the target OFD template, determine the text object and path object of the target OFD template; obtain the coordinate origin of the target OFD template; and determine the text object coordinates and path object coordinates based on the coordinate origin.

[0123] As an optional implementation of this embodiment, the coordinate sequence generation module 206 is specifically used to obtain the X-coordinate value of the text coordinate; arrange the text coordinates in ascending order according to the X-coordinate value to generate a text coordinate sequence to be used; obtain the X-coordinate value of the path coordinate; arrange the path coordinates in ascending order according to the X-coordinate value to generate a path coordinate sequence to be used.

[0124] As an optional implementation of this embodiment, the ideal coordinate generation module 207 is specifically used to calculate the coordinate sequence to be used based on a preset multi-flexible interpolation description algorithm to generate an objective function; determine a target adjustment value based on the objective function; and determine an ideal coordinate value based on the target adjustment value.

[0125] As an optional implementation of this embodiment, the OFD layout drift automatic correction system 200 based on multiple flexible interpolation descriptions further includes:

[0126] A distribution feature acquisition module is used to acquire the distribution features of the target OFD template;

[0127] A document module division module is used to divide the target OFD template into multiple document modules based on the distribution characteristics and determine the number of document modules;

[0128] The correction group division module is used to group document modules with the same distribution characteristics as a drift correction group.

[0129] As an optional implementation of this embodiment, the OFD layout drift automatic correction system 200 based on multiple flexible interpolation descriptions further includes:

[0130] A data result acquisition module is used to obtain drift correction data and result scores of the drift correction team;

[0131] A correction accuracy judgment module is used to judge whether the drift correction of the correction document is accurate based on the result score;

[0132] A correction data storage module, used for storing drift correction data;

[0133] The drift result correction module is used to perform drift correction based on the drift correction result.

[0134] As an optional implementation of this embodiment, the OFD layout drift automatic correction system 200 based on multiple flexible interpolation descriptions further includes:

[0135] A new drift judgment module is added to monitor the calibration documents to determine whether new drift content appears;

[0136] A location feature acquisition module is used to acquire location distribution features of the location of the newly added drift content;

[0137] An existing feature judgment module is used to judge whether the location distribution feature is an existing distribution feature;

[0138] A first drift correction module, configured to perform drift correction on the newly added drift content based on the drift correction data;

[0139] The second drift correction module is used to perform drift correction based on the newly added drift content.

[0140] In one example, the module in any of the above devices can be one or more integrated circuits configured to implement the above methods, such as: one or more application specific integrated circuits (ASICs), or, one or more digital signal processors (DSPs), or, one or more field programmable gate arrays (FPGAs), or a combination of at least two of these integrated circuit forms.

[0141] For another example, when the modules in the device can be implemented in the form of a processing element scheduling program, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules can be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0142] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0143] Figure 3 This is a structural block diagram of an electronic device 300 provided in an embodiment of the present application.

[0144] like Figure 3 As shown, the electronic device 300 includes a processor 301 and a memory 302 , and may further include an information input / information output (I / O) interface 303 , one or more of a communication component 304 , and a communication bus 305 .

[0145] The processor 301 is used to control the overall operation of the electronic device 300 to complete all or part of the steps of the OFD format drift automatic correction method based on multi-flexible interpolation description; the memory 302 is used to store various types of data to support the operation of the electronic device 300, and these data may include instructions for any application or method used to operate on the electronic device 300, and data related to the application. The memory 302 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), programmable read-only memory (Programmable Read-Only Memory, PROM), read-only memory (Read-Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0146] The I / O interface 303 provides an interface between the processor 301 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 304 is used for wired or wireless communication between the electronic device 300 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 304 can include: Wi-Fi components, Bluetooth components, NFC components.

[0147] The electronic device 300 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the OFD format drift automatic correction method based on multi-flexible interpolation description given in the above embodiment.

[0148] The communication bus 305 may include a path to transmit information between the above components. The communication bus 305 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus 305 may be divided into an address bus, a data bus, a control bus, etc.

[0149] The electronic device 300 may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc., and may also be servers, etc.

[0150] The present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned OFD format drift automatic correction method based on multi-flexible interpolation description are implemented.

[0151] The computer-readable storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0152] The terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, method, article, or apparatus.

[0153] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of application involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the aforementioned application concept. For example, the above features are replaced with (but not limited to) technical features with similar functions applied in the present application.

Claims

1. An automatic correction method for OFD layout drift based on multi-flexible interpolation description, characterized in that: include: Obtain target OFD template and target OFD document data; Extracting text objects, text object coordinates, path objects and path object coordinates of the target OFD template; Extracting text data from the target OFD document data; Binding the text data to the text object based on the text object coordinates to generate text coordinates, and connecting them in series to form a text coordinate sequence; Connecting the path object coordinates in series to generate a path coordinate sequence; generating a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence; Generate ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used; Perform drift correction on the target OFD template according to the ideal coordinate value to generate a correction document; The method of generating the ideal coordinate value based on the preset multi-flexible interpolation description algorithm and the coordinate sequence to be used includes: calculating the coordinate sequence to be used based on the preset multi-flexible interpolation description algorithm to generate a target function; determining a target adjustment value based on the target function; determining the ideal coordinate value based on the target adjustment value; applying the preset multi-flexible interpolation description algorithm to perform data fitting on the coordinate sequence to obtain an interpolation description function y=f(x) that reflects the overall distribution law of the text object, and the core formula of the MLID algorithm is: y=f(x)=Sum(ai*x^bi); wherein, i=0,...,n, n is the number of interpolation clauses, ai is the interpolation coefficient, and bi is the base number; wherein, the number of interpolation clauses n is automatically set according to the number of path objects in the page, and the number of path objects is different from the second text object to be converted, and ... The path object is the number of lines on the page, and the number of lines is automatically identified when analyzing the document; the preset multi-flexible interpolation description algorithm determines the values ​​of each parameter ai and bi in the interpolation description function y=f(x) through least squares fitting, so that the objective function Q(a,b)=Σ(yi-f(xi))^2 is minimized, where (xi,yi) is the coordinate point in the coordinate sequence; the heuristic optimization algorithm is used to find the optimal combination of (a,b) in the search space, and a set of initial (a,b) values ​​is generated as the initial population. Through iterative optimization, the current optimal solution is output until the termination condition is met; the obtained interpolation description function y=f(x) is defined as the objective function, with the goal of minimizing the total deviation distance from the text coordinates to the objective function, and the ideal Y coordinate value of each text object is solved through the optimization algorithm. , The calculation formula is =f(xi), where i=1,...,m, m is the number of text objects, and xi is the X-coordinate value of the i-th text object; finally, the unconstrained optimization algorithm of gradient descent or coordinate descent is used to solve.

2. The method according to claim 1, characterized in that The extracting of the text object, text object coordinates, path object and path object coordinates of the target OFD template comprises: Parsing the page object layer of the target OFD template to determine the text object and path object of the target OFD template; Obtaining the coordinate origin of the target OFD template; The text object coordinates and the path object coordinates are determined based on the coordinate origin.

3. The method according to claim 1, characterized in that The generating of a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence comprises: Get the X coordinate value of the text coordinate; Arrange the text coordinates in ascending order according to the X coordinate values ​​to generate a text coordinate sequence to be used; Obtain the X coordinate value of the path coordinate; The path coordinates are arranged in ascending order according to the X coordinate values ​​to generate a path coordinate sequence to be used.

4. The method according to claim 1, characterized in that: The method further comprises: Obtaining distribution characteristics of the target OFD template; Dividing the target OFD template into a plurality of document modules based on the distribution characteristics, and determining the number of the document modules; Document modules with the same distribution characteristics are considered as a drift correction group.

5. The method according to claim 4, characterized in that After the document modules with the same distribution characteristics are regarded as a drift correction group, the method further includes: Obtaining drift correction data and result scores of the drift correction team; Determining whether the drift correction of the correction document is accurate based on the result score; If the drift correction of the correction document is accurate, storing the drift correction data; If the drift correction of the correction document is inaccurate, drift correction is performed based on the drift correction result.

6. The method according to claim 5, characterized in that After performing drift correction on the target OFD template according to the ideal coordinate value and generating a correction document, the method further includes: Monitoring the calibration document to determine whether new drift content appears; If there is a newly added drifting content, obtaining the location distribution characteristics of the location of the newly added drifting content; Determining whether the location distribution feature is an existing distribution feature; If it is an existing distribution feature, drift correction is performed on the newly added drift content based on the drift correction data; If it is not an existing distribution feature, drift correction is performed based on the newly added drift content.

7. An OFD layout drift automatic correction system based on multi-flexible interpolation description, characterized in that: include: A target document acquisition module is used to acquire a target OFD template and target OFD document data; An object coordinate extraction module, used to extract text objects, text object coordinates, path objects and path object coordinates of the target OFD template; A document data extraction module, used to extract text data from the target OFD document data; A text sequence generation module, used for binding the text data with the text object based on the text object coordinates, generating text coordinates, and connecting them in series to form a text coordinate sequence; A path sequence generation module, used to connect the path object coordinates in series to generate a path coordinate sequence; A standby sequence generation module, used to generate a coordinate sequence to be used based on the text coordinate sequence and the path coordinate sequence; An ideal coordinate generation module, used to generate ideal coordinate values ​​based on a preset multi-flexible interpolation description algorithm and the coordinate sequence to be used; A correction document generation module, used to perform drift correction on the target OFD template according to the ideal coordinate value and generate a correction document; The ideal coordinate generation module is used to calculate the coordinate sequence to be used based on the preset multi-flexible interpolation description algorithm to generate the target function; determine the target adjustment value based on the target function; determine the ideal coordinate value based on the target adjustment value; for the coordinate sequence, apply the preset multi-flexible interpolation description algorithm to perform data fitting to obtain the interpolation description function y=f(x) that reflects the overall distribution law of the text object. The core formula of the MLID algorithm is: y=f(x)=Sum(ai*x^bi); wherein, i=0,...,n, n is the number of interpolation clauses, ai is the interpolation coefficient, and bi is the base; wherein, the number of interpolation clauses n is automatically set according to the number of path objects in the page, and the number of path objects is different from the second text object to be converted, and the path object is the number of lines on the page. The number of lines is automatically identified when analyzing the document; the preset multi-flexible interpolation description algorithm determines the values ​​of each parameter ai and bi in the interpolation description function y=f(x) by least squares fitting, so that the objective function Q(a,b)=Σ(yi-f(xi))^2 is minimized, where (xi,yi) is the coordinate point in the coordinate sequence; the heuristic optimization algorithm is used to find the optimal combination of (a,b) in the search space, and a set of initial (a,b) values ​​is generated as the initial population, and the optimal solution is output through iterative optimization until the termination condition is met; the obtained interpolation description function y=f(x) is defined as the objective function, with the goal of minimizing the total deviation distance from the text coordinates to the objective function, and the ideal Y coordinate value of each text object is solved through the optimization algorithm. , The calculation formula is =f(xi), where i=1,...,m, m is the number of text objects, and xi is the X-coordinate value of the i-th text object; finally, the unconstrained optimization algorithm of gradient descent or coordinate descent is used to solve.

Citation Information

Cited By

  • Financial interpretation-oriented text rhetorical drift detection and correction method and system

    CN122220520A

  • Methods and Systems for Detecting and Correcting Rhetorical Drift in Financial Text Interpretation

    CN122220520B