Digital newspaper layout generation method based on retrieval enhancement

Through the search enhancement method, using similar layout search and layout layout analysis, digital newspaper layouts that meet newspaper layout standards are generated, solving the problem of insufficient clarity and layout accuracy in the existing technology, and achieving low-cost text generation and layout intelligence.

CN120409423APending Publication Date: 2025-08-01HANGZHOU DIANZI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510508941.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

When generating pictures with text, the prior art is difficult to meet the requirements of digital newspapers for text clarity and layout accuracy, especially when dealing with complex typesetting requirements, it is difficult for existing image generation methods to generate digital newspaper layouts that meet the specifications.

Method used

Using a search enhancement method, through similar layout search and layout layout analysis, the layout layout is represented by a binary tree structure, combined with the target detection model with fine-grained annotation and the Chinese word embedding model, the layout parameters are adaptively adjusted to generate a digital newspaper layout that meets newspaper layout standards.

Benefits of technology

It realizes the accurate text generation and intelligent layout generation of low-cost text generation, solves the problems of font distortion and semantic fracture in the existing technology, and ensures the professionalism of layout design style and the intelligent optimization capabilities of content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120409423A_ABST
    Figure CN120409423A_ABST
Patent Text Reader

Abstract

The invention discloses a digital newspaper layout generation method based on retrieval enhancement. The method comprises the following steps: firstly, defining title word number, text word number, picture number, title semantics and text semantics similarity calculation, retrieving k retrieval layouts with highest scores from a newspaper database as recommended layouts, and then analyzing layout structure information contained in each layout and attribute information of each piece of news for the recommended layouts. According to the recommended layout, aiming at user input, the generated digital newspaper layout parameters including the width, height and position sequence of news blocks, the font size and line spacing of a title, transverse and longitudinal scaling factors of the title, the font size and line spacing of a text, whether the text is divided into columns or not, and the column width, column number and column spacing of the text are calculated; and finally, converting user input into a digital report of a pdf version through a latex template according to the information and the width, the height, the position and the path of the picture. And completing automatic typesetting and generation of the digital newspaper.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of data processing, relates to the layout of digital newspapers, and specifically relates to a method for generating digital newspaper layouts based on retrieval enhancement. Background Art

[0002] In the digital information age, the layout efficiency and quality of media content face double challenges. Traditional manual layout relies on designers to adjust the positions of text and pictures item by item, which is not only time-consuming and laborious but also difficult to meet the rapidly iterative dissemination requirements. Although artificial intelligence technology has promoted the development of automated layout, there are still obvious limitations when dealing with complex scenarios such as digital newspapers. For example, as an emerging image generation technology, the diffusion model performs well in generating high-quality images, but when generating pictures with text, problems such as flawed text, inconsistent fonts, and chaotic layout often occur. The fundamental reason is that the training objective of the diffusion model focuses more on the overall visual effect and lacks explicit modeling of the text structure, resulting in often distorted glyphs and semantic breaks when generating text. In addition, some other methods for generating pictures, such as technologies based on generative adversarial networks (GANs), although able to generate relatively realistic images, also have similar problems when dealing with text content. The pictures with text generated by these methods often fail to meet the requirements of digital newspapers for text clarity and layout accuracy. Digital newspaper layouts usually contain a large amount of text content, and the layout rules are complex, requiring precise control of parameters such as font, font size, line spacing, and character spacing of the text, while also considering the coordinated layout of pictures and text. Existing image generation methods often fail to achieve ideal results when dealing with these complex layout requirements and cannot meet the actual application needs of digital newspapers. Summary of the Invention

[0003] Aiming at the deficiencies of the prior art, the present invention proposes a method for generating digital newspaper layouts based on retrieval enhancement. This method can automatically retrieve a set of similar layouts as a reference for the layout structure according to the content of multiple news items to be typeset by the user, adaptively adjust the layout structure and news attributes, obtain layout parameters that can reasonably place the content of multiple news items to be typeset by the user, and thus generate a digital newspaper layout that is standardized and meets the newspaper layout standards.

[0004] A method for generating digital newspaper layouts based on retrieval enhancement specifically includes the following steps:

[0005] Step 1, Retrieval of Similar Layouts

[0006] Upload the news content to be typeset as a word document as the user input. Specify the newspaper name and layout type, and use the newspaper name, layout type, and the number of news articles in the user input as filtering conditions in the newspaper database to be retrieved. Calculate the similarity scores between the news content in the retrieved layout that meets the filtering conditions and the news content in the corresponding user input in sequence from top to bottom and from left to right, and return the top k retrieved layouts with the highest scores as the recommended layouts for reference in subsequent layout arrangements.

[0007] Define that the similarity score includes 5 feature dimensions: the number of title words, the number of body words, the number of pictures, the title semantics, and the body semantics, which are used to calculate the similarity score between each news article in the user input and the corresponding position in the retrieved layout. The similarity calculation method is as follows:

[0008] s1.1. For the similarity of the number of title words and the number of body words: Define that when the number of words is equal, the similarity is 1; when the number of words is not equal, select the ratio of the smaller value and the larger value of the number of words as the similarity.

[0009] s1.2. For the similarity of the number of pictures: Define that when the number of pictures is equal, the similarity is 1; when the number of pictures is not equal, select the ratio of the smaller value and the larger value of the number of pictures as the similarity.

[0010] s1.3. For the similarity of the title semantics and the body semantics: First, use the Chinese word embedding model to perform word embedding processing on the title and body of the news to obtain the semantic vectors of the title and the body, and then calculate the cosine similarity of the corresponding semantic vectors as the semantic similarity.

[0011] s1.4. Assign a weight coefficient to each of the 5 feature dimensions in the similarity score, perform weighted calculation on the 5 feature dimensions to obtain the similarity score between the two news articles in the retrieved layout and the corresponding position in the user input. Then assign a weight coefficient to each news article at each position, and perform weighted calculation to obtain the overall content similarity score of the retrieved layout. Return the picture URL links of the top k retrieved layouts with the highest overall content similarity scores and save them as the recommended layouts.

[0012] Step 2. Layout analysis

[0013] For the recommended layouts saved in Step 1, analyze the layout structure information and the attribute information of each news article in each layout.

[0014] S2.1. Define the layout structure representation of the layout: Use a binary tree string to model the layout structure information of the layout. Take the entire layout as the root node of the binary tree and recursively divide it from the root node to continuously split out sub-structures. Use H and V to represent the large structure division types of horizontal division and vertical division respectively. ()() represents the sub-structure under the division type, and (1) represents a non-nested structure, that is, a structure that cannot be further divided. Thus, a binary tree representing the layout structure of the layout is established, and the pre-order traversal of this binary tree is used as the layout structure representation of the layout. For a layout containing n news articles, a binary tree with 2n - 1 nodes can be generated, where n nodes are leaf nodes representing structures that cannot be further divided; n - 1 non-leaf nodes are divisible parent structures.

