A rich text processing method and device, a storage medium and an electronic device

By performing structural transformation and fit calculation on rich text content, constructing a tree structure and determining encapsulation boundaries, the problem of insufficient flexibility in rich text editors is solved, and fine-grained encapsulation and flexible editing are achieved.

CN116821426BActive Publication Date: 2026-01-30KANG JIAN INFORMATION TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310811173.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-04
Publication Date
2026-01-30
Estimated Expiration
2043-07-04

AI Technical Summary

Technical Problem

Existing rich text editors can only handle flat data and cannot be broken down into smaller modules, resulting in insufficient flexibility and freedom, making it difficult to modify and adjust rich text files.

Method used

By performing structural transformation on the rich text content, a tree structure is constructed, the fitting degree of the node level is calculated, the target encapsulation boundary is determined, and container encapsulation processing is performed.

Benefits of technology

It achieves fine-grained encapsulation of rich text, improves flexibility, facilitates subsequent modification and adjustment, and provides flexible and reliable editing services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116821426B_ABST
    Figure CN116821426B_ABST
Patent Text Reader

Abstract

This application relates to the fields of digital healthcare and computer technology, specifically disclosing a rich text processing method, apparatus, storage medium, and electronic device. The method includes: performing structural transformation on rich text content to obtain a tree structure with several content elements as nodes; classifying each content element in the tree structure to determine the element type corresponding to each content element; calculating the fitting degree for the current parent node and several current child nodes corresponding to the current parent node in two adjacent node levels of the tree structure, based at least on each content element and its element type, to obtain the fitting degree corresponding to each current parent node; determining a target encapsulation boundary based on the fitting degree corresponding to each current parent node, and performing container encapsulation processing on the rich text content based on the target encapsulation boundary. This application can refine the granularity of rich text, facilitating subsequent modification and adjustment of the rich text, and improving its flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of digital healthcare and computer technology, and in particular to a rich text processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] A rich text editor (multi-function text editor) is a browser-embedded document tool that allows editing of text, images, and Hyper Text Markup Language (HTML) elements. It has a WYSIWYG (What You See Is What You Get) capability and can be applied to online consultation platforms, remote consultation systems, or other medical systems for editing text / image content elements.

[0003] Currently, rich text editors can only handle flat data, such as text and images superimposed within a single outer frame, ultimately resulting in a fluid layout. However, they are ineffective for complex structures. Existing methods for handling rich text only accept fluid layouts and cannot be broken down into smaller, more granular modules, lacking freedom and flexibility, and making it inconvenient to modify and adjust rich text files later. Summary of the Invention

[0004] In view of this, the present invention provides a rich text processing method, apparatus, storage medium and electronic device, the main purpose of which is to solve the problem that the current method of processing rich text can only perform streaming layout, which is not convenient for subsequent modification and adjustment of rich text files.

[0005] To address the above problems, this application provides a rich text processing method, including:

[0006] The rich text content is structurally transformed to obtain a tree structure with several content elements as nodes;

[0007] Each content element in the tree structure is classified to determine the element type corresponding to each content element;

[0008] Based at least on each content element and the element type of each content element, the fitting degree is calculated for the current parent node and several current child nodes corresponding to the current parent node in two adjacent node levels in the tree structure, so as to obtain the fitting degree corresponding to each current parent node.

[0009] The target encapsulation boundary is determined based on the fit degree corresponding to each current parent node, and the rich text content is encapsulated in a container based on the target encapsulation boundary.

[0010] Optionally, the structural transformation of the rich text content to obtain a tree structure with several content elements as nodes specifically includes:

[0011] Recognize rich text content in a JSON structure and obtain several content elements;

[0012] Based on the hierarchical relationship between the content elements, a tree structure is constructed, consisting of several content elements as nodes.

[0013] Optionally, the step of calculating the fitting degree for the current parent node and several current child nodes corresponding to the current parent node in two adjacent node levels in the tree structure, based at least on each content element and the element type of each content element, to obtain the fitting degree corresponding to each current parent node, specifically includes:

[0014] Based on each content element, determine the repetition degree of the content elements corresponding to each node in the tree structure;

[0015] Based on the element type of each content element, determine the frequency of occurrence of the corresponding type for each node in the tree structure;

