HTML text conversion method and device, equipment and storage medium

By replacing the images and table fields in the HTML text, and based on the maximum character conversion length splitting and conversion HTML text, the image lack of image, chaos and content of the format format during HTML text conversion have been solved. Integration and readability.

CN119358513APending Publication Date: 2025-01-24CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411455541.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

When converting HTML text to standard text formats, there are problems such as inability to parse and download images, confusing table formats, incomplete content, and difficulty in processing non-standard HTML tags.

Method used

The candidate HTML text is obtained by replacing the networked image image fields in the HTML text with the target binary data, and replacing the table fields of the super-standard table with the table data of the reconstructed table. Then the candidate HTML text is split into multiple content areas to be converted based on the maximum character conversion length, and converted into target content areas in the corresponding text format, and finally spliced ​​into the target text.

Benefits of technology

It effectively solves the problems of missing images, disordered table formats and incomplete content, ensuring that the converted content is complete and well readable, and is suitable for web page conversion of non-standard HTML tags and attributes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358513A_ABST
    Figure CN119358513A_ABST
Patent Text Reader

Abstract

The invention relates to the field of natural language processing, and provides an HTML (Hypertext Markup Language) text conversion method, device and equipment and a storage medium, which are used for replacing image fields of various networked images in a to-be-converted HTML text with corresponding target binary data and replacing table fields of various super-specification tables in the to-be-converted HTML text with table data of corresponding reconstructed tables. According to the method, the content layout and data elements of an original webpage are reserved to the maximum extent, and the problems of image missing, table format disorder, table content dislocation and the like are solved; based on the maximum character conversion length, the candidate HTML text is split into a plurality of to-be-converted content areas, the to-be-converted content areas comprise at least one complete multimedia content, a target content area obtained after the plurality of to-be-converted content areas are converted is spliced, and a target text is obtained, and the export limitation problem of the excessive text and the difficult identification problem of the non-standard HTML text are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] Diversified web page layouts and personalized content elements can bring users stronger visual impact and richer reading experience. However, with the gradual weakening of page writing standards and the widespread use of custom plug-ins, while providing convenience for web page design, it also brings many challenges to web page maintenance. Converting web page content into a specific format (such as portable file format PDF, Word document, etc.) is one of them.

[0003] The Hypertext Markup Language (HTML) text of the directly exported web page is composed of various HTML tags, attributes and content strings, which lacks intuitive readability and presentation. Therefore, the HTML text needs to be converted into a standard text format that can retain the original web page layout and various elements for easy display and storage.

[0004] When converting HTML text to standard text format, the following problems may occur: (1) It is impossible to parse and download images in HTML text, and thus it is impossible to insert the corresponding images into the converted standard text format, resulting in incomplete content; (2) When converting tables in HTML text, the arrangement and layout of tables in different formats deviate, reducing the readability of the data and making it difficult for users to understand and analyze the information in the table; (3) Due to the limitation of character conversion length, longer HTML text may not be fully converted, resulting in incomplete content; (4) Non-standard HTML tags and attributes (for example, tags introduced by custom frameworks or libraries) are often used in modern web pages. These tags may not be correctly recognized and processed by traditional HTML parsers, resulting in conversion failure. Summary of the invention

[0005] The embodiments of the present application provide an HTML text conversion method, apparatus, device and storage medium to solve the conversion problem generated when converting HTML text into a standard text format.

[0006] In a first aspect, an embodiment of the present application provides an HTML text conversion method, comprising:

[0007] Replacing the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and replacing the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table, to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table;

[0008] Based on the maximum character conversion length, splitting the candidate HTML text into a plurality of content regions to be converted, wherein the content regions to be converted include at least one complete multimedia content;

[0009] The plurality of content areas to be converted are converted into target content areas in corresponding text formats, and the plurality of target content areas are spliced ​​to obtain a target text.

[0010] Optionally, replacing the image field of each networked image in the HTML text to be converted with corresponding target binary data includes:

[0011] By scanning the HTML text to be converted, the image field position of each of the networked images and the attribute position of each attribute parameter in the field are obtained;

[0012] According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data;

