Text classification method, text classification device and computer storage medium

By extracting the style, position and content information in the PPT text file, and generating text feature vectors, the effective grading of PPT text is achieved, the problem of poor grading performance in the existing technology is solved, and the accuracy and effect of text grading is improved. .

CN119474392APending Publication Date: 2025-02-18GUANGZHOU SHIYUAN ELECTRONICS CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310949701.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-28
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

The prior art does not perform well in PPT text grading and cannot effectively utilize multimodal information. In particular, there is a lack of effective methods in the fusion of style, position and content features of text on PPT, resulting in low grading performance.

Method used

A text grading method is proposed. By obtaining the extensible markup language file of the PPT text file, the style information, location information and content information of each piece of text are extracted, and the style position characteristics and text content characteristics are spliced ​​into Text feature vectors, which divide text into different levels through clustering.

Benefits of technology

By integrating the style, position and content characteristics of the text, better text grading performance is achieved, and the primary title, secondary title and text in PPT can be effectively distinguished.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119474392A_ABST
    Figure CN119474392A_ABST
Patent Text Reader

Abstract

The invention provides a text grading method, a text grading device and a computer storage medium. The text grading method comprises the following steps: acquiring an extensible markup language file of a to-be-graded text file; extracting style information, position information and content information of each text in the extensible markup language file; extracting style position features based on the style information and the position information; extracting text content features based on the content information; splicing the style position feature and the text content feature into a text feature vector; and clustering all texts in the to-be-graded text file based on the text feature vector, and dividing the texts of different clusters into different text levels. By means of the text grading method, the style features, the position features and the text content features of the text are fused together to be used for text hierarchy division, and better grading performance can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text analysis, and in particular to a text grading method, a text grading device and a computer storage medium. Background Art

[0002] Existing layout analysis methods mainly involve layout recognition models or text models such as Bert. The layout recognition model is mainly trained based on the image, location information and category information of the document, and the trained model is used for layout analysis of new document images; Bert and other language models are finetuning the pre-trained native Bert model based on the text content, and the trained classification model is used to process the text to be classified.

[0003] The multimodal information considered by the existing technology is relatively limited, and is not targeted at the data on the PPT. The object of text classification on the PPT is each text, and we need to classify it into first-level titles, second-level titles, and text. At the same time, the characteristics of each level of text on the PPT are relatively obvious: the font, font size, and position are quite different. The current technology has not done much work on PPT text classification. It can only achieve text recognition through image recognition, and cannot achieve good text classification performance. Summary of the invention

[0004] In order to solve the above technical problems, the present application proposes a text grading method, a text grading device and a computer storage medium.

[0005] In order to solve the above technical problems, the present application proposes a text grading method, which includes:

[0006] Obtain an extensible markup language file of a text file to be graded;

[0007] Extracting style information, location information and content information of each paragraph of text in the extensible markup language file;

[0008] extracting style position features based on the style information and the position information;

[0009] Extracting text content features based on the content information;

[0010] splicing the style position feature and the text content feature into a text feature vector;

[0011] All texts in the to-be-classified text file are clustered based on the text feature vector, and texts in different clusters are divided into different text levels.

[0012] The extracting of style location features based on the style information and the location information includes:

[0013] Extracting style features based on the style information, wherein the style information includes font, font size, color and / or whether it is bold;

[0014] extracting location features based on the location information;

[0015] The style feature and the position feature are concatenated into the style position feature.

[0016] The step of extracting style features based on the style information includes:

[0017] Based on the font, query the common font style table to obtain the corresponding font number;

[0018] Encoding the font number to obtain a first style feature;

[0019] Based on the color, a common color style table is searched to obtain a corresponding color number;

[0020] Encoding the color number to obtain a second style feature;

[0021] The first style feature and the second style feature are concatenated to obtain the style feature.

[0022] The step of extracting style features based on the style information includes:

[0023] Obtain a quantization interval based on a maximum font size and a minimum font size, and obtain a quantization integer of the font size in the quantization interval;

[0024] Encoding the quantized integer to obtain a third style feature;

[0025] When the text is bold, encoding is performed according to the first preset value to obtain a fourth style feature, or when the text is not bold, encoding is performed according to the second preset value to obtain a fourth style feature;

[0026] The third style feature and the fourth style feature are spliced ​​together to obtain the style feature.

[0027] Wherein, extracting the location feature based on the location information includes:

[0028] Acquire a text horizontal coordinate and a first text vertical coordinate based on the position information;

[0029] Obtaining a first bias value based on the maximum value of the abscissa;

[0030] Add the first offset value to the first text ordinate to obtain a second text ordinate;

[0031] The position feature is obtained by encoding according to the quantized value of the text horizontal coordinate and the quantized value of the second text vertical coordinate.