[0016] For the current parent node and several current child nodes corresponding to the current parent node in two adjacent node levels in the tree structure, the fitting degree is calculated based at least on the frequency of occurrence of the type corresponding to the current parent node and the repetition of the content elements corresponding to each current child node, so as to obtain the fitting degree corresponding to the current parent node.

[0017] Optionally, the rich text processing method further includes:

[0018] Based on the class name in each content element, determine the number of times the class name is repeated for each node in the tree structure;

[0019] The process of calculating the fitting degree for each content element and its element type, based at least on each content element, involves performing fitting degree calculations on the current parent node and its corresponding child nodes in adjacent node levels within the tree structure, to obtain the fitting degree corresponding to each current parent node. Specifically, this includes:

[0020] For the current parent node and several current child nodes corresponding to the current parent node in two adjacent node levels in the tree structure, the fitting degree is calculated based on the frequency of occurrence of the type corresponding to the current parent node, the repetition degree of the content elements corresponding to each current child node, and the repetition number of class names corresponding to each current child node, to obtain the fitting degree corresponding to the current parent node.

[0021] Optionally, determining the target encapsulation boundary based on the fitting degree corresponding to each current parent node specifically includes:

[0022] Sort the fitting degree of each current parent node in descending order, and determine the current parent node in the first sorting position as the target parent node;

[0023] Each child node corresponding to the target parent node is determined as a target child node, and each target child node is used as the target encapsulation boundary.

[0024] Optionally, the container encapsulation process of the rich text content based on the target encapsulation boundary specifically includes:

[0025] Based on the target encapsulation boundary, a container is encapsulated for the content element corresponding to each target child node to perform container encapsulation processing on the rich text content.

[0026] Optionally, the rich text processing method further includes: marking the encapsulation container according to a predetermined marking method.

[0027] To address the above problems, this application provides a rich text processing apparatus, comprising:

[0028] The conversion module is used to perform structural conversion on rich text content to obtain a tree structure with several content elements as nodes;

[0029] The first determining module is used to classify each content element in the tree structure to determine the element type corresponding to each content element;

[0030] The calculation module is used to calculate the fitting degree of each content element and the element type of each content element, respectively, for the current parent node and several current child nodes corresponding to the current parent node in the two adjacent node levels in the tree structure, and to obtain the fitting degree corresponding to each current parent node.

[0031] The encapsulation module is used to determine the target encapsulation boundary based on the fitting degree corresponding to each current parent node, and to perform container encapsulation processing on the rich text content based on the target encapsulation boundary.

[0032] To address the aforementioned problems, this application provides a storage medium storing a computer program that, when executed by a processor, implements the steps of any of the rich text processing methods described above.

[0033] To address the aforementioned problems, this application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program in the memory, implements the steps of any of the rich text processing methods described above.

[0034] This application discloses a rich text processing method, apparatus, storage medium, and electronic device. By acquiring a tree structure with element content as nodes and determining the element type of the element content corresponding to each node, a goodness-of-fit calculation can be performed based on the hierarchical relationship of each node and the element content and element type of each node. This makes the calculation results more reasonable and accurate. Subsequently, the encapsulation boundary can be accurately and reasonably determined based on the calculated goodness-of-fit, thereby achieving reasonable and accurate encapsulation of rich text. This refines the granularity of rich text, facilitates subsequent modification and adjustment of rich text, and improves the flexibility of rich text. At the same time, it can provide flexible and reliable rich text editing services for online consultation platforms, remote consultation systems, or other medical systems.

[0035] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0036] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0037] Figure 1 This is a flowchart illustrating a rich text processing method according to an embodiment of this application;

[0038] Figure 2 This is a flowchart of a rich text processing method according to another embodiment of this application;

[0039] Figure 3 This is a schematic diagram of a tree structure in one embodiment of this application;

[0040] Figure 4 This is a structural block diagram of a rich text processing device according to another embodiment of this application;

[0041] Figure 5 This is a structural block diagram of an electronic device according to another embodiment of this application. Detailed Implementation

[0042] Various embodiments and features of this application are described herein with reference to the accompanying drawings.

[0043] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.

[0044] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0045] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.

[0046] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.

[0047] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.

[0048] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.

[0049] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.

[0050] This application provides a rich text processing method, which can be applied to electronic devices such as servers and terminals. It can also be applied to rich text processing in online consultation platforms, remote consultation systems, or other medical systems. Figure 1 As shown, the method in this embodiment specifically includes the following steps:

[0051] Step S101: Perform structural transformation on the rich text content to obtain a tree structure with several content elements as nodes;

[0052] In this step, the rich text containing the JSON structure is identified to obtain several content elements. Then, a tree structure with each content element as a node is constructed based on the hierarchical relationship between these elements. Taking an online consultation platform as an example, the content elements in this embodiment can specifically include departments, registration information, symptoms, doctor profiles, doctor photos, etc., within the online consultation platform. Departments can include any one or more of the following: internal medicine, surgery, ophthalmology, orthopedics, dentistry, pediatrics, oncology, physical examination, psychiatry, obstetrics, etc.

[0053] Step S102: Classify each content element in the tree structure to determine the element type corresponding to each content element;

[0054] Step S103: Based at least on each content element and the element type of each content element, calculate the fitting degree for the current parent node and several current child nodes corresponding to the current parent node in the adjacent node levels of the tree structure, and obtain the fitting degree corresponding to each current parent node.

[0055] In this step, the repetition rate of content elements corresponding to each node in the tree structure can be determined based on each content element; simultaneously, the frequency of occurrence of the corresponding type of each node in the tree structure can be determined based on the element type of each content element. Then, the frequency of occurrence of the type corresponding to the current parent node in two adjacent node levels is weighted with the repetition rate of content elements corresponding to each current child node to obtain the fit with the current parent node.

[0056] Step S104: Determine the target encapsulation boundary based on the fitting degree corresponding to each current parent node, and perform container encapsulation processing on the rich text content based on the target encapsulation boundary.

[0057] In the specific implementation process, this step involves determining the current parent node with the highest fit as the target parent node, and then using the child nodes corresponding to this parent node as encapsulation boundaries to encapsulate the content elements corresponding to the child nodes.

[0058] This embodiment of a rich text processing method obtains a tree structure with element content as nodes and determines the element type of the element content corresponding to each node. Subsequently, a goodness-of-fit calculation can be performed based on the hierarchical relationship of each node and the element content and element type of each node, making the calculation results more reasonable and accurate. Then, based on the calculated goodness-of-fit, the encapsulation boundary can be accurately and reasonably determined, thereby realizing reasonable and accurate encapsulation of rich text, refining the granularity of rich text, facilitating subsequent modification and adjustment of rich text, improving the flexibility of rich text, and providing flexible and reliable rich text editing services for online consultation platforms, remote consultation systems, or other medical systems.

[0059] Another embodiment of this application provides a rich text processing method, such as... Figure 2 As shown, it includes:

[0060] Step S201: Recognize the rich text content of the JSON structure to obtain several content elements; Based on the hierarchical relationship between the content elements, construct a tree structure with several content elements as nodes;

[0061] In the specific implementation of this step, for example, we can first obtain content element A, content element a, content element b, content element c, content element a', content element b', content element c', content element d', content element e', and content element f'. Then, based on the hierarchical / nesting relationships between these content elements, we can construct and obtain, for example, content element a', content element b', content element c', content element c', content element d', content element e', and content element f'. Figure 3 The tree structure shown.

[0062] Step S202: Classify each content element in the tree structure to determine the element type corresponding to each content element;

[0063] In the specific implementation of this step, the element types can include any one or more of the following: main root element, document metadata, content section, text content, inline text semantics, images and multimedia, embedded content, SVG and MathML, scripts, editing tags, table content, forms, interactive elements, and web components. Specifically, for the main root element type, its corresponding content elements include: For the document metadata element type, its corresponding content elements include: <base> , <base> , <link> , <link> , <style>、<title>。针对分区根元素这个元素类型,其对应的内容元素包括<body>。针对内容分区这个元素类型,其对应的内容元素包括:<address>、<article>、<aside>、<footer>、<header>等等。也就是说,上述各元素类型分别对应有一种或多种内容元素,在此不再一一赘述。

[0064] 步骤S203,基于各内容元素,分别确定树形结构中各节点对应的内容元素重复度;

[0065] 本步骤在具体实施过程中,可以统计相同内容元素出现的次数,然后将相同内容元素出现的次数与树形结构中内容元素的总数量相除,即可以获得内容元素的重复度。比如针对内容元素c,可以确定其内容元素重复度为2 / 15。

