Text processing method, related device, storage medium and computer program product
By integrating syntactic structure features, text features and structural features, the problem of insufficient feature representation in the existing technology is solved, the accuracy and generalization ability of text classification are improved, and the occurrence of cascading errors is reduced.
Patent Information
- Application Number
- CN202111344591.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-12
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-11-12
AI Technical Summary
The existing technology extracts limited overall features from the text itself in text classification, which affects the accuracy of the classification results. Moreover, the deep learning model lacks the explicit introduction of syntactic structure features during feature extraction, resulting in an insufficiently comprehensive feature representation.
Combining syntactic structure features, text features and structured features for fusion processing, text classification is performed through the fused features after feature fusion, and prior knowledge of structured data is introduced to improve accuracy and generalization capabilities.
It effectively improves the accuracy and generalization ability of text classification, reduces the occurrence of cascading errors, obtains more relevant features, and improves the stability of text processing results.
Smart Images

Figure CN114328909B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text processing method, related equipment, storage medium and computer program product. Background Art
[0002] The rapid development of computer technology has enabled computer equipment to perform a variety of text processing on text data, such as semantic recognition, text classification, and sentiment recognition based on text data. At present, when processing text data, it is usually based on the text data itself, for example: calling a deep learning model for text classification or text recognition to extract the overall representation of the text data, and then performing text classification, semantic recognition and other processing based on the overall representation of the text data. However, the overall features extracted from the text itself are relatively limited in information expression, which may affect the accuracy of text processing results (such as text classification). Therefore, how to improve the accuracy of text classification has become a current research hotspot. Summary of the invention
[0003] The embodiments of the present application provide a text processing method, related equipment, storage medium and computer program product, which can improve the accuracy of text classification.
[0004] On the one hand, an embodiment of the present application provides a text processing method, including:
[0005] Acquire syntactic structure features and text features of the text to be processed, and acquire structural features of structured data. The text to be processed is generated under the target business, and the structured data refers to data with structural characteristics related to the target business;
[0006] Perform feature fusion processing on syntactic structure features, text features and structural features to obtain fusion features;
[0007] The text to be processed is classified based on the fused features.
[0008] On the one hand, an embodiment of the present application provides a text processing device, including:
[0009] An acquisition unit, used to acquire syntactic structure features and text features of a text to be processed, and to acquire structural features of structured data, wherein the text to be processed is generated under a target business, and the structured data refers to data with structural features related to the target business;
[0010] A processing unit, used for performing feature fusion processing on syntactic structure features, text features and structural features to obtain fusion features;
[0011] The classification unit is used to classify the text to be processed based on the fusion features.
[0012] In one implementation, the text to be processed includes one or more text characters, and the acquisition unit is specifically configured to execute:
[0013] Use the text classification model to analyze the syntactic structure of the text to be processed and obtain the dependency role of each text character;
[0014] The feature value corresponding to the dependency role of each text character is obtained, and the syntactic structure feature of the text to be processed is generated based on the obtained feature value.
[0015] In yet another embodiment, the structured data includes one or more data objects; and the acquisition unit is further specifically configured to execute:
[0016] Call the text classification model to preprocess each data object in the structured data to obtain the object features of each data object;
[0017] Based on the object features of each data object and the feature vectorization rules, each data object is vectorized to obtain the feature vector corresponding to each data object;
[0018] Based on the feature vector corresponding to each data object, a preset operation is performed to obtain the structured features of the structured data.
[0019] In yet another embodiment, the text classification model includes a text feature extraction network, and the acquisition unit is further specifically configured to perform:
[0020] Calling the text feature extraction network to extract lexical features, syntactic features and semantic features of the text to be processed, respectively, to obtain the lexical features, syntactic features and semantic features corresponding to the text to be processed;
[0021] The text features of the text to be processed are determined based on the lexical features, syntactic features and semantic features corresponding to the text to be processed.
[0022] In another embodiment, the text features are obtained by calling a text feature extraction network to extract features from the text to be processed, the text feature extraction network is trained based on the training text, or the text feature extraction network is trained based on the training text and the syntactic structure features corresponding to the training text.
[0023] In yet another embodiment, the text processing apparatus further includes a training unit, the training unit being configured to execute:
[0024] Obtaining training data, the training data includes: training text, structured training data related to the training text, and text classification labels corresponding to the training text;
[0025] The text classification model is used to perform text analysis on the training text to obtain the syntactic structure features and text features of the training text, and the text classification model is used to perform feature extraction on the structured training data to obtain the structured features of the structured training data;
[0026] The syntactic structure features and text features of the training text and the structured features of the structured training data are fused to obtain the target training features;
[0027] Perform text classification processing on the training text based on the target training features to obtain the predicted classification label of the training text;
[0028] Based on the difference information between the predicted classification label and the text classification label, the model parameters of the text classification model are adjusted.
[0029] In another embodiment, the structured features of the structured training data are obtained by performing feature extraction processing on the text classification model based on the feature vectorization rule; the feature vectorization rule includes one or more parameters, the model parameters include the feature value corresponding to each dependency role, and each parameter in the feature vectorization rule; the training unit can also be specifically used to execute:
[0030] Based on the difference information between the predicted classification label and the text classification label, the feature value corresponding to the dependency role and each parameter in the feature vectorization rule are adjusted.
[0031] In one aspect, an embodiment of the present application further provides a computer device, including:
[0032] a processor adapted to implement one or more computer programs;
[0033] Computer storage medium, the computer storage medium storing one or more computer programs, the one or more computer programs being suitable for being loaded and executed by a processor:
[0034] Obtain the syntactic structure features and text features of the text to be processed, as well as the structured features of structured data. The text to be processed is generated under the target business, and structured data refers to data with structured characteristics related to the target business; perform feature fusion processing on the syntactic structure features, text features and structured features to obtain fusion features; and perform text classification on the text to be processed based on the fusion features.
[0035] In one aspect, an embodiment of the present application further provides a computer storage medium, wherein the computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded and executed by a processor:
[0036] Obtain the syntactic structure features and text features of the text to be processed, as well as the structured features of structured data. The text to be processed is generated under the target business, and structured data refers to data with structured characteristics related to the target business; perform feature fusion processing on the syntactic structure features, text features and structured features to obtain fusion features; and perform text classification on the text to be processed based on the fusion features.
[0037] In one aspect, an embodiment of the present application further provides a computer program product or a computer program, wherein the computer program product includes a computer program, and the computer program is suitable for being loaded and executed by a processor:
[0038] Obtain the syntactic structure features and text features of the text to be processed, as well as the structured features of structured data. The text to be processed is generated under the target business, and structured data refers to data with structured characteristics related to the target business; perform feature fusion processing on the syntactic structure features, text features and structured features to obtain fusion features; and perform text classification on the text to be processed based on the fusion features.
[0039] In the embodiment of the present application, when the computer device performs text classification on the text to be processed, it is based on the syntactic structure features and text features of the text to be processed, and the structured features of the structured data, wherein the structured data refers to the data with structured characteristics in the target business where the text to be processed is located. Introducing structured data in the text processing process can effectively introduce structured prior knowledge, thereby improving the accuracy of the computer device in text classification to a certain extent. In addition, the syntactic structure features, text features and structured features are subjected to feature fusion processing, and text classification is performed based on the fused text features after the feature fusion processing, so that the computer device can obtain more relevant features in the text to be processed. Therefore, the computer device adopts the text classification method proposed in the embodiment of the present application, which can also effectively improve the generalization ability of the computer device. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0041] Figure 1 is a schematic diagram of a text classification system provided in an embodiment of the present application;
[0042] Figure 2 is a schematic flow chart of a text processing method provided in an embodiment of the present application;
[0043] Figure 3 is a schematic flow chart of another text processing method provided in an embodiment of the present application;
[0044] Figure 4a is a schematic diagram of a syntactic dependency relationship provided in an embodiment of the present application;
[0045] Figure 4b is a schematic diagram of a syntactic dependency vector provided in an embodiment of the present application;
[0046] Figure 5a is a schematic flow chart of text classification provided by an embodiment of the present application;
[0047] Figure 5b It is a schematic diagram of a Transformer framework provided in an embodiment of the present application;
[0048] Figure 5c is a schematic flow chart of obtaining character features provided by an embodiment of the present application;
[0049] Figure 6 is a structural schematic diagram of a text processing device provided in an embodiment of the present application;
[0050] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0051] When processing text, if the text features of the text to be processed are obtained from the text to be processed itself, it is easy to cause the text features to have insufficient feature representation capabilities for the text to be processed, thereby resulting in the accuracy of the text processing results not being guaranteed. Based on this, the present application proposes to combine syntactic structure features, text features, and structured features for text processing, thereby improving the accuracy of the text processing results. In the research process, the present application embodiment proposes a first text processing scheme, which points out that text processing can be divided into two stages. Among them, the first stage first performs feature extraction processing on structured data, and then uses a machine learning model to perform text processing based on the obtained structured features to obtain preliminary text processing results; the second stage first screens the preliminary text processing results, and then performs unstructured tasks based on the screened text processing results and unstructured data. Specifically, a deep learning model can be used to perform further text processing based on the screened text processing results and unstructured data. Among them, the above-mentioned machine learning (Machine Learning, ML) is a multi-field cross-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It is a field that studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0052] The research results show that although the above text processing scheme can improve the accuracy of text processing results to a certain extent, since the entire text processing process is divided into two stages and the second stage will refer to the output data of the first stage, this text processing method is prone to the problem of error cascade propagation, which has a certain impact on the accuracy of the text processing results, and further leads to the instability of the accuracy of the text processing results. In addition, since the first stage mostly uses machine learning models, it is necessary for relevant personnel to manually construct a large number of features, and the representation ability of these features is limited. Therefore, the accuracy of the first text processing scheme has not been greatly improved, but the difficulty of the entire text processing process has been increased. In addition, since the second stage uses a deep learning model as a feature extractor (in the text field, transformers are generally used as feature extractors), the representation ability is very strong, but when embedding input (i.e., vectorized input), it often only considers the lexical and positional representation of the text to be processed, and lacks the explicit introduction of syntactic structure features. Therefore, the feature representation of the text to be processed in the first text processing scheme is still not comprehensive enough.
[0053] Based on the above text processing scheme and the defects of the scheme, the embodiment of the present application provides another text processing scheme, which points out that: structural features, syntactic structure features and text features can be jointly processed, which can reduce the rule stacking when the text processing results of the two text processing stages are fused, thereby reducing cascade errors. Specifically, the scheme proposes: feature fusion can be performed on the syntactic structure features and text features of the text to be processed, as well as the structural features related to the text to be processed, so as to perform text processing (such as text classification) on the text to be processed based on the fused text features obtained after feature fusion, so as to effectively avoid the cascade propagation of errors, so as to further improve the accuracy of text classification. Among them, the text to be processed can be text data generated under the target business, such as: text data generated in the text sentiment classification business, or text data generated in the commodity classification business, etc. It should be noted that in specific applications, the text to be processed can be a single text sentence or a text paragraph composed of multiple text sentences, and this application does not limit this.
[0054] Optionally, the text features mentioned above may refer to: the part of speech of a text character in the text to be processed (such as: noun, verb, preposition, etc.), the syntactic type of the text to be processed (such as: declarative sentence, exclamatory sentence, interrogative sentence, etc.), and the semantic information expressed by the text to be processed. Optionally, the syntactic structure features mentioned above may specifically refer to: the syntactic structure relationship between the words in the text to be processed, or the syntactic structure relationship between the text characters in the text to be processed. Among them, the syntactic structure relationship includes but is not limited to: verb-object relationship, subject-predicate relationship, core relationship, etc. Then, based on the above description, it is not difficult to understand that the text features may include any one or more of the following: lexical features, syntactic features, and semantic features, etc. In addition, the structured features mentioned above may be obtained after feature extraction of structured data, and structured data refers to: data related to the target business and having structured characteristics. Then, based on this, it is not difficult to understand that the structured features can be used to describe: the structural relationship between words (or text characters) related to the text to be processed. For example, if the target business is commodity sentiment classification business, then the text to be processed can be any user's text comment on a commodity, and the structured data can include the commodity name and the commodity category to which the commodity belongs, the comment data corresponding to the commodity, etc. Of course, the structured data can also include the historical comment data of the arbitrary user, the user attributes of the arbitrary user (such as: gender, age, occupation, etc.), etc. Based on this, the structured features of the structured data can be used to describe the subordinate relationship between the commodity name and the commodity category, and can also be used to describe the relationship between the user's gender and the commodity category, etc.
[0055] In one embodiment, the above-mentioned text processing scheme can be executed separately by a computer device, and the computer device can be a terminal device or a server, and the present application does not limit this. Based on this, the general process of the text processing scheme provided by the embodiment of the present application can be as follows: the computer device performs an overall characterization of the text to be processed to obtain the text features of the text to be processed; the computer device performs a syntactic structure analysis on the text to be processed to vectorize the dependency roles of each text character in the text to be processed, thereby obtaining the syntactic structure features of the text to be processed. Further, the computer device can perform feature extraction processing on the structured data related to the target business of the text to be processed to obtain the structured features of the structured data. Further, the computer device can perform feature fusion processing on the acquired text features, syntactic structure features and structured features, and then perform text classification on the text to be processed based on the features after feature fusion.
[0056] In another embodiment, the above-mentioned text processing scheme can also be applied to Figure 1 In the text classification system shown in Figure 1 As shown, the text classification system includes a terminal device 10 and a server 11, and the terminal device 10 establishes a communication connection with the server 11. In this case, the above-mentioned text processing scheme can be executed collaboratively by the terminal device 10 and the server 11. Specifically, the terminal device 10 can send the text to be processed and the structured data to the server 11, and further, the server 11 performs feature extraction processing on the received text to be processed to obtain the syntactic structure features and text features of the text to be processed, and the server 11 performs feature extraction on the received structured data to obtain the structured features of the structured data. Further, the server 11 can perform feature fusion processing on the structured features, syntactic structure features and text features, and perform text classification on the text to be processed based on the features after the feature fusion processing. Optionally, the server 11 can send the text classification result of the text to be processed to the terminal device 10, wherein, exemplarily, the text classification result can be a predicted text classification of the text to be processed.
[0057] It should be noted that, for the sake of convenience, unless otherwise specified, the following description is based on the example of a computer device executing the above-mentioned text processing solution alone. In addition, it should be noted that the terminal devices mentioned above may include but are not limited to: smart phones, tablet computers, laptops, desktop computers, car terminals, smart TVs, etc.; various clients (applications, APPs) can be run in the terminal devices, such as multimedia playback clients, social clients, browser clients, information stream clients, educational clients, etc. In addition, the servers mentioned above may include but are not limited to: independent physical servers, server clusters or distributed systems composed of multiple physical servers, and cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, etc., and this application does not impose any restrictions on this.
[0058] Based on the above data processing scheme, the present application embodiment proposes a text processing method, and its schematic flow chart can be found in Figure 2 As shown. It is not difficult to understand that the text processing method can be executed by the computer device mentioned above. Figure 2 As shown, the method includes steps S201-S203:
[0059] S201, obtaining syntactic structure features and text features of the text to be processed, and obtaining structured features of structured data.
[0060] Among them, based on the above description, it can be known that the text to be processed is generated under the target business, and structured data refers to data with structured characteristics related to the target business. Exemplarily, the target business can be a text classification business, a text semantic recognition business, a text conversion task, etc. In addition, it should be noted that the text to be processed mentioned above is essentially unstructured data. The so-called unstructured data refers to: data that is not organized in a predefined manner. In addition to text data (i.e., text to be processed), unstructured data such as image data, audio data, etc. are also unstructured data. In practical applications, deep learning models are often used to extract features from unstructured data, such as: using NLP (Natural Language Processing, natural language processing) technology to extract high-level semantic representations of text data, and then applying high-level semantic representations to downstream tasks (such as text classification, text semantic recognition, etc.). Then, based on the above description, it is not difficult to understand that the computer device performs feature extraction processing on the text to be processed, and can obtain syntactic structure features and text features for text classification of the text to be processed. Among them, text features can include any one or more of the following: lexical features, syntactic features, and semantic features.
[0061] Correspondingly, structured data refers to data that can be logically expressed and realized using a two-dimensional table structure, which may include one or more data objects. Among them, each data object may correspond to one or more initial object features, and there is a clear and definable relationship between the data object and its corresponding initial object features. Taking structured data as corporate financial data as an example, the data objects included therein may be financial expenditures, then the initial object features corresponding to the data object may be a specific expenditure (such as: expenditure of XX yuan on X-month-X-day in X-year). In practical applications, computer devices often use machine learning methods to process structured data, such as: using a tree model to select a feature value (such as the initial object feature mentioned above) from the structured data that can bring the maximum information gain for splitting until the end condition of machine learning is met. Exemplarily, the computer device may use a tree model to vectorize each data object in the structured data, thereby obtaining the structured features of the structured data. The specific manner in which the computer device obtains the structured features of structured data will be described in detail in subsequent embodiments, and the embodiments of the present application will not be repeated here.
[0062] S202, performing feature fusion processing on the syntactic structure features, text features and structural features to obtain fused text features.
[0063] In practical applications, feature fusion processing can be specifically concat processing (i.e., feature splicing processing). That is, the computer device can splice the syntactic structure features, text features, and structured features in the channel dimension to obtain fused text features. Then, for example, assuming that the fused text feature is represented as H, the syntactic structure feature is represented as Feature1, the text feature is represented as Feature2, and the structured feature is represented as Feature3, then H=concat(Feature1, Feature2, Feature3).
[0064] S203, classifying the text to be processed based on the fused text features.
[0065] Among them, the computer device can predict the category of the text to be processed based on the fused text features, and input the predicted probabilities corresponding to each predicted text classification into the SoftMax layer (an output layer in the neural network) for normalization, thereby outputting the probability distribution of each predicted text classification, so that the computer device can determine the final text classification result corresponding to the text to be processed.
[0066] In the embodiment of the present application, since the computer device performs text classification on the text to be processed based on the syntactic structure features, text features and structured features of the structured data of the text to be processed, the structured prior knowledge is effectively introduced, so that the accuracy of the computer device in performing text classification can be improved to a certain extent. In addition, the syntactic structure features, text features, and structured features are subjected to feature fusion processing, and text classification is performed based on the fused text features after feature fusion, so that the computer device can obtain more relevant features in the text to be processed, so the computer device can also effectively improve the generalization ability of the computer device by using the text classification method proposed in the embodiment of the present application.
[0067] See also Figure 3 , Figure 3 is a schematic flow chart of another text processing method provided in an embodiment of the present application. The method can also be executed by the computer device mentioned above, such as Figure 3 As shown, the method includes steps S301-S306:
[0068] S301, obtaining syntactic structure features and text features of the text to be processed.
[0069] In one embodiment, the computer device can use a text classification model to perform syntactic structure analysis on the text to be processed, such as using LTP (Language Technology Plantform) to perform syntactic structure analysis on the text to be processed. It can be seen from the above that the text to be processed includes one or more text characters, so after the computer device performs syntactic structure analysis on the text to be processed, the dependency role of each text character can be obtained. Then further, the computer device can obtain the feature value corresponding to the dependency role of each text character, and generate the syntactic structure features of the text to be processed based on the obtained feature value. Among them, the dependency role can be understood as a syntactic component, such as: subject, predicate, attributive, adverbial, etc. Then, it is not difficult to understand that the dependency role can be used to indicate the syntactic structure relationship between text characters, such as: verb-object relationship, subject-predicate relationship, etc.
[0070] In order to more clearly understand the embodiments of the present application, the following is a detailed description of the way in which a computer device obtains syntactic structure features in combination with a specific example. Assuming that the text to be processed is "XX Company enters bankruptcy liquidation procedure", the computer device can first perform word segmentation processing on the text to be processed to obtain one or more words, and then the computer device further performs syntactic structure analysis on the text to be processed to obtain the syntactic dependency relationship between the words. For example, see Figure 4a , where ATT represents the attributive-predicate relationship, SBV represents the subject-predicate relationship, HED represents the core relationship, FOB represents the prepositioned object, and VOB represents the verb-object relationship. Based on this, Figure 4aIt is not difficult to see that in the text to be processed "XX Company has entered the bankruptcy liquidation process", the part of speech of "XX" is ns (a word composed of a noun and a location word), and "XX" is in the "ATT" role of "Company"; the part of speech of "Company" is n (noun), and "Company" is in the "SBV" role of "entered"; the part of speech of "entered" is v (verb), and "entered" is the "HED" role of this text to be processed; the part of speech of "bankruptcy" is a verb, and "bankruptcy" is in the "FOB" role of "liquidation"; the part of speech of "liquidation" is a verb, and "liquidation" is in the "ATT" role of "process"; the part of speech of "process" is a noun, and "process" is in the "VOB" role of "entered". Further, the computer device can use the dependency role corresponding to each word where a text character is located as the dependency role of the text character, so as to obtain the dependency role corresponding to each text character among one or more text characters. For example, since the dependency role of "Company" is SBV, the computer device can use SBV as the dependency role of "公" and use SBV as the dependency role of "司". Based on this, it is not difficult to understand that the dependency roles corresponding to each text character in the text to be processed in this example can be {"X": "ATT", "X": "ATT", "公": "SBV", "司": "SBV", "进": "HED", "入": "HED", "破": "FOB", "产": "FOB", "清": "ATT", "算": "ATT", "程": "VOB", "序": "VOB"}. Further, the computer device can obtain the feature value of each dependency role, thereby forming the syntactic dependency matrix (or: syntactic dependency vector) of the entire text to be processed, and further enabling the computer device to use the syntactic dependency matrix as the syntactic structure feature of the text to be processed. Exemplarily, the syntactic dependency matrix of the text to be processed in this example can be as Figure 4b shown, where: E_ATT represents the feature value of the dependency role ATT, E_SBV represents the feature value of the dependency role SBV, E_HED represents the feature value of the dependency role HED, E_FOB represents the feature value of the dependency role FOB, and E_VOB represents the feature value of the dependency role VOB.
[0071] In another embodiment, the text classification model may include a text feature extraction network, and the computer device may use the text feature extraction network to extract text features of the text to be processed. It can be seen from step S201 that the text features may include any one or more of the following: lexical features, syntactic features, and semantic features. Specifically, the computer device may call the text feature extraction network to perform lexical feature extraction, syntactic feature extraction, and semantic feature extraction on the text to be processed, respectively, to obtain the lexical features, syntactic features, and semantic features corresponding to the text to be processed. Further, the computer device may determine the text features of the text to be processed based on the lexical features, syntactic features, and semantic features corresponding to the text to be processed. Among them, the above-mentioned text feature extraction network may be a text pre-training model, that is, the computer device may use the text pre-training model to perform feature extraction processing on the text to be processed. Among them, text pre-training models include: BERT (Bidirectional Encoder Representations from Transformers, a bidirectional pre-training model), ALBERT (A LITE BERT, a BERT model with fewer parameters) or ERNIE (Enhanced Representation through Knowledge Integration, a pre-training model optimized based on BERT).
[0072] For the sake of convenience, the following will be combined Figure 5a The text classification process shown in FIG. 1 is used to describe in detail the steps for obtaining text features proposed in the embodiment of the present application. Figure 5a As shown, the computer device uses BERT to process the text to be processed, and adds a start identifier [CLS] before the first text character of the text to be processed. Then, the computer device can use BERT to obtain the character features of each text character (such as Figure 5a E_X1, E_X2, ..., E_Xn) and the identifier features corresponding to the start identifier (such as Figure 5a In E_[CLS]). Further, the computer device can use BERT to perform bidirectional feature learning based on the character features of each text character and the identifier features corresponding to the start identifier, thereby obtaining the lexical features, syntactic features and semantic features of each text character, as well as the lexical features, syntactic features and semantic features of the start identifier. The computer device can perform bidirectional feature learning through the Transformer model. Transformer is a natural language processing model, and its framework can be found in Figure 5b As shown, Figure 5bThe structure marked by 51 is an encoder. It is not difficult to see that the encoder has a layer of multi-head attention and a layer of feedforward neural network. Figure 5b The structure marked by 52 in the figure can be understood as a decoder. In practical applications, the transformer model may include multiple decoders and multiple encoders. Based on this, the computer device can input each character feature (Input Embedding) corresponding to the text to be processed into the first decoder, and then perform self-attention mechanism learning based on each character feature in the first decoder to obtain new character features corresponding to each character; further, the computer device can perform Add&Normalization processing on the new character features (i.e., residual connection and addition normalization processing), and propagate the processed character features to the next encoder. Furthermore, the character features output by the first encoder can be subjected to self-attention mechanism learning and Add&Normalization processing in the next encoder. It should be noted that the computer device can perform feature learning operations according to the above principles in each encoder, and can pass the output of the last encoder in the transformer model to all decoders, so that the corresponding decoder can obtain semantic features, syntactic features and lexical features according to the character features output by the encoder. According to Figure 5b It is not difficult to see that the decoder has an additional masked Multi-head Self-Attention compared to the encoder, which allows the computer device to pay more attention to the feature information of the generated character sequence corresponding to the text to be processed, thereby obtaining more accurate lexical features, syntactic features and lexical features.
[0073] Based on the above description, the computer device can implement bidirectional feature learning based on character features, so as to obtain the lexical features, syntactic features and semantic features of the text to be processed, and then obtain the text features of the text to be processed. Among them, BERT can directly use the lexical features, syntactic features and semantic features corresponding to the starting identifier [CLS] as the lexical features, syntactic features and semantic features of the text to be processed, respectively, so as to determine the text features of the text to be processed. So, that is to say, the computer device can directly determine the text features of the text to be processed based on the lexical features, syntactic features and semantic features corresponding to the starting identifier [CLS]. Exemplarily, the computer device can determine the text features of the text to be processed by performing feature analysis processing on the lexical features, syntactic features and semantic features of the text to be processed.
[0074] In order to further clearly describe the embodiments of the present application, the following takes the example of a computer device using BERT to perform feature extraction processing on a text to be processed to explain in detail how the computer device obtains the character features of each text character and the identifier features corresponding to the start identifier. Assume that the text to be processed is: I love my home, and my home has cats. Then, the computer device can use BERT to perform word segmentation processing on the text to be processed to obtain the following: Figure 5c The input sequence is labeled by 53. Figure 5c It is not difficult to see that the computer device can add an end identifier [SEP] after the last text character of each text sentence to separate different text sentences, so that the computer device can use BERT to generate different sentence vectors for different sentences. Then, for each character in the input sequence, the computer device can use BERT to obtain the character vector (ie: TokenEmbeddings), sentence vector (ie: SegmentEmbeddings) and position vector (ie: Position Embeddings) of the character. Furthermore, the computer device can use BERT to perform vector addition processing on the character vector, sentence vector and position vector corresponding to each character, so as to obtain the character features of each character, that is, to obtain the character features of each text character and the identifier features of the start identifier.
[0075] In another embodiment, when the computer device uses the text feature extraction network to extract text features from the text to be processed, it can also refer to the syntactic structure vector of the text to be processed. Then, that is to say, the text feature can be obtained by the computer device referencing the syntactic structure feature and fusing the lexical feature, syntactic feature, and semantic feature of the text to be processed. Then, in this case, the computer device can also obtain the text features of the text to be processed in the following way: the computer device first calls the text classification model to extract the syntactic structure feature of the text to be processed, and obtains the syntactic structure feature corresponding to the text to be processed. Further, the computer device can call the text feature extraction network in the text classification model to extract lexical features, syntactic features, and semantic features of the text to be processed respectively, and obtain the lexical features, syntactic features, and semantic features corresponding to the text to be processed, so that the computer device can fuse the obtained lexical features, syntactic features, and semantic features based on the syntactic structure feature, so as to obtain the text features of the text to be processed. The computer device extracts the text features of the text to be processed in this way, which can enhance the representation ability of the text features, so that the text classification result obtained by the computer device when performing text classification is more accurate.
[0076] S302, calling the text classification model to pre-process each data object in the structured data to obtain the object features of each data object.
[0077] Based on the foregoing, it can be known that structured data includes one or more data objects. Among them, each of the one or more data objects corresponds to one or more object features, and the object features can be obtained after the computer device preprocesses the initial object features of the data object, and illustratively, the object features can be represented by numerical values. Optionally, the computer device can preprocess an initial object feature to obtain an object feature, that is, there is a one-to-one correspondence between the initial object feature and the object feature. Taking the data object "gender" as an example, the initial object features corresponding to the data object are "male" and "female". Then, the object features corresponding to the data object "gender" can include two, namely: an object feature corresponding to the initial object feature "male" (which can be represented by the numerical value 1), and an object feature corresponding to the initial object feature "female" (which can be represented by the numerical value 0).
[0078] Optionally, the computer device can also preprocess one or more initial object features to obtain an object feature. That is, there is a many-to-one correspondence between the initial object feature and the object feature. Taking the data object "annual income" as an example, it is not difficult to understand that the initial object feature corresponding to the data object can be any non-negative value (that is: the initial object feature of the data object "annual income" can be infinite), then, the computer device can preprocess all the values from 0 to 100,000 (multiple initial object features) to obtain an object feature, then, it is not difficult to understand that all the values from 0 to 100,000 can be numerically represented by the same value, such as: using the value 1 to represent each value in the numerical range of 0 to 100,000; that is, the computer device can numerically represent 0-100,000 as 1.
[0079] In order to facilitate a clearer description of the embodiments of the present application, the following is a detailed description of the manner in which a computer device preprocesses a data object in conjunction with a specific example. Based on the above description, it is not difficult to see that if the number of initial object features of a data object is finite, the computer device can numerically map (or numerically represent) the initial object features of the data object one by one, thereby achieving preprocessing of the data object. Similarly, taking the above-mentioned data object as "gender" as an example, since gender corresponds to two initial object features (i.e., male and female), the computer device can directly numerically represent the object feature "male" as a value of 1, thereby obtaining an object feature of "gender"; and numerically represent the initial object feature "female" as a value of 0, thereby obtaining another object feature of "gender". That is to say, in specific applications, the computer device can use 1 to represent the gender as male and 0 to represent the gender as female.
[0080] Optionally, if the number of object features of the data object is infinite, or in other words, if the object features of the data object are not fixed, then the computer device can first discretize the data object, and then perform numerical mapping on the discretized data object, thereby realizing preprocessing of the data object. Among them, the discretization process can be understood as: changing the number of initial object features from infinite to finite. Taking the data object "annual income" as an example, it is not difficult to understand that in practical applications, the annual income can theoretically have no upper limit, that is, the annual income can theoretically be any non-negative value, such as: 0, 100.23, 10000, 235100.2, etc. Based on this, the computer device can first discretize the initial object features of the data object "annual income", so that the number of object features (hereinafter referred to as: intermediate object features) corresponding to the data object "annual income" is finite. It should be noted that the intermediate object features mentioned here refer to multiple initial object features after discretization, which are different from the initial object features and the preprocessed object features. Exemplarily, the computer device may divide all initial object features corresponding to the annual income into intervals to obtain one or more object feature intervals, and further use each object feature interval as an intermediate object feature. For example, the computer device divides the initial object feature of the annual income into four object feature intervals of 0-100,000, 100-300,000, 300-500,000, and more than 500,000. Then, the computer device may further use the one or more object feature intervals as four intermediate object features corresponding to the annual income, so that the computer device can perform numerical mapping on each intermediate object feature, obtain four object features corresponding to the annual income, and then realize the preprocessing of the data object "annual income".
[0081] S303, based on the object features of each data object and the feature vectorization rule, vectorization processing is performed on each data object to obtain a feature vector corresponding to each data object.
[0082] Among them, the feature vectorization rule may refer to: the vector dimension that the feature vector corresponding to the data object should satisfy and the distribution that each element in the vector should satisfy (specifically: mathematical distribution, such as normal distribution, Poisson distribution, etc.). In practical applications, the feature vectorization rule can be formulated with reference to the feature dimension of the syntactic structure feature. Based on this, exemplarily, the feature vectorization rule may indicate: the vector dimension of the feature vector corresponding to the data object is the same as the feature dimension of the syntactic structure feature. For example, assuming that a computer device uses a 4*4 matrix to represent the syntactic structure features of the text to be processed, then, exemplarily, the feature vectorization rule may be used to indicate: the feature vector of the data object needs to be represented by a 4*4 matrix, and the elements in the matrix satisfy the normal distribution.
[0083] S304: Perform a preset operation based on the feature vector corresponding to each data object to obtain structured features of the structured data.
[0084] In practical applications, the preset operation may refer to: vector average. That is to say, after obtaining the feature vector of each data object, the computer device may average the feature vector of each data object to obtain the structured features of the structured data. Figure 5a Taking the text classification process shown in the figure as an example, since the object features corresponding to the structured data are Feature1, Feature2, ..., FeatureN, the feature vector corresponding to Feature1 is Embedding1, the feature vector corresponding to Feature2 is Embedding2, and the feature vector corresponding to FeatureN is EmbeddingN. Based on this, the computer device can average the vectors of Embedding1, Embedding2, ..., EmbeddingN to obtain the structured features of the structured data. In other words, assuming that the structured features are represented by E_feature, then E_feature = average(Embedding1, Embedding2, ..., EmbeddingN).
[0085] S305, performing feature fusion processing on the syntactic structure features, text features and structural features to obtain fused text features.
[0086] S306, performing text classification on the text to be processed based on the fused text features.
[0087] In one embodiment, the related embodiments of step S305 to step S306 can refer to the description of step S201 to step S202, and the embodiments of the present application will not be repeated here.
[0088] Based on the above description, it can be known that the computer device can use the text classification model to extract features from the text to be processed and the structured data. Then, it should be noted that before the computer device uses the text classification model to perform feature extraction processing, the model parameters of the text classification model can also be adjusted. Among them, the specific way for the computer device to adjust the model parameters of the text classification model can be as follows: the computer device obtains training data, and the training data includes: training text, structured training data related to the training text, and text classification labels corresponding to the training text. It can be understood that the text classification label can be used to indicate the correct text category of the training text. Then, further, the computer device can use the text classification model to perform text analysis processing on the training text to obtain the syntactic structure features and text features of the training text, and use the text classification model to perform feature extraction processing on the structured training data to obtain the structured features of the structured training data. Among them, the computer device analyzes and processes the training text to obtain the syntactic structure features and text features of the training text. The specific method can refer to the relevant embodiment in the above step S301. The computer device uses the text classification model to extract features from the structured training data. The specific method of obtaining the structured features of the structured training data can refer to the relevant description of the above steps S302 to S304, which will not be repeated in this application. Further, after the computer device obtains the syntactic structure features and text features of the training text and the structured features of the structured data, the syntactic structure features and text features of the training text and the structured features of the structured training data can be fused to obtain the target training features, so that the training text can be subjected to text classification processing based on the target training features to obtain the predicted classification label of the training text. It can be understood that the predicted classification label can be one or more, and the predicted classification label can include the text classification label mentioned above, or may not include the text classification label mentioned above. Based on this, the computer device can adjust the model parameters of the text classification model based on the difference information between the predicted classification label and the text classification label.
[0089] Among them, based on the above Figure 3It is not difficult to understand from the relevant description that the structured features of the structured training data are obtained by the text classification model performing feature extraction processing based on the feature vectorization rule. It should be noted that the feature vectorization rule includes one or more parameters, and the model parameters include the feature values corresponding to each dependency role, and each parameter in the feature vectorization rule. Based on this, when the computer device adjusts the model parameters of the text classification model based on the difference information between the predicted classification label and the text classification label, it can specifically include: the computer device adjusts the feature values corresponding to the dependency role and each parameter in the feature vectorization rule based on the difference information between the predicted classification label and the text classification label. It is not difficult to understand that before the computer device adjusts the model parameters of the text classification model for the first time, each model parameter in the text classification model is randomly initialized. That is to say, when the computer device obtains the feature vector corresponding to the dependency role of each text character in the first training text, it is obtained by randomly initializing the feature vector corresponding to the dependency role. Similarly, when the computer device performs vectorization processing on each data object in the structured data, it is obtained by randomly vectorizing each data object.
[0090] In another embodiment, based on the above Figure 3 It can be known from the relevant embodiments that the text classification model may include a text feature extraction network, and the text feature extraction network is used to extract text features. In practical applications, the text feature extraction network may include multiple feature extraction parameters, so the text features of any text may be obtained by a computer device using a text feature extraction network and extracting features from the text based on the feature extraction parameters in the text feature extraction network. In this case, it should be noted that the above-mentioned text feature extraction network may be trained based on a training text, or may be trained based on a training text and the syntactic structure features corresponding to the training text. If the text feature extraction network is trained based on a training text and the syntactic structure features corresponding to the training text, then when the computer device adjusts the model parameters of the text classification model, the feature values and feature extraction parameters of the dependent roles may be adjusted together in the text feature extraction network.
[0091] In the embodiment of the present application, since the computer device performs a syntactic structure analysis on the text to be processed, thereby introducing the syntactic structure features of the text to be processed, this feature extraction method can enhance the characterization ability of the fusion feature on the text to be processed, thereby improving the accuracy of the computer device when classifying the text to be processed. In addition, the computer device also obtains the structured features of the structured data, and the dimension of the structured features can be consistent with the dimension of the syntactic structure features. It is not difficult to understand that when the dimension of the structured features is consistent with the dimension of the syntactic structure features, the difficulty of the computer device to fuse the syntactic structure features, text features and structured features can be reduced to a certain extent, thereby improving the overall text classification rate.
[0092] Based on the above description of the text processing method, the present application also discloses a text processing device. The text processing device may be a computer program (including program code) running in the above-mentioned computer device. The text processing device may execute the following steps: Figure 2 and Figure 3 For text processing methods shown, see Figure 6 The text processing device may at least include: an acquisition unit 601, a processing unit 602 and a classification unit 603.
[0093] The acquisition unit 601 is used to acquire syntactic structure features and text features of a text to be processed, and to acquire structural features of structured data, wherein the text to be processed is generated under a target business, and the structured data refers to data with structural characteristics related to the target business;
[0094] A processing unit 602 is used to perform feature fusion processing on the syntactic structure feature, the text feature and the structural feature to obtain a fusion feature;
[0095] The classification unit 603 is used to classify the text to be processed based on the fusion feature.
[0096] In one implementation, the text to be processed includes one or more text characters, and the acquiring unit 601 is specifically configured to execute:
[0097] Using a text classification model to perform syntactic structure analysis on the text to be processed to obtain a dependency role for each text character;
[0098] Acquire a feature value corresponding to the dependency role of each text character, and generate a syntactic structure feature of the text to be processed based on the acquired feature value.
[0099] In yet another implementation, the structured data includes one or more data objects; the acquiring unit 601 is further specifically configured to execute:
[0100] Calling a text classification model to preprocess each data object in the structured data to obtain object features of each data object;
[0101] Based on the object features of each data object and the feature vectorization rule, vectorize each data object to obtain a feature vector corresponding to each data object;
[0102] A preset operation is performed based on the feature vector corresponding to each data object to obtain the structured features of the structured data.
[0103] In yet another embodiment, the text classification model includes a text feature extraction network, and the acquisition unit 601 is further specifically configured to perform:
[0104] Calling the text feature extraction network to extract lexical features, syntactic features and semantic features of the text to be processed, respectively, to obtain lexical features, syntactic features and semantic features corresponding to the text to be processed;
[0105] The text features of the text to be processed are determined based on the lexical features, the syntactic features and the semantic features corresponding to the text to be processed.
[0106] In another embodiment, the text features are obtained by calling a text feature extraction network to extract features from the text to be processed, the text feature extraction network is trained based on a training text, or the text feature extraction network is trained based on the training text and the syntactic structure features corresponding to the training text.
[0107] In yet another embodiment, the text processing apparatus further includes a training unit 604, wherein the training unit 604 is configured to execute:
[0108] Acquire training data, the training data including: training text, structured training data related to the training text, and text classification labels corresponding to the training text;
[0109] Using a text classification model to perform text analysis on the training text to obtain syntactic structure features and text features of the training text, and using the text classification model to perform feature extraction on the structured training data to obtain structured features of the structured training data;
[0110] Fusing the syntactic structure features and text features of the training text and the structured features of the structured training data to obtain target training features;
[0111] Performing text classification processing on the training text based on the target training features to obtain a predicted classification label of the training text;
[0112] Based on the difference information between the predicted classification label and the text classification label, the model parameters of the text classification model are adjusted.
[0113] In another embodiment, the structured features of the structured training data are obtained by the text classification model performing feature extraction processing based on a feature vectorization rule; the feature vectorization rule includes one or more parameters, the model parameters include a feature value corresponding to each dependency role, and each parameter in the feature vectorization rule; the training unit 604 can also be specifically used to perform:
[0114] Based on the difference information between the predicted classification label and the text classification label, the feature value corresponding to the dependent role and each parameter in the feature vectorization rule are adjusted.
[0115] According to one embodiment of the present application, Figure 2 and Figure 3 The various steps involved in the method shown can be performed by Figure 6 The text processing device shown in the figure is executed by each unit. For example, Figure 2 Step S201 shown can be performed by Figure 6 The text processing device shown in the figure is executed by the acquisition unit 601; step S202 can be performed by Figure 6 The processing unit 602 in the text processing device shown in FIG. 1 is used to perform the step S203; the step S203 may be performed by Figure 6 The classification unit 603 in the text processing device shown in the figure is used for execution. Figure 3 Steps S301 to S304 shown in FIG. Figure 6 The text processing device shown in FIG. 1 is used to obtain the text processing device 601; step S305 can be performed by Figure 6 The processing unit 602 in the text processing device shown in FIG. 1 is executed; step S306 may be performed by Figure 6 The text processing device shown is executed by the classification unit 603.
[0116] According to another embodiment of the present application, Figure 6The various units in the text processing device shown are divided based on logical functions. The above-mentioned various units can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. In other embodiments of the present application, the above-mentioned text processing device can also include other units. In actual applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0117] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 or Figure 3 A computer program (including program code) for each step of the method shown in FIG. Figure 6 The text processing device shown in the embodiment of the present application is used to implement the text processing method of the embodiment of the present application. The computer program can be recorded on a computer storage medium, for example, and loaded into the above-mentioned computer device through the computer storage medium and run therein.
[0118] In the embodiment of the present application, the text processing device classifies the text to be processed based on the syntactic structure features, text features and structured features of the structured data of the text to be processed, wherein structured data refers to data with structured characteristics in the target business where the text to be processed is located. Introducing structured data in the text processing process can effectively introduce structured prior knowledge, thereby improving the accuracy of text classification by the text processing device to a certain extent. In addition, syntactic structure features, text features and structured features are subjected to feature fusion processing, and text classification is performed based on the fused text features after feature fusion, so that the text processing device can obtain more relevant features in the text to be processed. Therefore, the text processing device can also effectively improve the generalization ability of the text processing device by adopting the text classification method proposed in the embodiment of the present application.
[0119] Based on the relevant description of the above method embodiment and the device embodiment, the present application embodiment also provides a computer device, see Figure 7 The computer device at least includes a processor 701 and a computer storage medium 702, and the processor 701 and the computer storage medium 702 of the computer device may be connected via a bus or other means.
[0120] Among them, the computer storage medium 702 mentioned above is a memory device in a computer device for storing programs and data. It is understandable that the computer storage medium 702 here can include both the built-in storage medium in the computer device and the extended storage medium supported by the computer device. The computer storage medium 702 provides a storage space, which stores the operating system of the computer device. In addition, one or more computer programs suitable for being loaded and executed by the processor 701 are also stored in the storage space, and these computer programs can be one or more program codes. It should be noted that the computer storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory; optionally, it can also be at least one storage medium located away from the aforementioned processor. The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more computer programs, and is specifically suitable for loading and executing one or more computer programs to realize the corresponding method flow or corresponding function.
[0121] In one embodiment, the processor 701 may load and execute one or more computer programs stored in the computer storage medium 702 to implement the above-mentioned Figure 2 and Figure 3 Corresponding method steps in the method embodiment shown; in a specific implementation, one or more computer programs in the computer storage medium 702 are loaded by the processor 701 and execute the following steps:
[0122] An acquisition unit, used to acquire syntactic structure features and text features of a text to be processed, and to acquire structural features of structured data, wherein the text to be processed is generated under a target business, and the structured data refers to data with structural characteristics related to the target business;
[0123] A processing unit, used for performing feature fusion processing on the syntactic structure feature, the text feature and the structural feature to obtain a fusion feature;
[0124] A classification unit is used to classify the text to be processed based on the fusion feature.
[0125] In one implementation, the text to be processed includes one or more text characters, and the processor 701 may also be configured to execute:
[0126] Using a text classification model to perform syntactic structure analysis on the text to be processed to obtain a dependency role for each text character;
[0127] Acquire a feature value corresponding to the dependency role of each text character, and generate a syntactic structure feature of the text to be processed based on the acquired feature value.
[0128] In yet another embodiment, the structured data includes one or more data objects; the processor 701 may also be configured to execute:
[0129] Calling a text classification model to preprocess each data object in the structured data to obtain object features of each data object;
[0130] Based on the object features of each data object and the feature vectorization rule, vectorize each data object to obtain a feature vector corresponding to each data object;
[0131] A preset operation is performed based on the feature vector corresponding to each data object to obtain the structured features of the structured data.
[0132] In yet another embodiment, the text classification model includes a text feature extraction network, and the processor 701 may also be used to execute:
[0133] Calling the text feature extraction network to extract lexical features, syntactic features and semantic features of the text to be processed, respectively, to obtain lexical features, syntactic features and semantic features corresponding to the text to be processed;
[0134] The text features of the text to be processed are determined based on the lexical features, the syntactic features and the semantic features corresponding to the text to be processed.
[0135] In another embodiment, the text features are obtained by calling a text feature extraction network to extract features from the text to be processed, the text feature extraction network is trained based on a training text, or the text feature extraction network is trained based on the training text and the syntactic structure features corresponding to the training text.
[0136] In yet another implementation, the processor 701 may also be configured to execute:
[0137] Acquire training data, the training data including: training text, structured training data related to the training text, and text classification labels corresponding to the training text;
[0138] Using a text classification model to perform text analysis on the training text to obtain syntactic structure features and text features of the training text, and using the text classification model to perform feature extraction on the structured training data to obtain structured features of the structured training data;
[0139] Fusing the syntactic structure features and text features of the training text and the structured features of the structured training data to obtain target training features;
[0140] Performing text classification processing on the training text based on the target training features to obtain a predicted classification label of the training text;
[0141] Based on the difference information between the predicted classification label and the text classification label, the model parameters of the text classification model are adjusted.
[0142] In another embodiment, the structured features of the structured training data are obtained by the text classification model performing feature extraction processing based on a feature vectorization rule; the feature vectorization rule includes one or more parameters, the model parameters include a feature value corresponding to each dependency role, and each parameter in the feature vectorization rule; the processor 701 can also be specifically used to execute:
[0143] Based on the difference information between the predicted classification label and the text classification label, the feature value corresponding to the dependent role and each parameter in the feature vectorization rule are adjusted.
[0144] In the embodiment of the present application, when the computer device performs text classification on the text to be processed, it is based on the syntactic structure features, text features and structured features of the structured data of the text to be processed, wherein structured data refers to data with structured characteristics in the target business where the text to be processed is located. Introducing structured data in the text processing process can effectively introduce structured prior knowledge, thereby improving the accuracy of the computer device in text classification to a certain extent. In addition, the syntactic structure features, text features and structured features are subjected to feature fusion processing, and text classification is performed based on the fused text features after feature fusion, so that the computer device can obtain more relevant features in the text to be processed. Therefore, the computer device can also effectively improve the generalization ability of the computer device by adopting the text classification method proposed in the embodiment of the present application.
[0145] The present application also provides a computer storage medium, in which one or more computer programs corresponding to the above-mentioned text processing method are stored. When one or more processors load and execute the one or more computer programs, the description of the text processing method in the embodiment can be implemented, which will not be repeated here. The description of the beneficial effects of adopting the same method will not be repeated here. It is understood that the computer program can be deployed on one or more devices that can communicate with each other for execution.
[0146] It should be noted that according to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product includes a computer program, and the computer program is stored in a computer storage medium. A processor in a computer device reads the computer program from the computer storage medium and then executes the computer program, thereby enabling the computer device to perform the above Figure 2 and Figure 3 The methods provided in various optional aspects of the text processing method embodiment are shown.
[0147] It should be noted that the collection and processing of data related to "user attributes such as user's occupation, income, etc." involved in this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in instances, and should have a legal basis or obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and / or the personal information subject.
[0148] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment method can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer storage medium. When the computer program is executed, it can include the processes of the above-mentioned text processing method embodiment. Among them, the computer storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0149] What is disclosed above is only a partial embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. A person skilled in the art can understand that the entire or partial process of implementing the above embodiment and the equivalent changes made according to the claims of the present application are still within the scope of the invention.
Claims
1. A text processing method, characterized in that: include: Acquire syntactic structure features and text features of a text to be processed, and acquire structural features of structured data, wherein the text to be processed is unstructured data generated under a target business, the unstructured data refers to data that is not organized in a predefined manner, and the structured data refers to data with structural characteristics related to the target business; wherein the dimension of the structural feature is consistent with the dimension of the syntactic structure feature; the acquiring of the syntactic structure features and text features of the text to be processed includes: based on the syntactic structure features, the lexical features, syntactic features, and semantic features of the text to be processed are fused to obtain the text features; Performing feature fusion processing on the syntactic structure feature, the text feature and the structural feature to obtain a fusion feature; The text to be processed is classified based on the fusion features.
2. The method according to claim 1, characterized in that The text to be processed includes one or more text characters; obtaining the syntactic structure features of the text to be processed includes: Using a text classification model to perform syntactic structure analysis on the text to be processed to obtain a dependency role for each text character; Acquire a feature value corresponding to the dependency role of each text character, and generate a syntactic structure feature of the text to be processed based on the acquired feature value.
3. The method according to claim 1, characterized in that The structured data includes one or more data objects; the step of obtaining the structured features of the structured data includes: Calling a text classification model to preprocess each data object in the structured data to obtain object features of each data object; Based on the object features of each data object and the feature vectorization rule, vectorize each data object to obtain a feature vector corresponding to each data object; A preset operation is performed based on the feature vector corresponding to each data object to obtain the structured features of the structured data.
4. The method according to claim 1 or 2, characterized in that: The text classification model includes a text feature extraction network; Acquiring text features of the text to be processed includes: Calling the text feature extraction network to extract lexical features, syntactic features and semantic features of the text to be processed, respectively, to obtain lexical features, syntactic features and semantic features corresponding to the text to be processed; The text features of the text to be processed are determined based on the lexical features, the syntactic features and the semantic features corresponding to the text to be processed.
5. The method according to claim 1, characterized in that The text features are obtained by calling a text feature extraction network to extract features from the text to be processed, the text feature extraction network is trained based on a training text, or the text feature extraction network is trained based on the training text and the syntactic structure features corresponding to the training text.
6. The method according to claim 2, characterized in that The method further comprises: Acquire training data, the training data including: training text, structured training data related to the training text, and text classification labels corresponding to the training text; Using a text classification model to perform text analysis on the training text to obtain syntactic structure features and text features of the training text, and using the text classification model to perform feature extraction on the structured training data to obtain structured features of the structured training data; fusing the syntactic structure features and text features of the training text and the structured features of the structured training data to obtain target training features; Performing text classification processing on the training text based on the target training features to obtain a predicted classification label of the training text; Based on the difference information between the predicted classification label and the text classification label, the model parameters of the text classification model are adjusted.
7. The method according to claim 6, characterized in that The structured features of the structured training data are obtained by the text classification model performing feature extraction processing based on feature vectorization rules; the feature vectorization rules include one or more parameters, and the model parameters include feature values corresponding to each dependency role and each parameter in the feature vectorization rules; The adjusting the model parameters of the text classification model based on the difference information between the predicted classification label and the text classification label includes: Based on the difference information between the predicted classification label and the text classification label, the feature value corresponding to the dependent role and each parameter in the feature vectorization rule are adjusted.
8. A text processing device, characterized in that: include: An acquisition unit is used to acquire syntactic structure features and text features of a text to be processed, and to acquire structural features of structured data, wherein the text to be processed is unstructured data generated under a target business, wherein the unstructured data refers to data that is not organized in a predefined manner, and the structured data refers to data with structural characteristics related to the target business; wherein the dimension of the structural feature is consistent with the dimension of the syntactic structure feature; the acquisition of the syntactic structure features and text features of the text to be processed includes: based on the syntactic structure features, the lexical features, syntactic features, and semantic features of the text to be processed are fused to obtain the text features; A processing unit, used for performing feature fusion processing on the syntactic structure feature, the text feature and the structural feature to obtain a fusion feature; A classification unit is used to classify the text to be processed based on the fusion feature.
9. A computer device, characterized in that: include: a processor adapted to implement one or more computer programs; A computer storage medium storing one or more computer programs, wherein the one or more computer programs are suitable for being loaded by the processor and executing the text processing method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium stores one or more computer programs, and the one or more computer programs are suitable for being loaded by a processor and executing the text processing method according to any one of claims 1 to 7.
11. A computer program product or a computer program, characterized in that The computer program product comprises the computer program, and the computer program is suitable for being loaded by a processor and executing the text processing method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Picture feature extraction model training method and device and computer device
CN110163220A
Semantic analysis method, device and equipment and storage medium
CN112543932A
Text recognition method, related equipment and device
CN113392190A