[0015] S2.2. Train an object detection model using a newspaper layout dataset with fine-grained annotations to obtain a news element recognition model that can identify the titles, texts, and picture elements of each news in a news layout picture, and output the category, position, width, and height information of each news element.

[0016] S2.3. According to the recognition results of the news element recognition model, group the elements belonging to the same news together to form news blocks, and output the position, width, and height information of each news block in the layout picture. The specific steps are as follows:

[0017] S2.3.1. Generate initial rectangular boxes using the size information of news elements. Set the spacing threshold between similar elements in the same news and the spacing threshold between different types of elements in the same news.

[0018] S2.3.2. Let the initial rectangular boxes of each element extend to the right and downward by the size of the spacing threshold between similar elements to obtain element growth rectangular boxes.

[0019] S2.3.3. Traverse all the growth rectangular boxes of various types of elements. If there is an overlap between different rectangular boxes, it means that the corresponding similar elements belong to the same news.

[0020] S2.3.4. Let the growth rectangular boxes of different elements extend to the right and downward by the size of the spacing threshold between different types of elements. If there is an overlap between the extended element growth rectangular boxes, it means that the corresponding different types of elements belong to the same news.

[0021] S2.3.5. Create a rectangular box that can enclose all the elements of each news, that is, obtain the news block. Record the position, width, and height information of each news block.

[0022] S2.4. To address the recognition error of the news element recognition model, a two-dimensional rectangular coordinate system is established with the upper left corner of the layout as the origin, and the upper left coordinates of each news block are recorded. Based on the position, width, and height information of the news blocks, the positional relationships between the news blocks in the layout are determined, including adjacent relationships and alignment relationships. The specific steps are as follows:

[0023] S2.4.1. Set the x - coordinate deviation threshold x th , the y - coordinate deviation threshold y th , the width deviation threshold w th , and the height deviation threshold h th .

[0024] If |x a - x b | < x th , and |w a - w b | < w th , it is considered that there is a vertical alignment relationship between news blocks a and b;

[0025] If |y a - y b | < y th , and |h a - h b | < h th , it is considered that there is a horizontal alignment relationship between news blocks a and b.

[0026] Among them, (x a , y a ), (x b , y b ) represent the upper left coordinates of news blocks a and b, w a , w b respectively represent the widths of news blocks a and b, h a , h b respectively represent the heights of news blocks a and b.

[0027] S2.4.2. Set the horizontal spacing threshold and vertical spacing threshold. If the spacing between news blocks a and b is less than the spacing threshold, it is considered that there is an adjacent relationship between news blocks a and b.

[0028] S2.5. Based on the positional relationships between the news blocks in the layout, solve the layout structure. The specific steps are as follows:

[0029] S2.5.1. Initialize the structure string of all news blocks in a layout to "1", indicating an indivisible news.

[0030] s2.5.2. Put all news blocks into a news structure list. Determine whether there are two sub-structures in the list that simultaneously satisfy the alignment and adjacency relationships. If so, create a new parent structure, initialize the position, width, and height of the parent structure to enclose the two sub-structures, and initialize the string of the parent structure to "V()()" or "H()()" according to the alignment relationship between the two sub-structures.

[0031] s2.5.3. Add the parent structure to the news structure list and delete the original two sub-structures to complete an inverse splitting process.

[0032] s2.5.4. Repeat the inverse splitting process until there is only one element left in the news structure list. The structure string of this element is the layout structure representation of the current layout.

[0033] s2.5.5. When there are both adjacency and alignment relationships among multiple sub-structures, use the backtracking method. First, perform "inverse splitting" on any two structures with adjacency and alignment relationships. If, after traversing all sub-structures, it is impossible to make the entire news structure list contain only one element, then gradually backtrack and try other combinations of "inverse splitting". If no solution can be obtained after trying all possible combinations after backtracking, return that the layout structure analysis fails.

[0034] s2.6. For the layout where the layout structure representation is successfully solved, record the relevant information of each news in the layout, including the news position order, the width and height of the news block, the font size of the title, the style of the title, and the ranking of the number of characters in the text.

[0035] Step 3. Solve the layout parameters

[0036] Use the recommended layout saved in Step 2 as a reference layout to generate a digital newspaper layout for the user input, and output the layout parameters, including the width, height, position order of the news block, the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the text, whether the text is in columns, the column width, the number of columns and column spacing of the text, and the width, height, position and path of the picture. The specific process is as follows:

[0037] s3.1. Define the news position order as the placement order of the news from top to bottom and from left to right in the layout, and represent it with an id. For a recommended layout containing n news items, the id of the news in the upper left corner is 0, and the id of the news in the lower right corner is n - 1. Allocate the initial id for each news item starting from 0 in the order of the n news items in the user input document before and after.

[0038] For the m news articles in the order specified by the user, directly use their initial IDs as the mapping IDs and establish mapping relationships with the news blocks having the same IDs in the reference layout. For the n - m news articles without a specified order, count the number of characters in the main text of the news articles and sort them in descending order. At the same time, sort the news blocks in the reference layout that have not established mapping relationships in descending order of the number of characters in the main text, and then establish mapping relationships between the remaining news articles and news blocks in the order of the number of characters in the main text, using the IDs of the news blocks as the mapping IDs of the news articles.

[0039] s3.2. Set the font size of the initial main title of the news in the user input to the font size of the main title in the mapped news block. Set the initial font sizes of the subtitle and lead title, as well as the initial distances between different text elements, to fixed values.

[0040] s3.3. According to the total width total_width of the reference layout, set the candidate list w_list of width mapping values for the news blocks. Use the width of the mapped news block as the initial width of the news in the user input.

[0041] Select the width mapping value closest to the initial width from the candidate list w_list of width mapping values as the final width of the news article, eliminating the recognition error of the width value.

[0042] s3.4. According to the style types of the news blocks in the reference layout, set the initial styles of each news article in the user input. This includes the title style, whether the main text is in columns, and the number of pictures. According to the initial styles, calculate the initial attributes of each element in the news article, including the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the main text, whether the main text is in columns, the column width, number of columns, and column spacing of the main text, and the position, width, height, and path of the pictures.

