Text processing method and device and related product
Through a large language model, the semantic information of the story text is analyzed and the layout parameters are automatically adjusted, which solves the problem of inefficient manual adjustment of the layout parameters by the story author, and improves the layout efficiency and reading experience of the text.
Patent Information
- Application Number
- CN202510246344.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-05-13
AI Technical Summary
When writing story text, story authors need to manually adjust the layout parameters to adapt to the display parameters of different terminals, resulting in inefficient layout and poor reading experience.
The semantic information of the story text is analyzed through a large language model, the target layout parameters are automatically determined, and the difference information between the initial layout parameters and the target layout parameters is calculated to achieve automated layout.
Improves text layout efficiency and reading experience, and reduces the time and effort of manual adjustment.
Smart Images

Figure CN119990090A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a text processing method, device and related products. Background Art
[0002] In the related art, when a story author writes a story text, he or she manually typesets the story text according to editing habits, for example, manually sets parameters such as font, font size, line spacing, etc., and publishes the typeset story text to the Internet. Readers can browse the story text published by the story author through a mobile terminal such as an e-book reader in a mobile phone. On the one hand, when the story author typesets the story text, he or she usually typesets the story text according to the display parameters of the editing device of the story text, such as a computer, which causes the typesetting parameters of the story text to not match the display parameters of the mobile terminal when the reader reads the story text in the mobile terminal, thereby reducing the text reading experience. On the other hand, if the story author manually typesets the story text according to the display parameters of the mobile terminal, it will take a long time to achieve the ideal typesetting effect, resulting in low typesetting efficiency of the story text. Summary of the invention
[0003] The embodiments of the present disclosure provide a text processing method, device and related products, which can automatically typeset story texts, improve text typesetting efficiency, and enhance text browsing experience.
[0004] In a first aspect, an embodiment of the present disclosure provides a text processing method, including: Acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; If a browsing request for the first text from the browsing terminal is obtained, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0005] In a second aspect, an embodiment of the present disclosure provides a text processing device, including: A text acquisition unit, configured to acquire a first text; the first text includes a story text typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; A text typesetting unit, configured to determine target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determine typesetting difference information between the initial typesetting parameters and the target typesetting parameters; A text response unit is used to adjust the layout of the first text according to the layout difference information to obtain a second text if a browsing request for the first text is obtained from the browsing terminal, and respond to the browsing request based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0006] In a third aspect, an embodiment of the present disclosure provides an electronic device, comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, enable the processor to implement the method described in the first aspect above.
[0007] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions implement the method described in the first aspect when executed by a processor.
[0008] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0009] In one or more embodiments of the present disclosure, first, a first text is obtained, the first text including a story text typeset based on initial typesetting parameters, the format of the first text being a text format corresponding to a browsing terminal of the first text, then, through a large language model, based on semantic information of the first text, target typesetting parameters of the first text that match the browsing terminal are determined, and typesetting difference information between the initial typesetting parameters and the target typesetting parameters is determined, and finally, if a browsing request for the first text is obtained from the browsing terminal, the first text is typeset according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text, the text content of the second text being the same as the text content of the first text, and the format of the second text being a text format corresponding to the browsing terminal. It can be seen that through this embodiment, the target typesetting parameters can be determined for the first text through the large language model, and the typesetting difference information between the initial typesetting parameters of the first text and the target typesetting parameters can be determined, so that when a browsing request for the first text is received, the first text is typeset based on the typesetting difference information to obtain a second text with a better typesetting effect, and the above browsing request is responded to based on the second text, thereby realizing the automatic typesetting of the story text, improving the text typesetting efficiency and text typesetting effect, and improving the text browsing experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in one or more embodiments of the present disclosure or related technologies, the drawings required for use in the description of the embodiments or related technologies are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative labor. Figure 1 A flowchart of a text processing method provided by an embodiment of the present disclosure; Figure 2 A flowchart of a text processing method provided by another embodiment of the present disclosure; Figure 3 A schematic diagram of a DOM tree of a first text provided by an embodiment of the present disclosure; Figure 4 A schematic diagram of comparing a first text and a second text provided in an embodiment of the present disclosure; Figure 5 A schematic diagram of an application scenario of a text processing method provided by an embodiment of the present disclosure; Figure 6 A schematic diagram of the structure of a text processing device provided by an embodiment of the present disclosure; Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of the present disclosure. DETAILED DESCRIPTION
[0011] In order to enable those skilled in the art to better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on one or more embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the protection scope of the present disclosure.
[0012] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the information involved in the present disclosure should be informed to the relevant parties and their authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0013] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0014] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0015] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0016] The disclosed embodiment provides a text processing method that can automatically typeset text, improve text typesetting efficiency, and improve text browsing experience. The method can be applied to and executed by a server, which can be a single server or a server cluster.
[0017] Figure 1 A flowchart of a text processing method provided by an embodiment of the present disclosure is shown in FIG. Figure 1 As shown, the method includes: Step S102, obtaining a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Step S104, determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through the large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; Step S106: If a browsing request for the first text is obtained from the above-mentioned browsing terminal, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the above-mentioned browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the above-mentioned browsing terminal.
[0018] In the disclosed embodiment, first, a first text is obtained, the first text includes a story text that is typeset based on initial typesetting parameters, and the format of the first text is a text format corresponding to the browsing terminal of the first text. Then, through a large language model, based on the semantic information of the first text, target typesetting parameters of the first text that match the browsing terminal are determined, and typesetting difference information between the initial typesetting parameters and the target typesetting parameters is determined. Finally, if a browsing request for the first text is obtained from the browsing terminal, the first text is typeset according to the typesetting difference information to obtain a second text. The browsing request is responded to based on the second text. The text content of the second text is the same as the text content of the first text, and the format of the second text is a text format corresponding to the browsing terminal. It can be seen that through this embodiment, the target typesetting parameters can be determined for the first text through the large language model, and the typesetting difference information between the initial typesetting parameters of the first text and the target typesetting parameters can be determined, so that when a browsing request for the first text is received, the first text is typeset based on the typesetting difference information to obtain a second text with a better typesetting effect, and the above browsing request is responded to based on the second text, thereby realizing the automatic typesetting of the story text, improving the text typesetting efficiency and text typesetting effect, and improving the text browsing experience.
[0019] In the above step S102, a first text is obtained, and the first text is a story text that is typeset based on the initial typesetting parameters. In one example, the first text can be a novel written by an author and uploaded to the server. The first text has a corresponding browsing terminal, which refers to a terminal used by readers of the first text to browse the first text. The browsing terminal corresponding to the first text can be exemplified by a smart phone. Of course, the first text also has a corresponding editing device, and the author writes the first text through the editing device, and the editing device can be exemplified by a computer. The format of the first text is the text format corresponding to the browsing terminal of the first text, and the format of the first text can be any one of HTML (HyperText Markup Language), XML (Extensible Markup Language), and JSON (JavaScript Object Notation). The initial typesetting parameters are the typesetting parameters set by the author of the first text for the first text, and the initial typesetting parameters include at least one of the font, font size, text color, segment position, line spacing, and paragraph spacing of the first text.
[0020] In the above step S104, the target typesetting parameters of the first text that match the above browsing terminal are determined based on the semantic information of the first text through the large language model. Large Language Model (LLM) generally refers to a pre-trained language model with a large number of parameters and layers, such as the Generative Pre-trained Transformer (GPT) series and the Bidirectional Encoder Representations (BERT) series. These models can learn the grammar, semantics and contextual information of the language by pre-training on a large-scale corpus, thereby providing strong support for various natural language processing tasks.
[0021] In this embodiment, the semantic understanding ability of the large language model is used to determine the target typesetting parameters of the first text that match the above-mentioned browsing terminal according to the semantic information of the first text. The target typesetting parameters include at least one of font, font size, text color, segment position, line spacing, and paragraph spacing. By determining the target typesetting parameters for the first text, when the reader browses the first text through the browsing terminal, the first text can present a better reading effect based on the target typesetting parameters, thereby improving the browsing experience of the first text.
[0022] In one embodiment, determining the target layout parameters of the first text that match the browsing terminal based on the semantic information of the first text through the large language model includes: Determine a paragraph in the first text whose text length exceeds a first length threshold as a first target paragraph; the first length threshold is determined according to a display parameter of a browsing terminal; Using a large language model, based on semantic information of each sentence in the first target paragraph, the first target paragraph is split into a plurality of sub-paragraphs; each sub-paragraph contains at least one sentence that is semantically related to each other and the text length of each sub-paragraph is less than a second length threshold; the second length threshold is determined according to a display parameter of the browsing terminal; Determine the target layout parameters based on the segmentation position of the sub-paragraph.
[0023] In this embodiment, first, a first target paragraph that needs to be reformatted and a second target paragraph that does not need to be reformatted are determined in the first text. The number of the first target paragraphs is one or more, and the first target paragraphs can be paragraphs whose text length exceeds a first length threshold. The number of the second target paragraphs is one or more, and the second target paragraphs can be paragraphs whose text length does not exceed the first length threshold. The first length threshold is a set value determined according to display parameters of the browsing terminal, such as screen width.
[0024] Then, for each first target paragraph, each first target paragraph is input into the large language model, and the semantic information of each sentence in the first target paragraph is identified through the large language model, and the first target paragraph is split into a plurality of sub-paragraphs according to the semantic information of each sentence. Each sub-paragraph contains at least one sentence that is semantically related to each other and the text length of each sub-paragraph is less than a second length threshold. The second length threshold is a set value determined according to display parameters of the browsing terminal such as screen width. The large language model can output each sub-paragraph corresponding to each first target paragraph.
[0025] For example, the first target paragraph contains 500 characters, which exceeds the first length threshold of 150 characters. The first target paragraph is split into multiple sub-paragraphs through the large language model, each sub-paragraph contains one or more sentences that are semantically related to each other, and the text length of each sub-paragraph is less than the second length threshold of 150 characters. The large language model outputs each sub-paragraph corresponding to the first target paragraph. Through this step, the first target paragraph can be split based on the semantic information of the first target paragraph and the display parameters of the browsing terminal to obtain multiple sub-paragraphs corresponding to the first target paragraph.
[0026] Finally, the target layout parameters are determined based on the segmentation positions of the subparagraphs. Since the above steps only re-segment the first target paragraph, the segmentation positions of each subparagraph corresponding to each first target paragraph, the initial layout parameters of each subparagraph other than the segmentation positions, and the initial layout parameters of each second target paragraph are collectively determined as the target layout parameters.
[0027] In one example, a first text is input into a large language model, and the large language model determines a first length threshold and a second length threshold according to display parameters of a browsing terminal, such as screen width. Through the above process, a first target paragraph and a second target paragraph are determined in the first text, and the first target paragraph is re-divided to obtain a plurality of sub-paragraphs, and the segmentation positions of each sub-paragraph and the segmentation position of the second target paragraph are output as target typesetting parameters. In this example, the correspondence between the screen width range of the browsing terminal, the first length threshold, and the second length threshold can be pre-set, and the first length threshold and the second length threshold are determined based on the correspondence.
[0028] It can be seen that through this embodiment, a first target paragraph with a longer text length can be identified in the first text, and the first target paragraph can be split to obtain sub-paragraphs. According to the segmentation position of each sub-paragraph, the target typesetting parameters are determined, so that after the first text is typeset according to the target typesetting parameters, the first text does not contain text paragraphs with a longer length, thereby improving the typesetting effect and browsing experience of the first text, and, by determining the first length threshold and the second length threshold according to the display parameters of the browsing terminal, the target typesetting parameters can be matched with both the semantic information of the first text and the browsing terminal, thereby improving the reader's experience of browsing the first text based on the browsing terminal.
[0029] In another embodiment, determining target layout parameters of the first text that match the browsing terminal based on the semantic information of the first text through the large language model includes: Determine, by means of a large language model, at least one of a font, a font size, a text color, a segment position, a line spacing, and a paragraph spacing of the first text that matches the browsing terminal based on the semantic information of each sentence in the first text; Through the large language model, the target typesetting parameters are generated according to the determined information.
[0030] In this embodiment, the first text is input into the large language model, and the semantic information of each sentence in the first text is analyzed through the large language model. Based on the semantic information of each sentence in the first text, at least one of the font, font size, text color, segment position, line spacing, and paragraph spacing of the first text that matches the browsing terminal is determined, and the determined information is output as the target typesetting parameter through the large language model.
[0031] Among them, the large language model can determine the text type of the first text according to the semantic information of each sentence in the first text, and then determine the font, font size, text color, segmentation position, line spacing, and paragraph spacing that match the display parameters of the browsing terminal. For example, when the first text is determined to be an ancient romance story according to the semantic information of each sentence in the first text, the font that matches the display parameters of the browsing terminal is Songti, the font size is No. 4, the text color is black, the segmentation position ensures that the text length of each paragraph does not exceed 250 characters, the line spacing is 23 pounds, and the paragraph spacing is 0.5 lines. For another example, when the first text is determined to be a modern romance story according to the semantic information of each sentence in the first text, the font that matches the display parameters of the browsing terminal is Kaiti, the font size is No. 18, the text color is brown-black, the segmentation position ensures that the text length of each paragraph does not exceed 150 characters, the line spacing is 25 pounds, and the paragraph spacing is 1 line.
[0032] It can be seen that through this embodiment, based on the semantic information of each sentence in the first text, at least one of the font, font size, text color, segment position, line spacing, and paragraph spacing of the first text that matches the browsing terminal can be determined, and then the target typesetting parameters can be determined, thereby achieving the effect of utilizing the semantic understanding ability of the large language model to determine precisely matching typesetting parameters for the first text.
[0033] In one embodiment, after determining the target layout parameters of the first text that match the browsing terminal, the following process may also be performed: Typesetting the first text based on the target typesetting parameters to obtain a typeset text; Comparing the content of the typeset text with the text content of the first text to see if they are the same; If they are the same, the target typesetting parameters are retained; if they are different, the step of returning to the step of determining the target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through the large language model is repeated.
[0034] In this embodiment, it is considered that when the target typesetting parameters are determined by the large language model, there is a certain probability that the text content of the first text is modified. For example, when the first target paragraph in the first text is segmented by the large language model, sentences in the first target paragraph are deleted or sentences are added to the first target paragraph. Based on this, the first text can be typeset based on the target typesetting parameters to obtain the typeset text, for example, the first text is segmented based on the segmentation position in the target typesetting parameters to obtain the segmented text.
[0035] Next, compare the content of the typeset text with the text content of the first text. If they are the same, it means that the large language model did not modify the text content of the first text in the process of generating the target typesetting parameters, and thus the target typesetting parameters are retained. If they are different, it means that the large language model modified the text content of the first text in the process of generating the target typesetting parameters, and then return to the step of determining the target typesetting parameters based on the semantic information of the first text through the large language model and repeating it.
[0036] After repeated execution, the above process is also executed to typeset the first text based on the target typesetting parameters to obtain the typeset text, and to compare whether the content of the typeset text is the same as the text content of the first text, until the content of the typeset text is the same as the text content of the first text, and to obtain accurate target typesetting parameters. In an example, if the content of the typeset text is still different from the text content of the first text after repeated execution for a certain number of times, an error processing can be performed.
[0037] It can be seen that through this embodiment, the first text can be typeset based on the target typesetting parameters to obtain the typeset text, and the content of the typeset text can be compared with the text content of the first text to see if they are the same. If they are the same, the target typesetting parameters are retained; if they are different, the step of returning to determine the target typesetting parameters based on the semantic information of the first text through the large language model is repeated, thereby timely discovering the situation in which the text content of the first text is modified when the large language model determines the target typesetting parameters, thereby improving the accuracy of the target typesetting parameters.
[0038] After determining to obtain the target typesetting parameters, in the above step S104, the typesetting difference information between the initial typesetting parameters and the target typesetting parameters is also determined. In this embodiment, the initial typesetting parameters include at least one of font, font size, text color, segment position, line spacing, and paragraph spacing. The target typesetting parameters include at least one of font, font size, text color, segment position, line spacing, and paragraph spacing. Based on this, in one embodiment, determining the typesetting difference information between the initial typesetting parameters and the target typesetting parameters includes: At least one of font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information between the initial typesetting parameters and the target typesetting parameters is determined as typesetting difference information.
[0039] In this embodiment, the font difference information can be exemplified as "Kaiti-Songti", where Kaiti is the font of the first text in the initial typesetting parameters, and Songti is the font of the first text in the target typesetting parameters. The font size difference information can be exemplified as "5-4", where 5 is the font size of the first text in the initial typesetting parameters, and 4 is the font size of the first text in the target typesetting parameters. The text color difference information can be exemplified as "black-brown", where black is the text color of the first text in the initial typesetting parameters, and brown is the text color of the first text in the target typesetting parameters. The segmentation position difference information can be represented by the extra segmentation position of the target typesetting parameters relative to the initial typesetting parameters. For example, the target typesetting parameters have one more segmentation position relative to the initial typesetting parameters, which is used to segment the third sentence and the fourth sentence of the first paragraph, and the segmentation position between the third sentence and the fourth sentence of the first paragraph is recorded as the segmentation position difference information. The line spacing difference information may be exemplified as "21 pt-21 pt", which indicates that there is no difference between the line spacing of the first text in the initial typesetting parameters and the line spacing of the first text in the target typesetting parameters. The paragraph spacing difference information may be exemplified as "0 line-0 line", which indicates that there is no difference between the paragraph spacing of the first text in the initial typesetting parameters and the paragraph spacing of the first text in the target typesetting parameters.
[0040] In the scenario where the segment position of the first text is adjusted, the initial typesetting parameters include the segment position, and the target typesetting parameters include the segment position. The typesetting difference information between the initial typesetting parameters and the target typesetting parameters includes the segment position difference information. The segment position difference information includes the segment position that is added by the target typesetting parameters relative to the initial typesetting parameters.
[0041] It can be seen that, through this embodiment, the typesetting difference information between the initial typesetting parameters and the target typesetting parameters can be accurately determined.
[0042] In the above step S106, if a browsing request for the first text is obtained from the browsing terminal, the first text is adjusted for typesetting according to the typesetting difference information to obtain the second text, and the browsing request is responded to based on the second text. For example, if a browsing request for the first text sent by the reader's browsing terminal is obtained, the first text is adjusted for typesetting according to the typesetting difference information to obtain the second text, and the second text is returned to the reader, so that the reader can browse the text with better typesetting effect, thereby improving the text browsing experience. Among them, the typesetting parameters of the second text are target typesetting parameters, the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal. In one example, the format of the second text is the same as the format of the first text.
[0043] In one embodiment, the layout of the first text is adjusted according to the layout difference information to obtain the second text, which may be: According to the typesetting difference information, the initial typesetting parameters of the first text are adjusted to the target typesetting parameters, and the first text typeset based on the target typesetting parameters is the second text. Then, the second text is fed back to the reader.
[0044] In one embodiment, the first text is typed according to the typesetting difference information to obtain the second text, including: When the first text has multiple versions, determining the target text requested to be browsed by the browse request in each version of the first text; If the target text has matching typesetting difference information, the target text is typesetted according to the matching typesetting difference information to obtain a second text corresponding to the target text.
[0045] In some cases, the first text may have multiple versions. For example, the first text is a novel, and the author of the novel has uploaded multiple versions of the first text. In this embodiment, when the first text has multiple versions, the target text requested to be browsed by the browse request is determined in each version of the first text, wherein the browse request may carry the version number of the first text, thereby indicating the target text requested to be browsed in each version of the first text.
[0046] In this embodiment, for the first text of each version, Figure 1 Therefore, after determining the target text, it is necessary to determine whether the target text has been Figure 1 The process in , generates the matching typesetting difference information, if generated, then adjust the initial typesetting parameters of the target text according to the typesetting difference information matched by the target text, the adjusted target text is the second text corresponding to the target text, and the second text is fed back to the reader. Of course, if the typesetting difference information matched by the target text is not generated, the target text can be directly fed back to the reader.
[0047] It can be seen that through this embodiment, when the first text has multiple versions, the required version of the first text can be accurately returned to the reader, thereby satisfying the reader's browsing request for different versions of the first text.
[0048] In some embodiments, adjusting the layout of the first text according to the layout difference information to obtain the second text includes: extracting at least one of font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information from the typesetting difference information as an extraction result; According to the extraction result, the first text is typeset and adjusted to obtain the second text.
[0049] According to the previous description, the typesetting difference information includes at least one of font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information. Therefore, in this step, at least one of the font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information can be extracted from the typesetting difference information as an extraction result. According to the extraction result, the initial typesetting parameters of the first text are adjusted, and the initial typesetting parameters of the first text are adjusted to the target typesetting parameters. The first text typeset based on the target typesetting parameters is the second text.
[0050] It can be seen that through this embodiment, at least one of the font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information can be extracted from the typesetting difference information as the extraction result. According to the extraction result, the first text is typeset and adjusted to obtain the second text, so that readers can browse the second text with a better typesetting effect.
[0051] In some embodiments, the extraction result includes segmentation position difference information of the first target paragraph in the first text; the segmentation position difference information indicates that the first target paragraph is split to obtain the second text; and according to the extraction result, the first text is typed and adjusted to obtain the second text, including: Based on the initial typesetting parameters of the first text, the first text is parsed into a document object model DOM tree, and a first child node corresponding to the first target paragraph is determined in the DOM tree; Splitting the first child node according to the segmentation position difference information of the first target paragraph; Based on the split first child node, a second text is generated.
[0052] According to the previous description, the first target paragraph with a longer text length in the first text can be split into multiple sub-paragraphs to improve the text browsing experience. In this case, the difference between the first text and the second text is that the first target paragraph in the second text is split into multiple sub-paragraphs. Based on this, the above extraction result includes the segmentation position difference information of the first target paragraph in the first text, and the segmentation position difference information includes the segmentation position information newly added in the first target paragraph. Therefore, the segmentation position difference information indicates that the second text is obtained by splitting the first target paragraph.
[0053] Therefore, when the present embodiment performs typeset adjustment on the first text according to the extraction result to obtain the second text, the first text can be parsed into a DOM (Document Object Model Tree) tree based on the initial typeset parameters of the first text, and the first child node corresponding to the first target paragraph is determined in the DOM tree. Then, according to the segmentation position difference information of the first target paragraph, the first child node is split and the first child node is split into multiple child nodes, so as to achieve the effect of splitting the first target paragraph into multiple sub-paragraphs. Finally, based on the split first child node, the DOM tree corresponding to the second text is generated, and the second text is generated according to the DOM tree corresponding to the second text.
[0054] It can be seen that through this embodiment, when the layout of the first text is adjusted, the first text can be converted into a DOM tree form, and the layout of the first text can be adjusted by adjusting the structure of the DOM tree, thereby improving the efficiency of the layout adjustment of the first text.
[0055] In the above step S106, when responding to the browsing request based on the second text, a specific implementation method may be: If the browsing request comes from an editing device of the first text, generating a layout suggestion for the first text according to the layout difference information; The layout suggestion and the second text are returned to the editing device.
[0056] In this embodiment, considering that the person who requests to browse the first text may be an editor of the first text, such as a novel author, after determining that the browsing request comes from an editing device used to edit and generate the first text, a typesetting suggestion for the first text is generated based on the typesetting difference information. The typesetting suggestion is used to represent the above-mentioned typesetting difference information, or to represent an adjustment suggestion strategy for adjusting the initial typesetting parameters of the first text based on the typesetting difference information.
[0057] The typesetting suggestions and the second text are returned to the editing device, so that on the one hand the editor of the first text can browse the second text with better typesetting effect, and on the other hand it is convenient for the editor of the first text to make typesetting adjustments to the text content of the first text written subsequently according to the typesetting suggestions, thereby improving the typesetting efficiency of manual typesetting.
[0058] It can be seen that through this embodiment, when the editor of the first text requests to browse the first text, the second text and typesetting suggestions can be returned to him / her, so that the editor of the first text can browse the second text with better typesetting effect, and it is convenient for the editor of the first text to make typesetting adjustments to the text content of the first text written subsequently according to the typesetting suggestions, thereby improving the typesetting efficiency of manual typesetting.
[0059] An implementation scenario of the above method flow is described below through a specific embodiment.
[0060] Figure 2 A flowchart of a text processing method provided by another embodiment of the present disclosure is shown in FIG. Figure 2 Zhongyu Figure 1 The same steps and processes can be explained in detail in Figure 1 The explanation of , will not be repeated here. Figure 2 As shown, the method includes: Step S202, obtaining a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text.
[0061] The first text is in HTML format.
[0062] Step S204: parsing the first text into a DOM tree based on the initial typesetting parameters of the first text.
[0063] Step S206 , traversing the DOM tree of the first text, identifying paragraphs whose text length exceeds a first length threshold in the DOM tree of the first text, and determining the identified paragraphs as first target paragraphs.
[0064] The first length threshold is determined according to the screen width of the browsing terminal.
[0065] Step S208: for each first text paragraph, input the text content of the first target paragraph into the large language model, and split the first target paragraph into multiple sub-paragraphs based on the semantic information of each sentence in the first target paragraph through the large language model.
[0066] Each sub-paragraph contains at least one sentence that is semantically related to each other and the text length of each sub-paragraph is less than a second length threshold. The large language model can output the sub-paragraphs obtained by splitting. The second length threshold is determined according to the screen width of the browsing terminal.
[0067] Among them, you can input prompt words into the large language model, such as: You are a text segmentation expert, and you can divide the text into multiple segments without changing the text, with each segment length less than 150 characters.
[0068] Step S210 , for each first text paragraph, comparing the text content of each sub-paragraph obtained by splitting the large language model with the text content of the first target paragraph to see whether they are the same.
[0069] If they are the same, execute step S212; if they are different, return to step S208 and repeat the process up to a predetermined number of times.
[0070] Step S212: for each first text paragraph, compare the first target paragraph with each sub-paragraph obtained by splitting the large language model, obtain at least one segmentation position corresponding to the first target paragraph, and store each segmentation position corresponding to the first target paragraph as typesetting difference information.
[0071] In one example, the first target paragraph and each subparagraph obtained by splitting the large language model can be compared based on the Myers algorithm to obtain at least one segmentation position corresponding to the first target paragraph. Obtaining the segmentation position by the Myers algorithm has the advantage of saving the storage cost of the segmentation position.
[0072] Step S214: obtaining a browsing request for the first text sent by the browsing terminal, and determining a target text requested to be browsed by the browsing request in each version of the first text.
[0073] Step S216: If the target text has matching typesetting difference information, the DOM tree of the target text is obtained, and the first child node corresponding to the first target paragraph is determined in the DOM tree of the target text.
[0074] Step S218, splitting the first sub-node into multiple nodes according to the typesetting difference information matching the target text.
[0075] Step S220: Generate a new DOM tree according to the split first child node, generate a second text according to the new DOM tree, and send the second text to the browsing terminal.
[0076] The second text is in HTML format.
[0077] Figure 3 A schematic diagram of a DOM tree of a first text provided by an embodiment of the present disclosure, such as Figure 3 The first text is parsed into a DOM tree, each child node in the DOM tree represents a paragraph in the first text, and a child node corresponding to the first target paragraph with a longer text length is determined in the DOM tree, such as child node 2. According to the typesetting difference information, the first child node is split into multiple nodes, such as Figure 3 The child node 2 in is split into child nodes 2-1, 2-2 and 2-3, and a new DOM tree is generated according to the first child node after the splitting, and a second text is generated according to the new DOM tree, and the second text is sent to the browsing terminal. Figure 3 In this case, n is a positive integer.
[0078] Figure 4 A schematic diagram of comparing a first text and a second text provided in an embodiment of the present disclosure, Figure 4 The first text and the second text in are both illustrative examples. Figure 4 As described above, through this embodiment, a longer paragraph in the first text can be split into multiple sub-paragraphs, thereby solving the problem of tight typesetting of the first text, improving text typesetting efficiency and text typesetting effect, and improving text browsing experience.
[0079] Figure 5 A schematic diagram of an application scenario of a text processing method provided by an embodiment of the present disclosure, such as Figure 5 As shown, in this scenario, there are an editing device 100, a browsing terminal 200 and a server 300. The editing device can be exemplified as a computer, the browsing terminal can be exemplified as a smart phone, and the server can be exemplified as a single server. Figure 5 As shown in the figure, the story text edited by the novel author through the editing device is the first text. The editing device can upload the first text to the server. The server Figure 1 , Figure 2 The method flow in which the typesetting difference information corresponding to the first text is determined, and when a browsing terminal of the first text requests to browse the first text, the typesetting difference information is adjusted for the first text to obtain the second text, and the browsing request is responded to based on the second text. Figure 5 The first text and the second text are respectively returned to the browsing terminal. Figure 5 It can be seen that by returning the second text to the browsing terminal, the reader can browse the story text with better typesetting effect through the browsing terminal, thereby improving the reader's reading experience.
[0080] Figure 6A structural diagram of a text processing device provided by an embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the device comprises: The text acquisition unit 61 is used to acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; A text typesetting unit 62, configured to determine target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determine typesetting difference information between the initial typesetting parameters and the target typesetting parameters; The text response unit 63 is used to adjust the layout of the first text according to the layout difference information to obtain a second text if a browsing request for the first text is obtained from the browsing terminal, and respond to the browsing request based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0081] Optionally, the text layout unit 62 is specifically used to: determine a paragraph in the first text whose text length exceeds a first length threshold as a first target paragraph; the first length threshold is determined according to the display parameters of the browsing terminal; through the large language model, based on the semantic information of each sentence in the first target paragraph, the first target paragraph is split into multiple sub-paragraphs; each of the sub-paragraphs contains at least one sentence that is semantically related to each other and the text length of each sub-paragraph is less than a second length threshold; the second length threshold is determined according to the display parameters of the browsing terminal; based on the segmentation position of the sub-paragraph, the target layout parameters are determined.
[0082] Optionally, the text typesetting unit 62 is specifically used to: determine at least one of the font, font size, text color, segment position, line spacing, and paragraph spacing of the first text that matches the browsing terminal based on the semantic information of each sentence in the first text through the large language model; and generate the target typesetting parameters according to the determined information through the large language model.
[0083] Optionally, it also includes a consistency verification unit, which is used to: after determining the target typesetting parameters, typeset the first text based on the target typesetting parameters to obtain a typeset text; compare whether the content of the typeset text is the same as the text content of the first text; if they are the same, retain the target typesetting parameters; if they are different, return to the step of repeatedly determining the target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model.
[0084] Optionally, the text typesetting unit 62 is specifically used to determine at least one of the font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information between the initial typesetting parameters and the target typesetting parameters as the typesetting difference information.
[0085] Optionally, the text response unit 63 is specifically used to: when the first text has multiple versions, determine the target text requested to be browsed by the browsing request in each version of the first text; if the target text has matching typesetting difference information, then adjust the typesetting of the target text according to the matching typesetting difference information to obtain the second text corresponding to the target text.
[0086] Optionally, the text response unit 63 is specifically used to: extract at least one of font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information from the typesetting difference information as an extraction result; and perform typesetting adjustments on the first text according to the extraction result to obtain the second text.
[0087] Optionally, the extraction result includes segmentation position difference information of the first target paragraph in the first text; the segmentation position difference information indicates that the first target paragraph is split to obtain the second text; the text response unit 63 is also specifically used to: based on the initial typesetting parameters of the first text, parse the first text into a document object model DOM tree, determine the first child node corresponding to the first target paragraph in the DOM tree; split the first child node according to the segmentation position difference information of the first target paragraph; and generate the second text based on the split first child node.
[0088] Optionally, the text response unit 63 is specifically used to: respond to the browsing request based on the second text, including: if the browsing request comes from an editing device of the first text, generating a typesetting suggestion for the first text based on the typesetting difference information; and returning the typesetting suggestion and the second text to the editing device.
[0089] The text processing device in the embodiment of the present disclosure can implement each process of the above-mentioned text processing method embodiment and achieve the same effect and function, which will not be repeated here.
[0090] An embodiment of the present disclosure further provides an electronic device, Figure 7 A schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, such as Figure 7As shown, the electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and memory 702, and one or more applications or data may be stored in the memory 702. Among them, the memory 702 may be a temporary storage or a permanent storage. The application stored in the memory 702 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 701 may be configured to communicate with the memory 702 to execute a series of computer executable instructions in the memory 702 on the electronic device. The electronic device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input or output interfaces 705, one or more keyboards 706, etc.
[0091] In a specific embodiment, the electronic device includes a processor; and a memory configured to store computer executable instructions, wherein when the computer executable instructions are executed, the processor implements the following process: Acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; If a browsing request for the first text from the browsing terminal is obtained, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0092] The electronic device in the embodiment of the present disclosure can implement each process of the above-mentioned text processing method embodiment and achieve the same effects and functions, which will not be repeated here.
[0093] Another embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer-executable instructions, and when the computer-executable instructions are executed by a processor, the following process is implemented: Acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; If a browsing request for the first text from the browsing terminal is obtained, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0094] The computer-readable storage medium in the embodiment of the present disclosure can implement the various processes of the above-mentioned text processing method embodiment and achieve the same effects and functions, which will not be repeated here.
[0095] Another embodiment of the present disclosure further provides a computer program product, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following process is implemented: Acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; If a browsing request for the first text from the browsing terminal is obtained, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
[0096] The computer program product in the embodiment of the present disclosure can implement each process of the above-mentioned text processing method embodiment and achieve the same effect and function, which will not be repeated here.
[0097] In various embodiments of the present disclosure, the computer-readable storage medium includes a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0098] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0099] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0100] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0101] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of the present disclosure, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0102] It should be understood by those skilled in the art that one or more embodiments of the present disclosure may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, one or more embodiments of the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0103] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0104] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0105] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0106] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0107] One or more embodiments of the present disclosure may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present disclosure may also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0108] Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0109] The above description is only an embodiment of the present disclosure and is not intended to limit the present disclosure. For those skilled in the art, the present disclosure may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present disclosure shall be included in the scope of the claims of the present disclosure.
Claims
1. A text processing method, characterized in that: include: Acquire a first text; the first text includes a story text that is typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; Determining target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determining typesetting difference information between the initial typesetting parameters and the target typesetting parameters; If a browsing request for the first text from the browsing terminal is obtained, the first text is adjusted in typesetting according to the typesetting difference information to obtain a second text, and the browsing request is responded to based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
2. The method according to claim 1, characterized in that The determining, by using the large language model and based on the semantic information of the first text, a target typesetting parameter of the first text that matches the browsing terminal includes: Determine a paragraph in the first text whose text length exceeds a first length threshold as a first target paragraph; the first length threshold is determined according to a display parameter of the browsing terminal; Using the large language model, based on the semantic information of each sentence in the first target paragraph, the first target paragraph is divided into a plurality of sub-paragraphs; each of the sub-paragraphs contains at least one of the sentences that are semantically related to each other and the text length of each of the sub-paragraphs is less than a second length threshold; the second length threshold is determined according to the display parameters of the browsing terminal; The target layout parameters are determined based on the segmentation position of the subparagraph.
3. The method according to claim 1, characterized in that The determining, by using the large language model and based on the semantic information of the first text, a target typesetting parameter of the first text that matches the browsing terminal includes: Determining, by means of the large language model, at least one of a font, a font size, a text color, a segment position, a line spacing, and a paragraph spacing of the first text that matches the browsing terminal based on the semantic information of each sentence in the first text; The target typesetting parameters are generated according to the determined information through the large language model.
4. The method according to claim 1, characterized in that After determining the target layout parameter of the first text that matches the browsing terminal, the method further includes: Typesetting the first text based on the target typesetting parameters to obtain a typeset text; Comparing whether the content of the typeset text is the same as the text content of the first text; If they are the same, the target typesetting parameters are retained; if they are different, the step of returning to the step of determining the target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through the large language model is repeated.
5. The method according to claim 1, characterized in that The determining of typesetting difference information between the initial typesetting parameters and the target typesetting parameters includes: Determine at least one of the font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information between the initial typesetting parameters and the target typesetting parameters as the typesetting difference information.
6. The method according to claim 1, characterized in that The step of adjusting the layout of the first text according to the layout difference information to obtain the second text includes: When the first text has multiple versions, determining the target text requested to be browsed by the browse request in each version of the first text; If the target text has the matching typesetting difference information, the target text is typesetted according to the matching typesetting difference information to obtain the second text corresponding to the target text.
7. The method according to claim 1, characterized in that The step of adjusting the layout of the first text according to the layout difference information to obtain the second text includes: extracting at least one of font difference information, font size difference information, text color difference information, segment position difference information, line spacing difference information, and paragraph spacing difference information from the typesetting difference information as an extraction result; According to the extraction result, the first text is typeset to obtain the second text.
8. The method according to claim 7, characterized in that The extraction result includes segmentation position difference information of the first target paragraph in the first text; the segmentation position difference information indicates that the first target paragraph is split to obtain the second text; and the first text is typeset according to the extraction result to obtain the second text, including: Based on the initial typesetting parameter of the first text, the first text is parsed into a Document Object Model (DOM) tree, and a first child node corresponding to the first target paragraph is determined in the DOM tree; Splitting the first sub-node according to the segment position difference information of the first target paragraph; The second text is generated based on the split first child node.
9. The method according to claim 1, characterized in that: The responding to the browsing request based on the second text comprises: If the browsing request comes from an editing device of the first text, generating a layout suggestion for the first text according to the layout difference information; The layout suggestion and the second text are returned to the editing device.
10. A text processing device, characterized in that: include: A text acquisition unit, configured to acquire a first text; the first text includes a story text typeset based on initial typesetting parameters; the format of the first text is a text format corresponding to a browsing terminal of the first text; A text typesetting unit, configured to determine target typesetting parameters of the first text that match the browsing terminal based on the semantic information of the first text through a large language model, and determine typesetting difference information between the initial typesetting parameters and the target typesetting parameters; A text response unit is used to adjust the layout of the first text according to the layout difference information to obtain a second text if a browsing request for the first text is obtained from the browsing terminal, and respond to the browsing request based on the second text; the text content of the second text is the same as the text content of the first text, and the format of the second text is the text format corresponding to the browsing terminal.
11. An electronic device, characterized in that: include: processor; as well as, A memory configured to store computer executable instructions, which, when executed, cause the processor to implement the method of any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer-executable instructions, and the computer-executable instructions implement the method of any one of claims 1 to 9 when executed by a processor.
13. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.