A text detection method and device, electronic equipment and storage medium

By preprocessing the text to be detected and replacing it with a knowledge graph, the problems of poor anti-interference ability and insufficient information extraction in the existing technology are solved, and more comprehensive negative information detection is achieved.

CN114064847BActive Publication Date: 2026-01-02BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110915749.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-10
Publication Date
2026-01-02
Estimated Expiration
2041-08-10

AI Technical Summary

Technical Problem

Existing technologies have poor anti-interference capabilities and insufficient information extraction when detecting negative information, resulting in incomplete and inaccurate detection.

Method used

By performing keyword matching on the text to be detected, if no negative information keywords are matched, preprocessing is performed, including character format conversion, symbol deletion, entity transformation and replacement, and word segmentation. Combined with knowledge graph, entities are replaced with target entities, thereby improving the anti-interference ability and information content of text detection.

Benefits of technology

It improves the comprehensiveness and accuracy of negative information detection, enabling more precise identification of entities and relationships in text, reducing interference factors, and ensuring the reliability of detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064847B_ABST
    Figure CN114064847B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text detection method and device, electronic equipment and storage medium, relates to the field of artificial intelligence, in particular to the field of natural language processing. The specific implementation scheme is: performing keyword matching on the to-be-detected text to obtain a matching result; in response to the matching result representing that the to-be-detected text does not include a keyword corresponding to negative information, preprocessing the to-be-detected text to obtain a candidate to-be-detected text; replacing an entity included in the candidate to-be-detected text with a target entity based on a knowledge graph corresponding to the to-be-detected text to obtain at least one target detection text; and detecting whether the target detection text includes the negative information. By applying the technical solution of the present disclosure, the comprehensiveness and accuracy of negative information detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of artificial intelligence, and particularly to a text detection method and device, an electronic device, and a storage medium in the field of natural language processing. BACKGROUND

[0002] In the information age, various types of information penetrate into all aspects of society through different channels. In some scenarios, it is often necessary to detect information to avoid the widespread dissemination of negative information that violates social laws and regulations and other negative information that can have a negative impact. Therefore, comprehensive and accurate detection of negative information is a goal that the field of natural language processing has been pursuing. SUMMARY

[0003] The present disclosure provides a text detection method, device, electronic device, and storage medium.

[0004] According to a first aspect of the present disclosure, a text detection method is provided, comprising:

[0005] performing keyword matching on the text to be detected to obtain a matching result;

[0006] In response to the matching result indicating that the text to be detected does not include a keyword corresponding to negative information, preprocessing the text to be detected to obtain a candidate text to be detected;

[0007] replacing an entity included in the candidate text to be detected with a target entity based on a knowledge graph corresponding to the text to be detected to obtain at least one target detection text;

[0008] detecting whether the target detection text includes the negative information.

[0009] According to a second aspect of the present disclosure, a text detection device is provided, comprising:

[0010] a keyword matching module configured to perform keyword matching on the text to be detected to obtain a matching result;

[0011] a preprocessing module configured to, in response to the matching result indicating that the text to be detected does not include a keyword corresponding to negative information, preprocess the text to be detected to obtain a candidate text to be detected;

[0012] a replacement module configured to replace an entity included in the candidate text to be detected with a target entity based on a knowledge graph corresponding to the text to be detected to obtain at least one target detection text;

[0013] a detection module configured to detect whether the target detection text includes negative information.

[0014] According to a third aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein

[0015] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the text detection method described above.

