Rich text file conversion method and device, equipment and storage medium

By formatting rich text files and replacing image description text, combining large language models and Prompt templates, the problem of converting rich text files into specific languages in the field required for business applications is solved, and complete retention and accurate conversion of information is achieved.

CN120296069APending Publication Date: 2025-07-11BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510348895.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

The prior art cannot directly parse and use rich text files, resulting in lost information and difficult to translate them into domain-specific languages required for business applications.

Method used

By formatting rich text files, the target formatted text is generated, and the image description text is used to replace the picture, combining the large language model and the Prompt template, and converting it to a domain-specific language.

Benefits of technology

Ensure the information integrity of rich text files, improve the accuracy and generation efficiency of domain-specific languages, and reduce labor costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120296069A_ABST
    Figure CN120296069A_ABST
Patent Text Reader

Abstract

The invention relates to a rich text file conversion method and device, equipment and a storage medium. The method comprises the following steps: acquiring a to-be-processed rich text file, and formatting the rich text file to generate a target formatted text; if the rich text file comprises a picture, replacing the picture with a picture description text corresponding to the picture to generate a target formatted text during formatting processing; generating a corresponding domain-specific language according to the target formatted text; therefore, in order to accurately convert the rich text file into the domain-specific language required by the business application program, the picture description text of the picture can be used for replacing the picture, the formatted text of the rich text file is generated, and the domain-specific language is generated through the formatted text of the rich text file. Picture information can be prevented from being lost, and the accuracy of domain specific languages is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of rich text file conversion, and in particular, to a method, device, equipment, and storage medium for converting rich text files. Background Art

[0002] With the development of information technology, the presentation forms of documents and data are becoming increasingly rich, and formats including diverse rich texts are becoming more and more common. Rich Text is a text format opposite to Plain Text. In addition to basic character data, it supports various formatting features and multimedia content. These features include, but are not limited to, font styles (such as bold, italic, underline), font sizes, colors, background colors, paragraph alignments, lists (ordered lists and unordered lists), embedded hyperlinks, images, tables, videos, audio, and other formatting and embedded content. The rich text format can be: DOC (Document Word Binary File), DOCX (Document Word OpenXML Format, an open document format based on XML (Extensible Markup Language)), etc. Currently, business application programs cannot directly parse and use rich text files. Only extracting the plain text content in rich text files will result in information loss. Moreover, due to the diversity of rich text files, it is difficult to directly convert rich text files into the domain-specific languages required by business application programs.

[0003] Therefore, how to accurately convert rich text files into the domain-specific languages required by business application programs and avoid information loss is a problem that those skilled in the art need to solve. Summary of the Invention

[0004] This application provides a method, device, equipment, and storage medium for converting rich text files to accurately convert rich text files into the domain-specific languages required by business application programs and avoid information loss.

[0005] In a first aspect, this application provides a method for converting rich text files, including:

[0006] Obtain a rich text file to be processed;

[0007] Perform formatting processing on the rich text file to generate a target formatted text; if the rich text file includes a picture, during formatting processing, replace the picture with a picture description text corresponding to the picture to generate a target formatted text;

[0008] Generate a corresponding domain-specific language according to the target formatted text.

[0009] Optionally, formatting the rich text file to generate a target formatted text includes:

[0010] Determine each element in the rich text file and the corresponding hierarchical information for each element;

[0011] Format each element and the hierarchical information to generate a target formatted text.

[0012] Optionally, formatting each element and the hierarchical information to generate a target formatted text includes:

[0013] Convert at least one of the title and title hierarchical information, paragraph and paragraph hierarchical information, table and table hierarchical information, and picture and picture hierarchical information into corresponding formatted text;

[0014] Generate a target formatted text using the at least one converted formatted text.

[0015] Optionally, converting the picture and picture hierarchical information into corresponding formatted text includes:

[0016] Extract pictures from the rich text file;

