CN113297832A - Method, device and equipment for optimizing folding position and storage medium - Google Patents

Method, device and equipment for optimizing folding position and storage medium Download PDF

Info

Publication number
CN113297832A
CN113297832A CN202110581969.2A CN202110581969A CN113297832A CN 113297832 A CN113297832 A CN 113297832A CN 202110581969 A CN202110581969 A CN 202110581969A CN 113297832 A CN113297832 A CN 113297832A
Authority
CN
China
Prior art keywords
folding position
position information
content
folding
typesetting
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.)
Pending
Application number
CN202110581969.2A
Other languages
Chinese (zh)
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 Founder Electronics Co Ltd
Original Assignee
Beijing Founder Electronics 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 Founder Electronics Co Ltd filed Critical Beijing Founder Electronics Co Ltd
Priority to CN202110581969.2A priority Critical patent/CN113297832A/en
Publication of CN113297832A publication Critical patent/CN113297832A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/189Automatic justification

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application provides a folding position optimization method, a folding position optimization device, equipment and a storage medium, current folding position information and ideal folding position information corresponding to typesetting contents to be optimized are obtained, the current folding position information is obtained through calculation according to an existing folding algorithm, and the ideal folding position information is determined according to the area width. And obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information. And folding and typesetting the typesetting content to be optimized according to the target folding position. And under the condition that the folding effect is not ideal, searching a more optimal target folding position to enable the width of the content to be typeset to be closer to the region width, thereby improving the typesetting effect.

Description