[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the text detection method described above.

[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the text detection method described above.

[0018] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0019] The accompanying drawings are used to better understand the present scheme, and do not limit the present disclosure. Among them:

[0020] Figure 1 An optional processing flow diagram of the text detection method provided by the present disclosure;

[0021] Figure 2 A schematic diagram of the trie tree constructed by the present disclosure based on the determined pattern string;

[0022] Figure 3 A flowchart of an automaton matching provided by the present disclosure;

[0023] Figure 4 A multi-relation graph representing a knowledge graph provided by the present disclosure;

[0024] Figure 5 A schematic diagram of a knowledge graph of a social network provided by the present disclosure;

[0025] Figure 6 A detailed processing flow diagram of the text detection method provided by the present disclosure;

[0026] Figure 7 A network architecture diagram of the text detection method provided for implementing the present disclosure;

[0027] Figure 8 A detailed processing flow diagram of the text detection method provided by the present disclosure; Figure 6The processing result schematic diagram corresponding to each operation in the processing flow schematic diagram shown is as follows:

[0028] Figure 9 is an optional component structure schematic diagram of the text detection device provided by the present disclosure.

[0029] Figure 10 is an architecture schematic diagram of the text detection system provided by the present disclosure.

[0030] Figure 11 is a block diagram of the device for implementing the text detection method of the embodiment of the present disclosure. DETAILED DESCRIPTION

[0031] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to assist in understanding, and should be considered as merely exemplary. Thus, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, descriptions of well-known functions and structures are omitted in the following description.

[0032] In the following description, "some embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments, and can be combined with each other without conflict.

[0033] In the following description, the terms "first\second\third" are merely to distinguish similar objects, and do not represent a specific order of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence as allowed, so that the embodiments of the present disclosure described herein can be implemented in an order other than that illustrated or described herein.

[0034] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which the present disclosure belongs. The terms used herein are merely for the purpose of describing the embodiments of the present disclosure and are not intended to limit the present disclosure.

[0035] Before the embodiments of the present disclosure are further described in detail, the terms and phrases involved in the embodiments of the present disclosure are explained, which are applicable to the following explanations.

[0036] (1) Artificial intelligence (AI, Artificial Intelligence) is the use of digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method and technology and application system.

[0037] (2) Natural language processing is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science and mathematics. Therefore, the glasses in the field of natural language processing will design natural language, that is, the language used in daily life, so natural language processing is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies.

[0038] (3) Knowledge graph is a structured semantic knowledge base, which is used to quickly describe the concepts and their relationships in the physical world. By reducing the data granularity from the file level to the data level, a large amount of knowledge is aggregated, so as to realize the rapid response and reasoning of knowledge; The basic unit of knowledge graph is a triple consisting of "entity-relationship-entity".

[0039] (4) Entity refers to a recognized concept set, concept framework, such as "people", "events", "things", etc.

[0040] Entities can be manually constructed by artificial editing (with the help of entity editing software), or constructed in an automated data-driven manner.

[0041] The spread of negative information may derive significant public opinion or cause significant losses, therefore, it is necessary to detect whether the text includes negative information, if it includes negative information, the text is recalled to avoid the spread of the text including negative information. In the related technology, the following scheme is usually used for the recall of the text including negative information:

[0042] A set of keywords including negative information is stored or maintained in advance, it is detected whether there is any content in the text that is the same as any one keyword or a combination of multiple keywords in the keyword set, if there is, the text is recalled; if not, the text is not recalled.

[0043] However, the above scheme of the related art still has the following problems: on the one hand, in the related art, only when the content in the text is completely matched with the keyword or the keyword combination, the text can be recalled; if the text includes a deformation text of the keyword (for example, the keyword is "drama", and the text includes the deformation text "xiju" or "xij ju"), or the keyword in the text is increased by a character or a symbol (for example, the keyword is "drama", and the text includes "xiea drama" or "xie! drama"), it is still considered that the text does not include the keyword. Therefore, the above scheme of the related art has the problem of poor anti-interference ability. On the other hand, the above keyword matching mode takes the text as a string of characters; the amount of information extracted when the keyword is matched is only whether it includes the keyword, while the text actually includes various entities, relationships and semantic expressions; when the keyword is matched, the information such as entities, relationships and semantic expressions cannot be extracted, and the amount of information extracted is small. As an example, if the text is "the capital of X dynasty is P", the text has obvious errors, but "X dynasty", "capital" and "P" are recognized by keyword matching, and the error of the text cannot be recognized. The text includes two entities "X dynasty" and "P", and includes a relationship "capital" and a semantic "is"; from the perspective of the amount of text information, it is known that the capital of X dynasty is Q, not P, so it is determined that the text has errors and risks. Therefore, the scheme in the related art has the problems of incomplete and inaccurate negative information detection.

[0044] In view of the problems of incomplete and inaccurate text detection caused by poor anti-interference ability and small amount of extracted information in the above method for detecting text provided by the related art, the embodiments of the present disclosure provide a text detection method, device, electronic equipment and storage medium. First, keyword matching is performed on the text to be detected; if the keyword matching result indicates that the text to be detected includes the keyword corresponding to the negative information, the text to be detected is recalled; if the keyword matching result indicates that the text to be detected does not include the keyword corresponding to the negative information, the anti-interference ability of text detection can be improved by preprocessing the text to be detected to obtain a candidate text to be detected. Replacing part of the information in the candidate text to be detected with a target entity text based on a knowledge graph can improve the amount of text information extracted from the text to be detected. The embodiments of the present disclosure can improve the comprehensiveness and accuracy of negative detection information by improving the anti-interference ability of text detection and improving the amount of text information extracted from the text to be detected.

[0045] Figure 1 is an optional processing flow diagram of the text detection method provided by the present disclosure, which can at least include the following steps:

[0046] Step S101, keyword matching is performed on the text to be detected to obtain a matching result.

[0047] In some embodiments, the device performing the text detection method needs to obtain the text to be detected before performing keyword matching on the text to be detected. The text to be detected can be text converted from audio information or video information. For example, the device performing the text detection method obtains audio information or video information, performs speech recognition on the audio information or video information, and takes the recognized text as the text to be detected. The text to be detected can also be text directly obtained by the device performing the text detection method.

[0048] In some embodiments, the keyword can be pre-set, and the device performing the text detection method (such as a terminal device or a server) obtains the pre-set keyword to detect the text to be detected based on the keyword when triggering the process of detecting the text to be detected. The keyword can also be a function item for inputting a keyword presented by the device performing the text detection method on a display interface after triggering the process of detecting the text to be detected. After a user inputs the keyword based on the function item, the device performing the text detection method obtains the keyword input by the user, and then detects the text to be detected based on the keyword input by the user.

[0049] In some embodiments, the keyword can be a set of words related to negative information and filtered by risk control data. The keyword can include sensitive words, and can also include words constructed according to hot topics, real events, and supervisory requirements for sudden events and instructions. The keyword can include multiple keywords, and each keyword can be an independent word, a combination of two or more words, or a phrase including multiple words.

[0050] In some embodiments, keyword matching on the text to be detected can be implemented by the following technical solutions: generating an automaton corresponding to each pre-set keyword, and serializing the automata corresponding to all keywords and storing them in the device performing the text detection method, such as storing them in the hard disk of the device performing the text detection method. When the device performing the text detection method starts or runs, all automata are loaded into the memory of the device performing the text detection method. Then, the matching algorithm of the automaton is used to match the keywords. The matching algorithm of the automaton can support one-word matching, two-word matching, and multi-word matching.

[0051] The following describes an optional way of matching based on automata provided by the present disclosure. Figure 2 and Figure 3 First, determine the pattern strings "ash", "shex", "bcd", and "sha". Then, based on the determined pattern strings, construct an automaton as shown in FIG. 1. Figure 2The trie tree shown. Among them, "ash", "shex", "bcd", and "sha" can correspond to different words respectively. Taking the matching keyword as "ashe" as an example, the process of automaton matching is as follows Figure 3 shown. First, use "ash" to match in the trie tree. Since "ash" is a complete pattern string in the trie tree, therefore, look for the next "e". Since there is no letter after "ash", jump to the "h" pointed to by the fail pointer of "h" to continue the search; "e" is not found, continue the search; the search result is that the current "h" points to the root node. Then continue the search from the root node. Since "e" is not found, the search process ends and the matching fails.

[0052] Step S102, in response to the matching result indicating that the keyword corresponding to the negative information is not included in the text to be detected, preprocess the text to be detected to obtain the candidate text to be detected.

[0053] In some embodiments, preprocessing the text to be detected may be converting the characters in the text to be detected into characters in a preset format by using a converter; and / or converting the text in the text to be detected into text in a preset font. Among them, the characters in the preset format may be lowercase characters or uppercase characters, and the text in the preset font may be simplified Chinese. By unifying the characters and text in the text to be detected into a preset format, the normalization processing of the text to be detected is realized, and a unified text input format is provided for the subsequent text detection process.

[0054] In specific implementation, if the text to be detected includes characters, convert the characters into characters in a preset format; if the text to be detected includes text, convert the text into text in a preset font; if the text to be detected includes both characters and text, convert the characters into characters in a preset format and convert the text into text in a preset font.

[0055] As an example, the text to be detected is "A我爱黄山A". Convert the characters into lowercase characters and convert the font into simplified Chinese, then convert "A我爱黄山A" into "a我爱黄山a".

[0056] In some other embodiments, preprocessing the text to be detected may be using a filter to identify the symbols in the text to be detected and delete the symbols in the text to be detected. Among them, the symbols may be symbols other than characters and text such as punctuation marks, digital symbols, Roman symbols, etc.

[0057] In a specific implementation, if the text to be detected includes characters and words, the characters are first converted into characters in a preset format, and the words are converted into words in a preset format; then, the symbols in the text to be detected are identified and deleted. If the text to be detected does not include characters and words, the symbols in the text to be detected are directly identified and deleted. In this way, by deleting the symbols included in the text to be detected, the interference caused by the symbols on the text detection can be excluded, and the anti-interference capability of the text detection is improved.

[0058] For example, if the text to be detected after the character conversion and the word conversion is "I w* love a@ yellow h- mountain s", the symbols "*" "-" and "@" included in the text to be detected are identified, and after the symbols in the text to be detected are deleted, the text "I w love a yellow h mountain s" is obtained.

[0059] In some embodiments, after the symbols in the text to be detected are deleted, the words in the text to be detected can be further identified, and the words are spliced according to the order of the words in the text to be detected. In this way, by identifying and splicing the words in the text to be detected, the Chinese information included in the text can be extracted, further interference factors can be excluded, and the anti-interference capability of the text detection is improved.

[0060] For example, if the text to be detected after the symbols are deleted is "I w love a yellow h mountain s", the words included in the text are further identified, including "I", "love", "yellow", and "mountain". The words are spliced according to the order of the four words in the text as "I love yellow mountain".

[0061] In some other embodiments, the pre-processing of the text to be detected can be to identify the entity deformation text included in the text to be detected by using a replacer, and replace the entity deformation text with entity ontology text. The entity deformation text can be text obtained by performing homophonic substitution or other deformation on entity text, or by performing full-pinyin substitution, pinyin abbreviation, or the like on words.

[0062] In specific implementation, if the text to be detected does not include characters, words, and symbols, directly identify the entity deformed text included in the text to be detected, and replace the entity deformed text with the entity original text. If the text to be detected does not include characters and words, but only includes symbols, first identify the symbols in the text to be detected, and delete the symbols in the text to be detected; then, identify the entity deformed text included in the text to be detected, and replace the entity deformed text with the entity original text. If the text to be detected includes characters and words, but does not include symbols, first convert the characters into characters in a preset format, and convert the words into words in a preset format; then, identify the entity deformed text included in the text to be detected, and replace the entity deformed text with the entity original text. If the text to be detected includes characters, words, and symbols, first convert the characters into characters in a preset format, and convert the words into words in a preset format; then, identify and delete the symbols in the text to be detected; then, identify the words in the text to be detected, and splice the words in the order of the words in the text to be detected; finally, identify the entity deformed text included in the text to be detected, and replace the entity deformed text with the entity original text. If the text to be detected includes characters, words, and symbols, first convert the characters into characters in a preset format, and convert the words into words in a preset format; then, identify and delete the symbols in the text to be detected; finally, identify the entity deformed text included in the text to be detected, and replace the entity deformed text with the entity original text.

[0063] In summary, in the embodiments of the present disclosure, the characters in the text to be detected can be first converted into characters in a preset format, the words can be converted into words in a preset format, and the symbols in the text to be detected can be deleted; after performing the operations of character conversion, word conversion, and symbol deletion, the entity deformed text in the text to be detected after character conversion, word conversion, and symbol deletion can be replaced with the entity original text.

[0064] As an example, if the text to be detected after character conversion, word conversion, and character deletion includes entity deformed text, for example, the entity deformed text includes any one of "zhangsanfeng", "张三锋", "章叁疯", and "zhang三f", the entity deformed text can be replaced with the entity original text "张三丰".

[0065] In some other embodiments, the preprocessing of the text to be detected may include: performing word segmentation processing on the text to be detected based on semantics by using a word segmenter to obtain a word list; and annotating the corresponding word nature for each word included in the word list.

[0066] In a specific implementation, if the to-be-detected text does not include character, word, symbol and entity deformation text, the to-be-detected text is directly processed for word segmentation. If the to-be-detected text does not include character and word, only includes symbol, the symbol in the to-be-detected text is first identified and deleted; then, the entity deformation text included in the to-be-detected text is identified and replaced with entity ontology text; finally, the to-be-detected text is processed for word segmentation. If the to-be-detected text includes character and word, and does not include symbol, the character is first converted into a preset format character, and the word is converted into a preset format word; then, the entity deformation text included in the to-be-detected text is identified and replaced with entity ontology text; finally, the to-be-detected text is processed for word segmentation. If the to-be-detected text includes character, word and symbol, the character is first converted into a preset format character, and the word is converted into a preset format word; then, the symbol in the to-be-detected text is identified and deleted; then, the word in the to-be-detected text is identified and spliced according to the order of the word in the to-be-detected text; then, the entity deformation text included in the to-be-detected text is identified and replaced with entity ontology text; finally, the to-be-detected text is processed for word segmentation. If the to-be-detected text includes character, word and symbol, the character is first converted into a preset format character, and the word is converted into a preset format word; then, the symbol in the to-be-detected text is identified and deleted; then, the entity deformation text included in the to-be-detected text is identified and replaced with entity ontology text; finally, the to-be-detected text is processed for word segmentation.

[0067] In summary, in the embodiments of the present disclosure, the character in the to-be-detected text can be first converted into a preset format character, the word is converted into a preset format word, the symbol in the to-be-detected text is deleted, and the entity deformation text in the to-be-detected text is replaced with entity ontology text; after the character conversion, word conversion and symbol deletion operations are performed, the to-be-detected text after the character conversion, word conversion, symbol deletion and entity ontology text replacement is processed for word segmentation.

[0068] As an example, if the to-be-detected text after the character conversion, word conversion, character deletion and entity ontology replacement is "I love Huangshan", the word list obtained after the word segmentation processing includes the words "I", "love" and "Huangshan", and the part of speech of each word is respectively "I" (pronoun), "love" (verb) and "Huangshan" (place name). In this way, by marking the part of speech of each word, the structure of the to-be-detected text can be clearly determined, and the semantics of the to-be-detected text can be more accurately analyzed.

[0069] In some embodiments, the to-be-detected text can be processed by word segmentation based on a word dictionary algorithm in the prior art. The word dictionary algorithm refers to matching the to-be-matched string with a word in a "sufficiently large" word dictionary according to a certain strategy. If a word is found, it means that the matching is successful and the word is recognized. Specifically, the word dictionary algorithm can also include forward maximum matching, reverse maximum matching, and bidirectional matching word segmentation. A word segmentation model can also be trained based on a statistical machine learning algorithm, and the to-be-detected text can be processed by word segmentation using the word segmentation model. Specifically, the Chinese characters and words can be annotated and trained, not only considering the frequency of the words, but also considering the context of the words, so that the word segmentation model has good effect on the recognition of ambiguous words and out-of-vocabulary words.

[0070] In the embodiments of the present disclosure, the to-be-detected text is processed by character conversion, word conversion, symbol deletion, entity ontology text replacement, and word segmentation to obtain a candidate to-be-detected text. The candidate to-be-detected text can be a keyword set composed of multiple Chinese characters and words, and the Chinese characters and words in the keyword set can be referred to as keywords.

[0071] In step S103, the candidate to-be-detected text is replaced with a target entity based on the knowledge graph corresponding to the to-be-detected text to obtain at least one target detection text.

[0072] In some embodiments, the candidate to-be-detected text obtained in step S102 can be a keyword set composed of multiple Chinese characters and words. Then, the entities in the knowledge graph can be searched based on the order of the keywords in the keyword set.

[0073] In some embodiments, the knowledge graph can be referred to as a knowledge base of a semantic network (Semantic Network). The knowledge graph can be represented by a multi-relation graph. A multi-relation graph representing the knowledge graph is shown in FIG. 4. The multi-relation graph includes multiple types of nodes and edges, and different types of nodes and edges are marked by different types of lines. The nodes in the multi-relation graph represent "entities" in the knowledge graph, and the edges in the multi-relation graph represent "relationships" in the knowledge graph. The "relationships" are used to express the connection between different entities.

[0074] In some embodiments, network data can be crawled by a crawler, such as Wikipedia and Google search, to extract entities and build relationships between entities to form a knowledge graph. Different fields or industries correspond to different knowledge graphs. If a certain field is targeted, the network data of the field can be crawled by a crawler to build a knowledge graph of the field. As an example, entities in the knowledge graph can include: persons, institutions, events, and regions, etc. The relationships included in the knowledge graph can include: the kinship between persons, the position relationship between persons and institutions, the association relationship between persons and events, etc. The network formed by entities and relationships in the knowledge graph can maximize the extraction of information in the text. For example, the text "The mayor of Y city is A" can identify entities including "Y city" and "A" and relationships including "Y city-mayor" according to the knowledge graph.

[0075] The knowledge graph is described below with the social field as an example. As shown in Figure 5 Figure 5 is a schematic diagram of a knowledge graph of a social network, which can reflect the relationships between entities "Zhang San", "Li Si", "Xiao Wu", "Xiao Si", "Company A", and "Company B".

[0076] In some embodiments, based on the knowledge graph corresponding to the text to be detected, the candidate entity included in the text to be detected can be replaced by a target entity by at least the following schemes:

[0077] Scheme one, find the entity included in the text to be detected in the knowledge graph, determine the target entity corresponding to the entity; use the target entity to replace the entity included in the text to be detected, to obtain the first target detection text in the target detection text.

[0078] As an example, if the text to be detected includes "M", according to the knowledge graph, it is determined that the target entity corresponding to "M" is "M'", then "M" in the text to be detected is replaced by "M'" to obtain the first target detection text.

[0079] Scheme two, if the candidate text to be detected includes an entity and a first relationship corresponding to the entity, determine the target entity corresponding to the entity and the first relationship included in the candidate text to be detected based on the knowledge graph; use the target entity to replace the entity included in the text to be detected, to obtain the second target detection text in the target detection text.

[0080] As an example, if the text to be detected includes entity "M'" and first relationship "N", "M'" and "N" are replaced by target entity "N'" to obtain the second target detection text.

[0081] ​In a third scheme, if the first target detection text or the second target detection text includes a second relationship corresponding to the target entity, a new target entity corresponding to the target entity and the second relationship is determined based on the knowledge graph; and the new target entity is used to replace the target entity to obtain a third target detection text in the target detection text.

[0082] For example, for the first scheme, the target entity is "M'", and if the first target detection text includes a second relationship "E", a new target entity corresponding to "M'" and "E" is determined based on the knowledge graph to be "E'", and "M'" and "E" are replaced by "E'" to obtain a third target detection text.

[0083] For example, for the second scheme, the target entity is "M'", and if the second target detection text includes a second relationship "F", a new target entity corresponding to "M'" and "F" is determined based on the knowledge graph to be "F'", and "M'" and "F" are replaced by "F'" to obtain a third target detection text.

[0084] In the embodiments of the present disclosure, a greedy search algorithm is used to sequentially search for entities in the knowledge graph according to the order of the words included in the candidate detection text; and after searching for an entity, the corresponding relationship of the entity is searched (which can also be referred to as a bound relationship or an associated relationship); and the entity and the corresponding relationship of the entity are converted into a new entity based on the knowledge graph. Then, the corresponding relationship of the new entity is searched; and the new entity and the corresponding relationship of the new entity are converted into another new entity based on the knowledge graph; and so on, until no new entity is generated. In the search process, all searched entities are strictly arranged and combined, and no possible entity information search result is missed, ensuring zero loss of searched entity information.

[0085] For example, the detection text is "The mayor of Y city and his wife are very in love", and the candidate detection text is "Y city", "mayor" and "wife". According to the greedy search algorithm, the target entity corresponding to the entity "Y city" is searched based on the knowledge graph to be "Y' city", and "Y' city" is used to replace "Y city" to obtain a first target detection text "Y' city mayor and his wife are very in love". Then, the relationship "mayor" is searched based on the knowledge graph, and a new entity "A" is obtained according to "Y' city" and "mayor", and "A" is used to replace "Y' city" and "mayor" to obtain a second target detection text "A and his wife are very in love". Then, the relationship "wife" is searched based on the knowledge graph, and "B" is obtained according to "A" and "wife", and "B" is used to replace "his wife" to obtain a third target detection text "A and B are very in love". In this way, the target detection texts obtained include "Y' city mayor and his wife are very in love", "A and his wife are very in love" and "A and B are very in love".

[0086] In step S104, it is detected whether the target detection text includes negative information.

[0087] In some embodiments, whether the target detection text includes negative information can be detected based on a preset strategy.

[0088] In some embodiments, different strategies can be preset for different fields. For example, a strategy for the finance field can be preset, a strategy for the social field can be preset, a strategy for the logistics field can be preset, and the like.

[0089] In the embodiments of the present disclosure, the preset strategy can be flexibly plugged and unplugged, such as adding one or more strategies, or reducing one or more strategies, or changing the existing strategy, and the like, so as to configure the strategy according to the actual scene and improve the adaptability of text detection.

[0090] In some embodiments, the operation on the to-be-detected text can be performed according to the detection result of whether the target detection text includes negative information. The operation on the to-be-detected text can include recalling the to-be-detected text or not recalling the to-be-detected text. In response to the detection result including negative information, the to-be-detected text is recalled. In response to the detection result not including negative information, the to-be-detected text is not recalled.

[0091] For example, if the target detection text includes multiple target detection texts, and the detection result of any one of the target detection texts includes negative information, the to-be-detected text is recalled. Alternatively, if the number of target detection texts including negative information in the multiple target detection texts is greater than a preset threshold, the to-be-detected text is recalled. Alternatively, if the proportion of the number of target detection texts including negative information in the multiple target detection texts to the total number of target detection texts is greater than a preset proportion, the to-be-detected text is recalled.

[0092] For example, the risk level of the target detection text can also be determined according to the content of the negative information included in the target detection text, and whether the to-be-detected text is recalled can be determined according to the risk level. For example, if the risk level of the to-be-detected text is determined to be low risk according to the content of the negative information included in the target detection text, the to-be-detected text is not recalled. If the risk level of the to-be-detected text is determined to be high risk according to the content of the negative information included in the target detection text, the to-be-detected text is recalled.

[0093] As an example, it is also possible to determine whether to recall the text to be detected by combining two factors: the number of object detection texts including negative information and the risk level of the object detection texts. For example, if the number of object detection texts including negative information is greater than a preset threshold, and the risk level of the text to be detected is determined to be high risk based on the content of the negative information included in the object detection text, then the text to be detected is recalled. Or, if the proportion of the number of object detection texts including negative information among multiple object detection texts to the total number of object detection texts is greater than a preset proportion, and the risk level of the text to be detected is determined to be high risk based on the content of the negative information included in the object detection text, then the text to be detected is recalled.

[0094] The following combines Figure 6 , Figure 7 and Figure 8 to illustrate the implementation manner of the text detection method provided by the embodiments of the present disclosure in a specific application scenario. Figure 6 is a detailed processing flow schematic diagram of the text detection method provided by the present disclosure, Figure 7 is a network architecture diagram for implementing the text detection method provided by the present disclosure; Figure 8 is a schematic diagram of the processing results corresponding to each operation in the Figure 6 shown processing flow schematic diagram.

[0095] Step S201, obtain the text to be detected.

[0096] In some embodiments, it may be to first obtain a multimedia file such as an audio or video file, and then convert the multimedia file into the text to be detected, or directly obtain the text to be detected.

[0097] In some embodiments, as shown by the label "a" in Figure 8 , the text to be detected is "The person with the highest position in the H* Dynasty* is Zhang San".

[0098] Step S202, perform keyword matching on the text to be detected.

[0099] In some embodiments, keyword matching can be based on Figure 7The dictionary matching layer implementation shown pre-generates an automaton corresponding to each keyword, stores it, and loads the automaton. Then, the matching algorithm of the automaton is used to match the keywords, and a single-word match (also known as a word match), a two-word match (also known as a phrase match), or a multi-word match can be performed. Among them, a single-word match can refer to finding whether there is text in the text to be detected that matches a preset keyword. A two-word match can refer to finding whether there is text in the text to be detected that matches two preset keywords, and these two keywords can be two independent keywords or two keywords that form a phrase. A multi-word match can refer to finding whether there is text in the text to be detected that matches multiple preset keywords. The multiple keywords can be independent keywords respectively, or a phrase composed of two or more keywords, or a short sentence composed of two or more keywords, or a combination of at least two of the three forms. If the matching result is a hit on a keyword, it is determined that the text to be detected has a risk, and the text to be detected is recalled. In the embodiments of the present disclosure, if the matching result for the text to be detected is a miss on the keyword, step S203 is executed. Among them, a hit on a keyword can mean that the text to be detected includes at least one word that is exactly the same as the keyword in the dictionary matching layer.

[0100] Step S203: Preprocess the text to be detected to obtain a candidate text to be detected.

[0101] In some embodiments, it can be based on Figure 7 the text processing layer shown to process the text to be detected. As an example, the converter in the text processing layer can be used to first convert the uppercase characters in the text to be detected to lowercase characters and convert the traditional Chinese characters in the text to be detected to simplified Chinese characters, obtaining Figure 8 the “The highest-ranking person in the *H Dynasty* is Zhang San” marked as “b” in Figure 8 Then, the special symbols (such as “*” and “-”) are deleted using a filter, and the Chinese characters and characters are extracted and concatenated to obtain Figure 8 the “The highest-ranking person in the H Dynasty is Zhang San” marked as “c” in Figure 8 Then, the full spelling of the entity and the variant of the entity are replaced with the entity itself using a replacer, obtaining

[0102] In step S204, the candidate to-be-detected text is replaced based on the knowledge graph to obtain a target detection text.

[0103] In some embodiments, the candidate to-be-detected text can be replaced based on Figure 7 The knowledge graph layer is configured to replace the candidate to-be-detected text. The knowledge graph layer is configured to construct a knowledge graph, which includes entities and relationships. For a knowledge graph of a certain field, the entities can include persons and institutions, and the relationships can include person-kin-person, institution-position-person, and the like.

[0104] In some embodiments, as shown in Figure 6 , it is first determined whether an entity is searched in the knowledge graph. If the entity is not searched, it is determined whether the candidate to-be-detected text is searched. If the candidate to-be-detected text is not searched, it is determined whether an entity is searched in the knowledge graph. In the embodiment of the present disclosure, the entity "H Chao" indicated by the identifier "f" in Figure 8 is searched, and the corresponding institution entity is "H' Chao". The first target detection text "H' Chao (entity) is the person with the highest position, Zhang San" is obtained. Then, it is determined whether a relationship associated with the entity is searched. If not, it is determined whether an entity is searched in the knowledge graph. In the embodiment of the present disclosure, the "person with the highest position" indicated by the identifier "g" in Figure 8 is searched, and the corresponding institution-position-person relationship "H' Chao-position highest person-Wang Er" is searched. The entity and the relationship are replaced by a new entity, and the second target detection text "Wang Er (entity) is Zhang San" is obtained. Then, the "Zhang San" indicated by the identifier "h" in Figure 8 is searched, and the corresponding person entity "Zhang San" is searched. The third target detection text "Wang Er (entity) is Zhang San (entity)" is obtained. Finally, it is determined whether the candidate to-be-detected text obtained in step S203 is searched completely. If not, the entity is continuously searched. If yes, a combination of the target detection texts (including the first target detection text, the second target detection text, and the third target detection text) is generated. In the embodiment of the present disclosure, the generated target detection texts include "H Chao (entity) is the person with the highest position, Zhang San", "Wang Er (entity) is Zhang San", and "Wang Er (entity) is Zhang San (entity)".

[0105] In step S205, it is determined whether the target detection text hits a strategy.

[0106] In some embodiments, it can be determined whether the target detection text hits the strategy based on Figure 7 the strategy layer. The strategy layer includes a plurality of pre-stored strategies. If the target detection text hits any strategy included in the strategy layer, it is determined that the to-be-detected file is risky, and the to-be-detected file is recalled.

[0107] In the embodiment of the present disclosure, as shown in Figure 8 , the strategy layer includes a plurality of pre-stored strategies. If the target detection text hits any strategy included in the strategy layer, it is determined that the to-be-detected file is risky, and the to-be-detected file is recalled.As shown, for the first target detection file, the common entity "H Chao" is detected, and according to the strategy, it can be judged that the first target detection file is medium risk. For the second target detection file, the key entity "Wang Er" is detected, and according to the strategy, it can be judged that the second target detection file is high risk. For the third target detection file, the entity determination error is detected, and according to the strategy, it can be judged that the third target detection file is high risk. According to the detection result, the detection file "H * Chao * position highest person is Zhang San" is recalled.

[0108] By adopting the text detection method provided in the embodiments of the present disclosure, after the keyword matching method does not hit the keyword, the pre-processing is further performed on the to-be-detected text, and the to-be-detected text is detected in combination with the knowledge graph. By pre-processing the to-be-detected text, the interference information such as special symbols in the to-be-detected file can be excluded, and the transformation of the entity is replaced by the entity itself, thereby increasing the information amount of the to-be-detected text. By pre-processing the to-be-detected text, the font of the to-be-detected text can be normalized, and the text format of the subsequent text detection is unified. By the knowledge graph and the greedy search algorithm, the information amount of the to-be-detected text extracted can be maximized, and the negative information can be comprehensively and accurately detected.

[0109] It should be noted that, Figure 7 The data layer shown is used to construct the knowledge graph and the keyword. Specifically, the network information such as Wikipedia and Google can be crawled by a crawler to construct the knowledge graph. The keyword can be constructed by risk control data filtering and emergency shielding words.

[0110] It should be noted that the above Figures 6 to 8 The embodiments shown are detailed descriptions of the text detection method provided by the present disclosure for one application scenario. For different application scenarios, the text detection method provided by the present disclosure can also be used to detect whether the text includes negative information, and the present disclosure will not be described one by one.

[0111] In the technical solution of the present disclosure, the user personal information, text information and knowledge graph acquisition, storage and application involved all comply with the relevant legal regulations and do not violate the public order and good customs.

[0112] The embodiments of the present disclosure also provide a text detection device. An optional component structure of the text detection device is shown as Figure 9 As shown, the text detection device comprises:

[0113] The keyword matching module 401 is configured to perform keyword matching on the to-be-detected text to obtain a matching result.

[0114] The preprocessing module 402 is configured to perform preprocessing on the to-be-detected text to obtain a candidate to-be-detected text, in response to the matching result indicating that the to-be-detected text does not include the keyword corresponding to the negative information.

[0115] The replacing module 403 is configured to replace an entity included in the candidate to-be-detected text with a target entity to obtain at least one target detection text, based on a knowledge graph corresponding to the to-be-detected text.

[0116] The detecting module 404 is configured to detect whether the target detection text includes negative information.

[0117] In some embodiments, the preprocessing module 402 is configured to convert characters in the to-be-detected text into characters in a preset format, and / or convert words in the to-be-detected text into words in a preset font.

[0118] In some embodiments, the preprocessing module 402 is configured to identify symbols in the to-be-detected text, and delete the symbols in the to-be-detected text.

[0119] In some embodiments, the preprocessing module 402 is configured to identify words in the to-be-detected text, and splice the words in the to-be-detected text according to an order of the words in the to-be-detected text.

[0120] In some embodiments, the preprocessing module 402 is configured to identify entity deformation text included in the to-be-detected text, and replace the entity deformation text with entity ontology text.

[0121] In some embodiments, the preprocessing module 402 is configured to perform word segmentation processing on the to-be-detected text based on semantics to obtain a word list, and label a corresponding part of speech for each word included in the word list.

[0122] In some embodiments, the replacing module 403 is configured to find an entity included in the to-be-detected text in the knowledge graph, determine a target entity corresponding to the entity, and replace the entity included in the to-be-detected text with the target entity to obtain a first target detection text in the target detection text.

[0123] In some embodiments, the replacing module 403 is configured to, if the candidate to-be-detected text includes an entity and a first relationship corresponding to the entity, determine a target entity corresponding to the entity and the first relationship included in the candidate to-be-detected text based on the knowledge graph, and replace the entity included in the to-be-detected text with the target entity to obtain a second target detection text in the target detection text.

[0124] In some embodiments, the replacing module 403 is configured to, if the first target detection text or the second target detection text comprises a second relationship corresponding to the target entity, determine a new target entity corresponding to the target entity and the second relationship based on the knowledge graph; and replace the target entity with the new target entity to obtain a third target detection text in the target detection text.

[0125] The text detection method provided by the present disclosure can be implemented by a text detection system. The architecture diagram of the text detection system 100 is shown in Figure 10 As shown, the terminal device 400 is connected to the server 200 through the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two.

[0126] In some embodiments, the text detection method provided by the present disclosure can be implemented by the terminal device 400 or the server 200 alone. When implemented by the terminal device 400 alone, the text detection method can be installed on the terminal device 400 in the form of a client, so that the client on the terminal device 400 has a text detection function. The text detection method can also be used as a plug-in of a related client and downloaded to the client as needed for local use. In the above deployment mode, the text detection system can directly complete all detection processes locally without the need to access an external network, thereby ensuring the absolute safety of data.

[0127] In some embodiments, the text detection method provided by the present disclosure can be implemented by the terminal device 400 and the server 200 in cooperation. For example, the terminal device 400 sends a detection request for a to-be-detected text to the server 200; the server 200 performs keyword matching on the to-be-detected text based on the detection request to obtain a matching result; if the matching result indicates that the to-be-detected text does not comprise a keyword corresponding to negative information, the to-be-detected text is preprocessed to obtain a candidate to-be-detected text; entities included in the candidate to-be-detected text are replaced with target entities based on a knowledge graph corresponding to the to-be-detected text to obtain at least one target detection text; and it is detected whether the target detection text comprises the negative information to perform an operation on the to-be-detected text.

[0128] According to embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.

[0129] Figure 11A schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, etc., but is not limited thereto. The terminal and server can be directly or indirectly connected via wired or wireless communication, and this embodiment of the invention does not impose limitations.

[0130] Electronic devices can also refer to various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0131] like Figure 11 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.