[0017] Convert the pictures and picture hierarchical information in the rich text file into initial formatted text; wherein, in the initial formatted text, the positions of the pictures in the rich text file are occupied by specific symbols;

[0018] Convert the extracted pictures into picture description text;

[0019] Replace the specific symbols in the initial formatted text with the picture description text to obtain the formatted text after converting the pictures and picture hierarchical information.

[0020] Optionally, the converting the extracted pictures into picture description text includes:

[0021] Convert the extracted pictures into picture description text through a large language model.

[0022] Optionally, generating a corresponding domain-specific language according to the target formatted text includes:

[0023] Convert the target formatted text into a corresponding domain-specific language through a large language model and a Prompt template.

[0024] Optionally, the converting the target formatted text into a corresponding domain-specific language through a large language model and a Prompt template includes:

[0025] Generate a Prompt template according to the specific requirements of the business application; the specific requirements include at least one of the content requirements and format requirements of the business application;

[0026] Convert the target formatted text into a domain-specific language that meets the specific requirements through a large language model and the Prompt template.

[0027] In a second aspect, the present application provides a conversion device for rich text files, including:

[0028] An acquisition module for acquiring a rich text file to be processed;

[0029] A formatting processing module for performing formatting processing on the rich text file to generate a target formatted text; if the rich text file includes a picture, then during formatting processing, replace the picture with the picture description text corresponding to the picture to generate the target formatted text;

[0030] A specific language generation module for generating a corresponding domain-specific language according to the target formatted text.

[0031] In a third aspect, the present application provides an electronic device, including:

[0032] A processor, a memory, and a computer program stored on the memory and executable on the processor, and the processor executes the steps of the conversion method of the rich text file in the present application through the computer program.

[0033] In a fourth aspect, the present application further provides a computer storage medium, and the computer storage medium stores computer-executable instructions for executing the steps of the conversion method of the rich text file in the present application.

[0034] The above technical solutions provided by the embodiments of the present application have the following advantages compared with the prior art: The present application provides a conversion method, device, device, and storage medium for rich text files; the present application acquires a rich text file to be processed and performs formatting processing on the rich text file to generate a target formatted text; if the rich text file includes a picture, then during formatting processing, replace the picture with the picture description text corresponding to the picture to generate the target formatted text; generate a corresponding domain-specific language according to the target formatted text; it can be seen that in order to accurately convert a rich text file into a domain-specific language required by a business application, the present application can replace the picture with the picture description text of the picture to generate a formatted text of the rich text file, and generate a domain-specific language through the formatted text of the rich text file. In this way, the loss of picture information can be avoided and the accuracy of the domain-specific language can be improved. Description of the Drawings

[0035] The accompanying drawings herein are incorporated into and constitute a part of this specification, showing embodiments consistent with the present invention and, together with the specification, used to explain the principles of the present invention.

[0036] To more clearly illustrate the technical solutions in the embodiments of the present invention or in the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0037] One or more embodiments are exemplarily illustrated by the pictures in the corresponding accompanying drawings. These exemplary illustrations do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, and the drawings in the figures do not constitute a scale limitation.

[0038] Figure 1 Schematic diagram of a method for converting rich text files provided by an embodiment of the present application;

[0039] Figure 2 Schematic diagram of another method for converting rich text files provided by an embodiment of the present application;

[0040] Figure 3 Schematic diagram of another method for converting rich text files provided by an embodiment of the present application;

[0041] Figure 4 Specific flowchart of the method for converting rich text files provided by an embodiment of the present application;

[0042] Figure 5 Schematic diagram of the structure of a rich text formatting module provided by an embodiment of the present application;

[0043] Figure 6 Schematic diagram of the structure of a picture information analysis module provided by an embodiment of the present application;

[0044] Figure 7 Schematic diagram of the structure of a device for converting rich text files provided by an embodiment of the present application;