[0032] The step of encoding according to the quantized value of the horizontal coordinate of the text and the quantized value of the vertical coordinate of the second text to obtain the position feature includes:

[0033] Acquire a first text height coordinate and a first text width coordinate based on the position information;

[0034] Obtaining a second offset value based on the maximum value of the ordinate after adding the first offset value;

[0035] Add the second offset value to the first text width coordinate to obtain a second text width coordinate;

[0036] Obtaining a third offset value based on the maximum value of the width coordinate after adding the second offset value;

[0037] Add the third offset value to the first text height coordinate to obtain a second text height coordinate;

[0038] The position feature is obtained by encoding according to the quantized value of the text horizontal coordinate, the quantized value of the second text vertical coordinate, the quantized value of the second text width coordinate and the quantized value of the second text height coordinate.

[0039] Wherein, extracting text content features based on the content information includes:

[0040] Identify and delete special characters in the content information;

[0041] Split the remaining content information into several lexical units;

[0042] Converting the plurality of vocabulary units into vector representations;

[0043] The text content features are extracted using the vector representations of the plurality of vocabulary units.

[0044] The text levels include: first-level title, second-level title and / or main text.

[0045] In order to solve the above technical problems, the present application also proposes a text grading device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the text grading method as described above.

[0046] In order to solve the above technical problems, the present application also proposes a computer storage medium, wherein the computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the above text grading method.

[0047] Compared with the prior art, the beneficial effects of the present application are as follows: the text grading device obtains an extensible markup language file of a text file to be graded; extracts the style information, position information and content information of each text segment in the extensible markup language file; extracts the style position feature based on the style information and the position information; extracts the text content feature based on the content information; splices the style position feature and the text content feature into a text feature vector; clusters all the texts in the text file to be graded based on the text feature vector, and divides the texts of different clusters into different text levels. Through the above-mentioned text grading method, the style features, position features and text content features of the text are integrated together for the division of the text level, which can obtain better grading performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0049] in:

[0050] Figure 1 It is a flowchart of an embodiment of a text grading method provided by the present application;

[0051] Figure 2 It is a schematic diagram of the overall process of the text grading method provided by this application;

[0052] Figure 3 It is a structural schematic diagram of an embodiment of a text grading device provided by the present application;

[0053] Figure 4 is a structural schematic diagram of another embodiment of the text grading device provided by the present application;

[0054] Figure 5 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION

[0055] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0056] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0057] Please refer to Figure 1 and Figure 2 , Figure 1 is a flow chart of an embodiment of a text grading method provided by the present application. Figure 2 It is a schematic diagram of the overall process of the text grading method provided in this application.

[0058] The text grading method of the present application is applied to a text grading device, wherein the text grading device of the present application can be a server, a text grading device, or a system in which a server and a text grading device cooperate with each other. Accordingly, the various parts included in the text grading device, such as various units, subunits, modules, and submodules, can all be set in the server, can all be set in the text grading device, or can be set in the server and the text grading device respectively.

[0059] Furthermore, the above-mentioned server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, such as software or software modules used to provide distributed servers, or it can be implemented as a single software or software module, which is not specifically limited here.

[0060] like Figure 1 As shown, the specific steps are as follows:

[0061] Step S11: Obtain an extensible markup language file of the text file to be classified.

[0062] In the embodiment of the present application, the text classification device performs text classification on the text in the PPT, and determines which category each text belongs to among the first-level title, the second-level title and the main text. Among them, the PPT courseware is generally composed of xml files (ExtensibleMarkup Language, extensible markup language files), and each page of the PPT courseware corresponds to an xml file.

[0063] Step S12: extracting the style information, location information and content information of each text segment in the extensible markup language file.

[0064] In an embodiment of the present application, the text grading device needs to parse each XML file and remove elements that do not belong to the text category, such as image elements, table elements, format elements, etc. Then, the text grading device extracts the style information, position information, content information and other information of the text elements respectively. Among them, the style information includes but is not limited to: font, font size, color, whether it is bold, etc. The position information includes but is not limited to: text starting position, text ending position, text height, text width, etc. The content information includes but is not limited to: text semantics, text vocabulary, text words, etc.

[0065] Step S13: extracting style position features based on the style information and position information.

[0066] In an embodiment of the present application, the text classification device extracts style features based on the style information and extracts position features based on the position information; then, the style features and the position features are spliced ​​into the style position features.

[0067] Specifically, the text classification device performs style encoding on the style information, wherein the style mainly includes font, font size, color and whether it is bold. These four styles are expressed differently and require different encoding methods. The specific encoding process is as follows:

[0068] (1) Fonts and colors: Fonts and colors are both text representations and can use the same encoding method. The text grading device creates a unified common style table, with different numbers corresponding to different styles; it performs one-hot encoding on different numbers, and finally obtains the one-hot encoding corresponding to each style.

[0069] For example, the text grading device queries a common font style table based on the font of the text to obtain a corresponding font number; encodes the font number to obtain font style features.

[0070] For another example, the text grading device queries a common color style table based on the color to obtain a corresponding color number; encodes the color number to obtain a color style feature.

[0071] (2) Font size: The text grading device takes the maximum font size M and the minimum font size N of all texts, and quantizes all font sizes to [0, 32]. That is, the minimum font size N becomes 0, the maximum font size M becomes 32, and the other font sizes correspond to the nearest integers in proportion. If the font size is x, the quantized value is (xN) / ((MN) / 32). The text grading device performs one-hot encoding on the quantized value of the text font size, and finally obtains the one-hot encoding of each font size.

[0072] (3) Whether it is bold: The text classification device directly uses 1 to indicate bold and 0 to indicate non-bold.

[0073] The text grading device concatenates all the above encoding results in order to obtain a style encoding result, namely, a style feature.

[0074] It should be noted that, in different application scenarios, the text grading device may use one or more of the above-mentioned style information for style encoding, and the possible combinations and methods thereof will not be described in detail here.

[0075] Furthermore, the text classification device encodes the position of the text, wherein the position encoding method is similar to the above-mentioned method of encoding the font size. The difference is that the text position at least includes (x, y), and in another embodiment, the text position may also include four numbers (x, y, w, h).

[0076] During position encoding, the text grading device needs to add biases to distinguish different numbers so that the value ranges of each number do not overlap.

[0077] For example, the range of x is [0, 32), the range of y is [32, 64), the range of w is [64, 96), and the range of h is [96, 128). Therefore, the offset value between the x range and the y range is 32, the offset value between the y range and the w range is 32, and the offset value between the w range and the h range is 32.

[0078] It should be noted that the offset value mentioned in this application is not limited, and it is sufficient to ensure that different digital ranges do not overlap after the offset, and different digital ranges may not be connected.

[0079] Finally, the text classification device concatenates the style code and the position code and inputs them into the MLP model. The MLP model extracts the features of style and position and outputs the style position features of dimension P.

[0080] Step S14: extracting text content features based on the content information.

[0081] In the embodiment of the present application, the text grading device uses the fasttext model to extract text content features. First, the text needs to be preprocessed: such as removing a large number of special characters in the PPT text; secondly, the text is split into vocabulary units, and the vocabulary units are converted into vector representations using the bag-of-words model; finally, the vector is input into the fasttext model to extract text features, and the text content features with a dimension of Q are output.

[0082] Step S15: concatenate the style position feature and the text content feature into a text feature vector.

[0083] In an embodiment of the present application, the text grading device concatenates the above-mentioned mlp model output features and fasttext model output features to obtain a feature vector with a dimension of P+Q, which is a feature vector of a certain text on the PPT, that is, a text feature vector.

[0084] Step S16: clustering all texts in the text file to be classified based on the text feature vector, and dividing texts of different clusters into different text levels.

[0085] In an embodiment of the present application, the text grading device performs the above operation on all texts on all PPTs, obtains vector representations of all texts on all PPTs, clusters these vectors, and the number of clustering targets is three categories, namely, first-level titles, second-level titles, and text, so as to obtain the level corresponding to each paragraph of text on the PPT.

[0086] In an embodiment of the present application, a text grading device obtains an extensible markup language file of a text file to be graded; extracts style information, position information, and content information of each paragraph of text in the extensible markup language file; extracts style position features based on the style information and the position information; extracts text content features based on the content information; splices the style position features and the text content features into a text feature vector; clusters all texts in the text file to be graded based on the text feature vector, and divides texts of different clusters into different text levels. Through the above-mentioned text grading method, the style features, position features, and text content features of the text are integrated together for the division of text levels, which can obtain better grading performance.

[0087] This application creatively encodes various attributes of the text and extracts features for the division of text levels; uses the MLP model to fuse style and position features together, allowing the model to judge which feature is more important for hierarchical classification. This implicit judgment is better than manually setting weights for different attributes; although courseware can also obtain text hierarchical relationships through image recognition, the use of text attribute information can assist the algorithm in achieving better grading performance.

[0088] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0089] In order to implement the above-mentioned text classification method, this application also proposes a text classification device, for details, please refer to Figure 3 , Figure 3 It is a structural schematic diagram of an embodiment of a text grading device provided by the present application.

[0090] The text classification device 300 of this embodiment includes a file acquisition module 31 , an information extraction module 32 , a feature extraction module 33 and a text classification module 34 .