[0013] According to the image field position, the image field of each networked image in the HTML text to be converted is replaced with the corresponding target binary data.

[0014] Optionally, replacing the table fields of each oversized table in the to-be-converted HTML text with table data of a corresponding reconstructed table includes:

[0015] Based on the table field start and end characters, obtaining the table fields of each of the over-specification tables in the HTML text to be converted;

[0016] Based on the arrangement sequence number of each of the over-specification tables in the HTML text to be converted, the table fields of each of the over-specification tables are replaced with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

[0017] Optionally, the following operations are performed for one of the oversized tables to obtain one of the reconstructed tables:

[0018] storing the table data extracted from one of the over-specification tables as a two-dimensional data list in the form of a row and column array;

[0019] According to the form specification requirements, adjusting the parameter values ​​of the attribute parameters in the form fields of the super-specification form to obtain a standard specification form;

[0020] Fill the table data recorded in the two-dimensional data list into a standard specification table to obtain the corresponding reconstructed table.

[0021] In a second aspect, the embodiment of the present application further provides an HTML text conversion device, comprising:

[0022] a replacement unit, configured to replace the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and to replace the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table, to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table;

[0023] A splitting unit, configured to split the candidate HTML text into a plurality of content regions to be converted based on a maximum character conversion length, wherein the content regions to be converted include at least one complete multimedia content;

[0024] The conversion unit is used to convert the multiple content areas to be converted into target content areas in corresponding text formats, and to splice the multiple target content areas to obtain a target text.

[0025] Optionally, the replacement unit is used to:

[0026] By scanning the HTML text to be converted, the image field position of each of the networked images and the attribute position of each attribute parameter in the field are obtained;

[0027] According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data;

[0028] According to the image field position, the image field of each networked image in the HTML text to be converted is replaced with the corresponding target binary data.

[0029] Optionally, the replacement unit is used to:

[0030] Based on the table field start and end characters, obtaining the table fields of each of the over-specification tables in the HTML text to be converted;

[0031] Based on the arrangement sequence number of each of the over-specification tables in the HTML text to be converted, the table fields of each of the over-specification tables are replaced with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

[0032] Optionally, the HTML text conversion device further comprises a reconstruction unit, wherein the reconstruction unit performs the following operations on one of the over-specification tables to obtain a reconstructed table:

[0033] storing the table data extracted from one of the over-specification tables as a two-dimensional data list in the form of a row and column array;

[0034] According to the form specification requirements, adjusting the parameter values ​​of the attribute parameters in the form fields of the super-specification form to obtain a standard specification form;

[0035] Fill the table data recorded in the two-dimensional data list into a standard specification table to obtain the corresponding reconstructed table.

[0036] In a third aspect, an embodiment of the present application further provides a computer device, comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of any one of the above-mentioned HTML text conversion methods.

[0037] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which includes a program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of any one of the above-mentioned HTML text conversion methods.

[0038] The beneficial effects of this application are as follows:

[0039] An embodiment of the present application provides an HTML text conversion method, apparatus, device and storage medium, the method specifically comprising: replacing the image field of each networked image in the HTML text to be converted with corresponding target binary data, and replacing the table field of each over-specification table in the HTML text to be converted with table data of the corresponding reconstructed table to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table; based on the maximum character conversion length, splitting the candidate HTML text into multiple content areas to be converted, the content area to be converted contains at least one complete multimedia content; converting the multiple content areas to be converted into target content areas in the corresponding text format, and splicing the multiple target content areas to obtain the target text.

[0040] This application replaces the image fields of networked images that need to be downloaded online with target binary data. Since the target binary data contains all the original information of the networked image, such as pixel data, file header information and metadata, when converting HTML text to standard text format, the image content can be restored by extracting and parsing this information. This application replaces the table fields of oversized tables whose sizes exceed the specified range with the table data of the corresponding reconstructed table, which can avoid problems such as format confusion, data loss or inconsistent layout during the conversion process. By performing the above-mentioned replacement operation, this application retains the content layout and data elements of the original web page to the greatest extent, and solves problems such as missing images, disordered table formats, and misplaced table content.