[0045] Figure 8 Schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0046] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some but not all of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.

[0047] The following disclosure provides many different embodiments or examples for implementing different structures of the present invention. To simplify the disclosure of the present invention, the components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present invention. In addition, the present invention may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplification and clarity and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0048] A domain-specific language (DSL) refers to a computer language that focuses on a specific application domain. Currently, business applications need to use a domain-specific language to perform specific functions. Therefore, current business applications cannot directly parse and use rich text files. If only the plain text content in the rich text file is extracted, information will be lost. If the rich text content needs to be converted into the domain-specific language required by business applications, professional knowledge and a large amount of human input are often required.

[0049] Therefore, in this application, a method, apparatus, device, and storage medium for converting rich text files are disclosed. This application can accurately convert rich text files into the domain-specific language required by business applications, avoiding information loss.

[0050] See Figure 1 , which is a schematic flowchart of a method for converting rich text files provided in the embodiments of this application. The method may include the following steps:

[0051] S101. Obtain the rich text file to be processed;

[0052] In this application, a rich text file is a text format that contains rich formatting information and multimedia elements, such as DOC, DOCX, etc. The rich text file to be processed is the rich text file that business applications need to use. Since current business applications cannot directly parse and use rich text files, in this application, the rich text file to be processed needs to be converted to generate the domain-specific language required by business applications. After that, business applications can use the converted domain-specific language to process the content in the rich text file.

[0053] For example, the mind map generation software only accepts files in Markdown format. If the mind map generation software needs to convert a DOCX file into a mind map picture, since the mind map generation software cannot directly process DOCX files, this application can convert the DOCX file into a Markdown format file for the mind map generation software to process. Among them, the mind map generation software is a business application program, the DOCX file is a rich text file, and the Markdown format file is a domain-specific language required by the business application program.

[0054] S102. Perform formatting processing on the rich text file to generate a target formatted text; if the rich text file includes pictures, during the formatting processing, replace the pictures with picture description texts corresponding to the pictures to generate the target formatted text.

[0055] Due to the diversity of the content of rich text files, it is impossible to rely on a business application program to use a certain fixed rule to obtain information from the rich text file and generate a domain-specific language based on this. Therefore, in this application, after parsing the text information of the rich text file and converting the rich text file into a target formatted text, the corresponding domain-specific language is generated. However, most current parsing models do not directly support parsing rich text files. Although some parsing models can parse text and pictures simultaneously, since the pictures and text are input separately, it is impossible to accurately understand the position information of the pictures in the text; if the plain text in the rich text file is simply extracted directly, information loss will occur.

[0056] Therefore, in this application, in order to retain as much information of the rich text file as possible, this application performs formatting processing on the rich text file and pre-processes the pictures in the rich text file. After converting the pictures into picture description texts, they are then embedded in the formatted text. In this application, the formatted text finally generated from the rich text file is called the target formatted text.

[0057] Among them, when this application performs formatting processing on the rich text file, it is necessary to parse the content of the rich text file and adjust the format according to the parsing result. For example: by parsing the rich text file, it is found that the first line of the rich text file is a title. At this time, formatting processing needs to be performed on the title. This application can format the title into the following format:

[0058] “<head{heading_level}>Title content”

[0059] Among them: “head” represents the title, “{heading_level}” contains the level of the current title, that is, the hierarchical information of this title, and “Title content” is the specific title content of the current rich text file.

[0060] It can be seen that after formatting the rich text file to generate the target formatted text, the content of the rich text file can be accurately parsed, and the text, hierarchical information, and picture description text of each part in the rich text file are retained, ensuring the parsing accuracy of the rich text file and the integrity of the information, and effectively improving the generation effect of the domain-specific language.

[0061] S103. Generate the corresponding domain-specific language according to the target formatted text.

[0062] In this application, after converting the rich text file into the target formatted text, the file content of the rich text file can be accurately converted into a formatted text of plain text. Then, based on the target formatted text of this plain text, it can be converted into a domain-specific language.