[0091] The file acquisition module 31 is used to acquire the extensible markup language file of the text file to be classified.

[0092] The information extraction module 32 is used to extract the style information, location information and content information of each text segment in the extensible markup language file.

[0093] A feature extraction module 33 is used to extract a style position feature based on the style information and the position information; extract a text content feature based on the content information; and concatenate the style position feature and the text content feature into a text feature vector;

[0094] The text classification module 34 is used to cluster all the texts in the text file to be classified based on the text feature vector, and divide the texts of different clusters into different text levels.

[0095] In order to implement the above-mentioned text classification method, this application also proposes another text classification device, which can be found in detail. Figure 4 , Figure 4 It is a structural schematic diagram of another embodiment of the text grading device provided by the present application.

[0096] The text grading device 400 of this embodiment includes a processor 41 , a memory 42 , an input / output device 43 , and a bus 44 .

[0097] The processor 41 , the memory 42 , and the input / output device 43 are respectively connected to the bus 44 . The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the text classification method described in the above embodiment.

[0098] In the embodiment of the present application, the processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip having the ability to process signals. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 41 may also be any conventional processor, etc.

[0099] This application also provides a computer storage medium, please continue to refer to Figure 5 , Figure 5 It is a structural diagram of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the text grading method of the above embodiment.

[0100] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0101] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A text classification method, characterized in that: The text grading method comprises: Obtain an extensible markup language file of a text file to be graded; Extracting style information, location information and content information of each paragraph of text in the extensible markup language file; extracting a style position feature based on the style information and the position information; Extracting text content features based on the content information; splicing the style position feature and the text content feature into a text feature vector; All texts in the to-be-classified text file are clustered based on the text feature vector, and texts in different clusters are divided into different text levels.

2. The text classification method according to claim 1, characterized in that: The extracting of style position features based on the style information and the position information includes: Extracting style features based on the style information, wherein the style information includes font, font size, color and / or whether it is bold; extracting location features based on the location information; The style feature and the position feature are concatenated into the style position feature.

3. The text classification method according to claim 2, characterized in that: The extracting style features based on the style information includes: Based on the font, query the common font style table to obtain the corresponding font number; Encoding the font number to obtain a first style feature; Based on the color, a common color style table is searched to obtain a corresponding color number; Encoding the color number to obtain a second style feature; The first style feature and the second style feature are concatenated to obtain the style feature.

4. The text classification method according to claim 2 or 3, characterized in that: The extracting style features based on the style information includes: Obtain a quantization interval based on a maximum font size and a minimum font size, and obtain a quantization integer of the font size in the quantization interval; Encoding the quantized integer to obtain a third style feature; When the text is bold, encoding is performed according to the first preset value to obtain a fourth style feature, or when the text is not bold, encoding is performed according to the second preset value to obtain a fourth style feature; The third style feature and the fourth style feature are spliced ​​together to obtain the style feature.

5. The text classification method according to claim 2, characterized in that: The extracting of location features based on the location information includes: Acquire the text horizontal coordinate and the first text vertical coordinate based on the position information; Obtaining a first bias value based on the maximum value of the abscissa; Add the first offset value to the first text ordinate to obtain a second text ordinate; The position feature is obtained by encoding according to the quantized value of the text horizontal coordinate and the quantized value of the second text vertical coordinate.

6. The text classification method according to claim 5, characterized in that: The step of encoding according to the quantized value of the horizontal coordinate of the text and the quantized value of the vertical coordinate of the second text to obtain the position feature includes: Acquire a first text height coordinate and a first text width coordinate based on the position information; Obtaining a second offset value based on the maximum value of the ordinate after adding the first offset value; Add the second offset value to the first text width coordinate to obtain a second text width coordinate; Obtaining a third offset value based on the maximum value of the width coordinate after adding the second offset value; Add the third offset value to the first text height coordinate to obtain a second text height coordinate; The position feature is obtained by encoding according to the quantized value of the text horizontal coordinate, the quantized value of the second text vertical coordinate, the quantized value of the second text width coordinate and the quantized value of the second text height coordinate.

7. The text classification method according to claim 1, characterized in that: The extracting of text content features based on the content information includes: Identify and delete special characters in the content information; Split the remaining content information into several lexical units; Converting the plurality of vocabulary units into vector representations; The text content features are extracted using the vector representations of the plurality of vocabulary units.

8. The text classification method according to claim 1, characterized in that: The text levels include: first-level headings, second-level headings and / or main text.

9. A text grading device, characterized in that: The text grading device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the text grading method according to any one of claims 1 to 8.

10. A computer storage medium, characterized in that: The computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the text grading method according to any one of claims 1 to 8.