[0132] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0133] The computing unit 801 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs various methods and processes described above, such as the text detection method. For example, in some embodiments, the text detection method can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded onto the RAM 803 and executed by the computing unit 801, one or more steps of the text detection method described above can be performed. Alternatively, in other embodiments, the computing unit 801 can be configured to perform the text detection method by any other suitable means, such as by means of firmware.

[0134] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0135] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine or entirely on a remote machine or server.

[0136] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0137] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0138] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0139] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0140] It should be understood that the various forms of flow shown above can be used to reorder, add, or remove steps. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, without limitation herein, so long as the desired results of the technology described in the present disclosure are achieved.

[0141] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for detecting text, comprising: performing keyword matching on a text to be detected to obtain a matching result; in response to the matching result indicating that the text to be detected does not include a keyword corresponding to negative information, preprocessing the text to be detected to obtain a candidate text to be detected; replacing an entity included in the candidate text to be detected with a target entity based on a knowledge graph corresponding to the text to be detected to obtain at least one target detection text; the replacing the entity included in the candidate text to be detected with the target entity based on the knowledge graph corresponding to the text to be detected comprises: finding the entity included in the text to be detected in the knowledge graph to determine a target entity corresponding to the entity; and replacing the entity included in the text to be detected with the target entity to obtain a first target detection text in the target detection text; if the candidate text to be detected includes an entity and a first relationship corresponding to the entity, determining a target entity corresponding to the entity and the first relationship included in the candidate text to be detected based on the knowledge graph; and replacing the entity included in the text to be detected with the target entity to obtain a second target detection text in the target detection text; if the first target detection text or the second target detection text includes a second relationship corresponding to the target entity, determining a new target entity corresponding to the target entity and the second relationship based on the knowledge graph; and replacing the target entity with the new target entity to obtain a third target detection text in the target detection text; detecting whether the target detection text includes the negative information: detecting whether the target detection text hits a strategy based on a strategy layer, the strategy layer including a plurality of pre-stored strategies, and if the target detection text hits any strategy included in the strategy layer, determining that the text to be detected is risky.