[0063] When this application converts the target formatted text into a domain-specific language, it is necessary to clarify the type of the domain-specific language required by the business application, as well as the specific content requirements, format requirements, etc. when converting this target formatted text into the domain-specific language required by the business application, so as to accurately convert the target formatted text into the corresponding domain-specific language according to the content requirements and format requirements. When converting, the target formatted text can be converted into a domain-specific language through a conversion model. This conversion model can be a large language model (LLM), or it can be other models. It is not specifically limited here as long as it can implement the conversion function.

[0064] In summary, in order to accurately convert the rich text file into the domain-specific language required by the business application, this application can format the rich text file to generate the target formatted text. During the formatting process, the formatted text of the rich text file can be generated by replacing the picture with the picture description text of the picture. In this way, the content of the rich text file can be accurately parsed, the picture information can be avoided from being lost, the parsing accuracy of the rich text file and the integrity of the information are ensured, and the accuracy of the domain-specific language is effectively improved.

[0065] See Figure 2 , which is a schematic flowchart of another conversion method for the rich text file provided by the embodiment of this application. This method may include the following steps:

[0066] S201. Obtain the rich text file to be processed;

[0067] S202. Determine each element in the rich text file and the hierarchical information corresponding to each element;

[0068] S203. Format each element and hierarchical information to generate target formatted text. If the rich text file includes pictures, during the formatting process, replace the pictures with the corresponding picture description text to generate the target formatted text.

[0069] S204. Generate the corresponding domain-specific language based on the target formatted text.

[0070] In this application, when formatting a rich text file, specifically, the content of the rich text file is separated into various elements such as headings, paragraphs, tables, and pictures, and then each element is used to generate target formatted text through a predetermined format. When generating target formatted text from the rich text file in this application, it is also necessary to record the hierarchical information (level) of each text element. This hierarchical information represents the hierarchical structure of each element in the rich text file, such as: the hierarchical result information of paragraphs, the hierarchical structure information of tables, the hierarchical structure information of text in tables, the hierarchical structure information of pictures in tables, and so on. This hierarchical information is divided into full-text granularity and table cell granularity. For example, the table itself is represented using full-text granularity, and each cell text inside the table can use independent levels.

[0071] In another embodiment of this application, the process of formatting each element and hierarchical information to generate target formatted text specifically includes: converting at least one of the heading and its hierarchical information, paragraph and its hierarchical information, table and its hierarchical information, picture and its hierarchical information into the corresponding formatted text; using the at least one formatted text after conversion to generate the target formatted text.

[0072] In this embodiment, after obtaining the rich text file to be processed, this application can specifically format the rich text file through the following modules: a heading formatting module, a paragraph formatting module, a table formatting module, and a picture formatting module. The process of formatting the rich text file in this application helps to improve the generation effect of the domain-specific language.

[0073] When each module formats the rich text file, if a heading is parsed, it is formatted through the heading formatting module. For example, the heading in the rich text file is formatted into the format of "<head{heading_level}> heading content"; if a paragraph is parsed, it is formatted through the paragraph formatting module. This application can use " "Mark the paragraph; if a table is parsed, format it through the table formatting module. This application can use" <row>"Marker, text in the table uses" <t>"Tag; if a picture is parsed, it will be formatted by the picture formatting module. This application can use" "to tag the picture.

[0074] It should be noted that when this application formats the rich text file through each module, they can call each other. For example, if there is a table in a paragraph and there is also a paragraph in the table, at this time, the paragraph formatting module and the table formatting module will call each other. If there are pictures in the paragraph and the table, the picture formatting module will also be called for processing.

