Method, device, electronic device and storage medium for filtering advertisement content in text
By combining the FastText model and attention layer neural network, the accuracy of advertising content filtering in text is improved, and the problem of low accuracy of advertising content filtering in the prior art is solved, achieving higher filtering accuracy and robustness.
Patent Information
- Application Number
- CN201911115512.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-14
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2040-08-24
AI Technical Summary
In the prior art, the accuracy of filtering advertising content in text is low and cannot meet user needs.
The word vector pre-trained using the FastText model is combined with a neural network containing an attention layer to obtain the classification results of advertising content, thereby performing high-accurate advertising content filtering.
It improves the accuracy and recall of advertising content filtering, overcomes the shortcomings of low recall of classification recognition and frequent updates of sensitive thesaurus in unsupervised technology, and enhances robustness.
Smart Images

Figure CN110889717B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of natural language processing, and in particular to a method, device, electronic device and storage medium for filtering advertisement content in text. Background Art
[0002] With the development of information technology, people frequently read various texts on the Internet in their daily lives, such as public account articles and news information. In the case of universal online reading, many text producers or text movers often add advertising content to the text in order to improve efficiency. This behavior undoubtedly has a negative impact on user experience.
[0003] In order to avoid the adverse effects of advertising content on user experience, there is a need to filter advertising content in text. In the prior art, when filtering advertising content in text, unsupervised technology is used, for example, classification and filtering of advertising content based on matching of sensitive word libraries with rules. This method has a low accuracy rate for advertising content classification and cannot meet the demand for filtering advertising content in text. Summary of the invention
[0004] An object of the present disclosure is to provide a method, device, electronic device and storage medium for identifying advertisement content in a text, which can improve the filtering accuracy of advertisement content in a text.
[0005] According to one aspect of an embodiment of the present disclosure, a method for filtering advertisement content in a text is disclosed, the method comprising:
[0006] Get the text of the advertisement content to be filtered;
[0007] Based on the word vectors pre-trained by the FastText model, obtain the word vectors corresponding to each word in the text;
[0008] Inputting the word vector into a neural network including a cascaded attention layer to obtain the advertising content classification results corresponding to each word;
[0009] Based on the advertisement content classification result, the text is filtered for advertisement content.
[0010] According to one aspect of an embodiment of the present disclosure, a device for filtering advertisement content in a text is disclosed, the device comprising:
[0011] A first acquisition module, used to acquire the text of the advertisement content to be filtered;
[0012] A second acquisition module is used to obtain the word vectors corresponding to each word in the text based on the word vectors pre-trained by the FastText model;
[0013] A third acquisition module is used to input the word vector into a neural network including an attention layer to obtain the advertising content classification results corresponding to each word;
[0014] A filtering module is used to filter the advertisement content of the text based on the advertisement content classification result.
[0015] According to one aspect of an embodiment of the present disclosure, an electronic device for filtering advertisement content in text is disclosed, comprising: a memory storing computer-readable instructions; and a processor reading the computer-readable instructions stored in the memory to execute the above method.
[0016] According to one aspect of an embodiment of the present disclosure, a computer-readable storage medium is disclosed, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the above-described method.
[0017] The disclosed embodiment improves the model network structure used for filtering advertising content in text by combining pre-trained word vectors obtained using the FastText model with a neural network that introduces an attention mechanism, thereby improving the accuracy of filtering advertising content in text.
[0018] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.
[0021] Figure 1A The invention shows a system architecture applied to advertisement content recognition in text according to an embodiment of the present disclosure.
[0022] Figure 1B The interactive process of each terminal in identifying advertisement content in a text according to an embodiment of the present disclosure is shown.
[0023] Figure 1C The interactive process of each terminal in identifying advertisement content in a text according to an embodiment of the present disclosure is shown.
[0024] Figure 2 A flowchart of a method for identifying advertisement content in text according to an embodiment of the present disclosure is shown.
[0025] Figure 3The figure shows a model network structure applied to advertisement content recognition in text according to an embodiment of the present disclosure.
[0026] Figure 4 A block diagram of a device for identifying advertisement content in text according to an embodiment of the present disclosure is shown.
[0027] Figure 5 A hardware structure diagram of an electronic device for identifying advertisement content in text according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0028] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that the description of the present disclosure will be more comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0029] In addition, the described features, structures or characteristics may be combined in one or more example embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the example embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, steps, etc. may be adopted. In other cases, well-known structures, methods, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0030] Some of the blocks shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0031] The embodiments of the present disclosure relate to the field of artificial intelligence, and further to the field of natural language processing and machine learning within the field of artificial intelligence.
[0032] Among them, 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 machines have the functions of perception, reasoning and decision-making.
[0033] 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 technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. The embodiments of the present disclosure are based on artificial intelligence technology. More specifically, the embodiments of the present disclosure are based on natural language processing technology and machine learning to filter advertising content in text with high accuracy.
[0034] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies. Specifically, in the embodiments of the present disclosure, processing text based on natural language processing technology is the basis for filtering advertising content in text.
[0035] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithmic 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 generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching. Specifically, in the disclosed embodiments, the text is processed in combination with the FastText model in machine learning and natural language processing technology.
[0036] With the research and advancement 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. I believe that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0037] The solution provided by the embodiments of the present disclosure involves technologies such as natural language processing of artificial intelligence, which is specifically described by the following embodiments:
[0038] First refer to Figures 1A-1C The system architecture of advertisement content filtering in text according to the embodiment of the present disclosure is described.
[0039] Figure 1A The basic system architecture of filtering advertisement content in text of an embodiment of the present disclosure is shown as follows: a text processing server 10, a text production terminal 20, and a text receiving terminal 30. The text production terminal 20 is used to produce and upload text; the text processing server 10, as the execution subject of the present disclosure embodiment, filters the advertisement content of the text after receiving the text uploaded by the text production terminal 20, removes the advertisement part irrelevant to the main content of the text, and then publishes the text after the advertisement content is filtered and sends it to the text receiving terminal 30.
[0040] Understandably, Figure 1AWhat is shown is only a system architecture that may be applied to the present disclosure, which is used to show the roughly complete architecture composition of the present disclosure in a specific application. It does not mean that in a specific application, the implementation of the present disclosure must strictly rely on the system architecture. For example, in one embodiment, even if there is no text production end 20 to send the produced text to the text processing server 10, the text processing server 10 can filter the advertising content of the pre-stored text. This embodiment is only an exemplary description and does not limit the function and scope of use of the present disclosure.
[0041] It should be noted that Figure 1A The one-way arrow between the terminals indicates only the direction of text transmission, and does not mean that the terminals can only communicate in one direction according to the one-way arrow. It can be understood that in addition to the one-way transmission of text, the terminals can also perform various two-way communications with each other, which will not be repeated here.
[0042] Figure 1B The interactive process of each terminal for filtering advertisement content in text in an embodiment of the present disclosure is further shown. In this embodiment, after the text processing server 10 obtains the text produced by the text production terminal 20, before publishing the text, the text to be published is filtered for advertisement content according to the method provided by the present disclosure. After the advertisement content filtering is completed, the text that has been filtered for advertisement content is published and sent to the text receiving terminal 30.
[0043] For example, in one embodiment, the text processing server 10 is a public account server, which is used to manage the operation of each public account; the text production end 20 is a public account management end, which is used for the public account administrator to manage the public accounts registered by them; the text receiving end 30 is a public account subscription end, which is used for the public account subscribing readers to read the public account.
[0044] The public account administrator can produce public account articles through the public account management terminal, and then upload the produced public account articles to the public account server; after receiving the public account article, the public account server filters the advertising content of the public account article, removes the advertising parts in the public account article that are not related to the main content of the article, and then publishes the public account article after the advertising content is filtered and sends it to the public account subscription terminal, so that the public account subscribers can read the public account articles without advertisements through the public account subscription terminal.
[0045] It should be noted that this embodiment is only an exemplary description and does not limit the function and scope of use of the present disclosure.
[0046] Figure 1CThe interactive process of each terminal for filtering advertisement content in text in another embodiment of the present disclosure is further shown. In this embodiment, after the text processing server 10 obtains the text produced by the text production terminal 20, it publishes the text and sends it to the text receiving terminal 30. The text processing server 10 inspects the published text and filters the advertisement content. If the advertisement content contained therein is identified and filtered out, the text processing server 10 republishes the text with the advertisement content filtered out and sends it to the text receiving terminal 30.
[0047] For example, in one embodiment, the text processing server 10 is a news information server, which is used to collect news information from various sources for centralized display; the text production end 20 is a local newspaper platform or a self-media platform for journalists to produce first-hand news information; the text receiving end 30 is a news information subscription end, which is used for news information subscription readers to read news information.
[0048] After the news information server receives and collects the news information produced by various local newspaper platforms or self-media platforms, it will be published for news information subscribers to read. At the same time, the inspection module of the news information server inspects the published texts and filters the advertising content in real time according to the method provided by the present disclosure. If it is detected that one of the published texts contains advertising content, the advertising content in the text is filtered, and the text with the advertising content filtered out is republished and sent to the news information subscriber, so that the news information subscriber can read the news information without advertising content through the news information subscriber.
[0049] It should be noted that this embodiment is only an exemplary description and does not limit the function and scope of use of the present disclosure.
[0050] The specific process of the method for filtering advertisement content in text provided by the present disclosure is described in detail below.
[0051] The execution subject of the embodiment of the present disclosure is Figures 1A-1C The text processing server shown. Specifically, depending on the application scenario, the corresponding execution subject can be a public account server or a news information server. It should be noted that the description of the execution subject is only exemplary and should not limit the function and scope of use of the present disclosure.
[0052] refer to Figure 2 As shown, the present disclosure provides a method for filtering advertisement content in a text, comprising:
[0053] 410. Obtain the text of the advertisement content to be filtered;
[0054] 420. Based on the word vectors pre-trained by the FastText model, obtain the word vectors corresponding to each word in the text;
[0055] 430. Input the word vector into a neural network including an attention layer to obtain the advertising content classification results corresponding to each word;
[0056] 440. Filter the text for advertisement content based on the advertisement content classification result.
[0057] The FastText model is an existing open source word vector and text classification model in the field of natural language processing. It takes each word represented in the form of a vector and the N-Gram features corresponding to each word as input, and outputs the label corresponding to the text. In its output, there is an output by-product-the embedding vector corresponding to each word, which is referred to as the "word vector" in this disclosure. Among them, the embedding vector refers to a vector that has been processed by dimensionality reduction; the N-Gram feature refers to the word feature used to evaluate the degree of difference between words. In the embodiment of the present disclosure, each word represented in the form of a vector and the N-Gram features corresponding to each word are used as the input of the FastText model to obtain the word vector corresponding to each word.
[0058] Specifically, the model structure of the FastText model is composed of an input layer, a hidden layer, and an output layer in sequence. The vector corresponding to each word in the text and the corresponding N-Gram feature are used as inputs of the input layer; then they pass through a hidden layer that superimposes and averages multiple vectors; and finally the output layer outputs the label of the text. While outputting the label of the text, the output layer also outputs the embedding vector corresponding to each word. In the disclosed embodiment, the embedding vector corresponding to each word output by the FastText model is used as the word vector corresponding to each word.
[0059] The attention layer refers to the neural network layer built based on the attention mechanism. The attention mechanism simulates the human information processing process: due to the limitations of information processing capabilities, humans will selectively focus on some information when processing information, while ignoring or weakening other parts of information. By introducing the attention mechanism, the performance of the neural network can be greatly improved.
[0060] Specifically, the attention layers involved in the embodiments of the present disclosure mainly include: multi-head attention layer and self-attention layer. Among them, the multi-head attention layer is a neural network layer established based on the multi-head attention mechanism. The multi-head attention uses multiple queries to calculate in parallel to select multiple information from the input information; the self-attention layer is a neural network layer established based on the self-attention mechanism. Self-attention is to calculate the weight of itself. Since the content of the attention layer principle is the existing technology, it will not be repeated here.
[0061] In the disclosed embodiment, the FastText model and the neural network with the attention mechanism are used to filter the advertising content in the text. Specifically, the FastText model is used to pre-train the words to obtain the pre-trained word vectors; then on this basis, the word vectors corresponding to each word in the text of the advertising content to be filtered are obtained; and then the word vectors corresponding to each word in the text of the advertising content to be filtered are input into the neural network including the attention layer, so as to obtain the advertising content classification results corresponding to each word with higher accuracy. On this basis, the accuracy of the advertising content filtering of the text is greatly improved.
[0062] It is understandable that according to the method provided by the present disclosure, the embodiments of the present disclosure can filter not only advertisement content, but also irrelevant content irrelevant to the main body of the text according to the change of actual application requirements.
[0063] The specific process of each step of the present disclosure is described in detail below.
[0064] In step 410, the text of the advertisement content to be filtered is obtained.
[0065] In the disclosed embodiment, the text of the advertising content to be filtered can theoretically be any text. In terms of application scenarios with application value - online text processing scenarios, the text of the advertising content to be filtered can be public account articles, news information, or any online platform articles. Before publishing these online platform articles (for example: public account articles, news information), in order to avoid the impact of advertising content on the user's reading experience, the corresponding online platforms (for example: public account servers, news information servers) use these online platform articles as the text of the advertising content to be filtered to filter the advertising content.
[0066] In one embodiment, the execution subject is a public account server. When the public account server receives the public account article to be published uploaded by the public account management terminal in real time, the public account article is used as the text of the advertisement content to be filtered.
[0067] In one embodiment, the execution subject is a news information processing server. The news information server captures the published news information in real time and uses the captured news information as the text of the advertisement content to be filtered.
[0068] It should be noted that the embodiments of the execution subject are only exemplary descriptions and should not limit the functions and scope of use of the present disclosure.
[0069] Step 420: Based on the word vectors pre-trained by the FastText model, obtain the word vectors corresponding to each word in the text.
[0070] In the disclosed embodiment, the FastText model is used to pre-train words to obtain word vectors corresponding to the words. Specifically, a corpus containing various commonly used words can be pre-set, and all the words in the corpus can be processed using the FastText model to obtain the word vector corresponding to each word in the corpus. It can be understood that the word vector obtained by pre-training each word in the corpus represents the semantic positioning of the word in the corpus. As long as the corpus is large enough, the word vector is universal, so the pre-trained word vector can also accurately represent the semantic positioning of the word in a specific text.
[0071] At the same time, the word vector is the vector representation of the word, which can be regarded as a binding relationship between the word vector and the corresponding word. It can be seen that based on the word vector pre-trained by the FastText model, the word vector corresponding to each word in the text of the advertisement content to be filtered can be obtained.
[0072] In one embodiment, the FastText model is used to pre-train word vectors by the following method:
[0073] Get the preset corpus;
[0074] Input each word in the corpus into a preset N-Gram model to obtain N-Gram features corresponding to each word;
[0075] The words and the N-Gram features corresponding to the words are input into a preset FastText model to obtain the word vectors corresponding to the words.
[0076] In this embodiment, a corpus containing enough words is pre-set so that the words contained in the corpus can basically cover the words contained in the text of each advertisement content to be filtered. Each word in the corpus is input into a preset N-Gram model to obtain the N-Gram features corresponding to each word, so that the FastText model can use each word and the corresponding N-Gram features as input to obtain the word vector corresponding to each word.
[0077] It should be noted that using the N-Gram model to obtain the N-Gram features of a word is a prior art content, so it will not be repeated here.
[0078] In one embodiment, before obtaining the word vectors corresponding to each word in the text based on the word vector pre-trained by the FastText model, it includes: segmenting all text contents in the text content of the text to obtain each word in the text.
[0079] In this embodiment, based on the word vectors pre-trained by the FastText model, according to the binding relationship between the word vectors and the corresponding words, as long as the words contained in the text of the advertisement content to be filtered are determined and then compared, the word vectors corresponding to the words in the text can be obtained.
[0080] Therefore, in this embodiment, before obtaining the word vectors corresponding to the respective words in the text of the advertisement content to be filtered, all the text contents in the text are first segmented to determine the words contained in the text.
[0081] It should be noted that the technology for word segmentation of text content is an existing technology, so it will not be described in detail here.
[0082] In one embodiment, the text content of the text consists of text content and image content. Before segmenting all the text content in the text to obtain each word in the text, it includes: extracting the text content in the image content based on optical character recognition technology.
[0083] It is understandable that text includes not only text content that can be directly extracted and exists in the form of characters, but also text content that cannot be directly extracted and exists in the form of pixels or other forms in pictures. Regardless of the form of text content, it can be presented to users as a carrier of advertising content. Therefore, in order to filter advertising content more comprehensively, it is necessary to extract the text content in the picture and include the text content in the picture in the scope of consideration for advertising content filtering.
[0084] In this embodiment, before obtaining the word vectors corresponding to each word in the text of the advertisement content to be filtered, more specifically, before all the text content in the text is segmented to obtain each word in the text, the text content in the picture content in the text is extracted based on optical character recognition technology.
[0085] The advantage of this embodiment is that, by extracting text content in the picture, the coverage of advertisement content recognition is improved.
[0086] The following describes the detailed process of processing the word vectors after obtaining the word vectors corresponding to each word in the advertisement content text to be filtered.
[0087] In step 430, the word vector is input into a neural network including an attention layer to obtain the advertising content classification results corresponding to each word.
[0088] In the embodiment of the present disclosure, after obtaining the word vectors corresponding to each word in the advertisement content text to be filtered, these word vectors are used as the input of the neural network, and the neural network classifies the corresponding words into advertisement content based on the input word vectors to determine which words belong to the advertisement content. Among them, the neural network in the embodiment of the present disclosure introduces an attention mechanism, including an attention layer, so that the advertisement content can be classified more accurately.
[0089] Figure 3 The model network structure used in an embodiment of the present disclosure for filtering advertising content in text is shown: the neural network is composed of an attention layer, a pooling layer, and a cascade of fully connected layers. Furthermore, the attention layer is composed of a cascade of a multi-head attention layer and a self-attention layer. In this embodiment, the word vector pre-trained by FastText is used as the input of the neural network, and is processed in turn by the multi-head attention layer, the self-attention layer, the pooling layer, and the fully connected layer, so as to output the advertising content classification results corresponding to each word. Among them, the pooling layer and the fully connected layer are common structures in the field of neural networks, so they will not be repeated here.
[0090] The present disclosure improves the model network structure for advertising content filtering by combining the FastText model with the neural network including the attention layer. This improvement overcomes the defects of the prior art that the classification and recognition of advertising content based on unsupervised technology has a low recall rate and requires frequent updates of sensitive word libraries and matching rules, improves the accuracy of advertising content classification, and can also improve the recall rate and robustness of advertising content classification. Thus, on this basis, the accuracy of advertising content filtering can be improved while the recall rate and robustness of advertising content filtering can be improved.
[0091] In step 440, the text is filtered for advertisement content based on the advertisement content classification result.
[0092] In one embodiment, filtering the text for advertisement content based on the advertisement content classification result includes:
[0093] Based on the advertisement content classification result, determining the area where the advertisement content in the text is located;
[0094] The text content in the region is cleared from the text.
[0095] In this embodiment, after the advertisement content classification result is obtained, it is possible to determine which words in the text are advertisement content, thereby determining the area where the advertisement content is located in the text. The text content in the area is cleared, thus filtering the advertisement content.
[0096] For example: a public account article consists of text and pictures. Among them, the advertising content classification results corresponding to each word in the 20th paragraph of the text of the public account article are all "non-advertising content", then it can be determined that the text content of the 20th paragraph belongs to advertising content, and the 20th paragraph will be removed from the public account article; the advertising content classification results corresponding to each word in the text content of picture A are all "non-advertising content", then it can be determined that picture A does not belong to advertising content, and picture A will not be removed; the advertising content classification results corresponding to each word in the text content of picture B are all "advertising content", then it can be determined that picture B belongs to advertising content, and picture B will be removed from the public account article, thereby filtering advertising content.
[0097] It should be noted that this embodiment is only an exemplary description and should not limit the function and scope of use of the present disclosure.
[0098] The overall execution process of an embodiment of the present disclosure is described in detail below to demonstrate the general performance of the present disclosure in practical applications.
[0099] In one embodiment, the execution entity for filtering advertisement content is a public account server, and the text of the advertisement content to be filtered is a public account article on an h5 (fifth generation html, i.e., fifth generation hypertext markup language) details page.
[0100] After receiving the official account article, the official account server extracts the text content and image content contained in the official account article according to the HTML structure; and extracts the text content contained in the image content according to the optical character recognition technology. Based on the word vector pre-trained by the FastText model, the word vector corresponding to each word in all the text content is obtained; the word vector corresponding to each word is input into the neural network containing the attention layer, and the neural network classifies each word to obtain the advertising content classification result corresponding to each word. In this way, the official account server can determine which part of the official account article is the area where the advertising content is located, and then clear the content of the area, thereby filtering the advertising content.
[0101] It should be noted that this embodiment is only an exemplary description and should not limit the function and scope of use of the present disclosure.
[0102] In one embodiment, before obtaining the text of the advertisement content to be filtered, the method includes: accessing a real-time text processing link, wherein the real-time text processing link is used to process the text in real time;
[0103] The obtaining of the text of the advertisement content to be filtered includes: obtaining the text of the advertisement content to be filtered from the real-time text processing link, so as to filter the advertisement content of the text in real time.
[0104] In this embodiment, the method provided by the present disclosure is encapsulated as a complete online service module, which is connected to a real-time text processing link, so as to perform real-time advertising content filtering on the text flowing on the real-time text processing link.
[0105] The advantage of this embodiment is that it accesses a real-time text processing link, so that the embodiment of the present disclosure can filter the advertisement content in real time according to the requirements of the application scenario.
[0106] Specifically, in one embodiment, the public account article processing server sets up a real-time article processing link in the cloud to perform a series of real-time processing on the public account articles to be published. In this embodiment, the real-time article processing link is composed of a sensitive content review module and a format conversion module in sequence. Before the public account articles to be published are published, they will be reviewed for sensitive content and format converted by the real-time article processing link.
[0107] If advertising content is to be filtered for public account articles to be published, the method provided by the present invention can be encapsulated as a complete service module - an advertising content filtering module, and the advertising content filtering module can be connected to the real-time article processing link, so as to perform real-time advertising content filtering on the articles on the real-time article processing link.
[0108] For example, the advertisement content filtering module is connected before the sensitive content review module to obtain a real-time article processing chain - advertisement content filtering module, sensitive content review module, and format conversion module. Thus, the articles passing through the real-time article processing chain are sequentially subjected to advertisement content filtering, sensitive content review, and format conversion.
[0109] It should be noted that this embodiment is only an exemplary description and does not limit the function and scope of use of the present disclosure.
[0110] Specifically, in one embodiment, the news highlight server sets up a real-time article inspection link in the cloud to perform a series of real-time inspections on the published news articles. In this embodiment, the real-time article inspection link is composed of a source review module and an validity period review module in sequence. The news highlight server will capture the published news articles in real time, input the captured news articles into the real-time article inspection link, and perform source review and validity period review.
[0111] If it is desired to add advertising content filtering to news articles during real-time inspection, the method provided by the present invention can be encapsulated as a complete service module, namely, an advertising content filtering module, and the advertising content filtering module can be connected to the real-time article inspection link, so as to filter the advertising content of the captured news articles in real time.
[0112] For example, the advertisement content filtering module is connected between the source review module and the validity period review module to obtain a real-time article inspection link - source review module, advertisement content filtering module, and validity period review module. Thus, through this real-time article inspection link, the captured news articles are subjected to source review, advertisement content filtering, and validity period review in real time.
[0113] It should be noted that this embodiment is only an exemplary description and does not limit the function and scope of use of the present disclosure.
[0114] According to an embodiment of the present disclosure, Figure 4 As shown, a device for filtering advertisement content in text is also provided, the device comprising:
[0115] A first acquisition module 510 is used to acquire the text of the advertisement content to be filtered;
[0116] A second acquisition module 520 is used to acquire the word vectors corresponding to each word in the text based on the word vectors pre-trained by the FastText model;
[0117] A third acquisition module 530 is used to input the word vector into a neural network including a cascaded attention layer to obtain the advertising content classification results corresponding to each word;
[0118] The filtering module 540 is configured to filter the text for advertisement content based on the advertisement content classification result.
[0119] In an exemplary embodiment of the present disclosure, the device is configured as follows:
[0120] Get the preset corpus;
[0121] Input each word in the corpus into a preset N-Gram model to obtain N-Gram features corresponding to each word;
[0122] The words and the N-Gram features corresponding to the words are input into a preset FastText model to obtain the word vectors corresponding to the words.
[0123] In an exemplary embodiment of the present disclosure, the device is configured to: segment all text contents in the text content of the text to obtain each word in the text.
[0124] In an exemplary embodiment of the present disclosure, the text content of the text consists of text content and picture content, and the device is configured to extract the text content from the picture content based on optical character recognition technology.
[0125] In an exemplary embodiment of the present disclosure, the cascaded attention layer is composed of a multi-head attention layer and a self-attention layer cascaded.
[0126] In an exemplary embodiment of the present disclosure, the filtering module 540 is configured to: determine the area where the advertisement content in the text is located based on the advertisement content classification result;
[0127] The text content in the region is cleared from the text.
[0128] In an exemplary embodiment of the present disclosure, the device is configured as follows:
[0129] Accessing a real-time text processing link, wherein the text processing link is used to process the text in real time;
[0130] The text of the advertisement content to be filtered is obtained from the real-time text processing link.
[0131] The method for filtering advertisement content in text in the embodiment of the present disclosure may be performed by Figures 1A-1C The text processing server 10 shown is implemented. Figure 5 The text processing server 10 according to an embodiment of the present disclosure is described. Figure 5 The displayed text processing server 10 is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0132] like Figure 5 As shown, the text processing server 10 is in the form of a general computing device. The components of the text processing server 10 may include but are not limited to: at least one processing unit 610, at least one storage unit 620, and a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610).
[0133] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 performs the steps according to various exemplary embodiments of the present invention described in the description of the exemplary method described above in this specification. For example, the processing unit 610 can perform the following steps: Figure 2 The steps shown in .
[0134] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .
[0135] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0136] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0137] The text processing server 10 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the text processing server 10, and / or any device that enables the text processing server 10 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. In addition, the text processing server 10 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. As shown, the network adapter 660 communicates with other modules of the text processing server 10 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the text processing server 10, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0138] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0139] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is further provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the method described in the above method embodiment.
[0140] According to one embodiment of the present disclosure, a program product for implementing the method in the above method embodiment is also provided, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0141] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RGM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0142] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0143] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0144] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as JScript, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0145] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0146] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0147] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0148] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.
Claims
1. A method for filtering advertisement content in text, characterized in that: The method comprises: Get the text of the advertisement content to be filtered; Based on the word vectors pre-trained by the FastText model, obtain the word vectors corresponding to each word in the text; Input the word vector into a neural network composed of a cascade of an attention layer, a pooling layer, and a fully connected layer to obtain the advertising content classification results corresponding to each word; the attention layer is composed of a cascade of a multi-head attention layer and a self-attention layer; Based on the advertisement content classification result, filtering the text for advertisement content; Among them, the FastText model is used to pre-train word vectors through the following methods: Obtaining a preset corpus; the words contained in the corpus can cover the words contained in the text of each filtered advertisement content; Input each word in the corpus into a preset N-Gram model to obtain N-Gram features corresponding to each word; The words and the N-Gram features corresponding to the words are input into a preset FastText model to obtain word vectors corresponding to the words; the model structure of the FastText model is composed of an input layer, a hidden layer, and an output layer in sequence, and the output layer of the FastText model outputs the embedding vector corresponding to each word while outputting the label of the text as the word vector corresponding to each word.
2. The method according to claim 1, characterized in that Before obtaining the word vectors corresponding to the respective words in the text based on the word vectors pre-trained by the FastText model, it includes: performing word segmentation on all text contents in the text content of the text to obtain the respective words in the text.
3. The method according to claim 1, characterized in that The text content of the text consists of text content and picture content. Before segmenting all the text content in the text to obtain each word in the text, it includes: extracting the text content in the picture content based on optical character recognition technology.
4. The method according to claim 1, characterized in that: The filtering of the text for advertisement content based on the advertisement content classification result includes: Based on the advertisement content classification result, determining the area where the advertisement content in the text is located; The text content in the region is cleared from the text.
5. The method according to claim 1, characterized in that Before obtaining the text of the advertisement content to be filtered, it includes: accessing a real-time text processing link, wherein the text processing link is used to process the text in real time; The obtaining of the text of the advertisement content to be filtered includes: obtaining the text of the advertisement content to be filtered from the real-time text processing link.
6. A device for filtering advertisement content in text, characterized in that: The device comprises: A first acquisition module, used to acquire the text of the advertisement content to be filtered; A second acquisition module is used to obtain the word vectors corresponding to each word in the text based on the word vectors pre-trained by the FastText model; The third acquisition module is used to input the word vector into a neural network composed of a cascade of an attention layer, a pooling layer, and a fully connected layer to obtain the advertising content classification results corresponding to each word; the attention layer is composed of a cascade of a multi-headattention layer and a self-attention layer; A filtering module, configured to filter the text for advertisement content based on the advertisement content classification result; Among them, the FastText model is used to pre-train word vectors through the following methods: Obtaining a preset corpus; the words contained in the corpus can cover the words contained in the text of each filtered advertisement content; Input each word in the corpus into a preset N-Gram model to obtain N-Gram features corresponding to each word; The words and the N-Gram features corresponding to the words are input into a preset FastText model to obtain word vectors corresponding to the words; the model structure of the FastText model is composed of an input layer, a hidden layer, and an output layer in sequence, and the output layer of the FastText model outputs the embedding vector corresponding to each word while outputting the label of the text as the word vector corresponding to each word.
7. An electronic device for filtering advertisement content in text, characterized in that: include: a memory storing computer-readable instructions; The processor reads the computer readable instructions stored in the memory to execute the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Computer readable instructions are stored thereon, and when the computer readable instructions are executed by a processor of a computer, the computer is caused to execute the method of any one of claims 1-5.
Citation Information
Patent Citations
Content identification method and device
CN110162628A