[0041] This application uses extreme text splitting to solve the problem of export restriction of excessive text. Based on the maximum character conversion length, the candidate HTML text is split into multiple content areas to be converted. Each content area to be converted contains at least one complete multimedia content. While accurately extracting text information, it can ensure that the converted content is complete and has good readability, so that users can easily understand and use the converted content. Using the method provided by this application, it also has good performance when converting original web pages using non-standard HTML tags and attributes into content in standard text format, enhancing generalization and robustness.

[0042] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0044] Figure 1A A schematic diagram of a process for converting the HTML text of an original web page into a standard text format provided in an embodiment of the present application;

[0045] Figure 1B A logical schematic diagram of converting the HTML text of an original web page into a standard text format provided in an embodiment of the present application;

[0046] Figure 1C A schematic diagram of an original web page provided in an embodiment of the present application;

[0047] Figure 1D A schematic diagram of a portion of HTML text to be converted provided in an embodiment of the present application;

[0048] Figure 1E A schematic diagram of an image index dictionary provided in an embodiment of the present application;

[0049] Figure 1F A schematic diagram of a table index dictionary provided in an embodiment of the present application;

[0050] Figure 1G A schematic diagram of a process for replacing an image field of a networked image provided by an embodiment of the present application;

[0051] Figure 1H A schematic diagram of a specific example of replacing an image field of a networked image provided in an embodiment of the present application;

[0052] Fig. 1I A schematic diagram of a process for replacing table fields of an oversized table provided in an embodiment of the present application;

[0053] Figure 1J A schematic diagram of a specific example of replacing table fields of an oversized table provided in an embodiment of the present application;

[0054] Figure 1K A schematic diagram of a content area to be converted provided in an embodiment of the present application;

[0055] Figure 1L A schematic diagram of the converted target text provided in the embodiment of the present application;

[0056] Figure 2 A schematic diagram of the structure of an HTML text conversion device provided in an embodiment of the present application;

[0057] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0058] Figure 4 Schematic diagram of the structure of a computing device in an embodiment of the present application. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.

[0060] Some of the terms used in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.

[0061] 1. HTML: It is a markup language. It includes a series of tags, which can unify the document format on the Internet and connect scattered network resources into a logical whole.

[0062] HTML is often used by many websites together with CSS and JavaScript to design the user interfaces of web pages, web applications, and mobile applications. Web browsers can read HTML files and render them into visual web pages.

[0063] 2. User-Agent: It is a request header field used to identify the client software (such as browser, crawler, etc.) that initiates the request and its version information. The server can identify the type and version of the client based on the User-Agent, thereby providing content that is more suitable for the client.

[0064] 3. Cookie: It is a request header field used to transfer session state information or other persistent data between the client and the server.

[0065] The following is a brief introduction to the design concept of the embodiment of the present application:

[0066] Diversified web page layouts and personalized content elements can bring users stronger visual impact and richer reading experience. However, with the gradual weakening of page writing standards and the widespread use of custom plug-ins, while providing convenience for web page design, it also brings many challenges to web page maintenance. Converting web page content into a specific format (such as portable file format PDF, Word document, etc.) is one of them.

[0067] The HTML text of a directly exported web page is composed of various HTML tags, attributes, and content strings, which lacks intuitive readability and presentation. Therefore, the HTML text needs to be converted into a standard text format that can retain the original web page layout and various elements for easy display and storage.

[0068] When converting HTML text to standard text format, the following problems may occur: (1) It is impossible to parse and download images in HTML text, and thus it is impossible to insert the corresponding images into the converted standard text format, resulting in incomplete content; (2) When converting tables in HTML text, the arrangement and layout of tables in different formats deviate, reducing the readability of the data and making it difficult for users to understand and analyze the information in the table; (3) Due to the limitation of character conversion length, longer HTML text may not be fully converted, resulting in incomplete content; (4) Non-standard HTML tags and attributes (for example, tags introduced by custom frameworks or libraries) are often used in modern web pages. These tags may not be correctly recognized and processed by traditional HTML parsers, resulting in conversion failure.