[0075] In summary, when this application performs formatting processing, since different elements have different formatting methods, this application first needs to determine each element and its hierarchical information in the rich text file, and then format each element and its hierarchical information, thereby improving the generation speed and accuracy of the formatted text; moreover, this application divides the rich text file into elements such as titles, paragraphs, tables, and pictures, and after converting each element and its corresponding hierarchical information into formatted text respectively, the final target formatted text can be generated. The way this application formats each element and its hierarchical information can ensure the accuracy of content parsing and the integrity of information, and effectively improve the speed and accuracy of generating domain-specific languages.

[0076] In another embodiment of this application, the process of converting a picture and its picture hierarchical information into corresponding formatted text includes: extracting the picture from the rich text file; converting the picture and its picture hierarchical information in the rich text file into initial formatted text; wherein, in the initial formatted text, the position of the picture in the rich text file is occupied by a specific symbol; converting the extracted picture into picture description text; and replacing the specific symbol in the initial formatted text with the picture description text to obtain the formatted text after the conversion of the picture and its picture hierarchical information.

[0077] In this application, in order to ensure that the target formatted text includes the complete information of the rich text file, when formatting the pictures in the rich text file, special processing needs to be performed on the pictures, that is: in the formatting stage, the pictures are extracted from the rich text file, and a specific symbol is used to occupy the position of the pictures in the formatted text for marking. Subsequently, the extracted pictures are converted into picture description text, and the picture description text is used to replace the placeholder marks in the formatted text, so as to embed the picture description text into the formatted text and generate a pure text target formatted text.

[0078] In another embodiment of this application, when converting the extracted picture into picture description text, the extracted picture can be converted into picture description text through a large language model.

[0079] Among them, a large language model refers to a deep learning model trained with a large amount of text data, which can generate natural language text or understand the meaning of language text. In this application, a Multimodal Large Language Model (MLLM) is specifically used to convert an image into an image description text. A multimodal large language model is a large language model that can process and understand various modal information, where the modality can be text, image, audio, etc. This multimodal large language model is based on the large language model LLM and combines breakthroughs in fields such as Large Vision Models (LVM). It can not only handle traditional language tasks such as text generation, understanding, and reasoning, but also perceive and understand visual and auditory information such as images and audio, realizing cross-modal information interaction and understanding. Therefore, in this application, through the multimodal large language model, the extracted image can be converted into an accurate image description text, avoiding the loss of image information.

[0080] In summary, when formatting the image in this application, to avoid the loss of image information, specific symbols can be used to occupy the position of the image in the formatted text. After generating the image description text of the image, the specific symbols in the formatted text are replaced. In this way, the target formatted text can include the image description text, avoiding the loss of image information; moreover, this application can also convert the image into an image description text through a large prediction model, improving the accuracy of the image description text. Further, the method of converting the image into an image description text by using a large language model and then embedding it back into the formatted text in this application can solve the problem that the multimodal large language model cannot accurately understand the position of the image in the text, enabling the large language model to better understand the context of the image, thereby improving the effect of generating domain-specific language.

[0081] See Figure 3 , which is a schematic flowchart of another method for converting a rich text file provided by an embodiment of this application. The method may include the following steps:

[0082] S301. Obtain the rich text file to be processed;

[0083] S302. Perform formatting processing on the rich text file to generate a target formatted text; if the rich text file includes an image, during the formatting processing, replace the image with the corresponding image description text of the image to generate the target formatted text;

[0084] S303. Convert the target formatted text into the corresponding domain-specific language through a large language model and a Prompt template.

[0085] In this application, when converting target formatted text into the corresponding domain-specific language, the corresponding domain-specific language can be generated through a large language model and a Prompt template. Among them, the Prompt template includes: input text or instructions designed to guide the large language model to generate domain-specific language that meets specific requirements. Therefore, the process of generating domain-specific language through the large language model in this application is constrained based on the Prompt template; if other domain-specific languages need to be generated, at this time, only the Prompt template needs to be simply modified according to the requirements, which makes this application have good scalability.