[0043] s3.5. According to the initial width of the news article and the initial attributes of each element in the news article, typeset the news article to obtain the actual height occupied by the news content, and add the set fixed white space interval for the news content as the initial height of the news article.

[0044] s3.6. According to the binary tree string representing the layout structure information, update the height values of the news articles corresponding to each node from bottom to top. When updating, the height of the child nodes determines the height of the parent structure. Then set the height of the largest parent structure as the height of the total layout, and then update the height values of each node from top to bottom. When updating, the height of the parent structure determines the height of the child nodes to ensure that there will be no situation where a news block exceeds the height range of the total layout.

[0045] If the updated height value is greater than the initial value, a "floral news" picture can be inserted into the blank space. If the updated height value is less than the initial height, select the news block with blank space and shrink it, and update the widths and heights of other news blocks through the alignment strategy so that the current news block can accommodate the news content.

[0046] S3.7: Take the lower left corner of the layout as the coordinate origin, the horizontal direction as the x-axis, and the vertical direction as the y-axis. Perform a level-order traversal on the binary tree string representing the layout structure information to obtain a list of non-leaf nodes level_order_non_leaves. Initialize the horizontal and vertical coordinates of the root node as x = 0, y = 0, and then update the position information of the nodes from top to bottom. Specifically:

[0047] Take a non-leaf node from the list level_order_non_leaves in turn and update the coordinate values of its left and right child nodes.

[0048] If the splitting type of the non-leaf node is "H", that is, horizontal splitting, set the x coordinate values of the two child nodes to be the same as the x coordinate value of the parent node. At the same time, set the y coordinate value of the lower child node to be the same as the y coordinate value of the parent node, and set the y coordinate value of the upper child node to be the y coordinate value of the parent node + the height value of the lower child node.

[0049] If the splitting type of the non-leaf node is "V", that is, vertical splitting, set the x coordinate value of the left child node to be the same as the x coordinate value of the parent node, and set the x coordinate value of the right child node to be the x coordinate value of the parent node + the width value of the left child node. At the same time, set the y coordinate values of the two child nodes to be the same as the y coordinate value of the parent node.

[0050] Step 4: According to the layout parameters determined in Step 3, typeset the news input by the user to generate a digital newspaper layout.

[0051] The present invention has the following beneficial effects:

[0052] 1. Low training cost. The present invention adopts a retrieval-enhanced technology architecture, breaking through the dependence of traditional generative methods on a large amount of labeled data. Only a small amount of fine-grained labeled data is needed to train a basic object detection model to achieve the layout analysis function. Compared with generative models such as diffusion models and generative adversarial networks that require a large number of labeled samples for training, this solution greatly reduces the model training cost, significantly saving computing power resources and data annotation costs while ensuring the realization of functions.

[0053] 2. Precise text generation. To address the inherent problems of existing generative methods, such as glyph distortion and semantic breaks, the present invention adopts a structured content injection technique. By directly injecting the original text content into a professional LaTeX typesetting template, the technical bottleneck of generative models in complex glyph rendering, especially in the stroke structure of Chinese characters, is fundamentally circumvented. The key defects of text blurring and typesetting misalignment in the prior art are completely solved.

[0054] 3. Intelligent layout generation. By integrating the layout feature retrieval of newspaper databases and adaptive parameter adjustment techniques, it not only ensures the professionalism of the layout design style but also endows the system with the dynamic adjustment ability to intelligently optimize according to the actual content, achieving the collaborative optimization of quality and efficiency. Brief Description of the Drawings

[0055] Figure 1 is the flowchart of the digital newspaper layout generation method based on retrieval enhancement;

[0056] Figure 2 is the schematic diagram of the layout structure;

[0057] Figure 3 is the schematic diagram of the news element recognition result;

[0058] Figure 4 is the schematic diagram of the fusion of similar elements;

[0059] Figure 5 is the schematic diagram of the title-body rectangle;

[0060] Figure 6 is the schematic diagram of the analysis of the layout structure of the solution;

[0061] Figure 7 is the schematic diagram of the update of the news height and width. Detailed Embodiment

[0062] The present invention will be further explained below with reference to the accompanying drawings:

[0063] As Figure 1 shown, a digital newspaper layout generation method based on retrieval enhancement specifically includes the following steps:

[0064] Step 1. Similar layout retrieval

[0065] Upload the news content to be typeset as a word document as the user input. Specify the newspaper name and layout type, and use the newspaper name, layout type, and the number of news articles in the user input as screening conditions in the newspaper database to be retrieved. Calculate the similarity scores of the news content in the retrieved layouts that meet the screening conditions with the news content in the corresponding user input in sequence from top to bottom and from left to right, and return the top k retrieved layouts with the highest scores as recommended layouts for reference in subsequent layout arrangements.

[0066] The newspaper database contains the specific content information of each news article on the page, such as the newspaper name of the page to which the news belongs, the page type, the URL link of the page picture, the news title and the text content, and the number of pictures included in the news.

[0067] The defined similarity score includes 5 feature dimensions: the number of characters in the title, the number of characters in the text, the number of pictures, the semantics of the title, and the semantics of the text, which is used to calculate the similarity score between the user input and each news article at the corresponding position on the retrieved page. The similarity calculation method is as follows:

[0068] s1.1. For the similarity of the number of characters in the title and the number of characters in the text: It is defined that when the number of characters is equal, the similarity is 1; when the number of characters is not equal, the ratio of the smaller value to the larger value of the number of characters is selected as the similarity.

[0069] s1.2. For the similarity of the number of pictures: It is defined that when the number of pictures is equal, the similarity is 1; when the number of pictures is not equal, the ratio of the smaller value to the larger value of the number of pictures is selected as the similarity.

[0070] s1.3. For the similarity of the semantics of the title and the semantics of the text: First, use the Chinese word embedding model m3e-base to perform word embedding processing on the title and text of the news to obtain the semantic vectors of the title and the text, and then calculate the cosine similarity of the corresponding semantic vectors through the Milvus vector database as the semantic similarity.

[0071] Since the number of news articles recorded in the newspaper database is extremely large, if the title and text of each news article in the newspaper database are re-word embedded every time, it will consume too much time repeatedly. Therefore, the title and text of each news article in the newspaper database can be pre-word embedded, and the semantic vectors of the title and text generated by the word embedding are stored for subsequent use. Since new news records of new pages may be added to the newspaper database every once in a while, synchronization and update are required every once in a while.

[0072] s1.4. Assign a weight coefficient to each of the 5 feature dimensions in the similarity score, and perform weighted calculation on the 5 feature dimensions to obtain the similarity score between the two news articles at the corresponding positions on the retrieved page and the user input. The default is 0.2, which can also be adjusted according to preferences.

