Document processing method, apparatus, device, and medium
By acquiring content information and presentation format information of content blocks, determining rendering intent, and selecting adaptation strategies, the problem of document mismatch on different terminals is solved, and the display quality of documents on target terminals is improved.
Patent Information
- Application Number
- CN202611331060.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-20
AI Technical Summary
The presentation of documents on different terminals is difficult to match with the terminal's presentation capabilities, resulting in a decline in the presentation quality of document content, and some terminals may even be unable to present documents correctly.
By acquiring the content information and presentation format information of the content block, the rendering intent is determined, and a suitable transformation method is selected based on the set of adaptation strategies to make the presentation format of the content block adapt to the target terminal.
It improves the display quality of documents on target terminals, ensures that the presentation format of each content block can be supported by the target terminal, avoids display anomalies, and prioritizes the presentation quality of the core content.
Smart Images

Figure CN123139935A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, particularly to the fields of deep learning, natural language processing, and intelligent office technologies, specifically to a document processing method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies mainly include natural language processing, computer vision, speech recognition, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0003] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention
[0004] This disclosure provides a document processing method, a document processing apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] According to one aspect of this disclosure, a document processing method is provided, comprising: acquiring an original document and segmenting the original document to obtain multiple content blocks; acquiring content information and presentation format information of the multiple content blocks, wherein the presentation format information represents the visual form in which the corresponding content block is presented; acquiring a set of adaptation strategies corresponding to a target terminal, wherein the set of adaptation strategies includes multiple preset adaptation strategies, each adaptation strategy indicating a transformation method for the presentation format of the content block so that the transformed presentation format can be supported by the target terminal; taking each of the multiple content blocks as a target content block, and performing the following operations: determining the target rendering intent of the target content block based on the content information and presentation format information of the target content block; and determining the target adaptation strategy for the target content block in the set of adaptation strategies based on the target rendering intent; and transforming the corresponding content blocks respectively based on the transformation method indicated by the target adaptation strategies of the multiple content blocks to obtain a target document corresponding to the original document.
[0006] According to another aspect of this disclosure, a document processing apparatus is provided, comprising: a segmentation unit configured to acquire an original document and segment the original document to obtain multiple content blocks; a first acquisition unit configured to acquire content information and presentation format information of the multiple content blocks, wherein the presentation format information characterizes the visual form in which the corresponding content block is presented; a second acquisition unit configured to acquire an adaptation strategy set corresponding to a target terminal, wherein the adaptation strategy set includes multiple preset adaptation strategies, each adaptation strategy indicating a transformation method for the presentation format of the content block so that the transformed presentation format can be supported by the target terminal; and a processing unit configured to take each of the multiple content blocks as a target content block and perform operations using the following subunits: an intent determination subunit configured to determine a target rendering intent for the target content block based on the content information and presentation format information of the target content block; and a strategy determination subunit configured to determine a target adaptation strategy for the target content block in the adaptation strategy set based on the target rendering intent; and a transformation unit configured to transform the corresponding content blocks respectively based on the transformation method indicated by the target adaptation strategies of the multiple content blocks to obtain a target document corresponding to the original document.
[0007] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the above-described method.
[0008] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform the above-described method.
[0009] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the above-described method when executed by a processor.
[0010] According to one or more embodiments of this disclosure, the content information and presentation format information of a content block are used together as the basis for determining the rendering intent of the content block. The presentation format information characterizes the visual form in which the content block is presented, ensuring that the determined rendering intent accurately reflects the actual presentation function of the content block in the original document. By determining and transforming target adaptation strategies based on the rendering intent of each content block at the content block level, the transformation method is adapted to the presentation function of the content block in the original document. This improves the targeting of the transformation of the presentation format of the content block and ensures that the presentation format of each content block in the target document is supported by the target terminal.
[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0012] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0013] Figure 1 A schematic diagram of an exemplary system in which the various methods described herein may be implemented according to embodiments of the present disclosure is shown; Figure 2 A flowchart of a document processing method according to an embodiment of the present disclosure is shown; Figure 3 A flowchart illustrating the process of determining a target adaptation strategy according to an embodiment of the present disclosure is shown; Figure 4 A flowchart illustrating a process for determining a target adaptation strategy based on a score according to an embodiment of the present disclosure is shown; Figure 5 A flowchart of a document processing method according to an embodiment of the present disclosure is shown; Figure 6 A flowchart illustrating the process of obtaining a fidelity prediction value according to an embodiment of the present disclosure is shown; Figure 7 A structural block diagram of a document processing apparatus according to an embodiment of the present disclosure is shown; Figure 8 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0014] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0015] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.
[0016] The terminology used in the description of the various examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.
[0017] In related technologies, when a document is presented on different terminals, the presentation effect of the document is difficult to match with the presentation capabilities of the terminal, which affects the presentation quality of the document content. In some cases, the terminal cannot present the document because it does not support the presentation format of the document.
[0018] To address the aforementioned issues, this disclosure uses both content information and presentation format information of a content block as the basis for determining its rendering intent. The presentation format information characterizes the visual form in which the content block is presented, ensuring that the determined rendering intent accurately reflects the actual presentation function of the content block within the original document. By using content blocks as the granularity, and determining and transforming target adaptation strategies based on the rendering intent of each content block, the transformation method is adapted to the presentation function of the content block within the original document. This improves the targeted nature of the presentation format transformation of content blocks and ensures that the presentation format of each content block in the target document is supported by the target terminal.
[0019] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0020] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes one or more client devices 101, 102, 103, 104, 105 and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105 and 106 can be configured to execute one or more applications.
[0021] In embodiments of this disclosure, server 120 may run one or more services or software applications that enable the execution of the methods of this disclosure.
[0022] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to users of client devices 101, 102, 103, 104, 105 and / or 106 under a Software as a Service (SaaS) model.
[0023] exist Figure 1 In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 can sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.
[0024] Users can use client devices 101, 102, 103, 104, 105, and / or 106 for human-computer interaction. The client devices provide interfaces that enable users to interact with them. The client devices can also output information to the user through these interfaces. Although... Figure 1 Only six client devices are described, but those skilled in the art will understand that this disclosure can support any number of client devices.
[0025] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices. These computer devices can run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing various applications, such as various internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.
[0026] Network 110 can be any type of network well known to those skilled in the art, and can support data communication using any of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.). By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0027] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0028] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0029] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105 and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105 and / or 106.
[0030] In some implementations, server 120 can be a server for a distributed system or a server integrated with blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Server (VPS) services, such as high management difficulty and weak business scalability.
[0031] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. Databases 130 may reside in various locations. For example, a database used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of different types. In some embodiments, the database used by server 120 may be, for example, a relational database. One or more of these databases may store, update, and retrieve data from and from the databases in response to commands.
[0032] In some embodiments, one or more of the databases 130 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system.
[0033] Figure 1The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.
[0034] According to one aspect of this disclosure, a document processing method is provided. Figure 2 This is a flowchart illustrating a document processing method 200 according to an exemplary embodiment.
[0035] The document processing method provided in the embodiments of this disclosure can be executed by an electronic device. For example, the electronic device can be a server device that provides document presentation services to a target terminal, or it can be the target terminal itself.
[0036] refer to Figure 2 In step S201, the original document is obtained and segmented to obtain multiple content blocks.
[0037] An original document is a document intended for presentation on a target terminal. An original document can be a document created or edited on a terminal different from the target terminal, or it can be a document retrieved from a network or storage device. For example, an original document can be a formatted document such as a word processing document, a presentation, or a spreadsheet.
[0038] A content block refers to a unit of content in the original document that is treated as a whole during rendering. In some embodiments, the original document can be segmented based on its structural information, and each segmented content block corresponds to a relatively complete unit of content in the original document. In an exemplary embodiment, a paragraph, a heading, a table, a list, or a media object (image, video, link, etc.) in the original document can be segmented into a content block.
[0039] In step S202, the content information and presentation format information of multiple content blocks are obtained.
[0040] Content information refers to the content itself carried by the content block. For example, content information may include text content, image content, table content, video content, etc. in the content block, or it may include information describing the image content, table content, or video content in the content block.
[0041] Presentation format information refers to information describing the visual form in which a content block is presented, and it is independent of the content information. For example, presentation format information may include one or more of the following: font, font size, font weight, text decoration, foreground color, background color, alignment, indentation level, number of columns, spacing, and border style. For content blocks containing embedded objects, presentation format information may also include the type and size of the embedded objects, which may include, for example, images, videos, audio, formulas, charts, or embedded pages. For content blocks containing interactive elements or dynamic effects, presentation format information may also include interaction attributes and animation types. For example, text decoration may include bold, underline, strikethrough, or italics, and interaction attributes may include whether the content block is clickable or associated with a form, etc.
[0042] In step S203, an adaptation strategy set corresponding to the target terminal is obtained. The adaptation strategy set includes multiple preset adaptation strategies. Each adaptation strategy indicates a transformation method for the presentation form of the content block so that the transformed presentation form can be supported by the target terminal.
[0043] The target terminal refers to the terminal used to present the document. For example, the target terminal can be a mobile phone, tablet computer, personal computer, or an application or app environment running on the terminal device. Different target terminals may support different presentation formats. For example, some target terminals may not support the presentation of special fonts, dynamic effects, or certain embedded objects.
[0044] Transformation methods refer to the ways in which the presentation of a content block is adjusted. For example, transformation methods may include: replacing the font, font size, font weight, text decoration, foreground color, background color, etc., of the content block with the presentation methods supported by the target terminal; adjusting the alignment, indentation level, number of columns, spacing, border style, etc., of the content block; changing the type or size of embedded objects to the type or size supported by the target terminal, such as changing a video to a static cover image; and removing animation effects from the content block or presenting interactive content blocks in a static form. It can be understood that the object of transformation is the presentation of the content block, rather than directly editing the content it carries.
[0045] In some embodiments, corresponding adaptation strategy sets can be pre-configured for different types of terminals. After determining the target terminal, the adaptation strategy set corresponding to the type of the target terminal is obtained. In an exemplary embodiment, the adaptation strategies in the adaptation strategy set may include: an adaptation strategy that replaces special fonts with the system font of the target terminal, an adaptation strategy that replaces dynamic media with static images, an adaptation strategy that transforms complex tables into simplified forms, an adaptation strategy that first presents content blocks in simplified form and performs high-fidelity processing in the background before replacing and presenting them, and so on.
[0046] In step S204, each of the multiple content blocks is taken as the target content block, and the operations in steps S205 to S206 are performed.
[0047] In step S205, the target rendering intent of the target content block is determined based on the content information and presentation format information of the target content block.
[0048] The target rendering intent represents the presentation role of the target content block within the original document, that is, the role the target content block plays in the overall presentation of the original document. It can be understood that different content blocks in the original document may play different presentation roles. For example, some content blocks are used to carry the main content of the document, some are used to organize the document's structure, and others are only used to enhance the document's visual appeal.
[0049] In some embodiments, the content information and presentation format information of the target content block can be jointly encoded to obtain a content block vector, and the target rendering intent of the target content block can be determined based on the content block vector. Joint encoding refers to encoding both content information and presentation format information as encoding bases, so that the obtained content block vector simultaneously reflects the content semantics and presentation format of the target content block. Since the content block vector simultaneously reflects the content semantics and presentation format of the target content block, the presentation function of the target content block can be accurately determined based on the content block vector. In some embodiments, joint encoding can be performed using an encoding model, by inputting the content information and presentation format information of the target content block into the encoding model, and obtaining the content block vector output by the encoding model. For example, the encoding model can be implemented using a neural network model based on an attention mechanism. The content information of the target content block can be represented as a label sequence, and the presentation format information can be represented as attribute information associated with the label sequence, and both can be input into the encoding model for encoding.
[0050] In some embodiments, the encoding model can be obtained through pre-training, and examples of how the encoding model is trained will be described below.
[0051] In some embodiments, a trained classification model can be used to determine the target rendering intent based on the content block vector. The content block vector is input into the classification model to obtain the target rendering intent output by the classification model.
[0052] In step S206, based on the target rendering intent, a target adaptation strategy for the target content block is determined from the adaptation strategy set.
[0053] Since the target rendering intent characterizes the presentation function of the target content block in the original document, determining the target adaptation strategy based on the target rendering intent enables the determined target adaptation strategy to be adapted to the presentation function of the target content block. In some embodiments, a correlation between rendering intent and adaptation strategies can be established in advance, and the target adaptation strategy can be determined from the set of adaptation strategies based on the target rendering intent and this correlation. In other embodiments, each adaptation strategy in the set of adaptation strategies can be evaluated based on the target rendering intent, and the target adaptation strategy can be determined based on the evaluation results.
[0054] In step S207, based on the transformation method indicated by the target adaptation strategy of each of the multiple content blocks, the corresponding content blocks are transformed to obtain the target document corresponding to the original document.
[0055] In this step, for each content block, its presentation is transformed according to the transformation method indicated by the target adaptation strategy determined for that content block. After transforming multiple content blocks, the target document is obtained based on the transformed content blocks. The target document refers to the document representation presented to the target terminal after transformation, and the presentation format of each content block in the target document can be supported by the target terminal. It is understood that obtaining the target document does not require generating a new document file; for example, the target document can be in the form of document presentation data or rendering data in memory. In some embodiments, the arrangement order and hierarchical relationship of each content block in the original document can also be maintained, so that the target document corresponds to the original document in terms of content organization.
[0056] According to some embodiments, the document processing method may further include: displaying the target document on the target terminal after obtaining the target document.
[0057] Therefore, the presentation of each content block in the target document has been transformed to adapt to the target terminal. When the target document is displayed on the target terminal, each content block can be displayed in a presentation format supported by the target terminal, avoiding display abnormalities or failure to display due to the target terminal not supporting the presentation format in the original document, thus improving the display quality of the document on the target terminal.
[0058] In some embodiments, the target terminal can execute the above document processing method after receiving an open request for the original document, and directly display the target document after obtaining it, so that the user can see the presentation result adapted to the target terminal when initiating the operation of opening the original document on the target terminal.
[0059] According to embodiments of this disclosure, the content information and presentation format information of a content block are used together as the basis for determining the rendering intent of the content block. The presentation format information characterizes the visual form in which the content block is presented, ensuring that the determined rendering intent accurately reflects the actual presentation function of the content block in the original document. By determining and transforming target adaptation strategies based on the rendering intent of each content block at the content block level, the transformation method is adapted to the presentation function of the content block in the original document. This improves the targeting of the transformation of the presentation format of the content block and ensures that the presentation format of each content block in the target document is supported by the target terminal.
[0060] In some implementations, if the entire document is transformed according to uniform rules without distinguishing the presentation function of each part of the document, then content blocks carrying core content and content blocks that only serve a decorative purpose are treated equally, which can easily lead to damage to the core content during the transformation. In contrast, the embodiments of this disclosure determine the transformation method at the content block level, so that content blocks with different presentation functions can receive transformation processing adapted to their presentation functions. When the terminal's presentation capabilities are limited, the presentation quality of content blocks carrying core content can be prioritized, thereby improving the overall presentation quality of the target document on the target terminal.
[0061] Figure 3 A flowchart of a process 300 for determining a target adaptation strategy according to an exemplary embodiment of the present disclosure is shown. Process 300 can be used to implement step S206 in the method 200 described above. Figure 3 As shown, process 300 may include: step S301, obtaining the content block vector of the target content block, wherein the content block vector is obtained by jointly encoding the content information and presentation format information of the target content block; step S302, obtaining the strategy vector of each adaptation strategy in the adaptation strategy set, wherein the strategy vector is obtained by encoding the description information of the corresponding adaptation strategy; step S303, processing the strategy vector and content block vector of each adaptation strategy using a scoring model to obtain the score of the adaptation strategy, wherein the score characterizes the degree of matching between the adaptation strategy and the target content block; and step S304, determining the target adaptation strategy in the adaptation strategy set based on the score of each adaptation strategy.
[0062] Therefore, by encoding the description information of the adaptation strategy into a strategy vector and processing the strategy vector and content block vector using a scoring model, the degree of matching between the adaptation strategy and the target content block can be quantified and compared in the form of a score, thereby improving the degree of matching between the determined target adaptation strategy and the target content block.
[0063] In some embodiments, the description information may include one or more of the following: a policy identifier for the adaptation strategy, a textual description of the transformation method indicated by the adaptation strategy, and the content block type to which the adaptation strategy applies. In some embodiments, the description information of the adaptation strategy can be encoded using a specific encoding model to obtain the corresponding policy vector. It is understood that since the adaptation strategies in the adaptation strategy set are preset, the policy vectors of each adaptation strategy can be pre-encoded and stored, and directly read during execution process 300, thereby saving computational overhead.
[0064] In some embodiments, the scoring model can be a model that takes two vectors as input and outputs a scalar score. The scoring model can perform interactive operations on the policy vector and the content block vector, and the resulting score reflects the degree of adaptation between the transformation method represented by the policy vector and the content semantics and presentation form represented by the content block vector. The higher the score, the more suitable the corresponding adaptation strategy is for transforming the target content block.
[0065] For example, the scoring model can obtain a score by calculating the similarity between the policy vector and the content block vector. This can be achieved by mapping the two vectors to the same representation space and then calculating their inner product or cosine similarity as the score. Alternatively, the scoring model can be implemented using a neural network. For instance, the policy vector and content block vector can be concatenated and input into a multilayer perceptron, which then outputs the score. In some embodiments, the scoring model can be trained based on samples labeled with whether or not it fits or the degree of fit, aligning the score output by the scoring model with the actual fit after the adaptation policy is applied to the content block.
[0066] In some embodiments, in step S304, the adaptation strategy with the highest score can be determined as the target adaptation strategy, or each adaptation strategy can be further processed and selected based on the score.
[0067] According to some embodiments, the scoring model may include a learned bilinear matrix. Step S303, processing the policy vector and content block vector of each adaptation strategy using the scoring model to obtain the score of the adaptation strategy may include (not shown in the figure): performing bilinear operations on the policy vector and content block vector of each adaptation strategy based on the learned bilinear matrix to obtain the score of the adaptation strategy.
[0068] Therefore, by performing bilinear operations on the strategy vector and content block vector using a bilinear matrix, the interaction between different dimensions of the strategy vector and content block vector can be modeled, thereby more fully depicting the matching relationship between the adaptation strategy and the content block and improving the accuracy of the scoring.
[0069] In some embodiments, the bilinear operation can be represented as the sequential multiplication of the transpose of the policy vector, the bilinear matrix, and the content block vector. The bilinear matrix is a learnable parameter matrix that can be updated independently during the training phase or along with the policy network described below.
[0070] For example, the bilinear matrix can be initialized as the sum of the identity matrix and a small random perturbation, making the bilinear operation equivalent to the inner product scoring of the policy vector and the content block vector in the initial stage, and gradually learning the asymmetric interaction between the two during training. In an exemplary embodiment, the training objective of the bilinear matrix may include a regression objective and a ranking objective, wherein the regression objective aligns the score with the actual adaptation quality of the corresponding adaptation policy, and the ranking objective ensures that the score of the adaptation policy that matches the content block is higher than the score of the adaptation policy that does not match.
[0071] Figure 4 A flowchart of a process 400 for determining a target adaptation strategy based on a score, according to an exemplary embodiment of the present disclosure, is shown. Process 400 can be used to implement step S304 of process 300 described above. Figure 4 As shown, process 400 may include: step S401, obtaining the terminal capability vector of the target terminal, the terminal capability vector representing the presentation form supported by the target terminal; step S402, inputting the content block vector, target rendering intent, terminal capability vector and the scores of each adaptation strategy in the adaptation strategy set into the strategy network to obtain the probability distribution of each adaptation strategy output by the strategy network; and step S403, determining the target adaptation strategy in the adaptation strategy set based on the probability distribution.
[0072] Therefore, by using a policy network to comprehensively process the content block vector, target rendering intent, terminal capability vector, and scores of various adaptation strategies, the determination of the target adaptation strategy takes into account the content semantics and presentation form of the target content block, the presentation function of the target content block, the presentation capability of the target terminal, and the matching degree between each adaptation strategy and the target content block. This improves the accuracy of strategy determination and enhances the matching degree between the determined target adaptation strategy and the presentation capability of the target terminal.
[0073] In some embodiments, the terminal capability vector can be a multi-dimensional vector, where each dimension corresponds to a presentation format, and the value of the dimension represents whether the target terminal supports the corresponding presentation format.
[0074] In some embodiments, a predetermined number of adaptation strategies with higher scores can be selected from the set of adaptation strategies based on their scores. The scores of these selected strategies are then input into a policy network, which outputs a probability distribution for the selected strategies. This preliminary selection based on scores reduces the number of strategies the policy network needs to process, saving computational overhead in determining the target adaptation strategy.
[0075] In some embodiments, the content block vector, the representation of the target rendering intent, the terminal capability vector, and the scores of each adaptation strategy can be concatenated into an input vector, which is then input into the policy network. The policy network can be implemented using a multilayer perceptron, and the output layer of the policy network can output the probability distribution for each adaptation strategy through a normalized exponential function.
[0076] In some embodiments, in step S403, the adaptation strategy with the highest probability in the probability distribution can be determined as the target adaptation strategy.
[0077] According to some embodiments, the policy network can be trained through reinforcement learning, which is performed based on sample content blocks and a sample adaptation policy selected for the sample content blocks. The reward for reinforcement learning can be determined based on the following: fidelity reward, which represents the fidelity of the content block after transformation according to the sample adaptation policy; latency reward, which represents the time spent transforming and presenting the sample content block according to the sample adaptation policy; and user behavior reward, which represents the user's feedback behavior on the presentation result of the sample content block after transformation based on the sample adaptation policy.
[0078] Therefore, by training the policy network in reinforcement learning by integrating rewards from three aspects—content fidelity, the time spent on transformation and presentation, and user feedback—the policy network can simultaneously consider the quality of the transformed content, presentation efficiency, and the user's actual experience during the learning process. Compared to training based on only a single objective, the policy network trained in this way can achieve a balance in multiple aspects, thus improving the overall quality of policy determination.
[0079] In some embodiments, the sample content block can be a content block segmented from a sample document, and the sample adaptation strategy can be an adaptation strategy selected by the policy network based on probability distribution sampling during training. Sampling based on probability distribution during the training phase, rather than directly selecting the adaptation strategy with the highest probability, preserves the exploratory nature of different adaptation strategies.
[0080] In some embodiments, the fidelity reward can be determined by comparing the transformed sample content block with the sample content block before transformation. For example, for text-based content blocks, the fidelity can be determined based on edit distance; for media-based content blocks, the fidelity can be determined based on structural similarity; and for layout-based content blocks, the fidelity can be determined based on structural difference.
[0081] In some embodiments, the latency reward can be determined based on a comparison between the estimated rendering time and the target rendering time. When the estimated rendering time exceeds the target rendering time, a penalty corresponding to the degree of excess can be imposed. For example, the target rendering time can be determined according to the device level of the target terminal, with different device levels corresponding to different target rendering times.
[0082] In some embodiments, user behavior rewards can be determined based on historical behavioral signals of the user regarding the presented results. Exemplarily, historical behavioral signals may include one or more of the following: user dwell time on the presented results, page turning depth, number of zoom operations, sharing or exporting of the corresponding document, immediately closing or returning to the document after opening it, and whether the user views the document on another device. Dwell time, page turning depth, and sharing or exporting can serve as positive signals; immediately closing or returning to the document and viewing it on another device can serve as negative signals; and the number of zoom operations can serve as a signal reflecting content visibility needs.
[0083] According to some embodiments, the reward for reinforcement learning can be determined by weighting a fidelity reward, a latency reward, and a user behavior reward based on a weight combination, which can be determined based on the rendering intent of the sample content block.
[0084] Therefore, by determining the weight combination used for weighted combination based on the rendering intent of sample content blocks, sample content blocks with different presentation functions correspond to different optimization focuses during training. The policy network can learn the policy selection method that is adapted to the presentation function of the content block, thereby improving the pertinence of the trained policy network in determining the appropriate policy for content blocks with different presentation functions.
[0085] In some embodiments, corresponding weight combinations can be pre-configured for different rendering intentions. For example, for sample content blocks that carry the core content of a document, a larger weight can be assigned to the fidelity reward in the weight combination to focus on ensuring the fidelity of the transformed content; for sample content blocks that are sensitive to rendering time, a larger weight can be assigned to the latency reward in the weight combination to focus on controlling the time spent on transformation and rendering; for sample content blocks that depend on user operations, a larger weight can be assigned to the user behavior reward in the weight combination to focus on improving the user's actual user experience.
[0086] Figure 5 A flowchart of a document processing method 500 according to an exemplary embodiment of the present disclosure is shown. The operations of steps S501 to S505 and steps S507 to S508 in method 500 can be referred to the description above of steps S201 to S207 in method 200. Step S505 may include: determining the rendering intent category to which the target content block belongs from a plurality of preset rendering intent categories, as the target rendering intent.
[0087] like Figure 5 As shown, method 500 may include: step S506, filtering the adaptation strategies included in the adaptation strategy set based on the filtering conditions associated with the target rendering intent, wherein the target adaptation strategy for the target content block is determined in the filtered adaptation strategy set.
[0088] Therefore, by limiting the determination of rendering intent to multiple preset rendering intent categories, the presentation effects of different content blocks can be distinguished and processed using a unified category system. Furthermore, by filtering the set of adaptation strategies based on filtering conditions associated with the target rendering intent, adaptation strategies that are inconsistent with the presentation effects of the target content block can be pre-excluded before the target adaptation strategy is determined. This prevents such adaptation strategies from being selected as the target adaptation strategy, thereby improving the matching degree between the target adaptation strategy and the presentation effects of the target content block, narrowing the selection range when determining the target adaptation strategy, and saving computational overhead.
[0089] In some embodiments, the multiple rendering intent categories may be pre-defined categories based on the presentation role played by content blocks in the document. In an exemplary embodiment, the multiple rendering intent categories may include multiple of the following: structural categories representing the document structure, semantic categories representing the core content of the document, decorative categories representing visual style, and interactive categories representing user interaction dependencies. For example, content blocks containing titles and tables of contents may belong to structural categories, content blocks carrying body text and data may belong to semantic categories, content blocks containing separators and decorative images used only for visual enhancement may belong to decorative categories, and content blocks containing forms and playable media may belong to interactive categories.
[0090] In some embodiments, step S505 can be performed using a trained classification model, by inputting the content block vector obtained through joint encoding as described above into the classification model, obtaining the probability distribution of the target content block across multiple rendering intent categories, and determining the rendering intent category with the highest probability as the rendering intent category to which the target content block belongs. For example, the classification model can be implemented using a multilayer perceptron.
[0091] In some embodiments, filtering conditions are used to instruct the filtering of adaptation strategies that are unsuitable for the corresponding rendering intent category from the set of adaptation strategies. Associated filtering conditions can be pre-configured for each of the multiple rendering intent categories. It is understood that some rendering intent categories may have empty filtering conditions, meaning that no filtering of the set of adaptation strategies is performed for such rendering intent categories. For example, the content blocks of the decoration category allow for a greater degree of variation, and the filtering conditions associated with the decoration category may be empty.
[0092] According to some embodiments, multiple rendering intent categories may include structural categories that characterize the document structure, and filtering conditions associated with structural categories may indicate the filtering out of adaptation policies that indicate hiding or masking content blocks in the adaptation policy set.
[0093] Therefore, for target content blocks belonging to the structural category, filtering out adaptation strategies that indicate hiding or masking content blocks can prevent content blocks that play a role in organizing the document from being hidden or masked during transformation, ensuring the integrity of the document structure in the target document. This allows users to still browse and understand the target document based on the complete document structure on the target terminal, thus improving the user experience.
[0094] In some embodiments, the adaptation strategy of hiding or masking content blocks refers to the indicated transformation method being an adaptation strategy that does not display the corresponding content blocks. It can be understood that if content blocks belonging to structural categories such as titles and tables of contents are hidden or masked during transformation, the hierarchical organization of the target document will be difficult to understand. Therefore, such adaptation strategies are excluded in advance through filtering conditions.
[0095] According to some embodiments, multiple rendering intent categories may include semantic categories representing the core content of the document. The document processing method may further include: in response to the target rendering intent being a semantic category, obtaining a fidelity prediction value for each adaptation strategy in a set of adaptation strategies, whereby the fidelity prediction value represents the content fidelity of the content block obtained after transforming the target content block according to the corresponding adaptation strategy. Filtering conditions associated with the semantic category may instruct the filtering out of adaptation strategies in the set of adaptation strategies whose fidelity prediction values are lower than a preset threshold.
[0096] Therefore, for target content blocks belonging to semantic categories, filtering the set of adaptation strategies based on the fidelity prediction value can preemptively exclude adaptation strategies that may cause insufficient content fidelity before the actual transformation is performed. This avoids content loss in content blocks carrying the core content of the document during transformation, ensuring the fidelity of the core content in the target document and thus improving the user experience.
[0097] In some embodiments, the fidelity prediction value is a prediction of the fidelity of the transformed content before the actual transformation is performed. It is understood that for content blocks carrying the core content of a document, the fidelity of the transformed content directly affects the user's understanding of the document content; therefore, a fidelity prediction value reaching a preset threshold is used as a condition for the adaptation strategy to be applicable. For example, the preset threshold can be set according to the requirements for content fidelity, such as 0.9.
[0098] Figure 6 A flowchart of a process 600 for obtaining a fidelity prediction value according to an exemplary embodiment of the present disclosure is shown. Process 600 can be used to implement the steps described above for obtaining the fidelity prediction value for each adaptation strategy in the adaptation strategy set. Figure 6 As shown, process 600 may include: step S601, obtaining the content block vector of the target content block, which is obtained by jointly encoding the content information and presentation format information of the target content block; step S602, obtaining the strategy vector of each adaptation strategy in the adaptation strategy set, which is obtained by encoding the description information of the corresponding adaptation strategy; step S603, obtaining the terminal capability vector of the target terminal, which represents the presentation format supported by the target terminal; and step S604, inputting the strategy vector, content block vector and terminal capability vector of the corresponding adaptation strategy into the fidelity regression model to obtain the fidelity prediction value of the corresponding adaptation strategy output by the fidelity regression model.
[0099] Therefore, the acquisition of fidelity prediction values takes into account the transformation method indicated by the adaptation strategy, the content semantics and presentation form of the target content block, and the presentation form supported by the target terminal. This allows the same content block to obtain different fidelity prediction values under different adaptation strategies or different target terminals, thereby improving the accuracy of the fidelity prediction values in predicting the actual transformation results.
[0100] In some embodiments, the fidelity regression model can be a regression model that takes a policy vector, a content block vector, and a terminal capability vector as inputs and outputs a fidelity prediction value. The fidelity regression model can be trained based on training samples with fidelity labels. In some embodiments, the fidelity labels of the training samples can be automatically generated through rendering simulation; that is, rendering simulation is performed on the sample content blocks according to the corresponding adaptation strategy under the corresponding terminal conditions, and the fidelity labels are determined based on the simulation results.
[0101] For example, the fidelity label can be determined based on one or more of the following: content retention rate, layout offset, and interactive feature retention rate. The content retention rate can be determined based on the ratio of the number of content blocks that can be displayed after the transformation to the total number of content blocks. The layout offset can be determined based on the degree of offset of the paragraph positions before and after the transformation. The interactive feature retention rate can be determined based on the ratio of the number of interactive components that are available after the transformation to the total number of interactive components.
[0102] In some embodiments, the fidelity predictions output by the fidelity regression model can be used not only for filtering under semantic categories, but also as a source of fidelity rewards in reinforcement learning. That is, during the training phase, the fidelity predictions output by the fidelity regression model for sample content blocks and sample adaptation strategies are used as fidelity rewards, thereby eliminating the need to actually perform transformations on the sample content blocks during the training phase and saving computational overhead during the training phase.
[0103] In some embodiments, the encoding model described above for performing joint encoding can be obtained by joint pre-training through multiple training tasks. The multiple training tasks share the network backbone of the encoding model, so that the content block vector output by the encoding model has the representational capabilities corresponding to multiple training tasks.
[0104] In some embodiments, in a contrastive learning task, multiple versions of the same sample document with different presentation styles can be used as positive sample pairs, and different sample documents can be used as negative sample pairs. The encoding model is trained so that the content block vectors of positive sample pairs are close to each other, and the content block vectors of negative sample pairs are far apart, thereby maintaining the consistency of the semantic representation of the content under different presentation styles. For example, multiple versions of the same sample document with different presentation styles can be generated by automatically transforming the presentation styles of the sample document using a transformation tool. In some embodiments, the training corpus can be stratified according to the richness of presentation style information in the sample documents, so that sample documents with more complex presentation styles maintain a certain proportion in the training corpus, thereby improving the encoding model's ability to represent complex presentation styles.
[0105] In some embodiments, in a fidelity prediction task, an encoding model can be trained to predict the corresponding fidelity prediction value based on descriptive information of content blocks, terminal capability vectors, and adaptation strategies. In an exemplary embodiment, the fidelity regression model described above can be obtained by reusing network parameters pre-trained through a fidelity prediction task, or it can be implemented by connecting a regression output layer to the network backbone of the encoding model, thereby enabling fidelity prediction and joint encoding to share the same representation basis.
[0106] In some embodiments, in a presentation form prediction task, partial presentation form information of a sample content block can be obscured. The encoding model is then trained to predict the obscured presentation form information based on the unobscured information, thereby enabling the encoding model to learn the type semantics of the presentation form information and its association with the content information. For example, a certain proportion of sample content blocks can be randomly selected, and one or more categories of the presentation form information of the selected sample content blocks can be randomly obscured according to their categories. The encoding model then predicts the category and value of the obscured presentation form information.
[0107] In some embodiments, the losses of multiple training tasks can be weighted and summed to obtain the total loss of joint pre-training. The weights corresponding to the losses of each training task can be dynamically adjusted during training based on the gradient norm of each training task, thereby avoiding a single training task from dominating the training direction and improving the convergence stability of joint pre-training.
[0108] According to another aspect of this disclosure, a document processing apparatus is provided. For example... Figure 7 As shown, the device 700 includes: a segmentation unit 710 configured to acquire an original document and segment the original document to obtain multiple content blocks; a first acquisition unit 720 configured to acquire content information and presentation format information of the multiple content blocks, wherein the presentation format information represents the visual form in which the corresponding content block is presented; a second acquisition unit 730 configured to acquire an adaptation strategy set corresponding to a target terminal, wherein the adaptation strategy set includes multiple preset adaptation strategies, each adaptation strategy indicating a transformation method for the presentation format of the content block so that the transformed presentation format can be supported by the target terminal; and a processing unit 7. 40 is configured to use each of a plurality of content blocks as a target content block and perform operations using the following subunits: an intent determination subunit 741, configured to determine the target rendering intent of the target content block based on the content information and presentation format information of the target content block; a strategy determination subunit 742, configured to determine the target adaptation strategy for the target content block in the adaptation strategy set based on the target rendering intent; and a transformation unit 750, configured to transform the corresponding content blocks based on the transformation method indicated by the target adaptation strategies of the plurality of content blocks respectively, to obtain a target document corresponding to the original document.
[0109] It is understood that the operation and effects of units 710 to 750 and sub-units 741 to 742 in device 700 can be referred to the description of steps S201 to S207 above, and will not be repeated here.
[0110] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0111] According to embodiments of this disclosure, an electronic device, a readable storage medium, and a computer program product are also provided.
[0112] refer to Figure 8 The present invention describes a structural block diagram of an electronic device 800 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0113] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. The RAM 803 may also store various programs and data required for the operation of the electronic device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0114] Multiple components in electronic device 800 are connected to I / O interface 805, including: input unit 806, output unit 807, storage unit 808, and communication unit 809. Input unit 806 can be any type of device capable of inputting information to electronic device 800. Input unit 806 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device, and can include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 807 can be any type of device capable of presenting information, and can include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 808 can include, but is not limited to, disk and optical disk. Communication unit 809 allows electronic device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and can include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0115] The computing unit 801 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods, processes, and / or processing described above. For example, in some embodiments, these methods, processes, and / or processing may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods, processes, and / or processing described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform these methods, processes, and / or processing by any other suitable means (e.g., by means of firmware).
[0116] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0117] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0118] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0119] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0120] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), the Internet, and blockchain networks.
[0121] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is established by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0122] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0123] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.
Claims
1. A document processing method, comprising: Obtain the original document and segment it to obtain multiple content blocks; Obtain the content information and presentation format information of the multiple content blocks, wherein the presentation format information represents the visual form in which the corresponding content block is presented; Obtain a set of adaptation strategies corresponding to the target terminal. The set of adaptation strategies includes multiple preset adaptation strategies. Each adaptation strategy indicates a transformation method for the presentation form of the content block so that the transformed presentation form can be supported by the target terminal. For each of the plurality of content blocks, take it as the target content block and perform the following operations: The target rendering intent of the target content block is determined based on its content information and presentation format information. as well as Based on the target rendering intent, a target adaptation strategy for the target content block is determined from the set of adaptation strategies. as well as Based on the transformation method indicated by the target adaptation strategy of each of the multiple content blocks, the corresponding content blocks are transformed to obtain the target document corresponding to the original document.
2. The method according to claim 1, wherein, Based on the target rendering intent, the target adaptation strategy determined in the adaptation strategy set for the target content block includes: Obtain the content block vector of the target content block, wherein the content block vector is obtained by jointly encoding the content information and presentation format information of the target content block; Obtain the policy vector for each adaptation strategy in the adaptation strategy set, wherein the policy vector is obtained by encoding the description information of the corresponding adaptation strategy; A scoring model is used to process the strategy vector and the content block vector of each adaptation strategy to obtain a score for that adaptation strategy. The score characterizes the degree of matching between the adaptation strategy and the target content block. Based on the score of each adaptation strategy, the target adaptation strategy is determined in the set of adaptation strategies.
3. The method according to claim 2, wherein, The scoring model includes a learned bilinear matrix. The scoring model is used to process the strategy vector and the content block vector for each adaptation strategy to obtain a score for that adaptation strategy, including: Based on the learned bilinear matrix, a bilinear operation is performed on the policy vector and the content block vector of each adaptation strategy to obtain the score of the adaptation strategy.
4. The method according to claim 2, wherein, Based on the score of each adaptation strategy, the target adaptation strategy is determined from the set of adaptation strategies, including: Obtain the terminal capability vector of the target terminal, wherein the terminal capability vector represents the presentation formats supported by the target terminal; The content block vector, the target rendering intent, the terminal capability vector, and the scores of each adaptation strategy in the adaptation strategy set are input into the policy network to obtain the probability distribution of each adaptation strategy output by the policy network; and Based on the probability distribution, the target adaptation strategy is determined from the set of adaptation strategies.
5. The method according to claim 4, wherein, The policy network is trained through reinforcement learning, which is executed based on sample content blocks and sample-adapted policies selected for those blocks. The reward for reinforcement learning is determined based on the following factors: The fidelity reward represents the degree of fidelity of the sample content block after it has been transformed according to the sample adaptation strategy. Delayed reward represents the time consumed in transforming and presenting the sample content block according to the sample adaptation strategy; as well as User behavior rewards represent user feedback behavior on the presentation results after the sample content blocks are transformed based on the sample adaptation strategy.
6. The method according to claim 5, wherein, The reward for reinforcement learning is determined by weighting the fidelity reward, the latency reward, and the user behavior reward, and the weighting is determined based on the rendering intent of the sample content block.
7. The method according to any one of claims 1 to 6, wherein, Determining the target rendering intent of the target content block based on its content information and presentation format information includes: The target content block is determined from a set of preset rendering intent categories to identify its corresponding rendering intent category. The method further includes: The adaptation strategies included in the adaptation strategy set are filtered based on the filtering conditions associated with the target rendering intent, wherein the target adaptation strategy for the target content block is determined from the filtered adaptation strategy set.
8. The method according to claim 7, wherein, The plurality of rendering intent categories include structural categories that characterize document structure, and the filtering conditions associated with the structural categories indicate that adaptation strategies that indicate hiding or masking content blocks should be filtered out in the adaptation strategy set.
9. The method according to claim 7, wherein, The multiple rendering intent categories include semantic categories that characterize the core content of the document, and the method further includes: In response to the target rendering intent being the semantic category, a fidelity prediction value is obtained for each adaptation strategy in the adaptation strategy set. The fidelity prediction value represents the content fidelity of the content block obtained after transforming the target content block according to the corresponding adaptation strategy. The filtering conditions associated with the semantic category indicate that adaptation strategies with fidelity prediction values lower than a preset threshold are filtered out from the set of adaptation strategies.
10. The method according to claim 9, wherein, Obtaining the fidelity prediction value for each adaptation strategy in the adaptation strategy set includes: Obtain the content block vector of the target content block, wherein the content block vector is obtained by jointly encoding the content information and presentation format information of the target content block; Obtain the policy vector for each adaptation strategy in the adaptation strategy set, wherein the policy vector is obtained by encoding the description information of the corresponding adaptation strategy; Obtain the terminal capability vector of the target terminal, wherein the terminal capability vector represents the presentation formats supported by the target terminal; and The corresponding adaptation strategy's strategy vector, the content block vector, and the terminal capability vector are input into the fidelity regression model to obtain the fidelity prediction value of the corresponding adaptation strategy output by the fidelity regression model.
11. The method according to any one of claims 1 to 6, further comprising: The target document is displayed on the target terminal.
12. A document processing apparatus, comprising: The segmentation unit is configured to acquire the original document and segment the original document to obtain multiple content blocks; The first acquisition unit is configured to acquire content information and presentation format information of the plurality of content blocks, wherein the presentation format information characterizes the visual form in which the corresponding content block is presented. The second acquisition unit is configured to acquire an adaptation strategy set corresponding to the target terminal. The adaptation strategy set includes multiple preset adaptation strategies, each of which indicates a transformation method for the presentation form of a content block so that the transformed presentation form can be supported by the target terminal. The processing unit is configured to take each of the plurality of content blocks as a target content block and perform operations using the following subunits: The intent determination subunit is configured to determine the target rendering intent of the target content block based on the content information and presentation format information of the target content block. as well as The strategy determination subunit is configured to determine a target adaptation strategy for the target content block from the set of adaptation strategies based on the target rendering intent. as well as The transformation unit is configured to transform the corresponding content blocks according to the transformation method indicated by the target adaptation strategy of each of the plurality of content blocks, so as to obtain the target document corresponding to the original document.
13. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.
15. A computer program product comprising a computer program, wherein, When the computer program is executed by a processor, it implements the method of any one of claims 1-11.