Method, device and equipment for optimizing folding position and storage medium
Technical Field
The application relates to the field of content production and typesetting, and provides a method, a device, equipment and a storage medium for optimizing a folding position.
Background
With the increasing popularity of automated typesetting, efforts are constantly being made to reduce manual labor in the data processing process. Therefore, the requirement for the effect of the automatically typeset first draft document is higher and higher.
At present, when the width of the content to be typeset is larger than the width of the region, a proper folding position is found according to the existing folding algorithm, and folding and typesetting are carried out at the folding position.
However, if there is a long character string composed of western characters in the contents to be ranked, such as: the English website has the condition of poor typesetting effect in the existing roll-over algorithm.
Disclosure of Invention
The application provides a folding position optimization method, a folding position optimization device, equipment and a storage medium, which are used for solving the problem of poor typesetting effect of the existing folding algorithm.
In a first aspect, the present application provides a folding position optimization method, including:
acquiring current folding position information and ideal folding position information corresponding to the typesetting content to be optimized, wherein the current folding position information is obtained by calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the area width;
obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information;
and folding and typesetting the typesetting content to be optimized according to the target folding position.
Optionally, obtaining the target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information, including:
determining the content of the line to be folded according to the current folding position information and the ideal folding position information;
and matching the content to be folded with the preset characteristics, and determining a target folding position, wherein the target folding position is the position closest to the ideal folding position information.
Optionally, matching the content to be folded with a preset feature, and determining a target folding position includes:
matching the content of the row to be folded with a forcible splitting character table, wherein the forcible splitting character table comprises a plurality of weak splitting point characters;
when the characters of the content to be folded contain weak splitting point characters, marking the corresponding characters of the content to be folded as weak splitting points;
and determining the target folding position according to the weak splitting point.
Optionally, matching the content to be folded with a preset feature to determine a target folding position, further comprising:
judging the content to be typeset through a regular expression, wherein the regular expression is determined according to a plurality of contents to be typeset with poor typesetting effects;
when characters meeting conditions exist in the characters of the content to be folded, marking the corresponding characters of the content to be folded as weak splitting points;
and determining the target folding position according to the weak splitting point.
Optionally, before obtaining the current folding position information and the ideal folding position information corresponding to the typesetting content to be optimized, the method further includes:
obtaining a plurality of current folding position information of the content to be typeset according to the existing folding algorithm;
calculating a plurality of actual line typesetting widths according to the plurality of current line folding position information;
calculating a plurality of line typesetting ratios according to a plurality of actual line typesetting widths and region widths of the contents to be typeset, wherein the actual line typesetting widths are determined according to the current line folding position information;
and if the row typesetting ratio is smaller than the preset empirical value, determining the content to be typeset corresponding to the row typesetting ratio as the content to be optimally typeset.
Optionally, the method further comprises:
and optimizing and updating the preset empirical value and the folding optimization algorithm according to the characteristics of the content of the row to be folded.
In a second aspect, the present application provides a folding position optimizing device, comprising:
the obtaining module is used for obtaining current folding position information and ideal folding position information corresponding to the typesetting content to be optimized, the current folding position information is obtained by calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the area width;
the processing module is used for obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information;
the processing module is also used for folding and typesetting the typesetting content to be optimized according to the target folding position.
In a third aspect, the present application provides an electronic device, comprising: a memory, a processor;
a memory; a memory for storing processor-executable instructions;
and the processor is used for realizing the folding position optimization method related to the first aspect and the optional aspects according to executable instructions stored in the memory.
In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and the computer-executable instructions are executed by a processor to implement the folded position optimization method according to the first aspect and the optional aspects.
In a fifth aspect, the present application provides a computer program product comprising instructions that, when executed by a processor, implement the folded position optimization method according to the first aspect and the alternative.
The application provides a folding position optimization method, a folding position optimization device, equipment and a storage medium, current folding position information and ideal folding position information corresponding to typesetting contents to be optimized are obtained, the current folding position information is obtained through calculation according to an existing folding algorithm, and the ideal folding position information is determined according to the area width. And obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information. And folding and typesetting the typesetting content to be optimized according to the target folding position. And under the condition that the folding effect is not ideal, searching a more optimal target folding position to enable the width of the content to be typeset to be closer to the region width, thereby improving the typesetting effect.
Drawings
FIG. 1 is a diagram of a row typesetting effect provided by a conventional row folding algorithm;
FIG. 2 is a schematic view of Glue;
FIG. 3 is a schematic flow diagram illustrating a method for fold location optimization according to an exemplary embodiment of the present application;
FIG. 4 is a schematic flow diagram illustrating a method for fold location optimization according to another exemplary embodiment of the present application;
fig. 5 is a schematic diagram of obtaining weak splitting points according to the folding position optimization method provided in this embodiment;
FIG. 6 is a typesetting effect diagram containing characters and "&" obtained according to the prior line-folding algorithm;
FIG. 7 is a typesetting effect diagram containing characters and "&" obtained according to the folding position optimization method;
FIG. 8 is a diagram of a typesetting effect with a bottom horizontal line "_" according to a conventional zigzag algorithm;
FIG. 9 is a layout effect diagram with a bottom horizontal line "_" according to the folding position optimization method;
FIG. 10 is a diagram of typesetting effect including numbers [0-9] and English letters [ a-zA-Z ] and numbers | obtained according to a conventional folding algorithm;
FIG. 11 is a diagram of typesetting effect including numbers [0-9] and English letters [ a-zA-Z ] and numbers | obtained according to the folding position optimization method;
FIG. 12 is a diagram of typesetting effect obtained by a conventional line folding algorithm when the characters of the content to be folded are composed of only numbers;
FIG. 13 is a layout effect diagram when the characters of the content to be folded are only composed of numbers according to the folding position optimization method;
FIG. 14 is a diagram illustrating layout content of FIG. 1 optimized according to a folding position optimization method provided in the present application;
FIG. 15 is a schematic diagram illustrating a folded position optimizing device according to an exemplary embodiment of the present application;
fig. 16 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the field of content production and typesetting, the typesetting effect of typesetting content directly influences the quality and the aesthetic degree of publications. The line typesetting effect directly affects the overall effect of the publication, and if the line typesetting effect is not good, the layout effect of the publication is not ideal. With the increasing popularity of automated typesetting, efforts are constantly being made to reduce manual labor in the data processing process. Therefore, the requirement for the effect of the automatically typeset first draft document is higher and higher.
At present, when the width of the content to be typeset is larger than the width of the region, a proper folding position is found according to the existing folding algorithm, and folding and typesetting are carried out at the folding position.
However, if there is a long character string composed of western characters in the contents to be ranked, such as: the English website has the condition of poor typesetting effect in the existing roll-over algorithm.
Fig. 1 is a diagram of a row typesetting effect provided by a conventional row folding algorithm. As shown in fig. 1, the problems of the conventional walk-breaking algorithm are mainly expressed as follows: less typesetting content in the line, larger blank space, over-stretching of characters and unattractive typesetting effect. Under the condition of column division, the layout effect is worse. And it is difficult to achieve the desired effect by manual adjustment.
In order to solve the problems, the application provides a folding position optimization method. Under the condition that the folding effect is not ideal, a better target folding position is searched from a larger visual field range, so that the width of the content to be typeset is closer to the region width (line width or column width), and the typesetting effect is improved. In addition, the manual intervention on the layout can be reduced, the typesetting speed is accelerated, and the time cost and the labor cost are reduced.
The following are some of the functional and pronouns that will be used in the discussion below:
VCode: typesetting characters (including various characters and various box objects);
TotalLineWidth: the actual line typesetting width;
FrameWidth: the width of the region (line width when not column-dividing, column width when column-dividing);
d WidthRatio: the row composition ratio;
dEXP: presetting an experience value;
struct Glue: one structure representing the connection between the vcodes, like a "spring", stretches, compresses or breaks according to actual conditions, and includes information such as a normal width, a final width, a packing compression value, a packing tension value, and whether the VCode is a folding point mark. FIG. 2 is a schematic view of Glue. As shown in fig. 2, the value CanBreak of Glue at the dashed line is true, i.e. the broken line is performed at the dashed line, i.e. the broken line is performed after the character 1 and before the character 1.
Fig. 3 is a flowchart illustrating a folding position optimization method according to an exemplary embodiment of the present application. As shown in fig. 3, the method for optimizing the folding position provided in this embodiment includes the following steps:
s101, obtaining current folding position information and ideal folding position information corresponding to the typesetting content to be optimized, wherein the current folding position information is obtained through calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the region width.
More specifically, the content to be laid out optimally is the content to be laid out satisfying the folding optimization condition. And inputting the content to be typeset into the existing folding algorithm, wherein the existing folding algorithm can output all current folding position information of the content to be typeset. The number of the current folding position information is the number of lines corresponding to the content to be typeset. The current foldover location information includes a foldover point type, a current total width, a HyphenXSize (HyphenXSize), a stretch or compression value, and the like. And determining the ideal folding position information according to the area width FrameWidth, wherein the ideal folding position is equal to the area width FrameWidth.
And S102, obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information.
More specifically, the broken line optimization algorithm may be a brute force character table matching algorithm or a regular expression algorithm. And obtaining the content of the line to be folded according to the current folding position information and the ideal folding position information. And obtaining a plurality of weak splitting points according to the content of the row to be folded. And selecting a weak splitting point closest to the ideal folding position information from the plurality of weak splitting points, and taking the weak splitting point as a target folding position.
S103, folding and typesetting the content to be optimized according to the target folding position.
More specifically, the CanBreak attribute of Glue at the character corresponding to the current folding position information is reset to false. And setting the CanBreak attribute of Glue at the character corresponding to the target folding position as true, namely folding at the target folding position. And folding and typesetting the typesetting content to be optimized according to the target folding position.
For example, if the character before the target folding position is VCode _11 and the character before the target folding position is VCode _22, VCode _11 and VCode _22 are "unbundled". After loose binding, the folding and typesetting can be automatically carried out.
In the method provided by this embodiment, the current folding position information and the ideal folding position information corresponding to the content to be optimized are obtained, the current folding position information is obtained by calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the region width. And obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information. And folding and typesetting the typesetting content to be optimized according to the target folding position. And under the condition that the folding effect is not ideal, searching a more optimal target folding position to enable the width of the content to be typeset to be closer to the region width, thereby improving the typesetting effect.
Fig. 4 is a flowchart illustrating a fold location optimization method according to another exemplary embodiment of the present application. As shown in fig. 4, the method for optimizing the folding position provided in this embodiment includes the following steps:
s201, obtaining a plurality of current folding position information of the content to be typeset according to the existing folding algorithm.
More specifically, TotalLineWidth is set as the actual line layout width. The current foldover location information includes a foldover point type, a current total width, a HyphenXSize (HyphenXSize), a stretch or compression value, and the like.
For example, according to an existing fold line algorithm, 3 pieces of current fold line point information are obtained, which are called "Clue _ 1", "Clue _ 2" and "Clue _ 3", respectively, where "Clue _ 1" is a line change of the content to be typeset after VCode _1 and before VCode _2, "Clue _ 2" is a line change of the content to be typeset after VCode _3 and before VCode _4, and "Clue _ 3" is a line change of the content to be typeset after VCode _5 and before VCode _ 6.
S202, calculating the typesetting widths of a plurality of actual lines according to the current folding position information.
More specifically, the actual line layout width totalllinewidth is: when typesetting is carried out according to the existing line folding algorithm, the number of characters of each line of typesetting characters is calculated.
For example, the actual line layout width TotalLineWidth _1 of the line in which the value of Clue _2 is located is calculated according to the current fold position information Clue _1 and Clue _ 2. And calculating the actual line typesetting width TotalLineWidth _2 of the line where the Clue _3 is located according to the current folding position information Clue _2 and Clue _ 3.
S203, calculating the layout ratio of a plurality of lines according to the layout width and the area width of a plurality of actual lines of the content to be laid, wherein the layout width of the actual lines is determined according to the current folding position information.
More specifically, the line layout ratio dwidthatio is a quotient obtained by dividing the actual line layout width TotalLineWidth by the region width FrameWidth. And calculating the line typesetting ratio of each line according to the actual line typesetting width and the region width of each line.
For example, a line layout ratio dvidthratio _1 is calculated from the actual line layout width TotalLineWidth _1 and the region width FrameWidth, where dvidthratio _1 is a quotient of TotalLineWidth _1 divided by FrameWidth. And calculating a line typesetting ratio dWidthRatio _2 according to the actual line typesetting width TotalLineWidth _2 and the area width FrameWidth, wherein the dWidthRatio _2 is the quotient of the TotalLineWidth _2 divided by the FrameWidth.
And S204, if the row typesetting ratio is smaller than the preset empirical value, determining the content to be typeset corresponding to the row typesetting ratio as the content to be optimally typeset.
More specifically, the preset empirical value dEXP is a dEXP value initially determined empirically. And comparing the line layout ratio dWidthRatio of each line with a preset empirical value dEXP to obtain the line of which the line layout ratio dWidthRatio is smaller than the preset empirical value dEXP. If the line layout ratio dWidthRatio is smaller than the preset empirical value dEXP, the layout effect is poor, and the line position needs to be optimized. The content to be laid out of the line in which the dWidthRatio is smaller than dEXP can be determined as the content to be optimally laid out.
For example, if the line layout ratio dWidthRatio _1 is smaller than the preset empirical value dEXP, the content to be laid out of the line corresponding to the dWidthRatio _1 is determined as the content to be optimally laid out.
If the line typesetting ratio dWidthRatio of each line is larger than the preset empirical value dEXP, the typesetting effect is good, and the line position does not need to be optimized.
Considering the typesetting efficiency, performing the folding optimization under the condition that the typesetting effect is poor, namely the dWidthRatio is less than dEXP, otherwise, affecting the typesetting efficiency and enabling the optimization effect to be unreliated.
S205, obtaining current folding position information and ideal folding position information corresponding to the typesetting content to be optimized, wherein the current folding position information is obtained through calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the region width.
Step S205 is similar to the step S101 in the embodiment of fig. 3, and details of this embodiment are not repeated here.
And S206, determining the content to be folded according to the current folding position information and the ideal folding position information.
Fig. 5 is a schematic diagram of obtaining a weak splitting point according to the folding position optimization method provided in this embodiment. As shown in fig. 5, the content to be folded determined from the current folding position information and the ideal folding position information is "9 ea7d0f130daad4cc8c769a04d2d8d64e47f 9".
And S207, matching the content to be folded with the preset characteristics, and determining a target folding position, wherein the target folding position is the position closest to the ideal folding position information.
More specifically, the content to be broken down is matched with the preset features to obtain a plurality of weak splitting points. And selecting a weak splitting point closest to the ideal folding position information from the plurality of weak splitting points, and taking the weak splitting point as a target folding position.
In fig. 5, the weak split point is represented as: weak split point 1, … …, weak split point n. The weak splitting point n is closest to the ideal splitting position information. Therefore, the weak split point n is taken as the target folding position.
Optionally, matching the content to be folded with a preset feature, and determining a target folding position includes:
matching the content of the row to be folded with a forcible splitting character table, wherein the forcible splitting character table comprises a plurality of weak splitting point characters; when the characters of the content to be folded contain weak splitting point characters, marking the corresponding characters of the content to be folded as weak splitting points; and determining the target folding position according to the weak splitting point.
More specifically, the predetermined characteristic is a strongly-detachable character table. Characters that can be used as weak split points are collected and added to the table of strongly-split characters. And when the line typesetting ratio dWidthRatio is smaller than the preset empirical value dEXP, searching whether the content of the line to be typeset contains the weak splitting point character in the character table capable of being strongly split. When the character with the weak splitting point is contained, the character position of the content to be folded is marked as the weak splitting point. And if the target folding position contains a plurality of weak folding points, selecting the weak folding point closest to the ideal folding position information, and taking the weak folding point as the target folding position.
In fig. 5, the CanBreak attribute of Glue at the character corresponding to the current folding position information is reset to false. And setting the CanBreak attribute of Glue at the character position corresponding to the weak split point n as true, namely performing line folding after the weak split point n, namely performing loose binding on the character '0' and the character '4' at the weak split point n.
Optionally, matching the content to be folded with a preset feature to determine a target folding position, further comprising: judging the content to be typeset through a regular expression, wherein the regular expression is determined according to a plurality of contents to be typeset with poor typesetting effects; when characters meeting conditions exist in the characters of the content to be folded, marking the corresponding characters of the content to be folded as weak splitting points; and determining the target folding position according to the weak splitting point.
More specifically, the preset feature is a common feature found from a plurality of publications having poor layout effects. And when some characters of the content to be folded meet the conditions of the regular expression, marking the corresponding characters as weak splitting points. And if the target folding position contains a plurality of weak folding points, selecting the weak folding point closest to the ideal folding position information, and taking the weak folding point as the target folding position.
And extracting common characteristics according to experience and converting the common characteristics into a regular expression according to the condition of poor typesetting effect actually encountered in typesetting. Several cases are listed below:
case 1: when the characters of the content to be folded contain the characters with "&" (0x26) and the lower horizontal line "_" (0x5f), the characters following "&" and "_" are "unbound".
Fig. 6 is a layout effect diagram containing characters and "&" obtained according to the conventional parallel operation algorithm. FIG. 7 is a typesetting effect diagram containing characters and "&" obtained according to the folding position optimization method. FIG. 8 is a diagram of typesetting effect with a bottom horizontal line "_" according to the prior-art folding algorithm. FIG. 9 is a diagram of the layout effect with the bottom horizontal line "_" according to the folding position optimization method.
Case 2: when the characters of the contents to be folded contain numbers 0-9 and English letters a-zA-Z at the same time, and numbers are clamped among the English letters or between the English letters, the 'loose binding' is performed among numbers (such as 67), numbers (such as 9r) and letters (such as m 3).
FIG. 10 is a diagram of layout effects obtained according to the conventional folding algorithm, including numbers [0-9] and English letters [ a-zA-Z ] and including number | numbers. FIG. 11 is a diagram of typesetting effect including numbers [0-9] and English letters [ a-zA-Z ] and numbers | numbers obtained according to the folding position optimization method.
Case 3: when the character of the content to be folded consists of only the number and the lower horizontal line "_" (0x5f), and the number and "_" are present at the same time, "unbundling" is performed in the middle of the number | number (e.g., 67).
Fig. 12 is a diagram of the typesetting effect when the characters of the content to be folded are only composed of numbers according to the conventional folding algorithm. FIG. 13 is a layout effect diagram of the content to be folded, which is obtained by the folding position optimization method and has characters consisting of only numbers.
And S208, folding and typesetting the content to be optimized according to the target folding position.
Step S208 is similar to the step S103 in the embodiment of fig. 3, and details of this embodiment are not repeated here.
Optionally, the method for optimizing a folding position provided in this embodiment further includes: and optimizing and updating the preset empirical value and the folding optimization algorithm according to the characteristics of the content of the row to be folded.
More specifically, after the execution of the line folding optimization algorithm is finished, the features of the content to be folded are extracted. And optimizing the preset empirical value dEXP according to the characteristics of the content to be folded. And retraining and adjusting the optimization algorithm model according to the characteristics of the content of the row to be folded.
By changing the preset experience value dEXP, a preset experience value which gives consideration to both the typesetting efficiency and the typesetting effect is found, and on the basis, the optimization broken line optimization algorithm model is enriched continuously, so that the typesetting effect is better and better.
Fig. 14 is a schematic diagram of optimized typesetting content of fig. 1 according to the folding position optimization method provided by the present application. Wherein the preset empirical value dEXP of FIG. 14 is equal to 80%. As can be seen from fig. 6 to fig. 14, the folding position optimization method provided by the present application improves the typesetting effect to a great extent.
Fig. 15 is a schematic structural diagram of a folding position optimizing device according to an exemplary embodiment of the present application. As shown in fig. 15, the present application provides a folding position optimizing apparatus 40, the apparatus 40 including:
the obtaining module 41 is configured to obtain current folding position information and ideal folding position information corresponding to the content to be optimized, where the current folding position information is obtained by calculation according to an existing folding algorithm, and the ideal folding position information is determined according to the area width.
And the processing module 42 is configured to obtain a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information.
The processing module 42 is further configured to fold and typeset the content to be optimized according to the target folding position.
Specifically, the present embodiment may refer to the above method embodiments, and the principle and the technical effect are similar, which are not described again.
Fig. 16 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment of the present application. As shown in fig. 16, the electronic apparatus 50 of the present embodiment includes: a processor 51 and a memory 52; wherein the content of the first and second substances,
a memory 52, a memory for storing processor-executable instructions.
The processor 51 is configured to implement the fold location optimization method in the above embodiments according to executable instructions stored in the memory. Reference may be made in particular to the description relating to the method embodiments described above.
Alternatively, the memory 52 may be separate or integrated with the processor 51.
When the memory 52 is provided separately, the electronic device 50 further includes a bus 53 for connecting the memory 52 and the processor 51.
The present application also provides a computer readable storage medium, in which computer instructions are stored, and the computer instructions are executed by a processor to implement the methods provided by the above-mentioned various embodiments.
The computer-readable storage medium may be a computer storage medium or a communication medium. Communication media includes any medium that facilitates transfer of a computer program from one place to another. Computer storage media may be any available media that can be accessed by a general purpose or special purpose computer. For example, a computer readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the computer readable storage medium. Of course, the computer readable storage medium may also be integral to the processor. The processor and the computer-readable storage medium may reside in an Application Specific Integrated Circuit (ASIC). Additionally, the ASIC may reside in user equipment. Of course, the processor and the computer-readable storage medium may also reside as discrete components in a communication device.
The computer-readable storage medium may be implemented by any type of volatile or nonvolatile Memory device or combination thereof, such as Static Random-Access Memory (SRAM), Electrically-Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The present application also provides a computer program product comprising execution instructions stored in a computer readable storage medium. The at least one processor of the device may read the execution instructions from the computer-readable storage medium, and the execution of the execution instructions by the at least one processor causes the device to implement the methods provided by the various embodiments described above.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A folding position optimization method is characterized by comprising the following steps:
acquiring current folding position information and ideal folding position information corresponding to typesetting content to be optimized, wherein the current folding position information is obtained by calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the region width;
obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information;
and folding and typesetting the typesetting content to be optimized according to the target folding position.
2. The method of claim 1, wherein obtaining a target folding position using a folding optimization algorithm according to the current folding position information and the ideal folding position information comprises:
determining the content of the line to be folded according to the current folding position information and the ideal folding position information;
and matching the content of the line to be folded with a preset characteristic, and determining the target folding position, wherein the target folding position is the position closest to the ideal folding position information.
3. The method according to claim 2, wherein the matching the content to be folded with a preset feature to determine the target folding position comprises:
matching the content of the row to be folded with a forcible splitting character table, wherein the forcible splitting character table comprises a plurality of weak splitting point characters;
when the characters of the content to be folded contain the weak splitting point characters, marking the corresponding characters of the content to be folded as weak splitting points;
and determining the target folding position according to the weak splitting point.
4. The method according to claim 2, wherein the matching the content to be folded with a preset feature to determine the target folding position further comprises:
judging the content of the line to be typeset through a regular expression, wherein the regular expression is determined according to a plurality of contents to be typeset with poor typesetting effects;
when characters meeting conditions exist in the characters of the content to be folded, marking the corresponding characters of the content to be folded as weak splitting points;
and determining the target folding position according to the weak splitting point.
5. The method according to claim 1, wherein before the obtaining of the current folding position information and the ideal folding position information corresponding to the typeset content to be optimized, the method further comprises:
obtaining a plurality of current folding position information of the content to be typeset according to the existing folding algorithm;
calculating a plurality of actual line typesetting widths according to the plurality of current line folding position information;
calculating a plurality of line typesetting ratios according to a plurality of actual line typesetting widths of the content to be typeset and the region width, wherein the actual line typesetting widths are determined according to the current folding position information;
and if the line typesetting ratio is smaller than a preset empirical value, determining the content to be typeset corresponding to the line typesetting ratio as the content to be optimized.
6. The method according to any one of claims 3 to 5, further comprising:
and optimizing and updating the preset empirical value and the folding optimization algorithm according to the characteristics of the content to be folded.
7. A folded position optimizing device, the device comprising:
the obtaining module is used for obtaining current folding position information and ideal folding position information corresponding to the typesetting content to be optimized, the current folding position information is obtained by calculation according to the existing folding algorithm, and the ideal folding position information is determined according to the area width;
the processing module is used for obtaining a target folding position by using a folding optimization algorithm according to the current folding position information and the ideal folding position information;
the processing module is further used for folding and typesetting the typesetting content to be optimized according to the target folding position.
8. An electronic device, comprising: a memory, a processor;
a memory; a memory for storing the processor-executable instructions;
a processor for implementing the fold location optimization method of any of claims 1 to 6 in accordance with executable instructions stored by the memory.
9. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the folded position optimization method of any one of claims 1 to 6.
10. A computer program product comprising instructions which, when executed by a processor, carry out the fold location optimization method of any of claims 1 to 6.
CN202110581969.2A 2021-05-25 2021-05-25 Method, device and equipment for optimizing folding position and storage medium Pending CN113297832A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110581969.2A CN113297832A (en) 2021-05-25 2021-05-25 Method, device and equipment for optimizing folding position and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110581969.2A CN113297832A (en) 2021-05-25 2021-05-25 Method, device and equipment for optimizing folding position and storage medium

