A structured text classification method and device, electronic equipment and storage medium
By inserting identifiers and segment names into structured text and using BERT-like models for word segmentation and encoding/decoding, the problem of insufficient accuracy and fine granularity in existing structured text classification technologies is solved, achieving more efficient text structure recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CORP LTD
- Filing Date
- 2023-06-13
- Publication Date
- 2026-05-19
AI Technical Summary
Existing structured text classification technologies perform poorly when dealing with complex and long texts, and are unable to classify different structures of a single text in detail, resulting in insufficient accuracy.
By inserting identifiers and segment names into structured text, a BERT-like model is used for word segmentation and encoding, and the index position is combined for decoding to obtain the classification results of each segment.
It improves the granularity of structured text classification, enhances classification accuracy, and can more meticulously identify different structures in the text, making it suitable for classification tasks of complex and long texts.
Smart Images

Figure CN116795839B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text data processing technology, and in particular to a structured text classification method, apparatus, electronic device, and storage medium. Background Technology
[0002] Text classification, as one of the most common data classification tasks, has a wide range of applications and various input formats. Structured text is one such input format, which involves dividing the entire text into different paragraphs and classifying them based on the paragraphs themselves and their structural information. The text structure information varies depending on the scenario. For example, in the scenario of reviewing project proposals, the structured text information consists of templated segmentation requirements, including paragraph names and their start and end indexes in the original text. The task in this scenario requires reviewing the content of different segments to determine whether the content meets the standards, thereby improving the quality of approved projects and optimizing funding allocation. The text information for reviewing proposal content is typically lengthy and structurally complex. Current technologies mainly employ rule-based prior template matching and deep learning techniques based on text concatenation.
[0003] Existing rule-based prior template matching technologies have proposed designing different classification rules based on the structural information (categories) of different paragraphs, and classifying them according to keywords and content in text paragraphs. Although they can classify different structures in a single text in detail, they rely too much on prior knowledge and business experience, making them difficult to maintain and with low accuracy.
[0004] Existing deep learning techniques based on text concatenation propose concatenating keywords and structural information from a text paragraph, inputting them into a machine learning / deep learning model for prediction and classification results. Compared to rule-based methods, this reduces maintenance difficulty and significantly improves accuracy. However, since the information contained in keywords is significantly less contextual than in the full text, there is still room for improvement in classification accuracy, and it cannot perform detailed classification of different structures within a single article.
[0005] The relevant technologies have at least the following problems: they perform poorly in classifying long texts with complex structures, and they lack fine-grained classification of structured texts in a single scenario, making it impossible to classify different structures of a single text at the same time. Summary of the Invention
[0006] This invention aims to at least partially address one of the technical problems in related technologies. To this end, this invention proposes a structured text classification method, apparatus, electronic device, and storage medium that can improve the fine-grainedness of structured text classification.
[0007] On one hand, embodiments of the present invention provide a structured text classification method, including:
[0008] Retrieve structured text; where the structured text includes multiple segments, as well as the segment name and segment index of each segment;
[0009] Based on the segment index, insert identifiers and segment names before and after each segment to obtain the text to be processed;
[0010] The text to be processed is segmented and converted into words to obtain a target one-dimensional vector, and the index position of the identifier word is determined.
[0011] Encode the one-dimensional target vector to obtain a two-dimensional target vector;
[0012] Based on the index position, the target two-dimensional vector is decoded to obtain the classification results of each segment.
[0013] Optionally, obtain structured text, including:
[0014] Retrieve business text organized based on a preset structure;
[0015] The business text includes multiple segments, each segment being organized according to a preset structure;
[0016] Based on the preset structure, obtain the segment name and segment index of each segment.
[0017] Optionally, the identifiers include a start identifier and an end identifier. Based on the segment index, identifiers and segment names are inserted before and after each segment, including:
[0018] Based on the segment index, determine the start and end positions of each segment;
[0019] Insert a start identifier and segment name at the beginning position, and insert an end identifier and segment name at the end position.
[0020] Optionally, the text to be processed is segmented and converted to obtain a target one-dimensional vector, and the index position of the identifier word is determined, including:
[0021] The text to be processed is split into multiple sub-words that exist in the vocabulary to obtain a sub-word list of the first length;
[0022] The vocabulary includes multiple non-repeating sub-words, each corresponding to a unique identifier; the sub-words in the vocabulary include identifier words.
[0023] Locate the identifier in the sub-word list and determine the index position of the identifier;
[0024] Based on the unique identifier corresponding to each subword in the vocabulary, the subword list is transformed into a target one-dimensional vector of the first length.
[0025] Optionally, after determining the index position of the identifier, the method further includes:
[0026] The identifier words in the sub-word list are cleaned up, and the sub-word list is preprocessed to obtain a sub-word list with a unified encoding format.
[0027] Optionally, the one-dimensional target vector is encoded to obtain a two-dimensional target vector, including:
[0028] Using the encoding module, word embedding and multi-layer encoding are performed on the target one-dimensional vector to obtain the target two-dimensional vector.
[0029] The encoding module includes a word embedding layer for word embedding processing and a multi-layer encoding layer for multi-layer encoding processing; the second dimension is determined by the length of the target one-dimensional vector and the dimension of the multi-layer encoding layer.
[0030] Optionally, based on the index position, the target two-dimensional vector is decoded to obtain the classification results for each segment, including:
[0031] Based on the index position, the target two-dimensional vector is pooled to extract multiple one-dimensional feature tensors corresponding to each segment;
[0032] The multiple one-dimensional feature tensors corresponding to each segment are mapped by a fully connected layer and processed by a normalized exponent to obtain the probability of multiple classification categories corresponding to each segment. The classification category corresponding to the maximum probability among the multiple classification categories is selected as the classification result of each segment.
[0033] On the other hand, embodiments of the present invention provide a structured text classification device, comprising:
[0034] The first module is used to obtain structured text; the structured text includes multiple segments and the segment name and segment index of each segment;
[0035] The second module is used to insert identifier words and segment names before and after each segment according to the segment index to obtain the text to be processed;
[0036] The third module is used to perform word segmentation and transformation on the text to be processed, obtain the target one-dimensional vector, and determine the index position of the identifier word;
[0037] The fourth module is used to encode the one-dimensional vector of the target to obtain a two-dimensional vector of the target.
[0038] The fifth module is used to decode the target two-dimensional vector based on the index position to obtain the classification results of each segment.
[0039] Optionally, the first module is specifically used for:
[0040] Retrieve business text organized based on a preset structure;
[0041] The business text includes multiple segments, each segment being organized according to a preset structure;
[0042] Based on the preset structure, obtain the segment name and segment index of each segment.
[0043] Optionally, the identifier includes a start identifier and an end identifier, and the second module is specifically used for:
[0044] Based on the segment index, determine the start and end positions of each segment;
[0045] Insert a start identifier and segment name at the beginning position, and insert an end identifier and segment name at the end position.
[0046] Optionally, the third module is specifically used for:
[0047] The text to be processed is split into multiple sub-words that exist in the vocabulary to obtain a sub-word list of the first length;
[0048] The vocabulary includes multiple non-repeating sub-words, each corresponding to a unique identifier; the sub-words in the vocabulary include identifier words.
[0049] Locate the identifier in the sub-word list and determine the index position of the identifier;
[0050] Based on the unique identifier corresponding to each subword in the vocabulary, the subword list is transformed into a target one-dimensional vector of the first length.
[0051] Optionally, the system also includes:
[0052] The sixth module is used to clean up the identifier words in the sub-word list and preprocess the sub-word list to obtain a sub-word list with a unified encoding format.
[0053] Optionally, the fourth module is specifically used for:
[0054] Using the encoding module, word embedding and multi-layer encoding are performed on the target one-dimensional vector to obtain the target two-dimensional vector.
[0055] The encoding module includes a word embedding layer for word embedding processing and a multi-layer encoding layer for multi-layer encoding processing; the second dimension is determined by the length of the target one-dimensional vector and the dimension of the multi-layer encoding layer.
[0056] Optionally, the fifth module is specifically used for:
[0057] Based on the index position, the target two-dimensional vector is pooled to extract multiple one-dimensional feature tensors corresponding to each segment;
[0058] The multiple one-dimensional feature tensors corresponding to each segment are mapped by a fully connected layer and processed by a normalized exponent to obtain the probability of multiple classification categories corresponding to each segment. The classification category corresponding to the maximum probability among the multiple classification categories is selected as the classification result of each segment.
[0059] On the other hand, embodiments of the present invention provide an electronic device, including: a processor and a memory; the memory is used to store a program; the processor executes the program to implement the above-described structured text classification method.
[0060] On the other hand, embodiments of the present invention provide a computer storage medium storing a processor-executable program, which, when executed by a processor, is used to implement the above-described structured text classification method.
[0061] This invention first obtains structured text, which includes multiple segments and segment names and indices. Based on the segment indices, identifier words and segment names are inserted before and after each segment to obtain the text to be processed. This invention introduces the positional features of the segment structure within the entire text by adding identifier words before and after the segment structure, and further introduces the differences between the structured information of each segment by inserting corresponding segment names before and after the segment structure. The text to be processed is then segmented to obtain a target one-dimensional vector, and the index positions of the identifier words are determined. The target one-dimensional vector is encoded to obtain a target two-dimensional vector. Based on the index positions, the target two-dimensional vector is decoded to obtain the classification results for each segment. This invention improves the fine-grainedness of classification by obtaining the classification results for each segment structure based on the index positions of the identifier words. Attached Figure Description
[0062] The accompanying drawings are provided to further understand the technical solutions of the present invention and constitute a part of the specification. They are used together with the embodiments of the present invention to explain the technical solutions of the present invention, and do not constitute a limitation on the technical solutions of the present invention.
[0063] Figure 1 This is a schematic diagram of an implementation environment for structured text classification provided in an embodiment of the present invention;
[0064] Figure 2 This is a flowchart illustrating a structured text classification method provided in an embodiment of the present invention;
[0065] Figure 3 This is a schematic diagram of the word segmentation and conversion process provided in an embodiment of the present invention;
[0066] Figure 4 This is a schematic diagram of the decoding and conversion process provided in an embodiment of the present invention;
[0067] Figure 5 A schematic diagram illustrating the architecture and pre-training method of the BERT series models provided in this embodiment of the invention;
[0068] Figure 6 This is a schematic diagram illustrating the framework and process principles of the related technologies used in BERT according to embodiments of the present invention;
[0069] Figure 7 A schematic diagram illustrating the architecture of the structured text classification method provided in this embodiment of the invention;
[0070] Figure 8 This is a schematic diagram of a structured text classification device provided in an embodiment of the present invention;
[0071] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention;
[0072] Figure 10 A computer system architecture block diagram suitable for implementing electronic devices according to embodiments of the present invention is provided. Detailed Implementation
[0073] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0074] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100," "second / S200," etc., in the specification, claims, and the aforementioned figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0075] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0076] It is understood that the structured text classification method provided in this embodiment of the invention can be applied to any computer device with data processing and computing capabilities, and this computer device can be various terminals or servers. When the computer device in the embodiment is a server, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal can be a smartphone, tablet computer, laptop computer, or desktop computer, but it is not limited to these.
[0077] like Figure 1 The diagram shown is a schematic representation of an implementation environment provided by an embodiment of the invention. (Refer to...) Figure 1 The implementation environment includes at least one terminal 102 and a server 101. The terminal 102 and the server 101 can be connected via a network, either wirelessly or via a wired connection, to complete data transmission and exchange.
[0078] Server 101 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0079] Additionally, server 101 can also be a node server in a blockchain network. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms.
[0080] Terminal 102 can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited to these. Terminal 102 and server 101 can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose any limitations.
[0081] Exemplary based on Figure 1 The implementation environment shown in this embodiment of the invention provides a structured text classification method. The following description uses the application of this structured text classification method in server 101 as an example. It can be understood that this structured text classification method can also be applied in terminal 102.
[0082] Reference Figure 2 , Figure 2 This is a flowchart illustrating a structured text classification method applied to a server, provided in an embodiment of the present invention. The executing entity of this structured text classification method can be any of the aforementioned computer devices. (Refer to...) Figure 2 The method includes the following steps:
[0083] S100, Obtain structured text;
[0084] It should be noted that structured text includes multiple segments, as well as segment names and segment indexes for each segment;
[0085] In some embodiments, step S100 may include: obtaining business text organized based on a preset structure; wherein the business text includes multiple segments, each segment being organized according to the preset structure; and obtaining the segment name and segment index of each segment based on the preset structure.
[0086] In some specific embodiments, the structured text comprises: 1. the original text (i.e., the business text); 2. the names of each structure in the original text (i.e., the segment names, such as project introduction or implementation plan); and 3. the start and end indexes of the corresponding segments in the original text (i.e., the segment indexes). The input text to be classified is obtained from the target object. The input text includes structured text composed of multiple paragraphs and the structured information of each paragraph. Here, structured text refers to business text composed of multiple defined structures, and structured information refers to the names of the structures that match the structured text and appear within it, as well as the start and end indexes of the corresponding structures.
[0087] S200. Based on the segment index, insert identifiers and segment names before and after each segment to obtain the text to be processed;
[0088] It should be noted that in some embodiments, the identifier includes a start identifier and an end identifier. Step S200 may include: determining the start position and end position of each segment according to the segment index; inserting the start identifier and segment name at the start position, and inserting the end identifier and segment name at the end position.
[0089] In some specific embodiments, the positional features of the segment structure within the full text can be introduced by inserting special words (i.e., identifiers) before and after each segment. Based on the start and end indices of the segment structure in the original text, the special words <<start>> and <<end>> are inserted at the corresponding start and end positions to introduce the positional features of the segments. Furthermore, the differences in segment structures are introduced by inserting the names of the corresponding structures (i.e., segment names). Following the insertion of special words, the names of the corresponding segment structures are inserted at the corresponding start and end positions based on the start and end indices of the segment structure obtained in the second step, thus introducing the differences between different segment structures and preventing model confusion.
[0090] S300. Perform word segmentation on the text to be processed to obtain a target one-dimensional vector and determine the index position of the identifier word.
[0091] It should be noted that in some embodiments, such as Figure 3 As shown, step S300 may include: S301, splitting the text to be processed into multiple sub-words existing in the vocabulary to obtain a sub-word list of first length; wherein, the vocabulary includes multiple non-repeating sub-words, each sub-word corresponding to a unique identifier; the sub-words in the vocabulary include identifier words; S302, locating the identifier words in the sub-word list and determining the index position of the identifier words; S303, converting the sub-word list into a target one-dimensional vector of first length according to the unique identifier corresponding to each sub-word in the vocabulary.
[0092] In some embodiments, after determining the index position of the identifier, the method may further include the steps of cleaning up the identifiers in the subword list and preprocessing the subword list to obtain a subword list with a uniform encoding format.
[0093] In some specific embodiments, word segmentation and transformation processing can be performed using a word segmenter with added special words. Taking the implementation method corresponding to the specific embodiment of step S200 as an example, the text after processing with inserted identifier words and segment names is split. After splitting, the index positions of all <<start>> (or <<end>>) special words are located, and the word segmenter is used to transform the split sub-word list of length N into a one-dimensional vector of length N. The word segmenter here refers to the word segmenter commonly used in BERT-type models, whose basic components include:
[0094] a) Text preprocessing and cleaning algorithms: including encoding format unification, special word removal, etc.;
[0095] b) Thesaurus: This usually refers to a dictionary containing multiple unique sub-words in the form of "sub-word-ID";
[0096] c) Word segmentation algorithm: This algorithm first splits the text into multiple sub-words that exist in a pre-defined vocabulary. In BERT-like models, different segmentation models use different word segmentation algorithms, but each sub-word in the final sub-word list must exist in the vocabulary. Next, the sub-word list is traversed, and based on the ID (unique identifier) of each sub-word in the vocabulary, the sub-word list is converted into an ID list, which is also converted into a one-dimensional vector, realizing the transformation from text to mathematical representation.
[0097] It should be noted that since special words already exist in the vocabulary, inserting them before word segmentation avoids splitting them into subwords and prevents the original input text index from being biased due to word segmentation, thus affecting the accuracy of the insertion position. The segment name insertion is done before word segmentation because the segment structure names are not pre-added to the BERT word segmenter's vocabulary. Adding them after segmentation would cause an error, preventing the retrieval of the corresponding ID from the vocabulary. The reason for not adding the segment structure names (i.e., segment names) to the vocabulary is that each new subword requires expanding the dimension of the BERT model's embedding layer, increasing the overhead of learning the new subword's embedding features and affecting the model's fine-tuning performance on downstream tasks. Although the model can fully learn the new subword's embedding features with a large amount of data, this is not suitable for the scenario of this solution. Therefore, to ensure the stability of the model performance when the number of segment structure names is uncertain, this embodiment of the invention generally only adds the fixed special words <<start>> and <<end>> to the vocabulary.
[0098] S400. Encode the one-dimensional target vector to obtain a two-dimensional target vector;
[0099] It should be noted that, in some embodiments, step S400 may include: using an encoding module to perform word embedding processing and multi-layer encoding processing on the target one-dimensional vector to obtain a target two-dimensional vector with a second dimension; wherein, the encoding module includes a word embedding layer for word embedding processing and a multi-layer encoding layer for multi-layer encoding processing; the second dimension is determined by the length of the target one-dimensional vector and the dimension of the multi-layer encoding layer.
[0100] In some specific embodiments, the target one-dimensional vector can be passed through an embedding layer and multiple encoder layers to obtain a two-dimensional vector of dimension N*M, where N is the length of the target one-dimensional vector and M is the dimension of the encoder layer.
[0101] S500: Based on the index position, decode the target two-dimensional vector to obtain the classification results of each segment.
[0102] It should be noted that in some embodiments, such as Figure 4 As shown, step S500 may include: S501, performing pooling processing on the target two-dimensional vector according to the index position, and extracting multiple one-dimensional feature tensors corresponding to each segment; S502, performing fully connected layer mapping and normalization exponent processing on the multiple one-dimensional feature tensors corresponding to each segment to obtain multiple classification category probabilities corresponding to each segment, and selecting the classification category corresponding to the maximum probability among the multiple classification category probabilities as the classification result of each segment.
[0103] In some specific embodiments, taking the N*M two-dimensional vector obtained in step S400 as an example, based on the index positions of the identifier words obtained in the aforementioned steps, the vector at the index position is extracted from the first dimension of the N*M two-dimensional vector (dim = 0, dim represents the index of the two-dimensional vector in the M-dimensional dimension), resulting in a one-dimensional vector of length M with the same number of indices. Each vector is then processed by a fully connected layer and softmax (normalized exponential function) to obtain the probabilities of k classification categories. The category with the highest probability is taken as the classification result, corresponding to the classification result of the segment. Here, k represents the preset number of classification categories.
[0104] It should be noted that the encoding and decoding processes in this embodiment of the invention can be implemented using a text classification model obtained from a pre-trained language model. The text classification model includes an encoding module (including word embedding layers and multiple encoding layers) and a decoding module (including fully connected layers and a normalized exponential function). Furthermore, the pre-training of the decoding and classification functions can be achieved by training the model with structured text containing classification result labels. Specifically, the model training process can be implemented using K-fold cross-validation. Taking cross-validation with four equal parts of training data as an example, the text classification model can be trained in the following way:
[0105] 1) Divide the training data into four equal parts, which are called the first, second, third and fourth datasets.
[0106] 2) Take the first, second, third, and fourth datasets as test data, and the rest as training data, and repeat the following operation:
[0107] The text classification model is trained on the training dataset in multiple rounds with a predetermined number of rounds. For each training round:
[0108] a) Obtain a specified number of training data from the training dataset, input the specified number of training data and the corresponding classification label information into the classification model, and update the model parameters of the classification model through the gradient descent algorithm.
[0109] b) After a single training round, input each data point in the test dataset and its corresponding classification label information into the classification model to obtain the error value between the model prediction result and the actual label. Average the errors of all test data to obtain the average error of the classification model trained in this round on the test dataset. If the average error in this round is the minimum value in the current multi-round training, discard the saved classification model parameters and save the model parameters of the classification model in this round.
[0110] 3) After completing four rounds of training, the model parameters of the four classification models are the final training results. In actual classification scenarios, the same input data is input into the four classification models respectively to obtain four prediction results. The four results are averaged to obtain the final classification prediction result.
[0111] It should be understood that the loss function used to calculate the loss in the training step includes, but is not limited to, the cross-entropy loss function and Dice Loss; the gradient descent algorithm used in the training step can be, but is not limited to, AdamWSGD and Momentum; the pre-trained language model can be, but is not limited to, BERT, DeBERTa, RoBERTa and ALBERT; the model training parameters are not explicitly specified and can be adjusted according to the specific scenario.
[0112] To explain in detail the principle of the technical solution of the present invention, the overall process of the present invention will be described below with reference to some specific embodiments. It is easy to understand that the following is an explanation of the technical principle of the present invention and should not be regarded as a limitation of the present invention.
[0113] Take, for example, the application scenario of training BERT series pre-trained natural language processing models based on the transformer architecture to learn the complex relationship between text and target categories.
[0114] First, it should be noted that, as Figure 5As shown, the BERT series models consist of a tokenizer, a single-layer embedding layer, multiple encoder layers, and a decoder defined according to the downstream task. The model consists of a layer (decoding layer). Assuming the input is a single text string (batch_size = 1), the tokenizer, based on a pre-defined sub-vocabulary, splits the text string into a list of multiple sub-words. Each sub-word is then converted to a unique input_id, resulting in an array of seq_len IDs. This array is input to the embedding layer as a tensor of shape (seq_len * 1). The embedding layer functions similarly to a dictionary, storing the word features of each word in the model. After receiving the tensor input of (seq_len * 1), the word features of each ID are concatenated in the input order to obtain a tensor of shape (seq_len * hidden_dim). Here, hidden_dim is the word feature dimension, which is also the dimension of the model's encoding layer. After the encoding layer receives the output of the word embedding layer, it further extracts and models features through the transformer module and fully connected layers within the layer. Finally, the feature outputs from multiple encoding layers are superimposed to obtain an N * hidden_dim tensor, which is then passed to the decoder layer defined according to the downstream task to obtain the corresponding output.
[0115] Thanks to the core attention mechanism within the transformer structure, the BERT model can learn the global association between each word and its context. Through mask language modeling (MLM), it is pre-trained on a large-scale corpus, which helps the model learn enough prior word-sentence relationships and grammatical knowledge in advance, greatly enhancing the convergence speed and modeling effect of fine-tuning the model on downstream tasks.
[0116] like Figure 6 As shown, when using BERT for structured text classification tasks, the approach typically considers incorporating structured information and obtaining structured output, building upon general text classification tasks. This involves optimization at the word segmentation and decoding stages. In the word segmentation stage, the text itself and the structured information (name) are segmented separately, and then the delimiters in the vocabulary (such as [SEP] / ) are further segmented. <sep> / <s>The input to the model is obtained by concatenating the two inputs. For the decoding stage, pooling is usually performed first, followed by classification using a fully connected layer. Pooling is usually performed using the first tensor at dim=0 of the output tensor of the encoding layer (seq_len*hidden_dim), also known as cls pooling, or by averaging all tensors at dim=0, also known as mean pooling, to obtain a pooling vector of (1*hidden_dim). Then, a fully connected layer of (hidden_dim, target_num) is used for classification, and after softmax processing, an output of (1*target_num) is obtained, where target_num is the number of classes, and the output is the probability of each class. The class with the highest probability is the predicted class.
[0117] but Figure 6 The proposed solution has the following drawbacks: Insufficient utilization of structured information. In the word segmentation stage, the article itself is directly concatenated with structured information (name) before word segmentation and then passed to the BERT model for prediction. While this introduces structured information to some extent, it fails to incorporate the positional information of the corresponding segments within the article. This results in the model's inability to accurately extract the correlation between the input and the expected output, affecting classification accuracy. Insufficient classification granularity. The output of the encoding layer is directly pooled to obtain a single pooled tensor, which is then used with a fully connected layer to obtain a single classification result. This decoding method can only perform classification at the full-text level and cannot perform more detailed classification of different segment structures within the article, resulting in insufficient classification granularity and failing to provide sufficient reference value for business scenarios.
[0118] Therefore, this invention, based on deep learning methods, optimizes the text preprocessing and model decoding stages, making reasonable use of structured information to improve both classification accuracy and fine-grainedness. The following detailed description of the invention's solution is provided in conjunction with specific data processing scenarios:
[0119] like Figure 7 As shown, the method flow of this embodiment of the invention can be implemented through a preprocessing module, a model encoding module, and a model decoding module, and can be applied in combination with the model training and prediction process.
[0120] First, obtain the input structured text. The input structured text consists of:
[0121] 1. Original text;
[0122] 2. Names of various structures in the original text (e.g., project introduction, implementation plan);
[0123] 3. The start and end indexes of the corresponding segments in the original text.
[0124] The following steps can be achieved through the preprocessing and tokenization modules:
[0125] 1. Based on the index (input 3), embed two special words, <<start>> and <<end>>, before and after different segments of the original text (input 1) to introduce the positional information of the segment structure, enhance the model training effect, and improve the model classification accuracy;
[0126] 2. Based on the index (input 3), embed the names of the corresponding structured information (e.g., category) before and after different segments of the original text (input 1) (input 2) to introduce structured information, enhance the model training effect, and improve the model classification accuracy;
[0127] 3. Use a word segmenter with two special words to split the text. After splitting, locate the index positions of all <<start>> (or <<end>>) special words, and convert the word list of split length seq_len into a one-dimensional vector of length seq_len as the input to the subsequent model. The model includes a model encoding module and a model decoding module.
[0128] The steps can be achieved through the model encoding module (BERT encoder): use the BERT series model (a pre-trained language model based on the transformer architecture that includes word embedding layers and multiple encoding layers) to encode and extract features from the output of the preprocessing module, and obtain a feature tensor of shape seq_len*hidden_dim, where hidden_dim is the dimension of the model encoding layer.
[0129] The following steps can be achieved through the model decoding module (customized decoder):
[0130] 1. Pooling based on index: After obtaining the feature tensors extracted by the model's encoding layer, from the dimension where dim=0, that is, from the dimension of the input sequence length seq_len, according to the index of the special words <<start>> (or <<end>>) after word segmentation obtained by the preprocessing module (step 3) in the sequence, extract multiple one-dimensional feature tensors of length hidden_dim at the corresponding positions, corresponding to multiple encoding results to be classified, thereby improving the fine-grained effect;
[0131] 2. Classification using fully connected layers: Based on the multiple one-dimensional feature tensors of length hidden_dim obtained in step 1, a fully connected layer is used to perform an affine transformation from hidden_dim to n, resulting in multiple one-dimensional output tensors of length n, where n represents the number of all classes. The one-dimensional output tensors are then processed using SoftMax. Each value in the resulting one-dimensional tensor of length n corresponds to the predicted probability of the n classes. During the prediction phase, the class corresponding to the value with the highest probability is taken as the predicted output class (Argmax processing).
[0132] The model training process can be achieved through the following steps:
[0133] The training data, consisting of multiple (structured text inputs + labels), is divided into K equal parts. One part is used in turn to verify the model's performance, while the other K-1 parts are used for model training. This process yields K models with the best verification performance. This helps avoid overfitting caused by training the model on all data and ensures accurate predictions in real-world scenarios.
[0134] Training employs the Cross Entropy loss function: During training, one-hot encoding is used to process the labels, resulting in a one-dimensional tensor of length n composed of 0s and 1s. This tensor is then compared with the one-dimensional tensor of length n output by the model after SoftMax, composed of n floating-point probability values. The cross-entropy loss is calculated using this method. Compared to calculating the loss for a single predicted classification after ArgMax, this approach helps the model better learn the differences between different classifications, thus improving classification accuracy.
[0135] The model prediction process is implemented as follows:
[0136] Since K-fold cross-validation is used during training to avoid overfitting, K optimal models for the validation set will be generated. In the prediction stage, for a single structured text input, the prediction can be performed by the K models respectively, and the arithmetic mean of the output probability values of SoftMax can be taken. Then, Argmax can be used to obtain the predicted category with the highest probability.
[0137] The overall flow of the method of this invention embodiment based on the preprocessing module, model encoding module, and model decoding module is as follows:
[0138] 1. Data input: such as Figure 7 As shown, the bottom layer is the input, which consists of the original text composed of multiple segments, the structure name corresponding to each segment, and the start and end position index of each segment in the original text.
[0139] 2. Preprocessing module: such as Figure 7 The input data is preprocessed and segmented to obtain special word indexes and one-dimensional model inputs. The special word indexes are used for index pooling in the decoding layer, and the one-dimensional model inputs are used for model feature encoding.
[0140] 3. Model encoding module: such as Figure 7 The BERT word embedding layer and multi-layer encoding layer respectively encode the features of the one-dimensional model input to obtain the encoded feature tensor, the shape of which is seq_len*hidden_dim;
[0141] 4. Model decoding module: such as Figure 7 The decoding module obtains the encoded feature tensor and the preprocessed special word index. It extracts multiple one-dimensional tensors of length hidden_dim through index pooling, and performs affine transformations by a fully connected layer to obtain the classification result.
[0142] In some specific embodiments, taking the application scenario of automatic review of research proposals as an example, the method of the present invention can achieve the following:
[0143] a) Overview: A research proposal is a form of structured text with a defined format and writing requirements, including but not limited to a project description, feasibility analysis, and research and development process. Due to the varying quality of different proposals, they require format and content reviews, resulting in a significant workload. Therefore, the initial review is handled by an algorithm, which can provide preliminary scores (excellent, satisfactory, unsatisfactory) for different parts of the proposal, offering reference and focus for subsequent content reviews and saving reviewers valuable time.
[0144] b) Similar scenarios: Patent application review, contract review, etc.
[0145] c) Technical solution:
[0146] i. Assuming the input is: application text, and headings of different sections within the application.
[0147] ii. Implementation steps:
[0148] 1. Model preparation: Select the BERT pre-trained language model and word segmenter, and add the two special words "<<start>>" and "<<end>>" to the word segmenter in advance;
[0149] 2. Preprocessing: Embed the headings of different structures in the application form at the beginning and end of the corresponding paragraphs, and then embed <<start>> and <<end>> at the beginning and end of the paragraphs;
[0150] 3. Tokenization by the Tokenizer: The tokenizer splits the preprocessed text into a list of strings composed of multiple sub-words, and converts the list into a one-dimensional array (vector) based on the numerical ID of each sub-word in the word list dictionary. At the same time, since <<start>> and <<end>> have been added to the tokenizer's word list in advance, they will exist completely in the string list after tokenization. In order to extract the model's prediction results based on the position of special words, it is also necessary to extract the position index of <<start>> in the string list.
[0151] 4. BERT Model Inference: Input the one-dimensional vector generated by word segmentation in step 3 into the model to obtain the encoded two-dimensional vector, the first dimension of which is consistent with the one-dimensional vector;
[0152] 5. Post-processing: Based on the position indices of the special words in the word segmentation list obtained in step 3, extract the first dimension of the two-dimensional vector output in step 4 to obtain multiple one-dimensional vectors corresponding to the number of indices. The dimension of these vectors is consistent with the dimension of the model's encoding layer. Then, pass these multiple one-dimensional vectors to the decoding layer (nn.linear fully connected layer) for dimension compression. The compressed dimension is consistent with the number of classifications (3 classes: excellent, qualified, unqualified). The dimension with the highest probability value is taken as the classification result.
[0153] 6. BERT Model Training: Based on the output classification results, the results and the actual categories are fed into the loss function to calculate the loss value. The backpropagation mechanism is then used to update the BERT model parameters until convergence.
[0154] In summary, to address the problems existing in the prior art, this invention provides an implementation method for structured text classification that helps improve the poor classification results and insufficient fine-grained classification of single articles. During the word segmentation stage, two special words, <<start>> and <<end>>, are pre-added to the sub-vocabulary and directly embedded before and after the corresponding segment structure in the text to introduce the positional features of the segment structure within the entire text. Furthermore, during the word segmentation stage, the names of the corresponding segment structures are inserted before and after the segment structures to introduce differences between structured information. Then, in the decoding stage, all results corresponding to the positions of the special words <<start>> (or <<end>>) in the model output are extracted instead of the traditional pooling operation, resulting in multiple tensors used to obtain the classification results for each segment structure, thus improving the fine-grained classification. Compared to existing technologies, this invention fully utilizes the structured information of structured text. By inserting special words, it introduces structured information and structured positional features, improving model training performance and classification accuracy. Furthermore, it can obtain the classification results of the corresponding structure based on the index position of special words, thereby maximizing the fine-grainedness of classification output and providing sufficient reference indicators for business scenarios.
[0155] On the other hand, such as Figure 8 As shown, this embodiment of the invention provides a structured text classification device 800, comprising: a first module 810 for acquiring structured text; wherein the structured text includes multiple segments and segment names and segment indices for each segment; a second module 820 for inserting identifier words and segment names before and after each segment according to the segment indices to obtain text to be processed; a third module 830 for performing word segmentation and conversion processing on the text to be processed to obtain a target one-dimensional vector and determining the index positions of the identifier words; a fourth module 840 for encoding the target one-dimensional vector to obtain a target two-dimensional vector; and a fifth module 850 for decoding the target two-dimensional vector based on the index positions to obtain the classification results for each segment.
[0156] It should be noted that, in some embodiments, the system further includes the following modules:
[0157] The sixth module is used to clean up the identifier words in the sub-word list and preprocess the sub-word list to obtain a sub-word list with a unified encoding format.
[0158] The content of the method embodiments of the present invention is applicable to the device embodiments. The specific functions implemented by the device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0159] On the other hand, such as Figure 9 As shown, this embodiment of the invention also provides an electronic device 900, which includes at least one processor 910 and at least one memory 920 for storing at least one program; taking one processor 910 and one memory 920 as an example.
[0160] The processor 910 and memory 920 can be connected via a bus or other means.
[0161] Memory 920, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory 920 may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 920 may optionally include memory remotely located relative to the processor, and this remote memory can be connected to the device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0162] The electronic device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0163] Specifically, Figure 10 A schematic block diagram of a computer system architecture for implementing an electronic device according to embodiments of the present invention is shown.
[0164] It should be noted that, Figure 10 The computer system 1000 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.
[0165] like Figure 10 As shown, the computer system 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1002 or programs loaded from storage section 1008 into random access memory (RAM). The RAM 1003 also stores various programs and data required for system operation. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output interface 1005 (I / O interface) is also connected to the bus 1004.
[0166] The following components are connected to the input / output interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a local area network card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the input / output interface 1005 as needed. A removable medium 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1010 as needed so that computer programs read from it can be installed into the storage section 1008 as needed.
[0167] In particular, according to embodiments of the present invention, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit 1001, it performs various functions defined in the system of the present invention.
[0168] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein computer-readable program code is carried. Such transmitted data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0169] The content of the method embodiments of the present invention is applicable to the system embodiments. The specific functions implemented in the system embodiments are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0170] Another aspect of this invention provides a computer-readable storage medium storing a program that is executed by a processor to implement the method described above.
[0171] The content of the method embodiments of the present invention is applicable to the computer-readable storage medium embodiments. The specific functions implemented by the computer-readable storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above methods.
[0172] This invention also discloses a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned method.
[0173] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0174] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0175] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, portable hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of the present invention.
[0176] In some alternative embodiments, the functions / operations mentioned in the block diagrams may not occur in the order shown in the operation diagrams. For example, depending on the functions / operations involved, two consecutively shown blocks may actually be executed substantially simultaneously, or the blocks may sometimes be executed in reverse order. Furthermore, the embodiments presented and described in the flowcharts of this invention are provided by way of example to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed and sub-operations described as part of a larger operation are executed independently.
[0177] Furthermore, although the invention has been described in the context of functional modules, it should be understood that, unless otherwise stated, one or more of the functions and / or features may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the invention. Rather, given the properties, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the module will be understood within the scope of conventional skill of an engineer. Therefore, those skilled in the art can implement the invention as set forth in the claims using ordinary techniques without excessive experimentation. It is also understood that the specific concepts disclosed are merely illustrative and not intended to limit the scope of the invention, which is determined by the full scope of the appended claims and their equivalents.
[0178] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0179] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution means, apparatus, or device (such as a computer-based device, a processor-including device, or other means that can fetch and execute instructions from, or in conjunction with, an instruction execution means, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution means, apparatus, or device.
[0180] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0181] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution device. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0182] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0183] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.
[0184] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.< / s> < / sep>
Claims
1. A structured text classification method, characterized in that, include: Obtain structured text; wherein the structured text includes multiple segments and the segment name and segment index of each segment; Based on the segment index, insert identifiers and segment names before and after each segment to obtain the text to be processed; The text to be processed is segmented and converted to obtain a target one-dimensional vector, and the index position of the identifier word is determined. The target one-dimensional vector is encoded to obtain the target two-dimensional vector; The step of encoding the one-dimensional target vector to obtain a two-dimensional target vector includes: Using an encoding module, word embedding and multi-layer encoding are performed on the target one-dimensional vector to obtain a second-dimensional target two-dimensional vector; The encoding module includes a word embedding layer for word embedding processing and a multi-layer encoding layer for multi-layer encoding processing; the second dimension is determined by the length of the target one-dimensional vector and the dimension of the multi-layer encoding layer. Based on the index position, the target two-dimensional vector is decoded to obtain the classification results of each segment; The step of decoding the target two-dimensional vector based on the index position to obtain the classification results of each segment includes: Based on the index position, the target two-dimensional vector is pooled to extract multiple one-dimensional feature tensors corresponding to each segment; A fully connected layer is applied to the multiple one-dimensional feature tensors corresponding to each segment, and a normalization exponent is applied to obtain multiple classification category probabilities corresponding to each segment. The classification category corresponding to the maximum probability among the multiple classification category probabilities is selected as the classification result of each segment.
2. The structured text classification method according to claim 1, characterized in that, The acquisition of structured text includes: Retrieve business text organized based on a preset structure; The business text includes multiple segments, each of which is organized according to the preset structure. Based on the preset structure, obtain the segment name and segment index of each segment.
3. The structured text classification method according to claim 1, characterized in that, The identifier includes a start identifier and an end identifier. The step of inserting the identifier and the segment name before and after each segment according to the segment index includes: Based on the segment index, determine the start and end positions of each segment; Insert the start identifier and the segment name at the start position, and insert the end identifier and the segment name at the end position.
4. The structured text classification method according to claim 1, characterized in that, The step of performing word segmentation and transformation on the text to be processed to obtain a target one-dimensional vector and determining the index position of the identifier word includes: The text to be processed is split into multiple sub-words existing in the vocabulary to obtain a sub-word list of the first length; The vocabulary includes multiple non-repeating sub-words, each sub-word corresponding to a unique identifier; the sub-words in the vocabulary include the identifier word. Locate the identifier word in the sub-word list and determine the index position of the identifier word; Based on the unique identifier corresponding to each subword in the vocabulary, the subword list is transformed into a target one-dimensional vector of a first length.
5. The structured text classification method according to claim 4, characterized in that, After determining the index position of the identifier, the method further includes: The identifier words in the sub-word list are cleaned up, and the sub-word list is preprocessed to obtain a sub-word list with a unified encoding format.
6. A structured text classification device, characterized in that, include: The first module is used to obtain structured text; wherein the structured text includes multiple segments and the segment name and segment index of each segment; The second module is used to insert identifier words and segment names before and after each segment according to the segment index to obtain the text to be processed. The third module is used to perform word segmentation and conversion on the text to be processed, obtain a target one-dimensional vector, and determine the index position of the identifier word; The fourth module is used to encode the target one-dimensional vector to obtain the target two-dimensional vector; The step of encoding the one-dimensional target vector to obtain a two-dimensional target vector includes: Using an encoding module, word embedding and multi-layer encoding are performed on the target one-dimensional vector to obtain a second-dimensional target two-dimensional vector; The encoding module includes a word embedding layer for word embedding processing and a multi-layer encoding layer for multi-layer encoding processing; the second dimension is determined by the length of the target one-dimensional vector and the dimension of the multi-layer encoding layer. The fifth module is used to decode the target two-dimensional vector based on the index position to obtain the classification results of each segment; The step of decoding the target two-dimensional vector based on the index position to obtain the classification results of each segment includes: Based on the index position, the target two-dimensional vector is pooled to extract multiple one-dimensional feature tensors corresponding to each segment; A fully connected layer is applied to the multiple one-dimensional feature tensors corresponding to each segment, and a normalization exponent is applied to obtain multiple classification category probabilities corresponding to each segment. The classification category corresponding to the maximum probability among the multiple classification category probabilities is selected as the classification result of each segment.
7. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 5.
8. A computer storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to implement the method as described in any one of claims 1 to 5.