Typesetting method and device for unstructured data, electronic equipment and storage medium
By identifying and processing format tags and parameter values of unstructured data in text editors, automatic layout of unstructured data is achieved, solving the problems of low layout efficiency and insufficient standardization in the existing technology, and improving the layout efficiency and consistency, and support diverse application scenarios.
Patent Information
- Application Number
- CN202411333611.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-07
AI Technical Summary
The inefficient layout of unstructured data in the prior art has caused editors to spend a lot of time dealing with format problems, and the processing results of different editors are inconsistent, resulting in insignificant work results and inconsistent release specifications.
By identifying the source code of the initial unstructured data in a text editor, extracting the format tags and their corresponding tag parameter values, and using these tag parameter value sets to automatically type the data to achieve consistency and standardization of the layout, and Introduce one-click typography capabilities and preset format tag libraries for increased efficiency and flexibility.
It realizes automatic layout of unstructured data, improves layout efficiency and accuracy, reduces manual intervention, ensures uniformity and high quality of layout, supports diverse application scenarios, and allows the system to continuously learn and update to adapt to different formats need.
Smart Images

Figure CN119272718A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a typesetting method, device, electronic device and storage medium for unstructured data. Background Art
[0002] In the process of publishing articles online, the source of unstructured data is often uncertain. Some are captured from web pages, some are copied from electronic publications, and some are imported from various documents. The resulting problem is that the data formats are all kinds of strange. In order to make the articles more beautiful and readable after publication, editors often need to spend a lot of energy to deal with the format of the content. In addition, the formats of articles processed by different editors are also inconsistent, which ultimately leads to repeated and boring work for editors, insignificant work results, and inconsistent publishing specifications. It can be seen that the typesetting method in the relevant technology has the technical problem of low typesetting efficiency. Summary of the invention
[0003] In order to solve the above technical problems, the present application provides a typesetting method, device, electronic device and storage medium for unstructured data.
[0004] In a first aspect, the present application provides a method for typeseting unstructured data, comprising: when initial unstructured data has been entered in a text editor, identifying the source code of the initial unstructured data to obtain a set of format tags, wherein the set of format tags is used to identify the format characteristics of data included in the initial unstructured data; determining a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set, wherein the tag parameter value is used to define a specific attribute value of the corresponding format tag; and typeset processing the initial unstructured data according to the tag parameter value set.
[0005] By adopting the above technical solution, the initial unstructured data is entered into a text editor, and the source code of the initial unstructured data is identified to identify a group of format tags, wherein the group of format tags is used to represent the format characteristics of the data contained in the initial unstructured data, and then the label parameter value corresponding to each format tag in the group of format tags is determined to obtain a label parameter value set, each label parameter value is used to determine the specific attribute value of the format tag corresponding to the timing, and then the initial unstructured data is typeset according to the label parameter value set, thereby achieving the purpose of automatic typesetting of unstructured data, ensuring the consistency and standardization of typesetting, and typeset the initial unstructured data according to the label parameter value set, which significantly improves the typesetting efficiency.
[0006] Optionally, the initial unstructured data is identified to obtain a set of format tags, including: when a one-key typesetting instruction is received, the source code of the initial unstructured data is identified to obtain a set of format tags, wherein a one-key typesetting button is integrated in the text editor, and the one-key typesetting instruction is generated when the one-key typesetting button is triggered.
[0007] By adopting the above technical solution, a one-click typesetting button is integrated in the text editor. When a one-click typesetting instruction is received, for example, the user clicks the one-click typesetting button, the source code of the initial unstructured data entered into the text editor will be automatically identified to obtain a set of format tags. By setting the one-click typesetting button, the user experience can be improved. Through the one-click typesetting function, users can quickly organize the disorganized initial unstructured data into a standardized format and easy-to-read document or code, which greatly improves the typesetting efficiency.
[0008] Optionally, determining a label parameter value corresponding to each format tag in a set of format tags to obtain a label parameter value set includes: comparing a set of format tags with a preset format tag library; and when determining that the preset format tag library includes each format tag in a set of format tags, determining a label parameter value corresponding to each format tag in a set of format tags to obtain a label parameter value set, wherein the preset format tag library is created in advance, the preset format tag library includes a plurality of format tags, and each format tag in the plurality of format tags is used to represent a format feature.
[0009] By adopting the above technical solution, after a group of format tags are identified, the group of format tags can be compared with a preset format tag library, which includes multiple pre-created format tags. When it is determined that the preset format tag library includes each format tag in the above group of format tags, the tag parameter value corresponding to each format tag in the group of format tags is determined, thereby obtaining a tag parameter value set. By pre-creating and maintaining a preset format tag library containing multiple format tags, the system can support the addition of new format tags and the update of old format tags, thereby enhancing the flexibility and scalability of the system. The design of the preset format tag library allows users to quickly customize specific format rules as needed to meet typesetting requirements in different scenarios.
[0010] Optionally, determining the label parameter value corresponding to each format tag in a group of format tags to obtain a label parameter value set includes: determining the label parameter value matching each format tag in a group of format tags based on a pre-established target format sample library to obtain the label parameter value set, wherein the target format sample library includes multiple groups of correspondences, and each group of correspondences in the multiple groups of correspondences is used to represent the correspondence between a format tag and a group of label parameter values.
[0011] By adopting the above technical solution, a target format sample library can be pre-established, wherein the target format sample library includes the correspondence between the format label and the parameter value of the format label, and the target format sample library contains the label parameter value corresponding to each format label. In the process of processing unstructured data, it is ensured that each format label can be accurately matched to its corresponding parameter value. Manual matching is not only time-consuming, but also prone to errors, especially when processing large amounts of data. Through the pre-established target format sample library, this matching process can be completed automatically and accurately. Through the automated matching process, the possibility of human error is reduced, and the accuracy of matching format labels with parameter values is improved. By introducing a pre-established target format sample library and automatically determining the parameter value of the format label based on the sample library, the problems of format matching accuracy, flexibility, efficiency, etc. are effectively solved, and significant technical effects are brought about.
[0012] Optionally, before determining a tag parameter value that matches each format tag in a set of format tags based on a pre-established target format sample library to obtain a tag parameter value set, the method also includes: determining a first target format tag and target configuration parameters included in a predetermined typesetting format template, wherein the target configuration parameters are used to indicate parameters for configuring the first target format tag, and the first target format tag is any format tag included in the predetermined typesetting format template; and adding the first target format tag and the target configuration parameters as a set of correspondences to the target format sample library.
[0013] By adopting the above technical solution, by allowing dynamic addition of new format tags and configuration parameters to the target format sample library, the method enhances the flexibility of the system, enabling it to better adapt to changes in demand in different application scenarios; users can easily customize typesetting format templates, and include the format tags and configuration parameters therein into the support range of the text editor (or system), thereby improving user satisfaction and convenience when using the system; the process of adding format tags and configuration parameters can be automatically processed according to the predetermined typesetting format template, reducing errors and omissions caused by manual operations, and improving the accuracy and reliability of the system.
[0014] Optionally, the initial unstructured data is typeset according to the tag parameter value set, including: replacing the parameter value of the corresponding format tag in the source code of the initial unstructured data with the parameter value of each format tag in the tag parameter value set, so as to perform a format replacement operation on the initial unstructured data and obtain a typeset text that conforms to a predetermined typesetting format; and returning the typeset text to the text editor.
[0015] By adopting the above technical solution, after obtaining the tag parameter value set, the parameter value of each format tag in the tag parameter value set is replaced with the parameter value of the corresponding format tag in the source code of the initial unstructured data, so that the typeset text that conforms to the predetermined typesetting format can be obtained, that is, the obtained typeset text conforms to the requirements of the predetermined typesetting format template, and then the typeset text is returned to the text editor. By automatically typeset the initial unstructured data according to the tag parameter value set and returning the typeset text to the text editor, the problems of low efficiency and easy errors in manual typesetting are solved, and the typesetting efficiency, accuracy and user experience are improved, while supporting a variety of application scenarios.
[0016] Optionally, the method further includes: when it is determined that there is no corresponding relationship matching the second target format tag in the target format sample library, adding the corresponding relationship matching the second target format tag to the target format sample library, wherein the second target format tag is included in a group of format tags.
[0017] By adopting the above technical solution, when processing unstructured data, various new or rare format tags may be encountered. If there is no corresponding relationship between these new tags in the target format sample library, the data containing these tags cannot be correctly processed and typeset. This technical solution expands the coverage of the sample library by allowing newly discovered format tags to be added to the sample library, enabling it to support more format tags. By adding newly discovered format tags to the target format sample library, the system can continuously learn and update, thereby maintaining its flexibility and scalability.
[0018] In a second aspect of the present application, a typesetting device for unstructured data is also provided, including: an identification module, which is used to identify the source code of the initial unstructured data when the initial unstructured data has been entered in a text editor, and obtain a set of format tags, wherein the set of format tags is used to identify the format characteristics of the data included in the initial unstructured data; a first determination module, which is used to determine the label parameter value corresponding to each format tag in the set of format tags, and obtain a label parameter value set, wherein the label parameter value is used to define the specific attribute value of the corresponding format tag; a processing module, which is used to typeset the initial unstructured data according to the label parameter value set.
[0019] In a third aspect of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, any of the above method steps is implemented.
[0020] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the above method steps is performed.
[0021] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. The purpose of automatic typesetting of unstructured data is achieved to ensure the consistency and standardization of typesetting. The initial unstructured data is typeset according to the tag parameter value set, which significantly improves the typesetting efficiency; 2. Through the one-click typesetting function, users can quickly organize the disorganized initial unstructured data into a standardized and easy-to-read document or code, greatly improving typesetting efficiency; 3. By automatically typeset the initial unstructured data according to the tag parameter value set and returning the typeset text to the text editor, the problem of low efficiency and easy errors in manual typesetting is solved, and the typesetting efficiency, accuracy and user experience are improved, while supporting a variety of application scenarios; 4. By allowing newly discovered format tags to be added to the sample library, the coverage of the sample library is expanded to support more format tags. The system can continuously learn and update, thereby maintaining its flexibility and scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a flow chart of a method for typesetting unstructured data provided in an embodiment of the present application; Figure 2 It is a flowchart of an unstructured data processing method based on custom typesetting provided in an embodiment of the present application; Figure 3 This is an example diagram of a format tag library provided in an embodiment of the present application; Figure 4 This is an example diagram of a format sample library provided in an embodiment of the present application; Figure 5 It is a structural block diagram of a typesetting device for unstructured data provided in an embodiment of the present application; Figure 6 It is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application.
[0023] Description of reference numerals: 600 - electronic device; 601 - processor; 602 - communication bus; 603 - user interface; 604 - network interface; 605 - memory. DETAILED DESCRIPTION
[0024] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0025] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0026] In the description of the embodiments of the present application, the term "plurality" means two or more. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0027] This application provides a method for typesetting unstructured data, referring to Figure 1 , Figure 1 : is a flow chart of a method for typesetting unstructured data provided by an embodiment of the present application, comprising the following steps: Step S101, when the initial unstructured data has been entered in the text editor, the source code of the initial unstructured data is identified to obtain a set of format tags, wherein the set of format tags is used to identify the format features of the data included in the initial unstructured data; Step S102, determining a tag parameter value corresponding to each format tag in a set of format tags to obtain a tag parameter value set, wherein the tag parameter value is used to define a specific attribute value of the corresponding format tag; Step S103: performing typeset processing on the initial unstructured data according to the tag parameter value set.
[0028] In the above embodiment, the initial unstructured data is entered into a text editor, and the source code of the initial unstructured data is identified to identify a set of format tags, wherein the set of format tags is used to represent the format characteristics of the data contained in the initial unstructured data. For example, the format characteristics (or attributes) of the data may include text alignment text-align, text line break rule text-wrap-mode, margin attribute margin, font format font-family, font size font-size, line spacing attribute line-height, etc., and may also include the format characteristics of pictures and the format characteristics of tables. The format features of audio, the format features of video, etc., then determine the tag parameter value corresponding to each format tag in the set of format tags, and obtain a tag parameter value set. Each tag parameter value is used to determine the specific attribute value of the format tag corresponding to the timing. Then, the initial unstructured data is typeset according to the tag parameter value set. For example, the parameter values of each format tag in the source code of the initial unstructured data are replaced with the corresponding tag parameter values in the tag parameter value set, so as to achieve the purpose of automatic typesetting of unstructured data, ensure the consistency and standardization of typesetting, and typeset the initial unstructured data according to the tag parameter value set, which significantly improves the typesetting efficiency. In view of the fact that unstructured data has a wide range of sources and various formats, the methods in the related technology require manual adjustment by editors, which is inefficient and prone to errors. This method realizes the rapid identification and parsing of multiple data formats by automatically identifying the format tags in the source code of the initial unstructured data. At the same time, due to the different typesetting habits and styles of different editors, it is easy to cause inconsistent typesetting specifications of the final published articles. The embodiment of the present application reduces manual intervention by automatically identifying and processing format tags of unstructured data, greatly improves typesetting efficiency, and reduces the workload of editors. The uniformity and consistency of typesetting specifications are ensured through standardized label parameter values and typesetting processing procedures. Automated typesetting processing reduces dependence on human resources and reduces labor costs. Unified typesetting specifications and high-quality article presentation can enhance the user's reading experience and achieve the effect of improving user satisfaction.
[0029] In an optional embodiment, the initial unstructured data is identified to obtain a set of format tags, including: when a one-key typesetting instruction is received, the source code of the initial unstructured data is identified to obtain a set of format tags, wherein a one-key typesetting button is integrated in the text editor, and the one-key typesetting instruction is generated when the one-key typesetting button is triggered.
[0030] In the above embodiment, a one-key typesetting button is integrated in the text editor. When a one-key typesetting instruction is received, for example, the user clicks the one-key typesetting button, the source code of the initial unstructured data entered into the text editor will be automatically identified to obtain a set of format tags. By setting the one-key typesetting button, the effect of improving the user experience is achieved. The manual typesetting method in the related art requires the user to check and adjust the format of the text one by one, which is time-consuming, labor-intensive and error-prone. Through the one-key typesetting function, the user can quickly organize the disorganized initial unstructured data into a standardized format and easy-to-read document or code, which greatly improves the typesetting efficiency. In different projects or documents, the format requirements may be different. The one-key typesetting function can automatically adjust the text format according to preset rules or templates to ensure that all documents or codes follow a unified format standard, which is conducive to team collaboration and project management. Users only need to trigger the one-click typesetting button to quickly complete complex typesetting work, which greatly simplifies the operation process and improves the convenience and satisfaction of using the text editor; by automatically applying formatting tags such as indentation, font, color, etc., the structure of the document or code is clearer and the content is easier to read and understand.
[0031] In an optional embodiment, determining a tag parameter value corresponding to each format tag in a set of format tags to obtain a tag parameter value set includes: comparing a set of format tags with a preset format tag library; and when determining that the preset format tag library includes each format tag in the set of format tags, determining a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set, wherein the preset format tag library is created in advance, the preset format tag library includes a plurality of format tags, and each format tag in the plurality of format tags is used to represent a format feature.
[0032] In the above embodiment, after a group of format tags are identified, the group of format tags can be compared with a preset format tag library, which includes multiple pre-created format tags, such as word spacing tags, image size tags, line spacing tags, table style tags, font tags, etc. When it is determined that the preset format tag library includes each format tag in the above group of format tags, the tag parameter value corresponding to each format tag in the group of format tags is determined, thereby obtaining a tag parameter value set. For example, the preset format tag library stores all format features previously involved in the typesetting and publishing of articles for a certain type of customer. A format tag may include one or more format features. The preset format tag library can be stored in a local terminal. In actual applications, if there is a tag in the current group of format tags that is not included in the preset format tag library, the tag can be added to the preset format tag library, and the preset format tag library can be updated. By pre-creating and maintaining a preset format tag library containing multiple format tags, the system can support the addition of new format tags and the update of old format tags, thereby enhancing the flexibility and scalability of the system. The design of the preset format tag library allows users to quickly customize specific format rules as needed to meet the typesetting requirements in different scenarios. Users do not need to worry about complex format parameter settings, but only need to focus on the content itself, which improves the convenience and satisfaction of using the text editor.
[0033] In an optional embodiment, determining a label parameter value corresponding to each format tag in a set of format tags to obtain a label parameter value set includes: determining a label parameter value matching each format tag in a set of format tags based on a pre-established target format sample library to obtain a label parameter value set, wherein the target format sample library includes multiple groups of correspondences, and each group of correspondences in the multiple groups of correspondences is used to represent a correspondence between a format tag and a set of label parameter values.
[0034] In the above embodiment, a target format sample library can be pre-established, wherein the target format sample library includes the correspondence between the format tag and the parameter value of the format tag, and the target format sample library contains the tag parameter value (or specific attribute value) corresponding to each format tag, for example, the color of the font, the size of the font, the line spacing value, the width value and height value of the picture, etc. In actual applications, different users have different requirements and preferences for data formats. Different format samples can be set for different users. Even for the same user, multiple format samples can be set. In the process of processing unstructured data, it is ensured that each format tag can be accurately matched to its corresponding parameter value. Manual matching is not only time-consuming, but also prone to errors, especially when processing large amounts of data. Through the pre-established target format sample library, this matching process can be completed automatically and accurately. Through the automated matching process, the possibility of human error is reduced and the accuracy of matching format tags with parameter values is improved. Different application scenarios may require different combinations of format tags and parameter values. The design of the target format sample library allows the addition, modification, or deletion of the correspondence between format tags and parameter values, thereby supporting format requirements in different application scenarios. By building a target format sample library containing multiple sets of correspondences (i.e., the correspondence between format tags and tag parameter values), various format requirements can be flexibly supported. The automated matching process significantly improves processing efficiency, especially in scenarios where large amounts of data are processed or frequent formatting is required. By introducing a pre-established target format sample library and automatically determining the parameter values of the format tags based on the sample library, issues such as format matching accuracy, flexibility, and efficiency are effectively resolved, and significant technical effects are achieved.
[0035] In an optional embodiment, before determining the tag parameter value matching each format tag in a set of format tags based on a pre-established target format sample library to obtain a tag parameter value set, the method further includes: determining a first target format tag and target configuration parameters included in a predetermined typesetting format template, wherein the target configuration parameters are used to indicate parameters for configuring the first target format tag, and the first target format tag is any format tag included in the predetermined typesetting format template; and adding the first target format tag and the target configuration parameters as a set of corresponding relationships to the target format sample library.
[0036] In the above embodiment, by allowing dynamic addition of new format tags and configuration parameters to the target format sample library, the method enhances the flexibility of the system, enabling it to better adapt to changes in demand in different application scenarios; users can easily customize typesetting format templates, and include the format tags and configuration parameters therein into the support range of the text editor (or system), thereby improving user satisfaction and convenience when using the system; the process of adding format tags and configuration parameters can be automatically processed according to the predetermined typesetting format template, reducing errors and omissions caused by manual operations, and improving the accuracy and reliability of the system. The predetermined typesetting format template can be understood as the specific format requirements of different users for typesetting. For example, the typesetting format requirements may include requirements for font size, font color, line spacing, image size, table style, etc. Different predetermined typesetting format templates can be set for different users. For example, the user's predetermined typesetting format template requires that the tag parameter value corresponding to the first target format tag is a target configuration parameter. If the target format sample library does not include a set of correspondences between the first target format tag and the target configuration parameter, the set of correspondences can be added to the target format sample library. In this way, when the initial unstructured data is entered into the text editor, when the first target format tag is identified, the corresponding target configuration parameters can be automatically matched with the first target format tag based on the target format sample library, so that the parameter value of the first target format tag included in the source code can be replaced. By introducing a dynamic processing mechanism for the format tag and its configuration parameters in the predetermined typesetting format template and adding it as a correspondence to the target format sample library, the flexibility of updating and expanding the target format sample library is improved.
[0037] In an optional embodiment, the initial unstructured data is typeset according to a tag parameter value set, including: replacing the parameter value of the corresponding format tag in the source code of the initial unstructured data with the parameter value of each format tag in the tag parameter value set, so as to perform a format replacement operation on the initial unstructured data and obtain a typeset text that conforms to a predetermined typeset format; and returning the typeset text to a text editor.
[0038] In the above embodiment, after obtaining the tag parameter value set, the parameter value of each format tag in the tag parameter value set is replaced with the parameter value of the corresponding format tag in the source code of the initial unstructured data. For example, there are multiple different parameter values about the font size in the source code of the initial unstructured data. At this time, they can be replaced according to the parameter value of the font size in the tag parameter value set, so as to obtain a unified font size format requirement, and then the typeset text that meets the predetermined typesetting format can be obtained, that is, the obtained typeset text meets the requirements of the predetermined typesetting format template, and then the typeset text is returned to the text editor, so that the text editor presents an article in the predetermined typesetting format that meets the user's requirements. Automated typesetting processing significantly reduces manual intervention and improves typesetting efficiency, especially when processing a large amount of initial unstructured data containing complex format tags; by accurately replacing the parameter values of the format tags in the source code, errors that may occur in manual typesetting are avoided, and the accuracy of the typesetting results is improved; the typeset text is directly returned to the text editor, so that the user can complete editing, typesetting and viewing operations on a unified interface, thereby enhancing the user's experience. By automatically typeset the initial unstructured data according to a set of label parameter values and returning the typeset text to the text editor, the problem of low efficiency and error-prone manual typesetting is solved, and typesetting efficiency, accuracy and user experience are improved, while supporting a variety of application scenarios.
[0039] In an optional embodiment, the method further includes: when it is determined that there is no corresponding relationship matching the second target format tag in the target format sample library, adding the corresponding relationship matching the second target format tag to the target format sample library, wherein the second target format tag is included in a group of format tags.
[0040] In the above embodiment, when the second target format tag in the aforementioned set of format tags is not included in the target format sample library, the corresponding relationship matching the second target format tag can be added to the target format sample library, so as to achieve the purpose of updating the target format sample library. When processing unstructured data, various new or rare format tags may be encountered. If there is no corresponding relationship of these new tags in the target format sample library, the data containing these tags cannot be correctly processed and typeset. The embodiment of the present application allows the newly discovered format tags to be added to the sample library, thereby expanding the coverage of the sample library so that it can support more format tags. By adding the newly discovered format tags to the target format sample library, the system can continuously learn and update, thereby maintaining its flexibility and scalability. When the target format sample library contains more format tag corresponding relationships, the system can more accurately parse and process the unstructured data containing these tags, thereby improving the accuracy and efficiency of data processing. In the related art, when encountering a new format tag, it may be necessary to manually create the corresponding typesetting rules or templates. However, through the method of the embodiment of the present application, the system can automatically add new tags to the sample library, thereby reducing the need for manual intervention. Through the embodiments of the present application, by allowing newly discovered format tags to be added to the target format sample library, the problem that new format tags may not be processed in the related technology is solved, and the adaptability of the system, the accuracy and efficiency of data processing are improved, while the need for manual intervention is reduced, and the continuous learning and evolution of the system is promoted.
[0041] In an optional embodiment, the initial unstructured data is obtained by one of the following methods: crawling from a web page; copying from an electronic journal; or importing from various documents. That is, the initial unstructured data can be crawled from a web page, copied from an electronic journal, or imported from various documents.
[0042] It should be noted that the above-described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The present application will be described in detail below in conjunction with specific embodiments.
[0043] The present application embodiment provides a method for processing unstructured data based on custom typesetting. Figure 2 : is a flowchart of an unstructured data processing method based on custom typesetting provided in an embodiment of the present application, the process includes: Step S201: Format identification. Effective organization and classification of various unstructured data requires detailed analysis and identification of the various formats contained in the unstructured data. These formats may include but are not limited to text, pictures, tables, videos and other forms. In the identification stage, we accurately identify the different format elements in the data manually. For example, text formats may include different fonts, sizes, colors and layout styles; picture formats may involve different resolutions, formats (such as JPEG, PNG, etc.) and color modes; table formats may include row and column layouts, cell styles and data types; video formats may include different encoding standards, resolutions and frame rates.
[0044] Step S202: Create a format tag library. Once the format of the unstructured data is accurately identified, the next step is to create a standardized format tag library. This library will contain a series of predefined tags, each of which corresponds to a specific format feature. These tags not only help to quickly identify and classify data, but also ensure the consistency and retrievability of the data. In addition, this tag library should be extensible, which means that as new format features are discovered or existing features change, we can continuously update and expand the tag library to adapt to the ever-changing data environment. Figure 3 This is an example diagram of a format tag library provided in an embodiment of the present application.
[0045] Step S203: Format definition. Following the established data format specifications is the key to ensuring data consistency and availability. The article publishing format is pre-customized according to customer needs, which includes all necessary format tags and value settings.
[0046] Step S204: Create a format sample library. In the process of building the format sample library, we will perform detailed parameter configuration for each specific format tag in the format tag library. This step is crucial because it directly affects the quality and efficiency of the sample library. The parameter assignment process involves defining the specific attributes of each tag, including but not limited to data type, length, range, default value, etc. These parameters will be precisely set according to actual needs and data characteristics to ensure the standardization and normalization of data, thereby forming a structured and standardized format sample library. Figure 4 This is an example diagram of a format sample library provided in an embodiment of the present application.
[0047] Step S205: Input unstructured data. There is no specific method for data input. Data can be captured from web pages, copied from electronic publications, or imported from various documents. There is no special restriction on the content of the data. It can be plain text, mixed text and graphics, and can include multiple elements such as audio, video, and tables.
[0048] Step S206: Click on one-key typesetting. Integrate the one-key typesetting function, use the existing text editor, and add a one-key typesetting button.
[0049] Step S207, determining whether the format tag included in the unstructured data matches the format tag library.
[0050] When the judgment result of the above step S207 is mismatch, proceed to step S201; when the judgment result of the above step S207 is match, proceed to step S208.
[0051] Step S208: further determine whether the format tag included in the unstructured data matches the format sample library.
[0052] When the judgment result of the above step S208 is mismatch, proceed to step S203; when the judgment result of the above step S208 is match, proceed to step S209.
[0053] Step S209: format replacement.
[0054] Step S210: data is returned to the editor.
[0055] The above steps S205-S210 can be simply summarized as: when entering unstructured data, the user clicks the one-click typesetting button, which will transfer the unstructured data entered by the editor to the format tag library, identify the format tags contained in the data, and then use the identified tags as identifiers to automatically match them one by one in the sample library. After the pairing is successful, the label parameter values of the sample library will replace the parameter values in the source code to complete the standard format replacement operation, and the processed data will be returned to the editor.
[0056] It should be noted that the format tag library and format sample library are pre-created, and the above steps S201 to S204 do not need to be executed every time, that is, they can be executed directly from step S205, and only return to step S201 or step S203 when there is no match. Of course, in the actual application process, the format tag library and format sample library can also be updated regularly, that is, updated and iterated, log records are generated for unmatched tags, and the tag library and sample library are updated regularly and iteratively to ensure full coverage of tags.
[0057] In the above embodiment, the text format, image format, table format, and video format tags of unstructured data are fully identified to form a standard and extensible format tag library. According to the user's publishing specifications, parameters are assigned to each format tag to form a sample library. A one-click typesetting button is integrated in the editor, and the label in the data source code is used as an identifier to automatically match one by one in the sample library. After the pairing is successful, the label parameter value of the sample library replaces the parameter value in the source code to complete the standard format replacement operation. Log records are generated for unmatched labels, and the label library and sample library are continuously iterated and updated to ensure full label coverage.
[0058] Compared with the related art, the embodiment of the present application realizes one-click typesetting through the association matching of the format tag library and the format sample library, replaces the repetitive work of editors, and standardizes the publishing format.
[0059] As an optional implementation method, the above-mentioned manual one-click typesetting step can also be adjusted to automatically execute one-click typesetting by entering text; in the step of creating the format tag library, automatic analysis of format tags is realized based on the AI big model capability, and the format tag library is updated online synchronously by cloud service to avoid maintaining local version libraries of different users; format parameter configuration is realized by interface method to reduce maintenance costs.
[0060] The present application also provides a typesetting device for unstructured data, such as Figure 5 As shown, Figure 5 : is a structural block diagram of a typesetting device for unstructured data provided in an embodiment of the present application, the device comprising: The identification module 501 is used to identify the source code of the initial unstructured data when the initial unstructured data has been entered in the text editor, and obtain a set of format tags, wherein the set of format tags is used to identify the format features of the data included in the initial unstructured data; A first determining module 502 is used to determine a tag parameter value corresponding to each format tag in a set of format tags to obtain a tag parameter value set, wherein the tag parameter value is used to define a specific attribute value of the corresponding format tag; The processing module 503 is used to perform typesetting processing on the initial unstructured data according to the tag parameter value set.
[0061] In an optional embodiment, the above-mentioned identification module 501 includes: an identification unit, which is used to identify the source code of the initial unstructured data when a one-key typesetting instruction is received, and obtain a set of format tags, wherein a one-key typesetting button is integrated in the text editor, and the one-key typesetting instruction is generated when the one-key typesetting button is triggered.
[0062] In an optional embodiment, the first determination module 502 includes: a comparison unit, used to compare a group of format tags with a preset format tag library; a first determination unit, used to determine the tag parameter value corresponding to each format tag in a group of format tags when it is determined that the preset format tag library includes each format tag in a group of format tags, and obtain a tag parameter value set, wherein the preset format tag library is created in advance, and the preset format tag library includes multiple format tags, and each format tag in the multiple format tags is used to represent a format feature.
[0063] In an optional embodiment, the first determination module 502 includes: a second determination unit, configured to determine, based on a pre-established target format sample library, a tag parameter value matching each format tag in a set of format tags, and obtain a tag parameter value set, wherein the target format sample library includes multiple groups of correspondences, and each group of correspondences in the multiple groups of correspondences is used to represent a correspondence between a format tag and a set of tag parameter values.
[0064] In an optional embodiment, the above-mentioned device also includes: a second determination module, which is used to determine the label parameter value matching each format label in a set of format labels based on a pre-established target format sample library, and before obtaining the label parameter value set, determine the first target format label and target configuration parameters included in the predetermined typesetting format template, wherein the target configuration parameters are used to indicate the parameters for configuring the first target format label, and the first target format label is any format label included in the predetermined typesetting format template; a first adding module, which is used to add the first target format label and the target configuration parameters as a set of corresponding relationships to the target format sample library.
[0065] In an optional embodiment, the processing module 503 includes: a replacement unit, used to replace the parameter value of the corresponding format tag in the source code of the initial unstructured data with the parameter value of each format tag in the tag parameter value set, so as to perform a format replacement operation on the initial unstructured data to obtain a typeset text that conforms to a predetermined typesetting format; a processing unit, used to return the typeset text to the text editor.
[0066] In an optional embodiment, the apparatus further includes: a second adding module, configured to add a corresponding relationship matching the second target format label to the target format sample library when it is determined that there is no corresponding relationship matching the second target format label in the target format sample library, wherein the second target format label is included in a group of format labels.
[0067] Other device embodiments correspond to the aforementioned method embodiments, and other technical features can be found in the previous embodiments, which will not be repeated here.
[0068] The present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed, any one of the method steps described above is executed.
[0069] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0070] The present application also discloses an electronic device. Figure 6 As shown, Figure 6 The electronic device 600 may include: at least one processor 601 , at least one network interface 604 , a user interface 603 , a memory 605 , and at least one communication bus 602 .
[0071] The communication bus 602 is used to realize the connection and communication between these components.
[0072] The user interface 603 may include a display screen (Display) and a camera (Camera). The optional user interface 603 may also include a standard wired interface and a wireless interface.
[0073] The network interface 604 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0074] Among them, the processor 601 may include one or more processing cores. The processor 601 uses various interfaces and lines to connect various parts of the entire electronic device (such as a server), and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 605, and calling data stored in the memory 605. Optionally, the processor 601 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 601 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 601, and it can be implemented separately through a chip.
[0075] Among them, the memory 605 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 605 includes a non-transitory computer-readable storage medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 605 may optionally also be at least one storage device located away from the aforementioned processor 601. Refer to Figure 6 , the memory 605 as a computer storage medium may include an operating system, a network communication module, a user interface module and an application program of a typesetting method for unstructured data.
[0076] exist Figure 6In the electronic device 600 shown, the user interface 603 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 601 can be used to call an application of a typesetting method for unstructured data stored in the memory 605, and when executed by one or more processors 601, the electronic device 600 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0077] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0078] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0079] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0080] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0081] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0082] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0083] This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field not recorded in the present disclosure.
Claims
1. A typesetting method for unstructured data, characterized in that: include: In a case where initial unstructured data has been entered in a text editor, source code of the initial unstructured data is identified to obtain a set of format tags, wherein the set of format tags is used to identify format features of data included in the initial unstructured data; Determine a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set, wherein the tag parameter value is used to define a specific attribute value of the corresponding format tag; The initial unstructured data is formatted according to the tag parameter value set.
2. The method according to claim 1, characterized in that The initial unstructured data is identified to obtain a set of format labels, including: When a one-key typesetting instruction is received, the source code of the initial unstructured data is identified to obtain the set of format tags, wherein a one-key typesetting button is integrated in the text editor, and the one-key typesetting instruction is generated when the one-key typesetting button is triggered.
3. The method according to claim 1, characterized in that Determining a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set includes: comparing the set of format tags with a preset format tag library; In the case where it is determined that the preset format tag library includes each format tag in the set of format tags, a tag parameter value corresponding to each format tag in the set of format tags is determined to obtain the tag parameter value set, wherein the preset format tag library is created in advance, and the preset format tag library includes multiple format tags, and each format tag in the multiple format tags is used to represent a format feature.
4. The method according to claim 1, characterized in that Determining a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set includes: Based on a pre-established target format sample library, a label parameter value matching each format label in the set of format labels is determined to obtain a label parameter value set, wherein the target format sample library includes multiple groups of correspondences, and each group of correspondences in the multiple groups of correspondences is used to represent a correspondence between a format label and a set of label parameter values.
5. The method according to claim 4, characterized in that Before determining a tag parameter value matching each format tag in the set of format tags based on a pre-established target format sample library to obtain a tag parameter value set, the method further includes: Determine a first target format tag and a target configuration parameter included in a predetermined typesetting format template, wherein the target configuration parameter is used to indicate a parameter for configuring the first target format tag, and the first target format tag is any format tag included in the predetermined typesetting format template; The first target format tag and the target configuration parameter are added to the target format sample library as a set of corresponding relationships.
6. The method according to claim 4, characterized in that Performing typesetting processing on the initial unstructured data according to the tag parameter value set includes: Replacing the parameter value of each format tag in the tag parameter value set with the parameter value of the corresponding format tag in the source code of the initial unstructured data, so as to perform a format replacement operation on the initial unstructured data and obtain a typeset text that complies with a predetermined typeset format; Return the typeset text to the text editor.
7. The method according to claim 4, characterized in that The method further comprises: When it is determined that there is no corresponding relationship matching the second target format tag in the target format sample library, a corresponding relationship matching the second target format tag is added to the target format sample library, wherein the set of format tags includes the second target format tag.
8. A typesetting device for unstructured data, characterized in that: include: an identification module, configured to identify source code of the initial unstructured data when the initial unstructured data has been entered in a text editor, and obtain a set of format tags, wherein the set of format tags is used to identify format features of data included in the initial unstructured data; A first determination module is used to determine a tag parameter value corresponding to each format tag in the set of format tags to obtain a tag parameter value set, wherein the tag parameter value is used to define a specific attribute value of the corresponding format tag; A processing module is used to perform typeset processing on the initial unstructured data according to the tag parameter value set.
9. An electronic device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.