[0073] Comprehensively considering the importance of each news item in the layout, a weight coefficient is assigned to the news at each position respectively. If it is considered that the importance of the news at each position in the layout is the same, the weights can be evenly divided and equal weight coefficients can be assigned to the news at each position; in this embodiment, it is considered that the news with a higher ranking in the layout is more important, so the weights of each news item can be assigned in a decreasing order from top to bottom and from left to right. According to the weight coefficients of each news item, the overall content similarity score of the retrieved layout is calculated by weighted calculation. The picture URL links of the top k retrieved layouts with the highest overall content similarity scores are returned and saved as the recommended layouts.

[0074] Step 2. Layout analysis of the layout

[0075] For the recommended layouts saved in Step 1, analyze the layout structure information and the attribute information of each news item included in each layout.

[0076] s2.1. Since the layout structures of news are mostly regular, the content of each news item is usually placed in a rectangular block, and there is a good alignment relationship between the rectangular blocks. Therefore, a binary tree string is used to model the layout structure information of the layout. The entire layout is used as the root node of the binary tree, and recursively from the root node, the divided sub-structures are used as the left and right child nodes of this node, continuously dividing the sub-structures, and H and V are used to represent the large structure division types of horizontal division and vertical division respectively. ()() represents the sub-structure under the division type, and (1) represents a non-nested structure, that is, a structure that cannot be further divided. Thus, a binary tree representing the layout structure of the layout is established, and the pre-order traversal of this binary tree is used as the representation of the layout structure of the layout.

[0077] As Figure 2 shown in the layout structure, the corresponding binary tree string is V(H(1)(1))(1), which means that first, a vertical division is performed to obtain two sub-structures, one on the left and one on the right. The left sub-structure is then horizontally divided to obtain two sub-structures, one on the top and one on the bottom. For a layout structure with multiple division methods, one of them can be selected for representation.

[0078] s2.2. Use a newspaper layout dataset with fine-grained annotations to train a news element recognition model based on Cascade R-CNN for outputting the category, position, and width and height information of news elements from the layout picture. The news elements include the title, text, and picture of the news.

[0079] s2.3. Since the news element recognition model will perform fine-grained recognition of the news elements in the layout picture, the elements of the same category in the same news will also be recognized as multiple small element rectangular boxes in chunks, as Figure 3As shown in the figure, for the titles placed in separate lines, each line will be recognized as a separate title element. If there are subtitles and lead-ins, each line will also be recognized as a separate title element. For the text placed in columns, each column will be recognized as a separate text element. And the recognition rectangle frames of each element are discrete and unrelated. In order to group the elements belonging to the same news article together to form news blocks, it is necessary to group the news elements from bottom to top based on the category, position, width, and height information of the recognition rectangle frames. The specific steps are as follows:

[0080] S2.3.1. Generate initial rectangle frames using the size information of news elements. For the initial rectangle frames of multiple elements of the same type belonging to the same news article, the distance between them is obviously smaller than the distance between the initial rectangle frames of elements of the same type belonging to different news articles. Therefore, a spacing threshold between elements of the same type in the same news article and a spacing threshold between elements of different types in the same news article can be set first.

[0081] S2.3.2. Let the initial rectangle frames of each element extend to the right and downward by the size of the spacing threshold between elements of the same type to obtain element growth rectangle frames. After such processing, the rectangle frames of elements of the same type belonging to the same news article will overlap with each other, while the rectangle frames of elements of the same type belonging to different news articles will not overlap. Use a large rectangle frame to enclose the growth rectangle frames of elements of the same type with a non-zero overlapping area, thus obtaining the set of large title rectangle frames title_outer_squares and the set of large text rectangle frames text_outer_squares, as Figure 4 shown.

[0082] S2.3.3. Let the growth rectangle frames of different elements extend to the right and downward by the size of the spacing threshold between elements of different types. If there is an overlap in the growth rectangle frames of the elements after extension, it means that the corresponding different types of elements belong to the same news article. Thus, group the large title rectangle frames title_outer_square and the large text rectangle frames text_outer_square that belong to the same news article one by one, and use an even larger title-text rectangle frame title_text_square to enclose them, as Figure 5 shown.

[0083] To avoid the impact of images between the main text and titles on grouping, first copy the set of large title rectangular frames title_outer_squares as title_outer_square1s. Then set the vertical spacing threshold between titles and images, and traverse all the image rectangular frames figure_square in the set of image rectangular frames figure_squares. If the position of a certain image rectangular frame figure_square is below a certain large title rectangular frame title_outer_square1 and the distance between them is less than the vertical spacing threshold between titles and images, then we can consider that the image rectangular frame figure_square and the large title rectangular frame title_outer_square1 belong to the same news article. Update the width, height, and position information of title_outer_square1 to make it enclose both the image rectangular frame figure_square and the large title rectangular frame title_outer_square1 at the same time. After that, use the updated large title rectangular frame to participate in grouping.

[0084] S2.3.4. Create a set of news rectangular frames news_squares and put the title-text rectangular frame title_text_square obtained in S2.3.3 into it. Combine each image rectangular frame figure_square with the title-text rectangular frame title_text_square in turn, and create a judgment news rectangular frame try_square to enclose the combined image rectangular frame figure_square and title-text rectangular frame title_text_square. If there is no overlap between the created news rectangular frame try_square and other title-text rectangular frames except those within the frame, it means that the combination of the current image rectangular frame figure_square and the title-text rectangular frame title_text_square is correct. Take the current news rectangular frame try_square as a news block and record the position and width-height information. Otherwise, continue to find other combinations until all image rectangular frames are assigned to the corresponding news rectangular frames.

[0085] S2.4. To solve the recognition error of the news element recognition model, establish a two-dimensional rectangular coordinate system with the upper left corner of the layout as the origin, record the upper left corner coordinates of each news block, and judge the positional relationship between each news block in the layout according to the position and width-height information of the news block, including adjacent relationship and alignment relationship. The specific steps are as follows:

[0086] S2.4.1. Set the x-coordinate deviation threshold x th and the y-coordinate deviation threshold y th and the width deviation threshold wth and the height deviation threshold h th .

[0087] If |x a - x b | < x th , and |w a - w b | < w th , it is considered that there is a vertical alignment relationship between news blocks a and b;

[0088] If |y a - y b | < y th , and |h a - h b | < h th , it is considered that there is a horizontal alignment relationship between news blocks a and b.