2. The method of claim 1, wherein, the preprocessing the text to be detected comprises: converting characters in the text to be detected into characters in a preset format; and / or converting words in the text to be detected into words in a preset font. the preprocessing the text to be detected comprises:

3. The method of claim 1 or 2, wherein, identifying symbols in the text to be detected; and deleting the symbols in the text to be detected. after the deleting the symbols in the text to be detected, the preprocessing the text to be detected further comprises:

4. The method of claim 3, wherein, identifying words in the text to be detected; and splicing the words in the text to be detected according to an order of the words in the text. the preprocessing the text to be detected comprises:

5. The method of claim 1, wherein, identifying entity deformation texts included in the text to be detected; and replacing the entity deformation texts with entity ontology texts. the preprocessing the text to be detected comprises:

6. The method of claim 1, wherein, performing word segmentation processing on the text to be detected based on semantics to obtain a word list; and annotating a corresponding part of speech for each word included in the word list. 7.A device for detecting text, comprising: a keyword matching module configured to perform keyword matching on a text to be detected to obtain a matching result. ​ The preprocessing module is configured to preprocess the to-be-detected text to obtain a candidate to-be-detected text, in response to the fact that the to-be-detected text does not include the keyword corresponding to the negative information. The replacement module is configured to replace an entity included in the candidate to-be-detected text with a target entity based on a knowledge graph corresponding to the to-be-detected text, to obtain at least one target detection text. The replacement of the entity included in the candidate to-be-detected text with the target entity based on the knowledge graph corresponding to the to-be-detected text comprises: finding the entity included in the to-be-detected text in the knowledge graph, determining a target entity corresponding to the entity, and replacing the entity included in the to-be-detected text with the target entity to obtain a first target detection text in the target detection text; if the candidate to-be-detected text includes the entity and a first relationship corresponding to the entity, determining a target entity corresponding to the entity and the first relationship included in the candidate to-be-detected text based on the knowledge graph, and replacing the entity included in the to-be-detected text with the target entity to obtain a second target detection text in the target detection text; if the first target detection text or the second target detection text includes a second relationship corresponding to the target entity, determining a new target entity corresponding to the target entity and the second relationship based on the knowledge graph, and replacing the target entity with the new target entity to obtain a third target detection text in the target detection text; The detection module is configured to detect whether the target detection text includes negative information: detecting whether the target detection text hits a strategy based on a strategy layer, the strategy layer including a plurality of pre-stored strategies, and if the target detection text hits any strategy included in the strategy layer, determining that the to-be-detected file is at risk.

8. An electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6.

9. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1 to 6.

10. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method for extracting variation key word

    CN101324883A

  • False news detection method, electronic device and computer readable storage medium

    CN110275965A

  • Method and system for identifying deformed sensitive words

    CN112001170A