Publications (1)

Publication Number Publication Date
CN113297832A true CN113297832A (en) 2021-08-24

Family

ID=77325525

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110581969.2A Pending CN113297832A (en) 2021-05-25 2021-05-25 Method, device and equipment for optimizing folding position and storage medium

Country Status (1)

Country Link
CN (1) CN113297832A (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1920811A (en) * 2006-08-31 2007-02-28 北京北大方正电子有限公司 Character typesetting method
CN101201817A (en) * 2006-12-15 2008-06-18 北京北大方正电子有限公司 Method for layout of formula
US20130151953A1 (en) * 2011-12-09 2013-06-13 Fuji Xerox Co., Ltd. Information processing apparatus, and non-transitory computer readable medium storing information processing program
CN103488621A (en) * 2013-09-24 2014-01-01 长沙裕邦软件开发有限公司 Type setting method and system for laws and regulations
CN106445904A (en) * 2016-09-30 2017-02-22 乐视控股(北京)有限公司 Page typesetting method and device
CN108694162A (en) * 2017-04-11 2018-10-23 北大方正集团有限公司 The treating method and apparatus of file
CN110968988A (en) * 2019-12-06 2020-04-07 歌尔科技有限公司 Display processing method and device, electronic equipment and readable storage medium
CN111881656A (en) * 2020-08-11 2020-11-03 网易(杭州)网络有限公司 Text drawing method and device in card game
CN112016290A (en) * 2020-09-02 2020-12-01 湖南写邦科技有限公司 Automatic document typesetting method, device, equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1920811A (en) * 2006-08-31 2007-02-28 北京北大方正电子有限公司 Character typesetting method
CN101201817A (en) * 2006-12-15 2008-06-18 北京北大方正电子有限公司 Method for layout of formula
US20130151953A1 (en) * 2011-12-09 2013-06-13 Fuji Xerox Co., Ltd. Information processing apparatus, and non-transitory computer readable medium storing information processing program
CN103488621A (en) * 2013-09-24 2014-01-01 长沙裕邦软件开发有限公司 Type setting method and system for laws and regulations
CN106445904A (en) * 2016-09-30 2017-02-22 乐视控股(北京)有限公司 Page typesetting method and device
CN108694162A (en) * 2017-04-11 2018-10-23 北大方正集团有限公司 The treating method and apparatus of file
CN110968988A (en) * 2019-12-06 2020-04-07 歌尔科技有限公司 Display processing method and device, electronic equipment and readable storage medium
CN111881656A (en) * 2020-08-11 2020-11-03 网易(杭州)网络有限公司 Text drawing method and device in card game
CN112016290A (en) * 2020-09-02 2020-12-01 湖南写邦科技有限公司 Automatic document typesetting method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109582909B (en) Webpage automatic generation method and device, electronic equipment and storage medium
CN101770446B (en) Method and system for identifying form in layout file
CN107818075A (en) Form data structuring extracting method, electronic equipment and computer-readable recording medium
US20070136660A1 (en) Creation of semantic objects for providing logical structure to markup language representations of documents
CN109858036B (en) Method and device for dividing documents
CN110765739B (en) Method for extracting form data and chapter structure from PDF document
US20160048482A1 (en) Method for automatically partitioning an article into various chapters and sections
US10061750B2 (en) Arranging elements in a layout
CN105224540A (en) Page composing method and device
CN111797630A (en) PDF-format-paper-oriented biomedical entity identification method
FI20176151A1 (en) A heuristic method for analyzing content of an electronic document
CN100552670C (en) A kind of method of automatic discriminating digit document type page
CN116483644B (en) Log search method for chip verification test regression, electronic equipment and medium
US20080201635A1 (en) Document edit device and storage medium
CN101246475A (en) Retrieval methodology base on layout information
CN116644729A (en) Table file processing method, apparatus, computer device and storage medium
CN105488471A (en) Character pattern recognition method and device
CN114625996A (en) Webpage content paging method and device, electronic equipment and readable storage medium
CN111581939A (en) Method and device for typesetting questions, electronic equipment and storage medium
CN104794237B (en) web information processing method and device
CN113297832A (en) Method, device and equipment for optimizing folding position and storage medium
CN109977153B (en) Table big data export method
CN115880708A (en) Method for detecting character paragraph spacing compliance in APP (application) aging-adapted mode
US20140351695A1 (en) Terminal, apparatus and method for optimizing the description of text contents in a fixed-layout document
CN114359929A (en) Method, device, terminal and storage medium for translating cartoon file in JPG format

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