[0089] Among them, (x a , y a ), (x b , y b ) represent the upper left coordinates of news blocks a and b, w a , w b respectively represent the widths of news blocks a and b, and h a , h b respectively represent the heights of news blocks a and b.

[0090] S2.4.2. Set the horizontal spacing threshold and the vertical spacing threshold. If the spacing between news blocks a and b is less than the spacing threshold, it is considered that there is an adjacent relationship between news blocks a and b.

[0091] S2.5. According to the positional relationship between news blocks in the layout, perform the "inverse segmentation" operation from bottom to top to solve the layout structure of the layout. The specific steps are as follows:

[0092] S2.5.1. As Figure 6 shown, there are 5 news blocks in this layout. First, set the initial value of the structure string of all news blocks in a layout to "1", indicating an indivisible news.

[0093] s2.5.2. Put all news blocks into a news structure list. Check if there are two sub - structures in the list that simultaneously satisfy the alignment and adjacency relationships. If so, create a new parent structure, initialize the position, width, and height of this parent structure so that it encloses the two sub - structures, and initialize the string of this parent structure as "V()()" or "H()()" according to the alignment relationship between the two sub - structures. News 2 and News 3 are adjacent and have a vertical alignment relationship, that is, it can be considered that News 2 and News 3 are two sub - structures obtained by horizontal splitting of a larger parent structure A. Therefore, create a new parent structure A, initialize its position, width, and height so that it can just enclose the two sub - structures of News 2 and News 3, and set the initial value of its structure string as "H(1)(1)".

[0094] s2.5.3. Add the newly created parent structure A to the list, and delete the two sub - structures of News 2 and News 3 from the list, that is, complete an inverse splitting process.

[0095] s2.5.4. There are still 3 structures in the current list, namely News 1, News 4, and the parent structure A. Among them, the parent structure A and News 4 are adjacent and have a horizontal alignment relationship. Therefore, create a new parent structure B, initialize its position, width, and height so that it can just enclose the two sub - structures of the parent structure A and News 4, and set the initial value of its structure string as "V(H(1)(1))(1)". Then add the newly created parent structure B to the list, and delete the two sub - structures of the parent structure A and News 4 from the list.

[0096] s2.5.5. There are still News 1 and the parent structure B in the current list, and News 1 and the parent structure B are adjacent and have a vertical alignment relationship. Then create a new parent structure C, initialize its position, width, and height so that it can just enclose the two sub - structures of News 1 and the parent structure B, and set the initial value of its structure string as "H(1)(V(H(1)(1))(1))". Then add the newly created parent structure C to the list, and delete the two sub - structures of News 1 and the parent structure B from the list. At this time, there is only one element left in the news structure list. Therefore, use the structure string of the parent structure C as the layout structure representation of the current layout, that is, "H(1)(V(H(1)(1))(1))".

[0097] s2.5.6. When there are both adjacent relationships and alignment relationships among multiple sub - structures, use the backtracking method. First, perform "inverse splitting" on any two structures with adjacent relationships and alignment relationships. If, after traversing all sub - structures, it is impossible to make there be only one element left in the entire news structure list, then gradually backtrack and try other combinations of "inverse splitting". If, after backtracking, all possible attempts still cannot obtain a solution, then return that the layout structure analysis fails.

[0098] S2.6. For the layout structure of the successfully solved layout, record the relevant information of each news item in the layout, including the news position sequence, the width and height of the news block, the font size of the title, the style of the title, and the ranking of the number of characters in the text:

[0099] S2.6.1. The news position sequence is represented by an id. The news with id 0 is closest to the upper left corner of the layout, and the news with id n - 1 is closest to the lower right corner. Assign an id to each news block according to the order of the news blocks in the layout structure representation string of the layout.

[0100] S2.6.2. Use the width and height of the news rectangle try_square in S2.3.4 as the width and height of the news block.

[0101] S2.6.3. Take the maximum pixel value of a single character in the big title rectangle as the font size of the title.

[0102] S2.6.4. The title style is obtained through the aspect ratio of the title rectangle. When the aspect ratio is greater than 1, record the title style as horizontal, otherwise as vertical.

[0103] S2.6.5. Use the sum of the areas of the text rectangles in the news block to represent the number of characters in the text. Consider the news block with the largest sum of the areas of the text rectangles as having the largest number of characters in the text, and sort the number of characters in the text of each news block in turn.

[0104] Step 3. Solve the layout parameters

[0105] Use the recommended layout saved in Step 2 as the reference layout, generate a digital newspaper layout for the user input, output the layout parameters, and use the latex template to output the pdf version of the digital newspaper. The specific steps are as follows:

[0106] Generally speaking, the user is expected to place the news in the layout from top to bottom and from left to right in the order of the news in the user input. Therefore, first assign an initial id to each news item starting from 0 in the order of the n news items in the user input document.

[0107] In some cases, the user may specify the positions of m news items. At this time, use the initial id of the news items at the specified positions by the user as the mapping id, and establish a mapping relationship with the news blocks with the same id in the reference layout.

[0108] For n - m news articles without a specified order, adjust them based on the content volume. Specifically, count the number of characters in the main text of the news articles and sort them from high to low. At the same time, sort the news blocks in the reference layout that have no mapping relationship according to the number of characters in the main text from high to low. Then, establish a mapping relationship between the remaining news articles and news blocks in the order of the number of characters in the main text, and use the id of the news block as the mapping id of the news article.

[0109] S3.2. Set the initial font size of the main title of the news article in the user input to the font size of the main title in the mapped news block. Set the initial font sizes of the subtitle and lead title to 21pt. Set the line spacing of the title to 0pt. For a title that is processed in multiple lines, set its line spacing to the font size of the title + 1pt.

[0110] Set the spacing between the main title and subtitle, between the main title and lead title, and between the main title and the main text to 5mm.

[0111] S3.3. According to the total width total_width of the reference layout, set the candidate list w_list of width mapping values for the news block as w_list = [total_width, 0.75 * total_width, 0.618 * total_width, 0.5 * total_width, 0.382 * total_width, 0.25 * total_width]. Compare the actual width of the news block with the values in the candidate list w_list, and select the mapping value with the smallest difference as the width of the news block, so as to eliminate the recognition error of the width value. Then use the width of the mapped news block as the width of the news article in the user input.

