Data transfer methods, data display methods, devices, equipment and storage media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-09
- Publication Date
- 2026-08-14
AI Technical Summary
[0002]由于不同的客户端可能是基于不同的软、硬件开发的,因此,不同的客户端对从页面获取的数据信息进行渲染显示时,可能出现渲染显示异常
[0028] According to the scheme disclosed herein, the various types of data of the target object are rendered, the target elements that cannot be displayed normally are identified, and the target elements are converted into images, so that the various types of data of the target object can be displayed normally on different clients.
Smart Images

Figure CN115758011B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to the fields of big data and intelligent search technology. Background Technology
[0002] Since different clients may be developed based on different software and hardware, rendering and display errors may occur when different clients render and display the data information obtained from the page. Summary of the Invention
[0003] This disclosure provides a data transfer method, a data display method, an apparatus, a device, and a storage medium.
[0004] According to one aspect of this disclosure, a data transfer method is provided, comprising:
[0005] Based on the rich text content of the target object's multi-class first data, the target object is visualized and rendered to obtain the visualization result. The multi-class first data is the data obtained from the target webpage.
[0006] If the visualization results contain target elements that display abnormally, obtain the style resources of the target elements from the target webpage;
[0007] Generate the first image based on the rich text content and style resources corresponding to the target element;
[0008] Use the first image to replace the rich text content corresponding to the target element.
[0009] According to one aspect of this disclosure, a data display method is provided, comprising:
[0010] In response to an access request to the target object, retrieve multiple types of data about the target object;
[0011] When the rich text content of multiple data types contains the storage address of the first image, the first image is retrieved based on the storage address. The first image is generated using the data transfer method described above.
[0012] Based on the rich text content of multiple types of data and the first image, the target object is visualized and rendered to obtain the visualization result.
[0013] According to another aspect of this disclosure, a data transfer device is provided, comprising:
[0014] The first rendering module is used to perform visual rendering on the target object based on the rich text content of the multiple types of first data of the target object, and obtain the visualization result. The multiple types of first data are data obtained from the target webpage.
[0015] The style retrieval module is used to retrieve the style resources of the target element from the target webpage when the visualization results contain the target element with abnormal display.
[0016] The image generation module is used to generate the first image based on the rich text content and style resources corresponding to the target element;
[0017] The first replacement module is used to replace the rich text content corresponding to the target element using the first image.
[0018] According to another aspect of this disclosure, a data display device is provided, comprising:
[0019] The data acquisition module is used to acquire various types of data about the target object in response to access requests for the target object.
[0020] The second image acquisition module is used to acquire the first image based on its storage address when the rich text content of multiple types of data contains the storage address of the first image. The first image is generated by the data transfer device according to any of the above embodiments.
[0021] The second rendering module is used to perform visual rendering of the target object based on the rich text content of multiple types of data and the first image, and obtain the visualization result.
[0022] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0023] At least one processor; and
[0024] The memory is communicatively connected to the at least one processor; wherein,
[0025] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any aspect of the embodiments of this disclosure.
[0026] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform a method according to any aspect of the embodiments of this disclosure.
[0027] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the method according to any aspect of the embodiments of this disclosure.
[0028] According to the scheme disclosed herein, the various types of data of the target object are rendered, the target elements that cannot be displayed normally are identified, and the target elements are converted into images, so that the various types of data of the target object can be displayed normally on different clients.
[0029] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0030] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0031] Figure 1 This is a schematic flowchart of a data transfer method according to an embodiment of the present disclosure;
[0032] Figure 2 This is a flowchart illustrating a data transfer method according to another embodiment of the present disclosure;
[0033] Figure 3 This is a flowchart illustrating a test question transfer method according to an embodiment of this disclosure;
[0034] Figure 4 This is a flowchart illustrating a data display method according to an embodiment of the present disclosure;
[0035] Figure 5 This is a schematic flowchart of a data transfer device according to an embodiment of the present disclosure;
[0036] Figure 6 This is a schematic flowchart of a data display device according to an embodiment of the present disclosure;
[0037] Figure 7 This is a block diagram of an electronic device used to implement embodiments of the present disclosure. Detailed Implementation
[0038] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0039] With the development of science and technology, the popularization of internet information, artificial intelligence, big data, and the impact of the pandemic, the demand for online education is increasing. Online education cannot be separated from a large and high-quality test question resource library. In the process of building a test question resource library, the test question data obtained from online resources needs to be processed and transferred to obtain structured data that is easy to use.
[0040] Figure 1 This is a flowchart illustrating the data transfer method provided according to embodiments of this disclosure. For example... Figure 1The method includes at least the following steps:
[0041] S101: Based on the rich text content of the target object's multi-class first data, perform visualization rendering on the target object to obtain the visualization result. The multi-class first data is data obtained from the target webpage.
[0042] The target data can be test questions, practice questions, courseware, etc. Taking test questions as an example, the first data can be the question stem, answer data, option data, explanation data, or question type data, etc. Each test question forms structured data with its own question stem, answer data, option data, and explanation data.
[0043] Rich text content includes text content as well as font color, special punctuation, paragraph formatting, etc. Rich text content can also include images and tables.
[0044] Visualizing a target object can involve simulating a client's access to the target object and rendering its various primary data. The visualization result can be a rendered webpage.
[0045] S102: If the visualization results contain a target element that displays abnormally, obtain the style resources of the target element from the target webpage.
[0046] Display anomalies can include formatting errors, layout problems, and missing data. For example, formulas in a test question or parts of a chart might appear as black blocks. Therefore, the target element differs depending on the specific display anomaly. Taking the display anomaly of formula content in a test question as an example, the target element might be that the style of the rich text content corresponding to the formula cannot be loaded offline or on some clients.
[0047] Style resources can be obtained from the Cascading Style Sheets (CSS) document of the target webpage based on the style name of the target element.
[0048] S103: Generate the first image based on the rich text content and style resources corresponding to the target element.
[0049] Taking the formula content in the test question as the target element again, after obtaining the style resources, the formula content can be rendered and displayed normally based on the rich text content and style resources of the formula. After the formula content is displayed normally, the image of the area where the formula content is located in the visualization result can be fixed to obtain the first image.
[0050] S104: Replace the rich text content corresponding to the target element with the first image.
[0051] After obtaining the first image, replace the rich text content corresponding to the target element with the first image. After the target element is replaced, accessing and rendering the target object will no longer result in display errors.
[0052] In this embodiment of the disclosure, multiple target objects are visualized and rendered by simulating a client, and the target elements in the visualization results are gradually replaced. Through multiple iterations, the first data of multiple target objects of multiple types can be displayed normally in the rendered visualization results.
[0053] According to the solution of this disclosure embodiment, when acquiring various types of data of the target object, target elements that may not be displayed normally in the various types of data are converted into images, so that the target object can be displayed normally on different clients.
[0054] In one possible implementation, step S104: generating a first image based on the rich text content and style resources corresponding to the target element, further including the following steps:
[0055] S1041: Generate an HTML file based on the rich text content and style resources corresponding to the target element.
[0056] After identifying all target elements, the rich text content and style resources corresponding to each target element are used to generate an HTML file. Specifically, based on the name, identifier, or keywords of each target element, regular expressions are used to extract the rich text content of the target element from the Document Object Model (DOM) structure of the target object to generate the HTML file. Because the rich text content and style resources of the target elements are loaded, the target elements are displayed normally in the HTML file.
[0057] S1042: Convert the HTML file to an image format to obtain the first image.
[0058] HTML files can be converted to image formats using the wkhtmltopdf tool.
[0059] S1043: Store the first image and obtain the storage address of the first image.
[0060] After obtaining the first image, store it on the server and obtain the storage address of the first image, also known as the resource link.
[0061] In this embodiment of the disclosure, after the relevant content of the target element is loaded and displayed normally, the visualization result of the target element is converted into an image format and saved.
[0062] According to the solution of this embodiment, after the target element is converted into an image for storage, only the corresponding first image needs to be loaded during subsequent rendering, ensuring that the target element can be displayed normally.
[0063] In one possible implementation, step S1041: generating an HTML file based on the rich text content and style resources corresponding to the target element, further includes the following steps:
[0064] The rich text content corresponding to the target element is used as the main information, and the resource link of the static style file containing style resources is used as the header information to generate an HTML file.
[0065] In this embodiment of the disclosure, the resource link of the static style file containing style resources is used as header information, so that the HTML file can obtain the style resources from the static style file according to the style name corresponding to the target element when rendering.
[0066] According to the solution of this disclosure embodiment, the rich text content and style resources corresponding to the target element are written into an HTML file, so that the target element can be displayed normally when the HTML file is rendered, and it is convenient to convert the target element into an image format.
[0067] In one possible implementation, step S105: replacing the rich text content corresponding to the target element using the first image, including:
[0068] Based on the storage address of the first image, write the rich text content for the first image.
[0069] Specifically, the storage address, location, size, and other style information of the first image are compiled into rich text content in the style of rich text for the image.
[0070] Replace the rich text content of the target element with the rich text content of the first image.
[0071] In this embodiment of the disclosure, the rich text content corresponding to the target element is replaced with the rich text content of the newly generated first image, and the target element is deleted.
[0072] According to the solution of this disclosure embodiment, the content that could not be rendered normally is replaced with the corresponding image, which ensures that the content that could not be rendered normally can be displayed normally on various clients.
[0073] In one possible implementation, the data transfer method of this disclosure further includes the step of:
[0074] If the rich text content of any type of first data of the target object contains an image element, the second image is obtained based on the first storage address of the image element.
[0075] The second image is transferred to a different location, resulting in its second storage address.
[0076] Replace the first storage address with the second storage address.
[0077] In this embodiment of the disclosure, when the data of the target object contains image links to other websites or servers, the image is acquired and transferred to its own server.
[0078] According to the solution of this disclosure embodiment, transferring images from an external server to its own server can improve data loading speed, prevent data loss, and ensure accessibility.
[0079] Figure 2 This is a flowchart illustrating a data transfer method according to another embodiment of the present disclosure. In one possible implementation, the data transfer method of this disclosure further includes the step of:
[0080] S201: Obtain the Hypertext Markup Language text of the target webpage corresponding to the target object.
[0081] Based on the identifier of the target object, request the details page of the target object from the target webpage, thereby obtaining the Hyper Text Markup Language (HTML) source code of the page.
[0082] S202: Parse the document object model of the Hypertext Markup Language text to obtain the multi-class secondary data of the target object.
[0083] S203: Preprocess the multiple types of second data to obtain the multiple types of first data of the target object.
[0084] The definitions and content of the target website's multiple types of primary data may differ from the definitions of multiple types of secondary data. Therefore, the secondary data needs to be processed to obtain primary data that meets the usage requirements. For example, one type of secondary data might be question type data, where the target website only defines single-choice and multiple-answer questions. However, the primary data also defines multiple-choice questions with multiple correct answers. Therefore, the option data for these multiple-choice questions can be processed into structured data. Specifically, if an option is the correct answer, it is marked as selected; otherwise, it is marked as unselected. This allows for the selection of a subset of single-choice and multiple-answer questions to create multiple-choice questions with multiple correct answers, as needed.
[0085] According to the scheme of this disclosure embodiment, multiple types of second data are parsed from the source code obtained from the target webpage, and the multiple types of second data are processed to obtain structured data that meets the usage requirements.
[0086] In one possible implementation, step S203: preprocessing the multiple types of second data to obtain multiple types of first data of the target object, further includes the following steps:
[0087] The type of the target object is determined based on the multiple types of second data of the target object.
[0088] In one example, the target object is a test question, and the secondary data includes the question stem, options, and answers. If the secondary data for a test question does not include question type data, then the presence or absence of options data can be used to determine whether the question is a multiple-choice or fill-in-the-blank question. Furthermore, the content and number of answers in the answer data can be used to determine whether the question is a single-choice or multiple-answer question. If the secondary data includes question type data, other secondary data can be used to further determine whether the question type data is correct. For example, if a question is a single-choice question but the answer data contains multiple answers, then the question type can be changed to multiple-answer.
[0089] If the multiple types of second data of the target object conform to the preset verification rules corresponding to the type, data is extracted from the multiple types of second data according to the preset extraction rules to obtain the multiple types of first data of the target object.
[0090] In one example, the preset validation rules include:
[0091] The second type of data must include both the question stem data and the answer data.
[0092] For multiple-choice questions, the answer key must indicate that the correct answer is present in the answer choices. For example, if the answer to a question is C or F, then the answer choices must include six options from A to F.
[0093] For multiple-choice questions, the answer data should contain only one option.
[0094] For multiple-choice questions, the answer data should have at least two options.
[0095] Target objects that do not meet the preset validation rules can be discarded.
[0096] In one example, data is extracted from multiple categories of second data to obtain multiple categories of first data for the target object. The extraction method may include:
[0097] If the second set of data does not contain option data, but the options are in the question stem, then the option content in the question stem data will be extracted and used as option data in the first set of data.
[0098] If the second set of data does not contain option data or analysis data, but the answer contains analysis, then it is extracted into option data in the first set of data by matching keywords such as: analysis, evaluation, problem-solving ideas, etc.
[0099] If the answer data in the second type of data is not empty but the specific content is "omitted" or other non-substantive content, then the entire question is discarded.
[0100] For the question stem data in the second type of data, filter out useless serial number information such as 1, 2, 3, one, two, three, etc., to obtain the question stem data in the first type of data.
[0101] For the option data in the second type of data, remove the serial numbers (A, B, C, D, etc.) from the options and keep only the content to obtain the option data in the first type of data.
[0102] According to the scheme of the embodiments of this disclosure, the original data of the target object is parsed and extracted to obtain structured data that better meets the usage requirements, which facilitates the use of the data.
[0103] Data cleaning can also be performed during the extraction process. Specifically, this can include the following cleaning methods:
[0104] Clean up sensitive information, such as sensitive information contained in the alt attribute of the img tag, the class attribute of the p tag, and the class attribute of the div tag. External link validation: Filter out other domain information containing domains other than the domain name of the transferred image using regular expressions. Clean up other redundant information, such as unnecessary information. 、 、 Tags such as "etc." are used to clean up garbled content.
[0105] In one possible implementation, step S201: obtaining the Hypertext Markup Language text of the target webpage corresponding to the target object, further includes the following steps:
[0106] S2011: Based on the chapter information of the target website, obtain the identifiers of multiple target objects.
[0107] Chapter information can be obtained by traversing the chapter tree of the target website. The identifier of the target object can be key information or identification information.
[0108] In one example, the question ID can be written to the database, and the question ID can be used as a unique index to ensure the uniqueness of the question.
[0109] S2012: Through the production process, write the identifier of the target object in the uncaptured state into the task queue.
[0110] S2013: Based on the task queue, multiple consuming processes are used to retrieve the Hypertext Markup Language (HTML) text of the target webpage corresponding to the target object from the target website, each carrying a cookie. The cookie is obtained by simulating login to the target website.
[0111] By acquiring data of the target object in parallel through multiple consumer processes, the crawling efficiency can be improved. Once the crawling is successful, the identifier of the target object is removed from the task queue.
[0112] According to the scheme of this disclosure embodiment, the data of the target object is crawled from the target website by the target object's identifier through the production process and the consumption process. Based on the target object's identifier, task queue, and the one-to-many-consumption processing scheme, the throughput of concurrent crawling can be flexibly adjusted, while avoiding the same content being crawled multiple times.
[0113] In one possible implementation, the target object of this disclosure includes test questions, and the multiple types of data of the target object include at least one of the following: question stem data, answer data, option data, analysis data, or question type data.
[0114] According to the solution of this disclosure embodiment, when the target object is a test question, multiple types of data such as question stem data, answer data, and option data can be obtained to ensure that various types of test question data are displayed normally.
[0115] Figure 3 This is a flowchart illustrating a test question transfer method according to an embodiment of this disclosure. Figure 3 As shown, the method includes the following steps:
[0116] S301: Fetch the chapter tree of the target website.
[0117] Since the question IDs may be encrypted, it's impossible to obtain all question IDs through incremental traversal. Furthermore, when not logged in, users can only view the question stem. Therefore, we can scrape the target website's chapter tree and create a data table using the question IDs under each chapter tree as unique indexes.
[0118] S302: Traverse the chapter list to obtain the question ID and write it to the database.
[0119] Traverse the chapter tree to obtain all question IDs and store them in the database, ensuring the uniqueness of question IDs, avoiding duplicate crawling, and improving crawling efficiency. That is, S2011: Based on the chapter information of the target website, obtain the identifiers of multiple target objects.
[0120] S303: Simulate login to obtain cookies.
[0121] Use Selenium + Chrome to simulate browser login and obtain cookies.
[0122] S304: Write to the remote dictionary server (Redis) and store cookies.
[0123] Cookies are written to Redis. Each request retrieves the cookie from Redis. If the request fails, the login is simulated again to retrieve the cookie and write it to Redis. This solves the tediousness of manual login, avoids I / O read / write operations, and improves program efficiency.
[0124] S305: Get the ID of the uncaptured question and write it to the queue.
[0125] A production process is started to retrieve the IDs of uncaptured test questions from the database in batches and push them to a message queue. A maximum message queue length is set; the production process sleeps once the maximum length is reached. That is, S2012: The production process writes the identifiers of uncaptured target objects to the task queue.
[0126] S306: Obtain the question ID, obtain the cookie, and request the question details page.
[0127] Based on the actual throughput of the online service, multiple consumer processes are launched to retrieve the question ID from the message queue, the cookie from Redis, and the parameters to request the question details page to obtain the HTML source code. Specifically, S201: Obtain the Hypertext Markup Language (HTML) text of the target webpage corresponding to the target object, or S2013: Based on the task queue, multiple consumer processes, each carrying a cookie, retrieve the HTML text of the target webpage corresponding to the target object from the target website.
[0128] S307: Obtain the question stem, answer, and explanation.
[0129] The test question's HTML source code DOM structure is parsed to obtain the corresponding rich text content, including the question stem, options, answer, explanation, and question type. The completeness of the test question is verified by checking if the answer or question is empty, and whether the options are reasonable (empty or missing). Incomplete questions are discarded. Specifically, S202: Parsing the Hypertext Markup Language text's Document Object Model to obtain multiple types of secondary data for the target object.
[0130] S308: Image cleaning and replacement.
[0131] The system uses regular expressions to filter images within the test questions, identifies whether an image contains a watermark, and discards the entire test question if a watermark is present. Otherwise, it retrieves the image content, saves it to generate a new link, and replaces the original image information.
[0132] S309: Extract the content of rich text tags with specific styles and generate an HTML file.
[0133] For styles that fail to display correctly or appear as black borders during rendering, analyze the class styles of the black border content, actively download the corresponding static style files, and render them correctly. Continue this analysis and iteration until all static style files are downloaded and the page displays correctly. Use regular expressions to extract the DOM structure of elements requiring static style files and generate new HTML files. Specifically, S1041: Generate an HTML file based on the rich text content and style resources corresponding to the target element.
[0134] S310: Convert HTML files to images, and replace the original data after saving the converted images.
[0135] The wkhtmltopdf tool is used to convert HTML files into images. After the images are saved, rich text styles are written to replace the original DOM structure content, ultimately generating structured data. This eliminates the need to actively load static style files on any terminal, while also reducing the amount of test text. Specifically, S1042: Convert the HTML file to image format to obtain the first image.
[0136] S311: Data is structured and stored in the database; the question ID table is updated to show that it has been retrieved.
[0137] The system checks if the final structured data is duplicated. If it is not duplicated with existing test questions, it is written to the database, and the test question ID status is updated to "fetched" upon successful verification. If the entire process fails, the test question ID is rewritten to the message queue.
[0138] According to the solution of this disclosure embodiment, a high-concurrency crawling method is provided. The crawled test question data is stored in the database after being structured, which improves the content crawling efficiency and performs comprehensive cleaning of the test question content.
[0139] Figure 4 This is a flowchart illustrating a data display method according to an embodiment of this disclosure. Figure 4 As shown, the method includes at least the following steps:
[0140] S401: In response to an access request for the target object, retrieve multiple types of data of the target object.
[0141] S402: If the rich text content of the multi-type data contains the storage address of the first image, retrieve the first image based on the storage address. The first image is generated according to the data transfer method described above.
[0142] S403: Based on the rich text content of multiple types of data and the first image, perform visualization rendering on the target object to obtain the visualization result.
[0143] In this embodiment, the data display method can be executed on a user's electronic device, such as a computer, mobile phone, or other terminal device. The first image can be loaded based on its storage address and displayed on the generated page of the terminal device.
[0144] According to the solution of this embodiment, when accessing the target object, since the content in the target object's data that may cause rendering errors has been replaced with images, it is ensured that all types of data of the target object can be displayed normally.
[0145] Figure 5 This is a schematic diagram of a data transfer device according to an embodiment of the present disclosure, as shown below. Figure 5 As shown, the device 500 includes at least:
[0146] The first rendering module 501 is used to perform visual rendering on the target object based on the rich text content of the target object's multi-class first data, and obtain a visualization result. The multi-class first data is data obtained from the target webpage.
[0147] The style acquisition module 502 is used to acquire the style resources of the target element from the target webpage when the visualization results contain the target element with display anomalies.
[0148] Image generation module 503 is used to generate a first image based on the rich text content and style resources corresponding to the target element.
[0149] The first replacement module 504 is used to replace the rich text content corresponding to the target element using the first image.
[0150] In one possible implementation, the image generation module 503 includes:
[0151] The file generation submodule is used to generate HTML files based on the rich text content and style resources corresponding to the target element.
[0152] The conversion submodule is used to convert HTML files into image format to obtain the first image.
[0153] The storage submodule is used to store the first image and obtain the storage address of the first image.
[0154] In one possible implementation, the file generation submodule is used for:
[0155] The rich text content corresponding to the target element is used as the main information, and the resource link of the static style file containing style resources is used as the header information to generate an HTML file.
[0156] In one possible implementation, the first replacement module 504 is used for:
[0157] Based on the storage address of the first image, write the rich text content for the first image.
[0158] Replace the rich text content of the target element with the rich text content of the first image.
[0159] In one possible implementation, the data transfer device of this disclosure further includes:
[0160] The first image acquisition module is used to acquire the second image based on the first storage address of the image element when the rich text content of any type of first data of the target object contains an image element.
[0161] The transfer module is used to transfer the second image and obtain the second storage address of the second image.
[0162] The second replacement module is used to replace the first storage address with the second storage address.
[0163] In one possible implementation, the data transfer device of this disclosure further includes:
[0164] The crawling module is used to obtain the Hypertext Markup Language text of the target webpage corresponding to the target object.
[0165] The parsing module is used to parse the document object model of Hypertext Markup Language text to obtain multi-class secondary data of the target object.
[0166] The processing module is used to preprocess multiple types of second data to obtain multiple types of first data for the target object.
[0167] In one possible implementation, the processing module is used for:
[0168] The type of the target object is determined based on the multiple types of second data of the target object.
[0169] If the multiple types of second data of the target object conform to the preset verification rules corresponding to the type, data is extracted from the multiple types of second data according to the preset extraction rules to obtain the multiple types of first data of the target object.
[0170] In one possible implementation, the crawling module is used for:
[0171] Based on the chapter information of the target website, the identifiers of multiple target objects are obtained.
[0172] During the production process, the identifiers of target objects in an uncaptured state are written into the task queue.
[0173] Based on the task queue, multiple consuming processes are used to retrieve the Hypertext Markup Language (HTML) text of the target webpage corresponding to the target object from the target website, each carrying a cookie. The cookie is obtained by simulating logging into the target website.
[0174] In one possible implementation, the target object includes test questions, and the target object's multiple types of data include at least one of the following: question stem data, answer data, option data, explanation data, or question type data.
[0175] The specific functions and examples of each module and submodule of the apparatus in this disclosure can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0176] Figure 6 This is a schematic diagram of the structure of a data display device according to an embodiment of the present disclosure, as shown below. Figure 6 As shown, the device 600 includes at least:
[0177] The data acquisition module 601 is used to acquire multiple types of data of the target object in response to an access request to the target object.
[0178] The second image acquisition module 602 is used to acquire the first image based on its storage address when the rich text content of multiple types of data contains the storage address of the first image. The first image is generated by the data transfer device according to any of the above embodiments.
[0179] The second rendering module 603 is used to perform visual rendering on the target object based on the rich text content of multiple types of data and the first image, and obtain the visualization result.
[0180] The specific functions and examples of each module and submodule of the apparatus in this disclosure can be found in the relevant descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0181] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0182] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0183] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0184] like Figure 7 As shown, device 700 includes a computing unit 701, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 702 or a computer program loaded into random access memory (RAM) 703 from storage unit 708. RAM 703 may also store various programs and data required for the operation of device 700. The computing unit 701, ROM 702, and RAM 703 are interconnected via bus 704. Input / output (I / O) interface 705 is also connected to bus 704.
[0185] Multiple components in device 700 are connected to I / O interface 705, including: input unit 706, such as keyboard, mouse, etc.; output unit 707, such as various types of monitors, speakers, etc.; storage unit 708, such as disk, optical disk, etc.; and communication unit 709, such as network card, modem, wireless transceiver, etc. Communication unit 709 allows device 700 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0186] The computing unit 701 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as data transfer methods or data presentation methods. For example, in some embodiments, the data transfer method or data presentation method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the data transfer method or data presentation method described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform a data transfer method or a data display method by any other suitable means (e.g., by means of firmware).
[0187] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0188] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0189] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0190] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0191] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0192] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0193] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.
[0194] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A data transfer method, comprising: Based on the rich text content of the target object's multiple first data, the target object is visualized and rendered to obtain a visualization result, wherein the multiple first data are data obtained from the target webpage; If the visualization results contain a target element that displays abnormally, obtain the style resources of the target element from the target webpage; Based on the rich text content corresponding to the target element and the style resources, a first image is generated, including: The rich text content corresponding to the target element is used as the main information, and the resource link of the static style file containing the style resource is used as the header information to generate an HTML file; The HTML file is converted into an image format to obtain the first image; Use the first image to replace the rich text content corresponding to the target element.
2. The method according to claim 1, wherein, The step of replacing the rich text content corresponding to the target element using the first image includes: Based on the storage address of the first image, write the rich text content of the first image; Replace the rich text content corresponding to the target element with the rich text content of the first image.
3. The method according to claim 1, further comprising: If the rich text content of any type of first data of the target object contains an image element, the second image is obtained according to the first storage address of the image element; The second image is transferred to a different location to obtain its second storage address. Replace the first storage address with the second storage address.
4. The method according to claim 1, further comprising: Obtain the Hypertext Markup Language (HMR) text of the target webpage corresponding to the target object; The document object model of the Hypertext Markup Language text is parsed to obtain the multi-class second data of the target object; The multiple types of second data are preprocessed to obtain multiple types of first data for the target object.
5. The method according to claim 4, wherein, The preprocessing of the multiple types of second data to obtain multiple types of first data for the target object includes: The type of the target object is determined based on the multiple types of second data of the target object; If the multiple types of second data of the target object conform to the preset verification rules corresponding to the type, data is extracted from the multiple types of second data according to the preset extraction rules to obtain the multiple types of first data of the target object.
6. The method according to claim 4, wherein, The step of obtaining the Hypertext Markup Language text of the target webpage corresponding to the target object includes: Based on the chapter information of the target website, the identifiers of multiple target objects are obtained; During the production process, the identifier of the target object in the uncaptured state is written into the task queue; According to the task queue, multiple consuming processes are used to retrieve the hypertext markup language text of the target webpage corresponding to the target object from the target website, each carrying a cookie; wherein the cookie is obtained by simulating login to the target website.
7. The method according to any one of claims 1 to 6, wherein, The target object includes test questions, and the multiple types of data of the target object include at least one of the following: question stem data, answer data, option data, analysis data, or question type data.
8. A data display method, comprising: In response to an access request to a target object, obtain multiple types of data of the target object; If the rich text content of the multi-type data contains the storage address of the first image, the first image is obtained according to the storage address; wherein the first image is generated by the method according to any one of claims 1 to 7; Based on the rich text content of the multiple types of data and the first image, the target object is visualized and rendered to obtain a visualization result.
9. A data transfer device, comprising: The first rendering module is used to perform visualization rendering on the target object based on the rich text content of multiple types of first data of the target object, and obtain a visualization result, wherein the multiple types of first data are data obtained from the target webpage; The style acquisition module is used to acquire the style resources of the target element from the target webpage when the visualization result contains a target element with display anomalies. The image generation module is used to generate a first image based on the rich text content corresponding to the target element and the style resources, including: The rich text content corresponding to the target element is used as the main information, and the resource link of the static style file containing the style resource is used as the header information to generate an HTML file; The HTML file is converted into an image format to obtain the first image; The first replacement module is used to replace the rich text content corresponding to the target element using the first image.
10. The apparatus according to claim 9, wherein, The first replacement module is used for: Based on the storage address of the first image, write the rich text content of the first image; Replace the rich text content corresponding to the target element with the rich text content of the first image.
11. The apparatus according to claim 9, further comprising: The first image acquisition module is used to acquire a second image based on the first storage address of the image element when the rich text content of any type of first data of the target object contains an image element. The transfer module is used to transfer the second image to obtain the second storage address of the second image; The second replacement module is used to replace the first storage address with the second storage address.
12. The apparatus according to claim 9, further comprising: The crawling module is used to obtain the hypertext markup language text of the target webpage corresponding to the target object; The parsing module is used to parse the document object model of the Hypertext Markup Language text to obtain the multi-class second data of the target object; The processing module is used to preprocess the multiple types of second data to obtain multiple types of first data of the target object.
13. The apparatus according to claim 12, wherein, The processing module is used for: The type of the target object is determined based on the multiple types of second data of the target object; If the multiple types of second data of the target object conform to the preset verification rules corresponding to the type, data is extracted from the multiple types of second data according to the preset extraction rules to obtain the multiple types of first data of the target object.
14. The apparatus according to claim 12, wherein, The crawling module is used for: Based on the chapter information of the target website, the identifiers of multiple target objects are obtained; During the production process, the identifier of the target object in the uncaptured state is written into the task queue; According to the task queue, multiple consuming processes are used to retrieve the hypertext markup language text of the target webpage corresponding to the target object from the target website, each carrying a cookie; wherein the cookie is obtained by simulating login to the target website.
15. The apparatus according to any one of claims 11 to 14, wherein, The target object includes test questions, and the multiple types of data of the target object include at least one of the following: question stem data, answer data, option data, analysis data, or question type data.
16. A data display device, comprising: The data acquisition module is used to acquire multiple types of data of the target object in response to an access request for the target object; The second image acquisition module is configured to acquire the first image based on the storage address when the rich text content of the multi-type data contains the storage address of the first image; wherein the first image is generated by the apparatus according to any one of claims 9 to 15. The second rendering module is used to perform visualization rendering on the target object based on the rich text content of the multi-type data and the first image, so as to obtain a visualization result.
17. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.
19. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-8.
Citation Information
Patent Citations
Webpage page display control method and intelligent terminal
CN106372214A
Question bank resource construction method and system and computer readable storage medium
CN109753616A