[0066] 步骤S204,基于各内容元素的元素类型,分别确定树形结构中各节点对应的类型出现频率;

[0067] 本步骤在具体实施过程中,类型出现频率是指同一元素类型所包含的的内容元素的数量,即某一元素类型出现的次数。比如内容元素有如下几个:内容元素A、内容元素a、内容元素b、内容元素c、内容元素a’、内容元素b’、内容元素c’、内容元素d’、内容元素e’以及内容元素f’。其中,内容元素A对应的元素类型为类型1,内容元素a对应的元素类型为类型1,内容元素b对应的元素类型为类型2,内容元素c对应的元素类型为类型3,内容元素a’对应的元素类型为类型1,内容元素b’对应的元素类型为类型2,内容元素c’对应的元素类型为类型3,内容元素d’对应的元素类型为类型3,内容元素e’对应的元素类型为类型1,内容元素f’对应的元素类型为类型4。由此,可以确定内容元素A对应的节点的类型出现频率为类型1的出现频率,具体为4。内容元素a对应的节点的类型出现频率也为类型1的出现频率,也为4。内容元素b对应的节点的类型出现频率为类型2的出现频率,具体为2。以此类推,可以确定树形结构中每个节点的类型出现频次。

[0068] 步骤S205,针对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,至少基于当前父节点对应的类型出现频率以及各当前子节点对应的内容元素重复度进行拟合度计算,获得与所述当前父节点对应的拟合度。

[0069] 本步骤中,当确定了各节点对应的内容元素重复度以及各节点对应的类型出现频率之后,就可以基于任意父节点的类型出现频率、以及该父节点对应的各子节点的内容元素重复度,计算获得该父节点与各子节点之间的拟合度。

[0070] 如图3所述,在具体实施过程中,可以基于树形结构、按照由下向上的层级顺序,计算各父节点与相应的各子节点之间的拟合度。例如,首先可以将节点a’作为当前父节点,然后计算当前父节点a’与子节点e’以及子节点f’之间的拟合度。然后再将节点a、节点b以及两个节点c分别作为当前父节点,以分别计算当前节点a、节点b、节点c与其对应的各子节点之间的拟合度。

[0071] 以计算当前父节点a’与子节点e’以及子节点f’之间的拟合度为例,具体可以将当前父节点a’的类型出现频率、子节点e’的内容元素重复度以及子节点f’的内容元素重复度进行加权处理,由此获得拟合度。也就是,拟合度=4(父节点a’的类型出现频率)+1 / 15(子节点e’的内容元素重复度)+1 / 15(子节点f’的内容元素重复度)。

[0072] 步骤S206,对各当前父节点对应的拟合度按照由高到低的顺序进行排序,确定位于第一排序位置的当前父节点为目标父节点;确定所述目标父节点对应的各子节点为目标子节点,以将各目标子节点作为目标封装边界;

[0073] 本步骤中,通过根据拟合度按照的大小,对各当前父节点按照由高到低的顺序排序,能够快速准确的挑选出拟合度最高的当前父节点,由此就可以将该当前父节点作为目标父节点,同时将该父节点对应的各子节点作为目标封装边界。

[0074] 步骤S207,基于所述目标封装边界,为各所述目标子节点对应的内容元素封装容器,以对所述富文本内容进行容器封装处理。

[0075] 本步骤中,当确定出目标封装边界之后,就可以对目标子节点进行封装处理,细化了富文本的颗粒度,便于后续对富文本进行修改、调整,提高了富文本灵活度;打破传统富文本的单纬度模块处理模式。

[0076] 本步骤在具体实施过程中,在进行封装处理之后,还可以按照预定的标记方式对封装容器进行标记。并且可以将封装后的目标子节点对应的富文本内容进行存储,由此能够便于后续维护,方便后续进行增删改查等操作。

[0077] 本实施例中的一种富文本处理方法,通过获取以元素内容为节点的树形结构,并确定各节点对应的元素内容的元素类型,后续就可以基于各节点的层级关系以及各节点的元素内容和元素类型进行拟合度计算,使得计算结果更加合理、准确,后续就可以基于计算获得的拟合度精准、合理的确定出封装边界,从而实现对富文本合理、准确的进行封装,细化了富文本的颗粒度,便于后续对富文本进行修改、调整,提高了富文本灵活度,同时能够为线上问诊平台、远程会诊系统或其他等医疗系统提供灵活、可靠的富文本编辑服务。