[0069] In view of this, an embodiment of the present application provides an HTML text conversion method, apparatus, device and storage medium, the method specifically comprising: replacing the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and replacing the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table; based on the maximum character conversion length, splitting the candidate HTML text into multiple content areas to be converted, the content area to be converted contains at least one complete multimedia content; converting the multiple content areas to be converted into target content areas in the corresponding text format, and splicing the multiple target content areas to obtain the target text.

[0070] This application replaces the image fields of networked images that need to be downloaded online with target binary data. Since the target binary data contains all the original information of the networked image, such as pixel data, file header information and metadata, when converting HTML text to standard text format, the image content can be restored by extracting and parsing this information. This application replaces the table fields of oversized tables whose sizes exceed the specified range with the table data of the corresponding reconstructed table, which can avoid problems such as format confusion, data loss or inconsistent layout during the conversion process. By performing the above-mentioned replacement operation, this application retains the content layout and data elements of the original web page to the greatest extent, and solves problems such as missing images, disordered table formats, and misplaced table content.

[0071] This application uses extreme text splitting to solve the problem of export restriction of excessive text. Based on the maximum character conversion length, the candidate HTML text is split into multiple content areas to be converted. Each content area to be converted contains at least one complete multimedia content. While accurately extracting text information, it can ensure that the converted content is complete and has good readability, so that users can easily understand and use the converted content. Using the method provided by this application, it also has good performance when converting original web pages using non-standard HTML tags and attributes into content in standard text format, enhancing generalization and robustness.

[0072] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0073] The HTML text conversion method provided in this application can be applied to clients, servers or other application scenarios with HTML text conversion requirements. Figure 1A-1BThe schematic diagram shown specifically introduces the process of converting the HTML text of the original web page into a standard text format.

[0074] S101: Replace the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and replace the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table to obtain a candidate HTML text, where the reconstructed table is obtained by standardizing the over-specification table.

[0075] Before executing step 101, an image index dictionary and a table index dictionary are first constructed. The image index dictionary records the image name and original binary data of each networked image in the HTML text to be converted. The table index dictionary records the arrangement sequence number of each oversized table in the HTML text to be converted and the adjusted reconstructed table.

[0076] Based on the image download path recorded in the HTML text to be converted (such as the uniform resource locator URL address of the image), remove the empty value images (such as invalid images with incorrect paths or that have been deleted) and local images (such as the path containing words such as Desktop / xx / xx, etc.) in the HTML text to be converted, and retain the networked images that need to be downloaded online.

[0077] Establish an HTTP request, and based on the page information of the HTML text to be converted, modify the client identification information (such as User-Agent, Cookie) in the Hypertext Transfer Protocol HTTP request header. Then, based on the image download path of each networked image in the HTML text to be converted and the modified HTTP request header, generate multiple image data acquisition requests. Based on the multiple image data acquisition requests, obtain the initial binary data of each networked image, and associate the image name of each networked image with the initial binary data and store them as an image index dictionary.

[0078] For each over-specification table whose table size exceeds the maximum specified range, the following operations are performed respectively: the table data extracted from an over-specification table is stored as a two-dimensional data list in the form of a row and column array; according to the table specification requirements, the parameter values ​​of each attribute parameter in the table field of the over-specification table are adjusted, and the table size (table width and table height), fill color, line color, font size, font, text color, text format (center, left / right aligned, justified, etc.) of the text in the table are reset to obtain a standard specification table; the table data recorded in the two-dimensional data list is filled into the standard specification table to obtain the corresponding reconstructed table.

[0079] Traverse each super-specification table in the HTML text to be converted in turn, obtain the arrangement number of each super-specification table in the text, and associate the arrangement number of each super-specification table with the reconstructed table and store it as a table index dictionary. Super-specification tables are prone to problems such as disordered table format and misplaced table content during the conversion process. Therefore, this application only counts the arrangement numbers of super-specification tables. When there are multiple standard specification tables between two super-specification tables, the arrangement number of super-specification table a is 01, and the arrangement number of super-specification table b is 02.