[0086] In another embodiment provided by this application, converting the target formatted text into the corresponding domain-specific language through the large language model and the Prompt template includes: generating a Prompt template according to the specific requirements of the business application program; the specific requirements include at least one of the content requirements and format requirements of the business application program; converting the target formatted text into the domain-specific language that meets the specific requirements through the large language model and the Prompt template.

[0087] That is to say, before generating the domain-specific language in this application, it is first necessary to determine the Prompt template, which is specifically generated according to the specific requirements of the business application program, and the specific requirements include the content requirements, format requirements, etc. of the business application program. After generating the Prompt template, input the target formatted text into the large language model, and the large language model can use the preset Prompt template to limit its output content and format, so as to generate the final required domain-specific language.

[0088] In summary, this application can convert formatted text into the corresponding domain-specific language through the large prediction model and the Prompt template, improving the accuracy of the domain-specific language. Moreover, the Prompt template in this application can be adjusted according to the requirements of the business application program. Therefore, this application only needs to simply modify the Prompt template to adapt to the requirements of different domains, enhancing the output controllability and scalability of the large language model.

[0089] See Figure 4 , which is the flowchart of the specific rich text file conversion method provided by the embodiment of this application. As shown in the figure, first input a rich text file, and the rich text file can be a DOC file, a DOCX file, etc.; then perform formatting processing on the rich text file through the rich text formatting module to generate formatted text. See Figure 5 , which is a schematic structural diagram of a rich text formatting module provided by the embodiment of this application. Through Figure 5 It can be seen that the rich text formatting module includes: a title formatting module, a paragraph formatting module, a table formatting module, and a picture formatting module. During the formatting process, the paragraph formatting module needs to call the picture formatting module for processing. The paragraph formatting module and the table formatting module call each other, and the table formatting module needs to call the picture formatting module for processing. In this way, even if the levels of various elements in the rich text file are relatively complex, effective formatting processing can be carried out through the calls between the modules.

[0090] After processing by the rich text formatting module, formatted text is generated. Moreover, during formatting, if no picture is detected, the formatted text generated by the rich text formatting module is directly used as the target formatted text; if a picture is detected, the detected picture is extracted and encoded for storage, the picture position in the rich text file is occupied by a specific symbol, and a picture description text is generated by the picture information analysis module. Refer to Figure 6 , which is a schematic structural diagram of a picture information analysis module provided by an embodiment of the present application. Through Figure 6 It can be seen that the picture information analysis module includes a picture information extraction module, which is used to extract the saved picture, and then uses a multimodal large language model and a Prompt to analyze the picture information to generate a picture description text. Among them, since the picture description text also needs to be adjusted in terms of content and format through the Prompt in subsequent steps, the present application can generate the picture description text through the Prompt when generating the picture description text, so as to avoid adjusting the picture description text in the target formatted text later.

[0091] After the present application obtains the picture description text, it is necessary to aggregate the picture description text with the formatted text generated by the rich text formatting module through the picture and text information aggregation module, that is: replace the specific symbol generated at the original position of the picture in the formatted text during the formatting process with the picture description text, so as to embed the picture description text into the formatted text and generate a target formatted text containing the picture description text. After obtaining the target formatted text, the target formatted text can be converted into a specific domain-specific language through a large language model. During this process, content generation will be induced through a Prompt template and the output format will be limited, so as to obtain the final domain-specific language and output the domain-specific language.

[0092] For example, if it is necessary to convert a DOCX file into a mind map picture, in the existing solutions, mind map generation software only accepts Markdown format files. Therefore, this application can convert the original DOCX file into Markdown format. The process is as follows: First, extract the content in the DOCX file, identify its hierarchical structure and elements, and convert them into formatted text; then, through a predefined Prompt template, use a large language model to generate a Markdown format file. Among them, during the conversion process, the Prompt template guides the content generation and limits the Markdown format output to ensure the correctness of the output content and format. In this way, the DOCX file can be used as the input format. After being converted by this application, the text content in this format is finally input into the mind map generation software to generate the mind map of the DOCX file.