[0078] 在上述实施例的基础上,本申请另一实施例提供一种富文本处理方法,本实施例中,为了使得拟合度计算的更加精准可靠,可以进一步结合内容元素中的类名进行拟合度计算。也就是,基于当前父节点对应的类型出现频率、各当前子节点对应的内容元素重复度、以及各当前子节点对应的类名重复次数,进行拟合度计算,获得与所述当前父节点对应的拟合度。具体拟合度计算过程为:首先基于各内容元素中的类名,分别确定树形结构中各节点对应的类名重复次数;然后,针对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,基于当前父节点对应的类型出现频率、各当前子节点对应的内容元素重复度、以及各当前子节点对应的类名重复次数,进行拟合度计算,获得与所述当前父节点对应的拟合度。

[0079] 在上述实施例的基础上,以下结合具体的应用场景对本申请中的富文本处理方法进行解释说明,本实施例中,具体可以采用处理过程如下:

[0080] 步骤一、首先,获取最外层父内容元素(当前父节点)下的所有子内容元素(各子节点)。

[0081] 步骤二、对内容元素的元素类型进行归类,同时对各元素类型的出现频率(类型出现频率)进行降序排列,并基于类型出现频率对相对应的内容元素进行打标,形式如<divfrequency=n / >。

[0082] 步骤三、确定各内容元素是否存在类名;如果存在类名则对类名按照空格分割,然后统计具有相同类名的内容元素的个数,获得类名重复次数,并基于类名重复次数对相应的内容元素进行打标,形式如<div classNames={classA:3,classB:2} / >。

[0083] 步骤四、将各子内容元素(子节点)作为各当前父内容元素(父节点),判断各当前父内容元素是否存在子内容元素,如果存在子内容元素,则返回步骤二、以重复步骤二至步骤三;如果不存在子内容元素,则执行步骤五;

[0084] 步骤五、采用递归向上遍历所有层,计算拟合度,即计算各子内容元素与其对应的父内容元素之间的拟合度。

[0085] 本步骤中,具体可以拟合度计算公式如下:拟合度=父内容元素的类型出现频率frequency+子内容元素的类名重复次数childrenTagFrequency+子内容元素的内容元素重复度childrenTagFrequency。

[0086] 步骤六、选出拟合度最高的层级,其子内容元素即为目标封装边界 / 模块边界。

[0087] 步骤七、存储当前父内容元素,并为各个子内容元素封装外层容器,对应容器进行标记加粗提示,并对模块列表进行存储维护,方便后续进行增删改查。

[0088] 本实施例中的方法,通过获取以元素内容为节点的树形结构,并确定各节点对应的元素内容的元素类型,后续就可以基于各节点的层级关系以及各节点的元素内容和元素类型进行拟合度计算,使得计算结果更加合理、准确,后续就可以基于计算获得的拟合度精准、合理的确定出封装边界,从而实现对富文本合理、准确的进行封装,细化了富文本的颗粒度,便于后续对富文本进行修改、调整,提高了富文本灵活度,同时能够为线上问诊平台、远程会诊系统或其他等医疗系统提供灵活、可靠的富文本编辑服务。

[0089] 本申请另一实施例提供一种富文本处理装置,如图4所示,包括:

[0090] 转换模块11,用于对富文本内容进行结构转换,获得由若干内容元素作为节点的树形结构;

[0091] 第一确定模块12,用于分别对所述树形结构中各内容元素进行分类,以确定各内容元素对应的元素类型;

[0092] 计算模块13,用于至少基于各内容元素以及各内容元素的元素类型,分别对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,进行拟合度计算,获得与各当前父节点对应的拟合度;

[0093] 封装模块14,用于基于各当前父节点对应的拟合度确定目标封装边界,以基于所述目标封装边界对所述富文本内容进行容器封装处理。

[0094] 本实施例在具体实施过程中,所述转换模块具体用于:对json结构的富文本内容进行识别,获得若干内容元素;基于各内容元素之间的层级关系,构建获得由若干内容元素作为节点的树形结构。