[0112] S3.4. Use the comprehensive description of the title style, whether the main text is in columns, and the number of pictures as the style type of the news article, such as horizontal title - columnar main text - no picture, horizontal title - columnar main text - single picture, horizontal title - columnar main text - multiple pictures; horizontal title - non - columnar main text - no picture, horizontal title - non - columnar main text - single picture, horizontal title - non - columnar main text - multiple pictures; vertical title - non - columnar main text - no picture, vertical title - non - columnar main text - single picture, vertical title - non - columnar main text - multiple pictures, etc. Write a corresponding latex template for each news style, and reserve interfaces in the template that can dynamically pass in parameters, including the width, height, and position of the news block, the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the main text, whether the main text is in columns, the column width, number of columns, and column spacing of the main text, and the position, width, height, and path of the picture.

[0113] According to the style type of news blocks in the reference layout and combining with the news content, set the initial styles of each news in the user input, and then calculate the initial attributes of each element in the news, including the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the body text, whether the body text is in columns, the column width, number of columns, and column spacing of the body text, and the position, width, height, and path of the picture:

[0114] s3.4.1. The font size and line spacing of the title are set according to s3.2.

[0115] s3.4.2. For the number of lines of a horizontally arranged title, first divide the width of the news block by the width of a single character in the title to obtain the maximum number of characters in a single-line title. Then convert the font size of the title from point units to millimeter units to obtain the width of a single character in the title. Next, compare the number of characters in the title with the maximum number of characters in a single-line title. If the number of characters in the title is not greater than the maximum number of characters in a single-line title, it means that one line is sufficient to accommodate all the text of the title, and set the number of lines of the title to 1; otherwise, it means that one line cannot hold all the text of the title, set the number of lines to 2, and title line-breaking processing is required.

[0116] If there are spaces in the news title in the submitted word, it indicates user-defined line breaks. Directly perform title line breaks according to the spaces, and let the upper and lower lines of the title be the content before and after the spaces respectively; if there are no spaces, first perform word segmentation, cut the title into individual words, and then splice these words in sequence until the total number of these words is greater than or equal to half of the total number of characters in the title. Stop splicing, and the splicing result is the content of the first line of the title, and all the remaining content is spliced together as the content of the second line of the title. In particular, if the title contains double quotes, it is necessary to ensure that the paired double quotes are in the same line of the title, and the number of characters in the first line of the title is not less than the number of characters in the second line of the title.

[0117] For vertically arranged titles, line breaks are usually not performed.

[0118] s3.4.3. The default values of the horizontal and vertical scaling factors of the title are both 1. If the title still exceeds the width and height range of the news block after line-breaking processing, then it needs to be reset:

[0119] Horizontal scaling factor = actual width of news content / width of title

[0120] Vertical scaling factor = actual height of news content / height of title

[0121] Among them, the actual width or height of the news content is obtained by subtracting the blank space between the news block and the news content boundary from the width or height of the news block. The blank space is a fixed value of 5mm.

[0122] s3.4.4. The font size of the main text and the line spacing are set to 9pt and 10pt respectively.

[0123] When the number of words in the news main text exceeds a certain value and the width of the news block is greater than a certain multiple of the total width of the layout, the main text is typeset in columns to reduce the reading pressure.

[0124] Set the column spacing of the main text to a fixed value of 5mm; the initial column width is 50mm. Divide the width of the news block by the column width and round down the result to obtain the number of columns for the main text typesetting. Then, according to ((width of the news block - blank space) - number of column spacings * (number of columns - 1)) / number of columns, the updated column width is obtained.

[0125] s3.4.5. If there is only one picture in the news and the number of words in the news main text is relatively large, the picture can be embedded in the main text, such as at the top-middle position or any other position in the main text. Set the picture width according to the multiple of the main text column width and column spacing. If the number of words in the main text is relatively small, the picture can be placed below or above the main text, and the width of the picture is set to the width of the main text; if the number of words in the main text is extremely small, the title and the main text can be placed in a small block, and the picture is placed on the left or right side of it, using the picture to fill the remaining area in the news block.

[0126] If there are multiple pictures in the news, each picture can be placed continuously or separately at any position in the news.

[0127] Record the storage path of the picture, and in latex, find the picture according to the picture path and render it into the layout.

[0128] s3.5. Fill the initial width of the news and the initial attributes of each element in the news into the preset latex template for news typesetting. In the latex template, use the \usepackage[user,savepos]{zref} instruction to load the macro package for precise positioning in latex. Then, use the \zsaveposy command in the latex template to save the y coordinates of the starting position and the ending position of the news content. The difference between these two y coordinates is the actual height occupied by the news content. Add the set fixed blank space of 5mm for the news content as the initial height of the news.

[0129] s3.6. When calculating the initial height of the news, the alignment relationship between news blocks is not considered. Therefore, it is also necessary to perform alignment processing on the height values according to the alignment relationship between each news block. According to the binary tree string representing the layout structure information, update the height values of the news corresponding to each node from bottom to top. Specifically:

[0130] S3.6.1. Perform a level-order traversal of the binary tree. Add non-leaf nodes to the list level_order_non_leaves in order. Then generate the reverse list of level_order_non_leaves. Take an element from this reverse list in turn and update the height values of non-leaf nodes and their child nodes from bottom to top: If the non-leaf node is a vertical split, set the height values of this non-leaf node and its two child nodes to the maximum height among the two child nodes; If the non-leaf node is a horizontal split, set the height value of this non-leaf node to the sum of the height values of the two child nodes, and the height values of the child nodes remain unchanged.

[0131] S3.6.2. Set the height value of the first node in the level_order_non_leaves list, which represents the root node of the entire layout, to the total height of the layout. Then take an element from the level_order_non_leaves list in turn and update the height values of non-leaf nodes and their child nodes from top to bottom: If the non-leaf node is a vertical split, set the height values of both child nodes to the height value of the parent node; If the non-leaf node is a horizontal split, since the priority of news is usually more important the higher up, do not change the height value of the upper child node, and set the height value of the lower child node to the height value of the parent node minus the height value of the upper child node.

[0132] If the updated height value is greater than the initial value, a "newspaper flower" picture can be inserted in the blank space.

[0133] If the updated height value is less than the initial height, first find the news block node smallspace_node where the news content overflows and a news block node bigspace_node with the most internal blank space currently. Then find the nearest common ancestor node lca_node of these two news block nodes. If the split type of lca_node is a horizontal split, it means that smallspace_node and bigspace_node are in two large structures, one above the other. Therefore, the height of bigspace_node can be reduced by the sum of the height required for its news content and the fixed blank spaces at the upper and lower boundaries. Then, through the height alignment strategy, increase the height of smallspace_node and update the heights of other news blocks to ensure that the alignment relationship remains unchanged.