[0080] For example, for Figure 1C Decode the original web page shown and export Figure 1D Based on the URL address of the networked image, the initial binary data of the image is requested, and the image name of the networked image and the initial binary data are associated to obtain Figure 1E The image index dictionary shown. The table data extracted from the super-specification table is stored in the form of a row and column array. By adjusting the parameter values ​​of each attribute parameter in the table field of the super-specification table, the table size (table width and table height), fill color, line color, font size, font, text color, text format (center, left / right alignment, justification, etc.) of the table text are reset, and the extracted table data is filled into the standard specification table to obtain the corresponding reconstructed table. By associating the arrangement sequence number of the super-specification table in the text with the reconstructed table, the Figure 1F The table index dictionary shown.

[0081] When executing step 101, the process of replacing the image field is as follows: Figure 1G As shown:

[0082] S1011: Obtain the image field position of each networked image and the attribute position of each attribute parameter in the field by scanning the HTML text to be converted.

[0083] The image name that hits the image index dictionary in the HTML text to be converted is used as the image field start character of the corresponding networked image. The attribute parameters (such as image height, image width, image style, alt, lastModify, etc.) and connection marks (such as ">", "\>", etc.) following the start character of each image field are scanned respectively to obtain the image field position of each networked image and the attribute position of each attribute parameter in the field.

[0084] S1012: According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data.

[0085] Adjust the initial binary data of each networked image according to the attribute positions of the attribute parameters within the field, so that the attribute positions of the attribute parameters in the initial binary data of each networked image are consistent with those of the corresponding image field in the HTML text, to ensure that the content of the image can be correctly restored during the conversion process.

[0086] S1013: Replace the image fields of each networked image in the HTML text to be converted with the corresponding target binary data according to the image field positions.

[0087] For example, for Figure 1D in the networked image, perform image field replacement to obtain Figure 1H the candidate HTML text shown.

[0088] When performing step 101, the process of replacing the image field is as Fig. 1I shown:

[0089] S1011’: Obtain the table fields of each oversized table in the HTML text to be converted based on the table field start and end delimiters.

[0090] During the conversion process, only one identifier is supported as the benchmark for splitting the HTML text to be converted. Therefore, replace the table field end identifier of the table field with the table field start identifier (i.e., replace with <table), and then use the table field start identifier (<table) as the splitting identifier to split the HTML text to be converted to obtain the table fields of each oversized table in the HTML text to be converted.

[0091] S1012’: Based on the arrangement sequence numbers of each oversized table in the HTML text to be converted, replace the table fields of each oversized table with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

[0092] Based on the arrangement sequence numbers of each oversized table in the HTML text to be converted, obtain the associated reconstructed table in the table index dictionary, and then replace the table fields of each oversized table with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

[0093] For example, for Figure 1D in the oversized table, perform table field replacement to obtain Figure 1J the candidate HTML text shown.

[0094] S102: Based on the maximum character conversion length, split the candidate HTML text into multiple content areas to be converted, and the content areas to be converted contain at least one complete multimedia content.

[0095] This application uses text extreme splitting to solve the problem of export restriction of excessive text. Based on the maximum character conversion length, the candidate HTML text is split into multiple content areas to be converted, one of which is as follows: Figure 1K As shown, the content area to be converted contains at least one complete multimedia content.

[0096] Assuming that the content area obtained by segmentation based on the maximum character conversion length is incomplete, then backtrack to the last complete multimedia content and cut it based on the end position of the multimedia content to obtain a content area to be converted.

[0097] S103: converting multiple content areas to be converted into target content areas in corresponding text formats, and concatenating the multiple target content areas to obtain a target text.

[0098] Perform format conversion on multiple content areas to be converted respectively to obtain target content areas in corresponding text format, and then sequentially splice multiple target content areas to obtain Figure 1L The target text shown.

[0099] During the conversion process, for local images, the corresponding images can be downloaded locally based on the image download path of the local images. If the download of local images is not supported, the preset default images can be filled in the corresponding image positions to avoid image loss and ensure content integrity. For standard specification tables, the table conversion is directly performed to obtain the table content in the corresponding text format.

[0100] Since the present application replaces the image fields of networked images and the table fields of oversized tables, it retains the content layout and data elements of the original web page to the greatest extent, thereby avoiding problems such as formatting errors, data loss or layout inconsistency during the conversion process, and solves problems such as missing images, incorrect table formats, and misplaced table content.

