Advertisement type identification method and device, equipment and storage medium
By obtaining advertising product and company information in advertising text, combining named entity recognition and information extraction models, the poor classification accuracy caused by advertising text similarity is solved, and the accuracy and efficiency of advertising type recognition are improved.
Patent Information
- Application Number
- CN202310639141.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-31
- Publication Date
- 2024-12-03
AI Technical Summary
In the prior art, in advertising text classification, the classification accuracy is poor due to the similarity of advertising texts, and it is difficult to effectively distinguish some advertising texts with low distinction.
By obtaining advertising product information and advertising company information in advertising text, combining named entity recognition and information extraction models, an input vector of the advertising type recognition model is generated to improve the accuracy of advertising type recognition and model prediction speed.
It improves the accuracy and efficiency of advertising type recognition, effectively distinguishes some advertising texts with low distinction, and optimizes the model prediction speed.
Smart Images

Figure CN119067117A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an advertisement type identification method, device, equipment and storage medium. Background Art
[0002] With the development of computer technology, natural language processing is increasingly being used in a variety of scenarios. When natural language processing is applied in advertising scenarios, it usually involves the problem of classifying and identifying advertising information.
[0003] A related art provides a text information classification method, which calls a trained classification model to classify the text information and obtain the category to which the text information belongs. However, the texts of some advertisements are usually very similar, and classification based only on the text information itself results in poor classification accuracy. Summary of the invention
[0004] Embodiments of the present application provide an advertisement type identification method, apparatus, device, and storage medium for improving the identification accuracy of advertisement types.
[0005] In view of this, on the one hand, the present application provides an advertisement type identification method, including: obtaining an advertisement text to be identified; calling a named entity recognition model to perform named entity recognition processing on the advertisement text to be identified to obtain corresponding advertisement product information; calling an information extraction model to perform information extraction processing on the advertisement text to be identified to obtain corresponding advertisement company information; performing word segmentation processing on the advertisement text to be identified and counting each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold; fusing the at least one target phrase, the advertisement product information, and the advertisement company information to obtain an input vector of the advertisement type identification model; and calling the advertisement type identification model based on the input vector to perform advertisement type identification processing on the advertisement text to be identified to obtain the corresponding advertisement type.
[0006] On the other hand, the present application provides an advertisement type identification device, including: an acquisition module, used to acquire an advertisement text to be identified;
[0007] The processing module is used to call the named entity recognition model to perform named entity recognition on the advertisement text to be recognized to obtain the corresponding advertisement product information; call the information extraction model to perform information extraction processing on the advertisement text to be recognized to obtain the corresponding advertisement company information; perform word segmentation processing on the advertisement text to be recognized and count each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold; fuse the at least one target phrase, the advertisement product information, and the advertisement company information to obtain an input vector of the advertisement type recognition model; and call the advertisement type recognition model based on the input vector to perform advertisement type recognition processing on the advertisement text to be recognized to obtain the corresponding advertisement type.
[0008] In a possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is specifically used to perform word segmentation processing on the advertisement text to be classified using the Jieba word segmentation to obtain a phrase set;
[0009] Get the statistical number of each phrase in the phrase set;
[0010] The phrase whose statistical number is greater than the first threshold is determined as the target phrase.
[0011] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is specifically used to obtain an advertising company information library and add the advertising company information library to the vocabulary of the information extraction model, and the information extraction model is a Flashtext extraction model;
[0012] The Flashtext extraction model is called, and the advertisement text to be identified is extracted based on the vocabulary of the Flashtext extraction model to obtain the advertising company information.
[0013] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is specifically used to perform embedding processing on the at least one target phrase, the advertising product information, and the advertising company information to obtain multiple word vectors;
[0014] Performing vector concatenation processing on the multiple word vectors to obtain an input vector of the advertisement type recognition model;
[0015] or;
[0016] The processing module is specifically used to perform text splicing processing on the at least one target phrase, the advertising product information and the advertising company information to obtain a text to be processed;
[0017] The text to be processed is embedded to obtain an input vector of the advertisement type recognition model.
[0018] In one possible design, in another implementation of another aspect of the embodiment of the present application, the device also includes a prompt module for prompting that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type when the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type.
[0019] In a possible design, in another implementation of another aspect of the embodiment of the present application, the prompt module is specifically used to prompt in a pop-up window on the advertisement webpage corresponding to the advertisement text to be identified that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type;
[0020] or,
[0021] Prompt, in the form of voice broadcast, on the advertisement webpage corresponding to the advertisement text to be identified that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type;
[0022] or,
[0023] The advertisement text to be identified is shielded on the advertisement webpage corresponding to the advertisement text to be identified.
[0024] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is further used to generate an abnormal advertisement type database according to the abnormal advertisement type corresponding to the advertisement text to be identified.
[0025] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is further used to acquire a first information library and a second information library, the first information library is a mapping library of advertising products and advertising types, and the second information library is a mapping library of advertising companies and advertising types;
[0026] The processing module is further used to obtain a first search result based on the advertising product information and the first information database, and to obtain a second search result based on the advertising company information and the second information database;
[0027] When the first search result and the second search result are not empty, determining that the advertisement type indicated by the second search result is the advertisement type corresponding to the advertisement text to be identified;
[0028] When the first search result is not empty and the second search result is empty, determining that the advertisement type indicated by the first search result is the advertisement type corresponding to the advertisement text to be identified;
[0029] When both the first search result and the second search result are empty, an operation of obtaining the target phrase of the advertisement text to be recognized is triggered.
[0030] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is further used to update the first information library according to the advertisement type and the advertisement product information, and to update the second information library according to the advertisement type and the advertisement company information. In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is specifically used to acquire the advertisement webpage to be collected;
[0031] The advertisement webpage is accessed by a static crawler, and the text content corresponding to the advertisement webpage is obtained as the advertisement text to be identified. The advertisement text to be identified includes an advertisement title text and an advertisement body text.
[0032] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is further used to acquire a first training sample and an initial named entity recognition model, the first training sample includes a first advertisement sample and first annotation information of the first advertisement sample, the first annotation information includes annotated product information and sentence position information of the product information in the advertisement sample, and the initial named entity recognition model includes a bidirectional encoder representation from transformers (BERT), a bidirectional long short-term memory network (BiLSTM), and a conditional random field network (CRF);
[0033] The processing module is further used to obtain an input word vector of the first training sample;
[0034] Based on the BERT, the input word vector is embedded and encoded to obtain a first vector;
[0035] Perform feature extraction on the first vector based on the BiLSTM to obtain a label sequence;
[0036] Decoding the labeled sequence based on the CRF to obtain a predicted character sequence of the first training sample;
[0037] Obtaining a loss value according to the predicted character sequence and the first annotation information;
[0038] The device also includes a training module, which is used to train the initial named entity recognition model according to the loss value to obtain the named entity recognition model.
[0039] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is further used to acquire a second training sample and an initial advertisement type recognition model, and the initial advertisement type recognition model is a text convolutional neural network TextCNN;
[0040] The processing module is further used to call the named entity recognition model to perform named entity recognition processing on the second training sample to obtain corresponding training advertising product information; call the information extraction model to perform information extraction processing on the second training sample to obtain corresponding training advertising company information;
[0041] Performing word segmentation processing on the second training sample and performing statistics on each phrase to obtain at least one training phrase whose statistical number is greater than the first threshold;
[0042] fusing the training advertisement product information, the training advertisement company information and the at least one training phrase to obtain a training input vector of the initial advertisement type recognition model;
[0043] The device also includes a training module, which is used to train the initial advertisement type recognition model based on the training input vector to obtain the advertisement type recognition model.
[0044] Another aspect of the present application provides a computer device, including: a memory, a processor, and a bus system;
[0045] Wherein, the memory is used to store programs;
[0046] The processor is used to execute the program in the memory, and the processor is used to execute the above-mentioned methods according to the instructions in the program code;
[0047] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
[0048] Another aspect of the present application provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.
[0049] Another aspect of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided by the above aspects.
[0050] It can be seen from the above technical scheme that the embodiments of the present application have the following advantages: in the process of identifying the advertisement type of the advertisement text to be identified, the advertisement product corresponding to the advertisement text and the advertisement company information are introduced, which increases the features of the advertisement text, thereby improving the feature extraction of the advertisement text, and further improving the accuracy of advertisement type identification; at the same time, in the process of classifying the advertisement text, the high-frequency phrases in the advertisement text are first extracted, and then the advertisement type is identified through the advertisement type identification model based on the high-frequency phrases, advertisement product information and advertisement company information, which can improve the model prediction speed and effectively distinguish some advertisement texts with low discrimination, and also improve the accuracy of advertisement type identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1a A schematic diagram of a network structure of BERT in an embodiment of the present application;
[0052] Figure 1b A flowchart of the BERT input sequence in an embodiment of the present application;
[0053] Figure 1c A schematic diagram of a network structure of BiLSTM in an embodiment of the present application;
[0054] Figure 2a A schematic diagram of an implementation architecture of the method for identifying advertisement types in an embodiment of the present application;
[0055] Figure 2b A schematic diagram of an application scenario of the advertisement type identification method in an embodiment of the present application;
[0056] Figure 2c This is a schematic diagram of the architecture of the BERT+BiLSTM+CRF model in the embodiment of the present application;
[0057] Figure 2d A schematic diagram of a training process of the BERT+BiLSTM+CRF model in an embodiment of the present application;
[0058] Figure 2e A training flow diagram of the TextCNN model in the embodiment of the present application;
[0059] Figure 3 A schematic diagram of an embodiment of a method for identifying an advertisement type in an embodiment of the present application;
[0060] Figure 3a This is a schematic diagram of an application for prompting abnormal advertisements in an embodiment of the present application;
[0061] Figure 3b Another application diagram of prompting abnormal advertisements in an embodiment of the present application;
[0062] Figure 3c Another application diagram of prompting abnormal advertisements in an embodiment of the present application;
[0063] Figure 4 This is a schematic diagram of another embodiment of the method for identifying advertisement types in the embodiments of the present application;
[0064] Figure 4a A storage diagram of the first information database in the embodiment of the present application;
[0065] Figure 4b A storage diagram of the second information database in the embodiment of the present application;
[0066] Figure 5 This is a schematic diagram of an embodiment of an advertisement type identification device in an embodiment of the present application;
[0067] Figure 6 This is a schematic diagram of another embodiment of the device for identifying advertisement type in the embodiment of the present application;
[0068] Figure 7 This is a schematic diagram of another embodiment of the device for identifying advertisement type in the embodiment of the present application;
[0069] Figure 8 This is a schematic diagram of another embodiment of the device for identifying advertisement type in the embodiment of the present application;
[0070] Fig. 9 Schematic diagram of another embodiment of the advertisement type identification device in the embodiment of the present application. DETAILED DESCRIPTION
[0071] Embodiments of the present application provide an advertisement type identification method, apparatus, device, and storage medium for improving the identification accuracy of advertisement types.
[0072] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0073] With the development of computer technology, the application of natural language processing is becoming more and more extensive and can be applied in a variety of scenarios. When natural language processing is applied in advertising scenarios, it usually involves the problem of classifying and identifying advertising information. A text information classification method is provided in the related art, which calls a trained classification model to classify the text information and obtain the category to which the text information belongs. However, the advertising texts of some advertisements are usually very similar, and classification is only based on the text information itself, resulting in poor classification accuracy.
[0074] In order to solve the above problems, the present application provides the following technical solutions: obtaining an advertisement text to be identified; calling a named entity recognition model to perform named entity recognition processing on the advertisement text to be identified to obtain corresponding advertisement product information; calling an information extraction model to perform information extraction processing on the advertisement text to be identified to obtain corresponding advertisement company information; performing word segmentation processing on the advertisement text to be identified and counting each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold; fusing the at least one target phrase, the advertisement product information, and the advertisement company information to obtain an input vector of an advertisement type recognition model; calling the advertisement type recognition model based on the input vector to perform information extraction processing on the advertisement text to be identified. The advertisement type is identified and processed on the advertisement text to obtain the corresponding advertisement type. In this way, in the process of identifying the advertisement type of the advertisement text to be identified, the advertisement product and the advertisement company information corresponding to the advertisement text are introduced, which increases the features of the advertisement text, thereby improving the feature extraction of the advertisement text, and further improving the accuracy of advertisement type identification; at the same time, in the process of classifying the advertisement text, the high-frequency phrases in the advertisement text are first extracted, and then the advertisement type is identified through the advertisement type identification model based on the high-frequency phrases, advertisement product information and advertisement company information. This can improve the model prediction speed and effectively distinguish some advertisement texts with low discrimination, and also improve the accuracy of advertisement type identification.
[0075] The advertisement type identification method of each optional embodiment of the present application is implemented based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making.
[0076] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.
[0077] The present application also involves cloud technology, which refers to a hosting technology that unifies system resources such as hardware, software, and network in a wide area network or a local area network to achieve data computing, storage, processing, and sharing.
[0078] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on the cloud computing business model. It can form a resource pool, which can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources, such as video websites, picture websites and more portal websites. With the high development and application of Internet behavior, each item may have its own identification mark in the future, and all need to be transmitted to the background system for logical processing. Data of different levels will be processed separately, and all kinds of industry data require strong system backing support, which can only be achieved through cloud computing. The cloud technology involved in this application mainly refers to the image recognition between terminal devices or servers through the "cloud", etc.
[0079] For ease of understanding, some nouns in this application are explained below.
[0080] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning. With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0081] Flashtext: is an efficient character search and replacement algorithm. The time complexity of the algorithm does not depend on the number of characters searched or replaced. For example, for a document with N characters and a keyword library with M words, the time complexity is O(N). This algorithm is much faster than the general regular matching method because the time complexity of regular matching is O(M*N). The Flashtext algorithm is designed to match only complete words. For example, if you enter a word {Apple}, the algorithm will not match the apple in "I like Pineapple". This algorithm is designed to match the longest string first. For example, if there is a dataset like {Machine, Learning, Machine Learning} and a document "Ilike Machine Learning", the Flashtext algorithm will only match "Machine Learning" because it is the longest match.
[0082] BERT: It is a pre-trained model. The BERT model architecture is based on a multi-layer bidirectional transformer encoder and decoder. Since the decoder cannot obtain prediction information, the model can use two methods, the Masked Language Model (LM) and the Next Sentence Prediction (NSP), to capture word and sentence level representations respectively. Figure 1a The network architecture shown illustrates the BERT: the model can be simply summarized into three parts, namely the input layer, the middle layer, and the output layer. Among them, the middle layer is generated by stacking multiple layers of transformer structures. The input layer of BERT inputs a linear sequence. The two sentences are separated by a delimiter, and two identification symbols are added at the front and the end. Each word has three embedding representations (embedding): 1. Position information embedding. This is because the order of words in natural language processing (Natural Language Processing, NLP) is a very important feature, and the position information needs to be encoded here; 2. Word embedding, that is, encoding each word; 3. Sentence embedding, because the training data is composed of two sentences, then each sentence has an embedding item of the entire sentence corresponding to each word. The three embeddings corresponding to the words are superimposed to form the input of BERT. In an exemplary scheme, with Figure 1bThe processing flow shown illustrates the input of the BERT: In this exemplary scheme, in order to adapt to downstream tasks, the input will be constructed as [CLS] + sentence A (+ [SEP] + sentence B + [SEP]). [CLS]: represents a special token for classification tasks; [SEP]: separator; sentence A and sentence B are the input texts of the model, where sentence B can be empty, then the input becomes [CLS] + sentence A. Because the transformer cannot obtain the position information of the word, BERT, like the transformer, also adds absolute position (position encoding), but unlike the transformer, BERT does not use the functional encoding method corresponding to the transformer, but directly adopts a method similar to word embedding (Parametric) to directly obtain the position embedding. Because the input has a new structure, the model may have multiple sentence segments (Segment) input, so it is also necessary to add segment embedding (embedding). For example, the segment input corresponding to [CLS], A_1, A_2, A_3, [SEP], B_1, B_2, B_3, [SEP] is [0, 0, 0, 0, 1, 1, 1, 1], and then perform embedding_lookup based on segmentid to get the segment embedding.
[0083] CRF: It is a basic model for natural language processing and is widely used in annotation scenarios such as Chinese word segmentation, named entity recognition, and part-of-speech tagging. CRF is combined with the attention mechanism to develop models such as Transformer-CRF and BERT-BiLSTM-CRF, which significantly improve the effects of Chinese word segmentation, named entity recognition, and part-of-speech tagging.
[0084] BiLSTM: It is composed of a forward long short-term memory network (Long Short-Term Memory, LSTM) and a backward LSTM. Among them, LSTM can capture longer-distance dependencies. However, there is still a problem in using LSTM to model sentences: it is impossible to encode information from back to front. In more fine-grained classification, such as the five-category task of strong praise, weak praise, neutral, weak derogatory, and strong derogatory, it is necessary to pay attention to the interaction between sentiment words, degree words, and negative words. For example, "This restaurant is so dirty, not as good as the one next door." The "bad" here is a modification of the degree of "dirty." In order to learn the information from back to front, a backward LSTM is added, so that the information from back to front can be encoded. Therefore, the BiLSTM composed of a forward LSTM and a backward LSTM can better capture bidirectional semantic dependencies. In an exemplary scheme, with Figure 1c The network architecture shown in the figure illustrates the operation of the BiLSTM: a single-layer BiLSTM is composed of two LSTMs, one for processing the input sequence in the forward direction; the other for processing the sequence in the reverse direction, and the outputs of the two LSTMs are concatenated after processing. In the figure above, the final BiLSTM output can only be obtained after all time steps are calculated. The forward LSTM obtains a result vector after 6 time steps; the reverse LSTM also obtains another result after 6 time steps. The two result vectors are concatenated to obtain the final BiLSTM output result.
[0085] TextCNN: It is a model that applies Convolutional Neural Network (CNN) to text classification tasks. Its principle is to use multiple convolution kernels of different sizes to extract key information in a sentence (similar to n-grams with multiple window sizes), so as to better capture local correlations. Compared with the traditional image CNN network, TextCNN has no changes in network structure (even simpler). TextCNN includes an input layer, a convolution layer, a pooling layer, and finally an external softmax activation function to the output to achieve classification (that is, output the probability value of each class). Among them, the input layer is an n*k matrix, where n is the number of words in a sentence and k is the dimension of the word vector corresponding to each word. In other words, each row of the input layer is a k-dimensional word vector corresponding to a word. Since the "image" of the input layer is a word matrix composed of word vectors, in this convolution layer, the width of the convolution kernel of the convolution layer is the same as the width of the word matrix, which is the word vector size, and the convolution kernel only moves in the height direction. Therefore, each time the convolution kernel slides over a complete word, it will not convolve parts of several words. The rows of the word matrix represent discrete symbols (that is, words), which ensures the rationality of words as the smallest granularity in the language. Each convolution operation is equivalent to the extraction of a feature vector. By defining different windows, different feature vectors can be extracted to form the output of the convolution layer. The pooling layer can use 1-Max pooling (that is, to select the largest feature from the feature vector generated by each sliding window, and then concatenate these features to form a vector representation); K-Max pooling (that is, to select the largest K features in each feature vector); or average pooling (that is, to average each dimension in the feature vector). The above pooling operations all pool sentences of different lengths to obtain a fixed-length vector representation. When the TextCNN is applied to text classification, a fully connected layer can be connected after the pooling layer, and the Softmax activation function can be used to output the probability of each category, and finally the classification result is output.
[0086] Neural Network: Artificial Neural Networks (ANN) are composed of a large number of neurons connected by adjustable connection weights. They have the characteristics of large-scale parallel processing, distributed information storage, and good self-organization and self-learning capabilities.
[0087] A convolutional layer (Conv) refers to a layered structure composed of several convolutional units in a convolutional neural network layer. A convolutional neural network (CNN) is a feedforward neural network. A convolutional neural network includes at least two neural network layers, each of which contains several neurons. Each neuron is arranged in layers. Neurons in the same layer are not connected to each other, and information between layers is transmitted in only one direction.
[0088] Back propagation: Forward propagation refers to the feedforward processing of the model, while back propagation is the opposite of forward propagation, which refers to updating the weight parameters of each layer of the model according to the output of the model. For example, if the model includes input layer, hidden layer and output layer, then forward propagation refers to processing in the order of input layer-hidden layer-output layer, and back propagation refers to updating the weight parameters of each layer in the order of output layer-hidden layer-input layer.
[0089] Jieba word segmentation: The main function is to do Chinese word segmentation. It can perform simple word segmentation, parallel word segmentation, command line word segmentation, and also supports keyword extraction, part-of-speech tagging, word position query, etc. It has multiple word segmentation modes, such as full mode and precise mode. Among them, the full mode scans all the words that can form words in the sentence, and there will be multiple uses and multiple meanings of one word. The precise mode divides the sentence most accurately, and each word has only one meaning. For example, the sentence "Shanghai, China is a beautiful international metropolis" can be segmented into "China / Shanghai / is / a / beautiful / international / international / metropolis / metropolis" when using the full mode; while using the precise mode, it can be segmented into "China / Shanghai / is / a / beautiful / international / metropolis / metropolis".
[0090] The present invention provides an advertisement type identification method, device, equipment and storage medium, which can improve the identification accuracy of advertisement types. The following describes an exemplary application of the electronic device provided by the present invention. The electronic device provided by the present invention can be implemented as various types of user terminals or as a server.
[0091] By running the advertisement type recognition method provided in the embodiment of the present application, the electronic device improves the recognition accuracy of the advertisement type, that is, improves the recognition accuracy of the advertisement type corresponding to the advertisement text by the electronic device deployed with the named entity recognition model, the information extraction model and the advertisement type recognition model.
[0092] See also Figure 2a , Figure 2aIt is a schematic diagram of an application framework of the advertising type identification method provided by the embodiment of the present application. The advertising information library stores the advertising text to be identified; the named entity recognition model is used to perform named entity recognition processing on the advertising text to be identified to obtain the advertising product information, and then the advertising product information is retrieved from the advertising type mapping library to obtain the retrieval result; at the same time, the information extraction module is used to extract information from the advertising text to be identified to obtain the advertising company information corresponding to the advertising text to be identified, and then the advertising company information is retrieved from the advertising type mapping library to obtain the retrieval result; when the above two retrieval results are both empty, the advertising company information and the advertising product information are introduced into the advertising type identification model as new features, and finally the advertising type of the advertising text to be identified is identified, and when the advertising type is an abnormal advertising type, an abnormal advertising type information database is generated; when at least one of the above two retrieval results is not empty, the advertising type indicated by the above retrieval result is selected as the advertising type of the advertising text to be identified.
[0093] See also Figure 2b , Figure 2bIt is an optional architecture diagram of an application scenario of the training scheme of the named entity recognition model and the advertisement type recognition model provided in the embodiment of the present application. To implement the training scheme supporting a named entity recognition model and the advertisement type recognition model, the terminal device 100 is connected to the server 300 through the network 200, and the server 300 is connected to the database 400. The network 200 can be a wide area network or a local area network, or a combination of the two. The client for implementing the training scheme of the named entity recognition model and the advertisement type recognition model is deployed on the terminal device 100, wherein the client can be run on the terminal device 100 in the form of a browser, or in the form of an independent application (application, APP), etc. The specific presentation form of the client is not limited here. The server 300 involved in this application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal device 100 can be a smart phone, a tablet computer, a laptop, a PDA, a personal computer, a smart TV, a smart watch, a vehicle-mounted device, a wearable device, etc., but is not limited to this. The terminal device 100 and the server 300 can be directly or indirectly connected through the network 200 by wired or wireless communication, and this application does not limit this. The number of servers 300 and terminal devices 100 is also not limited. The solution provided in this application can be completed independently by the terminal device 100, or by the server 300, or by the terminal device 100 and the server 300 in cooperation, and this application does not make specific limitations. The database 400 can be viewed as an electronic file cabinet, a place for storing electronic files, where users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data that is stored together in a certain way, can be shared with multiple users, has as little redundancy as possible, and is independent of the application program. A database management system (DBMS) is a computer software system designed for managing databases, and generally has basic functions such as storage, interception, security, and backup.Database management systems can be classified according to the database models they support, such as relational, Extensible Markup Language (XML); or according to the types of computers they support, such as server clusters, mobile phones; or according to the query language used, such as Structured Query Language (SQL), XQuery; or according to performance impulse focus, such as maximum scale, maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages at the same time. In the present application, database 400 can be used to store training samples or advertising texts to be identified. Of course, the storage location of training samples or advertising texts to be identified is not limited to the database, for example, it can also be stored in the terminal device 100, blockchain or distributed file system of server 300.
[0094] In some embodiments, the server 300 and the terminal device 100 can both execute the advertisement type recognition method, the named entity recognition model, and the advertisement type recognition model training method provided in the embodiments of the present application.
[0095] In this embodiment, the specific process may be as follows: the terminal device 100 obtains a first training sample and an initial named entity recognition model; then the terminal device 100 may store the first training sample in the database 400 or in the memory of the terminal device 100; the server 300 obtains the first training sample from the database 400 or the terminal device 100; then the initial named entity recognition model is trained according to the first training sample to obtain the named entity recognition model. Finally, the server 300 may deploy the named entity recognition model to the terminal device 100, so that the terminal device 100 may call the named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain the function of the advertisement product; or, the server 300 may deploy the named entity recognition model on a server that performs advertisement type recognition, so that the server that performs advertisement type recognition calls the named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain the function of the advertisement product.
[0096] In an exemplary embodiment, the named entity recognition model can be a BERT+BiLSTM+CRF model, and its specific architecture can be as follows: Figure 2c As shown in the figure, the input layer converts Chinese characters into word vectors to obtain input word vectors; then the word vectors are input to the BERT model layer (i.e., the multi-layer bidirectional conversion encoding and decoding layer) to output the vectors of the BERT model layer (as shown in the figure). Figure 2cThe size and dimension of the vector is 12*768); and then the processed vector is obtained after a layer of weighted sum (such as Figure 2c The vector is a vector of dimension 768 in ); the vector is input into the BiLSTM for feature extraction, and the decoding process is performed to obtain the labeled sequence (such as Figure 2c The vector with a dimension of 14 in the middle); then it is output to CRF to obtain the advertising product information.
[0097] An exemplary training process can be as follows Figure 2d As shown: obtain a first training sample, the first training sample includes an advertisement text and annotation information of the advertisement text, the annotation information includes an advertisement product in the advertisement text and sentence position information of characters corresponding to the advertisement product in the advertisement text; transmit the first training sample to the BERT+BiLSTM+CRF model through a corresponding interface; train the BERT+BiLSTM+CRF model according to the first training sample. In the present application, the BERT+BiLSTM+CRF model can be trained by back propagation training.
[0098] At the same time, the terminal device 100 obtains a second training sample and an initial advertisement type recognition model; then the terminal device 100 may store the first training sample in the database 400 or in the memory of the terminal device 100; the server 300 obtains the second training sample from the database 400 or the terminal device 100; then the Jieba word segmentation is used to obtain at least one target phrase in the second training sample whose statistical number is greater than the first threshold, and at the same time, the above-mentioned trained named entity recognition model can be used to identify the advertisement product information corresponding to the second training sample, and the information extraction model is used to obtain the advertisement company information corresponding to the second training sample; then the initial advertisement type recognition model is trained according to at least one target phrase, the advertisement product information corresponding to the second training sample, and the advertisement company information corresponding to the second training sample to obtain the advertisement type recognition model. Finally, the server 300 can deploy the advertisement type recognition model to the terminal device 100, so that the terminal device 100 can call the advertisement type recognition model to perform advertisement type recognition processing on the advertisement text to be recognized, so as to identify the advertisement type; or, the server 300 deploys the advertisement type recognition model on the server that performs advertisement type recognition, so that the server that performs advertisement type recognition calls the advertisement type recognition model to perform advertisement type recognition processing on the advertisement text to be recognized, so as to identify the advertisement type.
[0099] In an exemplary solution, the advertisement type recognition model may be a TextCNN model, and an exemplary training process thereof may be as follows: Figure 2eAs shown: a second training text is obtained, and the second training text includes an advertisement title text and an advertisement body text; then, high-frequency phrases are extracted using the Jieba word segmentation method, and the named entity recognition model is used to identify the advertisement product information corresponding to the second training text, and the information extraction model is used to extract the advertisement company information corresponding to the second training text; the high-frequency phrases, the advertisement product information corresponding to the second training sample, and the advertisement company information corresponding to the second training sample are transmitted to the TextCNN model through corresponding interfaces; and finally, the TextCNN model is trained.
[0100] In another embodiment, the terminal device 100 obtains a first training sample and an initial named entity recognition model; then the terminal device 100 may store the first training sample in the database 400 or in the memory of the terminal device 100; the terminal device 100 obtains the first training sample from the database 400 or the terminal device 100; then the initial named entity recognition model is trained according to the first training sample to obtain the named entity recognition model. Finally, the terminal device 100 may deploy the named entity recognition model to the terminal device 100, so that the terminal device 100 may call the named entity recognition model to perform advertising type recognition processing on the advertising text to be recognized, so as to identify the function of the advertising product; or, the terminal device 100 deploys the named entity recognition model on a server that performs advertising type recognition, so that the server that performs advertising type recognition calls the named entity recognition model to perform advertising type recognition processing on the advertising text to be recognized, so as to identify the function of the advertising product.
[0101] At the same time, the terminal device 100 obtains a second training sample and an initial advertisement type recognition model; then the terminal device 100 may store the first training sample in the database 400 or in the memory of the terminal device 100; the terminal device 100 obtains the second training sample from the database 400 or the terminal device 100; then the Jieba word segmentation is used to obtain at least one target phrase in the second training sample whose statistical number is greater than the first threshold, and at the same time, the above-mentioned trained named entity recognition model can be used to identify the advertisement product information corresponding to the second training sample, and the information extraction model can be used to extract the advertisement company information corresponding to the second training sample; then the initial advertisement type recognition model is trained according to at least one target phrase, the advertisement product information corresponding to the second training sample, and the advertisement company information corresponding to the second training sample to obtain the advertisement type recognition model. Finally, the terminal device 100 can deploy the advertisement type recognition model to the terminal device 100, so that the terminal device 100 can call the advertisement type recognition model to perform advertisement type recognition processing on the advertisement text to be recognized, so as to identify the advertisement type; or, the terminal device 100 deploys the advertisement type recognition model on a server that performs advertisement type recognition, so that the server that performs advertisement type recognition calls the advertisement type recognition model to perform advertisement type recognition processing on the advertisement text to be recognized, so as to identify the advertisement type.
[0102] Its exemplary network structure and training process can be as above Figure 2c to Figure 2e As shown, the details will not be repeated here.
[0103] It can be understood that in the specific implementation of the present application, it involves relevant data such as the advertising text to be identified, training samples, the first information database, the second information database, and the advertising company information database. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0104] In combination with the above introduction, the following will introduce the advertisement type identification method in this application with the server as the execution subject, please refer to Figure 3 , an embodiment of the method for identifying the type of advertisement in the embodiment of the present application includes:
[0105] 301. Obtain advertisement text to be identified.
[0106] In this embodiment, the advertisement text to be identified can be obtained by the server extracting text from the advertisement webpage, or can be obtained by a third-party terminal extracting text from the advertisement webpage and then sent to the server by the third-party terminal, which is not limited here.
[0107] In an exemplary solution, the server or the third-party terminal can extract text from the advertising web page by accessing it with a static crawler. For example, take out the advertising web page from the advertising task queue to be collected, and use the static crawler to access the web page to obtain the content of the web page. The static crawler uses the Python language and the requests library. To use the requests library, you first need to install it through pip install requests, and then execute the requests.get(url) command, where url is a specific advertising link. After executing the above-mentioned request.get(url) command, you can extract the advertising text corresponding to the advertising web page. Specifically, the advertising text can include an advertising title text and an advertising body text. For example, the advertising text can be as follows: the advertising title text is "XX drink can treat YY", and the advertising body text is "XX drink is squeezed from pure natural XX fruit, and XX fruit includes rich vitamins, which can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789".
[0108] 302. Calling a named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain corresponding advertisement product information.
[0109] The server calls a named entity recognition model deployed on itself or a third-party device to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain corresponding advertisement product information.
[0110] In this embodiment, the named entity recognition model can adopt the above Figure 2c to Figure 2d The BERT+BiLSTM+CRF model described in the invention is used. The specific structure and training method of the named entity recognition model are not described here. When the advertisement product is recognized in the advertisement text, the specific application process can be as follows: the advertisement text to be recognized includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is produced by squeezing pure natural XX fruit, which contains rich vitamins and can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789". After passing the named entity recognition model, the output advertisement product information is "XX drink".
[0111] 303. Calling an information extraction model to perform information extraction processing on the advertisement text to be identified to obtain corresponding advertising company information.
[0112] The server calls an information extraction model deployed on itself or a third-party device to extract the corresponding advertising company information in the advertisement text to be identified.
[0113] In this embodiment, the information extraction model can be a Flashtext model or a regular expression "r'Company is (\w+)'".
[0114] The specific operation of the regular expression is simple. However, for this embodiment, since the positions of company names in advertising texts are different and the expressions are also different, a large number of regular expressions need to be maintained when using regular expressions, resulting in low accuracy and coverage.
[0115] The Flashtext model can identify the advertising company information more quickly and accurately, and its specific process can be as follows:
[0116] First, obtain the company name information library, and its magnitude can be determined according to actual needs. For example, in order to achieve a better coverage rate, its magnitude can be defined as hundreds of millions. Among them, the company name information library is used to store multiple company names. For example, the company name can be as follows: A City B Pharmaceutical Technology Co., Ltd., C Pharmaceutical Co., Ltd., D Technology Co., Ltd., etc. Then add the company name information library to the keyword library of the FlashText model; finally, use the advertisement text to be identified to retrieve the advertising company information corresponding to the advertisement text to be identified in the keyword library. In an exemplary scheme, the specific implementation process of the FlashText model can be as follows: Step 1, obtain the vocabulary, which is divided into char level and word level, and can be regarded as a dictionary, where the key is all possible char or word, and the value is its corresponding id; assume that the length of the vocabulary here is D, that is, there are at most D different chars or words. Step 2, divide the input sentence into the char or word in step 1, that is, word segmentation; according to the id of each char or word in step 1, the original sentence is converted from text to a string of numbers, which is called a word vector. Generally speaking, the converted word vector is of fixed length, so it is necessary to short-fill and long-truncate. Step 3, embedding: word vectors and multiple n-gram feature vectors need to be embedded. Embedding can use pre-trained networks or random initialization; embedding will change the size. Take bs = 128 and word vector length V = 32 as an example. The input features are all 128x32. You can manually set a hyperparameter of the mapping dimension, such as 300. After mapping, the tensor size becomes 128x32x300, and the elements are changed from the original positive integers to decimals. Step 4, network structure: concatenate all vectors and take the average value in the dimension of word vector length V as the feature representation; you can set 1 to 2 fully connected layers (fc) and dropout layers to finally get the classification probability, that is, output the final information. For example, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can cure YY", the advertisement body text is "XX drink is squeezed from pure natural XX fruit. XX fruit is rich in vitamins and can effectively cure YY. For more details, please visit the official website of ZZ company or call 123456789". After passing through the FlashText module, the output advertising company information is "ZZ company".
[0117] 304. Perform word segmentation processing on the advertisement text to be identified and count each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold.
[0118] The server segments the advertisement text to be identified by using Jieba word segmentation to obtain a phrase set, then counts each phrase in the phrase set and obtains the statistical number; finally, the phrase whose statistical number is greater than a first threshold is selected as the target phrase.
[0119] It is understandable that the server may also sort the statistical times from large to small and select the first N phrases in the sorting as the target phrases; the server may also sort the statistical times from small to large and select the last N phrases in the sorting as the target phrases; the server may also judge the statistical times of each phrase, and as long as it is greater than the set first threshold, it is classified as the target phrase. The specific implementation method is not limited here. For example, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is produced by squeezing pure natural XX fruit, XX fruit includes rich vitamins, which can effectively treat YY. For details, please visit the official website of ZZ company or call 123456789", and the phrase set obtained by using stuttering word segmentation can be as follows: "XX / drink / can / treat / YY / XX / drink / is / produced / by / pure / natural / XX / fruit / , / XX / fruit / includes / rich / vitamins / , / can / effectively / treat / YY / . / For details, / please / visit / ZZ / company / official / website / or / please / call / 123456789 / ". Then, the number of times each phrase appears is counted, and the following results can be obtained: "XX" appears 4 times, "drinks" appears 2 times, "can" appears 2 times, "treatment" appears 2 times, "YY" appears 2 times, "adopt" appears 1 time, "is" appears 1 time, "pure natural" appears 1 time, "of" appears 2 times, "fruit" appears 2 times, "conduct" appears 1 time, "squeeze" appears 1 time, "generate" appears 1 time, "in" appears 1 time, "include" appears 1 time, "rich" appears 1 time, "vitamins" appears 1 time, "in" appears 1 time, "effective" appears 1 time, "details" appears 1 time, "please" appears 1 time, "visit" appears 1 time, "ZZ" appears 1 time, "company" appears 1 time, "official website" appears 1 time, "or" appears 1 time, "please" appears 1 time, "dial" appears 1 time, "telephone" appears 1 time, and "123456789" appears 1 time. If the first threshold is 1, the target phrases will include "XX", "drinks", "can", "treatment", "YY", "of", and "fruit".
[0120] It is understandable that there is no time sequence among step 302, step 303 and step 304, and the two steps can be executed in parallel or in a free order, which is not specifically limited here.
[0121] 305. The at least one target phrase, the advertisement product information, and the advertisement company information are fused to obtain an input vector of an advertisement type recognition model.
[0122] The server embeds the target phrase, the advertising product information and the advertising company respectively to obtain processing vectors, and then splices the processing vectors to obtain the input vector; or first splices the target phrase, the advertising product information and the advertising company to generate a long phrase, and then embeds the long phrase to obtain the input vector. In an exemplary scheme, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is squeezed from pure natural XX fruit, XX fruit contains rich vitamins, which can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789", and the target phrases obtained by using the stuttering word segmentation are as follows: "XX", "drink", "can", "treat", "YY", "of", "fruit"; the advertisement product information is "XX drink"; the advertisement company information is "ZZ company". When embedding, the processing vectors corresponding to the target phrase are as follows: "E1 E2", "E3 E4", "E5 E6", "E7 E8", "E9 E10", "E11", "E12 E13"; the processing vectors corresponding to the advertising product information are as follows: "E14 E15 E16 E17"; the processing vectors corresponding to the advertising company information are as follows: "E18 E19 E20 E21". The input vector obtained by concatenating the above processing vectors is "E1 E2 E3 E4 E5 E6E7 E8 E9 E10 E11 E12 E13E14 E15 E16 E17 E18 E19 E20 E21".
[0123] 306. Based on the input vector, the advertisement type recognition model is called to perform advertisement type recognition processing on the advertisement text to be recognized to obtain a corresponding advertisement type.
[0124] The server transmits the input vector to the input layer of the advertisement type recognition model through the corresponding interface, and then performs advertisement type recognition processing on the advertisement text to be recognized through the advertisement type to obtain the corresponding advertisement type. In this embodiment, the advertisement type recognition model can be a TextCNN model, and its specific network structure and training method have been described above, and will not be repeated here.
[0125] It is understandable that in order to manage the advertisement text, the server can also make corresponding prompt operations when the advertisement type is identified as an abnormal advertisement type. In an exemplary solution, the server sends a pop-up prompt to the advertisement webpage corresponding to the advertisement text to be identified, so as to prompt the user that the advertisement on the current advertisement webpage is an abnormal advertisement, such as Figure 3a As shown; or the server sends a voice message to the advertising webpage corresponding to the advertising text to be identified, and plays it on the advertising webpage to prompt the user that the advertisement on the current advertising webpage is an abnormal advertisement, such as Figure 3b As shown; or the server directly blocks the advertising webpage corresponding to the advertising text to be identified, such as Figure 3c shown.
[0126] In order to improve the recognition efficiency of subsequent advertisement texts, the server may also establish an abnormal advertisement type database for the abnormal advertisement type.
[0127] In actual application, after identifying the advertisement product information and the advertisement company information, the advertisement type identification device can also first perform a search and perform the next step of operation according to the search result. Figure 4 , Figure 4 Another embodiment of the method for identifying the type of advertisement in the embodiment of the present application includes:
[0128] 401. Obtain advertisement text to be identified, a first information database, and a second information database.
[0129] In this embodiment, the advertisement text to be identified can be obtained by the server extracting text from the advertisement webpage, or by a third-party terminal extracting text from the advertisement webpage, and then sent to the server by the third-party terminal. The specific details are not limited here. At the same time, the server can also generate the first information library and the second information library based on historical identification maintenance. The first information library is a mapping library between the advertisement product and the advertisement type. For example, the first information library can represent Figure 4a As shown, advertisement product 1 corresponds to advertisement type 1, advertisement product 2 corresponds to advertisement type 1, advertisement product 3 corresponds to advertisement type 2, and so on. The second information database is a mapping database between the advertising company and the advertisement type. For example, the second information database can represent Figure 4b As shown, advertising company 1 corresponds to advertising type 1, advertising company 2 corresponds to advertising type 2, advertising company 3 corresponds to advertising type 3, etc. It can be understood that the data storage method of the first information library and the second information library is not limited here, as long as the mapping relationship between advertising products and advertising types and between advertising companies and advertising types can be established.
[0130] In an exemplary solution, the server or the third-party terminal can extract text from the advertising web page by accessing it with a static crawler. For example, take out the advertising web page from the advertising task queue to be collected, and use the static crawler to access the web page to obtain the content of the web page. The static crawler uses the Python language and the requests library. To use the requests library, you first need to install it through pip install requests, and then execute the requests.get(url) command, where url is a specific advertising link. After executing the above-mentioned request.get(url) command, you can extract the advertising text corresponding to the advertising web page. Specifically, the advertising text can include an advertising title text and an advertising body text. For example, the advertising text can be as follows: the advertising title text is "XX drink can treat YY", and the advertising body text is "XX drink is squeezed from pure natural XX fruit, and XX fruit includes rich vitamins, which can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789".
[0131] 402. Calling a named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized to obtain corresponding advertisement product information, and searching the first information database according to the advertisement product information to obtain a first search result.
[0132] The server calls a named entity recognition model deployed on itself or a third-party device to perform named entity recognition on the advertisement text to be recognized to obtain corresponding advertisement product information. Then, a traversal search is performed in the first information database according to the advertisement product information to obtain the first search result.
[0133] In this embodiment, the named entity recognition model can adopt the above Figure 2c to Figure 2d The BERT+BiLSTM+CRF model described in the invention is used. The specific structure and training method of the named entity recognition model are not described here. When the advertisement product is recognized in the advertisement text, the specific application process can be as follows: the advertisement text to be recognized includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is produced by squeezing pure natural XX fruit, which contains rich vitamins and can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789". After passing the named entity recognition model, the output advertisement product information is "XX drink".
[0134] 403. Calling the information extraction model to perform information extraction processing on the advertisement text to be identified to obtain corresponding advertising company information, and searching the second information database according to the advertising company information to obtain a second search result.
[0135] The server calls an information extraction model deployed on itself or a third - party device to extract information from the advertisement text to be recognized, so as to obtain the corresponding advertisement company information. Then, according to the advertisement company information, a traversal search is performed in the second information database to obtain the second search result.
[0136] In this embodiment, the information extraction model can be a Flashtext model or a regular expression "r'company is (\w+)'".
[0137] The specific operation of the regular expression is simple. However, for this embodiment, since the position of the company name in the advertisement text is different, the expressions are also different. Therefore, a large number of regular expressions need to be maintained when using the regular expression, which results in low accuracy and coverage.
[0138] The Flashtext model can identify the advertisement company information more quickly and accurately, and its specific process can be as follows:
[0139] First, obtain the company name information library, and its magnitude can be determined according to actual needs. For example, in order to achieve a better coverage rate, its magnitude can be defined as hundreds of millions. Among them, the company name information library is used to store multiple company names. For example, the company name can be as follows: A City B Pharmaceutical Technology Co., Ltd., C Pharmaceutical Co., Ltd., D Technology Co., Ltd., etc. Then add the company name information library to the keyword library of the FlashText model; finally, use the advertisement text to be identified to retrieve the advertising company information corresponding to the advertisement text to be identified in the keyword library. In an exemplary scheme, the specific implementation process of the FlashText model can be as follows: Step 1, obtain the vocabulary, which is divided into char level and word level, and can be regarded as a dictionary, where the key is all possible char or word, and the value is its corresponding id; assume that the length of the vocabulary here is D, that is, there are at most D different chars or words. Step 2, divide the input sentence into the char or word in step 1, that is, word segmentation; according to the id of each char or word in step 1, the original sentence is converted from text to a string of numbers, which is called a word vector. Generally speaking, the converted word vector is of fixed length, so it is necessary to short-fill and long-truncate. Step 3, embedding: word vectors and multiple n-gram feature vectors need to be embedded. Embedding can use pre-trained networks or random initialization; embedding will change the size. Take bs = 128 and word vector length V = 32 as an example. The input features are all 128x32. You can manually set a hyperparameter of the mapping dimension, such as 300. After mapping, the tensor size becomes 128x32x300, and the elements are changed from the original positive integers to decimals. Step 4, network structure: concatenate all vectors and take the average value in the dimension of word vector length V as the feature representation; you can set 1 to 2 fully connected layers (fc) and dropout layers to finally get the classification probability, that is, output the final information.
[0140] For example, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can cure YY", the advertisement body text is "XX drink is squeezed from pure natural XX fruit. XX fruit is rich in vitamins and can effectively cure YY. For more details, please visit the official website of ZZ company or call 123456789". After passing through the FlashText module, the output advertising company information is "ZZ company".
[0141] 404. Determine whether the first search result and the second search result are both empty. If so, execute steps 405 to 407; if not, execute step 408.
[0142] After obtaining the first search result and the second search result, the server first determines whether the search results are empty. If they are empty, it means that the advertising product and the advertising company corresponding to the advertising text to be identified are not included in the two information databases, and it is necessary to identify them through the advertising type identification model. If at least one of the two search results is not empty, the advertising type of the advertising text to be identified can be obtained according to the search result that is not empty.
[0143] 405 . Perform word segmentation processing on the advertisement text to be identified and count each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold.
[0144] The server segments the advertisement text to be identified by using Jieba word segmentation to obtain a phrase set, then counts the number of occurrences of each phrase in the phrase set to obtain the statistical number corresponding to each phrase; finally, a phrase whose statistical number is greater than a first threshold is selected to generate the target phrase.
[0145] It is understandable that the server may also sort the statistical times from large to small and select the top N phrases as the target phrases; the server may also sort the statistical times from small to large and select the bottom N phrases as the target phrases. The specific implementation method is not limited here. For example, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is produced by squeezing pure natural XX fruit, XX fruit includes rich vitamins, which can effectively treat YY. For details, please visit the official website of ZZ company or call 123456789", and the phrase set obtained by using stuttering word segmentation can be as follows: "XX / drink / can / treat / YY / XX / drink / is / produced / by / pure / natural / XX / fruit / , / XX / fruit / includes / rich / vitamins / , / can / effectively / treat / YY / . / For details, / please / visit / ZZ / company / official / website / or / please / call / 123456789 / ". Then, the number of times each phrase appears is counted, and the following results can be obtained: "XX" appears 4 times, "drinks" appears 2 times, "can" appears 2 times, "treatment" appears 2 times, "YY" appears 2 times, "adopt" appears 1 time, "is" appears 1 time, "pure natural" appears 1 time, "of" appears 2 times, "fruit" appears 2 times, "conduct" appears 1 time, "squeeze" appears 1 time, "generate" appears 1 time, "in" appears 1 time, "include" appears 1 time, "rich" appears 1 time, "vitamins" appears 1 time, "in" appears 1 time, "effective" appears 1 time, "details" appears 1 time, "please" appears 1 time, "visit" appears 1 time, "ZZ" appears 1 time, "company" appears 1 time, "official website" appears 1 time, "or" appears 1 time, "please" appears 1 time, "dial" appears 1 time, "telephone" appears 1 time, and "123456789" appears 1 time. If the first threshold is 1, the target phrases will include "XX", "drinks", "can", "treatment", "YY", "of", and "fruit".
[0146] 406. The at least one target phrase, the advertisement product information, and the advertisement company information are fused to obtain an input vector of an advertisement type recognition model.
[0147] The server embeds the at least one target phrase, the advertising product information and the advertising company respectively to obtain processing vectors, and then splices the processing vectors to obtain the input vector; or first splices the target phrase, the advertising product information and the advertising company to generate a long phrase, and then embeds the long phrase to obtain the input vector. In an exemplary scheme, the advertisement text to be identified includes the following: the advertisement title text is "XX drink can treat YY", the advertisement body text is "XX drink is squeezed from pure natural XX fruit, XX fruit includes rich vitamins, which can effectively treat YY. For more information, please visit the official website of ZZ company or call 123456789", and the target phrases obtained by using the stuttering word segmentation are as follows: "XX", "drink", "can", "treat", "YY", "of", "fruit"; the advertisement product information is "XX drink"; the advertisement company information is "ZZ company". When embedding, the processing vectors corresponding to the target phrase are as follows: "E1 E2", "E3 E4", "E5 E6", "E7 E8", "E9 E10", "E11", "E12 E13"; the processing vectors corresponding to the advertising product information are as follows: "E14 E15 E16 E17"; the processing vectors corresponding to the advertising company information are as follows: "E18 E19E20 E21". The input vector obtained by concatenating the above processing vectors is "E1 E2 E3 E4 E5 E6 E7 E8 E9 E10E11 E12 E13 E14 E15 E16 E17 E18 E19 E20E21".
[0148] 407. Based on the input vector, the advertisement type recognition model is called to perform advertisement type recognition processing on the advertisement text to be recognized, so as to obtain a corresponding advertisement type.
[0149] The server transmits the input vector to the input layer of the advertisement type recognition model through the corresponding interface, and then performs advertisement type recognition processing on the advertisement text to be recognized according to the advertisement type. In this embodiment, the advertisement type recognition model can be a TextCNN model, and its specific network structure and training method have been described above, and will not be repeated here.
[0150] 408. Perform decision processing according to the first search result and the second search result to obtain the advertisement type corresponding to the advertisement text to be identified.
[0151] If the server can perform a decision process based on the priorities of the first search result and the second search result to obtain the advertisement type corresponding to the advertisement text to be identified.
[0152] In an exemplary embodiment, if the priority of the second search result is higher than that of the first search result, then when the second search result is not empty, it is determined that the advertisement type indicated by the second search result is the advertisement type corresponding to the advertisement text to be identified; when the second search result is empty and the first search result is not empty, it is determined that the advertisement type indicated by the first search result is the advertisement type corresponding to the advertisement text to be identified. For example, if the first search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 1" and the second search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 2", it is determined that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 2". If the first search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 1" and the second search result is empty, it is determined that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 1".
[0153] Similarly, if the priority of the first search result is higher than that of the second search result, then when the first search result is not empty, it is determined that the advertisement type indicated by the first search result is the advertisement type corresponding to the advertisement text to be identified; when the first search result is empty and the second search result is not empty, it is determined that the advertisement type indicated by the second search result is the advertisement type corresponding to the advertisement text to be identified. For example, if the first search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 1", and the second search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 2", it is determined that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 1". If the second search result indicates that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 2", and the first search result is empty, it is determined that the advertisement type corresponding to the advertisement text to be identified is "advertisement type 2".
[0154] It is understandable that in order to manage the advertisement text, the server can also make corresponding prompt operations when the advertisement type is identified as an abnormal advertisement type. In an exemplary solution, the server sends a pop-up prompt to the advertisement webpage corresponding to the advertisement text to be identified, so as to prompt the user that the advertisement on the current advertisement webpage is an abnormal advertisement, such as Figure 3a As shown; or the server sends a voice message to the advertising webpage corresponding to the advertising text to be identified, and plays it on the advertising webpage to prompt the user that the advertisement on the current advertising webpage is an abnormal advertisement, such as Figure 3b As shown; or the server directly blocks the advertising webpage corresponding to the advertising text to be identified, such as Figure 3c shown.
[0155] In order to improve the recognition efficiency of subsequent advertisement texts, the server may also establish an abnormal advertisement type database for the abnormal advertisement type.
[0156] The following is a detailed description of the advertisement type identification device in this application. Figure 5 , Figure 5 This is a schematic diagram of an embodiment of an advertisement type identification device in an embodiment of the present application. The advertisement type identification device 20 includes:
[0157] An acquisition module 201 is used to acquire the advertisement text to be identified;
[0158] Processing module 202 is used to call the named entity recognition model to perform named entity recognition on the advertising text to be recognized to obtain the corresponding advertising product information; call the information extraction model to perform information extraction processing on the advertising text to be recognized to obtain the corresponding advertising company information; perform word segmentation processing on the advertising text to be recognized and count each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold; fuse the at least one target phrase, the advertising product information, and the advertising company information to obtain an input vector of the advertising type recognition model; call the advertising type recognition model based on the input vector to perform advertising type recognition processing on the advertising text to be recognized to obtain the corresponding advertising type.
[0159] In the embodiment of the present application, an advertisement type identification device is provided. By using the above device, in the process of identifying the advertisement type of the advertisement text to be identified, the advertisement product corresponding to the advertisement text and the advertisement company information are introduced, which increases the features of the advertisement text, thereby improving the feature extraction of the advertisement text, and further improving the accuracy of advertisement type identification; at the same time, in the process of classifying the advertisement text, high-frequency phrases in the advertisement text are first extracted, and then the advertisement type is identified through the advertisement type identification model based on the high-frequency phrases, advertisement product information and advertisement company information, which can improve the model prediction speed and effectively distinguish some advertisement texts with low discrimination, and also improve the accuracy of advertisement type identification.
[0160] In an embodiment of the present application, an advertisement type identification device is provided. With the above device, after determining the advertisement type of the advertisement text to be identified, the relationship between the advertisement type and the advertisement product or the advertisement company is used to maintain the information database, so that the information in the information database can be increased, providing more information for the next retrieval, thereby reducing the time consumption of the next identification and improving the identification rate.
[0161] Optionally, in the above Figure 5 On the basis of the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application, the processing module 202 is specifically used to perform word segmentation processing on the advertisement text to be classified using Jieba word segmentation to obtain a phrase set;
[0162] Get the statistical number of each phrase in the phrase set;
[0163] The phrase whose statistical number is greater than the first threshold is determined as the target phrase.
[0164] In an embodiment of the present application, an advertisement type recognition device is provided. By using the above device and providing a Jieba word segmentation scheme to segment the advertisement text to be recognized, accurate word segmentation of Chinese text can be achieved, thereby obtaining a more accurate phrase set, thereby improving the recognition accuracy of the advertisement text.
[0165] Optionally, in the above Figure 5 Based on the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0166] The processing module 202 is specifically used to obtain an advertising company information database and add the advertising company information database to the vocabulary of the information extraction model, and the information extraction model is a Flashtext extraction model;
[0167] The Flashtext extraction model is called, and the advertisement text to be identified is extracted based on the vocabulary of the Flashtext extraction model to obtain the advertising company information.
[0168] In an embodiment of the present application, an advertisement type identification device is provided. By using the above device, a Flashtext extraction model and a preset advertisement company information library are provided, so that the advertisement company information in the advertisement text to be identified can be quickly extracted, thereby reducing the identification time and improving the identification efficiency.
[0169] Optionally, in the above Figure 5 On the basis of the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application, the processing module 202 is specifically used to embed the at least one target phrase, the advertisement product information and the advertisement company information respectively to obtain multiple word vectors;
[0170] Performing vector concatenation processing on the multiple word vectors to obtain an input vector of the advertisement type recognition model;
[0171] or;
[0172] The processing module is specifically used to perform text splicing processing on the at least one target phrase, the advertising product information and the advertising company information to obtain a text to be processed;
[0173] The text to be processed is embedded to obtain an input vector of the advertisement type recognition model.
[0174] In an embodiment of the present application, an advertisement type recognition device is provided. When the above device is used to recognize the advertisement text to be recognized based on the advertisement type recognition model, multi-feature information is provided. At this time, the multi-feature information needs to be fused, that is, the multi-feature information is spliced and word embedding is performed, so that a multi-feature input vector can be obtained, thereby improving the recognition accuracy.
[0175] Optionally, in the above Figure 5 Based on the corresponding embodiments, Figure 6 As shown, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application, the device also includes a prompt module 203 for prompting that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type when the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type.
[0176] In an embodiment of the present application, an advertisement type identification device is provided. With the above device, after identifying that the advertisement type is an abnormal advertisement type, the user can be prompted that the advertisement text is abnormal, so that the advertisement text can be effectively managed to prevent the user from believing the advertisement text.
[0177] Optionally, in the above Figure 6 On the basis of the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application, the prompt module 203 is specifically used to prompt the advertisement webpage corresponding to the advertisement text to be identified in a pop-up window form that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type;
[0178] or,
[0179] The prompt module 203 is specifically used to prompt the advertisement webpage corresponding to the advertisement text to be identified that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type in the form of voice broadcast;
[0180] or,
[0181] The prompt module 203 is specifically used to shield the advertisement text to be identified on the advertisement webpage corresponding to the advertisement text to be identified.
[0182] In the embodiment of the present application, a device for identifying advertisement types is provided. The device is used to provide multiple prompting schemes, which can increase the feasibility of the schemes.
[0183] Optionally, in the above Figure 5 Based on the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0184] The processing module 202 is further configured to generate an abnormal advertisement type database according to the abnormal advertisement type corresponding to the advertisement text to be identified.
[0185] In an embodiment of the present application, a device for identifying advertisement types is provided. By using the above device, the identified abnormal advertisement types are classified and stored, so that a search information library is added in the subsequent identification process, thereby improving the identification efficiency.
[0186] Optionally, in the above Figure 5 Based on the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0187] The acquisition module 201 is further used to acquire a first information library and a second information library, wherein the first information library is a mapping library of advertising products and advertising types, and the second information library is a mapping library of advertising companies and advertising types;
[0188] The processing module 202 is further used to obtain a first search result based on the advertising product information and the first information database, and to obtain a second search result based on the advertising company information and the second information database;
[0189] When the first search result and the second search result are not empty, determining that the advertisement type indicated by the second search result is the advertisement type corresponding to the advertisement text to be identified;
[0190] When the first search result is not empty and the second search result is empty, determining that the advertisement type indicated by the first search result is the advertisement type corresponding to the advertisement text to be identified;
[0191] When both the first search result and the second search result are empty, an operation of obtaining the target phrase of the advertisement text to be recognized is triggered.
[0192] In an embodiment of the present application, an advertisement type recognition device is provided. With the above device, after obtaining the advertisement product information and the advertisement company information, the advertisement type corresponding to the advertisement text to be recognized is first retrieved according to the mapping library between the advertisement product and the advertisement type and the mapping library between the advertisement company and the advertisement type, so that the model prediction process can be reduced, thereby reducing the recognition time and improving the recognition rate.
[0193] Optionally, in the above Figure 5 On the basis of the corresponding embodiment, in another embodiment of the advertising type identification device 20 provided in the embodiment of the present application, the processing module 202 is also used to update the first information database according to the advertising type and the advertising product information, and to update the second information database according to the advertising type and the advertising company information.
[0194] Optionally, in the above Figure 5Based on the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0195] The acquisition module 201 is specifically used to acquire the advertisement webpage to be collected;
[0196] The advertisement webpage is accessed by a static crawler, and the text content corresponding to the advertisement webpage is obtained as the advertisement text to be identified. The advertisement text to be identified includes an advertisement title text and an advertisement body text.
[0197] In an embodiment of the present application, a device for identifying advertisement types is provided. By using the above device, the advertisement text on the advertisement webpage is obtained by static crawling, and more comprehensive advertisement text can be extracted, so that the characteristic information of the advertisement text is richer, thereby improving the recognition accuracy.
[0198] Optionally, in the above Figure 6 Based on the corresponding embodiments, Figure 7 As shown, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0199] The acquisition module 201 is further used to acquire a first training sample and an initial named entity recognition model, wherein the first training sample includes a first advertisement sample and first annotation information of the first advertisement sample, wherein the first annotation information includes annotated product information and sentence position information of the product information in the advertisement sample, and the initial named entity recognition model includes a bidirectional encoder representation from transformers (BERT), a bidirectional long short-term memory network (BiLSTM), and a conditional random field network (CRF);
[0200] The processing module 202 is further used to obtain an input word vector of the first training sample;
[0201] Based on the BERT, the input word vector is embedded and encoded to obtain a first vector;
[0202] Perform feature extraction on the first vector based on the BiLSTM to obtain a label sequence;
[0203] Decoding the labeled sequence based on the CRF to obtain a predicted character sequence of the first training sample;
[0204] Obtaining a loss value according to the predicted character sequence and the first annotation information;
[0205] The device also includes a training module 204, which is used to train the initial named entity recognition model according to the loss value to obtain the named entity recognition model.
[0206] In an embodiment of the present application, an advertisement type recognition device is provided. Using the above device, the named entity recognition model adopts a BERT+BiLSTM+CRF network structure, and the training sample is a self-labeled sample, which can effectively extract product information from the advertisement, ensure the accuracy of the advertisement product information, and thus improve the recognition accuracy of the advertisement type.
[0207] Optionally, in the above Figure 7 Based on the corresponding embodiment, in another embodiment of the advertisement type identification device 20 provided in the embodiment of the present application,
[0208] The acquisition module 201 is further used to acquire a second training sample and an initial advertisement type recognition model, where the initial advertisement type recognition model is a text convolutional neural network TextCNN;
[0209] The processing module 202 is further used to call the named entity recognition model to perform named entity recognition processing on the second training sample to obtain corresponding training advertising product information; call the information extraction model to perform information extraction processing on the second training sample to obtain corresponding training advertising company information;
[0210] Performing word segmentation processing on the second training sample and performing statistics on each phrase to obtain at least one training phrase whose statistical number is greater than the first threshold;
[0211] fusing the training advertisement product information, the training advertisement company information and the at least one training phrase to obtain a training input vector of the initial advertisement type recognition model;
[0212] The device also includes a training module 204, which is used to train the initial advertisement type recognition model based on the training input vector to obtain the advertisement type recognition model.
[0213] In an embodiment of the present application, an advertisement type recognition device is provided. By using the above device, high-frequency phrases in the training sample are first extracted during the training of the advertisement text, and then the advertisement type recognition model is trained based on the high-frequency phrases, advertisement product information, and advertisement company information, which can improve the model prediction speed and effectively distinguish some advertisement texts with low discrimination, and also improve the accuracy of advertisement type recognition.
[0214] The advertisement type identification device provided in this application can be used in a server, see Figure 8 , Figure 8: is a schematic diagram of a server structure provided in an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.
[0215] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2000. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM etc.
[0216] The steps performed by the advertisement type identification device in the above embodiment can be based on the Figure 8 The server structure shown.
[0217] The advertisement type identification device provided in this application can be used in terminal equipment. Fig. 9 For the sake of convenience, only the parts related to the embodiments of the present application are shown. For specific technical details not disclosed, please refer to the method part of the embodiments of the present application. In the embodiments of the present application, the terminal device is a smart phone as an example for explanation:
[0218] Fig. 9 The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Fig. 9 The smart phone includes: a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will appreciate that Fig. 9The structure of the smartphone shown in the figure does not constitute a limitation of the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0219] Combine the following Fig. 9 A detailed introduction to the various components of a smartphone:
[0220] The RF circuit 410 can be used for receiving and sending signals during the process of sending and receiving information or making calls. In particular, after receiving the downlink information of the base station, it is sent to the processor 480 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communication (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.
[0221] The memory 420 can be used to store software programs and modules. The processor 480 executes various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the smartphone (such as audio data, a phone book, etc.), etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0222] The input unit 430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smart phone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 431 or near the touch panel 431 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into contact coordinates, and then sends it to the processor 480, and can receive and execute commands sent by the processor 480. In addition, the touch panel 431 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 431, the input unit 430 may also include other input devices 432. Specifically, other input devices 432 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.
[0223] The display unit 440 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 440 may include a display panel 441. Optionally, the display panel 441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides a corresponding visual output on the display panel 441 according to the type of touch event. Although in Fig. 9 In the embodiment, the touch panel 431 and the display panel 441 are used as two independent components to implement the input and output functions of the smartphone, but in some embodiments, the touch panel 431 and the display panel 441 can be integrated to implement the input and output functions of the smartphone.
[0224] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in smartphones, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0225] The audio circuit 460, the speaker 461, and the microphone 462 can provide an audio interface between the user and the smartphone. The audio circuit 460 can transmit the received audio data to the speaker 461 after converting the received audio data into an electrical signal, which is converted into a sound signal for output; on the other hand, the microphone 462 converts the collected sound signal into an electrical signal, which is received by the audio circuit 460 and converted into audio data, and then the audio data is output to the processor 480 for processing, and then sent to another smartphone through the RF circuit 410, or the audio data is output to the memory 420 for further processing.
[0226] WiFi is a short-range wireless transmission technology. Smartphones can help users send and receive emails, browse web pages, and access streaming media through WiFi module 470, which provides users with wireless broadband Internet access. Fig. 9 A WiFi module 470 is shown, but it is understandable that it is not an essential component of the smartphone and can be omitted as needed without changing the essence of the invention.
[0227] Processor 480 is the control center of the smartphone, which uses various interfaces and lines to connect various parts of the entire smartphone, and executes various functions of the smartphone and processes data by running or executing software programs and / or modules stored in memory 420, and calling data stored in memory 420, thereby monitoring the smartphone as a whole. Optionally, processor 480 may include one or more processing units; optionally, processor 480 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into processor 480.
[0228] The smart phone also includes a power source 490 (such as a battery) for supplying power to various components. Optionally, the power source can be logically connected to the processor 480 through a power management system, thereby managing functions such as charging, discharging, and power consumption management through the power management system.
[0229] Although not shown, the smartphone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0230] The steps performed by the advertisement type identification device in the above embodiment can be based on the Fig. 9 The terminal device structure shown.
[0231] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0232] The present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.
[0233] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0234] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0235] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0236] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0237] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0238] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for identifying advertisement type, characterized in that: include: Obtain the advertisement text to be identified; Calling a named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain corresponding advertisement product information; Calling the information extraction model to perform information extraction processing on the advertisement text to be identified, so as to obtain corresponding advertising company information; Performing word segmentation processing on the advertisement text to be identified and counting each phrase to obtain at least one target phrase whose statistical number is greater than a first threshold; fusing the at least one target phrase, the advertisement product information, and the advertisement company information to obtain an input vector of an advertisement type recognition model; The advertisement type recognition model is called based on the input vector to perform advertisement type recognition processing on the advertisement text to be recognized, so as to obtain a corresponding advertisement type.
2. The method according to claim 1, characterized in that The step of performing word segmentation processing on the advertisement text to be identified and counting each word group to obtain at least one target word group whose statistical number is greater than a first threshold comprises: Using the Jieba word segmentation to perform word segmentation processing on the advertisement text to be classified to obtain a phrase set; Obtaining the statistical number of each phrase in the phrase set; A phrase whose statistical number is greater than the first threshold is determined as the at least one target phrase.
3. The method according to claim 1, characterized in that The calling of the information extraction model to extract information from the advertisement text to be identified to obtain corresponding advertising company information includes: Acquire an advertising company information database, and add the advertising company information database to the vocabulary of the information extraction model, where the information extraction model is a Flashtext extraction model; The Flashtext extraction model is called, and the advertisement text to be identified is extracted based on the vocabulary of the Flashtext extraction model to obtain the advertising company information.
4. The method according to claim 1, characterized in that The step of fusing the at least one target phrase, the advertisement product information, and the advertisement company information to obtain an input vector of the advertisement type recognition model includes: Embedding the at least one target phrase, the advertising product information, and the advertising company information to obtain a plurality of word vectors; Performing vector concatenation processing on the multiple word vectors to obtain an input vector of the advertisement type recognition model; or; Performing text splicing processing on the at least one target phrase, the advertising product information, and the advertising company information to obtain a text to be processed; The text to be processed is embedded to obtain an input vector of the advertisement type recognition model.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: When the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type, it is prompted that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type.
6. The method according to claim 5, characterized in that Prompting that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type includes: Prompt, in a pop-up window on the advertisement webpage corresponding to the advertisement text to be identified, that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type; or, Prompting, in the form of voice broadcast, on the advertisement webpage corresponding to the advertisement text to be identified, that the advertisement type corresponding to the advertisement text to be identified is an abnormal advertisement type; or, The advertisement text to be identified is shielded on the advertisement webpage corresponding to the advertisement text to be identified.
7. The method according to claim 5, characterized in that The method further comprises: An abnormal advertisement type database is generated according to the abnormal advertisement type corresponding to the advertisement text to be identified.
8. The method according to any one of claims 1 to 4 or 6 and 7, characterized in that: Before obtaining the target phrase of the advertisement text to be identified, the method further includes: Acquire a first information database and a second information database, wherein the first information database is a mapping database of advertisement products and advertisement types, and the second information database is a mapping database of advertisement companies and advertisement types; Obtain a first search result based on the advertisement product information and the first information database, and obtain a second search result based on the advertisement company information and the second information database; When the first search result and the second search result are not empty, determining that the advertisement type indicated by the second search result is the advertisement type corresponding to the advertisement text to be identified; When the first search result is not empty and the second search result is empty, determining that the advertisement type indicated by the first search result is the advertisement type corresponding to the advertisement text to be identified; When both the first search result and the second search result are empty, an operation of acquiring the target phrase of the to-be-recognized advertisement text is triggered.
9. The method according to claim 8, characterized in that The method further comprises: The first information base is updated according to the advertisement type and the advertisement product information, and the second information base is updated according to the advertisement type and the advertisement company information.
10. The method according to any one of claims 1 to 4, 6, 7 and 9, characterized in that: The step of obtaining the advertisement text to be identified comprises: Obtain the advertisement webpage to be collected; The advertisement webpage is accessed by a static crawler, and the text content corresponding to the advertisement webpage is obtained as the advertisement text to be identified. The advertisement text to be identified includes an advertisement title text and an advertisement body text.
11. The method according to any one of claims 1 to 4, 6, 7 and 9, characterized in that: The method further comprises: Obtaining a first training sample and an initial named entity recognition model, wherein the first training sample includes a first advertisement sample and first annotation information of the first advertisement sample, the first annotation information includes annotated product information and sentence position information of the product information in the advertisement sample, and the initial named entity recognition model includes a bidirectional transform encoder network BERT, a bidirectional long short-term memory network BiLSTM, and a conditional random field network CRF; Obtaining an input word vector of the first training sample; Based on the BERT, the input word vector is embedded and encoded to obtain a first vector; Performing feature extraction on the first vector based on the BiLSTM to obtain a label sequence; Decoding the labeled sequence based on the CRF to obtain a predicted character sequence of the first training sample; Obtaining a loss value according to the predicted character sequence and the first annotation information; The initial named entity recognition model is trained according to the loss value to obtain the named entity recognition model.
12. The method according to any one of claims 1 to 4, 6, 7 and 9, characterized in that: The method further comprises: Obtain a second training sample and an initial advertisement type recognition model, wherein the initial advertisement type recognition model is a text convolutional neural network TextCNN; Calling the named entity recognition model to perform named entity recognition processing on the second training sample to obtain corresponding training advertisement product information; Calling the information extraction model to perform information extraction processing on the second training sample to obtain corresponding training advertising company information; Performing word segmentation processing on the second training sample and performing statistics on each phrase to obtain at least one training phrase having a statistical number greater than the first threshold; fusing the training advertisement product information, the training advertisement company information and the at least one training phrase to obtain a training input vector of the initial advertisement type recognition model; The initial advertisement type recognition model is trained based on the training input vector to obtain the advertisement type recognition model.
13. An advertisement type identification device, characterized in that: include: An acquisition module, used for acquiring the advertisement text to be identified; A processing module is used to call a named entity recognition model to perform named entity recognition processing on the advertisement text to be recognized, so as to obtain corresponding advertisement product information; and call an information extraction model to perform information extraction processing on the advertisement text to be recognized, so as to obtain corresponding advertisement company information; The advertisement text to be identified is segmented and each phrase is counted to obtain at least one target phrase whose statistical times are greater than a first threshold; the at least one target phrase, the advertisement product information, and the advertisement company information are fused to obtain an input vector of an advertisement type identification model; based on the input vector, the advertisement type identification model is called to perform advertisement type identification processing on the advertisement text to be identified to obtain a corresponding advertisement type.
14. A computer device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is used to execute the program in the memory, and the processor is used to execute the method according to any one of claims 1 to 12 according to the instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.
15. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 12.