[0134] If the splitting type of the lca_node is vertical splitting, it indicates that the smallspace_node and the bigspace_node are respectively in two large structures, one on the left and the other on the right. Set the width adjustment candidate value list w1_list. Each time, find the maximum value in w1_list that is smaller than the current width value of the bigspace_node as the width update value of the bigspace_node, and update the widths of other news blocks according to the alignment relationship based on the width update value of the bigspace_node to ensure that the alignment relationship remains unchanged. The method for updating the widths of other news blocks is as follows:

[0135] As Figure 7 shown, first use the reverse list of the non-leaf node list level_order_non_leaves obtained by level-order traversal of the binary tree to update the width values of non-leaf nodes and their child nodes from bottom to top. If the non-leaf node is vertically split, set the width value of the non-leaf node to the sum of the width values of the two child nodes, and the width values of the child nodes remain unchanged; if the non-leaf node is horizontally split, set the width values of the non-leaf node and its two child nodes to the minimum width value among the two child nodes.

[0136] Then set the width value of the first node in the level_order_non_leaves list to the total width of the layout, and then sequentially take out an element from the level_order_non_leaves list to update the width values of non-leaf nodes and their child nodes from top to bottom. If the non-leaf node is vertically split, do not change the width value of the left child node, and set the width value of the right child node to the width value of the parent node minus the width value of the left child node. If the non-leaf node is horizontally split, set the width values of the two child nodes to the width value of the parent node.

[0137] s3.7. Update the position information of the nodes from top to bottom using the non-leaf node list level_order_non_leaves obtained by level-order traversal of the binary tree. Initialize the horizontal and vertical coordinates of the root node as x = 0 and y = 0, and sequentially take out a non-leaf node from the list level_order_non_leaves to update the coordinate values of its left and right child nodes.

[0138] If the non-leaf node is horizontally split, set the x coordinate values of the two child nodes to the same as the x coordinate value of the parent node. At the same time, set the y coordinate value of the lower child node to the y coordinate value of the parent node, and set the y coordinate value of the upper child node to the y coordinate value of the parent node + the height value of the lower child node.

[0139] If the non - leaf node is a vertical split, set the x - coordinate value of the left child node to be the same as the x - coordinate value of the parent node, and set the x - coordinate value of the right child node to be the x - coordinate value of the parent node plus the width value of the left child node. At the same time, set the y - coordinate values of both child nodes to be the same as the y - coordinate value of the parent node.

[0140] Step 4: According to the layout parameters determined in Step 3, design a LaTeX template for a layout, embed the LaTeX templates of each news in the form of strings into the LaTeX template of the layout, typeset the news input by the user, and generate a PDF version of the digital newspaper layout.

Claims

1. A method for generating a digital newspaper layout based on retrieval enhancement, characterized in that: Specifically, it includes the following steps: Step 1, Similar layout retrieval Upload the news content to be typeset in a word document as the user input; specify the newspaper name and layout type, and use the newspaper name, layout type, and the number of news articles in the user input as the screening conditions in the newspaper database to be retrieved. Calculate the similarity scores between the news content in the retrieved layouts that meet the screening conditions and the news content in the corresponding user input in order from top to bottom and from left to right, and return the top k retrieved layouts with the highest scores as the recommended layouts; the similarity scores include 5 feature dimensions: the number of title characters, the number of body characters, the number of pictures, the title semantics, and the body semantics. Step 2, Layout analysis For the recommended layouts saved in Step 1, analyze the layout structure information contained in each layout and the attribute information of each news article. s2.1, Use a binary tree string to model the layout structure information of the layout. Take the entire layout as the root node of the binary tree, and use H and V to represent the large structure division types of horizontal division and vertical division respectively; ()() represents the sub-structures under the division type, and (1) represents the structure that cannot be further divided; thus, a binary tree representing the layout structure of the layout is established, and the pre-order traversal of this binary tree is used as the representation of the layout structure. s2.2, Train an object detection model based on a deep neural network to identify the titles, bodies, and picture elements of each news in the news layout picture, and output the category, position, width, and height information of each news element. s2.3, According to the recognition results of the news element recognition model, group the elements belonging to the same news article together to form news blocks, and output the position, width, and height information of each news block in the layout picture. s2.4, According to the position, width, and height information of the news blocks, judge the position relationship between each news block in the layout, including adjacent relationship and alignment relationship. s2.5, According to the position relationship between each news block in the layout, solve the layout structure of the layout, and record the relevant information of each news article in the layout, including the news position order, the width and height of the news block, the font size of the title, the style of the title, and the ranking of the number of body characters. Step 3, Solve layout parameters Use the recommended layouts saved in Step 2 as the reference layouts to generate a digital newspaper layout for the user input, and output the layout parameters, including the width, height, position order of the news blocks, the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the body, whether the body is in columns, the column width, the number of columns and column spacing of the body, and the width, height, position, and path of the picture. Step 4, Generate digital newspaper layout According to the layout parameters determined in Step 3, typeset the news input by the user to generate a digital newspaper layout.

2. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 1, wherein: The calculation method of the similarity score is as follows: s1.1, For the similarity of the number of title characters and the number of body characters: Define that when the number of characters is equal, the similarity is 1; when the number of characters is not equal, select the ratio of the smaller value and the larger value of the number of characters as the similarity. s1.

2. For the similarity of the number of pictures: Define that when the number of pictures is equal, the similarity is 1; when the number of pictures is not equal, select the ratio of the smaller value to the larger value of the number of pictures as the similarity; s1.

3. For the similarity of the title semantics and the text semantics: First, use the Chinese word embedding model to perform word embedding processing on the title and text of the news to obtain the semantic vectors of the title and text, and then calculate the cosine similarity of the corresponding semantic vectors as the semantic similarity; s1.

4. Assign a weight coefficient to each of the 5 feature dimensions in the similarity score, perform weighted calculation on the 5 feature dimensions to obtain the similarity score between the retrieved layout and the two news at the corresponding positions in the user input; then assign a weight coefficient to the news at each position respectively, and perform weighted calculation to obtain the overall content similarity score of the retrieved layout; Return the top k retrieved layouts with the highest overall content similarity scores and save them as the recommended layouts.

3. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 1, wherein: The target detection model is the Cascade R-CNN model trained based on the newspaper layout dataset with fine-grained annotations.

4. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 1, wherein: The specific steps to form news blocks are as follows: s2.3.

1. Generate initial rectangular boxes using the size information of news elements; set the spacing threshold between similar elements in the same news, and the spacing threshold between different types of elements in the same news; s2.3.

2. Let the initial rectangular box of each element extend to the right and downward by the size of the spacing threshold between similar elements to obtain the element growth rectangular box; s2.3.