[0095] 本实施例在具体实施过程中,所述计算模块具体包括第一确定单元、第二确定单元以及计算单元;所述第一确定单元用于:基于各内容元素,分别确定树形结构中各节点对应的内容元素重复度;所述第二确定单元用于:基于各内容元素的元素类型,分别确定树形结构中各节点对应的类型出现频率;所述计算单元用于:针对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,至少基于当前父节点对应的类型出现频率以及各当前子节点对应的内容元素重复度进行拟合度计算,获得与所述当前父节点对应的拟合度。

[0096] 本实施例在具体实施过程中,所述富文本处理装置还包括:第二确定模块,所述第二确定模块用于:基于各内容元素中的类名,分别确定树形结构中各节点对应的类名重复次数。所述计算模块具体用于:针对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,基于当前父节点对应的类型出现频率、各当前子节点对应的内容元素重复度、以及各当前子节点对应的类名重复次数,进行拟合度计算,获得与所述当前父节点对应的拟合度。

[0097] 本实施例在具体实施过程中,所述封装模块具体用于:对各当前父节点对应的拟合度按照由高到低的顺序进行排序,确定位于第一排序位置的当前父节点为目标父节点;确定所述目标父节点对应的各子节点为目标子节点,以将各目标子节点作为目标封装边界。

[0098] 本实施例在具体实施过程中,所述封装模块具体还用于:基于所述目标封装边界,为各所述目标子节点对应的内容元素封装容器,以对所述富文本内容进行容器封装处理。

[0099] 本实施例在具体实施过程中,所述富文本处理装置还包括标记模块,所述标记模块用于:按照预定的标记方式对封装容器进行标记。

[0100] 本实施例中的富文本处理装置,通过获取以元素内容为节点的树形结构,并确定各节点对应的元素内容的元素类型,后续就可以基于各节点的层级关系以及各节点的元素内容和元素类型进行拟合度计算,使得计算结果更加合理、准确,后续就可以基于计算获得的拟合度精准、合理的确定出封装边界,从而实现对富文本合理、准确的进行封装,细化了富文本的颗粒度,打破单维度编辑边界,便于后续对富文本进行修改、调整,大大增强了用户的操作空间,提高了富文本灵活度,同时能够为线上问诊平台、远程会诊系统或其他等医疗系统提供灵活、可靠的富文本编辑服务。

[0101] 本申请另一实施例提供一种存储介质,所述存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如下方法步骤:

[0102] 步骤一、对富文本内容进行结构转换,获得由若干内容元素作为节点的树形结构;

[0103] 步骤二、分别对所述树形结构中各内容元素进行分类,以确定各内容元素对应的元素类型;

[0104] 步骤三、至少基于各内容元素以及各内容元素的元素类型,分别对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,进行拟合度计算,获得与各当前父节点对应的拟合度;

[0105] 步骤四、基于各当前父节点对应的拟合度确定目标封装边界,以基于所述目标封装边界对所述富文本内容进行容器封装处理。

[0106] 上述方法步骤的具体实施过程可参见上述任意富文本处理方法的实施例,本实施例在此不再重复赘述。

[0107] 本实施例中的存储介质,通过获取以元素内容为节点的树形结构,并确定各节点对应的元素内容的元素类型,后续就可以基于各节点的层级关系以及各节点的元素内容和元素类型进行拟合度计算,使得计算结果更加合理、准确,后续就可以基于计算获得的拟合度精准、合理的确定出封装边界,从而实现对富文本合理、准确的进行封装,细化了富文本的颗粒度,便于后续对富文本进行修改、调整,提高了富文本灵活度,同时能够为线上问诊平台、远程会诊系统或其他等医疗系统提供灵活、可靠的富文本编辑服务。

[0108] 本申请另一实施例提供一种电子设备,如图5所示,至少包括存储器1、处理器2,所述存储器1上存储有计算机程序,所述处理器2在执行所述存储器1上的计算机程序时实现如下方法步骤:

[0109] 步骤一、对富文本内容进行结构转换,获得由若干内容元素作为节点的树形结构;

[0110] 步骤二、分别对所述树形结构中各内容元素进行分类,以确定各内容元素对应的元素类型;

[0111] 步骤三、至少基于各内容元素以及各内容元素的元素类型,分别对树形结构中相邻两个节点层级中的当前父节点以及与当前父节点对应的若干当前子节点,进行拟合度计算,获得与各当前父节点对应的拟合度;

[0112] 步骤四、基于各当前父节点对应的拟合度确定目标封装边界,以基于所述目标封装边界对所述富文本内容进行容器封装处理。