[0101] This application uses extreme text splitting to solve the export restriction problem of excessive text, accurately extracting text information while ensuring that the converted content is complete and readable, so that users can easily understand and use the converted content. The method provided by this application supports the conversion of various common text formats to meet the import, export and storage needs of different people, and the method also performs well when converting original web pages that use non-standard HTML tags and attributes, enhancing generalization and robustness.

[0102] Based on the same inventive concept as the above method embodiment, the present application embodiment also provides an HTML text conversion device. Figure 2 As shown, the HTML text conversion device 200 may include:

[0103] The replacement unit 201 is used to replace the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and replace the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table;

[0104] A splitting unit 202, configured to split the candidate HTML text into a plurality of content regions to be converted based on a maximum character conversion length, wherein the content regions to be converted include at least one complete multimedia content;

[0105] The conversion unit 203 is used to convert the multiple content areas to be converted into target content areas in a corresponding text format, and to splice the multiple target content areas to obtain a target text.

[0106] Optionally, the replacement unit 201 is used to:

[0107] By scanning the HTML text to be converted, the image field position of each of the networked images and the attribute position of each attribute parameter in the field are obtained;

[0108] According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data;

[0109] According to the image field position, the image field of each networked image in the HTML text to be converted is replaced with the corresponding target binary data.

[0110] Optionally, the replacement unit 201 is used to:

[0111] Based on the table field start and end characters, obtaining the table fields of each of the over-specification tables in the HTML text to be converted;

[0112] Based on the arrangement sequence number of each of the over-specification tables in the HTML text to be converted, the table fields of each of the over-specification tables are replaced with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

[0113] Optionally, the HTML text conversion device 200 further includes a reconstruction unit 204, and the reconstruction unit 204 performs the following operations on one of the oversized tables to obtain a reconstructed table:

[0114] storing the table data extracted from one of the over-specification tables as a two-dimensional data list in the form of a row and column array;

[0115] According to the form specification requirements, adjusting the parameter values ​​of the attribute parameters in the form fields of the super-specification form to obtain a standard specification form;

[0116] Fill the table data recorded in the two-dimensional data list into a standard specification table to obtain the corresponding reconstructed table.

[0117] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

[0118] After introducing the HTML text conversion method and apparatus according to an exemplary embodiment of the present application, next, a computer device according to another exemplary embodiment of the present application is introduced.

[0119] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0120] Based on the same inventive concept as the above method embodiment, the present application embodiment also provides a computer device, see Figure 3 As shown, the computer device 300 may include at least a processor 301 and a memory 302. The memory 302 stores program codes, and when the program codes are executed by the processor 301, the processor 301 executes any one of the steps of the above-mentioned HTML text conversion method.

[0121] In some possible implementations, the computing device according to the present application may include at least one processor and at least one memory. The memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the HTML text conversion method according to various exemplary implementations of the present application described above in this specification. For example, the processor may execute the following steps: Figure 1A Follow the steps shown in .

[0122] Refer to the following Figure 4 hereinafter, a computing device 400 according to this embodiment of the present application is described. Figure 4 The computing device 400 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0123] like Figure 4As shown, the computing device 400 is in the form of a general computing device. The components of the computing device 400 may include but are not limited to: at least one processing unit 401, at least one storage unit 402, and a bus 403 connecting different system components (including the storage unit 402 and the processing unit 401).

[0124] Bus 403 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a processor, or a local bus using any of a variety of bus architectures.

[0125] The storage unit 402 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 4021 and / or a cache memory unit 4022 , and may further include a read-only memory (ROM) 4023 .

[0126] The storage unit 402 may also include a program / utility 4025 having a set (at least one) of program modules 4024, such program modules 4024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0127] The computing device 400 may also communicate with one or more external devices 404 (e.g., keyboards, pointing devices, etc.), one or more devices that enable a user to interact with the computing device 400, and / or any device that enables the computing device 400 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 405. In addition, the computing device 400 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 406. As shown, the network adapter 406 communicates with other modules for the computing device 400 via a bus 403. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the computing device 400, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0128] Based on the same inventive concept as the above method embodiment, various aspects of the HTML text conversion method provided by the present application can also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the HTML text conversion method according to various exemplary embodiments of the present application described above in this specification. For example, the computer device can execute the following steps: Figure 1A Follow the steps shown in .