3. Traverse all the growth rectangular boxes of various types of elements. If there is an overlap between different rectangular boxes, it means that the corresponding similar elements belong to the same news; s2.3.

4. Let the growth rectangular boxes of different elements extend to the right and downward by the size of the spacing threshold between different types of elements. If there is an overlap between the derived element growth rectangular boxes, it means that the corresponding different elements belong to the same news; s2.3.

5. Create a rectangular box for each news that can enclose all its elements, that is, obtain the news block; record the position, width, and height information of each news block.

5. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 1, wherein: The method for judging the relative position relationship between news blocks is as follows: s2.4.

1. Take the upper left corner of the layout as the origin, establish a two-dimensional rectangular coordinate system, and record the upper left corner coordinates of each news block, s2.4.2, Set the x - coordinate deviation threshold x th , the y - coordinate deviation threshold y th , the width deviation threshold w th and the height deviation threshold h th ; If |x a -x b | < x th , and |w a -w b | < w th , then it is considered that there is a vertical alignment relationship between news blocks a and b; If |y a -y b | < y th , and |h a -h b | < h th , then it is considered that there is a horizontal alignment relationship between news blocks a and b; Among them, (x a , y a ), (x b , y b ) represent the upper left coordinates of news blocks a and b, w a , w b respectively represent the widths of news blocks a and b, h a , h b respectively represent the heights of news blocks a and b; s2.4.

3. Set the horizontal spacing threshold and the vertical spacing threshold. If the spacing between news blocks a and b is less than the spacing threshold, it is considered that there is an adjacent relationship between news blocks a and b.

6. The method for generating a digital newspaper layout based on retrieval enhancement as claimed in claim 1 or 5, characterized in that: The specific steps to solve the layout structure of the layout are as follows: s2.5.

1. Initialize the structure string value of all news blocks in a layout to "1", indicating an indivisible news; s2.5.

2. Put all news blocks into a news structure list, and judge whether there are two sub-structures that simultaneously satisfy the alignment and adjacent relationships. If satisfied, create a new parent structure, initialize the position and width and height of the parent structure so that it encloses the two sub-structures, and initialize the string of the parent structure to "V()()" or "H()()" according to the alignment relationship of the two sub-structures; s2.5.

3. Add the parent structure to the news structure list, and delete the original two sub-structures to complete an inverse splitting process; s2.5.

4. Repeat the inverse splitting process until there is only one element left in the news structure list, and the structure string of this element is the layout structure representation of the current layout; s2.5.

5. When there are both adjacent relationships and alignment relationships among multiple sub-structures, use the backtracking method. First, perform "inverse splitting" on any two structures with adjacent relationships and alignment relationships. If after traversing all sub-structures, it is impossible to make there be only one element left in the entire news structure list, then gradually backtrack and try other combinations of "inverse splitting". If after backtracking, all possible combinations have been tried and still no solution can be obtained, then return that the layout structure analysis fails.

7. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 1, wherein: The specific process of solving the layout parameters is as follows: s3.

1. Define the news position order as the placement order of news from top to bottom and from left to right in the layout, and use id to represent it; for a recommended layout containing n news items, the id of the news in the upper left corner is 0, and the id of the news in the lower right corner is n - 1; according to the front-to-back order of the n news items in the user input document, starting from 0, incrementally assign the initial id to each news item, and establish a mapping relationship with the news block with the same id; s3.

2. Set the initial font size of the main title of the news in the user input to the font size of the main title in the mapped news block; set the initial font sizes of the subtitle and lead title and the initial distances between different text elements to fixed values; s3.

3. According to the total width total_width of the reference layout, set the candidate list w_list of width mapping values for the news block; use the width of the mapped news block as the initial width of the news in the user input; Select the width mapping value closest to the initial width from the candidate list w_list of width mapping values as the final width of this news; s3.

4. According to the style type of the news block in the reference layout, set the initial styles of each news in the user input; including the title style, whether the text is in columns and the number of pictures; according to the initial style, calculate the initial attributes of each element in the news, including the font size and line spacing of the title, the horizontal and vertical scaling factors of the title, the font size and line spacing of the text, whether the text is in columns, the column width, number of columns and column spacing of the text, and the position, width, height and path of the pictures; s3.

5. According to the initial width of the news and the initial attributes of each element in the news, typeset the news to obtain the actual height occupied by the news content, and add the set fixed white space interval for the news content as the initial height of the news; s3.

6. According to the binary tree string representing the layout structure information, update the height values of the news corresponding to each node from bottom to top. When updating, the height of the parent structure is determined by the height of the child nodes; then set the height of the largest parent structure as the height of the total layout, and then update the height values of each node from top to bottom. When updating, the height of the child nodes is determined by the height of the parent structure to ensure that there will be no situation where the news block exceeds the height range of the total layout; S3.7: Use the lower left corner of the layout as the coordinate origin, the horizontal direction as the x-axis, and the vertical direction as the y-axis. Perform a level-order traversal on the binary tree string representing the layout structure information to obtain a list of non-leaf nodes level_order_non_leaves. Initialize the horizontal and vertical coordinates of the root node as x = 0 and y = 0, and then update the position information of the nodes from top to bottom.

8. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 7, wherein: For the m news articles in the order specified by the user, directly use their initial IDs as the mapping IDs and establish mapping relationships with the news blocks with the same IDs in the reference layout. For the n - m news articles without a specified order, count the number of positive words in the news and sort them from high to low. At the same time, sort the news blocks in the reference layout that have not established mapping relationships from high to low according to the number of positive words, and then establish mapping relationships between the remaining news and news blocks in the order of the number of positive words, using the IDs of the news blocks as the mapping IDs of the news.

9. The method for generating a digital newspaper layout based on retrieval enhancement according to claim 7, wherein: The method for updating the node position information is as follows: Successively take out a non-leaf node from the list level_order_non_leaves and update the coordinate values of its left and right child nodes. If the splitting type of the non-leaf node is "H", i.e., horizontal splitting, set the x coordinate values of the two child nodes to be the same as the x coordinate value of the parent node. At the same time, set the y coordinate value of the lower child node to be the same as the y coordinate value of the parent node, and set the y coordinate value of the upper child node to be the y coordinate value of the parent node + the height value of the lower child node. If the splitting type of the non-leaf node is "V", i.e., vertical splitting, set the x coordinate value of the left child node to be the same as the x coordinate value of the parent node, and set the x coordinate value of the right child node to be the x coordinate value of the parent node + the width value of the left child node. At the same time, set the y coordinate values of both child nodes to be the same as the y coordinate value of the parent node.