[0093] In summary, this application can break through the barrier between rich text files and business application programs, enabling business application programs to be not limited to specific domain languages, but capable of processing rich text files using natural languages, thereby expanding their application scope; currently, many application programs are restricted by the inability to obtain specific information of rich text files at low cost. Therefore, this application can provide them with basic information and significantly save labor costs.

[0094] See Figure 7 , Figure 7 which is a schematic structural diagram of a conversion device for rich text files provided by an embodiment of this application. The device specifically includes:

[0095] An acquisition module 11, configured to acquire a rich text file to be processed;

[0096] A formatting processing module 12, configured to perform formatting processing on the rich text file to generate a target formatted text; if the rich text file includes a picture, during formatting processing, replace the picture with a picture description text corresponding to the picture to generate a target formatted text;

[0097] A specific language generation module 13, configured to generate a corresponding domain-specific language according to the target formatted text.

[0098] As an optional embodiment, the formatting processing module includes:

[0099] A determination unit, configured to determine each element in the rich text file and the hierarchical information corresponding to each element;

[0100] A processing unit, configured to perform formatting processing on each element and the hierarchical information to generate a target formatted text.

[0101] As an optional embodiment, the processing unit includes:

[0102] A first conversion subunit, configured to convert at least one of title and title hierarchy information, paragraph and paragraph hierarchy information, table and table hierarchy information, and picture and picture hierarchy information into corresponding formatted text;

[0103] A generation subunit, configured to generate target formatted text by using the at least one converted formatted text.

[0104] As an optional embodiment, the processing unit includes:

[0105] An extraction subunit, configured to extract pictures from the rich text file;

[0106] The first conversion subunit is configured to convert the pictures and picture hierarchy information of the rich text file into initial formatted text; wherein, in the initial formatted text, the positions of the pictures in the rich text file are occupied by specific symbols;

[0107] A second conversion subunit, configured to convert the extracted pictures into picture description text;

[0108] A replacement subunit, configured to replace the specific symbols in the initial formatted text with the picture description text to obtain the formatted text after conversion of the pictures and picture hierarchy information.

[0109] As an optional embodiment, the second conversion subunit is specifically configured to: convert the extracted pictures into picture description text through a large language model.

[0110] As an optional embodiment, the specific language generation module is specifically configured to:

[0111] Convert the target formatted text into a domain-specific language corresponding thereto through a large language model and a Prompt template.

[0112] As an optional embodiment, the specific language generation module includes:

[0113] A template generation unit, configured to generate a Prompt template according to specific requirements of a business application program; the specific requirements include at least one of content requirements and format requirements of the business application program;

[0114] A conversion unit, configured to convert the target formatted text into a domain-specific language that meets the specific requirements through a large language model and a Prompt template.

[0115] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.

[0116] See Figure 8 , Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device specifically includes:

[0117] A processor 21, a memory 22, and a computer program stored on the memory 22 and executable on the processor 21. The processor 21 executes the steps of the conversion method of the rich text file described in any of the above method embodiments through the computer program.

[0118] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may further include an AI (Artificial Intelligence) processor, and the AI processor is used to process computing operations related to machine learning.

[0119] The memory 22 may include one or more computer-readable storage media, and the computer-readable storage media may be non-transitory. The memory 22 may further include a high-speed random access memory and a non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 22 is at least used to store the following computer program 221. After the computer program is loaded and executed by the processor 21, it can implement the relevant steps in the conversion method of the rich text file disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 22 may further include an operating system 222 and data 223, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 222 may include Windows, Unix, Linux, etc.

[0120] In some embodiments, the electronic device may further include a display screen 23, an input / output interface 24, a communication interface 25, a sensor 26, a power supply 27, and a communication bus 28.