[0113] 上述方法步骤的具体实施过程可参见上述任意富文本处理方法的实施例,本实施例在此不再重复赘述。

[0114] 本实施例中的电子设备,通过获取以元素内容为节点的树形结构,并确定各节点对应的元素内容的元素类型,后续就可以基于各节点的层级关系以及各节点的元素内容和元素类型进行拟合度计算,使得计算结果更加合理、准确,后续就可以基于计算获得的拟合度精准、合理的确定出封装边界,从而实现对富文本合理、准确的进行封装,细化了富文本的颗粒度,便于后续对富文本进行修改、调整,提高了富文本灵活度,同时能够为线上问诊平台、远程会诊系统或其他等医疗系统提供灵活、可靠的富文本编辑服务。

[0115] 以上实施例仅为本申请的示例性实施例,不用于限制本申请,本申请的保护范围由权利要求书限定。本领域技术人员可以在本申请的实质和保护范围内,对本申请做出各种修改或等同替换,这种修改或等同替换也应视为落在本申请的保护范围内。< / style>

Claims

1. A method of rich text processing, characterized by, The method comprises the following steps: structure conversion is performed on the rich text content to obtain a tree structure with a plurality of content elements as nodes; each content element in the tree structure is classified to determine the element type corresponding to each content element; based at least on each content element and the element type of each content element, the fitting degree of each current parent node and a plurality of current child nodes corresponding to the current parent node in the adjacent two node levels of the tree structure is calculated respectively to obtain the fitting degree corresponding to each current parent node; a target packaging boundary is determined based on the fitting degree corresponding to each current parent node, so that the container packaging processing is performed on the rich text content based on the target packaging boundary; the calculation of the fitting degree of each current parent node and a plurality of current child nodes corresponding to the current parent node in the adjacent two node levels of the tree structure based at least on each content element and the element type of each content element to obtain the fitting degree corresponding to each current parent node comprises the following steps: based on each content element, the content element repetition degree corresponding to each node in the tree structure is determined respectively; based on the element type of each content element, the type frequency corresponding to each node in the tree structure is determined respectively; for each current parent node and a plurality of current child nodes corresponding to the current parent node in the adjacent two node levels of the tree structure, the fitting degree of the current parent node is calculated based at least on the type frequency corresponding to the current parent node and the content element repetition degree corresponding to each current child node to obtain the fitting degree corresponding to the current parent node.

2. The method of claim 1, wherein, The structure conversion of the rich text content to obtain a tree structure with a plurality of content elements as nodes comprises the following steps: the rich text content in the json structure is identified to obtain a plurality of content elements; based on the hierarchical relationship between each content element, a tree structure with a plurality of content elements as nodes is constructed.

3. The method of claim 1, wherein, The method further comprises the following steps: based on the class name in each content element, the class name repetition times corresponding to each node in the tree structure are determined respectively; the calculation of the fitting degree of each current parent node and a plurality of current child nodes corresponding to the current parent node in the adjacent two node levels of the tree structure based at least on each content element and the element type of each content element to obtain the fitting degree corresponding to each current parent node comprises the following steps: for each current parent node and a plurality of current child nodes corresponding to the current parent node in the adjacent two node levels of the tree structure, the fitting degree of the current parent node is calculated based on the type frequency corresponding to the current parent node, the content element repetition degree corresponding to each current child node, and the class name repetition times corresponding to each current child node to obtain the fitting degree corresponding to the current parent node.

4. The method of claim 1, wherein, The determination of the target packaging boundary based on the fitting degree corresponding to each current parent node comprises the following steps: the fitting degrees corresponding to each current parent node are sorted in descending order, and the current parent node located at the first sorting position is determined as a target parent node; each child node corresponding to the target parent node is determined as a target child node, and each target child node is taken as a target packaging boundary.

5. The method of claim 4, wherein, The container packaging processing performed on the rich text content based on the target packaging boundary comprises the following steps: The method further comprises: marking the encapsulation container according to a predetermined marking manner.

6. The method of claim 1, wherein, The method further comprises:

7. A rich text processing apparatus, characterized by: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises:

8. A storage medium, characterized by The method further comprises:

9. An electronic device, comprising: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises: The method further comprises:

Citation Information

Patent Citations

  • Interface layout file generation method, interface generation method, device and equipment

    CN112015405A