Content typesetting method and device based on reference document, equipment and medium
By performing semantic analysis on multiple target original contents and newly added contents in the uploaded document and determining the keywords associated with the newly added contents, the problems of cumbersome and inflexible typesetting steps in the existing technology are solved, automatic content typesetting is achieved, and the process of adding new content is simplified.
Patent Information
- Application Number
- CN202510547110.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-09-19
AI Technical Summary
In the prior art, the steps for typesetting the content of an uploaded document are cumbersome and inflexible, especially when there are new elements in the uploaded document, it is impossible to automatically typeset based on an existing template.
By performing semantic analysis on multiple target original contents and newly added contents in the document to be uploaded, the target first keyword associated with the second keyword of the newly added content is determined, and the newly added content is added to the original typesetting results based on the typesetting results of the original content and the association relationship between the keywords, the typesetting steps of the content of the document to be uploaded are simplified and the flexibility of content typesetting is improved.
It realizes automatic typesetting of new content in uploaded documents without adjusting reference documents, simplifies typesetting steps, and improves the flexibility and accuracy of content typesetting.
Smart Images

Figure CN120671635A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a content typesetting method, device, equipment and medium based on a reference document. Background Art
[0002] Content layout refers to the process of creating a structured layout and style for elements such as text, images, tables, and formulas within documents uploaded to publishing platforms. Content layout ensures that documents are legible, aesthetically pleasing, and consistently formatted. To improve document upload efficiency, efficiently and accurately arranging elements within uploaded documents according to their layout order and formatting requirements has become a hot research topic.
[0003] In the existing technology, the content layout method for uploaded documents is mainly to generate a static reference template for the layout of the document to be uploaded based on the elements in the document to be uploaded and the received document layout requirements, and then map the corresponding content of the elements in the document to be uploaded to the corresponding positions in the template according to the element positions in the static reference template to obtain the final layout result of the document to be uploaded.
[0004] However, the existing technology requires generating different static reference templates for documents to be uploaded containing different elements. When there are new elements in the document to be uploaded, it is impossible to automatically layout the document content based on the existing template. There are problems such as cumbersome steps for layout of uploaded document content and insufficient flexibility in layout method. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a content typeset method, apparatus, device and medium based on a reference document, which solves the problems in the prior art of cumbersome content typeset steps for uploaded documents and inflexible typesetting methods. By semantically analyzing multiple target original contents and newly added contents in the uploaded document, determining the target first keyword associated with the second keyword of the newly added content, and adding the newly added content to the original typesetting result based on the typesetting result of the original content and the association between the keywords, the purpose of automatically typeset the newly added content in the uploaded document content can be achieved without adjusting the reference document, thereby simplifying the steps of content typesetting of the document to be uploaded and improving the flexibility of content typesetting.
[0006] In a first aspect, an embodiment of the present application provides a content layout method based on a reference document, the method comprising:
[0007] When there is a newly added element in the document to be uploaded, obtaining multiple original contents in the document to be uploaded and the newly added content corresponding to the newly added element, calculating the similarity between the newly added content and each original content, and determining multiple target original contents whose similarity is greater than a preset similarity threshold among the multiple original contents;
[0008] Performing semantic analysis on the multiple target original contents and the newly added contents to obtain a first keyword in each target original content and a second keyword in the newly added contents, and determining a target first keyword associated with the second keyword;
[0009] Obtain the layout information of the reference document, perform original layout on multiple original contents based on the layout information, add new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword, and obtain the final layout result of the document to be uploaded.
[0010] Optionally, determining a target first keyword associated with the second keyword includes:
[0011] Acquire a first content keyword and a first logical keyword from the first keyword, and a second content keyword and a second logical keyword from the second keyword;
[0012] determining a target first logical keyword that matches the second logical keyword among the first logical keywords, and determining a target first content keyword that corresponds to the target first logical keyword among the first content keywords;
[0013] A logical consistency check is performed on the target first content keyword and the second content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and the target first keyword associated with the second keyword is determined based on a result of the logical consistency check.
[0014] Optionally, performing a logical consistency check on the target first content keyword and the second content keyword based on a matching relationship between the second logical keyword and the target first logical keyword includes:
[0015] Determining a target semantic attribute range of the target first content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and identifying an actual semantic attribute of the target first content keyword;
[0016] It is determined whether the actual semantic attribute belongs to the target semantic attribute range. If the actual semantic attribute belongs to the target semantic attribute range, it is determined that the target first content keyword is logically consistent with the second content keyword.
[0017] Optionally, the original typesetting result includes the typesetting position and typesetting format of each original content;
[0018] Based on the original layout results and the association between the second keyword and the target first keyword, new content is added to the original layout results, including:
[0019] Determine the associated typesetting order among the multiple original contents based on the typesetting positions, determine the associated format features among the multiple original contents based on the typesetting formats, and determine the target typesetting position and target typesetting format of the newly added content based on the associated typesetting order, the associated format features, and the association between the second keyword and the target first keyword;
[0020] The new content is added to the original layout result based on the target layout position and the target layout format.
[0021] Optionally, determining a target typesetting position and a target typesetting format of the newly added content based on the associated typesetting order, the associated formatting features, and the association between the second keyword and the target first keyword includes:
[0022] Determining a logical hierarchical relationship between the newly added content and the target original content corresponding to the target first keyword based on the association relationship between the second keyword and the target first keyword;
[0023] Determine the target layout position of the new content based on the associated layout order and logical hierarchical relationship;
[0024] Based on the associated format features, the typesetting format change rules of multiple original contents are determined, and based on the typesetting format change rules and logical hierarchical relationships, the target typesetting format of the newly added content is determined.
[0025] Optionally, the number of new content added is multiple;
[0026] Determine the target layout position of the new content based on the associated layout order and logical hierarchical relationship, including:
[0027] Determine the layout range of multiple newly added contents based on the associated layout order and logical hierarchical relationship;
[0028] The correlation degree among the multiple new contents is determined based on the second keyword in each new content, and the multiple new contents are sorted in the typesetting range according to the size of the correlation degree to obtain the target typesetting position of each new content.
[0029] Optionally, after obtaining the final typesetting result of the document to be uploaded, the method further includes:
[0030] Identify the actual image format and text style in the final typesetting results;
[0031] Obtain the configuration parameters of the target upload interface for the document to be uploaded, and determine the target image format and target text style of the newly added content based on the configuration parameters;
[0032] The actual image format and the actual text style are adjusted based on the target image format and the target text style to obtain the target upload format of the document to be uploaded, and the document to be uploaded is uploaded according to the target upload format.
[0033] In a second aspect, an embodiment of the present application provides a content layout device based on a reference document, the device comprising:
[0034] a target content determination module for, when a new element type exists in the document to be uploaded, obtaining new content corresponding to the new element type and a plurality of original contents in the document to be uploaded, calculating a similarity between the new content and each original content, and determining a plurality of target original contents whose similarities are greater than a preset similarity threshold;
[0035] a reference content determination module, configured to perform semantic analysis on a plurality of target original contents and newly added contents, obtain a first keyword in each target original content and a second keyword in the newly added contents, and determine a target first keyword associated with the second keyword;
[0036] The content layout module is used to obtain the layout information of the reference document, perform original layout on multiple original contents based on the layout information, add new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword, and obtain the final layout result of the document to be uploaded.
[0037] In a third aspect, an embodiment of the present application provides an electronic device comprising a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0038] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0039] In the fifth aspect, an embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device performs the method described in the first aspect.
[0040] In an embodiment of the present application, when there are new elements in the document to be uploaded, multiple original contents in the document to be uploaded and the new contents corresponding to the new elements are obtained, the similarity between the new contents and each original content is calculated, and multiple target original contents whose similarity is greater than a preset similarity threshold are determined in the multiple original contents; semantic analysis is performed on the multiple target original contents and the new contents to obtain the first keyword in each target original content and the second keyword in the new content, and the target first keyword associated with the second keyword is determined; the layout information of the reference document is obtained, and the multiple original contents are originally layouted based on the layout information, and the new contents are added to the original layout result based on the original layout result and the association relationship between the second keyword and the target first keyword to obtain the final layout result of the document to be uploaded. The above-mentioned content typesetting method based on reference documents solves the problems of cumbersome typesetting steps and inflexible typesetting methods in the prior art for uploaded document content. By performing semantic analysis on multiple target original contents and newly added contents in the uploaded document, the target first keyword associated with the second keyword of the newly added content is determined, and the newly added content is added to the original typesetting result based on the typesetting result of the original content and the association relationship between the keywords. This can achieve the purpose of automatically typeset the newly added content in the uploaded document content without adjusting the reference document, simplifying the steps of typesetting the content of the document to be uploaded and improving the flexibility of content typesetting. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is a flowchart of a content typesetting method based on a reference document provided in an embodiment of the present application;
[0042] Figure 2 This is a page display of the layout information of the reference document provided by this application;
[0043] Figure 3 This is a flowchart of identifying related keywords provided by an embodiment of the present application;
[0044] Figure 4 This is a flowchart of adding new content provided by an embodiment of the present application;
[0045] Figure 5 This is a structural block diagram of a content typesetting device based on a reference document provided in an embodiment of the present application;
[0046] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. It should also be noted that, for ease of description, only parts related to the present application, not all of the contents, are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow charts describe each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but can also have additional steps not included in the accompanying drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0048] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the embodiments described are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field are within the scope of protection of this application.
[0049] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0050] First of all, the usage scenario of this solution can be a scenario of automatic typeset of a document to be uploaded, especially a scenario of automatic typeset of the corresponding content of a newly added element in a document to be uploaded based on a reference document. By performing semantic analysis on multiple target original contents and newly added contents in a document to be uploaded, determining the target first keyword associated with the second keyword of the newly added content, and adding the newly added content to the original typesetting result based on the typesetting result of the original content and the association relationship between the keywords, the purpose of automatically typeset the newly added content in the content of the document to be uploaded can be achieved without adjusting the reference document, thereby simplifying the steps of typesetting the content of the document to be uploaded and improving the flexibility of content typesetting. Based on the above usage scenarios, it can be understood that the executor of this solution can be an electronic device.
[0051] In the following, in conjunction with the accompanying drawings, a content typesetting method, apparatus, device and medium based on a reference document provided by an embodiment of the present application are described in detail through specific embodiments and their application scenarios.
[0052] Figure 1 This is a flowchart of a content typesetting method based on a reference document provided in an embodiment of the present application.
[0053] like Figure 1 As shown, the specific steps include:
[0054] S101, when there is a new element in the document to be uploaded, obtain multiple original contents in the document to be uploaded and the new contents corresponding to the new elements, calculate the similarity between the new contents and each original content, and determine multiple target original contents whose similarity is greater than a preset similarity threshold among the multiple original contents.
[0055] Among them, the document to be uploaded can be an unformatted document to be uploaded to the target platform or to be published to the target system. The newly added elements can be elements that exist in the document to be uploaded but do not exist in the reference document. For example: the reference document includes title, text and picture elements, and the document to be uploaded also includes annotations and comment elements, then the annotations and comments are newly added elements. The original content can be the content in the document to be uploaded that is the same as the reference document elements. The newly added content can be the content corresponding to the newly added elements in the document to be uploaded. The preset similarity threshold can be a pre-set minimum similarity between the newly added content and the original content when the original content is textually related to the target content. The target original content can be the content in the original content that has a textual association relationship with the newly added content.
[0056] In one embodiment, it is possible to determine whether there are new elements in the document to be uploaded by comparing elements in the document to be uploaded with elements in the reference document. If there are new elements in the document to be uploaded, new content corresponding to the new elements in the document to be uploaded and original content corresponding to multiple original elements other than the new elements are obtained, an original element vector is constructed based on the original content, and a new element vector is constructed based on the new content. The similarity between the new content and each original content is calculated based on the original element vector and the new element vector, and the similarity is compared with a preset similarity threshold. Multiple original contents having similarities greater than the preset similarity threshold are determined as multiple target original contents.
[0057] S102 , performing semantic analysis on multiple target original contents and newly added contents, obtaining a first keyword in each target original content and a second keyword in the newly added contents, and determining a target first keyword associated with the second keyword.
[0058] Among them, keywords can be sentences expressing logical relationships, or they can be sentences that appear repeatedly in multiple contents. Sentences expressing logical relationships in keywords can include logical keywords and content keywords associated with logical keywords. The first keyword can be a keyword in the target original content. The second keyword can be a keyword in the newly added content. The target first keyword can be the first keyword that can form a logical correspondence with the second keyword or that has appeared repeatedly in the second keyword. For example: the first keyword A is sports including football, the first keyword B is that outdoor sports should be minimized in rainy weather, and the second keyword is that football is a sport loved by young people. Then the "football" in the first keyword A and the "football" in the second keyword appear repeatedly. At this time, the first keyword A can be determined as the target first keyword.
[0059] In one embodiment, a semantic parsing tool can be used to perform semantic parsing on multiple target original contents and newly added contents, and keywords in each target original content and newly added content can be extracted respectively to obtain the first keyword in each target original content and the second keyword in the newly added content. The target first keyword associated with the second keyword can be determined based on the repetition rate of words in the first keyword and the second keyword; the corresponding association relationship can also be determined based on the association relationship between logically associated words, and the target first keyword in the first keyword that meets the association relationship can be identified.
[0060] S103, obtaining the typesetting information of the reference document, performing original typesetting on the multiple original contents based on the typesetting information, adding the new content to the original typesetting result based on the original typesetting result and the association between the second keyword and the target first keyword, and obtaining the final typesetting result of the document to be uploaded.
[0061] The reference document can be a document that complies with standard typesetting requirements and is used to guide the typesetting of the document to be uploaded. Based on the reference document, the consistency of the document content format and visual style can be ensured. The typesetting information can include information about the order, size, and format of the document content. The original typesetting result can be the document content obtained by typesetting the original content according to the typesetting information. The final typesetting result can be the document content that complies with the typesetting information and includes the newly added content.
[0062] Figure 2 This is a page display diagram of the reference document layout information provided by this application.
[0063] like Figure 2As shown in the figure, the elements in the reference document include: main title, subtitle, body text, and images. The reference document's layout information includes the font, size, line spacing, element position, overall spacing between elements, and the document's code format for each text element. It also includes the element position, size, color, and type of image elements. The elements in the to-be-uploaded document that are identical to the reference document's elements can be typeset according to the reference document's layout information to obtain the original typesetting result.
[0064] In one embodiment, the reference document can be formatted to obtain typesetting information or the typesetting information of the pre-stored reference document can be directly obtained, and the format and typesetting order of the multiple original contents can be adjusted according to the typesetting information to obtain the original typesetting result. The typesetting position and typesetting format of the newly added content are determined based on the original typesetting result and the association relationship between the second keyword and the target first keyword, and the newly added content is added to the original typesetting result according to the typesetting position and typesetting format to obtain the final typesetting result of the document to be uploaded. The typesetting position of the newly added content can be determined based on the association relationship between the second keyword and the target first keyword and the position of the target original content corresponding to the target first keyword. The typesetting rules between the parallel content and the typesetting rules between the hierarchical progressive content can be determined based on the original typesetting result, the hierarchical relationship between the newly added content and the target original content corresponding to the target first keyword can be determined based on the association relationship between the second keyword and the target first keyword, and the typesetting format of the newly added content can be determined according to the above-mentioned typesetting rules.
[0065] In one embodiment, after obtaining the final layout result of the document to be uploaded, the method further includes: identifying the actual image format and actual text style in the final layout result; obtaining configuration parameters of the target upload interface of the document to be uploaded, and determining the target image format and target text style of the newly added content addition result based on the configuration parameters; adjusting the actual image format and actual text style based on the target image format and target text style to obtain the target upload format of the document to be uploaded, and uploading the document to be uploaded according to the target upload format. The actual image format may be parameters describing the size, clarity, and type of the image in the final layout result. The actual text style may be parameters describing the size, color, line spacing, and programming language type of the text in the final layout result. The target upload interface may be a component on the target platform for receiving and parsing the content of the document to be uploaded. The configuration parameters of the target upload interface may be parameters describing the language format, image type, and target display style of the text and images that the target platform can recognize. The target text and image format may be a display format that the target platform can recognize and adapt to different terminal sizes.
[0066] In one embodiment, the actual image format and actual text style in the final typesetting result can be identified, the configuration parameters of the target upload interface of the document to be uploaded can be obtained, and the target image format and target text style of uploading the newly added content addition result to the target platform can be determined based on the configuration parameters. According to the target image format and target text style, the actual image style and type are adjusted, as well as the style and programming language of the actual text are adjusted to obtain the target upload format of the document to be uploaded, and the document to be uploaded is uploaded according to the target upload format. Since different platforms can recognize different document languages, and different device terminals have different page display sizes, in order to enable the document to be uploaded to automatically adapt to the size of the target platform and the device terminal, it is necessary to convert the document format and scale the content size before uploading the document to improve the intelligence and automation of typesetting.
[0067] This solution identifies the actual image format and actual text style in the final typesetting result, determines the target image format and target text style according to the configuration parameters of the target upload interface, and adjusts them to obtain the target upload format of the document to be uploaded. This can ensure that the document to be uploaded is adaptive to different platforms and terminal configurations, and ensure that the typesetting results can be accurately displayed on different terminals.
[0068] The technical solution provided by the embodiment of the present application, when there are new elements in the document to be uploaded, obtains multiple original contents in the document to be uploaded and the new contents corresponding to the new elements, calculates the similarity between the new contents and each original content, and determines multiple target original contents whose similarity is greater than a preset similarity threshold among the multiple original contents; performs semantic analysis on the multiple target original contents and the new contents, obtains the first keyword in each target original content and the second keyword in the new content, and determines the target first keyword associated with the second keyword; obtains the layout information of the reference document, performs original layout on the multiple original contents based on the layout information, and adds the new contents to the original layout result based on the original layout result and the association relationship between the second keyword and the target first keyword to obtain the final layout result of the document to be uploaded. The above-mentioned content typesetting method based on reference documents solves the problems of cumbersome typesetting steps and inflexible typesetting methods in the prior art for uploaded document content. By performing semantic analysis on multiple target original contents and newly added contents in the uploaded document, the target first keyword associated with the second keyword of the newly added content is determined, and the newly added content is added to the original typesetting result based on the typesetting result of the original content and the association relationship between the keywords. This can achieve the purpose of automatically typeset the newly added content in the uploaded document content without adjusting the reference document, simplifying the steps of typesetting the content of the document to be uploaded and improving the flexibility of content typesetting.
[0069] Figure 3This is a flowchart of identifying related keywords provided by the embodiment of this application. Figure 3 As shown, the specific steps include:
[0070] S301 : Acquire a first content keyword and a first logical keyword in the first keyword, and a second content keyword and a second logical keyword in the second keyword.
[0071] The first logical keyword may be a word that represents the logical relationship between sentences in the first keyword. For example, "because, so" represents a causal logical relationship, and "first, secondly" represents a hierarchical progressive logical relationship. The first content keyword may be a sentence in the first keyword that is associated with the first logical keyword. For example, if the first keyword is "because it rains today", then the first content keyword corresponding to the first logical keyword "because" is "it rains today". The second logical keyword may be a word that represents the logical relationship between sentences in the second keyword. The second content keyword may be a sentence in the second keyword that is associated with the second logical keyword.
[0072] In one embodiment, a logical word keyword in a first keyword can be identified to obtain a first logical keyword, and a forward statement and a backward statement of the first logical keyword in the first keyword can be obtained to obtain a first content keyword. A second content keyword and a second logical keyword in the second keyword can be obtained in the same manner.
[0073] S302: Determine a target first logical keyword that matches the second logical keyword in the first logical keywords, and determine a target first content keyword that corresponds to the target first logical keyword in the first content keywords.
[0074] The target first logical keyword may be a keyword in the first logical keyword that can form a logical association relationship with the second logical keyword. The target first content keyword may be a content sentence associated with the target first logical keyword in the original content. For example, the target first logical keyword may be a forward sentence or backward sentence in the original content.
[0075] In one embodiment, a logical association relationship corresponding to the second keyword can be determined based on the second logical keyword, a target first logical keyword matching the second logical keyword in the first logical keyword can be determined based on the logical association relationship, and a target first content keyword corresponding to the target first logical keyword can be determined based on the position of the first content keyword in the original content.
[0076] S303 : Perform a logic consistency check on the target first content keyword and the second content keyword based on the matching relationship between the second logical keyword and the target first logical keyword, and determine the target first keyword associated with the second keyword based on the logic consistency check result.
[0077] The matching relationship may be a logical correspondence relationship between the second logical keyword and the target first logical keyword. The logical consistency check may be an operation to verify whether the logic corresponding to the matching relationship and the content relationship is the same.
[0078] In one embodiment, since there may be multiple target first logical keywords that match the second logical keyword, and the multiple target first content keywords corresponding to the multiple target first logical keywords may contain content statements that conflict with the logical relationship between the logical keywords, it is necessary to perform a consistency check on the logical relationship between the logical keywords and the logical relationship between the content keywords to determine the target first logical keyword that ultimately matches the second logical keyword. The theoretical logical relationship between the target first content keyword and the second content keyword can be determined based on the matching relationship between the second logical keyword and the target first logical keyword, and the actual logical relationship can be determined based on the target first content keyword and the second content keyword. It is then determined whether the theoretical logical relationship and the actual logical relationship are the same, and the target first keyword associated with the second keyword can be determined based on the logical consistency check result. For example, the first keywords corresponding to the target first logical keyword that matches the second logical keyword include keyword A and keyword B. Keyword A is "because it rains today," and keyword B is "because it's summer now." The second keyword corresponding to the second logical keyword is "so I didn't go out." The target first logical keywords corresponding to keyword A and keyword B are both "because." In this case, the target first content keywords "it rains today" and "it's summer now" need to be matched with the second content keyword "not going out," respectively, and a consistency check of the causal logical relationship needs to be performed to determine that the target first keyword associated with the second keyword is keyword A. This solution can avoid the problem of inaccurate layout of newly added content due to logical conflicts by verifying the logical consistency of the keyword and content matching relationship.
[0079] In one embodiment, a logical consistency check is performed on the target first content keyword and the second content keyword based on the matching relationship between the second logical keyword and the target first logical keyword, including: determining the target semantic attribute range of the target first content keyword based on the matching relationship between the second logical keyword and the target first logical keyword, and identifying the actual semantic attribute of the target first content keyword; determining whether the actual semantic attribute falls within the target semantic attribute range, and if the actual semantic attribute falls within the target semantic attribute range, determining that the target first content keyword and the second content keyword are logically consistent. The target semantic attribute range can be the semantic range of the target first content keyword when logically consistent, and the actual semantic attribute can be the actual semantics of the target first content keyword.
[0080] In one embodiment, the target semantic attribute range of the target first content keyword can be determined based on the matching relationship between the second logical keyword and the target first logical keyword, using the second content keyword corresponding to the second logical keyword as a restriction condition. For example: if the matching relationship is a causal relationship, if the second logical keyword is a result logical keyword, then the target semantic attribute range of the target first content keyword is the semantic range that causes the second content keyword; if the matching relationship is a progressive relationship, then the target semantic attribute range of the target first content keyword is the semantic range that describes the subject or the same object in the second content keyword. The actual semantic attribute of the target first content can be determined by identifying the subject, predicate, and object in the target first content keyword. It is determined whether the actual semantic attribute belongs to the target semantic attribute range. If the actual semantic attribute belongs to the target semantic attribute range, it is determined that the target first content keyword is logically consistent with the second content keyword.
[0081] This solution can further improve the accuracy of content keyword logic consistency verification by determining the target semantic attribute range of the target first content keyword based on the matching relationship between the second logical keyword and the target first logical keyword, judging whether the actual semantic attribute of the target first content keyword falls within the target semantic attribute range, and determining whether the target first content keyword and the second content keyword are logically consistent.
[0082] The technical solution provided in the embodiment of the present application determines the target first logical keyword that matches the second logical keyword in the first logical keyword and determines the target first content keyword that corresponds to the target first logical keyword in the first content keyword, performs a logical consistency check on the target first content keyword and the second content keyword based on the matching relationship between the second logical keyword and the target first logical keyword, and determines the target first keyword associated with the second keyword. This can avoid the problem of inaccurate subsequent typesetting of new content caused by content and logic conflicts, and can improve the accuracy of automatic typesetting of uploaded document content.
[0083] Figure 4 This is a flow chart of adding new content provided by the embodiment of this application. Figure 4 As shown, the original typesetting result includes the typesetting position and typesetting format of each original content, which specifically includes the following steps:
[0084] S401, determining the associated typesetting order among multiple original contents based on the typesetting position, determining the associated format features among multiple original contents based on the typesetting format, and determining the target typesetting position and target typesetting format of the newly added content based on the associated typesetting order, the associated format features and the association between the second keyword and the target first keyword.
[0085] Among them, the layout position can be the position of the original content in the document display page. For example: the image content is located below the main text. The associated layout order can be the layout order of multiple original contents with an associated relationship. For example: multiple original contents are introductions to a certain product, and the associated layout order can be product definition-example content-summary content. The layout format can be a parameter representing the layout size, font, spacing between different contents, and line spacing of the same content. The associated format feature can be the format change characteristics of adjacent content in multiple contents. The target layout position can be the addition position of the new content to the original layout result. The target layout format can be a format that typesets the new content in accordance with the layout rules of the reference document.
[0086] In one embodiment, the associated typesetting order between related contents in multiple original contents can be determined based on the typesetting position of each original content in the original typesetting result, the format change rule between adjacent contents in multiple original contents can be determined based on the typesetting format of each original content, and the associated format characteristics between the multiple original contents can be obtained. The target typesetting position of the newly added content can be determined based on the associated typesetting order and the associated relationship between the second keyword and the target first keyword, and the target typesetting format of the newly added content after adjustment according to the associated format characteristics can be determined based on the associated format characteristics and the associated relationship between the second keyword and the target first keyword.
[0087] S402: Add the new content to the original typesetting result based on the target typesetting position and the target typesetting format.
[0088] In one embodiment, the newly added content can be added to the original layout result according to the target layout position and target layout format. After the newly added content is added, useless elements that exist in the reference document but not in the added result can be identified, and the useless elements can be deleted from the corresponding positions in the added result. The position of the elements in the added result can be adaptively adjusted to avoid the problem of vacant positions in the layout, further improving the flexibility of content layout of the uploaded document based on the reference document.
[0089] In one embodiment, the target typesetting position and target typesetting format of the newly added content are determined based on the associated typesetting order, the associated format characteristics, and the association between the second keyword and the target first keyword, including: determining the logical hierarchical relationship between the newly added content and the target original content corresponding to the target first keyword based on the association between the second keyword and the target first keyword; determining the target typesetting position of the newly added content based on the associated typesetting order and the logical hierarchical relationship; determining the typesetting format change rules of multiple original contents based on the associated format characteristics, and determining the target typesetting format of the newly added content based on the typesetting format change rules and the logical hierarchical relationship. Among them, the logical hierarchical relationship can be a hierarchical relationship between the logical level where the newly added content is located and the logical level where the target original content is located. The logical hierarchical relationship includes a parallel relationship and a progressive relationship. The typesetting format change rules can be information describing the typesetting changes of different original contents.
[0090] In one embodiment, a logical hierarchical relationship between the newly added content and the target original content corresponding to the target first keyword can be determined based on the association between the second keyword and the target first keyword, and a target layout position of the newly added content when typeset according to the associated layout sequence can be determined based on the associated layout sequence and the logical hierarchical relationship. A layout format variation pattern of multiple original contents can be determined based on the associated format features, and a target layout format of the newly added content after the layout format variation pattern is changed based on the layout format variation pattern and the logical hierarchical relationship can be determined.
[0091] This solution determines the logical hierarchical relationship between the new content and the target original content based on the association of keywords, determines the target typesetting position of the new content based on the associated typesetting order and the logical hierarchical relationship, determines the typesetting format change rules of multiple original contents based on the associated format characteristics, and determines the target typesetting format of the new content based on the typesetting format change rules and the logical hierarchical relationship. This can achieve the purpose of automatically determining the typesetting position and typesetting format of the new content according to the logical hierarchy when there is no reference typesetting information in the reference document, thereby improving the intelligence and automation of typesetting.
[0092] In one embodiment, there are multiple newly added contents; the target layout position of the newly added contents is determined based on the associated layout order and the logical hierarchical relationship, including: determining the layout range of the multiple newly added contents based on the associated layout order and the logical hierarchical relationship; determining the degree of association between the multiple newly added contents based on the second keyword in each newly added content, and sorting the layout positions of the multiple newly added contents within the layout range according to the magnitude of the association degree, to obtain the target layout position of each newly added content. The layout range can be the range of positions where the newly added content can be added in the original layout result. The degree of association can be a parameter indicating the degree of relevance between the multiple newly added contents.
[0093] In one embodiment, the layout range of multiple new contents can be determined based on the associated layout order and the logical hierarchical relationship. For example: if the logical hierarchical relationship between the new content and the original content is that the new content is a progressive level of a certain original content, then the position range between the original content below and the original content adjacent to the original content is used as the layout range of the multiple new contents according to the associated layout order. The similarity between the multiple new contents is calculated based on the second keyword in each new content, and the similarity is used as the degree of association between the multiple new contents. The new contents with a larger degree of association are sorted at the front position in the layout range, and the remaining new contents are sorted in the layout position according to the relationship between the degree of association, so as to obtain the target layout position of each new content.
[0094] This solution can automatically determine the typesetting positions of multiple new contents by determining the typesetting range of multiple new contents and the degree of correlation between the multiple new contents, and sorting the typesetting positions of the multiple new contents within the typesetting range, thereby improving the efficiency of automatic typesetting.
[0095] The technical solution provided in the embodiment of the present application determines the associated typesetting order between multiple original contents and determines the associated format features between multiple original contents, and determines the target typesetting position and target typesetting format of the new content based on the associated typesetting order, the associated format features, and the association between the second keyword and the target first keyword, and then adds the new content to the original typesetting result. This can achieve the purpose of automatically determining the typesetting position and typesetting format of the new content without adding new elements to the reference document, thereby improving the efficiency of typesetting the new content.
[0096] Figure 5 This is a structural block diagram of a content typesetting device based on a reference document provided in an embodiment of the present application. Figure 5 As shown, specifically including the following:
[0097] Target content determination module 501 is configured to, when a new element type exists in the document to be uploaded, obtain new content corresponding to the new element type and multiple original contents in the document to be uploaded, calculate similarity between the new content and each original content, and determine multiple target original contents whose similarity exceeds a preset similarity threshold;
[0098] A reference content determination module 502 is configured to perform semantic analysis on the plurality of target original contents and the newly added contents, obtain a first keyword in each target original content and a second keyword in the newly added contents, and determine a target first keyword associated with the second keyword;
[0099] The content layout module 503 is used to obtain the layout information of the reference document, perform original layout on multiple original contents based on the layout information, add new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword, and obtain the final layout result of the document to be uploaded.
[0100] Optionally, the reference content determination module 502 is specifically configured to:
[0101] Acquire a first content keyword and a first logical keyword from the first keyword, and a second content keyword and a second logical keyword from the second keyword;
[0102] determining a target first logical keyword that matches the second logical keyword among the first logical keywords, and determining a target first content keyword that corresponds to the target first logical keyword among the first content keywords;
[0103] A logical consistency check is performed on the target first content keyword and the second content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and the target first keyword associated with the second keyword is determined based on a result of the logical consistency check.
[0104] Optionally, the reference content determination module 502 is specifically configured to:
[0105] Determining a target semantic attribute range of the target first content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and identifying an actual semantic attribute of the target first content keyword;
[0106] It is determined whether the actual semantic attribute belongs to the target semantic attribute range. If the actual semantic attribute belongs to the target semantic attribute range, it is determined that the target first content keyword is logically consistent with the second content keyword.
[0107] Optionally, the original typesetting result includes the typesetting position and typesetting format of each original content;
[0108] The content layout module 503 is specifically used to:
[0109] Determine the associated typesetting order among the multiple original contents based on the typesetting positions, determine the associated format features among the multiple original contents based on the typesetting formats, and determine the target typesetting position and target typesetting format of the newly added content based on the associated typesetting order, the associated format features, and the association between the second keyword and the target first keyword;
[0110] The new content is added to the original layout result based on the target layout position and the target layout format.
[0111] Optionally, the content layout module 503 is specifically configured to:
[0112] Determining a logical hierarchical relationship between the newly added content and the target original content corresponding to the target first keyword based on the association relationship between the second keyword and the target first keyword;
[0113] Determine the target layout position of the new content based on the associated layout order and logical hierarchical relationship;
[0114] Based on the associated format features, the typesetting format change rules of multiple original contents are determined, and based on the typesetting format change rules and logical hierarchical relationships, the target typesetting format of the newly added content is determined.
[0115] Optionally, the number of new content added is multiple;
[0116] Optionally, the content layout module 503 is specifically configured to:
[0117] Determine the layout range of multiple newly added contents based on the associated layout order and logical hierarchical relationship;
[0118] The correlation degree among the multiple new contents is determined based on the second keyword in each new content, and the multiple new contents are sorted in the typesetting range according to the size of the correlation degree to obtain the target typesetting position of each new content.
[0119] Optionally, the device further comprises:
[0120] The actual style recognition module is used to identify the actual image format and actual text style in the final typesetting result;
[0121] A target style determination module is used to obtain configuration parameters of the target upload interface of the document to be uploaded, and determine the target image format and target text style of the newly added content based on the configuration parameters;
[0122] The document upload module is used to adjust the actual image format and the actual text style based on the target image format and the target text style, obtain the target upload format of the document to be uploaded, and upload the document to be uploaded according to the target upload format.
[0123] The technical solution provided in the embodiment of the present application includes a target content determination module, which is used to obtain the new content corresponding to the new element type and multiple original contents in the document to be uploaded when there is a new element type in the document to be uploaded, calculate the similarity between the new content and each original content, and determine multiple target original contents whose similarity is greater than a preset similarity threshold; a reference content determination module, which is used to perform semantic analysis on the multiple target original contents and the new content, obtain the first keyword in each target original content and the second keyword in the new content, and determine the target first keyword associated with the second keyword; and a content layout module, which is used to obtain the layout information of the reference document, perform original layout on the multiple original contents based on the layout information, and add the new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword to obtain the final layout result of the document to be uploaded. The above-mentioned content typesetting device based on reference documents solves the problems of cumbersome typesetting steps and inflexible typesetting methods in the prior art for uploaded document content. By performing semantic analysis on multiple target original contents and newly added contents in the uploaded document, the target first keyword associated with the second keyword of the newly added content is determined, and the newly added content is added to the original typesetting result based on the typesetting result of the original content and the association relationship between the keywords. This can achieve the purpose of automatically typeset the newly added content in the uploaded document content without adjusting the reference document, simplifying the steps of typesetting the content of the document to be uploaded and improving the flexibility of content typesetting.
[0124] In an embodiment of the present application, a content typesetting device based on a reference document can be configured in a device, or can be configured in a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine, or a self-service machine, etc., and the embodiment of the present application does not specifically limit this.
[0125] In the embodiment of the present application, a content typesetting device based on a reference document may be an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0126] The content typesetting device based on a reference document provided in the embodiment of the present application can implement each process implemented in the above-mentioned method embodiments. To avoid repetition, they will not be described here.
[0127] like Figure 6 As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a program or instruction stored in the memory 602 and executable on the processor 601. When the program or instruction is executed by the processor 601, each process of the above-mentioned embodiment of the content typesetting method based on a reference document is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0128] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0129] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned embodiment of the content typesetting method based on a reference document is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0130] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (ROM), random access memory (RAM), a magnetic disk, or an optical disk.
[0131] The present application also provides a program product comprising program code. When the program product is executed on a computer device, the program code is configured to cause the computer device to execute the steps of the methods described above in accordance with various exemplary embodiments of the present application. For example, the computer device may execute a method for content layout based on a reference document as described in the present application. The program product may be implemented using any combination of one or more readable media.
[0132] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be noted that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0133] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), including a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0134] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of this application, ordinary technicians in this field can also make many forms without departing from the purpose of this application and the scope of protection of the claims, all of which are within the protection of this application.
[0135] The above are only preferred embodiments of the present application and the technical principles employed. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that are possible for those skilled in the art will not depart from the scope of protection of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments and may include more other equivalent embodiments without departing from the concept of the present application. The scope of the present application is determined by the scope of the claims.
Claims
1. A content layout method based on a reference document, characterized in that: The method comprises: When a newly added element exists in the document to be uploaded, obtaining a plurality of original contents in the document to be uploaded and the newly added content corresponding to the newly added element, calculating the similarity between the newly added content and each of the original contents, and determining a plurality of target original contents having a similarity greater than a preset similarity threshold among the plurality of original contents; Performing semantic analysis on the multiple target original contents and the newly added content to obtain a first keyword in each target original content and a second keyword in the newly added content, and determining a target first keyword associated with the second keyword; Obtain the layout information of the reference document, perform original layout on the multiple original contents based on the layout information, add the new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword, and obtain the final layout result of the document to be uploaded.
2. The content typesetting method based on reference documents according to claim 1, characterized in that: The determining the target first keyword associated with the second keyword includes: Acquire a first content keyword and a first logical keyword from the first keywords, and a second content keyword and a second logical keyword from the second keywords; determining a target first logical keyword in the first logical keywords that matches the second logical keyword, and determining a target first content keyword in the first content keywords that corresponds to the target first logical keyword; A logical consistency check is performed on the target first content keyword and the second content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and a target first keyword associated with the second keyword is determined based on a result of the logical consistency check.
3. The content typesetting method based on reference documents according to claim 2, characterized in that: The performing a logical consistency check on the target first content keyword and the second content keyword based on the matching relationship between the second logical keyword and the target first logical keyword includes: determining a target semantic attribute range of the target first content keyword based on a matching relationship between the second logical keyword and the target first logical keyword, and identifying an actual semantic attribute of the target first content keyword; It is determined whether the actual semantic attribute belongs to the target semantic attribute range. If the actual semantic attribute belongs to the target semantic attribute range, it is determined that the target first content keyword is logically consistent with the second content keyword.
4. The content typesetting method based on reference documents according to claim 1, characterized in that: The original typesetting result includes the typesetting position and typesetting format of each original content; The adding the new content to the original typesetting result based on the original typesetting result and the association between the second keyword and the target first keyword includes: Determining an associated typesetting order among the plurality of original contents based on the typesetting positions, determining associated format features among the plurality of original contents based on the typesetting formats, and determining a target typesetting position and a target typesetting format of the newly added content based on the associated typesetting order, the associated format features, and an association between the second keyword and the target first keyword; The newly added content is added to the original layout result based on the target layout position and the target layout format.
5. The content typesetting method based on reference documents according to claim 4, characterized in that: The determining of the target typesetting position and target typesetting format of the new content based on the associated typesetting order, the associated format feature, and the association between the second keyword and the target first keyword includes: Determining a logical hierarchical relationship between the new content and the target original content corresponding to the target first keyword based on an association relationship between the second keyword and the target first keyword; Determining a target layout position of the newly added content based on the associated layout order and the logical hierarchical relationship; Based on the associated format features, a change pattern of the typesetting formats of the plurality of original contents is determined; based on the change pattern of the typesetting formats and the logical hierarchical relationship, a target typesetting format of the newly added content is determined.
6. The content typesetting method based on reference documents according to claim 5, characterized in that: The number of the newly added content is multiple; The determining the target layout position of the newly added content based on the associated layout order and the logical hierarchical relationship includes: Determining the layout range of the plurality of newly added contents according to the associated layout order and the logical hierarchical relationship; Based on the second keyword in each of the new contents, the degree of association between the multiple new contents is determined, and the multiple new contents are sorted in the layout position within the layout range according to the size relationship of the degree of association to obtain the target layout position of each of the new contents.
7. The content typesetting method based on reference documents according to claim 1, characterized in that: After obtaining the final typesetting result of the document to be uploaded, the method further includes: Identifying the actual image format and actual text style in the final typesetting result; Obtaining configuration parameters of a target upload interface for the document to be uploaded, and determining a target image format and a target text style for the newly added content based on the configuration parameters; The actual image format and the actual text style are adjusted based on the target image format and the target text style to obtain the target upload format of the document to be uploaded, and the document to be uploaded is uploaded according to the target upload format.
8. A content layout device based on a reference document, characterized in that: The device comprises: a target content determination module configured to, when a newly added element type exists in the document to be uploaded, obtain newly added content corresponding to the newly added element type and a plurality of original contents in the document to be uploaded, calculate a similarity between the newly added content and each of the original contents, and determine a plurality of target original contents whose similarities are greater than a preset similarity threshold; a reference content determination module, configured to perform semantic analysis on the plurality of target original contents and the newly added content, obtain a first keyword in each target original content and a second keyword in the newly added content, and determine a target first keyword associated with the second keyword; A content layout module is used to obtain the layout information of the reference document, perform original layout on the multiple original contents based on the layout information, add the new content to the original layout result based on the original layout result and the association between the second keyword and the target first keyword, and obtain the final layout result of the document to be uploaded.
9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of a content typesetting method based on a reference document as described in any one of claims 1 to 7.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the content typesetting method based on the reference document are implemented as described in any one of claims 1 to 7.