CN113609433A - Method and device for determining formula layout, electronic equipment and storage medium - Google Patents

Method and device for determining formula layout, electronic equipment and storage medium Download PDF

Info

Publication number
CN113609433A
CN113609433A CN202110890794.3A CN202110890794A CN113609433A CN 113609433 A CN113609433 A CN 113609433A CN 202110890794 A CN202110890794 A CN 202110890794A CN 113609433 A CN113609433 A CN 113609433A
Authority
CN
China
Prior art keywords
formula
layout
determining
node
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110890794.3A
Other languages
Chinese (zh)
Other versions
CN113609433B (en
Inventor
安汝胜
何剑峰
潘卓
曾鹏轩
王宇航
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Siming Qichuang Technology Co ltd
Original Assignee
Beijing Siming Qichuang Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Siming Qichuang Technology Co ltd filed Critical Beijing Siming Qichuang Technology Co ltd
Priority to CN202110890794.3A priority Critical patent/CN113609433B/en
Publication of CN113609433A publication Critical patent/CN113609433A/en
Application granted granted Critical
Publication of CN113609433B publication Critical patent/CN113609433B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Operations Research (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The embodiment of the invention discloses a method and a device for determining an arithmetic layout, electronic equipment and a storage medium. The method comprises the following steps: acquiring editing information of a user on the target arithmetic layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content; and determining the current arithmetic formula layout according to the layout change node, the layout change mode and the target arithmetic formula layout. By operating the technical scheme provided by the embodiment of the invention, the problem that the input efficiency of the formula is reduced because a user can only perform editing operations such as insertion or modification at corresponding positions after deleting the input characters one by one in the input process of the formula can be solved, and the effects of improving the input efficiency of the formula and improving the flexibility and convenience of the formula editing are realized.

Description

Method and device for determining formula layout, electronic equipment and storage medium
Technical Field
The present invention relates to computer technologies, and in particular, to a method and an apparatus for determining an equation layout, an electronic device, and a storage medium.
Background
Often, the user inputs the formula according to a fixed format of the formula to obtain the final result of the formula, for example, sequentially inputting numbers and operation symbols according to the calculation order.
The existing formula input is usually input in a specified formula input area, and only after input characters are deleted one by one, the corresponding positions can be subjected to editing operations such as insertion or modification, and the efficiency of formula input is reduced.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining formula layout, electronic equipment and a storage medium, which are used for improving the efficiency of formula input and the flexibility and convenience of formula editing.
In a first aspect, an embodiment of the present invention provides a method for determining an equation layout, where the method includes:
acquiring editing information of a user on the target arithmetic layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content;
and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout.
In a second aspect, an embodiment of the present invention further provides an equation layout determining apparatus, where the apparatus includes:
the formula editing information acquisition module is used for acquiring the editing information of a user on the target formula layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
the node changing mode determining module is used for determining the layout changing node of the formula according to the formula editing position and determining the layout changing mode of the formula according to the formula editing content;
and the current arithmetic formula layout determining module is used for determining the current arithmetic formula layout according to the layout change node, the layout change mode and the target arithmetic formula layout.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the mathematical layout determination method as described above.
In a fourth aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor implements the mathematical layout determination method as described above.
The embodiment of the invention obtains the editing information of the target arithmetic layout by the user; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content; and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout. The method solves the problem that the user can only delete the input characters one by one and then can perform editing operations such as insertion or modification and the like on corresponding positions in the input process of the formula, thereby reducing the formula input efficiency, realizing the effects of improving the formula input efficiency and improving the flexibility and convenience of formula editing.
Drawings
Fig. 1 is a flowchart of a method for determining an equation layout according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for determining an equation layout according to a second embodiment of the present invention;
FIG. 3 is a flowchart of a method for determining an equation layout according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an equation layout determining apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a method for determining a formula layout according to an embodiment of the present invention, where the embodiment is applicable to a case where a user modifies a formula layout when editing a formula, and the method can be executed by a device for determining a formula layout according to an embodiment of the present invention, and the device can be implemented by software and/or hardware. Referring to fig. 1, the method for determining an equation layout provided in this embodiment includes:
step 110, acquiring editing information of a target formula layout by a user; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; .
And the target formula layout is the formula layout of the current editing operation of the user. The historical formula layout is a layout of the formula existing before the user edits, and the formula layout may include formula content and formula format, for example, the historical formula is 100 ÷ 4 ═ 25, the formula content may include numbers and operation symbols, and the formula format may include font interval, font size, whether to wrap or not.
The initial arithmetic layout is a blank layout without history content, and the user edits the initial arithmetic layout, that is, the user inputs arithmetic.
The user may perform an operation of editing the target formula layout and/or the initial formula layout by inputting or deleting through an input device such as a keyboard and a mouse, which is not limited in this embodiment. Acquiring corresponding formula editing information through a user for a target formula layout editing operation, wherein the formula editing information comprises a formula editing position and formula editing content, and the formula editing position is a position corresponding to the editing operation in a formula, such as division in 100 division 4-25; the arithmetic editing content is a specific editing operation, for example, deleting a digital modification operation symbol, and the deleting manner may be reset, line deleting, unit-by-unit deleting, character-by-character deleting, and the like, which is not limited in this embodiment.
Optionally, when it is detected that the user performs an editing operation, a cursor may flash at the formula editing position selected by the user to prompt. The control of the direction keys of the physical keyboard and the upper, lower, left and right keys of the soft keyboard can be supported. Various controls on the object-oriented programming platform in the formula can use a chain structure, so that all content traversal is completed by combining direction key control.
Analyzing key value data transmitted by the soft keyboard through a message communication loose coupling mode with the keyboard component; meanwhile, the input of a physical keyboard is supported, the consistent data transmission of a soft keyboard is realized through a key value mapping mode, and the analysis of common mathematical symbols can be supported. Through the method, the formula editing experience of the user is improved.
Because the original mathematical components are mostly single components, for example, the fractional component only supports fractional parts, and the cyclic decimal component only supports cyclic decimal parts. The underlying mathematical elements may be parsed into corresponding sub-components according to different types, for example, integers are parsed into integer sub-components, operators and other symbols are parsed into symbol sub-components, cyclic fractions are parsed into cyclic fraction sub-components, fractions are parsed into fraction sub-components, etc., and the collection of sub-components is a complete sub-component library. The effect of assembling various mathematical elements in the formula can be achieved by combining the sub-components to obtain a formula. And because the method supports both independent mathematical basic elements and random combination of the elements, the flexibility of the formula layout can be improved.
In addition to the presentation of the various elements, the component can tightly integrate the input editing process of the formula, as well as the layout change process of the formula content and location, such as the input editing process with respect to the formula.
Illustratively, the row of nodes are divided into substring arrays containing data according to a grouping rule, and a copy key is arranged. And convenience support is provided for customized development, and the method is suitable for development of various service scenes.
In this embodiment, optionally, determining the layout change node of the equation according to the equation editing position includes:
determining a target formula node from the candidate formula nodes according to the formula editing position;
judging whether the target formula node has a father node or not; and if so, determining that the layout change node of the formula comprises the target formula node and a parent node of the target formula node.
The candidate arithmetic nodes are all editable arithmetic nodes, and the target arithmetic node is an arithmetic for performing editing operation.
The parent node of the target arithmetic node is a superior node including the target arithmetic node, and illustratively, if the target arithmetic node is an exponential part of a number, the whole number is the parent node, and if the whole number is a molecular part in a score, the whole score is also the parent node. The layout change node of the determination formula includes the target formula node and all parents of the target formula node. Therefore, the layout of all nodes is updated in a subsequent recursive updating mode, and the accuracy of the formula layout is improved.
And 120, determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content.
The layout change node is a basic unit of layout change, and each basic unit can be selected and operated, so that the operation efficiency is improved. The composition of each layout change node may be preset, and for example, the basic unit may be a continuous number, an arbitrary one-digit symbol, or an entire score, which is not limited in this embodiment. And determining the layout change node of the formula corresponding to the editing position according to the formula editing position.
Determining the layout change mode of the formula according to the formula editing content, for example, if the formula editing content is withdrawn, the layout change mode is to restore the last saved content, if the formula editing content is up, down, left and right cursor movement, the layout change mode is cursor movement but the layout is not changed, and the like.
And step 130, determining the current arithmetic formula layout according to the layout change node, the layout change mode and the target arithmetic formula layout.
And determining whether to change the target formula layout and the change mode of the target formula layout according to the layout change node and the layout change mode, and taking the changed formula layout as the current formula layout. Illustratively, if the layout change node is the operation symbol ÷ in the equation 100 ÷ 4, and the layout change manner is to change ÷ to +, then the current equation layout is 100+ 4. If the layout change node is the number after the operation symbol in equation 2+ and the layout change mode is input 3, the current equation layout is 2+ 3.
According to the technical scheme provided by the embodiment, the editing information of the target formula layout by the user is acquired; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content; and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout. The method solves the problem that the user can only delete the input characters one by one and then can perform editing operations such as insertion or modification and the like on corresponding positions in the input process of the formula, thereby reducing the formula input efficiency, realizing the effects of improving the formula input efficiency and improving the flexibility and convenience of formula editing.
Example two
Fig. 2 is a flowchart of an equation layout determining method according to a second embodiment of the present invention, and the present technical solution is supplementary explained for a process of determining a current equation layout according to the layout change node, the layout change method, and the target equation layout. Compared with the scheme, the scheme is specifically optimized in that the determining of the current formula layout according to the layout change node, the layout change mode and the target formula layout comprises the following steps:
determining a layout change line according to the layout change node and the target formula layout;
acquiring the accumulated line length corresponding to the formula node in the layout change line according to the layout change mode and the target formula layout;
determining the updating range of the target arithmetic layout according to whether the accumulated line length is larger than a preset line length threshold value or not;
and determining the current arithmetic layout according to the updating range and the layout change mode. Specifically, the flow chart of the formula layout determining method is shown in fig. 2:
step 210, obtaining editing information of a target formula layout by a user; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; .
And step 220, determining a formula layout change node according to the formula editing position, and determining a formula layout change mode according to the formula editing content.
And step 230, determining a layout change line according to the layout change node and the target formula layout.
The layout change line is a line of the formula which is changed in the target formula layout, and illustratively, the formula as a whole includes five lines, and if the user edits in the fourth line, the layout change node is in the fourth line, and the fourth line of the formula is the layout change line.
And 240, acquiring the accumulated line length corresponding to the formula node in the layout change line according to the layout change mode and the target formula layout.
The temporary layout after the layout change line is determined according to the layout change manner and the target formula layout, and illustratively, the content in the layout change line is (250 ÷ 50) + (12 × 4), the layout change manner is increased by + (15 × 2), and then the temporary layout after the layout change line is changed is (250 ÷ 50) + (12 × 4) + (15 × 2).
At this time, the accumulated line length of each node in the layout change line is obtained, and the accumulated line length may be calculated by the length of the formula node itself + the length of the horizontal interval between the formula node and the previous formula node + the line length accumulated by all formula nodes before the formula node, which is not limited in this embodiment.
And step 250, determining the updating range of the target mathematical expression layout according to whether the accumulated line length is larger than a preset line length threshold value.
And determining an updating range according to whether the current length of the layout change line is greater than a preset line length threshold, wherein if the current length is greater than the preset line length threshold, the formula node is a line change node, namely the layout change line needs to be changed, and the updating range comprises the layout change line and the subsequent line of the layout change line. If the current length is less than or equal to the preset line length threshold, the update range is indicated to include the layout change line only.
In this embodiment, optionally, determining an update range of the target mathematical expression layout according to whether the accumulated line length is greater than a preset line length threshold includes:
and if the current length of the layout change line is less than or equal to a preset line length threshold value, determining the updating range of the target arithmetic layout according to whether the line height of the layout change line is changed.
And if the current length is less than or equal to the preset line length threshold value, determining whether to change other formula lines except the layout change line according to whether the line height of the layout change line is changed, determining whether to change whether the line height changed by the layout change node in the layout change line is larger than the historical line height of the layout change line, and if so, changing.
If the row height of the layout change row changes, the subsequent rows of the layout change row may need to sequentially change the y coordinate of the position of the row, i.e., the update range includes the subsequent rows of the layout change row and the layout change row. For example, the original formula is a calculation between integers, a fraction appears in the changed formula, and since the fraction occupies a higher height, the height of the layout change row is adjusted to the height of the fraction, and the subsequent rows of the layout change row are sequentially adjusted. Thereby improving the flexibility of formula editing and the aesthetic degree of formula layout.
And step 260, determining the layout of the current formula according to the updating range and the layout change mode.
And determining the layout change form of each row in the updating range according to the updating range and the layout change mode, such as the change of the row length, whether to add a new row, the change of the row height and the like.
For example, when the accumulated line length corresponding to the formula node is greater than the preset line length threshold, the formula node is a line feed node, and the determination method of the current formula layout includes: sequentially updating the x coordinates of all the formula nodes in the updating range into horizontal indentation, accumulated line length and horizontal interval; sequentially updating the y coordinates of all the formula nodes in the updating range into vertical direction indentation + current height + vertical direction interval, wherein the current height is the line height of the layout change line + the line height of the line which is increased due to line change, and the line height is determined by the maximum node height in the line; and updating the line number according to the number of the line feed nodes.
When the accumulated row lengths corresponding to the formula nodes are all less than or equal to the preset row length threshold, the determining mode of the current formula layout comprises the following steps: sequentially updating the x coordinates of all the formula nodes in the updating range into horizontal indentation, accumulated line length and horizontal interval; and judging whether the line height of the layout change line is changed, if so, sequentially updating the y coordinates of all the formula nodes in the updating range to be the vertical direction indentation + the current height + the vertical direction interval, and otherwise, updating the y coordinates of the layout change nodes in the updating range to be the vertical direction indentation + the current height + the vertical direction interval. Where the current height is determined by the largest node height in the row.
In this embodiment, optionally, all data formats in the uniform arithmetic expression of the LaTex character string format are used to realize standardization. Adding LaTex parsing support for special symbols such as cyclic decimal, fractional, tape fractional, square, cubic, remainder, and the like, except for supporting standard LaTex strings, for example: the method comprises the steps of using \ times to represent a product number, \\ div to represent a division number, \\ dot { x } to represent a cyclic decimal number, \\ cdots to represent a remainder, and the like, and using two marks of [ GlobalConfig ] [/GlobalConfig ] [ cfg ] [/cfg ] to dynamically configure identifiers by components, so that complete text exporting and analysis of data, layout and configuration can be realized.
Specifically, an init interface is called through initialization to transfer style parameters, the width and the height in a component, the maximum line number, the width, the font size and the like can be modified dynamically, global dynamic configuration is achieved by adding a [ GlobalConfig ] [/GlobalConfig ] identifier in a LaTex character string, and a [ cfg ] [/cfg ] identifier is added to dynamically configure unit elements. For example, if a command with-r added to the GlobalConfig tag is required, then the elements of the entire component will be read only, and if one of the elements needs to be editable, then the cfg, add-w command can be used to override the global configuration to achieve a gap-like requirement.
In addition to the above data formats, special symbols may be specified, such as specifying'; ' as a separator of a plurality of numbers, for example 10; 15; and 20 represents three numbers. Designating '#' as a placeholder for space-time, the marked element has the property of being writable and writable, but not deleting the element. The problem of the data standard that prior art used is various, difficult standardization is solved.
Determining the updating range of the target formula layout according to whether the accumulated line length corresponding to the formula node is greater than a preset line length threshold value or not; and the current formula layout is determined according to the updating range and the layout change mode, so that the automatic updating of the layout is realized, the efficiency and the aesthetic degree of the layout updating are improved, and the flexibility of formula editing is improved.
EXAMPLE III
Fig. 3 is a flowchart of an equation layout determining method according to a third embodiment of the present invention, and the application of the present technical solution to the equation-less equation is supplementary explained with respect to a process after determining the current equation layout. Compared with the scheme, the scheme is specifically optimized in that after the current formula layout is determined, the method further comprises the following steps:
judging whether a redundant symbol exists in the current formula layout according to the layout rule of the formula-off formula;
and if so, deleting the redundant symbol. Referring to fig. 3, the method for determining an equation layout according to this embodiment includes:
step 310, acquiring editing information of a target formula layout by a user; the formula editing information comprises a formula editing position and formula editing content; the target algorithm layout comprises at least one of a historical algorithm layout and an initial algorithm layout.
And step 320, determining a formula layout change node according to the formula editing position, and determining a formula layout change mode according to the formula editing content.
And step 330, determining the current arithmetic formula layout according to the layout change node, the layout change mode and the target arithmetic formula layout.
In this embodiment, optionally, after determining the layout of the current equation, the method further includes:
determining the formula content of each formula according to the current formula layout;
obtaining the formula result of each formula content according to the inverse Polish expression;
determining whether the formula result has errors or not according to the comparison result of each formula result and a preset answer;
if yes, determining a reminding mode according to the calculation formula result with errors.
According to the current formula layout, determining the formula content of each equal sign post formula, for example, the formula is:
{[(9+8)×4]+5}
={[17×4]+5}
={68+5}
=73
the contents of the equations are { [17 × 4] +5}, {68+5}, and 73, respectively.
Obtaining the formula result of each formula content according to the inverse Polish expression can be realized by converting the latex character string of each formula content into the inverse Polish expression through the dal2Rpn function, and solving the inverse Polish expression through the evalRpn function. And comparing each solution value with a preset answer, for example, the answer is 73, if the solution values are consistent, the formula result is judged to be correct, otherwise, the formula result is judged to be wrong.
If there is an incorrect formula result, a prompting manner may be determined according to a corresponding position of the incorrect formula result, for example, if the last calculation result is an incorrect result, a secondary submission confirmation interface is provided for the user to input and determine, and the prompting manner may be to only prompt the result that the calculation is incorrect, or may be to prompt from which calculation formula the calculation is incorrect, which is not limited in this embodiment.
Therefore, the method and the device avoid the error of the formula calculation result caused by the error input of the user, and improve the formula input experience of the user.
And 340, judging whether a redundant symbol exists in the current formula layout according to the layout rule of the formula-off formula.
The layout rule may include first calculating multiplication and division, and then calculating addition and subtraction. In the successive calculation of multiplication and division, calculation is performed sequentially from left to right. When the brackets are encountered, the inner parts of the brackets are calculated firstly; except for the first row of equations, each row is headed with an equal sign, and so on.
Whether the redundant symbols exist in the current formula layout can be judged to be whether redundant equal signs appear in the middle line or the tail line, namely whether formula lines which only have equal signs and do not have corresponding contents appear.
And step 350, if the redundant symbol exists, deleting the redundant symbol.
If so, the redundant symbol can be deleted by using a regular expression, for example, the continuous equal sign of the middle line can be replaced by the regular expression (\\ 2+), and if the tail line has only one equal sign, the equal sign is directly deleted, so that the deletion of the redundant symbol is completed.
According to the embodiment of the invention, whether the redundant symbols exist in the current formula layout is judged according to the layout rule of the disjunctive formula, and the redundant symbols are deleted, so that the automatic repair of the layout is realized, the accuracy of the layout update and the formula input efficiency of the user are improved, and the formula input experience of the user is improved.
Example four
Fig. 4 is a schematic structural diagram of an equation layout determining apparatus according to a fourth embodiment of the present invention. The device can be realized by hardware and/or software, can execute the method for determining the formula layout provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. As shown in fig. 4, the apparatus includes:
an equation editing information obtaining module 410, configured to obtain editing information of a target equation layout by a user; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
a node-changing mode determining module 420, configured to determine a layout-changing node of the formula according to the formula editing position, and determine a layout-changing mode of the formula according to the formula editing content;
a current mathematical formula layout determining module 430, configured to determine a current mathematical formula layout according to the layout change node, the layout change manner, and the target mathematical formula layout.
According to the technical scheme provided by the embodiment, the editing information of the target formula layout by the user is acquired; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout; determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content; and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout. The method solves the problem that the user can only delete the input characters one by one and then can perform editing operations such as insertion or modification and the like on corresponding positions in the input process of the formula, thereby reducing the formula input efficiency, realizing the effects of improving the formula input efficiency and improving the flexibility and convenience of formula editing.
On the basis of the above technical solutions, optionally, the node change mode determining module includes:
the target formula node determining unit is used for determining a target formula node from the candidate formula nodes according to the formula editing position;
a change node determination unit configured to determine whether the target formula node has a parent node; and if so, determining that the layout change node of the formula comprises the target formula node and a parent node of the target formula node.
On the basis of the above technical solutions, optionally, the current formula layout determining module includes:
a layout change line determination unit configured to determine a layout change line based on the layout change node and the target arithmetic layout;
an accumulated row length obtaining unit, configured to obtain, according to the layout change manner and the target arithmetic layout, an accumulated row length corresponding to the arithmetic node in the layout change row;
an update range determining unit, configured to determine an update range of the target mathematical formula layout according to whether the accumulated line length is greater than a preset line length threshold;
and the current arithmetic formula layout determining unit is used for determining the current arithmetic formula layout according to the updating range and the layout change mode.
On the basis of the foregoing technical solutions, optionally, the update range determining unit includes:
and the updating range determining subunit is used for determining the updating range of the target arithmetic layout according to whether the line height of the layout change line is changed or not if the current length of the layout change line is less than or equal to a preset line length threshold.
On the basis of the above technical solutions, optionally, the method is applied to a formula-off equation, and the apparatus further includes:
a redundant symbol judging module, configured to judge whether a redundant symbol exists in the current formula layout according to the layout rule of the disjunctive formula after the current formula layout determining module;
and the redundant symbol deleting module is used for deleting the redundant symbol if the redundant symbol judging module judges that the redundant symbol exists.
On the basis of the above technical solutions, optionally, the method is applied to a formula-off equation, and the apparatus further includes:
the formula content determining module is used for determining the formula content of each formula according to the current formula layout after the current formula layout determining module;
the formula result obtaining module is used for obtaining the formula result of each formula content according to the inverse Polish expression;
a result error existence determining module, configured to determine whether there is an error in the formula result according to a comparison result between each formula result and a preset answer;
and the reminding mode determining module is used for determining the reminding mode according to the wrong formula result if the result error existence determining module determines that the result error exists.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an electronic device according to a fifth embodiment of the present invention, as shown in fig. 5, the electronic device includes a processor 50, a memory 51, an input device 52, and an output device 53; the number of the processors 50 in the electronic device may be one or more, and one processor 50 is taken as an example in fig. 5; the processor 50, the memory 51, the input device 52 and the output device 53 in the electronic apparatus may be connected by a bus or other means, and the bus connection is exemplified in fig. 5.
The memory 51 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the formula layout determination method in the embodiment of the present invention. The processor 50 executes various functional applications and data processing of the electronic device by executing software programs, instructions and modules stored in the memory 51, that is, implements the above-described mathematical layout determination method.
The memory 51 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 51 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 51 may further include memory located remotely from the processor 50, which may be connected to the electronic device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for determining a mathematical layout, the method including:
acquiring editing information of a user on the target arithmetic layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content;
and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the formula layout determination method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the above formula layout determining apparatus, the included units and modules are only divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A method for determining an equation layout, comprising:
acquiring editing information of a user on the target arithmetic layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
determining a layout change node of the formula according to the formula editing position, and determining a layout change mode of the formula according to the formula editing content;
and determining the current arithmetic layout according to the layout change node, the layout change mode and the target arithmetic layout.
2. The method of claim 1, wherein determining a layout change node of an equation based on the equation edit position comprises:
determining a target formula node from the candidate formula nodes according to the formula editing position;
judging whether the target formula node has a father node or not; and if so, determining that the layout change node of the formula comprises the target formula node and a parent node of the target formula node.
3. The method of claim 1, wherein determining a current algorithm layout based on the layout change node, the layout change mode, and the target algorithm layout comprises:
determining a layout change line according to the layout change node and the target formula layout;
acquiring the accumulated line length corresponding to the formula node in the layout change line according to the layout change mode and the target formula layout;
determining the updating range of the target arithmetic layout according to whether the accumulated line length is larger than a preset line length threshold value or not;
and determining the current arithmetic layout according to the updating range and the layout change mode.
4. The method of claim 3, wherein determining the update range of the target algorithm layout according to whether the accumulated line length is greater than a preset line length threshold comprises:
and if the current length of the layout change line is less than or equal to a preset line length threshold value, determining the updating range of the target arithmetic layout according to whether the line height of the layout change line is changed.
5. The method of claim 1, applied to a disjoint algorithm, further comprising, after determining the current algorithm layout:
judging whether a redundant symbol exists in the current formula layout according to the layout rule of the formula-off formula;
and if so, deleting the redundant symbol.
6. The method of claim 1, applied to a disjoint algorithm, further comprising, after determining the current algorithm layout:
determining the formula content of each formula according to the current formula layout;
obtaining the formula result of each formula content according to the inverse Polish expression;
determining whether the formula result has errors or not according to the comparison result of each formula result and a preset answer;
if yes, determining a reminding mode according to the calculation formula result with errors.
7. An arithmetic layout determination apparatus, comprising:
the formula editing information acquisition module is used for acquiring the editing information of a user on the target formula layout; the formula editing information comprises a formula editing position and formula editing content; the target formula layout comprises at least one of a historical formula layout and an initial formula layout;
the node changing mode determining module is used for determining the layout changing node of the formula according to the formula editing position and determining the layout changing mode of the formula according to the formula editing content;
and the current arithmetic formula layout determining module is used for determining the current arithmetic formula layout according to the layout change node, the layout change mode and the target arithmetic formula layout.
8. The apparatus of claim 7, wherein the change node mode determining module comprises:
the target formula node determining unit is used for determining a target formula node from the candidate formula nodes according to the formula editing position;
a change node determination unit configured to determine whether the target formula node has a parent node; and if so, determining that the layout change node of the formula comprises the target formula node and a parent node of the target formula node.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the mathematical layout determination method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the mathematical layout determination method according to any one of claims 1 to 6.
CN202110890794.3A 2021-08-04 2021-08-04 Method and device for determining arithmetic layout, electronic equipment and storage medium Active CN113609433B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110890794.3A CN113609433B (en) 2021-08-04 2021-08-04 Method and device for determining arithmetic layout, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110890794.3A CN113609433B (en) 2021-08-04 2021-08-04 Method and device for determining arithmetic layout, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113609433A true CN113609433A (en) 2021-11-05
CN113609433B CN113609433B (en) 2024-04-30

Family

ID=78306774

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110890794.3A Active CN113609433B (en) 2021-08-04 2021-08-04 Method and device for determining arithmetic layout, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113609433B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114357944A (en) * 2021-12-17 2022-04-15 永中软件股份有限公司 Layout method of large operator formula and computer device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1845054A (en) * 2005-04-08 2006-10-11 皮克塞(研究)有限公司 System and method for dynamically zooming and rearranging display items
CN107608617A (en) * 2017-09-13 2018-01-19 浙江慧脑信息科技有限公司 A kind of characters by touch screen input and amending method
CN111191412A (en) * 2019-12-24 2020-05-22 远光软件股份有限公司 Method, device, storage medium and terminal for editing formula

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1845054A (en) * 2005-04-08 2006-10-11 皮克塞(研究)有限公司 System and method for dynamically zooming and rearranging display items
CN107608617A (en) * 2017-09-13 2018-01-19 浙江慧脑信息科技有限公司 A kind of characters by touch screen input and amending method
CN111191412A (en) * 2019-12-24 2020-05-22 远光软件股份有限公司 Method, device, storage medium and terminal for editing formula

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114357944A (en) * 2021-12-17 2022-04-15 永中软件股份有限公司 Layout method of large operator formula and computer device
CN114357944B (en) * 2021-12-17 2024-02-20 永中软件股份有限公司 Layout method of large operator formula and computer device

Also Published As

Publication number Publication date
CN113609433B (en) 2024-04-30

Similar Documents

Publication Publication Date Title
CN102609403B (en) Formatting data by example
CN110532019B (en) Method for tracing history of software code segment
US20080079730A1 (en) Character-level font linking
US11907203B2 (en) Path encoded tree structures for operations
CN108399072B (en) Application page updating method and device
CN108491326B (en) Test behavior a recombination process apparatus and storage medium
CN110738037A (en) Method, apparatus, device and storage medium for automatically generating electronic form
CN111666740A (en) Flow chart generation method and device, computer equipment and storage medium
CN106599016A (en) Front-end element maintenance method based on virtual DOM
CN112417569B (en) Revit primitive labeling method, device, equipment and storage medium
CN111831815B (en) Control method and device for questionnaire display, storage medium and electronic equipment
CN115358200A (en) Template document automatic generation method based on SysML meta model
CN101802765B (en) Method, and apparatus for facilitating object selection on display screen
CN110308907B (en) Data conversion method and device, storage medium and electronic equipment
CN113609433A (en) Method and device for determining formula layout, electronic equipment and storage medium
CN113282799B (en) Node operation method, node operation device, computer equipment and storage medium
CN116841536B (en) Component reference relation reconstruction method, device, system and storage medium
US20080256437A1 (en) Document Processing Apparatus and Document Processing Method
CN115577683B (en) HTML rich text content conversion method, device, equipment and medium
CN104346174A (en) Method for describing and reproducing on-line vector diagram modeling process
CN108255486B (en) View conversion method and device for form design and electronic equipment
EP1780645A1 (en) Document processing method and device
CN113011146A (en) Information processing apparatus, storage medium, and information processing method
CN115017161A (en) Method, device and application for updating tree data structure by combining virtual DOM
CN115525629A (en) Data processing method, data processing device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant