Category analysis method, device, equipment and storage medium

By using the automatic category analysis method based on word vector tables and machine classification models in the e-commerce platform, the problem of low efficiency of product category analysis in the e-commerce platform is solved, automatic identification of product categories is achieved, labor costs are reduced, and detection efficiency is improved. efficiency.

CN113762998BActive Publication Date: 2024-10-22BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010757954.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-31
Publication Date
2024-10-22
Estimated Expiration
2040-07-31

AI Technical Summary

Technical Problem

The efficiency of product category analysis on e-commerce platforms is low, resulting in a waste of human resources and the inability to effectively supervise the listing of illegal or risky products.

Method used

Using a category analysis method based on a preset word vector table and a pre-trained machine classification model, the text data is obtained to determine the word sequence vector, and the self-attention processing layer and neural network layer are used for information fusion and processing to automatically identify product categories. Replace manual inspection.

Benefits of technology

It realizes automatic identification of product categories, reduces labor costs, improves detection efficiency, and reduces the risk of illegal or risky products being put on the shelves.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113762998B_ABST
    Figure CN113762998B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a category analysis method, device, equipment and storage medium, which obtains the text data of the object to be identified, determines the word sequence vector corresponding to the text data based on a preset word vector table, and then inputs the word sequence vector into a pre-trained machine classification model for processing to obtain the category probability distribution corresponding to the object to be identified, and finally determines the category to which the object to be identified belongs based on the category probability distribution. This technical solution uses a natural language processing algorithm to replace the detection of black and gray product inspectors, realizes the automatic identification of product categories, does not require human participation, reduces labor costs, and improves detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of Internet technology, and in particular to a category analysis method, apparatus, device, and storage medium. Background Art

[0002] With the continuous development of science and technology, online shopping has become increasingly popular, allowing people to purchase the goods they need without leaving their homes, bringing great convenience to people's lives. However, this also provides some businesses with opportunities to sell illegal and / or risky goods online, posing a risk to e-commerce platforms.

[0003] In the existing technology, product category analysis on e-commerce platforms mainly relies on manual screening by dedicated inspectors. Specifically, dedicated inspectors conduct category analysis on newly added products on the e-commerce platform every day to prevent illegal products from being put on the shelves or reduce the probability of risky products being put on the shelves.

[0004] In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: since a large number of products are put on the shelves on the e-commerce platform every day, a large amount of manpower is required to analyze the categories of these products, resulting in low analysis efficiency and waste of human resources. Summary of the Invention

[0005] The embodiments of the present application provide a category analysis method, apparatus, device, and storage medium to solve the problems of low analysis efficiency and waste of human resources in existing object category analysis methods.

[0006] In a first aspect, an embodiment of the present application provides a category analysis method, comprising:

[0007] Obtain text data of the object to be identified;

[0008] Determining a word sequence vector corresponding to the text data based on a preset word vector table;

[0009] Inputting the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified;

[0010] The category to which the object to be identified belongs is determined according to the category probability distribution.

[0011] In a possible design of the first aspect, determining the word sequence vector corresponding to the text data based on a preset word vector table includes:

[0012] Performing word segmentation processing on the text data to obtain at least one word corresponding to the text data;

[0013] According to the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table;

[0014] A word sequence vector corresponding to the text data is obtained according to the encoding information of the at least one word in the word vector table.

[0015] In another possible design of the first aspect, the machine classification model includes: a self-attention processing layer and a neural network layer connected to each other;

[0016] The step of inputting the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified includes:

[0017] Using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector;

[0018] The neural network layer is used to extract and process information from the self-attention result to obtain the category probability distribution corresponding to the object to be identified.

[0019] Optionally, the using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain the self-attention result of the word sequence vector includes:

[0020] Using at least three network models in the preset self-attention processing layer to process the word sequence vector respectively to obtain at least three word sequence matrices, wherein the at least three network models are of the same type but have different parameters;

[0021] Calculating the correlation of word vectors in each sequence matrix based on at least two of the at least three word sequence matrices to obtain a word correlation matrix;

[0022] A self-attention result of the word sequence vector is calculated according to the word correlation matrix and a target word sequence matrix in the at least three word sequence matrices, wherein the target word sequence matrix is ​​different from the at least two word sequence matrices.

[0023] Optionally, the neural network layer includes: a feedforward network layer, a pooling layer and a fully connected layer;

[0024] The using the neural network layer to extract and process information from the self-attention result to obtain a category probability distribution corresponding to the object to be identified includes:

[0025] Processing the self-attention result using the feedforward network layer to obtain an updated word sequence vector corresponding to the word sequence vector;

[0026] Using the pooling layer to perform feature extraction on the updated word sequence vector to obtain a representation word sequence vector corresponding to the text data;

[0027] The fully connected layer is used to perform dimension-weighted summation and normalization processing on the representation word sequence vector to obtain the category probability distribution corresponding to the object to be identified.

[0028] In another possible design of the first aspect, the method further includes:

[0029] Acquire a text data set with labeled object categories, wherein the text data set includes a plurality of text data corresponding to preset object categories;

[0030] Based on a preset word segmentation rule, each piece of text data in the text data set is segmented to obtain a word set corresponding to the text data set;

[0031] The word vector table is generated according to the word set corresponding to the text data set and the terms input from the outside, and each word in the word vector table has a unique code.

[0032] Optionally, the method further includes:

[0033] Determine, according to the word vector table, a word sequence annotation vector corresponding to each text annotation data in the text dataset;

[0034] The word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the labeled object category corresponding to the text annotation data is used as the output, and the preset network is trained to obtain the machine classification model.

[0035] In a second aspect, an embodiment of the present application provides a category analysis device, comprising: an acquisition module, a first processing module, a second processing module, and a determination module;

[0036] The acquisition module is used to acquire text data of the object to be identified;

[0037] The first processing module is used to determine the word sequence vector corresponding to the text data based on a preset word vector table;

[0038] The second processing module is used to input the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified;

[0039] The determination module is used to determine the category to which the object to be identified belongs based on the category probability distribution.

[0040] In a possible design of the second aspect, the first processing module is specifically configured to:

[0041] Performing word segmentation processing on the text data to obtain at least one word corresponding to the text data;

[0042] According to the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table;

[0043] A word sequence vector corresponding to the text data is obtained according to the encoding information of the at least one word in the word vector table.

[0044] In another possible design of the second aspect, the machine classification model includes: a self-attention processing layer and a neural network layer connected to each other;

[0045] The second processing module is specifically configured to:

[0046] Using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector;

[0047] The neural network layer is used to extract and process information from the self-attention result to obtain the category probability distribution corresponding to the object to be identified.

[0048] Optionally, the second processing module is configured to use the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector, specifically:

[0049] The second processing module is specifically configured to:

[0050] Using at least three network models in the preset self-attention processing layer to process the word sequence vector respectively to obtain at least three word sequence matrices, wherein the at least three network models are of the same type but have different parameters;

[0051] Calculating the correlation of word vectors in each sequence matrix based on at least two of the at least three word sequence matrices to obtain a word correlation matrix;

[0052] A self-attention result of the word sequence vector is calculated according to the word correlation matrix and a target word sequence matrix in the at least three word sequence matrices, wherein the target word sequence matrix is ​​different from the at least two word sequence matrices.

[0053] Optionally, the neural network layer includes: a feedforward network layer, a pooling layer and a fully connected layer;

[0054] The second processing module is used to extract and process information from the self-attention result using the neural network layer to obtain the category probability distribution corresponding to the object to be identified, specifically:

[0055] The second processing module is specifically configured to:

[0056] Processing the self-attention result using the feedforward network layer to obtain an updated word sequence vector corresponding to the word sequence vector;

[0057] Using the pooling layer to perform feature extraction on the updated word sequence vector to obtain a representation word sequence vector corresponding to the text data;

[0058] The fully connected layer is used to perform dimension-weighted summation and normalization processing on the representation word sequence vector to obtain the category probability distribution corresponding to the object to be identified.

[0059] In another possible design of the second aspect, the acquisition module is further configured to acquire a text dataset of labeled object categories, wherein the text dataset includes a plurality of text data corresponding to preset object categories.

[0060] The first processing module is further configured to:

[0061] Based on a preset word segmentation rule, each piece of text data in the text data set is segmented to obtain a word set corresponding to the text data set;

[0062] The word vector table is generated according to the word set corresponding to the text data set and the terms input from the outside, and each word in the word vector table has a unique code.

[0063] Optionally, the second processing module is further configured to:

[0064] Determine, according to the word vector table, a word sequence annotation vector corresponding to each text annotation data in the text dataset;

[0065] The word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the labeled object category corresponding to the text annotation data is used as the output, and the preset network is trained to obtain the machine classification model.

[0066] In a third aspect, an embodiment of the present application further provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in the first aspect and various possible designs is implemented.

[0067] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and each possible design.

[0068] The category analysis method, apparatus, device, and storage medium provided in the embodiments of the present application obtain text data of an object to be identified, determine the word sequence vector corresponding to the text data based on a preset word vector table, and then input the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified. Finally, based on the category probability distribution, the category to which the object to be identified belongs is determined. This technical solution uses an NLP algorithm to replace the inspection of black and gray commodity inspectors, achieving automatic identification of commodity categories without the need for human participation, reducing labor costs, and improving inspection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0070] Figure 1 This is a schematic diagram of the application scenario of the category analysis method provided by this application;

[0071] Figure 2 A flow chart of the first embodiment of the category analysis method provided in this application;

[0072] Figure 3 A flow chart of the second embodiment of the category analysis method provided in this application;

[0073] Figure 4 A flow chart of the third embodiment of the category analysis method provided in this application;

[0074] Figure 5 A flow chart of the fourth embodiment of the category analysis method provided in this application;

[0075] Figure 6 A schematic diagram of the structure of an embodiment of a category analysis device provided in an embodiment of the present application;

[0076] Figure 7 A schematic diagram of the structure of an electronic device embodiment for executing a category analysis method provided in an embodiment of the present application.

[0077] The above drawings illustrate specific embodiments of the present disclosure, which will be described in more detail below. These drawings and textual descriptions are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0078] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.

[0079] First, the terms involved in the embodiments of this application are explained:

[0080] Black and gray products: Black products and gray products. Black products refer to products that are prohibited from sale by national law, such as e-cigarettes and protected wild animals. Gray products are products that are prone to industrial and commercial complaints and disputes, such as IoT cards.

[0081] The Transformer model is a model structure based on the self-attention mechanism. It is widely used in the field of natural language processing (NLP) and can be applied to machine translation, question-answering systems, text summarization, speech recognition, and other fields. Based on this attention mechanism, the Transformer can combine contextual information to obtain richer semantic information.

[0082] Convolutional neural networks (CNNs) are a type of feedforward neural networks that include convolutional calculations and have a deep structure. They are one of the representative algorithms of deep learning. They include an input layer, a hidden layer, and an output layer. The hidden layer includes a convolutional layer, a pooling layer, and a fully connected layer.

[0083] Jieba word segmentation tool (jieba.load_userdict): Jieba word segmentation tool method, which can add custom dictionaries.

[0084] Relu: is a nonlinear activation function.

[0085] Softmax function: also known as the normalized exponential function (applicable to multi-classification), aims to present multi-classification results in the form of probabilities. The first step of the Softmax function is to transform the model's prediction results into an exponential function, which ensures the non-negativity of the probabilities. The second step is to divide the transformed results by the sum of all transformed results (the sum of the probabilities of various prediction results is equal to 1), that is, the percentage of the transformed results in the total number, thus obtaining an approximate probability.

[0086] For example, Figure 1 This is a schematic diagram of the application scenario of the category analysis method provided by this application. Figure 1 As shown, the application scenario may include: at least one terminal device ( Figure 1 Three terminal devices are shown, namely terminal device 111, terminal device 112, and terminal device 113), network 12, and server 13. Each terminal device and server 13 can communicate through network 12. Optionally, Figure 1 The illustrated application scenario may also include a data storage device 14 connected to the server 13 .

[0087] For example, in Figure 1 In the application scenario shown, the server 13 can obtain the text data of the object to be identified from the network 12 and store it in the data storage device 14 so that it can be directly used in the subsequent clustering analysis of the text data. The server 13 can also receive the text data set sent by the user through the terminal device through the network 12, identify the object corresponding to the text data set, and store the processing result in the data storage device 14.

[0088] In this embodiment, the data storage device 14 can store a large number of text data sets for category analysis, and can also store the processing results of the server 13. The server 13 can execute the program code of the category analysis method based on the text data of the object to be identified in the data storage device 14 to determine the category to which the object to be identified belongs.

[0089] It should be noted that the attached Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 The equipment included in the Figure 1 The positional relationship between the devices in the Figure 1 In the embodiment, the data storage device 14 can be an external memory relative to the server 13. In other cases, the data storage device 14 can also be placed in the server 13.

[0090] In actual applications, since the terminal device is also a processing device with data processing capabilities, the above Figure 1 The server in the application scenario shown can also be implemented by a terminal device. In the embodiments of the present application, the server and terminal device with category analysis capabilities can be collectively referred to as electronic devices. Optionally, the embodiments of the present application are explained with the execution subject of the category analysis method as an electronic device.

[0091] For example, a specific application scenario of the embodiment of the present application may be as follows:

[0092] With the development of technology, the internet has brought about tremendous changes in people's lives. E-commerce, in particular, has enabled people to buy goods from all over the world without leaving their homes, bringing immense convenience to people's lives. However, this has also created opportunities for some businesses to profit from selling illegal and illicit goods online (illegal goods refer to products prohibited by national law, such as e-cigarettes and protected wild animals; illicit goods refer to products prone to industrial and commercial complaints and disputes, such as Internet of Things cards).

[0093] In practice, e-commerce platforms must establish a healthy ecosystem and mitigate the risks of illegal and regulated products. Currently, these platforms manage illegal and shady products by conducting daily product listing inspections, blocking and removing illegal products, and restricting advertising and marketing activity reporting for shady products. This reduces the sale of illegal and / or risky products.

[0094] Currently, the detection of illicit and fraudulent products on e-commerce platforms relies primarily on dedicated inspectors. These inspectors inspect newly added products daily, labeling any identified products and administering specific procedures. However, due to the large number of merchants on e-commerce platforms, each potentially releasing a massive volume of products daily, e-commerce platforms require a significant workforce to conduct these inspections, resulting in inefficient inspections and a high human resource burden.

[0095] In order to solve the above problems, the invention concept of the technical solution of this application is as follows: In actual applications, the inventors found that pre-trained word vectors are a key component of many natural language understanding models. Embedding them into the model at the input layer can effectively improve the performance of the model. In addition, models based on the attention mechanism have shined in the field of natural language understanding, and have achieved great success in a series of tasks from intelligent question answering, machine translation, speech recognition to image subtitles. As a result, the Transformer network structure model has evolved. Based on this, in order to solve the problems of low efficiency in detecting black and gray products on e-commerce platforms and excessive human resource investment, the inventors of this application thought about whether it is possible to mine product title data based on the properties of the Transformer and CNN model structures to determine whether the product is a black and gray product.

[0096] Based on the above technical concept, an embodiment of the present application provides a category analysis method. By obtaining the text data of the object to be identified, based on a preset word vector table, the word sequence vector corresponding to the text data is determined. The word sequence vector is then input into a pre-trained machine classification model for processing to obtain the category probability distribution corresponding to the object to be identified. Finally, based on the category probability distribution, the category to which the object to be identified belongs is determined. This technical solution uses an NLP algorithm to replace the inspection of black and gray product inspectors, realizing the automatic identification of product categories without the need for human participation, reducing labor costs and improving inspection efficiency.

[0097] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0098] Figure 2 This is a flow chart of the first embodiment of the category analysis method provided in this application. Figure 2 As shown, the category analysis method may include the steps of:

[0099] S201: Acquire text data of an object to be recognized.

[0100] In an embodiment of the present application, for a given service platform (e.g., an e-commerce website), when a category identification requirement is requested for an object, the electronic device can obtain the text data of the object to be identified from the service platform or a storage location storing the object's text data. Typically, one piece of text data can be used to describe one object to be identified.

[0101] For example, in an application scenario of an e-commerce platform, the text data of the object to be identified may refer to product title data, and the category of the product may be determined by analyzing the product title data.

[0102] It is understandable that the electronic device may also simultaneously obtain multiple pieces of text data of multiple objects to be identified, and then process each piece of text data in turn.

[0103] S202: Determine the word sequence vector corresponding to the text data based on a preset word vector table.

[0104] Optionally, after obtaining the text data of the object to be identified, the electronic device can first perform word segmentation on the text data, then determine the encoding information of each word in a preset word vector table, obtain the word vector corresponding to the text data, and finally perform pooling on the word vector according to a preset method to obtain the word sequence vector corresponding to the text data.

[0105] Optionally, the specific implementation principle of this step can be found in the following Figure 3 The description of the illustrated embodiments will not be repeated here.

[0106] S203: Input the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified.

[0107] In an embodiment of the present application, a pre-trained machine classification model is loaded on the electronic device. The machine classification model is obtained by training a preset network using text annotation data of multiple objects of different categories. Its input is text annotation data of multiple objects of different categories, and its output is probability information of the category to which the object belongs.

[0108] Specifically, when the electronic device obtains the word sequence vector corresponding to the text data of the object to be identified, the word sequence vector is input into the machine classification model, and the machine classification model is used to perform information fusion, information extraction and information processing on the word sequence vector, and finally the category probability distribution corresponding to the object to be identified can be output.

[0109] Exemplarily, the machine classification model can determine the probability information of the object to be identified belonging to each category based on the number of possible categories determined during training.

[0110] For the specific implementation principle of this step, please refer to the following Figure 4 The description of the illustrated embodiments will not be repeated here.

[0111] S204: Determine the category to which the object to be identified belongs based on the above category probability distribution.

[0112] In the embodiments of the present application, the electronic device can determine the probability that the object to be identified belongs to each category based on the above-mentioned category probability distribution. In practical applications, after the possible category of the object to be identified is determined, the sum of the probabilities of all possible categories equals 1. Therefore, the probabilities of all possible categories to which the object to be identified may be compared, and the category with the highest probability is determined as the category to which the object to be identified belongs.

[0113] For example, assuming the object to be identified is a commodity, and commodities are categorized as normal commodities, black commodities, and gray commodities, the sum of the probabilities of the commodity being a normal commodity, a black commodity, and a gray commodity is equal to 1. Therefore, for a commodity to be identified, if the probability of the commodity being a normal commodity is 0.6, the probability of the commodity being a gray commodity is 0.3, and the probability of the commodity being a black commodity is 0.1, the commodity to be identified is determined to be a normal commodity.

[0114] The category analysis method provided in the embodiment of the present application obtains the text data of the object to be identified, determines the word sequence vector corresponding to the text data based on a preset word vector table, then inputs the word sequence vector into a pre-trained machine classification model for processing to obtain the category probability distribution corresponding to the object to be identified, and finally determines the category to which the object to be identified belongs based on the category probability distribution. In this technical solution, during the detection process, the category analysis of the object can be automatically performed based on the pre-trained machine classification model, without the need for human intervention, thereby improving detection efficiency and reducing labor costs.

[0115] Based on the above embodiments, Figure 3 This is a flow chart of the second embodiment of the category analysis method provided in this application. Figure 3 As shown, in this embodiment, the above S202 can be implemented by the following steps:

[0116] S301: Perform word segmentation processing on the above text data to obtain at least one word corresponding to the text data.

[0117] In an embodiment of the present application, preset word segmentation rules may be pre-stored in the electronic device, so that after the electronic device obtains the text data of the object to be identified, it can perform word segmentation processing on the text data based on the preset word segmentation rules to obtain at least one word corresponding to the text data.

[0118] Optionally, the word segmentation rules may include non-segmentation in vertical fields, text segmentation, etc. For example, in this embodiment, the electronic device first identifies professional vocabulary in the vertical field. For example, if the text data contains medical terms such as "seborrheic alopecia," "pityriasis rosea," "identity reader," "hpv vaccine," "Taoist spell," etc., and these terms can largely distinguish the semantics of the text, then when segmenting the text data, it is determined that some specified words will not be segmented, and the text data, except for the specified non-segmented words, is segmented according to the semantics of the words.

[0119] Optionally, in an embodiment of the present application, the electronic device can use the Jieba word segmentation tool to add accumulated professional vocabulary to achieve the purpose of not segmenting words in vertical fields.

[0120] Optionally, in an embodiment of the present application, before step S301, the electronic device may further perform the following processing on the text data:

[0121] The text data is preprocessed to delete preset attribute content appearing in the text data, where the preset attribute content includes at least one of the following: stop words, annotation words, and symbols.

[0122] Optionally, stop words are usually not keywords in a sentence. They not only take up a lot of computing and storage resources, but also cause semantic confusion to a large extent. For example, meaningless words such as "you", "I", "of", "le", "guo", etc., therefore, these words can be removed before word segmentation of the text.

[0123] In this embodiment, the symbol may be a single symbol, such as "&", "%", etc., or it may be a combination of various symbols, numbers, and letters, such as a link. An annotation word may be a word used to explain a certain term, or it may be content such as certain numbers that have little relevance to the text content and can therefore be deleted.

[0124] S302: Based on the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table.

[0125] In an embodiment of the present application, the preset word vector table is obtained based on open source pre-trained word vectors and a corpus, and each word vector has unique encoding information. Exemplarily, the number of columns in the word vector table is the same as the dimension of the corpus, and the number of rows in the word vector table is consistent with the number of words contained in the word set corresponding to the training data participating in the establishment of the word vector table. Therefore, in this embodiment, each word corresponds to a row vector.

[0126] Optionally, for at least one word corresponding to the text data, a preset word vector table is first queried to determine the encoding information (i.e., index information) of each word in the word vector table. Optionally, for words in the text data that do not appear in the word vector table, a random word "null" is used to fill in the gaps, and the corresponding encoding information is an empty vector.

[0127] S303. Obtain a word sequence vector corresponding to the text data based on encoding information of at least one word in the word vector table.

[0128] Optionally, the electronic device may first determine the word vector corresponding to each word based on the encoding information of each word in the word vector table, and then determine the order sequence vector corresponding to the text data according to a preset word sequence length.

[0129] For example, assuming the word vector table has 300 columns and the word sequence length is set to S, then for text data with more than S words, the word sequence vector corresponding to the text data is determined based on the word vectors corresponding to the first S words in the text data. For text data with less than S words, the ends of the direct words are padded with a random word "pos", and the encoding information corresponding to the random word "pos" is an empty vector. Thus, a word sequence vector of size S*300 is obtained.

[0130] For example, Table 1 is a distribution table of word sequence vectors corresponding to text data. As shown in Table 1, for the S words corresponding to the text data, by querying the pre-trained word vectors, the word vector corresponding to each word can be determined separately. Based on the word vectors corresponding to all words, the word sequence vector corresponding to the text data can be determined.

[0131] Table 1 Distribution table of word sequence vectors corresponding to text data

[0132]

[0133] It can be understood that, in this embodiment, the random word "pos" and the random word "null" are both used to represent a null vector, and the difference between them is only in the circumstances under which they are added.

[0134] Exemplarily, in an embodiment of the present application, the above steps S302 and S303 can be specifically implemented using an embedding layer (Embedding) network, and the word sequence vector corresponding to the text data can be obtained by inputting the segmented text data into the embedding layer network.

[0135] The category analysis method provided in the embodiments of the present application performs word segmentation on text data to obtain at least one word corresponding to the text data, then queries a preset word vector table to determine the encoding information of each word in the word vector table, and finally obtains the word sequence vector corresponding to the text data based on the encoding information of the at least one word in the word vector table. In this technical solution, the word sequence vector corresponding to the text data is determined using a preset word vector table, which enriches the semantic representation capability of the word vector, can improve the performance of the model, and lays the foundation for subsequent classification of the object to be identified.

[0136] Based on any of the above embodiments, Figure 4 This is a flow chart of Example 3 of the category analysis method provided in this application. In this embodiment, the machine classification model may include: a self-attention processing layer and a neural network layer connected to each other. Exemplarily, the self-attention processing layer adopts a Transformer model, and the neural network layer adopts a CNN model. Therefore, the machine classification model can be a Transformer+CNN model structure, which combines the advantages of Transformer and CNN and can better improve the model effect.

[0137] Specifically, such as Figure 4 As shown, the above S203 can be implemented by the following steps:

[0138] S401. Use the self-attention processing layer to fuse the word vectors included in the word sequence vector to obtain the self-attention result of the word sequence vector.

[0139] In an embodiment of the present application, the self-attention processing layer is a Transformer model based on the Attention mechanism. When processing each word vector in the word sequence vector, it can take into account the context information of the word vector, fuse the semantic information represented by the word sequence vector, and use the Attention mechanism to obtain the self-attention result of the word sequence vector.

[0140] Exemplarily, step S401 may be implemented by the following steps:

[0141] A1. Use at least three network models in the preset self-attention processing layer to process the word sequence vectors respectively to obtain at least three word sequence matrices.

[0142] Among them, at least three network models are of the same type but have different parameters.

[0143] Exemplarily, the self-attention processing layer may include at least three network models, which may be independent models of the same type but with different parameters, or may be multiple models with a mutual dependency relationship, for example, the latter model is formed by adding a network layer on the basis of the previous model. The embodiment of the present application does not limit the implementation method of each network model in the self-attention processing layer. Optionally, the at least three network models in this embodiment can be regarded as at least three weight matrices of the word sequence vector.

[0144] Optionally, assume that the preset self-attention processing layer includes three network models, and the corresponding model parameters are W k and b k 、W q and b q 、W v and b v Among them, W k 、W q 、W v They are the parameter matrices of the three models, b k 、b q 、b v are the offsets in the three models respectively. Generally, there is at least one parameter different between any two of the three network models.

[0145] It is understandable that W k 、W q 、W v The number of rows in E is the same as the number of columns in E. Usually, W k 、W q 、W v and E are matrices of the same dimension.

[0146] For example, the function corresponding to each of the above network models can be expressed by the linear rectifier function Relu, and the Relu function is expressed by the formula Characterization, therefore, using W k and b k The weighted sum of each dimension of the single word vector in the word sequence vector E is re-extracted and converted into a word sequence matrix K (also called a new word sequence vector), that is, K = relu (EW k +b k ).

[0147] Similarly, using W q and b q The weighted sum of each dimension of a single word vector in the word sequence vector E can be converted into a word sequence matrix Q (also called a new word sequence vector), that is, Q = relu (EW q +b q ). Using W v and b v The weighted sum of each dimension of a single word vector in the word sequence vector E can be converted into a word sequence matrix V (also called a new word sequence vector), that is, V = relu (EW v +b v ).

[0148] A2. Calculate the correlation of word vectors in each sequence matrix based on at least two of the at least three word sequence matrices to obtain a word correlation matrix.

[0149] In an embodiment of the present application, after determining at least two word sequence matrices among the at least three word sequence matrices, a word correlation matrix can be obtained by performing a dot product operation on each of the word sequence matrices.

[0150] For example, for the above word sequence matrix K, Q, V, first Q, K T Perform a dot product operation to calculate the correlation between the two word vectors in the word sequence matrix K and Q, and obtain the word correlation matrix S*S.

[0151] For example, the electronic device may also use a softmax function to normalize the word correlation matrix S*S to obtain a normalized word correlation matrix. It is understood that in the normalized word correlation matrix, the larger the element value, the more correlated the two word vectors are.

[0152] A3. Calculate the self-attention result of the word sequence vector according to the word correlation matrix and the target word sequence matrix in at least three word sequence matrices, where the target word sequence matrix is ​​different from the at least two word sequence matrices.

[0153] Optionally, in an embodiment of the present application, the above-mentioned word correlation matrix is ​​obtained by performing correlation operations on at least two word sequence matrices among at least three word sequence matrices. In order to obtain the self-attention result of the word sequence vector, the target word sequence matrix in at least three word sequence matrices can be information fused according to the correlation between the word vectors in the word correlation matrix to obtain the self-attention result of the word sequence vector.

[0154] For example, for the above word sequence matrices K, Q, and V, after obtaining the word correlation matrix S*S, the word sequence matrix V can be used to perform weighted summation on each word vector in the correlation matrix S*S to obtain the attention result A, which is equivalent to a word vector A in the attention result A. i The word vector A is obtained by weighting other word vectors. i This is equivalent to being represented by all word vectors in the word sequence vector, integrating information from other word vectors and having rich semantic information. Optionally, the formula for obtaining the attention result A based on the word sequence matrices K, Q, and V is as follows:

[0155]

[0156] Where d is the dimension of the word sequence matrix. For example, for a word sequence vector of S*300, the value of d is 300.

[0157] S402: Use the neural network layer to extract and process information from the self-attention results to obtain the category probability distribution corresponding to the object to be identified.

[0158] Optionally, the neural network layer is obtained by training certain layers in CNN, and is mainly used to extract and process information from the self-attention results to ensure that the category probability distribution corresponding to the object to be identified is output.

[0159] For example, in an embodiment of the present application, the neural network layer includes: a feedforward network layer, a pooling layer, and a fully connected layer. Accordingly, step S402 can be implemented by the following steps:

[0160] B1. Use the feedforward network layer to process the self-attention results to obtain the updated word sequence vector corresponding to the word sequence vector.

[0161] For example, the electronic device mainly adds a residual term to the feedforward network layer to improve the convergence speed of the neural network layer during training. Optionally, the residual term can be replaced by relu (AW c +b c ) means that the model parameters of the feedforward network layer are W c and b c , and the W c and bc It can be a matrix with the same parameter type as the above network model but different parameter values. It can be understood that W c and b c The dimension of is consistent with the dimension of A.

[0162] Optionally, use the feedforward network layer to calculate the updated word sequence vector Y 2 The calculation formula is: 2 =relu(AW c +b c )+A. Due to the increase of relu(AW c +b c ) This additive term, therefore, during the training process, the gradient disappearance can be effectively suppressed during back propagation, and the convergence speed can be improved when solving the variables in the matrix A.

[0163] B2. Use the pooling layer to extract features from the updated word sequence vector to obtain the representation word sequence vector corresponding to the text data.

[0164] Optionally, in this embodiment, the pooling layer can be used to update the word sequence vector Y output by the feedforward network layer. 2 To extract information, select the feature with the largest value in each word vector dimension as the feature of that dimension, that is, select the value with the largest element value in the row vector corresponding to each word as the value of the row, so as to obtain the word sequence vector Y corresponding to the text data 1 The formula is as follows: Among them, i represents the number of word vector variables, S is the number of word vectors, and Y i 2 Represents the updated word sequence vector Y 2 The i-th word vector in .

[0165] For example, the pooling layer is equivalent to a filter layer, which extracts the characteristic information output by the feedforward network layer and effectively filters out the noise information to ensure the performance of the model.

[0166] B3. Use the fully connected layer to perform dimension-weighted summation and normalization on the vector representing the word sequence to obtain the category probability distribution corresponding to the object to be identified.

[0167] In this embodiment, similar to the traditional neural network model, a fully connected matrix is ​​connected after the pooling layer to convert the output of the pooling layer Y 1 The weighted sum of each dimension of is used to obtain the word sequence vector corresponding to each category. The formula is Among them, W0 is the parameter matrix of the fully connected layer, and b0 is the bias term of the fully connected layer.

[0168] In addition, the softmax function is used to transform the word sequence vectors corresponding to each category Converts the probability distribution of categories. The Softmax function is a normalized exponential function, mainly used for multi-classification.

[0169] For example, the prediction probability calculation formula of the fully connected layer output category k is as follows:

[0170]

[0171] Among them, p k is the predicted probability of category k, is the word sequence vector corresponding to category k, and n is the number of word vectors belonging to category k in the word sequence vector.

[0172] The category analysis method provided in the embodiments of this application utilizes the self-attention processing layer of a machine classification model to fuse information from the word vectors included in the word sequence vectors, obtaining a self-attention result of the word sequence vectors. The neural network layer then extracts and processes information from the self-attention result to obtain a category probability distribution corresponding to the object to be identified. In this technical solution, the use of the self-attention processing layer and the neural network layer to analyze the word sequence vectors corresponding to the text data of the object to be identified can accurately obtain the category probability distribution of the object to be identified, thereby improving the efficiency of object category detection.

[0173] Based on any of the above embodiments, Figure 5 This is a flow chart of the fourth embodiment of the category analysis method provided in this application. Figure 5 As shown, in this embodiment, the method may further include the following steps:

[0174] S501: Acquire a text dataset with labeled object categories, where the text dataset includes a plurality of text data corresponding to preset object categories.

[0175] In the embodiments of the present application, before executing the solutions of the above embodiments, the electronic device first needs to generate a word vector table and train a machine classification model. Therefore, the electronic device needs to obtain a large amount of text data sets with labeled object categories and then perform subsequent processing based on the text data sets.

[0176] Optionally, the text dataset is determined by the electronic device itself by annotating the text data of multiple objects obtained, or it can be annotated in another device and transmitted to the electronic device, or it can be manually annotated. The embodiments of this application do not limit the specific source of the text dataset of the annotated object category, which can be determined based on actual circumstances and will not be further described here.

[0177] For example, for commodities on an e-commerce platform, the commodity title text data may be labeled with three categories, namely, black commodities, gray commodities, and normal commodities.

[0178] S502: Based on a preset word segmentation rule, perform word segmentation processing on each text data in the text data set to obtain a word set corresponding to the text data set.

[0179] In an embodiment of the present application, the electronic device can use the Jieba word segmentation tool to segment all acquired text data labeled with object categories, such as product title data. Optionally, before word segmentation, some simple data processing can be performed on the text data, such as removing special symbols, punctuation marks, and other noise information that is irrelevant to object category identification.

[0180] Optionally, the electronic device groups the words corresponding to each text data in the text data set into a preset set, and then deletes repeated words in the preset set to obtain a word set corresponding to the text data set.

[0181] S503: Generate a word vector table based on the word set corresponding to the text data set and the terms input from the outside, where each word in the word vector table has a unique code.

[0182] Optionally, in the process of word segmentation of text data, you can also add external input terms, such as professional vocabulary in vertical fields, business custom vocabulary, such as identity reader, HPV vaccine, Taoist talisman, etc., so that all words in the term are considered as a whole. Therefore, during use, if the input text data contains these words, it can be divided into one vocabulary, thereby ensuring successful word segmentation.

[0183] Accordingly, the electronic device can add the externally input terms to the word set corresponding to the text dataset to obtain a preset target set, and then determine the size of the word vector table based on the dimension of the preset corpus. The number of rows in the word vector table is the number of words in the preset target set, and the number of columns in the word vector table is the dimension of the corpus.

[0184] Furthermore, the electronic device encodes each word according to the order in which the words are arranged in the preset target set, and determines the position encoding information of each word in the word vector table, in which each word corresponds to a unique identifier.

[0185] Alternatively, the electronic device can search for word vectors corresponding to each word in the preset target set from pre-trained word vectors available online. Words not found in the pre-trained word vectors can be initialized using random assignment, for example, to "null."

[0186] For example, the open source pre-trained word vector corpus is Baidu Encyclopedia, which contains more than 5 million words, with a vector dimension of 300. Each word vector incorporates rich semantic information. Therefore, assuming that the preset target set obtained from the above text dataset contains V b words, then the generated word vector table is a V b * 300. From top to bottom, each row represents a word vector, arranged according to the word encoding.

[0187] Further, refer to Figure 5 As shown, the method may further include the following steps:

[0188] S504: Determine the word sequence annotation vector corresponding to each text annotation data in the text dataset according to the above word vector table.

[0189] In an embodiment of the present application, during the training of the machine classification model, each text annotation data in the text dataset can be processed separately, thereby determining the word sequence annotation vector corresponding to each text annotation data in the text dataset.

[0190] S505: Using the word sequence annotation vector corresponding to each text annotation data as the input of the preset network and the annotated object category corresponding to the text annotation data as the output, the preset network is trained to obtain a machine classification model.

[0191] Optionally, in an embodiment of the present application, the preset network may include at least two parts, one of which is a self-attention processing layer with a self-attention mechanism, and the other is a neural network layer including a feedforward network layer, a pooling layer, and a fully connected layer. During the training process, the self-attention processing layer and the neural network layer are trained as a whole. The specific parameters of each layer in the preset network can be updated and optimized during the training process. The specific parameters of each layer are the same as those mentioned above. Figure 4 The details in the illustrated embodiment are similar and will not be described again here.

[0192] Exemplarily, in an embodiment of the present application, a cross entropy loss function can be used to optimize the loss function of the preset network using a stochastic gradient descent method to determine parameter information of each layer in the preset network.

[0193] Optionally, in practical applications, the cross entropy loss function formula of the machine classification model is: Among them, y k is the text data with labeled object labels in the text dataset; k is the text data y k The object category is marked on the top; N is the number of object categories marked as k; p k is the text data y kThe probability of being classified as k after passing through the preset network. Therefore, the word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the annotated object category corresponding to the text annotation data is used as the output. By adjusting the parameters of the preset network, the object category output by the preset network is consistent with the annotated category. The adjusted preset network is the machine classification model.

[0194] For example, in an e-commerce platform, products can be classified into three categories based on product title data: black products, gray products, and normal products.

[0195] The category analysis method provided in the embodiment of the present application performs word segmentation processing on each text data in the text data set based on a preset word segmentation rule to obtain a word set corresponding to the text data set. Based on the word set corresponding to the text data set and the terms input from the outside, a word vector table is generated. Then, the word sequence annotation vector corresponding to each text annotation data in the text data set is determined. Finally, the word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network and the annotated object category corresponding to the text annotation data is used as the output. The preset network is trained to obtain a machine classification model. In this technical solution, by training the machine classification model, the foundation is laid for the subsequent realization of automated category analysis.

[0196] It can be seen from the above embodiments that the embodiments of the present application provide a Transformer+Cnn model structure, which adopts open source pre-trained word vectors and fine-tunes the word vectors on specific classification tasks, which can improve the representation ability of word vectors. The performance of the model is improved through model combination, and the accuracy of object category detection is greatly improved.

[0197] It can be understood that the embodiment of the present application selects an architecture that integrates the pooling layer of CNN and the Transformer. In practical applications, a convolutional layer can also be added to improve the model's ability to extract abstract information. However, adding a convolutional layer will reduce the model's computational response speed and increase its complexity. Therefore, in order to improve the response speed of the model and simplify the complexity of the model, the embodiment of the present application does not add a convolutional layer.

[0198] Furthermore, the embodiment of this application only designs a single-layer Transformer, and multiple layers can be stacked to extract word representation capabilities. However, in the actual scenario of product classification on e-commerce platforms, given the limited product title data, an overly complex model is prone to overfitting and consumes too much hardware storage and computing resources. Therefore, this application uses a single-layer Transformer.

[0199] The embodiment of the present application uses pre-trained word vectors to initialize the Embedding layer, and combines random assignment to initialize the variable matrix of the Embedding layer. It can fine-tune the variables of the Embedding layer during model training to meet actual needs and improve the performance of generating word vector tables.

[0200] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0201] Figure 6 This is a schematic diagram of the structure of the category analysis device embodiment provided in the present application. Figure 6 As shown, the category analysis device may include: an acquisition module 601 , a first processing module 602 , a second processing module 603 and a determination module 604 .

[0202] The acquisition module 601 is used to acquire text data of the object to be identified;

[0203] A first processing module 602 is configured to determine a word sequence vector corresponding to the text data based on a preset word vector table;

[0204] The second processing module 603 is used to input the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified;

[0205] The determination module 604 is configured to determine the category to which the object to be identified belongs based on the category probability distribution.

[0206] In a possible design of the embodiment of the present application, the first processing module 602 is specifically configured to:

[0207] Performing word segmentation processing on the text data to obtain at least one word corresponding to the text data;

[0208] According to the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table;

[0209] A word sequence vector corresponding to the text data is obtained according to the encoding information of the at least one word in the word vector table.

[0210] In another possible design of the embodiment of the present application, the machine classification model includes: a self-attention processing layer and a neural network layer connected to each other;

[0211] The second processing module 603 is specifically configured to:

[0212] Using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector;

[0213] The neural network layer is used to extract and process information from the self-attention result to obtain the category probability distribution corresponding to the object to be identified.

[0214] Optionally, the second processing module 603 is configured to use the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector, specifically:

[0215] The second processing module 603 is specifically configured to:

[0216] Using at least three network models in the preset self-attention processing layer to process the word sequence vector respectively to obtain at least three word sequence matrices, wherein the at least three network models are of the same type but have different parameters;

[0217] Calculating the correlation of word vectors in each sequence matrix based on at least two of the at least three word sequence matrices to obtain a word correlation matrix;

[0218] A self-attention result of the word sequence vector is calculated according to the word correlation matrix and a target word sequence matrix in the at least three word sequence matrices, wherein the target word sequence matrix is ​​different from the at least two word sequence matrices.

[0219] Optionally, the neural network layer includes: a feedforward network layer, a pooling layer and a fully connected layer;

[0220] The second processing module 603 is used to extract and process information from the self-attention result using the neural network layer to obtain the category probability distribution corresponding to the object to be identified, specifically:

[0221] The second processing module 603 is specifically configured to:

[0222] Processing the self-attention result using the feedforward network layer to obtain an updated word sequence vector corresponding to the word sequence vector;

[0223] Using the pooling layer to perform feature extraction on the updated word sequence vector to obtain a representation word sequence vector corresponding to the text data;

[0224] The fully connected layer is used to perform dimension-weighted summation and normalization processing on the representation word sequence vector to obtain the category probability distribution corresponding to the object to be identified.

[0225] In another possible design of the embodiment of the present application, the acquisition module 601 is further configured to acquire a text dataset of labeled object categories, wherein the text dataset includes a plurality of text data corresponding to preset object categories.

[0226] The first processing module 602 is further configured to:

[0227] Based on a preset word segmentation rule, each piece of text data in the text data set is segmented to obtain a word set corresponding to the text data set;

[0228] The word vector table is generated according to the word set corresponding to the text data set and the terms input from the outside, and each word in the word vector table has a unique code.

[0229] Optionally, the second processing module 603 is further configured to:

[0230] Determine, according to the word vector table, a word sequence annotation vector corresponding to each text annotation data in the text dataset;

[0231] The word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the labeled object category corresponding to the text annotation data is used as the output, and the preset network is trained to obtain the machine classification model.

[0232] The device provided in the embodiment of the present application can be used to perform Figures 2 to 5 The implementation principles and technical effects of the methods in the illustrated embodiments are similar and will not be described in detail here.

[0233] It should be noted that it should be understood that the division of the various modules of the above devices is merely a division of logical functions. In actual implementation, they can be fully or partially integrated into a physical entity, or they can be physically separated. Moreover, these modules can all be implemented in the form of software called by processing elements; they can also all be implemented in the form of hardware; some modules can be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. In addition, these modules can be fully or partially integrated together or implemented independently. The processing element described here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed by hardware integrated logic circuits in the processor element or instructions in the form of software.

[0234] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)).

[0235] Figure 7 This is a schematic diagram of the structure of an electronic device embodiment for performing a category analysis method provided in an embodiment of the present application. Figure 7 As shown, the electronic device may include: a processor 71, a memory 72, a communication interface 73 and a system bus 74. The memory 72 and the communication interface 73 are connected to the processor 71 through the system bus 74 and communicate with each other. The memory 72 is used to store computer-executable instructions, and the communication interface 73 is used to communicate with other devices. When the processor 71 executes the computer-executable instructions, the above-mentioned Figures 2 to 5 A scheme of the embodiment shown.

[0236] In this Figure 7 In the embodiment, the processor 71 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0237] The memory 72 may include a random access memory (RAM), a read-only memory (RAM), or a non-volatile memory (non-volatile memory), such as at least one disk storage.

[0238] The communication interface 73 is used to implement communication between the database access device and other devices (such as clients, read-write libraries, and read-only libraries).

[0239] The system bus 74 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. System buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the figure shows only one thick line, but this does not imply that there is only one bus or only one type of bus.

[0240] Optionally, the embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, which, when executed on a computer, enable the computer to execute the above-mentioned Figures 2 to 5 The method of the embodiment shown.

[0241] Optionally, the embodiment of the present application further provides a chip for executing instructions, the chip being used to execute the above Figures 2 to 5 The method of the embodiment shown.

[0242] The embodiment of the present application also provides a program product, which includes a computer program, which is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when the at least one processor executes the computer program, the above-mentioned Figures 2 to 5 The method of the embodiment shown.

[0243] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the applications disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0244] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A category analysis method, It is characterized in that include: Obtain text data of the object to be identified; Determine the word sequence vector corresponding to the text data based on a preset word vector table; Inputting the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified; The machine classification model includes: a single-layer self-attention processing layer and a neural network layer connected to each other; the neural network layer includes: a feedforward network layer, a pooling layer and a fully connected layer; Determining the category to which the object to be identified belongs according to the category probability distribution; The step of inputting the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified includes: Using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector; Using the neural network layer to extract and process information from the self-attention result to obtain a category probability distribution corresponding to the object to be identified; The using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain the self-attention result of the word sequence vector includes: Using at least three network models in the self-attention processing layer to process the word sequence vectors respectively to obtain at least three word sequence matrices, wherein the at least three network models are of the same type but have different parameters; According to at least two word sequence matrices of the at least three word sequence matrices, calculating the correlation of word vectors in each sequence matrix to obtain a word correlation matrix; The self-attention result of the word sequence vector is calculated according to the word correlation matrix and a target word sequence matrix among the at least three word sequence matrices, and the target word sequence matrix is ​​different from the at least two word sequence matrices.

2. The method according to claim 1, It is characterized in that The determining, based on a preset word vector table, a word sequence vector corresponding to the text data includes: Performing word segmentation processing on the text data to obtain at least one word corresponding to the text data; According to the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table; According to the encoding information of the at least one word in the word vector table, a word sequence vector corresponding to the text data is obtained.

3. The method according to claim 1, It is characterized in that The using the neural network layer to extract and process information from the self-attention result to obtain the category probability distribution corresponding to the object to be identified includes: Processing the self-attention result using the feedforward network layer to obtain an updated word sequence vector corresponding to the word sequence vector; Using the pooling layer to perform feature extraction on the updated word sequence vector to obtain a representation word sequence vector corresponding to the text data; The fully connected layer is used to perform dimension-weighted summation and normalization processing on the representation word sequence vector to obtain the category probability distribution corresponding to the object to be identified.

4. The method according to any one of claims 1 to 3, It is characterized in that The method further comprises: Acquire a text data set with labeled object categories, wherein the text data set includes a plurality of text data corresponding to preset object categories respectively; Based on a preset word segmentation rule, each piece of text data in the text data set is segmented to obtain a word set corresponding to the text data set; The word vector table is generated according to the word set corresponding to the text data set and the terms input from the outside, and each word in the word vector table has a unique code.

5. The method according to claim 4, It is characterized in that The method further comprises: Determine, according to the word vector table, a word sequence annotation vector corresponding to each text annotation data in the text data set; The word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the annotated object category corresponding to the text annotation data is used as the output, and the preset network is trained to obtain the machine classification model.

6. A category analysis device, It is characterized in that include: An acquisition module, a first processing module, a second processing module and a determination module; The acquisition module is used to acquire text data of the object to be identified; The first processing module is used to determine the word sequence vector corresponding to the text data based on a preset word vector table; The second processing module is used to input the word sequence vector into a pre-trained machine classification model for processing to obtain a category probability distribution corresponding to the object to be identified; The machine classification model includes: a single-layer self-attention processing layer and a neural network layer connected to each other; the neural network layer includes: a feedforward network layer, a pooling layer and a fully connected layer; The determination module is used to determine the category to which the object to be identified belongs according to the category probability distribution; The second processing module is specifically used for: Using the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain a self-attention result of the word sequence vector; Using the neural network layer to extract and process information from the self-attention result to obtain a category probability distribution corresponding to the object to be identified; The second processing module is used to use the self-attention processing layer to perform information fusion on the word vectors included in the word sequence vector to obtain the self-attention result of the word sequence vector, specifically: The second processing module is specifically used for: Using at least three network models in the self-attention processing layer to process the word sequence vectors respectively to obtain at least three word sequence matrices, wherein the at least three network models are of the same type but have different parameters; According to at least two word sequence matrices of the at least three word sequence matrices, calculating the correlation of word vectors in each sequence matrix to obtain a word correlation matrix; The self-attention result of the word sequence vector is calculated according to the word correlation matrix and a target word sequence matrix among the at least three word sequence matrices, and the target word sequence matrix is ​​different from the at least two word sequence matrices.

7. The device according to claim 6, It is characterized in that The first processing module is specifically used for: Performing word segmentation processing on the text data to obtain at least one word corresponding to the text data; According to the at least one word, query a preset word vector table to determine encoding information of each word in the word vector table; According to the encoding information of the at least one word in the word vector table, a word sequence vector corresponding to the text data is obtained.

8. The device according to claim 6, It is characterized in that The second processing module is used to extract and process information from the self-attention result using the neural network layer to obtain the category probability distribution corresponding to the object to be identified, specifically: The second processing module is specifically used for: Processing the self-attention result using the feedforward network layer to obtain an updated word sequence vector corresponding to the word sequence vector; Using the pooling layer to perform feature extraction on the updated word sequence vector to obtain a representation word sequence vector corresponding to the text data; The fully connected layer is used to perform dimension-weighted summation and normalization processing on the representation word sequence vector to obtain the category probability distribution corresponding to the object to be identified.

9. The device according to any one of claims 6 to 8, It is characterized in that The acquisition module is further used to acquire a text data set of annotated object categories, wherein the text data set includes a plurality of text data corresponding to preset object categories respectively; The first processing module is further used for: Based on a preset word segmentation rule, each piece of text data in the text data set is segmented to obtain a word set corresponding to the text data set; The word vector table is generated according to the word set corresponding to the text data set and the terms input from the outside, and each word in the word vector table has a unique code.

10. The device according to claim 9, It is characterized in that The second processing module is further used for: Determine, according to the word vector table, a word sequence annotation vector corresponding to each text annotation data in the text data set; The word sequence annotation vector corresponding to each text annotation data is used as the input of the preset network, and the annotated object category corresponding to the text annotation data is used as the output, and the preset network is trained to obtain the machine classification model.

11. An electronic device comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.

12. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.