Data processing method and device, computer equipment and storage medium
By analyzing document content blocks with a unified data structure and corresponding data model that is compatible with different data types, the problem of multiple software switching of documents in different data types is solved, and the unified analysis and display of document content is realized, which improves application universality sex.
Patent Information
- Application Number
- CN202311041302.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-17
- Publication Date
- 2025-02-21
AI Technical Summary
In the prior art, documents of different data types need to be edited and parsed using different editing software, resulting in users needing to frequently switch software, and documents that are directly imported into certain data types may not be parsed and displayed normally.
Using a unified data structure that is compatible with different data types, the document content is divided into content blocks, and the content blocks are analyzed through the corresponding data model to obtain the data analysis results to render and display the document content.
It realizes that content containing different data types in the same document can be parsed and displayed without installing multiple editing software, which improves the universality of the document in different applications.
Smart Images

Figure CN119494324A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of data processing technology, and in particular to a data processing method, apparatus, computer equipment and storage medium. Background Art
[0002] Document editing is a common function of computer devices, which allows users to edit text, tables, pictures, formulas, mind maps and other contents.
[0003] Since content of different data types requires specific editing software to be opened, multiple editing software needs to be installed in the computer device, and switching back and forth between different editing software is required during the editing process. Summary of the invention
[0004] The embodiments of the present application provide a data processing method, apparatus, computer equipment and storage medium. The technical solution is as follows:
[0005] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:
[0006] Acquire a target document, wherein the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks;
[0007] Based on the target data type corresponding to the target content block in the target document, performing data parsing on the content block through a target data model corresponding to the target data type to obtain a data parsing result, wherein different data models are used to parse content blocks of different data types;
[0008] The document content corresponding to the target content block is rendered and displayed based on the data parsing result.
[0009] On the other hand, an embodiment of the present application provides a data processing device, the device comprising:
[0010] An acquisition module is used to acquire a target document, wherein the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks;
[0011] A parsing module, configured to perform data parsing on a target content block in the target document based on a target data type corresponding to the target content block through a target data model corresponding to the target data type, to obtain a data parsing result, wherein different data models are used to parse content blocks of different data types;
[0012] A rendering module is used to render and display the document content corresponding to the target content block based on the data parsing result.
[0013] On the other hand, an embodiment of the present application provides a computer device, which includes dual cards, a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the data processing method described in the above aspect.
[0014] On the other hand, an embodiment of the present application provides a computer-readable storage medium, in which at least one instruction is stored, and the instruction is loaded and executed by a processor to implement the data processing method described in the above aspects.
[0015] On the other hand, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the data processing method provided by the above aspect.
[0016] The embodiment of the present application proposes a unified data structure that is compatible with different data types. The document content in a document using the unified data structure is divided into content blocks. When parsing the document, the data type corresponding to the content block is determined based on the content block, and the content block is parsed using a data model corresponding to the data type to obtain a data parsing result, thereby rendering the document content based on the data parsing result. Using the solution provided by the embodiment of the present application, the same document can contain content of different data types, and the parsing and display of the document can be completed using a single editing software that integrates data models corresponding to different data types, without the need to install multiple editing software, thereby improving the versatility of the document in different applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 is a flow chart of a data processing method provided by an exemplary embodiment of the present application;
[0019] Figure 2 is a schematic diagram of a document parsing and displaying process shown in an exemplary embodiment of the present application;
[0020] Figure 3 is a flow chart of a data processing method provided by another exemplary embodiment of the present application;
[0021] Figure 4 is a schematic diagram of a data model shown in an exemplary embodiment of the present application;
[0022] Figure 5 is a schematic diagram of a document parsing and displaying process shown in another exemplary embodiment of the present application;
[0023] Figure 6 is a flowchart of a hierarchical parsing process shown in an exemplary embodiment of the present application;
[0024] Figure 7 is a schematic diagram of an implementation of a hierarchical parsing process shown in an exemplary embodiment of the present application;
[0025] Figure 8 is a schematic diagram of an implementation of a data type conversion process shown in an exemplary embodiment of the present application;
[0026] Fig. 9 is a system level diagram of a unified data structure system shown in an exemplary embodiment of the present application;
[0027] Fig.10 This is a schematic diagram of an exemplary implementation of the data model dynamic loading process of the present application;
[0028] Fig.11 is a structural block diagram of a data processing device provided by an exemplary embodiment of the present application;
[0029] Fig.12 It is a structural diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0031] In the related art, different editing software supports different data types. When a user has a need to edit data of multiple data types, he needs to switch back and forth between different editing software.
[0032] For example, for data such as text and tables, users can use text editing software (such as Word) to edit them. Figure 1 For data of this type, users can use vector drawing editing software (such as Visio) to edit it. Figure 1If the document contains text, flowcharts, and mind maps, the user needs to switch back and forth between the three editing software. Figure 1 The data of the class directly imported into the document may not be parsed and displayed normally, and needs to be added to the document through screenshots or other methods.
[0033] In order to improve the versatility of documents in different applications, the embodiment of the present application proposes a unified data structure, which supports compatibility with different data types. In a document using the unified data structure, the document content is divided in the form of content blocks, and the editing software that follows the unified data structure contains data models corresponding to different data types. Accordingly, the document parsing process is carried out in units of content blocks, and the corresponding data model is used to parse the content blocks, and the document content is displayed based on the parsing results.
[0034] For example, when a document using a unified data structure contains a first content block corresponding to text, a second content block corresponding to a flowchart, and a third content block corresponding to a mind map, when the document is opened using editing software that follows the unified data structure, the first content block is parsed using a graphic model, the second content block and the third content block are parsed using a graph model, and the text, flowchart, and mind map are displayed simultaneously based on the parsing results without the need for other editing software.
[0035] The data processing method provided in the embodiment of the present application is used for a computer device installed with editing software that complies with a unified data structure, wherein the editing software can be a native application of the computer device or a third-party application installed on the computer device; the computer device can be a smart phone, a tablet computer, a personal computer, etc., which is not limited in the embodiment of the present application.
[0036] See also Figure 1 , which shows a flow chart of a data processing method provided by an exemplary embodiment of the present application. The method may include the following steps.
[0037] Step 102, obtaining a target document, the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks.
[0038] The target document may be a local document of the computer device or a document downloaded from the network, which is not limited in this embodiment.
[0039] In some embodiments, the data types compatible with the unified data structure include data types supported by different editing software. For example, the data types supported by the unified data structure include, but are not limited to: graphics (text and pictures), graphs (graphs consisting of nodes and lines), lists, charts, cards, and tools. Among them, graphics are data types supported by text editing software. Figures are data types supported by vector drawing or mind map editing software, charts are data types supported by table editing software, lists are data types supported by form editing software, and cards are data types supported by notification card editing software. The embodiments of the present application do not limit the specific data types supported by the unified data structure.
[0040] In the embodiment of the present application, a document using a unified data structure supports modularization, that is, the document is divided into multiple content blocks, and different content blocks can correspond to the same data type, or can correspond to the same data type (but with different contents).
[0041] In an illustrative example, Figure 2 As shown, the document content in the target document 20 is divided into four content blocks, wherein the data types corresponding to the first content block 201 and the fourth content block 204 are both pictures and texts, the data type corresponding to the third content block 203 is a chart, and the data type corresponding to the second content block 202 is a picture.
[0042] Step 104, based on the target data type corresponding to the target content block in the target document, the content block is parsed using the target data model corresponding to the target data type to obtain a data parsing result, wherein different data models are used to parse content blocks of different data types.
[0043] In the embodiment of the present application, the editing software for parsing documents of a unified data structure includes multiple data models, and each data model is used to parse a content block of a specific data type. For the acquired target document, the computer device determines the data type corresponding to the content block based on the content block, and selects the data model corresponding to the data type to parse the content block, thereby obtaining data parsing results corresponding to different content blocks.
[0044] In some embodiments, the data model included in the editing software supports updates, that is, the data types supported for parsing can be continuously increased during the software version update process.
[0045] In some embodiments, the content block indicates the corresponding data type through the content type field, and the computer device can determine the data type of the content block by reading the field value in the corresponding type field of the content block.
[0046] Indicative, such as Figure 2As shown, the computer device uses the graphic data model to parse the first content block 201 and the fourth content block 204 respectively, uses the graph data model to parse the second content block 202, and uses the chart data model to parse the third content block 203.
[0047] Step 106: Render and display the document content corresponding to the target content block based on the data analysis result.
[0048] Furthermore, the computer device renders corresponding document contents respectively according to the data parsing results corresponding to the content blocks, and displays the document contents of each part in the same container.
[0049] Indicative, such as Figure 2 As shown, based on the data analysis results of different data models, the computer device displays the title 211 corresponding to the first content block 201, the mind map 212 corresponding to the second content block 202, the bar chart 213 corresponding to the third content block 203 and the main text 214 corresponding to the fourth content block 204 in the same container 21.
[0050] In summary, the embodiments of the present application propose a unified data structure that is compatible with different data types. The document content in a document using the unified data structure is divided into content blocks. When parsing the document, the data type corresponding to the content block is determined based on the content block, and the content block is parsed using the data model corresponding to the data type to obtain a data parsing result, thereby rendering the document content based on the data parsing result. Using the solution provided by the embodiments of the present application, the same document can contain content of different data types, and the parsing and display of the document can be completed using a single editing software that integrates data models corresponding to different data types, without the need to install multiple editing software, thereby improving the versatility of the document in different applications.
[0051] In a possible implementation, the data model is a loose model. The data model corresponding to the same data type can be divided into a content model (AbstractModel) and a style model (including AbstractStyle and AbstractAlignStyle). Accordingly, the content part and the style part of the document content can be distinguished in the content block through the content field and the style field. The following exemplary embodiments are described.
[0052] See also Figure 3 , which shows a flow chart of a data processing method provided by another exemplary embodiment of the present application. The method may include the following steps.
[0053] Step 301 , obtaining a target document. The target document adopts a unified data structure, which is compatible with different data types, and the document content in the target document is divided into content blocks.
[0054] The implementation of this step may refer to the above step 102, and this embodiment will not be described in detail here.
[0055] Step 302: Determine a target data model corresponding to the target data type based on the target data type corresponding to the target content block in the target document. The target data model includes a content model and a style model.
[0056] In some embodiments, the data models corresponding to various data types include a content model and a style model, or the data models corresponding to some data types include a content model and a style model, while the data models corresponding to some data types only include a content model (which does not mean that there is no style, but only a default style, and style modification is not supported).
[0057] Indicative, such as Figure 4 As shown, the unified data structure includes a graph theory data model, a graphic and text data model, a list data model, a chart data model, a card data model and a dividing line data model (the document model (OUDSModel) is the root node, which is used to declare the unified data structure itself), among which the graph theory data model, the graphic and text data model, the list data model, the chart data model, and the card data model contain a content model and a style model, while the dividing line data model only contains a content model.
[0058] In some embodiments, when a data type contains multiple subtypes, the data model corresponding to the data type may include multiple content models (i.e., sub-models), and different content models are used to perform data parsing on content blocks of different subtypes under the data type; and, the common basic data of different subtypes under the same data type can be abstracted into a basic content model for calling by the content model corresponding to the subtype.
[0059] In some embodiments, the content model and the style model are associated with each other, and some content models are associated with the style model, while some content models are not associated with the style model.
[0060] In a possible implementation, determining the target data model based on the target data type includes the following situations:
[0061] 1. When the data type is graph data, the graph theory data model is determined as the target data model. The graph theory data model is used to describe the graph structure through nodes and lines.
[0062] Since graphs can be broken down into nodes and lines, the graph theory data model can describe most graph structures such as mind maps, flow charts, tree diagrams, document structure diagrams, etc. through basic nodes and lines.
[0063] In some embodiments, the content model in the graph theory data model may include a mind map model, a flow chart model, a tree diagram model, etc., and since each content model describes the graph result through nodes and lines, the graph theory data model may also include a node model and a line model for each content model to call. Among them, the node model can be used to describe the node information such as the node identifier, node text, and node type of the node, and the line model can be used to describe the line identifier of the line and the line information such as the connected node.
[0064] Correspondingly, the node model has an associated node style model, and the line model has an associated line style model. The node style model is used to describe the appearance style of the node, such as size, color, shape, etc., and the line model is used to describe the appearance style of the line, such as thickness, color, arrow, etc.
[0065] Indicative, such as Figure 4 As shown, the graph theory data model includes a link model (LinkModel), a node model (NodeModel), a mind map model (MindMapModel) and a flow chart model (FlowChartModel), and the link model is associated with a link style model (LinkStyle), and the node model is associated with a node style model (NodeStyle).
[0066] 2. When the data type is graphic data, a graphic data model is determined as a target data model, where the graphic data model is used to describe at least one of text, paragraph, title, and picture.
[0067] In some embodiments, the content model in the graphic data may include a text model, a paragraph model, a title model, and a picture model. Correspondingly, the text model is associated with a text style model, the paragraph model is associated with a paragraph style model (used to describe paragraph information such as paragraph indentation and paragraph spacing), the title model is associated with a title style model (used to describe title layout, title font, title size and other title information), and the picture model is associated with a picture style model (used to describe picture layout, picture color, picture size and other picture information). Of course, the graphic data model may also include other content models and style models, and this embodiment does not limit this.
[0068] In some embodiments, the graphic data model, as a basic model, can be nested and contained in other data models. For example, the graphic data model can be nested in the card data model.
[0069] Indicative, such as Figure 4As shown, the graphic data model includes a text model (TextModel), a paragraph model (ParagraphModel), a title model (HeadingModel) and an image model (ImageModel), and the text model is associated with a text style model (TextStyle), the paragraph model is associated with a paragraph style model (ParagraphStyle), the title model is associated with a title style model (HeadingStyle), and the image model is associated with an image style model (ImageStyle).
[0070] 3. When the data type is list data, the list data model is determined as the target data model, and the list data model is used to describe at least one of an ordered list, an unordered list, and a to-do list.
[0071] Since different types of lists are all composed of list items, the content model of the list data model may include a list item model, the style model may include a list item style model associated with the list item model, and other content models may call the list item model.
[0072] In some embodiments, the content models in the list data model include an ordered list model, an unordered list model, and a to-do list model, and the above content models can all call the list item model to describe the list items.
[0073] Indicative, such as Figure 4 As shown, the list data model includes a list item model (ListItemModel), an ordered list model (OrderedListModel), an unordered list model (BulletListModel) and a to-do list model (TodoListModel).
[0074] 4. When the data type is chart data, the chart data model is determined as the target data model, and the chart data model is used to describe a structured chart through rows and columns.
[0075] Since structured charts are based on rows and columns, the chart data model can describe most structured charts such as tables, bar charts, line charts, pie charts, etc. through rows and columns.
[0076] In some embodiments, the content model of the chart data model may include a row model and a cell model (one row and one column corresponds to one cell), and the row model and the cell model can be called by other content models that use row and column descriptions, where the content models that use row and column descriptions may include bar chart models, table models, line chart models, and the like.
[0077] In some embodiments, the cell model is associated with a cell style model, and the cell style model can be used to describe the style of each cell, such as size and color.
[0078] Indicative, such as Figure 4 As shown, the chart data model includes a row model (RowModel) and a cell model (CellModel), as well as a bar chart model (BarChartModel) corresponding to the bar chart, a table model (TableModel) corresponding to the table, a line chart model (LineChartModel) corresponding to the line chart, and TModel; and the cell model is associated with a cell style model (CellStyle), and TModel is associated with TStyle.
[0079] 5. When the data type is card data, the card data model is determined as the target data model. The card data model is used to describe the card content.
[0080] In some embodiments, the card data model includes a card model, and a card style model associated with the card model. The card model is used to describe the data displayed by the card, and the card style model is used to describe the overall style of the card and the data display style of each piece of data.
[0081] Indicative, such as Figure 4 As shown, the card data model includes a card model (CardModel) and an associated card style model (CardStyle).
[0082] 6. When the data type is dividing line data, a dividing line data model is determined as a target data model. The dividing line data model is used to describe a dividing line for dividing different content blocks.
[0083] In addition to document contents with practical meanings, the document also includes some auxiliary tools. The dividing line, as a tool in the document, is used to divide different types of content blocks and cluster the same type of content blocks.
[0084] In some embodiments, the dividing line data model may only include a dividing line model (content model), which is used to indicate the division rules of content blocks in the document, such as which data types of content blocks to add dividing lines between, which data types of content blocks to aggregate, etc. Of course, in other embodiments, the dividing line model may also be associated with a dividing line style model, which is used to describe the style of the dividing line, such as color, thickness, solid line / dotted line, etc.
[0085] Indicative, such as Figure 4As shown, the dividing line data model includes a dividing line model (HorizionalRuleModel).
[0086] Of course, in other possible implementations, when the document also supports other tools, the dividing line and other tools can be classified as tool data together and correspond to their own tool data models respectively, which is not limited in this embodiment.
[0087] It should be noted that Figure 4 The data model in the data model is only used for exemplary illustration. The data structures included in the unified data structure may be more or less than the above examples. In addition, the content model and style model in the data model are also only used for exemplary illustration. The number and setting method of the content models and style models in the data model may be different from the above examples.
[0088] Step 303: Perform content analysis on the content field of the target content block through the content model to obtain a content analysis result.
[0089] In some embodiments, the computer device performs content parsing on the data content carried by the content field in the target content block through the content model in the target data model to obtain a content parsing result.
[0090] For example, for the target content block corresponding to the mind map, the computer device performs content analysis on the target content block through the connection model and the node model in the graph theory data model to obtain the node information and the connection information, and further analyzes the node information and the connection information through the mind map model corresponding to the mind map to obtain the mind map analysis result.
[0091] For another example, for the target content block corresponding to the to-do list, the computer device performs content parsing on the target content block through the list item model in the list data model to obtain information of each list item (such as the data carried by the list item), and further performs item parsing on the list item information through the to-do class list model corresponding to the to-do list to obtain the to-do list parsing result.
[0092] Step 304: Perform style parsing on the style field of the target content block using the style model to obtain a style parsing result.
[0093] In some embodiments, when the target content block includes a style field indicating the content style, the computer device performs style parsing on the style information carried by the style field in the target content block through a style model associated with the content model to obtain a style parsing result.
[0094] For example, for the target content block corresponding to the mind map, the computer device performs style analysis on the target content block through the connection style model associated with the connection model and the node style model associated with the node model to obtain connection style information and node style information (such as color, thickness, etc.).
[0095] For another example, for a target content block corresponding to a to-do list, a computer device performs style analysis on the target content block through a list item style model associated with a list item model to obtain list item style information (such as list item color, etc.).
[0096] Of course, in other embodiments, when the content model used for content parsing is not associated with a style model, or when the content model used for content parsing is associated with a style model but the target content block does not contain a style field, the computer device does not need to perform style parsing.
[0097] Step 305 : performing content rendering on the document content corresponding to the target content block based on the content parsing result, and performing style rendering on the document content corresponding to the target content block based on the style parsing result.
[0098] Among them, content rendering refers to the rendering of the data content part, which can be a graph structure, text content, picture, list structure, chart structure, card structure, etc. Style rendering refers to the display style of the rendered data content, such as the display style of nodes and lines in the graph structure, the text display style, the display style of class table items in the list structure, the display style of each card field in the card, etc.
[0099] In some embodiments, when the target content block corresponds only to the content parsing result but does not include the style parsing result, the computer device may use a default style to perform style rendering on the document content corresponding to the target content block to meet the basic display requirements of the document content.
[0100] In this embodiment, by setting different data models for document content of different data types and decoupling the content model and style model used for content parsing and style parsing, the content and style are separated and do not affect each other, which helps to improve the content readability of documents using a unified data structure.
[0101] For document content of known data types in the unified data structure, computer devices can parse it through the corresponding data model. However, for data types not defined in the unified data structure, computer devices cannot correctly parse the data contained in the document content through the data model, and thus cannot display the document content in the container.
[0102] In order to prompt users that there are document contents of unknown data types in the document, and to ensure that after the data types supported by the unified data structure are expanded, the document contents of the original unknown data types can be correctly parsed and displayed, the unified data structure also includes unknown data models corresponding to the unknown data types.
[0103] In one possible implementation, when the data type is a known data type, the computer device targets a target data model corresponding to the data type; when the data type is an unknown data type, the computer device renders an attachment identifier corresponding to the unknown data model, which is a data model corresponding to the unknown data type, and the attachment identifier is used to characterize the existence of document content of the unknown data type in the target document.
[0104] In some embodiments, when the value corresponding to the data type field in the content block is not a known value, the computer device determines that the data type of the content is an unknown data type.
[0105] Indicative, such as Figure 4 As shown, the unified data structure also includes an unknown data model (UnknownModel). When the value corresponding to the data type field does not belong to {dividing line, graph theory, chart, card, category table, picture and text}, the computer device determines that the data model corresponding to the content block is an unknown data model.
[0106] Optionally, the attachment identifier may be at least one of preset text, preset pattern or preset picture, or a combination of at least two of them, which is not limited in this embodiment.
[0107] In an illustrative example, Figure 5 As shown, the document content in the target document 50 is divided into four content blocks, and the computer device parses the first content block 501 using the graphic data model, parses the second content block 502 using the graph data model, and parses the third content block 503 using the chart data model, and displays the title 511 corresponding to the first content block 501, the mind map 512 corresponding to the second content block 502, and the bar chart 513 corresponding to the third content block 503 in the same container 51. Since the data type corresponding to the fourth content block 504 is an unknown data type, the computer device displays an attachment identifier 514 corresponding to the unknown data model in the container 51.
[0108] Since data will be deserialized and serialized during the storage and parsing and display process, in order to avoid the deviation (or loss) of the data content of the content blocks of unknown data types after deserialization and serialization, which will affect the subsequent normal parsing, in a possible implementation, the unknown data model stores the content blocks of unknown data types through a Map structure, that is, when deserializing, the content blocks are stored through a Map structure to prevent data loss, and when serializing, the content stored in the Map is taken out to avoid deviation.
[0109] In an illustrative example, a computer device communicates with a var UNKNOWN :Map<String,Any?> =mapOf(), put the data content of unknown data type into this field, and in subsequent serialization, the computer device returns context.serialize(src. UNKNOWN , Map::class.java) restores the data content to ensure that the data content will not be lost during deserialization and serialization.
[0110] In this embodiment, an unknown data model is set in the unified data structure, and the unknown data model is used to store data content of unknown data types through a Map structure, so as to ensure that unknown data types are not lost during the serialization and deserialization process, and avoid compatibility issues when the versions of the unified data structure used by the software and the document are inconsistent. In addition, when a content block of unknown data type is included in the document, the computer device can render and display the attachment mark corresponding to the unknown data model, so that the user can perceive the existence of document content of unknown data type in the document.
[0111] In some embodiments, the fields corresponding to the data are divided into multiple levels. When parsing, the computer device can perform hierarchical parsing on the fields in the data as required, that is, only part of the data content in the content block can be parsed. Figure 6 As shown, the computer device may parse the content block and may include the following steps:
[0112] Step 601, determining the field parsing level, where the field parsing level is used to represent the level to which the fields to be parsed in the target content block belong, and the fields to be parsed are all or part of the fields in the target content block.
[0113] Optionally, fields in content blocks of different data types are divided into at least two levels, and the level division methods and number of level divisions corresponding to different data types may be the same or different.
[0114] For example, for graph data, the graph data field is divided into 3 levels, for list data, the list data field is divided into 2 levels, and for chart data, the chart data field is divided into 3 levels.
[0115] In some embodiments, the levels of data fields can be divided according to their importance, where the importance is related to the degree of necessity in the display process, and the data fields belonging to the first level are necessary data fields in the display process, so the field parsing level includes at least the first field parsing level.
[0116] In one possible implementation, when there are at least two levels of field resolution levels, the importance of fields belonging to the i-th field resolution level is higher than the importance of fields belonging to the i+1-th field resolution level, and the first field resolution level is a necessary field resolution level (that is, the fields belonging to the first field resolution level must be resolved, otherwise they cannot be displayed), and i is a positive integer.
[0117] In an illustrative example, Figure 7 As shown, for graph theory data, the fields belonging to the first field parsing level 711 include a node identification field (Node ID), a node text field (Node Text), a node type field (NodeType), a link identification field (Link ID), a connection start node field (From), and a link end node field (To). The fields belonging to the second field parsing level include a node stroke color field (Stroke-color), a node stroke width field (Stroke-width), and a node fill color field (fill-color). The fields belonging to the third field parsing level include a node bounding box field (Bbox), a line style field (lineStyle), and a line thickness field (linePoints).
[0118] In some embodiments, the field parsing level can be represented by numbers. For example, when the field parsing level is 1 and 2, it indicates that the computer device needs to parse the fields belonging to the first field parsing level and the second field parsing level in the target content block; when the field parsing level is 1, 2, and 3, it indicates that the computer device needs to parse the fields belonging to the first field parsing level, the second field parsing level, and the third field parsing level in the target content block.
[0119] Regarding the method for determining the field parsing level, in a possible implementation, the computer device determines the level to which the required parsed field in the target content block belongs based on the display requirements in the current scenario.
[0120] Optionally, the display requirement is related to at least one of a physical characteristic and a usage characteristic of the computer device, wherein the physical characteristic at least includes a screen size, and the usage characteristic at least includes a control method, wherein the control method may include low-precision control (such as finger touch control) and high-precision control (such as stylus control, mouse control, etc.).
[0121] Generally, when users use computer devices to view documents, their display requirements for small-screen devices are lower than those for large-screen devices (small-screen devices only need to ensure that the content is displayed completely and accurately). Therefore, in some embodiments, when the computer device determines the field resolution level based on the screen size, the number of field resolution levels is positively correlated with the screen size.
[0122] In addition, when a user uses a computer device to view a document, the need for editing on a small-screen device is lower than the need for editing on a large-screen device. Therefore, in some embodiments, when the computer device determines the field resolution level based on the control accuracy of the control method, the number of field resolution levels is positively correlated with the control accuracy.
[0123] Indicatively, Figure 7 As shown, for the same graph theory data content block, when the computer device is a bar terminal, since the screen size of the bar terminal is small and generally supports finger touch operations, the bar terminal determines the first field parsing level 711 as the field level to be parsed; when the computer device is a folding screen terminal or a tablet terminal, since the screen size is large and generally supports finger touch operations and stylus operations, the folding screen terminal or the tablet terminal determines the first field parsing level 711 and the second field parsing level 712 as the field levels to be parsed; when the computer device is a personal computer, since the screen size is large and generally supports finger touch operations, stylus operations and mouse operations, the folding screen terminal or the tablet terminal determines the first field parsing level 711, the second field parsing level 712 and the third field parsing level 713 as the field levels to be parsed.
[0124] Step 602 , based on the target data type corresponding to the target content block in the target document and through the target data model corresponding to the target data type, data parsing is performed on the fields belonging to the field parsing level in the target content block to obtain a data parsing result.
[0125] When performing parsing, the computer device performs data parsing on the fields belonging to the field parsing level through the target data model, and does not perform data parsing on the fields that do not belong to the field parsing level.
[0126] In a possible implementation, the computer device determines a target field belonging to the field parsing level based on the correspondence between the field level and the field, and performs data parsing on the target field through a target data model.
[0127] Indicatively, Figure 7As shown, for bar-type terminals, the most basic graph structure (including nodes and lines with default display style) is displayed based on the data analysis results; for folding screen terminals and tablet terminals, in addition to displaying the most basic graph structure based on the data analysis results, the nodes in the graph structure also have specific node styles (color, width, fill color); for personal computers, in addition to displaying the most basic graph structure and specific node styles based on the data analysis results, the connecting lines in the graph structure also have specific connecting line styles (color and width), and the nodes also have specific bounding box styles.
[0128] In this embodiment, by dividing the data fields into levels, subsequent data analysis can be performed progressively according to the display requirements of the current scenario. This helps to improve the document display speed in different scenarios while ensuring the basic display requirements in different scenarios.
[0129] from Figure 4 As can be seen from the unified data structure shown, the same data model may contain multiple sub-models. For example, the chart data model includes the table model, the bar chart model, and the line chart model. Since different sub-models correspond to homogeneous data (for example, the sub-models under the chart data model all correspond to row data and cell data), content blocks of different sub-data types under the same data type can support type conversion.
[0130] In a possible implementation, a computer device receives a type modification operation on a target content block, where the type modification operation is used to instruct to convert the target content block from a first data type to a second data type, wherein the first data type and the second data type are subtypes of the target data type.
[0131] The type modification operation may be an operation received in the document editing interface. In one possible implementation, when an editing operation on a target content block in the document editing interface is received, at least one type conversion control is displayed in the document editing interface, and the type conversion control is used to trigger the conversion of the target content block from a first data type to a second data type.
[0132] For example, when an editing operation on a table in a document editing interface is received, the computer device displays a bar chart conversion control and a line chart conversion control in the document editing interface. The bar chart conversion control is used to trigger the conversion of the table into a bar chart, and the line chart conversion control is used to trigger the conversion of the table into a line chart.
[0133] Further, the computer device modifies the value of the data type field in the target content block from the first data type to the second data type based on the type modification operation.
[0134] Since different subtypes correspond to homogeneous data, the computer device only needs to modify the value of the data type field to complete the type conversion.
[0135] In an illustrative example, Figure 8 As shown, the original value of the data type field in the content block corresponding to table 81 is "Table". When a type modification operation is received for table 81, and the modified target type is a bar chart, the computer device modifies the value of the data type field in the content block to "BarChart". After performing data parsing on the modified content block, the computer device displays the bar chart 82 obtained after the type conversion.
[0136] Of course, even without a rendering engine, users can manually modify the value of the data type field in the content block to complete the type conversion of the document content.
[0137] In this embodiment, for subtypes under the same data type, format conversion between different subtypes can be achieved by modifying the value of the data type field in the content block, thereby improving the format conversion efficiency of the document content.
[0138] In order to connect different applications and provide intercommunication capabilities between applications, in some embodiments, an adaptation layer is provided in the editing software that adopts a unified data structure. A data converter is provided in the data adaptation layer. The data converter is used to realize data structure conversion between the unified data structure and other data structures adopted by other applications.
[0139] Indicative, such as Figure 7 As shown, the data adaptation layer supports converting a unified data structure into other data structures, and also supports converting other data structures into a unified data structure. And for unknown data structures, the data adaptation layer will not convert the data structure, but use the original format for file storage.
[0140] Regarding the method of obtaining the target document, in a possible implementation, the computer device obtains an original document, which uses a first data structure different from the unified data structure. The computer device converts the data structure of the original document through a first data converter corresponding to the first data structure to obtain a target document with a unified data structure. In this way, the computer device can parse and display documents output by other applications.
[0141] In some embodiments, when the original document is generated by an office application, the computer device can convert the data structure of the original document used by the office application into a unified data structure through the ODUS-office converter, so as to facilitate data parsing according to the data model of the unified data structure.
[0142] In other possible implementations, the computer device may also perform data structure conversion on the target document through a second data converter corresponding to the target data structure to obtain a target converted document, and output the target converted document. In this way, the computer device may output a document that can be parsed and displayed by other applications.
[0143] In some embodiments, when the target document needs to be sent to an office application for parsing and display, the computer device can use the ODUS-office converter to convert the target document from a unified data structure to a data structure used by the office application, thereby facilitating the office application to parse and display the converted target document.
[0144] In addition, in some embodiments, in order to improve the versatility across systems, the computer device can switch the data format based on the applicable system. For example, the computer device can select the most suitable format according to the adaptability of the system to different languages. For example, the JS (Java Script) language used by the Android system has a natural adaptability to the json format, so a document in the json format can be used; when the system has a high adaptability to the xml language, the document can be converted to the xml format.
[0145] In this embodiment, data structure conversion is performed through data converters corresponding to different data structures in the data adaptation layer, so that the unified data structure can communicate with other data structures, implement cross-application document content parsing, and expand the applicable scenarios of the unified data structure.
[0146] Indicative, such as Fig. 9 As shown, the unified data structure parsing system consists of a basic model layer 91, a data adaptation layer 92 and an auxiliary extension layer 93.
[0147] The basic model layer 91 includes data models corresponding to different data types.
[0148] The data adaptation layer 92 is the core layer of the data ecosystem and is used to realize the data flow between the unified data structure and other applications. The data adaptation layer 92 contains a large number of data converters, such as ouds-html (OUDS is converted to HTML format, and HTML can be rendered in a common browser), ouds-gson (custom gson parsing logic, which speeds up parsing efficiency while doing special processing for extended models and unknown models to prevent data loss), ouds-md (data models can be exported to markdown format to achieve flow in related applications), ouds-tiptap (with the tiptap rich text editor to achieve the ability to edit static data), ouds-office (the ability to export office data, which can support exporting software such as excel and word), and ouds-note (to achieve intercommunication with sticky notes).
[0149] The auxiliary extension layer 93 (ouds-assist) is used to provide packaged auxiliary capabilities.
[0150] In some embodiments, the data model in the basic model layer 91 supports extension via SPI (Service Provider Interface).
[0151] In some embodiments, the data converters in the data adaptation layer support updates, that is, as the number of adapted applications increases, the number of data converters in the data adaptation layer will also increase.
[0152] Indicatively, Fig.10 As shown, when a new data model needs to be added to the basic model layer 1001, it is necessary to consider supporting gson, html, tiptap and office. The data conversion layer 1002 can add a new data model to the Jar package 1003 through SPI dynamic loading, so as to expand the data model without modifying the source code of the basic package and expand the data types supported by the unified data structure.
[0153] See also Fig.11 , Fig.11 : is a structural block diagram of a data processing device provided by an exemplary embodiment of the present application. The device includes:
[0154] The acquisition module 1101 is used to acquire a target document, wherein the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks;
[0155] The parsing module 1102 is used to perform data parsing on the target content block in the target document based on the target data type corresponding to the target content block through the target data model corresponding to the target data type to obtain a data parsing result, wherein different data models are used to parse content blocks of different data types;
[0156] The rendering module 1103 is used to render and display the document content corresponding to the target content block based on the data parsing result.
[0157] Optionally, the parsing module 1102 is used to:
[0158] Based on the target data type corresponding to the target content block in the target document, determining the target data model corresponding to the target data type, wherein the target data model includes a content model and a style model;
[0159] Performing content parsing on the content field of the target content block through the content model to obtain a content parsing result, and performing style parsing on the style field of the target content block through the style model to obtain a style parsing result;
[0160] Optionally, the rendering module 1103 is used to:
[0161] The document content corresponding to the target content block is rendered based on the content parsing result, and the document content corresponding to the target content block is rendered in a style based on the style parsing result.
[0162] Optionally, the parsing module 1102 is used to:
[0163] In the case where the data type is graph data, a graph theory data model is determined as the target data model, wherein the graph theory data model is used to describe a graph structure through nodes and lines;
[0164] In the case where the data type is graphic data, determining a graphic data model as the target data model, the graphic data model being used to describe at least one of text, paragraph, title, and picture;
[0165] In the case where the data type is list data, determining a list data model as the target data model, the list data model being used to describe at least one of an ordered list, an unordered list, and a to-do list;
[0166] In the case where the data type is chart data, determining a chart data model as the target data model, the chart data model being used to describe a structured chart by rows and columns;
[0167] In the case where the data type is card data, determining a card data model as the target data model, the card data model being used to describe card content;
[0168] In the case where the data type is dividing line data, a dividing line data model is determined as the target data model, and the dividing line data model is used to describe a dividing line for dividing different content blocks.
[0169] Optionally, the parsing module 1102 is used to:
[0170] In the case where the data type is a known data type, determining the target data model corresponding to the target data type;
[0171] The rendering module 1103 is further used for:
[0172] In the case where the data type is an unknown data type, an attachment identifier corresponding to an unknown data model is rendered, the unknown data model is a data model corresponding to the unknown data type, and the attachment identifier is used to represent that there is document content of the unknown data type in the target document.
[0173] Optionally, the unknown data model stores the content blocks of the unknown data type through a Map structure, and the data content of the content blocks of the unknown data type remains unchanged after deserialization and serialization.
[0174] Optionally, the parsing module 1102 is further used to:
[0175] Determine a field parsing level, where the field parsing level is used to represent the level to which the fields to be parsed in the target content block belong, and the fields to be parsed are all or part of the fields in the target content block;
[0176] Based on the target data type corresponding to the target content block in the target document, data parsing is performed on the fields belonging to the field parsing level in the target content block through the target data model corresponding to the target data type to obtain the data parsing result.
[0177] Optionally, when there are at least two levels of field resolution levels, the importance of fields belonging to the i-th field resolution level is higher than the importance of fields belonging to the i+1-th field resolution level, and the first field resolution level is a necessary field resolution level, and i is a positive integer.
[0178] Optionally, the parsing module 1102 is used to:
[0179] The field resolution level is determined based on physical characteristics and usage characteristics of the computer device, wherein the physical characteristics at least include screen size, and the usage characteristics at least include control methods.
[0180] Optionally, the device further comprises:
[0181] an operation receiving module, configured to receive a type modification operation on the target content block, wherein the type modification operation is used to instruct to convert the target content block from a first data type to a second data type, wherein the first data type and the second data type are subtypes of the target data type;
[0182] A modification module is used to modify the value of the data type field in the target content block from the first data type to the second data type based on the type modification operation.
[0183] Optionally, the data model supports extension via SPI.
[0184] Optionally, the acquisition module 1101 is used to:
[0185] Acquire an original document, wherein the original document adopts a first data structure different from the unified data structure;
[0186] The data structure of the original document is converted by a first data converter corresponding to the first data structure to obtain the target document, wherein different data structures correspond to different data converters.
[0187] Optionally, the device further comprises:
[0188] A conversion module, configured to perform data structure conversion on the target document through a second data converter corresponding to the target data structure to obtain a target conversion document, wherein different data structures correspond to different data converters;
[0189] An output module is used to output the target conversion document.
[0190] In summary, the embodiments of the present application propose a unified data structure that is compatible with different data types. The document content in a document using the unified data structure is divided into content blocks. When parsing the document, the data type corresponding to the content block is determined based on the content block, and the content block is parsed using the data model corresponding to the data type to obtain a data parsing result, thereby rendering the document content based on the data parsing result. Using the solution provided by the embodiments of the present application, the same document can contain content of different data types, and the parsing and display of the document can be completed using a single editing software that integrates data models corresponding to different data types, without the need to install multiple editing software, thereby improving the versatility of the document in different applications.
[0191] See also Fig.12 , Fig.1212 is a schematic diagram of a computer device provided by an exemplary embodiment of the present application. The computer device may be an electronic device such as a smart phone, a tablet computer, a personal computer, etc. The computer device may also include one or more of the following components: a processor 1210 and a memory 1220.
[0192] Optionally, the processor 1210 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 1220, and calling data stored in the memory 1220. Optionally, the processor 1210 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 1210 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), a neural network processor (NPU), and a baseband chip. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content that needs to be displayed on the touch display; the NPU is used to implement artificial intelligence (AI) functions; and the baseband chip is used to process wireless communications. It is understandable that the above-mentioned baseband chip may not be integrated into the processor 1210, but may be implemented by a separate chip.
[0193] The memory 1220 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 1220 includes a non-transitory computer-readable storage medium. The memory 1220 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 1220 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 following various method embodiments, etc.; the data storage area may store data created according to the use of the electronic device (such as audio data, a phone book), etc.
[0194] In addition, those skilled in the art will appreciate that the structure of the computer device shown in the above figures does not constitute a limitation on the computer device, and the computer device may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0195] The embodiment of the present application also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the method described in the above embodiment. Optionally, the computer-readable storage medium may include: ROM, RAM, solid state drive (SSD, Solid State Drives) or optical disk, etc. Among them, RAM may include resistance random access memory (ReRAM, Resistance Random Access Memory) and dynamic random access memory (DRAM, Dynamic Random Access Memory).
[0196] The embodiment of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the data processing method provided in various optional implementations of the above aspects.
[0197] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a target document, wherein the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks; Based on the target data type corresponding to the target content block in the target document, the content block is parsed using the target data model corresponding to the target data type to obtain a data parsing result, wherein different data models are used to parse content blocks of different data types; The document content corresponding to the target content block is rendered and displayed based on the data parsing result.
2. The method according to claim 1, characterized in that The step of performing data parsing on the content block based on the target data type corresponding to the target content block in the target document by using the target data model corresponding to the target data type to obtain the data parsing result includes: Based on the target data type corresponding to the target content block in the target document, determining the target data model corresponding to the target data type, wherein the target data model includes a content model and a style model; Performing content parsing on the content field of the target content block through the content model to obtain a content parsing result, and performing style parsing on the style field of the target content block through the style model to obtain a style parsing result; The rendering and displaying of the document content corresponding to the target content block based on the data parsing result includes: The document content corresponding to the target content block is rendered based on the content parsing result, and the document content corresponding to the target content block is rendered in a style based on the style parsing result.
3. The method according to claim 2, characterized in that The determining the target data model corresponding to the target data type includes: In the case where the data type is graph data, a graph theory data model is determined as the target data model, wherein the graph theory data model is used to describe a graph structure through nodes and lines; In the case where the data type is graphic data, determining a graphic data model as the target data model, the graphic data model being used to describe at least one of text, paragraph, title, and picture; In the case where the data type is list data, determining a list data model as the target data model, the list data model being used to describe at least one of an ordered list, an unordered list, and a to-do list; In the case where the data type is chart data, determining a chart data model as the target data model, the chart data model being used to describe a structured chart by rows and columns; In the case where the data type is card data, determining a card data model as the target data model, the card data model being used to describe card content; In the case where the data type is dividing line data, a dividing line data model is determined as the target data model, and the dividing line data model is used to describe a dividing line for dividing different content blocks.
4. The method according to claim 2, characterized in that: The determining the target data model corresponding to the target data type includes: In the case where the data type is a known data type, determining the target data model corresponding to the target data type; The method further comprises: In the case where the data type is an unknown data type, an attachment identifier corresponding to an unknown data model is rendered, the unknown data model is a data model corresponding to the unknown data type, and the attachment identifier is used to represent that there is document content of the unknown data type in the target document.
5. The method according to claim 4, characterized in that The unknown data model stores the content blocks of the unknown data type through a Map structure, and the data content of the content blocks of the unknown data type remains unchanged after deserialization and serialization.
6. The method according to claim 1, characterized in that The method further comprises: Determine a field parsing level, where the field parsing level is used to represent the level to which the fields to be parsed in the target content block belong, and the fields to be parsed are all or part of the fields in the target content block; The step of performing data parsing on the content block based on the target data type corresponding to the target content block in the target document by using the target data model corresponding to the target data type to obtain the data parsing result includes: Based on the target data type corresponding to the target content block in the target document, data parsing is performed on the fields belonging to the field parsing level in the target content block through the target data model corresponding to the target data type to obtain the data parsing result.
7. The method according to claim 6, characterized in that When there are at least two levels of field resolution levels, the importance of fields belonging to the i-th field resolution level is higher than the importance of fields belonging to the i+1-th field resolution level, and the first field resolution level is a necessary field resolution level, and i is a positive integer.
8. The method according to claim 6, characterized in that The determining of the field parsing level includes: The field resolution level is determined based on physical characteristics and usage characteristics of the computer device, wherein the physical characteristics at least include screen size, and the usage characteristics at least include control methods.
9. The method according to claim 1, characterized in that: The method further comprises: receiving a type modification operation on the target content block, the type modification operation being used to instruct the target content block to be converted from a first data type to a second data type, the first data type and the second data type being subtypes of the target data type; Based on the type modification operation, the value of the data type field in the target content block is modified from the first data type to the second data type.
10. The method according to claim 1, characterized in that The data model supports extension via SPI.
11. The method according to claim 1, characterized in that: The obtaining of the target document comprises: Acquire an original document, wherein the original document adopts a first data structure different from the unified data structure; The data structure of the original document is converted by a first data converter corresponding to the first data structure to obtain the target document, wherein different data structures correspond to different data converters.
12. The method according to claim 1, characterized in that The method further comprises: Performing data structure conversion on the target document by a second data converter corresponding to the target data structure to obtain a target conversion document, wherein different data structures correspond to different data converters; The target conversion document is output.
13. A data processing device, characterized in that: The device comprises: An acquisition module is used to acquire a target document, wherein the target document adopts a unified data structure, the unified data structure is compatible with different data types, and the document content in the target document is divided into content blocks; A parsing module, configured to parse the target content block in the target document based on the target data type corresponding to the target content block, and obtain a data parsing result by using a target data model corresponding to the target data type, wherein different data models are used to parse content blocks of different data types; A rendering module is used to render and display the document content corresponding to the target content block based on the data parsing result.
14. A computer device, characterized in that: The computer device includes a processor and a memory; the memory stores at least one instruction, and the at least one instruction is used to be executed by the processor to implement the data processing method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is used to be executed by a processor to implement the data processing method according to any one of claims 1 to 12.
16. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the terminal implements the data processing method as described in any one of claims 1 to 12.