[0121] Of course, Figure 8 the structure of the shown electronic device does not constitute a limitation on the electronic device in the embodiments of the present application. In practical applications, the electronic device may include more or fewer components than Figure 8 those shown, or combine certain components.

[0122] In another exemplary embodiment, a computer storage medium is further provided. When the program instructions are executed by a processor, the steps of the conversion method of the rich text file described in any of the above method embodiments are implemented. Wherein, the storage medium may include: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc., which can store program codes.

[0123] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and will not be elaborated herein.

[0124] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless otherwise clearly specified in the context, the singular forms "a", "an", and "the" as used herein may also include the plural form. The terms "include", "comprise", "contain", and "have" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be executed in the specific order described or illustrated, unless the execution order is explicitly stated. It should also be understood that alternative or additional steps may be used.

[0125] The above are only specific embodiments of the present invention, enabling those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the broadest scope consistent with the principles and novel features claimed herein.< / t> < / row> "Mark the table, and use" for the rows in the table

Claims

1. A conversion method for rich text files, characterized in that, Including: Obtain a rich text file to be processed; Perform formatting processing on the rich text file to generate a target formatted text; If the rich text file includes pictures, during formatting processing, replace the pictures with picture description texts corresponding to the pictures to generate a target formatted text; Generate a corresponding domain-specific language according to the target formatted text.

2. The conversion method according to claim 1, wherein The performing formatting processing on the rich text file to generate a target formatted text includes: Determine each element in the rich text file and the hierarchical information corresponding to each element; Perform formatting processing on each element and the hierarchical information to generate a target formatted text.

3. The conversion method according to claim 2, wherein The performing formatting processing on each element and the hierarchical information to generate a target formatted text includes: Convert at least one of the title and title hierarchical information, paragraph and paragraph hierarchical information, table and table hierarchical information, picture and picture hierarchical information into corresponding formatted texts; Generate a target formatted text by using at least one of the converted formatted texts.

4. The conversion method according to claim 3, wherein Converting the picture and picture hierarchical information into corresponding formatted texts includes: Extract pictures from the rich text file; Convert the pictures and picture hierarchical information of the rich text file into an initial formatted text; wherein, in the initial formatted text, the positions of the pictures in the rich text file are occupied by specific symbols; Convert the extracted pictures into picture description texts; Replace the specific symbols in the initial formatted text with the picture description texts to obtain the formatted text after conversion of the pictures and picture hierarchical information.

5. The conversion method according to claim 6, characterized in that, The converting the extracted pictures into picture description texts includes: Convert the extracted pictures into picture description texts through a large language model.

6. The conversion method according to any one of claims 1 to 5, characterized in that The generating a corresponding domain-specific language according to the target formatted text includes: Convert the target formatted text into a corresponding domain-specific language through a large language model and a Prompt template.

7. The conversion method according to claim 6, wherein The converting the target formatted text into a corresponding domain-specific language through a large language model and a Prompt template includes: Generate a Prompt template according to the specific requirements of the business application; the specific requirements include at least one of the content requirements and format requirements of the business application; Convert the target formatted text into a domain-specific language that meets the specific requirements through a large language model and a Prompt template.

8. A conversion device for rich text files, characterized in that, Including: An acquisition module for acquiring a rich text file to be processed; A formatting processing module for performing formatting processing on the rich text file to generate a target formatted text; If the rich text file includes pictures, during formatting processing, replace the pictures with picture description texts corresponding to the pictures to generate a target formatted text; A specific language generation module for generating a corresponding domain-specific language according to the target formatted text.

9. An electronic device, characterized in that, Including: A processor, a memory, and a computer program stored on the memory and executable on the processor, and the processor executes the steps of the conversion method of the rich text file according to any one of claims 1 to 7 of the present application through the computer program.

10. A computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions for performing the steps of the rich text file conversion method according to any one of claims 1 to 7 of the present application.