A method and apparatus for text feature information recognition
By using text vector models and neural network models to extract and aggregate features from text information, the ambiguity of brand and category information in text is resolved, and efficient text feature information recognition is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies are ambiguous when extracting brand or category information from text and cannot effectively handle new brands and categories, resulting in low efficiency in recognizing text feature information.
The text vector model is used to extract, aggregate, and process text information features. The neural network model and the Transformer model are used to identify industry category and brand category information through contextual semantic information.
It improves the efficiency of text feature information recognition, accurately determines the industry of the text, and effectively extracts unknown brand category information.
Smart Images

Figure CN114564577B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of information recognition, and in particular to a text feature information recognition method and device. BACKGROUND
[0002] Extracting brand category information in the text and judging which industry the text belongs to is an important means for advertising data analysis, so that users can filter the text. Currently, keyword matching and other technologies are usually used to extract brand or category information in the text, and then the brand and category information are used to judge which industry the text belongs to. However, this method has the following disadvantages: first, the brand or category information may be ambiguous, for example, a brand may involve multiple industries; second, when new brands and new categories appear, it is impossible to extract and judge the industry. Therefore, it is particularly important to provide a text feature information recognition method and device to extract brand category information and judge the industry of the text, and effectively extract unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information. SUMMARY
[0003] The technical problem to be solved by the present application is to provide a text feature information recognition method and device, which can use a text vector model to perform feature extraction processing, aggregation and extraction processing on text information, and obtain industry category information and brand category information, so as to extract brand category information and judge the industry of the text, and effectively extract unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0004] To solve the above technical problems, the first aspect of the embodiment of the present application discloses a text feature information recognition method, which comprises:
[0005] Obtaining text information;
[0006] Using a preset text vector model to perform feature extraction processing on the text information to obtain text feature vector information;
[0007] Performing aggregation and extraction processing on the text feature vector information to obtain text feature information; the text feature information comprises industry category information and / or brand category information.
[0008] As an optional implementation manner, in the first aspect of the embodiment of the present application, the aggregation and extraction processing on the text feature vector information to obtain text feature information comprises:
[0009] Performing aggregation processing on the text feature vector information to obtain the industry category information; the industry category information represents the industry to which the text information belongs;
[0010] The text feature vector information is classified and labeled to obtain the brand category information.
[0011] As an optional implementation, in the first aspect of the embodiment of the present application, the aggregation processing of the text feature vector information to obtain the industry category information comprises:
[0012] A first initialization matrix and a second initialization matrix are obtained;
[0013] The first initialization matrix and the text feature vector information are calculated to obtain a query vector;
[0014] The second initialization matrix and the text feature vector information are calculated to obtain a key matrix;
[0015] The industry category information is determined according to the query vector and the key matrix.
[0016] As an optional implementation, in the first aspect of the embodiment of the present application, the text vector model comprises a first neural network model;
[0017] The determination of the industry category information according to the query vector and the key matrix comprises:
[0018] The inner product of the query vector and the key matrix is calculated to obtain an attention vector;
[0019] The attention vector is normalized to obtain a weight vector;
[0020] The weight vector and the text feature vector information are processed to obtain a classification vector;
[0021] The industry category information is determined according to the first neural network model and the classification vector.
[0022] As an optional implementation, in the first aspect of the embodiment of the present application, the text vector model further comprises a second neural network model;
[0023] The classification and labeling of the text feature vector information to obtain the brand category information comprises:
[0024] The text classification of the text feature vector information is performed by using the second neural network model to obtain text category information;
[0025] The brand category information is obtained by performing label annotation on the text category information.
[0026] As an optional implementation, in the first aspect of the embodiment of the present application, the text vector model further comprises a Transformer model;
[0027] The feature extraction processing of the text information by using the preset text vector model comprises:
[0028] The text information is subjected to word splitting processing to obtain a text information vector; the text information vector comprises M pieces of text information; M is a positive integer greater than or equal to 1;
[0029] The text information vector is processed by using a preset word vector to obtain a text matrix;
[0030] The text matrix is processed by using the Transformer model to obtain the text feature vector information.
[0031] As an optional implementation, in the first aspect of the embodiment of the present application, the text vector model is obtained based on the following training steps:
[0032] A training sample set is obtained; the training sample set comprises a plurality of training samples;
[0033] For any training sample, the training sample is input into a preset text training model, and a preset cross-entropy loss function is used for calculation processing to obtain loss function value information; the loss function value information comprises a first loss function value and a second loss function value; the first loss function value represents the function loss condition of a sub-training model for determining the industry category information; the second loss function value represents the function loss condition of a sub-training model for determining the brand category information;
[0034] The text training model is updated;
[0035] The loss function value information is calculated and processed to obtain a total loss function value;
[0036] It is judged whether the total loss function value satisfies a training termination condition to obtain a loss judgment result;
[0037] When the loss judgment result is yes, the updated text training model is determined as the text vector model.
[0038] The second aspect of the embodiment of the present application discloses a text feature information recognition device, and the device comprises:
[0039] An acquisition module is configured to acquire text information;
[0040] The first processing module is configured to perform feature extraction processing on the text information by using a preset text vector model to obtain text feature vector information.
[0041] The second processing module is configured to perform aggregation and extraction processing on the text feature vector information to obtain text feature information, wherein the text feature information comprises industry category information and / or brand category information.
[0042] As an optional implementation, in the second aspect of the embodiment of the present application, the specific manner in which the second processing module performs aggregation and extraction processing on the text feature vector information to obtain text feature information is as follows:
[0043] The text feature vector information is aggregated to obtain the industry category information, wherein the industry category information represents the industry to which the text information belongs.
[0044] The text feature vector information is classified and labeled to obtain the brand category information.
[0045] As an optional implementation, in the second aspect of the embodiment of the present application, the specific manner in which the second processing module performs aggregation processing on the text feature vector information to obtain the industry category information is as follows:
[0046] A first initialization matrix and a second initialization matrix are obtained.
[0047] The first initialization matrix and the text feature vector information are calculated to obtain a query vector.
[0048] The second initialization matrix and the text feature vector information are calculated to obtain a key matrix.
[0049] The industry category information is determined according to the query vector and the key matrix.
[0050] As an optional implementation, in the second aspect of the embodiment of the present application, the text vector model comprises a first neural network model.
[0051] The specific manner in which the second processing module determines the industry category information according to the query vector and the key matrix is as follows:
[0052] The query vector and the key matrix are subjected to inner product calculation to obtain an attention vector.
[0053] The attention vector is subjected to normalization processing to obtain a weight vector.
[0054] The weight vector and the text feature vector information are processed to obtain a classification vector.
[0055] According to the first neural network model and the classification vector, the industry category information is determined.
[0056] As an optional implementation, in the second aspect of the embodiment of the present application, the text vector model further comprises a second neural network model.
[0057] The second processing module classifies and labels the character feature vector information to obtain the brand category information in the following specific manner:
[0058] The second neural network model is used to classify the character feature vector information to obtain character category information.
[0059] The character category information is labeled to obtain the brand category information.
[0060] As an optional implementation, in the second aspect of the embodiment of the present application, the text vector model further comprises a Transformer model.
[0061] The first processing module extracts features from the text information by using a preset text vector model to obtain character feature vector information, including:
[0062] The text information is processed by word splitting to obtain character information vectors; the character information vectors comprise M pieces of character information; M is a positive integer greater than or equal to 1;
[0063] The character information vectors are processed by using a preset word vector to obtain a character matrix.
[0064] The character matrix is processed by using the Transformer model to obtain the character feature vector information.
[0065] As an optional implementation, in the second aspect of the embodiment of the present application, the device further comprises:
[0066] A training module is configured to perform the following steps to train the text vector model:
[0067] A training sample set is obtained; the training sample set comprises a plurality of training samples.
[0068] For any training sample, the training sample is input into a preset text training model, and a preset cross-entropy loss function is used for calculation and processing to obtain loss function value information; the loss function value information comprises a first loss function value and a second loss function value; the first loss function value represents the function loss of a sub-training model for determining the industry category information; and the second loss function value represents the function loss of a sub-training model for determining the brand category information.
[0069] updating the text training model;
[0070] calculating and processing the loss function value information to obtain a total loss function value;
[0071] judging whether the total loss function value meets a training termination condition to obtain a loss judgment result;
[0072] when the loss judgment result is yes, determining that the updated text training model is the text vector model.
[0073] A third aspect of the present application discloses another text feature information recognition device, which comprises:
[0074] a memory storing executable program codes;
[0075] a processor coupled with the memory;
[0076] The processor invokes the executable program codes stored in the memory to execute part or all steps of the text feature information recognition method disclosed in the first aspect of the present application.
[0077] A fourth aspect of the present application discloses a computer storage medium storing computer instructions, which, when invoked, are used to execute part or all steps of the text feature information recognition method disclosed in the first aspect of the present application.
[0078] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0079] In the embodiments of the present application, text information is acquired, the text information is subjected to feature extraction processing by using a preset text vector model to obtain text feature vector information, the text feature vector information is subjected to aggregation and extraction processing to obtain text feature information, and the text feature information comprises industry category information and / or brand category information. It can be seen that the text information can be subjected to comprehensive processing such as feature extraction processing, aggregation and extraction processing by using the text vector model to obtain the industry category information and the brand category information, which is beneficial to judging the industry of the text while extracting the brand category information, and effectively extracting unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information. BRIEF DESCRIPTION OF DRAWINGS
[0080] In order to make the technical solutions in the embodiments of the present application clearer, the accompanying drawings needed in the embodiments will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings belong to the protection scope of the present application.
[0081] Figure 1 is a flow diagram of a text feature information recognition method disclosed by an embodiment of the present application;
[0082] Figure 2 is a flow diagram of another text feature information recognition method disclosed by an embodiment of the present application;
[0083] Figure 3 is a structural diagram of a text feature information recognition device disclosed by an embodiment of the present application;
[0084] Figure 4 is a structural diagram of another text feature information recognition device disclosed by an embodiment of the present application;
[0085] Figure 5 is a structural diagram of another text feature information recognition device disclosed by an embodiment of the present application. DETAILED DESCRIPTION
[0086] In order to make the technical solutions in the embodiments of the present application clearer, the accompanying drawings needed in the embodiments will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and all other drawings obtained by those of ordinary skill in the art without creative effort based on these drawings belong to the protection scope of the present application.
[0087] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned accompanying drawings are used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product or equipment including a series of steps or units is not limited to the listed steps or units, but can optionally include steps or units not listed or can optionally include other steps or units inherent to the process, method, product or equipment.
[0088] Reference to“an embodiment” herein means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase“in one embodiment” in various places in the specification are not necessarily referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. As will be apparent to those of ordinary skill in the art, embodiments described herein can be combined with other embodiments.
[0089] The application discloses a text feature information recognition method and device, which can utilize a text vector model to perform comprehensive processing such as feature extraction processing, aggregation and extraction processing on text information, obtain industry category information and brand category information, is beneficial to judging the industry of the text while extracting the brand category information, and effectively extracts unknown brand categories through semantic information of context, thereby improving the recognition efficiency of text feature information. The following will be described in detail.
[0090] Embodiment one
[0091] Please refer to Figure 1 , Figure 1 is a flowchart of a text feature information recognition method disclosed by an embodiment of the application. Wherein, Figure 1 The text feature information recognition method described above is applied to a data processing system, such as a local server or a cloud server for text feature information recognition management, and the application embodiment is not limited. As shown in Figure 1 The text feature information recognition method can include the following operations:
[0092] 101, obtaining text information.
[0093] 102, utilizing a preset text vector model to perform feature extraction processing on the text information to obtain text feature vector information.
[0094] In the embodiment of the application, the text vector model includes a Transformer model.
[0095] 103, performing aggregation and extraction processing on the text feature vector information to obtain text feature information.
[0096] In the embodiment of the application, the text feature information includes industry category information and / or brand category information, and the application embodiment is not limited.
[0097] It can be seen that the text feature information recognition method described in the embodiments of the present application can utilize the text vector model to perform comprehensive processing such as feature extraction, aggregation and extraction on the text information, obtain the industry category information and the brand category information, is conducive to judging the industry of the text while extracting the brand category information, and effectively extracts the unknown brand category through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0098] In an optional embodiment, the aggregation and extraction processing of the character feature vector information in step 103 described above to obtain the text feature information comprises:
[0099] The aggregation processing of the character feature vector information obtains the industry category information; the industry category information represents the industry to which the text information belongs;
[0100] The classification labeling of the character feature vector information obtains the brand category information.
[0101] In this optional embodiment, as an optional implementation, the specific manner of the aggregation processing of the character feature vector information to obtain the industry category information described above is:
[0102] The character feature vector in the first order in the character feature vector information is selected as a sentence vector;
[0103] The sentence vector is input into the first neural network model to obtain the industry category information.
[0104] In this optional embodiment, as another optional implementation, the specific manner of the aggregation processing of the character feature vector information to obtain the industry category information described above is:
[0105] The average vector is obtained by averaging the character feature vector information;
[0106] The average vector is input into the first neural network model to obtain the industry category information.
[0107] It can be seen that the text feature information recognition method described in the embodiments of the present application can obtain the industry category information and the brand category information through the aggregation processing and classification labeling of the character feature vector information, is conducive to judging the industry of the text while extracting the brand category information, and effectively extracts the unknown brand category through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0108] In another optional embodiment, the aggregation processing of the character feature vector information to obtain the industry category information described above comprises:
[0109] The first initialization matrix and the second initialization matrix are obtained;
[0110] calculating the first initialization matrix and the character feature vector information to obtain a query vector;
[0111] calculating the second initialization matrix and the character feature vector information to obtain a key matrix;
[0112] determining the industry category information according to the query vector and the key matrix.
[0113] Optionally, the calculation of the first initialization matrix and the character feature vector information is the calculation of the character feature vector in the first order in the first initialization matrix and the character feature vector information.
[0114] Optionally, the dimension of the query vector is K.
[0115] Optionally, K is a positive integer greater than or equal to 1.
[0116] Optionally, the dimension of the key matrix is M*K.
[0117] It can be seen that the text feature information recognition method described in the embodiment of the application can obtain the industry category information through the calculation and processing of the character feature vector, which is beneficial to the extraction of the brand category information and the judgment of the industry of the text, and the unknown brand category can be effectively extracted through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0118] In another optional embodiment, the text vector model includes a first neural network model.
[0119] determining the industry category information according to the query vector and the key matrix, including:
[0120] performing inner product calculation on the query vector and the key matrix to obtain an attention vector;
[0121] performing normalization processing on the attention vector to obtain a weight vector;
[0122] processing the weight vector and the character feature vector information to obtain a classification vector;
[0123] determining the industry category information according to the first neural network model and the classification vector.
[0124] In this optional embodiment, as an optional implementation, the specific manner of performing normalization processing on the attention vector to obtain the weight vector is:
[0125] transposing the key matrix;
[0126] multiplying the query vector and the transposed key matrix to obtain the attention vector.
[0127] Optionally, the normalization of the attention vector is performed by using a softmax function.
[0128] Optionally, the weight vector has a higher weight for the character vector corresponding to the brand or category, and a lower weight for the character vector corresponding to other characters.
[0129] It can be seen that the text feature information recognition method described in the embodiments of the present application can obtain industry category information through comprehensive processing such as inner product calculation of the query vector and the key matrix, which is more conducive to judging the industry of the text while extracting brand and category information, and effectively extracting unknown brand and category information through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0130] In yet another optional embodiment, the text vector model further includes a second neural network model;
[0131] The text feature vector information is classified and labeled to obtain brand and category information, including:
[0132] The text feature vector information is classified by the second neural network model to obtain text category information;
[0133] The text category information is labeled to obtain brand and category information.
[0134] Optionally, the brand and category information includes category labels and / or text order information, which is not limited by the embodiments of the present application.
[0135] Optionally, the category labels include first brand labels, and / or second brand labels, and / or first category labels, and / or second category labels, and / or other category labels, which are not limited by the embodiments of the present application.
[0136] Optionally, the first brand label represents the starting character representing the brand in the text information.
[0137] Optionally, the first category label represents the starting character representing the category in the text information.
[0138] Optionally, the text category information includes text categories and / or text order information, which is not limited by the embodiments of the present application.
[0139] Optionally, the text categories include brand categories, and / or category categories, and / or other categories, which are not limited by the embodiments of the present application.
[0140] Optionally, the text categories include first labels and / or second labels, which are not limited by the embodiments of the present application.
[0141] Optionally, the first label and the second label of the other category are the same.
[0142] Optionally, the first label of the brand category is B-brand.
[0143] Optionally, the second label of the brand category is I-brand.
[0144] Optionally, the first label of the category category is B-cate.
[0145] Optionally, the second label of the category category is I-cate.
[0146] In this optional embodiment, as an optional implementation, the specific manner of labeling the text category information to obtain the brand category information is as follows:
[0147] Select the text information in the text information vector one by one according to the text order information in the text category information as a to-be-labeled character;
[0148] Determine whether the to-be-labeled character is a starting character of the category corresponding to the to-be-labeled character, to obtain a starting determination result;
[0149] When the starting determination result is yes, determine that the first label of the category corresponding to the to-be-labeled character is the category label of the to-be-labeled character;
[0150] When the starting determination result is no, determine that the second label of the category corresponding to the to-be-labeled character is the category label of the to-be-labeled character.
[0151] It can be seen that the text feature information recognition method described in the embodiment of the application can utilize the second neural network model to classify the text feature vector information, and obtain the brand category information through label labeling, which is more conducive to judging the industry of the text while extracting the brand category information, and effectively extracting unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0152] Embodiment Two
[0153] Please refer to Figure 2 , Figure 2 is a flowchart of another text feature information recognition method disclosed by the embodiment of the application. Among them, Figure 2 The text feature information recognition method described in the embodiment of the application is applied in a data processing system, such as a local server or a cloud server for text feature information recognition management, which is not limited by the embodiment of the application. As Figure 2 The text feature information recognition method can include the following operations:
[0154] 201、obtain text information.
[0155] 202、perform word splitting processing on the text information to obtain a character information vector.
[0156] In the embodiment of the present application, the character information vector includes M character information.
[0157] In the embodiment of the present application, M is a positive integer greater than or equal to 1.
[0158] 203、process the character information vector using a preset word vector to obtain a character matrix.
[0159] 204、process the character matrix using a Transformer model to obtain character feature vector information.
[0160] 205、perform aggregation and extraction processing on the character feature vector information to obtain text feature information.
[0161] In the embodiment of the present application, for the specific technical details and technical terms of steps 201 and 205, reference can be made to the detailed description of steps 101 and 103 in Embodiment One, and the present embodiment will not be described again.
[0162] Optionally, the word splitting processing on the text information is splitting the sentences in the text information at the word level.
[0163] Optionally, the splitting at the word level includes splitting of English characters, and / or splitting of numerical characters, and / or splitting of Chinese characters, and / or splitting of special characters, which is not limited in the present embodiment.
[0164] For example, the sentence "adidas shoes are hot-selling" in the text information is split into ["a", "d", "i", "d", "a", "s", "shoes", "are", "hot-selling"].
[0165] Optionally, the character matrix is an M*N matrix.
[0166] Optionally, N is a positive integer greater than or equal to 1.
[0167] In this optional implementation, as an optional implementation, the specific manner of processing the character information vector using a preset word vector to obtain a character matrix is as follows:
[0168] sequentially select the character information in the character information vector as a to-be-processed character in order;
[0169] extract a feature vector from the to-be-processed character using a preset word vector to obtain a character vector; the dimension of the character vector is N.
[0170] Integrate all the character vectors according to the arrangement order of the character information in the character information vector to obtain a character matrix.
[0171] Optionally, the character feature vector information includes M character feature vectors.
[0172] Optionally, the dimension of the character feature vector is L.
[0173] Optionally, L is a positive integer greater than or equal to 1.
[0174] It can be seen that the text feature information recognition method described in the embodiments of the present application can utilize the word vector and the Transformer model to perform comprehensive processing such as word splitting processing, aggregation and extraction processing on the text information, obtain industry category information and brand category information, is conducive to judging the industry of the text while extracting the brand category information, and effectively extracts unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0175] In an optional embodiment, the text vector model is obtained based on the following training steps:
[0176] Obtain a training sample set; the training sample set includes a plurality of training samples;
[0177] For any training sample, input the training sample into a preset text training model, and calculate and process using a preset cross-entropy loss function to obtain loss function value information; the loss function value information includes a first loss function value and a second loss function value; the first loss function value represents the function loss of the sub-training model for determining the industry category information; the second loss function value represents the function loss of the sub-training model for determining the brand category information;
[0178] Update the text training model;
[0179] Calculate and process the loss function value information to obtain a total loss function value;
[0180] Determine whether the total loss function value satisfies a training termination condition to obtain a loss determination result;
[0181] When the loss determination result is yes, the updated text training model is determined as the text vector model.
[0182] Optionally, the training termination condition includes that the total loss function value is less than or equal to a preset loss threshold, and / or the descending gradient of the total loss function value is less than or equal to a preset gradient threshold, which is not limited by the embodiments of the present application.
[0183] In the optional embodiment, as an optional implementation, the specific manner of judging whether the total loss function value satisfies the training termination condition to obtain the loss judgment result is as follows:
[0184] obtaining a historical total loss function value;
[0185] determining a descending gradient according to the historical total loss function value and the total loss function value;
[0186] judging whether the descending gradient is less than or equal to a preset gradient threshold to obtain a gradient judgment result;
[0187] when the gradient judgment result is yes, determining that the loss judgment result is yes.
[0188] It can be seen that the text feature information recognition method described in the embodiments of the present application can train the model by using the cross-entropy loss function to obtain the text vector model, which is more conducive to judging the industry of the text while extracting the brand category information, and effectively extracts the unknown brand category through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0189] Embodiment Three
[0190] Please refer to Figure 3 , Figure 3 is a structural schematic diagram of a text feature information recognition device disclosed by the embodiments of the present application. Among them, Figure 3 The device described in the embodiments of the present application can be applied to a data processing system, such as a local server or a cloud server for text feature information recognition management, and the embodiments of the present application are not limited. As shown in Figure 3 The device can include:
[0191] The acquisition module 301 is configured to acquire text information.
[0192] The first processing module 302 is configured to perform feature extraction processing on the text information by using a preset text vector model to obtain text feature vector information.
[0193] The second processing module 303 is configured to perform aggregation and extraction processing on the text feature vector information to obtain text feature information. The text feature information includes industry category information and / or brand category information.
[0194] It can be seen that the text feature information recognition device described in the embodiments of the present application can train the model by using the cross-entropy loss function to obtain the text vector model, which is more conducive to judging the industry of the text while extracting the brand category information, and effectively extracts the unknown brand category through the semantic information of the context, thereby improving the recognition efficiency of the text feature information. Figure 3The text feature information recognition device described can utilize a text vector model to perform comprehensive processing such as feature extraction processing, aggregation, and extraction processing on text information, obtain industry category information and brand category information, is conducive to judging the industry of the text while extracting brand category information, and effectively extracts unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of text feature information.
[0195] In another optional embodiment, as shown in Figure 4 The second processing module 303 aggregates and extracts the character feature vector information to obtain the specific manner of the text feature information as follows:
[0196] The character feature vector information is aggregated to obtain industry category information; the industry category information represents the industry to which the text information belongs;
[0197] The character feature vector information is classified and labeled to obtain brand category information.
[0198] As can be seen, the implementation Figure 4 The text feature information recognition device described can obtain industry category information and brand category information through aggregation and classification labeling of the character feature vector information, is conducive to judging the industry of the text while extracting brand category information, and effectively extracts unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of text feature information.
[0199] In yet another optional embodiment, as shown in Figure 4 The second processing module 303 aggregates the character feature vector information to obtain the specific manner of the industry category information as follows:
[0200] Obtain a first initialization matrix and a second initialization matrix;
[0201] Calculate the first initialization matrix and the character feature vector information to obtain a query vector;
[0202] Calculate the second initialization matrix and the character feature vector information to obtain a key matrix;
[0203] Determine the industry category information according to the query vector and the key matrix.
[0204] As can be seen, the implementation Figure 4 The text feature information recognition device described can obtain industry category information through calculation processing of the character feature vector, is conducive to judging the industry of the text while extracting brand category information, and effectively extracts unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of text feature information.
[0205] In yet another optional embodiment, asFigure 4 As shown, the text vector model includes a first neural network model;
[0206] The second processing module 303 determines the specific method for industry category information based on the query vector and key matrix as follows:
[0207] The attention vector is obtained by performing an inner product calculation on the query vector and the key matrix;
[0208] The attention vector is normalized to obtain the weight vector;
[0209] The weight vector and text feature vector information are processed to obtain the classification vector;
[0210] Based on the first neural network model and classification vector, industry category information is determined.
[0211] It is evident that implementation Figure 4 The described text feature information recognition device can obtain industry category information through comprehensive processing such as inner product calculation of query vector and key matrix. This is more conducive to judging the industry of text while extracting brand category information, and effectively extracting unknown brand categories through contextual semantic information, thereby improving the recognition efficiency of text feature information.
[0212] In yet another alternative embodiment, such as Figure 4 As shown, the text vector model also includes a second neural network model;
[0213] The second processing module 303 classifies and labels the text feature vector information to obtain brand category information in the following way:
[0214] The second neural network model is used to classify text features and obtain text category information.
[0215] Label the text category information to obtain brand category information.
[0216] It is evident that implementation Figure 4 The described text feature information recognition device can classify text by using a second neural network model to classify text feature vector information and obtain brand category information through label annotation. This is more conducive to judging the industry of the text while extracting brand category information, and effectively extracting unknown brand categories through contextual semantic information, thereby improving the recognition efficiency of text feature information.
[0217] In yet another alternative embodiment, such as Figure 4 As shown, the text vector model also includes the Transformer model;
[0218] The first processing module 302 performs feature extraction processing on the text information by using a preset text vector model to obtain text feature vector information, including:
[0219] The text information is subjected to word splitting processing to obtain text information vectors; the text information vectors include M text information; M is a positive integer greater than or equal to 1;
[0220] The text information vectors are processed by using a preset word vector to obtain a text matrix;
[0221] The text matrix is processed by using a Transformer model to obtain text feature vector information.
[0222] It can be seen that, in the implementation Figure 4 The described text feature information recognition device can perform comprehensive processing such as word splitting processing, aggregation, and extraction processing on text information by using a word vector and a Transformer model to obtain industry category information and brand category information, which is beneficial to judging the industry of the text while extracting brand category information and effectively extracting unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0223] In yet another optional embodiment, as Figure 4 The device further includes:
[0224] The training module 304 is configured to perform the following steps to train the text vector model:
[0225] Obtain a training sample set; the training sample set includes a plurality of training samples;
[0226] For any training sample, the training sample is input into a preset text training model, and a preset cross-entropy loss function is used for calculation processing to obtain loss function value information; the loss function value information includes a first loss function value and a second loss function value; the first loss function value represents the function loss of the sub-training model for determining the industry category information; and the second loss function value represents the function loss of the sub-training model for determining the brand category information;
[0227] The text training model is updated;
[0228] The loss function value information is calculated and processed to obtain a total loss function value;
[0229] Determine whether the total loss function value meets a training termination condition to obtain a loss determination result;
[0230] When the loss determination result is yes, the updated text training model is determined as the text vector model.
[0231] It can be seen that, in the implementationFigure 5 The described text feature information recognition device can train the model by using the cross-entropy loss function to obtain a text vector model, is more conducive to judging the industry of the text while extracting brand category information, and effectively extracts unknown brand categories through the semantic information of the context, thereby improving the recognition efficiency of the text feature information.
[0232] Embodiment four
[0233] Please refer to Figure 5 , Figure 5 is another structure diagram of the text feature information recognition device disclosed by the embodiment of the application. Among them, Figure 5 The described device can be applied to a data processing system, such as a local server or a cloud server for text feature information recognition management, and the embodiment of the application does not make any limitation. As shown in the figure, The device can include:
[0234] The memory 401 stores executable program codes;
[0235] The processor 402 is coupled to the memory 401;
[0236] The processor 402 calls the executable program codes stored in the memory 401, and is used to execute the steps in the text feature information recognition method described in embodiment one or embodiment two.
[0237] Embodiment five
[0238] The embodiment of the application discloses a computer readable storage medium which stores a computer program for electronic data exchange, wherein the computer program causes the computer to execute the steps in the text feature information recognition method described in embodiment one or embodiment two.
[0239] Embodiment six
[0240] The embodiment of the application discloses a computer program product, which includes a non-transitory computer readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute the steps in the text feature information recognition method described in embodiment one or embodiment two.
[0241] The device embodiments described above are only schematic, wherein the modules illustrated as separate components can or can not be physically separated, and the components illustrated as modules can or can not be physical modules, that is, they can be located in one place, or can be distributed on multiple network modules. According to actual needs, some or all of the modules can be selected to achieve the purpose of the embodiment scheme. Those skilled in the art can understand and implement without creative labor.
[0242] Through the specific description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software and the necessary general hardware platform, and of course, can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product in essence or in the form of a part of the prior art. The computer software product can be stored in a computer readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disk storage, a magnetic disk storage, a magnetic tape storage, or any other computer readable medium that can be used to carry or store data.
[0243] Finally, it should be noted that: the text feature information recognition method and device disclosed by the embodiments of the present application are only the preferred embodiments of the present application, and are used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method of recognizing text feature information, characterized by, The method comprises: acquiring text information; performing feature extraction processing on the text information by using a preset text vector model to obtain text feature vector information; performing aggregation and extraction processing on the text feature vector information to obtain text feature information; the text feature information comprises industry category information and brand category information; and the aggregation and extraction processing on the text feature vector information to obtain text feature information comprises: performing aggregation processing on the text feature vector information to obtain the industry category information; the industry category information represents an industry to which the text information belongs; performing classification labeling on the text feature vector information to obtain the brand category information; and the text vector model comprises a first neural network model; and the aggregation processing on the text feature vector information to obtain the industry category information comprises: selecting a text feature vector in a first order in the text feature vector information as a sentence vector; inputting the sentence vector into the first neural network model to obtain the industry category information; or performing average calculation on the text feature vector information to obtain an average vector; inputting the average vector into the first neural network model to obtain the industry category information; and the text vector model further comprises a second neural network model; the classification labeling on the text feature vector information to obtain the brand category information comprises: performing text classification on the text feature vector information by using the second neural network model to obtain text category information; performing label labeling on the text category information to obtain the brand category information; and the label labeling on the text category information to obtain the brand category information comprises: selecting text information in the text information vector one by one according to text order information in the text category information as a to-be-labeled character; determining whether the to-be-labeled character is a start character of a category corresponding to the to-be-labeled character to obtain a start determination result; when the start determination result is yes, determining a first label of the category corresponding to the to-be-labeled character as a category label of the to-be-labeled character; when the start determination result is no, determining a second label of the category corresponding to the to-be-labeled character as the category label of the to-be-labeled character.
2. The text feature information recognition method according to claim 1, characterized by, The text vector model further comprises a Transformer model; the feature extraction processing on the text information by using the preset text vector model to obtain text feature vector information comprises: performing word splitting processing on the text information to obtain a text information vector; the text information vector comprises M pieces of text information; M is a positive integer greater than or equal to 1; processing the text information vector by using a preset word vector to obtain a text matrix; processing the text matrix by using the Transformer model to obtain text feature vector information; and the processing of the text information vector by using the preset word vector to obtain the text matrix comprises: selecting text information in the text information vector in turn as to-be-processed text; The character vector is obtained by performing feature vector extraction on the to-be-processed text using a preset character vector; the dimension of the character vector is N; The character vectors are integrated according to the arrangement order of the character information in the character information vector to obtain a character matrix.
3. The text feature information recognition method according to claim 1, characterized by, The text vector model is obtained based on the following training steps: A training sample set is obtained; the training sample set includes a plurality of training samples; For any training sample, the training sample is input into a preset text training model, and a preset cross-entropy loss function is used for calculation and processing to obtain loss function value information; the loss function value information includes a first loss function value and a second loss function value; the first loss function value represents the function loss of a sub-training model for determining the industry category information; the second loss function value represents the function loss of a sub-training model for determining the brand category information; The text training model is updated; The loss function value information is calculated and processed to obtain a total loss function value; It is determined whether the total loss function value meets a training termination condition to obtain a loss determination result; When the loss determination result is yes, the updated text training model is determined as the text vector model; Furthermore, the determination of whether the total loss function value meets the training termination condition to obtain the loss determination result includes: A historical total loss function value is obtained; A descending gradient is determined according to the historical total loss function value and the total loss function value; It is determined whether the descending gradient is less than or equal to a preset gradient threshold to obtain a gradient determination result; When the gradient determination result is yes, the loss determination result is determined as yes.
4. A text feature information recognizing apparatus characterized by comprising: The device includes: An acquisition module configured to acquire text information; A first processing module configured to perform feature extraction processing on the text information using a preset text vector model to obtain character feature vector information; A second processing module configured to perform aggregation and extraction processing on the character feature vector information to obtain text feature information; the text feature information includes industry category information and brand category information; Furthermore, the specific manner in which the second processing module performs aggregation and extraction processing on the character feature vector information to obtain text feature information includes: The industry category information is obtained by performing aggregation processing on the character feature vector information; the industry category information represents the industry to which the text information belongs; The brand category information is obtained by performing classification labeling on the character feature vector information; Furthermore, the text vector model includes a first neural network model; Furthermore, the specific manner in which the second processing module performs aggregation processing on the character feature vector information to obtain the industry category information includes: A first-order character feature vector in the character feature vector information is selected as a sentence vector; The sentence vector is input into the first neural network model to obtain the industry category information; or An average vector is obtained by performing average calculation on the character feature vector information; The average vector is input into the first neural network model to obtain the industry category information; Furthermore, the text vector model also includes a second neural network model; The second processing module classifies and labels the text feature vector information, and the specific manner of obtaining the brand category information is: performing text classification on the text feature vector information by using the second neural network model to obtain text category information; performing label annotation on the text category information to obtain the brand category information; and the specific manner of obtaining the brand category information by the second processing module performing label annotation on the text category information is: selecting text information in the text information vector one by one as a to-be-labeled character according to text order information in the text category information; determining whether the to-be-labeled character is a starting character of a category corresponding to the to-be-labeled character to obtain a starting determination result; when the starting determination result is yes, determining a first label of the category corresponding to the to-be-labeled character as a category label of the to-be-labeled character; when the starting determination result is no, determining a second label of the category corresponding to the to-be-labeled character as the category label of the to-be-labeled character.
5. A text feature information recognizing apparatus characterized by comprising: The device comprises: a memory storing executable program codes; a processor coupled with the memory; the processor invokes the executable program codes stored in the memory to execute the text feature information recognition method according to any one of claims 1-3.
6. A computer storable medium, characterized by The computer storage medium stores computer instructions, and the computer instructions are invoked to execute the text feature information recognition method according to any one of claims 1-3.
Citation Information
Patent Citations
Text classification method and device, computer equipment and storage medium
CN109918499A
Semi-structure text classification scheme based on graph attention
CN113312477A