[0129] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0130] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0131] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for converting HTML text, characterized in that: include: Replacing the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and replacing the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table, to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table; Based on the maximum character conversion length, splitting the candidate HTML text into a plurality of content regions to be converted, wherein the content regions to be converted include at least one complete multimedia content; The plurality of content areas to be converted are converted into target content areas in corresponding text formats, and the plurality of target content areas are spliced ​​to obtain a target text.

2. The method according to claim 1, characterized in that The step of replacing the image field of each networked image in the HTML text to be converted with the corresponding target binary data includes: By scanning the HTML text to be converted, the image field position of each of the networked images and the attribute position of each attribute parameter in the field are obtained; According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data; According to the image field position, the image field of each networked image in the HTML text to be converted is replaced with the corresponding target binary data.

3. The method according to claim 1, characterized in that The step of replacing the table fields of each over-specification table in the to-be-converted HTML text with the table data of the corresponding reconstructed table includes: Based on the table field start and end characters, obtaining the table fields of each of the over-specification tables in the HTML text to be converted; Based on the arrangement sequence number of each of the super-specification tables in the HTML text to be converted, the table fields of each of the super-specification tables are replaced with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

4. The method according to claim 3, characterized in that Perform the following operations on one of the over-specification tables to obtain one of the reconstructed tables: storing the table data extracted from one of the over-specification tables as a two-dimensional data list in the form of a row and column array; According to the form specification requirements, adjusting the parameter values ​​of the attribute parameters in the form fields of the super-specification form to obtain a standard specification form; Fill the table data recorded in the two-dimensional data list into a standard specification table to obtain the corresponding reconstructed table.

5. An HTML text conversion device, characterized in that: include: a replacement unit, configured to replace the image field of each networked image in the HTML text to be converted with the corresponding target binary data, and to replace the table field of each over-specification table in the HTML text to be converted with the table data of the corresponding reconstructed table, to obtain a candidate HTML text, wherein the reconstructed table is obtained by standardizing the over-specification table; A splitting unit, configured to split the candidate HTML text into a plurality of content regions to be converted based on a maximum character conversion length, wherein the content regions to be converted include at least one complete multimedia content; The conversion unit is used to convert the multiple content areas to be converted into target content areas in corresponding text formats, and to splice the multiple target content areas to obtain a target text.

6. The device according to claim 5, characterized in that The replacement unit is used for: By scanning the HTML text to be converted, the image field position of each of the networked images and the attribute position of each attribute parameter in the field are obtained; According to the attribute position of each attribute parameter in the field, the initial binary data of each networked image is adjusted to obtain corresponding target binary data; According to the image field position, the image field of each networked image in the HTML text to be converted is replaced with the corresponding target binary data.

7. The device according to claim 5, characterized in that The replacement unit is used for: Based on the table field start and end characters, obtaining the table fields of each of the over-specification tables in the HTML text to be converted; Based on the arrangement sequence number of each of the super-specification tables in the HTML text to be converted, the table fields of each of the super-specification tables are replaced with the table data of the reconstructed table associated with the corresponding arrangement sequence number.

8. The device according to claim 7, characterized in that The HTML text conversion device further comprises a reconstruction unit, which performs the following operations on one of the over-specification tables to obtain a reconstructed table: storing the table data extracted from one of the over-specification tables as a two-dimensional data list in the form of a row and column array; According to the form specification requirements, adjusting the parameter values ​​of the attribute parameters in the form fields of the super-specification form to obtain a standard specification form; Fill the table data recorded in the two-dimensional data list into a standard specification table to obtain the corresponding reconstructed table.

9. A computer device, characterized in that: It comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of the method according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The method comprises a program code, and when the program code is run on a computer device, the program code is used to make the computer device execute the steps of the method according to any one of claims 1 to 4.