Slide processing method and device
By clustering and sorting the first scores of the target text in the slide, the problems of outline hierarchy discontinuity, repetition of the same level and inconsistent number of levels in the prior art are solved, and the continuity and consistency of outline hierarchy are achieved in the existing technology. .
Patent Information
- Application Number
- CN202310934620.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-27
- Publication Date
- 2025-02-07
AI Technical Summary
When predicting the outline level of slides, existing neural networks cannot effectively solve the problems of outline level discontinuity, duplication of hierarchy at the same level, and inconsistent number of different slide levels.
By obtaining the first score corresponding to the target text in the slide, clustering to obtain the cluster category, determining the cluster center and sorting it, and assigning the corresponding outline level to the target text according to the sorting results.
Outline hierarchy is implemented starting from 1 and continuously, ensuring that the same level of outline hierarchy appears in the predicted outline hierarchy, and allowing different slides to predict different numbers of outline hierarchy.
Smart Images

Figure CN119397039A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a slide processing method and device. Background Art
[0002] In the intelligent beautification scenario of slides, an essential task is to use neural networks to predict how many different outline levels the text in each slide corresponds to, and which outline level the text belongs to, so as to facilitate subsequent beautification operations such as intelligently modifying the font and repositioning the text at different outline levels. Figure 1 The slide shown uses a neural network to predict that the text in the slide corresponds to two different outline levels, where a company’s main brand is “XX”…which is the first-level outline, “XX” positioning…is the second-level outline, and “XX” product…is the third-level outline.
[0003] In the related art, since there is no neural network specifically applied to outline level prediction, the search and sorting method is generally used to train the neural network. Among them, the more popular search and sorting methods are Pointwise, Pairwise, and Listwise. For Pointwise, each text in the slide is regarded as a separate training sample, for Pairwise, the importance relationship between two texts in the slide is regarded as a separate training sample, and for Listwise, the arrangement order of all the texts in the slide as a whole is regarded as a separate training sample.
[0004] Using a neural network trained by the search and sort method to predict outline levels cannot solve the following three problems well. Even if it can avoid the occurrence of a problem, the effect is not ideal. Problem 1: How to ensure that the outline level starts from 1 and is continuous, such as 1, 2, 3; Problem 2: How to make the same level of outline levels appear in the predicted outline level, such as 1, 2, 2, 1, 2, 2; Problem 3: How to make different slides predict different numbers of outline levels, such as the outline level of slide 1: 1, 2, 2, 1, 2, and the outline level of slide 2: 1, 2, 3, 1, 2, 3, 4. Summary of the invention
[0005] In order to solve the technical problem that the above-mentioned neural network trained by the search and sorting method to predict the outline level cannot solve the following three problems well, and even if it can avoid the occurrence of a problem, the effect is not ideal, the embodiment of the present invention provides a slide processing method, device, electronic device and storage medium. The specific technical solution is as follows:
[0006] In a first aspect of an embodiment of the present invention, a slide processing method is first provided, the method comprising:
[0007] Obtain a slide to be processed, and determine a first score corresponding to at least one target text in the slide to be processed;
[0008] Clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, where N is a positive integer;
[0009] Determine a first cluster center of each of the first cluster categories, and sort the first cluster centers;
[0010] According to the ranking result of the first cluster centers, the target texts corresponding to the first scores in the N first cluster categories are assigned corresponding first outline levels.
[0011] In an optional implementation, before clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, the method further includes:
[0012] Obtaining the number of scores of the first score corresponding to at least one of the target texts, and determining whether the number of scores is greater than a preset number threshold;
[0013] When the number of scores is greater than the preset number threshold, it is determined that the step of clustering the first score corresponding to at least one target text to obtain N first cluster categories will be performed.
[0014] In an optional embodiment, the method further comprises:
[0015] When the number of scores is not greater than the preset number threshold, at least one of the target texts is assigned the third outline level.
[0016] In an optional implementation, before clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, the method further includes:
[0017] Determine a variance of the first score corresponding to at least one of the target texts, and determine whether the variance is greater than a preset variance threshold;
[0018] In a case where the variance is greater than the preset variance threshold, it is determined that the step of clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories will be performed.
[0019] In an optional embodiment, the method further comprises:
[0020] When the variance is not greater than the preset variance threshold, at least one of the target texts is assigned the fourth outline level.
[0021] In an optional implementation, determining a first score corresponding to at least one target text in the slide to be processed includes:
[0022] Determine at least one target text in the slide to be processed, and obtain at least one text feature of the target text;
[0023] The text features of at least one of the target texts are input into a pre-trained neural network, and a first score corresponding to at least one of the target texts output by the pre-trained neural network is obtained, wherein the size of the first score corresponding to at least one of the target texts represents an outline level to which at least one of the target texts belongs.
[0024] In an optional embodiment, before executing the method, the method further includes:
[0025] Acquire multiple slide sample sets, wherein each slide sample set includes multiple slide samples;
[0026] Determine at least one text sample of a slide sample in each of the slide sample sets, and obtain a text feature sample of at least one of the text samples;
[0027] Inputting the text feature sample of at least one of the text samples into a preset neural network, and obtaining a second score corresponding to at least one of the text samples output by the preset neural network;
[0028] Clustering the second score corresponding to at least one of the text samples to obtain M second cluster categories, where M is a positive integer;
[0029] Determine a second cluster center of each of the second cluster categories, and sort the second cluster centers;
[0030] According to the ranking result of the second cluster centers, assigning corresponding second outline levels to the text samples corresponding to the second scores in the M second cluster categories;
[0031] Determine an outline level error between the marked outline level of at least one of the text samples in the slide sample in each of the slide sample sets and the second outline level;
[0032] determining a comparison error based on the second outline level of at least one of the text samples in the slide samples in each of the slide sample sets;
[0033] The preset neural network is trained according to the outline level error and the comparison error, and when the outline level error and the comparison error meet a preset condition, the network training is stopped to obtain the pre-trained neural network.
[0034] In an optional implementation, determining the comparison error based on the second outline level of at least one text sample of the slide sample in each slide sample set includes:
[0035] Determine the different second outline levels in the slide samples in each of the slide sample sets based on the second outline level of at least one of the text samples in the slide sample set in each of the slide sample sets;
[0036] Inputting different second outline levels in slide samples in each slide sample set and at least one text sample in slide samples in each slide sample set into a supervised contrastive learning loss function to obtain a contrast error;
[0037] Wherein, the supervised contrastive learning loss function includes:
[0038]
[0039] The J is the comparison error, the batch is each slide sample set, the cls is the different second outline levels in the slide samples in each slide sample set, the d is the distance function, the i and j are the subscripts of the text samples at the same second outline level, the k and l are the subscripts of the text samples at different second outline levels, and the si, sj, sk, sl are the text samples corresponding to i, j, k, and l respectively.
[0040] In an optional embodiment, the preset neural network is trained according to the outline level error and the comparison error, and when the outline level error and the comparison error meet a preset condition, the network training is stopped to obtain the pre-trained neural network.
[0041] A weighted operation is performed on the outline level error and the comparison error to obtain a weighted error, the preset neural network is trained according to the weighted error, and the network training is stopped when the weighted error is less than a preset error threshold to obtain the pre-trained neural network.
[0042] In an optional implementation, the number of the text features is multiple;
[0043] The step of inputting the text feature of at least one target text into a pre-trained neural network comprises:
[0044] Performing vectorization processing on the plurality of text features of any of the target texts respectively to obtain a plurality of text vectors of the target text;
[0045] Performing horizontal splicing processing on multiple text vectors of any of the target texts to obtain a text vector group of the target text;
[0046] The text vector groups of at least one of the target texts are vertically spliced to obtain a text vector matrix, and the text vector matrix is input into a pre-trained neural network.
[0047] In an optional implementation, the number of the text feature samples is multiple;
[0048] The step of inputting the text feature sample of at least one of the text samples into a preset neural network comprises:
[0049] Performing vectorization processing on the multiple text feature samples of any of the text samples respectively to obtain multiple text vector samples of the text sample;
[0050] Performing horizontal splicing processing on multiple text vector samples of any of the text samples to obtain a text vector group sample of the text sample;
[0051] The text vector group samples of at least one of the text samples are vertically spliced to obtain text vector matrix samples, and the text vector matrix samples are input into a preset neural network.
[0052] In an optional implementation, the determining at least one target text in the slide to be processed includes:
[0053] Obtain all texts in the slide to be processed, and determine the style types corresponding to all the texts;
[0054] At least one text whose style type is body text is searched from all texts, and the at least one text is determined as a target text.
[0055] In a second aspect of the embodiments of the present invention, a slide processing device is further provided, the device comprising:
[0056] A slide acquisition module is used to acquire slides to be processed;
[0057] A first score determination module, used to determine a first score corresponding to at least one target text in the slide to be processed;
[0058] A first score clustering module, used for clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, where N is a positive integer;
[0059] A first cluster center sorting module, used to determine a first cluster center of each of the first cluster categories and sort the first cluster centers;
[0060] The first outline level assigning module is used to assign a corresponding first outline level to the target text corresponding to the first score in N first cluster categories according to the sorting result of the first cluster centers.
[0061] In an optional embodiment, the device further comprises:
[0062] A score quantity determination module, used to obtain the score quantity of the first score corresponding to at least one of the target texts, and determine whether the score quantity is greater than a preset quantity threshold;
[0063] When the number of scores is greater than the preset number threshold, it is determined that the step of clustering the first score corresponding to at least one target text to obtain N first cluster categories will be performed.
[0064] In an optional embodiment, the device further comprises:
[0065] The same outline level assigning module is used to assign the third outline level to all at least one of the target texts when the number of scores is not greater than the preset number threshold.
[0066] In an optional embodiment, the device further comprises:
[0067] A variance judgment module, used to determine the variance of the first score corresponding to at least one of the target texts, and to judge whether the variance is greater than a preset variance threshold;
[0068] In a case where the variance is greater than the preset variance threshold, it is determined that the step of clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories will be performed.
[0069] In an optional embodiment, the device further comprises:
[0070] The same outline level assigning module is used to assign the fourth outline level to all at least one of the target texts when the variance is not greater than the preset variance threshold.
[0071] In an optional implementation, the first score determination module includes:
[0072] A text feature acquisition module, used to determine at least one target text in the slide to be processed, and acquire at least one text feature of the target text;
[0073] A first score acquisition module is used to input the text features of at least one of the target texts into a pre-trained neural network, and obtain a first score corresponding to at least one of the target texts output by the pre-trained neural network, wherein the size of the first score corresponding to at least one of the target texts represents an outline level to which at least one of the target texts belongs.
[0074] In an optional embodiment, the device further comprises:
[0075] A sample set acquisition module, used to acquire a plurality of slide sample sets, wherein each of the slide sample sets includes a plurality of slide samples;
[0076] A text feature sample acquisition module, used to determine at least one text sample of a slide sample in each slide sample set, and acquire a text feature sample of at least one of the text samples;
[0077] A second score acquisition module, used for inputting the text feature sample of at least one of the text samples into a preset neural network, and acquiring a second score corresponding to at least one of the text samples output by the preset neural network;
[0078] A second score clustering module, used for clustering the second score corresponding to at least one of the text samples to obtain M second cluster categories, where M is a positive integer;
[0079] A second cluster center sorting module, used for determining the second cluster center of each of the second cluster categories and sorting the second cluster centers;
[0080] A second outline level assigning module, configured to assign corresponding second outline levels to the text samples corresponding to the second scores in the M second cluster categories according to the ranking result of the second cluster centers;
[0081] A level error determination module, used to determine an outline level error between the marked outline level of at least one of the text samples of the slide samples in each of the slide sample sets and the second outline level;
[0082] A comparison error determination module, configured to determine a comparison error based on the second outline level of at least one of the text samples in the slide sample in each of the slide sample sets;
[0083] The network training module is used to train the preset neural network according to the outline level error and the comparison error, and stop the network training when the outline level error and the comparison error meet the preset conditions to obtain the pre-trained neural network.
[0084] In an optional implementation, the comparison error determination module is specifically used to:
[0085] Determine the different second outline levels in the slide samples in each of the slide sample sets based on the second outline level of at least one of the text samples in the slide sample set in each of the slide sample sets;
[0086] Inputting different second outline levels in slide samples in each slide sample set and at least one text sample in slide samples in each slide sample set into a supervised contrastive learning loss function to obtain a contrast error;
[0087] Wherein, the supervised contrastive learning loss function includes:
[0088]
[0089] The J is the comparison error, the batch is each slide sample set, the cls is the different second outline levels in the slide samples in each slide sample set, the d is the distance function, the i and j are the subscripts of the text samples at the same second outline level, the k and l are the subscripts of the text samples at different second outline levels, and the si, sj, sk, sl are the text samples corresponding to i, j, k, and l respectively.
[0090] In an optional implementation, the network training module is specifically used to:
[0091] A weighted operation is performed on the outline level error and the comparison error to obtain a weighted error, the preset neural network is trained according to the weighted error, and the network training is stopped when the weighted error is less than a preset error threshold to obtain the pre-trained neural network.
[0092] In an optional implementation, the number of the text features is multiple;
[0093] The first score acquisition module is specifically used for:
[0094] Performing vectorization processing on the plurality of text features of any of the target texts respectively to obtain a plurality of text vectors of the target text;
[0095] Performing horizontal splicing processing on multiple text vectors of any of the target texts to obtain a text vector group of the target text;
[0096] The text vector groups of at least one of the target texts are vertically spliced to obtain a text vector matrix, and the text vector matrix is input into a pre-trained neural network.
[0097] In an optional implementation, the number of the text feature samples is multiple;
[0098] The second score acquisition module is specifically used for:
[0099] Performing vectorization processing on the multiple text feature samples of any of the text samples respectively to obtain multiple text vector samples of the text sample;
[0100] Performing horizontal splicing processing on multiple text vector samples of any of the text samples to obtain a text vector group sample of the text sample;
[0101] The text vector group samples of at least one of the text samples are vertically spliced to obtain text vector matrix samples, and the text vector matrix samples are input into a preset neural network.
[0102] In an optional implementation, the text feature acquisition module is specifically used to:
[0103] Obtain all texts in the slide to be processed, and determine the style types corresponding to all the texts;
[0104] At least one text whose style type is body text is searched from all texts, and the at least one text is determined as a target text.
[0105] In a third aspect of an embodiment of the present invention, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0106] Memory, used to store computer programs;
[0107] The processor is used to implement any slide processing method described in the first aspect when executing the program stored in the memory.
[0108] In a fourth aspect of the embodiments of the present invention, a storage medium is provided, wherein instructions are stored in the storage medium, and when the instructions are executed on a computer, the computer executes any slide processing method described in the first aspect.
[0109] In a fifth aspect of the embodiments of the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned slide processing methods.
[0110] The technical solution provided by the embodiment of the present invention obtains a slide to be processed, and determines a first score corresponding to at least one target text in the slide to be processed; clusters the first score corresponding to at least one target text to obtain N first cluster categories, where N is a positive integer; determines the first cluster center of each first cluster category, and sorts the first cluster centers; and assigns a corresponding first outline level to the target text corresponding to the first score in the N first cluster categories according to the sorting result of the first cluster centers. By determining the first score corresponding to at least one target text in the slide to be processed, clustering the first score to obtain N first cluster categories, sorting the first cluster centers of each first cluster category, and assigning a corresponding first outline level to the target text corresponding to the first score in the N first cluster categories according to the sorting result, it can be ensured that the outline level starts from 1 and is continuous, the same level of outline levels can appear in the predicted outline level, and different numbers of outline levels can be predicted for different slides. BRIEF DESCRIPTION OF THE DRAWINGS
[0111] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0112] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0113] Figure 1 A schematic diagram of the outline level to which text in a slide belongs shown in an embodiment of the present invention;
[0114] Figure 2 It is a schematic diagram of an implementation flow of a slide processing method shown in an embodiment of the present invention;
[0115] Figure 3 It is a schematic diagram of an implementation flow of another slide processing method shown in an embodiment of the present invention;
[0116] Figure 4 It is a schematic diagram of an implementation flow of another slide processing method shown in an embodiment of the present invention;
[0117] Figure 5 A schematic diagram of an implementation flow of a neural network training method shown in an embodiment of the present invention;
[0118] Figure 6 is a schematic structural diagram of a slide processing device shown in an embodiment of the present invention;
[0119] Figure 7 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present invention. DETAILED DESCRIPTION
[0120] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0121] like Figure 2 FIG. 1 is a schematic diagram of an implementation flow of a slide processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:
[0122] S201, obtaining a slide to be processed, and determining a first score corresponding to at least one target text in the slide to be processed.
[0123] In an embodiment of the present invention, in the intelligent beautification scenario of slides, an essential task is to use a neural network to predict how many different outline levels the text in the slide corresponds to, and to which outline level the text belongs, so as to facilitate subsequent beautification operations such as intelligently modifying the font and rearranging the position of the text at different outline levels.
[0124] Based on this, the slides to be processed are obtained. Here, the slides to be processed need to predict how many different outline levels at least one target text in the slides to be processed corresponds to, and to which outline level at least one target text belongs, so as to facilitate subsequent beautification operations such as intelligently modifying the font and rearranging the position of at least one target text at different outline levels.
[0125] In order to predict how many different outline levels at least one target text in the slide to be processed corresponds to, and to which outline level at least one target text belongs, for the slide to be processed, it is necessary to determine a first score corresponding to at least one target text in the slide to be processed. It should be noted that the first score can be between 0 and 1.
[0126] For example, for the slide to be processed, there are 5 target texts, which are represented by x1, x2, x3, x4, and x5 respectively. The first score (Score) corresponding to each of the above 5 target texts in the slide to be processed is determined, as shown in Table 1 below.
[0127] Target text First score x1 Score1 x2 Score2 x3 Score3 x4 Score4 x5 Score5
[0128] Table 1
[0129] S202: Clustering the first score corresponding to at least one target text to obtain N first cluster categories, where N is a positive integer.
[0130] In an embodiment of the present invention, for the first score corresponding to at least one target text in the slide to be processed, the first score corresponding to the at least one target text can be clustered to obtain N first clustering categories, where N is a positive integer, and N here represents the number of different outline levels corresponding to at least one target text in the slide to be processed.
[0131] It should be noted that the first scores corresponding to at least one target text can be clustered by a corresponding clustering algorithm, such as the MeanShift method, to obtain N first cluster categories. The clustering algorithm does not need to specify the number of clusters, and it will determine how many categories to cluster the first scores according to the specific distribution of the first scores.
[0132] In addition, after clustering the first scores, the number of different outline levels can be known. According to the correspondence between the target text and the first score, it can be known which first cluster category the target text belongs to, as well as the cluster center of each first cluster category, and target texts belonging to the same first cluster category belong to the same outline level.
[0133] For example, the MeanShift method is used to cluster the first scores corresponding to at least one target text, and three first cluster categories are obtained, from which it can be known that at least one target text in the slide to be processed corresponds to three different outline levels. Among them, the MeanShift method does not need to specify the number of clusters, and it will determine how many categories to cluster the first scores according to the specific distribution of the first scores.
[0134] S203: Determine the first cluster center of each first cluster category, and sort the first cluster centers.
[0135] In the embodiment of the present invention, for N first cluster categories, the first cluster center of each first cluster category may be determined, and the first cluster centers may be sorted, wherein the sorting may be performed in an order from small to large or from large to small.
[0136] S204: assigning a corresponding first outline level to the target texts corresponding to the first scores in the N first cluster categories according to the ranking result of the first cluster centers.
[0137] In the embodiment of the present invention, for the sorting result of the first cluster center, the target text corresponding to the first score in the N first cluster categories can be assigned a corresponding first outline level according to the sorting result of the first cluster center. The first outline level here can be, for example, Figure 1 The first-level outline, second-level outline, etc. shown, the outline level refers to the outline of a corresponding level.
[0138] It should be noted that, assuming that the first cluster centers are sorted in descending order, the higher the value of the first cluster center, the higher the ranking of the first cluster center, and the higher the outline level of the corresponding target text of the cluster category belonging to the first cluster center, which means that the outline level of the target text is positively correlated with the value of the first cluster center of the cluster category.
[0139] For example, the first cluster centers A1, B2, and C3 are sorted in descending order. Assuming the sorting order is C3, A1, and B2, according to this sorting order, the target text corresponding to the first score in the first cluster category C is assigned a corresponding level 1 outline, the target text corresponding to the first score in the first cluster category A is assigned a corresponding level 2 outline, and the target text corresponding to the first score in the first cluster category B is assigned a corresponding level 3 outline.
[0140] Through the above description of the technical solution provided by the embodiment of the present invention, a slide to be processed is obtained, and a first score corresponding to at least one target text in the slide to be processed is determined; the first score corresponding to the at least one target text is clustered to obtain N first cluster categories, where N is a positive integer; the first cluster center of each first cluster category is determined, and the first cluster centers are sorted; according to the sorting result of the first cluster centers, the target text corresponding to the first score in the N first cluster categories is assigned a corresponding first outline level.
[0141] By determining the first score corresponding to at least one target text in the slide to be processed, clustering the first scores to obtain N first cluster categories, sorting the first cluster centers of each first cluster category, and assigning the corresponding first outline level to the target text corresponding to the first score in the N first cluster categories according to the sorting result, it can be ensured that the outline level starts from 1 and is continuous, the outline levels of the same level can appear in the predicted outline level, and different numbers of outline levels can be predicted for different slides.
[0142] like Figure 3 FIG. 1 is a schematic diagram of an implementation flow of another slide processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:
[0143] S301, obtaining a slide to be processed, determining at least one target text in the slide to be processed, and obtaining text features of the at least one target text.
[0144] In an embodiment of the present invention, a slide to be processed is obtained, and at least one target text in the slide to be processed needs to be determined. For example, five target texts in the slide to be processed are determined, such as {x1, x2, x3, x4, x5}.
[0145] In addition, for at least one target text in the slide to be processed, it is necessary to obtain text features of at least one target text, wherein the text features include position, font size and / or text length, etc., which are not limited in the embodiment of the present invention.
[0146] In addition, for the slides to be processed, which include multiple texts, it is not necessary to predict the outline level to which all the texts belong, but only to predict the outline level to which some specific texts belong.
[0147] Based on this, all the texts in the slide to be processed are obtained, and the style types corresponding to all the texts are determined. At least one text with a style type of body text is found from all the texts, and at least one text is determined as the target text, which means predicting the outline level to which the text with a style type of body text belongs.
[0148] S302: Input text features of at least one target text into a pre-trained neural network, and obtain a first score corresponding to the at least one target text output by the pre-trained neural network.
[0149] In an embodiment of the present invention, the text features of at least one target text are input into a pre-trained neural network, and a first score corresponding to at least one target text output by the pre-trained neural network is obtained. The pre-trained neural network is a neural network trained by the listwise method, and the text features of at least one target text are arranged in the range of 0 to 1 in the form of a first score after being trained by the listwise method. The size of the first score corresponding to at least one target text represents the outline level to which the at least one target text belongs.
[0150] The number of text features is generally multiple, such as position, font size and / or text length, so that multiple text features of any target text can be vectorized separately to obtain multiple text vectors of the target text. Multiple text vectors of any target text are spliced horizontally to obtain a text vector group of the target text; the text vector group of at least one target text is spliced vertically to obtain a text vector matrix corresponding to at least one target text in the slide to be processed, and the text vector matrix is input into the pre-trained neural network to obtain a first score corresponding to at least one target text in the slide to be processed.
[0151] It should be noted that vectorization processing uses feature tools, such as hashing, embedding, log, etc., which can convert text features into vector form and concatenate all features horizontally. For example, the text vector group of x1 is {feat_1, feat_2, feat_3, ..., feat_n}, and the text vector groups of x1, x2, x3, x4, and x5 are concatenated vertically and then input into a neural network trained by the listwise method (such as an MMOE network).
[0152] S303, obtaining the number of scores of the first score corresponding to at least one target text, and determining whether the number of scores is greater than a preset number threshold.
[0153] S304: When the number of scores is not greater than a preset number threshold, assign the third outline level to all of the at least one target text.
[0154] In an embodiment of the present invention, the number of scores of the first score corresponding to at least one target text is obtained, and it is determined whether the number of scores is greater than a preset number threshold. When the number of scores is not greater than the preset number threshold, it is considered that at least one target text in the slide to be processed belongs to the same outline level, and the slide to be processed also has only one outline level, so the at least one target text is assigned the third outline level.
[0155] For example, obtain the number of scores of the first score corresponding to at least one target text, and determine whether the number of scores is greater than 1. If the number of scores is not greater than 1, it is considered that at least one target text in the slide to be processed belongs to the same outline level, and the slide to be processed also has only one outline level. Therefore, at least one target text is all assigned the third outline level, that is, all are assigned the first-level outline.
[0156] S305: When the number of scores is greater than a preset number threshold, cluster the first score corresponding to at least one target text to obtain N first cluster categories, where N is a positive integer.
[0157] In an embodiment of the present invention, when the number of scores is greater than a preset number threshold, the first score corresponding to at least one target text can be clustered using, for example, the MeanShift method to obtain N first cluster categories, where N is a positive integer.
[0158] S306: Determine the first cluster center of each first cluster category, and sort the first cluster centers.
[0159] In the embodiment of the present invention, this step is similar to the above step S203, and the embodiment of the present invention will not be described in detail here.
[0160] S307: assigning a corresponding first outline level to the target texts corresponding to the first scores in the N first cluster categories according to the ranking result of the first cluster centers.
[0161] In the embodiment of the present invention, this step is similar to the above-mentioned step S204, and the embodiment of the present invention will not be described in detail here.
[0162] By determining the text features of at least one target text in a slide to be processed, the text features of the at least one target text are processed using a pre-trained neural network to obtain a first score corresponding to the at least one target text. When the number of scores of the first score is not greater than a preset number threshold, the at least one target text is assigned a third outline level. When the number of scores of the first score is greater than the preset number threshold, the first score is clustered to obtain N first cluster categories, the first cluster centers of each first cluster category are sorted, and the target text corresponding to the first score in the N first cluster categories is assigned a corresponding first outline level according to the sorting result. In this way, it can be ensured that the outline level starts from 1 and is continuous, the same level of outline levels can appear in the predicted outline level, and different numbers of outline levels can be predicted for different slides.
[0163] like Figure 4 FIG. 1 is a schematic diagram of an implementation flow of another slide processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:
[0164] S401, obtaining a slide to be processed, determining at least one target text in the slide to be processed, and obtaining text features of the at least one target text.
[0165] In the embodiment of the present invention, this step is similar to the above step S301, and the embodiment of the present invention will not be described in detail here.
[0166] S402: Input text features of at least one target text into a pre-trained neural network, and obtain a first score corresponding to the at least one target text output by the pre-trained neural network.
[0167] In the embodiment of the present invention, this step is similar to the above step S302, and the embodiment of the present invention will not be described in detail here.
[0168] S403: Determine the variance of the first score corresponding to at least one target text, and determine whether the variance is greater than a preset variance threshold.
[0169] S404: When the variance is not greater than a preset variance threshold, assign the fourth outline level to all of the at least one target text.
[0170] In an embodiment of the present invention, the variance of the first score corresponding to at least one target text is determined, and it is determined whether the variance is greater than a preset variance threshold. When the variance is not greater than the preset variance threshold, it is considered that at least one target text in the slide to be processed belongs to the same outline level, and the slide to be processed also has only one outline level. Therefore, at least one target text is all assigned the fourth outline level, for example, all are assigned the first-level outline.
[0171] It should be noted that, for the variance of the first score corresponding to at least one target text, when the variance is not greater than the preset variance threshold, it means that the variance is very small, and the first score corresponding to at least one target text is not much different. At this time, it is considered that at least one target text in the slide to be processed belongs to the same outline level, and the slide to be processed also has only one outline level.
[0172] S405: When the variance is greater than a preset variance threshold, cluster the first score corresponding to at least one target text to obtain N first cluster categories, where N is a positive integer.
[0173] In an embodiment of the present invention, when the variance is greater than a preset variance threshold, the first score corresponding to at least one target text can be clustered using, for example, the MeanShift method to obtain N first cluster categories, where N is a positive integer.
[0174] S406: Determine the first cluster center of each first cluster category, and sort the first cluster centers.
[0175] In the embodiment of the present invention, this step is similar to the above step S203, and the embodiment of the present invention will not be described in detail here.
[0176] S407: assigning a corresponding first outline level to the target texts corresponding to the first scores in the N first cluster categories according to the ranking result of the first cluster centers.
[0177] In the embodiment of the present invention, this step is similar to the above-mentioned step S204, and the embodiment of the present invention will not be described in detail here.
[0178] By determining the text features of at least one target text in a slide to be processed, the text features of at least one target text are processed using a pre-trained neural network to obtain a first score corresponding to the at least one target text, and when the variance of the first score is not greater than a preset variance threshold, all of the at least one target text is assigned the fourth outline level, and when the variance of the first score is greater than the preset variance threshold, the first score is clustered to obtain N first cluster categories, and the first cluster centers of each first cluster category are sorted, and according to the sorting result, the target text corresponding to the first score in the N first cluster categories is assigned the corresponding first outline level, so that it can be ensured that the outline level starts from 1 and is continuous, the outline levels of the same level can appear in the predicted outline level, and different numbers of outline levels can be predicted for different slides.
[0179] In addition, it should be noted that the ideal premise for clustering methods to work is that scores of the same category are close to each other on the axis, and scores of different categories are far away from each other on the axis. In the experiment, it was found that due to the natural defects of the loss function APPROX-NDCG used by the listwise method, most of the predicted scores are in the following three situations: evenly distributed on the axis, tightly clustered around 0, or clustered around 1. Such score results can easily cause the clustering method to fail, resulting in MeanShift either predicting each score as category 1 or predicting all scores as the same category.
[0180] Based on this, in order to achieve better clustering effect, the most critical step is added in the embodiment of the present invention: supervised contrastive learning. The main idea of supervised contrastive learning is to construct the loss function in a supervised way, so that samples of the same class are closer in the feature space, and the distance between sample classes is farther. Such learning results perfectly match the ideal premise of clustering we need.
[0181] When supervised contrastive learning loss is added to the loss function, the scores of the same class are close to each other on the axis, and the scores of different classes are as far away from each other as possible on the axis. Under such score distribution, the clustering effect will be effectively indicated.
[0182] Based on this, Figure 5 FIG. 1 is a schematic diagram of an implementation flow of a neural network training method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:
[0183] S501, obtaining a plurality of slide sample sets, wherein each slide sample set includes a plurality of slide samples.
[0184] In the embodiment of the present invention, multiple slide sample sets may be obtained, wherein each slide sample set includes multiple slide samples, and each slide sample set may be referred to as a batch slide sample.
[0185] S502: Determine at least one text sample of a slide sample in each slide sample set, and obtain a text feature sample of the at least one text sample.
[0186] In the embodiment of the present invention, for each slide sample set, at least one text sample of (each) slide sample in each slide sample set is determined, and a text feature sample of at least one text sample of (each) slide sample in each slide sample set is obtained.
[0187] It should be noted that the text feature sample may be, for example, the position, font size, text length, etc. mentioned above, which is not limited in the embodiment of the present invention.
[0188] S503: Input a text feature sample of at least one text sample into a preset neural network, and obtain a second score corresponding to the at least one text sample output by the preset neural network.
[0189] In an embodiment of the present invention, a text feature sample of at least one text sample of (each) slide sample in each slide sample set is input into a preset neural network, and a second score corresponding to at least one text sample of (each) slide sample in each slide sample set output by the preset neural network is obtained.
[0190] Among them, for the text feature samples, there are usually multiple samples, such as the position, font size, text length, etc. mentioned above, and thus the multiple text feature samples of any text sample of (each) slide sample in each slide sample set are respectively vectorized to obtain multiple text vector samples of any text sample of (each) slide sample in each slide sample set. The multiple text vector samples of any text sample of (each) slide sample in each slide sample set are horizontally spliced to obtain a text vector group sample of any text sample of (each) slide sample in each slide sample set, and the text vector group samples of any text sample of (each) slide sample in each slide sample set are vertically spliced to obtain a text vector matrix sample corresponding to at least one text sample in (each) slide sample in each slide sample set, and the text vector matrix sample is input into a preset neural network to obtain a second score corresponding to at least one text sample of (each) slide sample in each slide sample set.
[0191] S504: Cluster the second score corresponding to the at least one text sample to obtain M second cluster categories, where M is a positive integer.
[0192] In the embodiment of the present invention, the second score corresponding to at least one text sample of (each) slide sample in each slide sample set is clustered to obtain M second cluster categories, where M is a positive integer.
[0193] For example, the MeanShift method is used to cluster the second scores corresponding to at least one text sample of (each) slide sample in each slide sample set to obtain M second cluster categories, where M is a positive integer.
[0194] S505: Determine the second cluster center of each second cluster category, and sort the second cluster centers.
[0195] In the embodiment of the present invention, for the M second cluster categories obtained by clustering the second scores corresponding to at least one text sample of (each) slide sample in each slide sample set, the second cluster center of each second cluster category can be determined, and the second cluster centers can be sorted. The sorting can be performed in an order from small to large or from large to small.
[0196] S506: assign corresponding second outline levels to text samples corresponding to the second scores in the M second cluster categories according to the ranking result of the second cluster centers.
[0197] In an embodiment of the present invention, M second cluster categories are obtained by clustering the second score corresponding to at least one text sample of (each) slide sample in each slide sample set, and after sorting the respective second cluster centers in the M second cluster categories, the corresponding second outline levels can be assigned to the text samples corresponding to the second scores in the M second cluster categories according to the sorting results.
[0198] S507: Determine an outline level error between the marked outline level of at least one text sample of the slide sample in each slide sample set and the second outline level.
[0199] In an embodiment of the present invention, the outline level error between the annotated outline level and the second outline level of at least one text sample of (each) slide sample in each slide sample set can be determined by the original loss function of the listwise method. Here, at least one text sample of (each) slide sample in each slide sample set is pre-annotated with a label of the actual outline level.
[0200] S508: Determine a comparison error based on the second outline level of at least one text sample of the slide sample in each slide sample set.
[0201] In an embodiment of the present invention, a supervised contrastive learning loss is constructed based on InfoNCE. Through this supervised contrastive learning loss, the contrast error is determined based on the second outline level of at least one text sample of (each) slide sample in each slide sample set.
[0202] Specifically, based on the second outline level of at least one text sample of the slide sample in each slide sample set, determining different second outline levels in the slide samples in each slide sample set;
[0203] Inputting different second outline levels in slide samples in each slide sample set and at least one text sample of the slide sample in each slide sample set into a supervised contrastive learning loss function to obtain a contrastive error;
[0204] Among them, supervised contrastive learning loss functions include:
[0205]
[0206] J is the comparison error, batch is each slide sample set, cls is the different second outline levels in each slide sample (each slide) in each slide sample set, d is the distance function, i, j are the subscripts of text samples at the same second outline level, k, l are the subscripts of text samples at different second outline levels, si, sj, sk, sl are the text samples corresponding to i, j, k, l respectively.
[0207] It should be noted that the distance function here can be Manhattan distance, or Euclidean distance or cosine distance. For the calculation of the distance function, the text samples involved, such as si, sj, sk, sl, etc., need to be vectorized first, so that the distance function can be used to calculate the distance between si and sj, and the distance between sk and sl, which means that the distance function actually calculates the distance between two vectors.
[0208] In addition, for the vectorization processing of si, sj, sk, and sl, reference can be made to the existing vectorization processing process. Taking si as an example, the processing of the other sj, sk, and sl is similar. The layout features of si (the length and width of the slide, the starting position, length and width, and relative position of the text box in the slide, etc.) and the semantic features of si (text content) can be obtained, the layout features are bucketed, the semantic features are hashed, or processed using the Tinybert model, the processing result of the layout features is processed by the first embedding layer to obtain the first embedding vector, and the processing result of the semantic features is processed by the second embedding layer to obtain the second embedding vector, and the first embedding vector and the second embedding vector are spliced, which is considered to be the vector obtained after the si vector processing, and the embodiment of the present invention is not limited to this.
[0209] For the above supervised contrastive learning loss function, in the numerator, for each second outline level, the sum of the distances between the second scores of any two text samples belonging to this second outline level is calculated. In the denominator, for each second outline level, the sum of the distances between the second score corresponding to any text sample belonging to this second outline level and the second score corresponding to any text sample belonging to other second outline levels is calculated. At the same time, a numerator is added on this basis, one is to avoid the occurrence of the denominator dividing by 0, and the other is to make this part between (0, 1), and have a larger gradient after taking log (imagine that when x is greater than 0, the gradient of log(x) will gradually decrease or even approach 0, which is not conducive to network learning and back propagation). Minimizing J, that is, minimizing the numerator while maximizing the denominator, means minimizing the distance between the scores of the same outline level and maximizing the distance between the scores of this outline level and the scores of other outline levels.
[0210] S509, training a preset neural network according to the outline level error and the comparison error, and stopping the network training when the outline level error and the comparison error meet preset conditions to obtain a pre-trained neural network.
[0211] In an embodiment of the present invention, a preset neural network can be trained according to the outline level error and the contrast error, and when the outline level error and the contrast error meet preset conditions, the network training is stopped to obtain a pre-trained neural network.
[0212] Among them, for the outline level error and the contrast error, the outline level error and the contrast error can be weighted to obtain a weighted error, so as to train the preset neural network according to the weighted error of the two errors, and stop the network training when the weighted error is less than the preset error threshold, so as to obtain a pre-trained neural network
[0213] Through the above description of the technical solution provided by the embodiment of the present invention, on the basis of the original loss function of the listwise method, after adding the supervised contrastive learning loss, the scores of the same category are close to each other on the numerical axis, and the scores of different categories are as far away from each other as possible on the numerical axis. Under such score distribution conditions, the performance of the clustering effect will be very effectively prompted.
[0214] Corresponding to the above method embodiment, the embodiment of the present invention also provides a slide processing device, such as Figure 6 As shown, the device may include: a slide acquisition module 610 , a first score determination module 620 , a first score clustering module 630 , a first cluster center sorting module 640 , and a first outline level assignment module 650 .
[0215] The slide acquisition module 610 is used to acquire the slides to be processed;
[0216] A first score determination module 620, configured to determine a first score corresponding to at least one target text in the slide to be processed;
[0217] A first score clustering module 630 is used to cluster the first score corresponding to at least one of the target texts to obtain N first cluster categories, where N is a positive integer;
[0218] A first cluster center sorting module 640, configured to determine a first cluster center of each of the first cluster categories and sort the first cluster centers;
[0219] The first outline level assigning module 650 is used to assign a corresponding first outline level to the target text corresponding to the first score in the N first cluster categories according to the ranking result of the first cluster centers.
[0220] In an optional embodiment, the device further comprises:
[0221] A score quantity determination module, used to obtain the score quantity of the first score corresponding to at least one of the target texts, and determine whether the score quantity is greater than a preset quantity threshold;
[0222] When the number of scores is greater than the preset number threshold, it is determined that the step of clustering the first score corresponding to at least one target text to obtain N first cluster categories will be performed.
[0223] In an optional embodiment, the device further comprises:
[0224] The same outline level assigning module is used to assign the third outline level to all at least one of the target texts when the number of scores is not greater than the preset number threshold.
[0225] In an optional embodiment, the device further comprises:
[0226] A variance judgment module, used to determine the variance of the first score corresponding to at least one of the target texts, and to judge whether the variance is greater than a preset variance threshold;
[0227] In a case where the variance is greater than the preset variance threshold, it is determined that the step of clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories will be performed.
[0228] In an optional embodiment, the device further comprises:
[0229] The same outline level assigning module is used to assign the fourth outline level to all at least one of the target texts when the variance is not greater than the preset variance threshold.
[0230] In an optional implementation, the first score determination module includes:
[0231] A text feature acquisition module, used to determine at least one target text in the slide to be processed, and acquire at least one text feature of the target text;
[0232] A first score acquisition module is used to input the text features of at least one of the target texts into a pre-trained neural network, and obtain a first score corresponding to at least one of the target texts output by the pre-trained neural network, wherein the size of the first score corresponding to at least one of the target texts represents an outline level to which at least one of the target texts belongs.
[0233] In an optional embodiment, the device further comprises:
[0234] A sample set acquisition module, used to acquire a plurality of slide sample sets, wherein each of the slide sample sets includes a plurality of slide samples;
[0235] A text feature sample acquisition module, used to determine at least one text sample of a slide sample in each slide sample set, and acquire a text feature sample of at least one of the text samples;
[0236] A second score acquisition module, used for inputting the text feature sample of at least one of the text samples into a preset neural network, and acquiring a second score corresponding to at least one of the text samples output by the preset neural network;
[0237] A second score clustering module, used for clustering the second score corresponding to at least one of the text samples to obtain M second cluster categories, where M is a positive integer;
[0238] A second cluster center sorting module, used for determining the second cluster center of each of the second cluster categories and sorting the second cluster centers;
[0239] A second outline level assigning module, configured to assign corresponding second outline levels to the text samples corresponding to the second scores in the M second cluster categories according to the ranking result of the second cluster centers;
[0240] A level error determination module, used to determine an outline level error between the marked outline level of at least one of the text samples of the slide samples in each of the slide sample sets and the second outline level;
[0241] A comparison error determination module, configured to determine a comparison error based on the second outline level of at least one of the text samples in the slide sample in each of the slide sample sets;
[0242] The network training module is used to train the preset neural network according to the outline level error and the comparison error, and stop the network training when the outline level error and the comparison error meet the preset conditions to obtain the pre-trained neural network.
[0243] In an optional implementation, the comparison error determination module is specifically used to:
[0244] Determine the different second outline levels in the slide samples in each of the slide sample sets based on the second outline level of at least one of the text samples in the slide sample set in each of the slide sample sets;
[0245] Inputting different second outline levels in slide samples in each slide sample set and at least one text sample in slide samples in each slide sample set into a supervised contrastive learning loss function to obtain a contrast error;
[0246] Wherein, the supervised contrastive learning loss function includes:
[0247]
[0248] The J is the comparison error, the batch is each slide sample set, the cls is the different second outline levels in the slide samples in each slide sample set, the d is the distance function, the i and j are the subscripts of the text samples at the same second outline level, the k and l are the subscripts of the text samples at different second outline levels, and the si, sj, sk, sl are the text samples corresponding to i, j, k, and l respectively.
[0249] In an optional implementation, the network training module is specifically used to:
[0250] A weighted operation is performed on the outline level error and the comparison error to obtain a weighted error, the preset neural network is trained according to the weighted error, and the network training is stopped when the weighted error is less than a preset error threshold to obtain the pre-trained neural network.
[0251] In an optional implementation, the number of the text features is multiple;
[0252] The first score acquisition module is specifically used for:
[0253] Performing vectorization processing on the plurality of text features of any of the target texts respectively to obtain a plurality of text vectors of the target text;
[0254] Performing horizontal splicing processing on multiple text vectors of any of the target texts to obtain a text vector group of the target text;
[0255] The text vector groups of at least one of the target texts are vertically spliced to obtain a text vector matrix, and the text vector matrix is input into a pre-trained neural network.
[0256] In an optional implementation, the number of the text feature samples is multiple;
[0257] The second score acquisition module is specifically used for:
[0258] Performing vectorization processing on the multiple text feature samples of any of the text samples respectively to obtain multiple text vector samples of the text sample;
[0259] Performing horizontal splicing processing on multiple text vector samples of any of the text samples to obtain a text vector group sample of the text sample;
[0260] The text vector group samples of at least one of the text samples are vertically spliced to obtain text vector matrix samples, and the text vector matrix samples are input into a preset neural network.
[0261] In an optional implementation, the text feature acquisition module is specifically used to:
[0262] Obtain all texts in the slide to be processed, and determine the style types corresponding to all the texts;
[0263] At least one text whose style type is body text is searched from all texts, and the at least one text is determined as a target text.
[0264] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 71, a communication interface 72, a memory 73 and a communication bus 74, wherein the processor 71, the communication interface 72, and the memory 73 communicate with each other through the communication bus 74.
[0265] A memory 73, for storing computer programs;
[0266] The processor 71 is used to execute the program stored in the memory 73 to implement the following steps:
[0267] Obtain slides to be processed, and determine a first score corresponding to at least one target text in the slides to be processed; cluster the first score corresponding to at least one target text to obtain N first cluster categories, where N is a positive integer; determine a first cluster center of each of the first cluster categories, and sort the first cluster centers; and assign a corresponding first outline level to the target text corresponding to the first score in the N first cluster categories according to the sorting result of the first cluster centers.
[0268] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0269] The communication interface is used for communication between the above electronic device and other devices.
[0270] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0271] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0272] In another embodiment of the present invention, a storage medium is provided. The storage medium stores instructions. When the instructions are executed on a computer, the computer executes the slide processing method described in any one of the above embodiments.
[0273] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the slide processing method described in any one of the above embodiments.
[0274] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a storage medium, or transmitted from one storage medium to another storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0275] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0276] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0277] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A slide processing method, characterized in that: The method comprises: Obtain a slide to be processed, and determine a first score corresponding to at least one target text in the slide to be processed; Clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, where N is a positive integer; Determine a first cluster center of each of the first cluster categories, and sort the first cluster centers; According to the ranking result of the first cluster centers, the target texts corresponding to the first scores in the N first cluster categories are assigned corresponding first outline levels.
2. The method according to claim 1, characterized in that Before clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, the method further includes: Obtaining the number of scores of the first score corresponding to at least one of the target texts, and determining whether the number of scores is greater than a preset number threshold; In the case where the number of scores is greater than the preset number threshold, determining to perform the step of clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories; When the number of scores is not greater than the preset number threshold, at least one of the target texts is assigned the third outline level.
3. The method according to claim 1, characterized in that Before clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, the method further includes: Determine a variance of the first score corresponding to at least one of the target texts, and determine whether the variance is greater than a preset variance threshold; In the case where the variance is greater than the preset variance threshold, determining to perform the step of clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories; When the variance is not greater than the preset variance threshold, at least one of the target texts is assigned the fourth outline level.
4. The method according to claim 1, characterized in that: The determining a first score corresponding to at least one target text in the slide to be processed includes: Determine at least one target text in the slide to be processed, and obtain at least one text feature of the target text; The text features of at least one of the target texts are input into a pre-trained neural network, and a first score corresponding to at least one of the target texts output by the pre-trained neural network is obtained, wherein the size of the first score corresponding to at least one of the target texts represents an outline level to which at least one of the target texts belongs.
5. The method according to claim 4, characterized in that Before executing the method, the method further includes: Acquire multiple slide sample sets, wherein each slide sample set includes multiple slide samples; Determine at least one text sample of a slide sample in each of the slide sample sets, and obtain a text feature sample of at least one of the text samples; Inputting the text feature sample of at least one of the text samples into a preset neural network, and obtaining a second score corresponding to at least one of the text samples output by the preset neural network; Clustering the second score corresponding to at least one of the text samples to obtain M second cluster categories, where M is a positive integer; Determine a second cluster center of each of the second cluster categories, and sort the second cluster centers; According to the ranking result of the second cluster centers, assigning corresponding second outline levels to the text samples corresponding to the second scores in the M second cluster categories; Determine an outline level error between the marked outline level of at least one of the text samples in the slide sample in each of the slide sample sets and the second outline level; determining a comparison error based on the second outline level of at least one of the text samples in the slide samples in each of the slide sample sets; The preset neural network is trained according to the outline level error and the comparison error, and when the outline level error and the comparison error meet a preset condition, the network training is stopped to obtain the pre-trained neural network.
6. The method according to claim 5, characterized in that The step of training the preset neural network according to the outline level error and the comparison error, and stopping the network training when the outline level error and the comparison error meet a preset condition to obtain the pre-trained neural network includes: A weighted operation is performed on the outline level error and the comparison error to obtain a weighted error, the preset neural network is trained according to the weighted error, and the network training is stopped when the weighted error is less than a preset error threshold to obtain the pre-trained neural network.
7. The method according to claim 4, characterized in that The number of the text features is multiple; The step of inputting the text feature of at least one target text into a pre-trained neural network comprises: Performing vectorization processing on the plurality of text features of any of the target texts respectively to obtain a plurality of text vectors of the target text; Performing horizontal splicing processing on multiple text vectors of any of the target texts to obtain a text vector group of the target text; The text vector groups of at least one of the target texts are vertically spliced to obtain a text vector matrix, and the text vector matrix is input into a pre-trained neural network.
8. The method according to claim 5, characterized in that The number of the text feature samples is multiple; The step of inputting the text feature sample of at least one of the text samples into a preset neural network comprises: Performing vectorization processing on the multiple text feature samples of any of the text samples respectively to obtain multiple text vector samples of the text sample; Performing horizontal splicing processing on multiple text vector samples of any of the text samples to obtain a text vector group sample of the text sample; The text vector group samples of at least one of the text samples are vertically spliced to obtain text vector matrix samples, and the text vector matrix samples are input into a preset neural network.
9. The method according to claim 4, characterized in that The step of determining at least one target text in the slide to be processed includes: Obtain all texts in the slide to be processed, and determine the style types corresponding to all the texts; At least one text whose style type is body text is searched from all texts, and the at least one text is determined as a target text.
10. A slide processing device, characterized in that: The device comprises: A slide acquisition module is used to acquire slides to be processed; A first score determination module, used to determine a first score corresponding to at least one target text in the slide to be processed; A first score clustering module, used for clustering the first score corresponding to at least one of the target texts to obtain N first cluster categories, where N is a positive integer; A first cluster center sorting module, used to determine a first cluster center of each of the first cluster categories and sort the first cluster centers; The first outline level assigning module is used to assign a corresponding first outline level to the target text corresponding to the first score in N first cluster categories according to the sorting result of the first cluster centers.