Sensitive word processing method and device, equipment and storage medium

By identifying and merging the inclusion relationships of candidate sensitive words in the text in the sensitive word filtering method, the problem of repeated filtering of sensitive words is solved and the efficiency of sensitive word filtering is improved.

CN118673104AInactive Publication Date: 2024-09-20FLYING FOX INFORMATION TECH TIANJIN CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411175932.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-26
Publication Date
2024-09-20
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing sensitive word filtering methods may have inclusion relationships between multiple sensitive words in the text, resulting in repeated filtering of sensitive words and reducing filtering efficiency.

Method used

By obtaining the candidate sensitive words and their position information in the text to be filtered, the inclusion relationship between the candidate sensitive words is determined, the sensitive words are merged to obtain the target sensitive words, and repeated operations are reduced during the filtering process to improve filtering efficiency.

Benefits of technology

It effectively avoids repeated filtering of sensitive words, improves the filtering efficiency of sensitive words, and ensures the filtering effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118673104A
    Figure CN118673104A
Patent Text Reader

Abstract

The invention discloses a sensitive word processing method and device, equipment and a storage medium, and is used for the technical field of data processing. Obtaining a plurality of candidate sensitive words in the to-be-filtered text and position information of each candidate sensitive word in the to-be-filtered text; determining an inclusion relationship among the plurality of candidate sensitive words through the plurality of candidate sensitive words and the plurality of pieces of position information corresponding to the plurality of candidate sensitive words; combining the plurality of candidate sensitive words based on the inclusion relation to obtain a target sensitive word; and filtering the target sensitive words in the to-be-filtered text to obtain a filtered text. Through the position information of each candidate sensitive word in the to-be-filtered text, the inclusion relation among the candidate sensitive words in the to-be-filtered text can be considered, and the candidate sensitive words are merged to obtain the target sensitive word; according to the method, the target sensitive words in the to-be-filtered text are filtered, the repeated filtering operation of the sensitive words can be reduced, the problem of repeated filtering of the sensitive words is avoided, and the filtering efficiency of the sensitive words is improved on the basis of guaranteeing the filtering effect of the sensitive words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a sensitive word processing method, device, equipment and storage medium. Background Art

[0002] In various fields of information circulation, the sensitive word filtering technology can maintain the healthy dissemination of information. In the related technology, the sensitive word filtering method refers to: first obtaining multiple sensitive words in the text, and then directly filtering multiple sensitive words in the text.

[0003] However, the inventors have found through research that there may be an inclusion relationship between multiple sensitive words in a text. Directly filtering multiple sensitive words in a text may result in repeated filtering of sensitive words, thereby reducing the filtering efficiency of sensitive words. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a sensitive word processing method, device, equipment and storage medium, which can reduce repeated filtering operations of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words while ensuring the filtering effect of sensitive words.

[0005] On the one hand, an embodiment of the present application provides a sensitive word processing method, the method comprising: Acquire multiple candidate sensitive words in the text to be filtered, and position information of each of the candidate sensitive words in the text to be filtered; Determining the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words; Merging the multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word; Sensitive word filtering is performed on the target sensitive words in the text to be filtered to obtain a filtered text.

[0006] Optionally, the plurality of candidate sensitive words include a first sensitive word and a second sensitive word; and determining the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words includes: If the position information of the second sensitive word includes the position information of the first sensitive word, determining the inclusion relationship includes that the second sensitive word includes the first sensitive word.

[0007] Optionally, the method further includes: For each of the target sensitive words, if the target sensitive word matches a target word index in a preset recovery word library, determine a target recovery word corresponding to the target word index; the preset recovery word library includes a plurality of preset word indexes and a preset recovery word corresponding to each of the preset word indexes, and the preset word indexes belong to sensitive words; If the text to be filtered includes the target restored word, sensitive word restoration is performed on the filtered text according to the target sensitive word in the text to be filtered to obtain a restored text.

[0008] Optionally, if the text to be filtered includes the target restored word, performing sensitive word restoration on the filtered text according to the target sensitive word in the text to be filtered to obtain the restored text includes: If the text to be filtered includes the target restored word, and the position information of the target restored word in the text to be filtered includes the position information of the target sensitive word in the text to be filtered, the filtered text is restored with sensitive words according to the target sensitive word in the text to be filtered to obtain the restored text.

[0009] Optionally, the location information includes a starting location and an ending location.

[0010] Optionally, the obtaining of a plurality of candidate sensitive words in the text to be filtered and position information of each of the candidate sensitive words in the text to be filtered includes: Sensitive word detection is performed on the text to be filtered according to a plurality of preset sensitive words in a preset sensitive word library, and a plurality of candidate sensitive words and position information of each candidate sensitive word are obtained.

[0011] Optionally, the step of obtaining the plurality of preset sensitive words includes: Multiple existing sensitive words are expanded with similar-phonetic characters to obtain multiple preset sensitive words.

[0012] On the other hand, an embodiment of the present application provides a sensitive word processing device, the device comprising: an acquisition unit, a determination unit, a merging unit and a filtering unit; The acquisition unit is used to acquire a plurality of candidate sensitive words in the text to be filtered, and position information of each of the candidate sensitive words in the text to be filtered; The determining unit is used to determine the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words; The merging unit is used to merge the multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word; The filtering unit is used to perform sensitive word filtering on the target sensitive words in the text to be filtered to obtain filtered text.

[0013] Optionally, the multiple candidate sensitive words include a first sensitive word and a second sensitive word; and the determination unit is used to determine that the inclusion relationship includes that the second sensitive word includes the first sensitive word if the position information of the second sensitive word includes the position information of the first sensitive word.

[0014] Optionally, the device further comprises: a recovery unit; The determination unit is configured to determine, for each of the target sensitive words, a target recovery word corresponding to the target word index if the target sensitive word matches the target word index in a preset recovery word library; the preset recovery word library includes a plurality of preset word indexes and a preset recovery word corresponding to each of the preset word indexes, and the preset word indexes are sensitive words; The restoration unit is used to restore the filtered text to the sensitive word according to the target sensitive word in the text to be filtered to obtain the restored text if the text to be filtered includes the target restoration word.

[0015] Optionally, the restoration unit is used to restore the sensitive word of the filtered text according to the target sensitive word in the text to be filtered to obtain the restored text if the text to be filtered includes the target restoration word and the position information of the target restoration word in the text to be filtered contains the position information of the target sensitive word in the text to be filtered.

[0016] Optionally, the location information includes a starting location and an ending location.

[0017] Optionally, the acquisition unit is used to perform sensitive word detection on the text to be filtered according to a plurality of preset sensitive words in a preset sensitive word library, and acquire a plurality of candidate sensitive words and position information of each of the candidate sensitive words.

[0018] Optionally, the device further comprises: an expansion unit; The expansion unit is used to expand multiple existing sensitive words with similar-phonetic characters to obtain multiple preset sensitive words.

[0019] On the other hand, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is configured to execute the method described in the above aspects according to the instructions in the computer program.

[0020] On the other hand, an embodiment of the present application provides a computer-readable storage medium, which is used to store a computer program. When the computer program is executed by a processor, it is used to implement the method described in the above aspects.

[0021] Compared with the prior art, this application has at least the following advantages: Adopting the technical solution of the embodiment of the present application, first, multiple candidate sensitive words in the text to be filtered and the position information of each candidate sensitive word in the text to be filtered are obtained; secondly, the inclusion relationship between the multiple candidate sensitive words is determined through the multiple candidate sensitive words and the multiple position information corresponding to the multiple candidate sensitive words; then, based on the inclusion relationship, the multiple candidate sensitive words are merged to obtain the target sensitive word; finally, the target sensitive word in the text to be filtered is filtered to obtain the filtered text. This method can consider the inclusion relationship between the multiple candidate sensitive words in the text to be filtered through the position information of each candidate sensitive word in the text to be filtered, and realize the merging of multiple candidate sensitive words to obtain the target sensitive word; based on this, filtering the target sensitive word in the text to be filtered can reduce the repeated filtering operation of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words on the basis of ensuring the filtering effect of sensitive words. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 A schematic diagram of a system framework involved in an application scenario provided in an embodiment of the present application; Figure 2 A flowchart of a sensitive word processing method provided in an embodiment of the present application; Figure 3 A flowchart of another sensitive word processing method provided in an embodiment of the present application; Figure 4 A schematic diagram of the structure of a sensitive word processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] At present, the sensitive word filtering method usually refers to: first obtain multiple sensitive words in the text, and then directly filter the multiple sensitive words in the text. However, after research, it is found that there may be an inclusion relationship between multiple sensitive words in the text. Directly filtering multiple sensitive words in the text may cause the problem of repeated filtering of sensitive words, which reduces the filtering efficiency of sensitive words.

[0026] In order to solve this problem, in an embodiment of the present application, through the position information of each candidate sensitive word in the text to be filtered, the inclusion relationship between multiple candidate sensitive words in the text to be filtered can be considered, and multiple candidate sensitive words can be merged to obtain the target sensitive word; based on this, the target sensitive word in the text to be filtered is filtered, which can reduce the repeated filtering operation of sensitive words and avoid the problem of repeated filtering of sensitive words. On the basis of ensuring the filtering effect of sensitive words, the filtering efficiency of sensitive words is improved.

[0027] For example, one of the scenarios of the embodiment of the present application, see Figure 1 , Figure 1 A schematic diagram of a system framework involved in an application scenario provided in an embodiment of the present application. The application scenario includes a terminal 101 and a server 102. The terminal 101 sends a text to be filtered to the server 102, and the server 102 executes the implementation method provided in the embodiment of the present application to process sensitive words and obtains a filtered text corresponding to the text to be filtered.

[0028] First, in the above application scenario, although the action description of the implementation method provided in the embodiment of the present application is executed by the server 102; however, the embodiment of the present application is not limited in terms of the execution subject, as long as the actions disclosed in the implementation method provided in the embodiment of the present application are executed.

[0029] Secondly, the above scenario is only an example scenario provided by the embodiment of the present application, and the embodiment of the present application is not limited to this scenario.

[0030] The specific implementation of the sensitive word processing method, device, equipment and storage medium in the embodiments of the present application will be described in detail below with reference to the accompanying drawings through embodiments.

[0031] First, the specific implementation of the sensitive word processing method in the embodiment of the present application is described in detail through an embodiment.

[0032] See also Figure 2 , Figure 2 A flowchart of a sensitive word processing method provided in an embodiment of the present application. In this embodiment, the method may include the following steps: S201: Acquire multiple candidate sensitive words in the text to be filtered, and position information of each candidate sensitive word in the text to be filtered.

[0033] In the related art, the sensitive word filtering method generally refers to: first obtaining multiple sensitive words in the text, and then directly filtering the multiple sensitive words in the text. However, after research, it is found that there may be an inclusion relationship between multiple sensitive words in the text. Directly filtering multiple sensitive words in the text may cause the problem of repeated filtering of sensitive words, which reduces the filtering efficiency of sensitive words.

[0034] In an embodiment of the present application, in order to solve the above-mentioned problem, considering that the inclusion relationship between multiple sensitive words in a text can be determined by multiple position information corresponding to the multiple sensitive words in the text, therefore, for the text to be filtered, it is necessary not only to obtain multiple candidate sensitive words in the text to be filtered, but also to obtain the position information of each candidate sensitive word in the text to be filtered, so as to subsequently determine the inclusion relationship between multiple candidate sensitive words in the text to be filtered, thereby avoiding the problem of repeated filtering of sensitive words.

[0035] The text to be filtered refers to the text of the sensitive words to be filtered; the candidate sensitive words refer to the sensitive words obtained by directly detecting the text to be filtered; and the position information of the candidate sensitive words refers to the position of the candidate sensitive words in the text to be filtered.

[0036] On the basis of obtaining multiple candidate sensitive words in the text to be filtered, S201 further obtains the position information of each candidate sensitive word in the text to be filtered, and provides a basis for determining the inclusion relationship between the multiple candidate sensitive words in the text to be filtered, so as to avoid the problem of repeated filtering of sensitive words, thereby improving the filtering efficiency of sensitive words while ensuring the filtering effect of sensitive words.

[0037] In the embodiment of the present application, when the above S201 is specifically implemented, on the basis that the preset sensitive word library includes multiple preset sensitive words, multiple candidate sensitive words in the text to be filtered and the position information of each candidate sensitive word in the text to be filtered can be obtained by detecting whether the text to be filtered includes the preset sensitive words. Therefore, in an optional implementation of the embodiment of the present application, the above S201 can, for example, include S2011 (not shown in the figure): sensitive word detection is performed on the text to be filtered according to the multiple preset sensitive words in the preset sensitive word library, and multiple candidate sensitive words and the position information of each candidate sensitive word are obtained.

[0038] Among them, the preset sensitive word library refers to a preset sensitive word library; the preset sensitive words refer to pre-set sensitive words.

[0039] S2011 detects whether the text to be filtered includes multiple preset sensitive words in the preset sensitive word library, obtains multiple candidate sensitive words in the text to be filtered, and the position information of each candidate sensitive word in the text to be filtered, so as to obtain the sensitive words in the text to be filtered more comprehensively and accurately.

[0040] Among them, considering the comprehensiveness and accuracy of sensitive word detection, the homophonic words of existing sensitive words are also sensitive words, and multiple existing sensitive words can be expanded into more sensitive words by homophonic words. Therefore, multiple preset sensitive words in the preset sensitive word library are obtained by expanding multiple existing sensitive words by homophonic words on the basis of multiple existing sensitive words, that is, multiple preset sensitive words include not only multiple existing sensitive words, but also multiple homophonic sensitive words obtained by expanding multiple existing sensitive words by homophonic words. Based on this, in an optional implementation of the embodiment of the present application, the step of obtaining multiple preset sensitive words in the above S2011, for example, may include S1 (not shown in the figure): expand multiple existing sensitive words by homophonic words to obtain multiple preset sensitive words.

[0041] The multiple existing sensitive words refer to multiple sensitive words collected in advance.

[0042] Based on multiple existing sensitive words, S1 further expands the similar-phonetic characters to obtain multiple preset sensitive words, laying a foundation for more comprehensive and accurate acquisition of sensitive words in the text to be filtered in the future.

[0043] The position information of the candidate sensitive word actually refers to the starting position and the ending position of the candidate sensitive word in the text to be filtered. Therefore, in an optional implementation of the embodiment of the present application, the position information includes the starting position and the ending position.

[0044] As an example, M existing sensitive words are expanded with near-phonetic characters to obtain N preset sensitive words to form a preset sensitive word library, where M is a positive integer, N is a positive integer, and 2≤M<N; sensitive word detection is performed on the filtered text according to the N preset sensitive words in the preset sensitive word library to obtain K candidate sensitive words, as well as the starting position and ending position of each candidate sensitive word.

[0045] S202: Determine the inclusion relationship between the multiple candidate sensitive words according to the multiple candidate sensitive words and the multiple position information corresponding to the multiple candidate sensitive words.

[0046] In an embodiment of the present application, after executing the above S201 to obtain multiple candidate sensitive words in the text to be filtered and the position information of each candidate sensitive word in the text to be filtered, it is also necessary to determine the inclusion relationship between the multiple candidate sensitive words through the multiple candidate sensitive words and the multiple position information corresponding to the multiple candidate sensitive words, so as to avoid the problem of repeated filtering of sensitive words in the subsequent process.

[0047] The inclusion relationship between multiple candidate sensitive words is used to indicate multiple candidate sensitive words having an inclusion relationship.

[0048] Based on multiple candidate sensitive words in the text to be filtered and the position information of each candidate sensitive word in the text to be filtered, S202 further determines the inclusion relationship between the multiple candidate sensitive words to indicate multiple candidate sensitive words with an inclusion relationship, thereby laying a foundation for avoiding the problem of repeated filtering of sensitive words in the future, thereby improving the filtering efficiency of sensitive words while ensuring the filtering effect of sensitive words.

[0049] In an embodiment of the present application, when the above S202 is specifically implemented, for the first sensitive word and the second sensitive word among the multiple candidate sensitive words in the text to be filtered, when the position information of the second sensitive word in the text to be filtered contains the position information of the first sensitive word in the text to be filtered, it means that the second sensitive word contains the first sensitive word, then the inclusion relationship between the multiple candidate sensitive words is determined to indicate that the second sensitive word contains the first sensitive word, that is, the inclusion relationship between the multiple candidate sensitive words includes the second sensitive word containing the first sensitive word. Therefore, in an optional implementation of the embodiment of the present application, the multiple candidate sensitive words include the first sensitive word and the second sensitive word; S202 may include S2021 (not shown in the figure), for example: if the position information of the second sensitive word contains the position information of the first sensitive word, determine that the inclusion relationship includes the second sensitive word containing the first sensitive word.

[0050] S2021 determines the inclusion relationship between the position information of the first sensitive word and the position information of the second sensitive word in multiple candidate sensitive words, that is, determines that the position information of the second sensitive word contains the position information of the first sensitive word, and determines that the inclusion relationship between the multiple candidate sensitive words includes that the second sensitive word contains the first sensitive word. Based on the position information of each sensitive word in the text to be filtered, the inclusion relationship between the multiple candidate sensitive words can be determined relatively quickly and accurately.

[0051] As an example, based on the above example, the first sensitive word in the text to be filtered is "A" and the second sensitive word is "AB"; if the starting position and ending position of "AB" in the text to be filtered contain the starting position and ending position of "A", it is determined that the inclusion relationship between multiple candidate sensitive words in the text to be filtered includes "AB" containing "A".

[0052] S203: Merge multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word.

[0053] In an embodiment of the present application, after executing the above S202 to determine the inclusion relationship between multiple candidate sensitive words, since the inclusion relationship between the multiple candidate sensitive words is used to indicate multiple candidate sensitive words with an inclusion relationship, it is also necessary to merge the multiple candidate sensitive words based on the inclusion relationship to obtain the target sensitive words, so that the target sensitive words are relatively independent, so as to avoid the problem of repeated filtering of sensitive words in the future.

[0054] The target sensitive word is obtained by merging multiple candidate sensitive words according to the inclusion relationship between the multiple candidate sensitive words.

[0055] In S203, for multiple candidate sensitive words in the text to be filtered, multiple candidate sensitive words with inclusion relationships indicated by the inclusion relationships between the multiple candidate sensitive words are merged to obtain a target sensitive word, so that there is no inclusion relationship between the target sensitive words in the text to be filtered, and filtering data is provided to avoid the problem of repeated filtering of sensitive words in the subsequent process, thereby improving the filtering efficiency of sensitive words while ensuring the filtering effect of sensitive words.

[0056] As an example, based on the above example, according to the inclusion relationship between multiple candidate sensitive words in the text to be filtered, including "AB" including "A", multiple candidate sensitive words in the text to be filtered are merged to obtain the target sensitive words in the text to be filtered including "AB".

[0057] S204: Filter the target sensitive words in the text to be filtered to obtain the filtered text.

[0058] In the embodiment of the present application, after executing the above S203 to obtain the target sensitive words in the text to be filtered, since the target sensitive words are relatively independent, that is, there is no inclusion relationship between the target sensitive words in the text to be filtered, the target sensitive words in the text to be filtered are filtered to avoid the problem of repeated filtering of sensitive words and obtain the filtered text.

[0059] In S204, on the basis that there is no inclusion relationship between the target sensitive words in the text to be filtered, the target sensitive words in the text to be filtered are filtered, which can reduce repeated filtering operations of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words on the basis of ensuring the filtering effect of sensitive words.

[0060] As an example, based on the above example, sensitive word filtering is performed on "AB" in the text to be filtered to obtain the filtered text.

[0061] Through the various implementation methods provided in this embodiment, multiple candidate sensitive words in the text to be filtered and the position information of each candidate sensitive word in the text to be filtered are obtained; through multiple candidate sensitive words and multiple position information corresponding to multiple candidate sensitive words, the inclusion relationship between multiple candidate sensitive words is determined; based on the inclusion relationship, multiple candidate sensitive words are merged to obtain the target sensitive word; the target sensitive word in the text to be filtered is filtered to obtain the filtered text. This method can consider the inclusion relationship between multiple candidate sensitive words in the text to be filtered through the position information of each candidate sensitive word in the text to be filtered, and realize the merging of multiple candidate sensitive words to obtain the target sensitive word; based on this, filtering the target sensitive word in the text to be filtered can reduce the repeated filtering operation of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words on the basis of ensuring the filtering effect of sensitive words.

[0062] In addition, in the embodiment of the present application, considering that there may be a situation in the text to be filtered that the segmented words include the target sensitive words but the segmented words themselves are reasonable, in order to avoid filtering the target sensitive words in the text to be filtered from affecting the accuracy of the segmented words, a preset recovery word library can also be pre-set, and the preset recovery word library includes multiple preset word indexes and preset recovery words corresponding to each preset word index, and the preset word index belongs to the sensitive word; for each target sensitive word, first, it can be determined whether the target sensitive word matches the multiple preset word indexes in the preset recovery word library. If the target sensitive word matches the target word index in the multiple preset word indexes, it means that the target sensitive word has a corresponding word that includes the sensitive word but is reasonable itself, and then the target recovery word corresponding to the target word index is determined; then, it is determined whether the text to be filtered includes the target recovery word. If the text to be filtered includes the target recovery word, it means that the target recovery word in the text to be filtered includes the target sensitive word but is reasonable itself, then the target sensitive word is restored for the filtered text to obtain the restored text, so that the restored text includes the target sensitive word but the target recovery word to which the target sensitive word belongs is reasonable itself, so as to ensure the accuracy of the target recovery word. Therefore, in an optional implementation of the embodiment of the present application, the method may also include the following S2-S3 (not shown in the figure).

[0063] S2: For each target sensitive word, if the target sensitive word matches the target word index in the preset recovery word library, determine the target recovery word corresponding to the target word index; the preset recovery word library includes multiple preset word indexes and preset recovery words corresponding to each preset word index, and the preset word index belongs to a sensitive word.

[0064] S3: If the text to be filtered includes the target recovery word, the filtered text is restored with the target sensitive word in the text to be filtered to obtain the restored text.

[0065] Among them, the preset recovery words refer to words that include sensitive words but are reasonable in themselves.

[0066] In S2-S3, for each target sensitive word, it is determined whether the target sensitive word matches the target word index in the preset recovery word library, indicating that the target sensitive word has a corresponding target recovery word that includes the sensitive word but is reasonable in itself; it is further determined that the text to be filtered includes the target recovery word, indicating that the target recovery word in the text to be filtered includes the target sensitive word but is reasonable in itself, and the target sensitive word is restored for the filtered text to obtain the restored text, so as to avoid the restored text losing part of the information of the target recovery word, so as to ensure the accuracy of the target recovery word in the restored text, thereby avoiding affecting the true meaning of the text to be filtered.

[0067] In the embodiment of the present application, when the above S3 is specifically implemented, it is determined whether the text to be filtered includes the target recovery word. If the text to be filtered includes the target recovery word, it means that the target recovery word in the text to be filtered includes the target sensitive word but is reasonable in itself. Then, it is necessary to further determine whether the target recovery word in the text to be filtered contains the target sensitive word, that is, to determine whether the position information of the target recovery word in the text to be filtered contains the position information of the target sensitive word in the text to be filtered. If the position information of the target recovery word in the text to be filtered contains the position information of the target sensitive word in the text to be filtered, it means that the target recovery word in the text to be filtered contains the target sensitive word but is reasonable in itself. Then, the target sensitive word is restored for the filtered text to obtain the restored text. Therefore, in an optional implementation of the embodiment of the present application, the above S3 may include S31 (not shown in the figure): if the text to be filtered includes the target recovery word, and the position information of the target recovery word in the text to be filtered contains the position information of the target sensitive word in the text to be filtered, the filtered text is restored to the sensitive word according to the target sensitive word in the text to be filtered to obtain the restored text.

[0068] The position information of the target restored word actually refers to the starting position and the ending position of the target restored word in the text to be filtered.

[0069] The S31 determines, for each target sensitive word, whether the target sensitive word matches the target word index in the preset recovery word library, indicating that the target sensitive word has a corresponding target recovery word that includes the sensitive word but is reasonable in itself; further determines that the text to be filtered includes the target recovery word, and determines that the position information of the target recovery word in the text to be filtered includes the position information of the target sensitive word in the text to be filtered, indicating that the target recovery word in the text to be filtered includes the target sensitive word but is reasonable in itself, and restores the target sensitive word for the filtered text to obtain the restored text, which can effectively and accurately avoid the restored text from losing part of the information of the target recovery word, so as to effectively and accurately ensure the accuracy of the target recovery word in the restored text, thereby effectively and accurately avoiding affecting the true meaning of the text to be filtered.

[0070] As an example, based on the above example, the preset recovery vocabulary includes {"AB":["ABCD"]}. If "AB" matches the target word index "AB" in the preset recovery vocabulary, the target recovery word corresponding to "AB" is determined to be "ABCD"; if the text to be filtered includes "ABCD", and the starting position and ending position of "ABCD" in the text to be filtered contain the starting position and ending position of "AB" in the text to be filtered, the filtered text is restored for sensitive words according to "AB" to obtain the restored text.

[0071] See also Figure 3 , Figure 3 A flowchart of another sensitive word processing method provided in an embodiment of the present application. In this embodiment, the method may include the following steps: S301: Expand multiple existing sensitive words in a preset sensitive word library with similar-phonetic characters to obtain multiple preset sensitive words.

[0072] S302: Perform sensitive word detection on the text to be filtered according to a plurality of preset sensitive words in a preset sensitive word library, and obtain a plurality of candidate sensitive words, and a starting position and an ending position of each candidate sensitive word.

[0073] S303: Determine the inclusion relationship between the multiple candidate sensitive words according to the multiple candidate sensitive words, the multiple starting positions and the multiple ending positions corresponding to the multiple candidate sensitive words.

[0074] S304: Merge multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word.

[0075] S305: Filter the target sensitive words in the text to be filtered to obtain the filtered text.

[0076] S306: For each target sensitive word, if the target sensitive word matches the target word index in the preset recovery word library, determine the target recovery word corresponding to the target word index; the preset recovery word library includes multiple preset word indexes and preset recovery words corresponding to each preset word index, and the preset word index belongs to a sensitive word.

[0077] S307: If the text to be filtered includes the target recovery word, and the starting position and the ending position of the target recovery word in the text to be filtered include the starting position and the ending position of the target sensitive word in the text to be filtered, sensitive word recovery is performed on the filtered text according to the target sensitive word in the text to be filtered to obtain a recovered text.

[0078] Through the various implementation methods provided in this embodiment, on the basis of multiple existing sensitive words, multiple preset sensitive words are further expanded by near-phonetic characters, laying the foundation for more comprehensive and accurate acquisition of sensitive words in the text to be filtered in the future; by detecting whether the text to be filtered includes multiple preset sensitive words in the preset sensitive word library, multiple candidate sensitive words in the text to be filtered, and the starting position and ending position of each candidate sensitive word in the text to be filtered are obtained, so that the sensitive words in the text to be filtered can be obtained more comprehensively and accurately. On the basis of multiple candidate sensitive words in the text to be filtered and the starting position and ending position of each candidate sensitive word in the text to be filtered, the inclusion relationship between multiple candidate sensitive words is further determined to indicate multiple candidate sensitive words with inclusion relationship, so as to provide a foundation for avoiding the problem of repeated filtering of sensitive words in the future. For multiple candidate sensitive words in the text to be filtered, multiple candidate sensitive words with inclusion relationship indicated by the inclusion relationship between multiple candidate sensitive words are merged to obtain the target sensitive word, so that the target sensitive word in the text to be filtered does not have an inclusion relationship, and filtering data is provided for avoiding the problem of repeated filtering of sensitive words in the future. On the basis that there is no inclusion relationship between the target sensitive words in the text to be filtered, filtering the target sensitive words in the text to be filtered can reduce repeated filtering operations of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words while ensuring the filtering effect of sensitive words.

[0079] In addition, for each target sensitive word, it is determined that the target sensitive word matches the target word index in the preset recovery word library, indicating that the target sensitive word has a corresponding target recovery word that includes the sensitive word but is reasonable in itself. It is further determined that the text to be filtered includes the target recovery word, and it is determined that the position information of the target recovery word in the text to be filtered includes the position information of the target sensitive word in the text to be filtered, indicating that the target recovery word in the text to be filtered includes the target sensitive word but is reasonable in itself. The target sensitive word is restored for the filtered text to obtain the restored text, which can effectively and accurately avoid the loss of part of the information of the target recovery word in the restored text, so as to effectively and accurately ensure the accuracy of the target recovery word in the restored text, thereby effectively and accurately avoiding affecting the true meaning of the text to be filtered.

[0080] Next, the specific implementation method of the sensitive word processing device in the embodiment of the present application is described in detail through an embodiment.

[0081] See also Figure 4 , Figure 4 A schematic diagram of a sensitive word processing device provided in an embodiment of the present application. In this embodiment, the device may include, for example, an acquisition unit 401, a determination unit 402, a merging unit 403, and a filtering unit 404; The acquisition unit 401 is used to acquire multiple candidate sensitive words in the text to be filtered, and the position information of each candidate sensitive word in the text to be filtered; A determination unit 402 is used to determine the inclusion relationship between the multiple candidate sensitive words according to the multiple candidate sensitive words and the multiple position information corresponding to the multiple candidate sensitive words; A merging unit 403 is used to merge multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word; The filtering unit 404 is used to filter the target sensitive words in the text to be filtered to obtain the filtered text.

[0082] In an optional implementation of the embodiment of the present application, the multiple candidate sensitive words include a first sensitive word and a second sensitive word; the determination unit 402 is used to determine that the inclusion relationship includes the second sensitive word including the first sensitive word if the position information of the second sensitive word includes the position information of the first sensitive word.

[0083] In an optional implementation of the embodiment of the present application, the device further includes: a recovery unit; A determination unit 402 is configured to determine, for each target sensitive word, a target recovery word corresponding to the target word index if the target sensitive word matches the target word index in the preset recovery word library; the preset recovery word library includes a plurality of preset word indexes and a preset recovery word corresponding to each preset word index, and the preset word index belongs to a sensitive word; The restoration unit is used to restore the sensitive words of the filtered text according to the target sensitive words in the text to be filtered to obtain the restored text if the text to be filtered includes the target restoration words.

[0084] In an optional implementation of the embodiment of the present application, the restoration unit is used to restore the sensitive words of the filtered text according to the target sensitive words in the text to be filtered to obtain the restored text if the text to be filtered includes the target restoration words and the position information of the target restoration words in the text to be filtered includes the position information of the target sensitive words in the text to be filtered.

[0085] In an optional implementation of the embodiment of the present application, the location information includes a starting location and an ending location.

[0086] In an optional implementation of the embodiment of the present application, the acquisition unit 401 is used to perform sensitive word detection on the text to be filtered according to multiple preset sensitive words in a preset sensitive word library, and obtain multiple candidate sensitive words and position information of each candidate sensitive word.

[0087] In an optional implementation of the embodiment of the present application, the device further includes: an expansion unit; The expansion unit is used to expand multiple existing sensitive words with similar-phonetic characters to obtain multiple preset sensitive words.

[0088] Through various implementation methods provided in this embodiment, the sensitive word processing device includes an acquisition unit, a determination unit, a merging unit and a filtering unit; the acquisition unit acquires multiple candidate sensitive words in the text to be filtered, and the position information of each candidate sensitive word in the text to be filtered; the determination unit determines the inclusion relationship between multiple candidate sensitive words through multiple candidate sensitive words and multiple position information corresponding to the multiple candidate sensitive words; the merging unit merges multiple candidate sensitive words based on the inclusion relationship to obtain the target sensitive word; the filtering unit filters the target sensitive word in the text to be filtered to obtain the filtered text. The device can consider the inclusion relationship between multiple candidate sensitive words in the text to be filtered through the position information of each candidate sensitive word in the text to be filtered, and realize the merging of multiple candidate sensitive words to obtain the target sensitive word; based on this, filtering the target sensitive word in the text to be filtered can reduce the repeated filtering operation of sensitive words, avoid the problem of repeated filtering of sensitive words, and improve the filtering efficiency of sensitive words on the basis of ensuring the filtering effect of sensitive words.

[0089] In addition, an embodiment of the present application further provides a computer device, the computer device comprising a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is configured to execute the method described in the above embodiment according to the instructions in the computer program.

[0090] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, it is used to implement the method described in the above embodiment.

[0091] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0092] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0093] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprises a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0094] The above is only a preferred embodiment of the present application and does not constitute any formal limitation to the present application. Although the present application has been disclosed as above with a preferred embodiment, it is not intended to limit the present application. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present application using the methods and technical contents disclosed above without departing from the scope of the technical solution of the present application, or modify it into an equivalent embodiment of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments based on the technical essence of the present application without departing from the content of the technical solution of the present application still fall within the scope of protection of the technical solution of the present application.

Claims

1. A sensitive word processing method, characterized in that: include: Acquire multiple candidate sensitive words in the text to be filtered, and position information of each of the candidate sensitive words in the text to be filtered; Determining the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words; Merging the multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word; Sensitive word filtering is performed on the target sensitive words in the text to be filtered to obtain a filtered text.

2. The method according to claim 1, characterized in that The plurality of candidate sensitive words include a first sensitive word and a second sensitive word; and determining the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words includes: If the position information of the second sensitive word includes the position information of the first sensitive word, determining the inclusion relationship includes that the second sensitive word includes the first sensitive word.

3. The method according to claim 1, characterized in that The method further comprises: For each of the target sensitive words, if the target sensitive word matches a target word index in a preset recovery word library, determine a target recovery word corresponding to the target word index; the preset recovery word library includes a plurality of preset word indexes and a preset recovery word corresponding to each of the preset word indexes, and the preset word indexes belong to sensitive words; If the text to be filtered includes the target restored word, sensitive word restoration is performed on the filtered text according to the target sensitive word in the text to be filtered to obtain a restored text.

4. The method according to claim 3, characterized in that If the text to be filtered includes the target restored word, performing sensitive word restoration on the filtered text according to the target sensitive word in the text to be filtered to obtain the restored text, comprising: If the text to be filtered includes the target restored word, and the position information of the target restored word in the text to be filtered includes the position information of the target sensitive word in the text to be filtered, the filtered text is restored with sensitive words according to the target sensitive word in the text to be filtered to obtain the restored text.

5. The method according to any one of claims 1 to 4, characterized in that: The location information includes a starting location and an ending location.

6. The method according to claim 1, characterized in that The step of obtaining a plurality of candidate sensitive words in the text to be filtered and location information of each of the candidate sensitive words in the text to be filtered includes: Sensitive word detection is performed on the text to be filtered according to a plurality of preset sensitive words in a preset sensitive word library, and a plurality of candidate sensitive words and position information of each candidate sensitive word are obtained.

7. The method according to claim 6, characterized in that The steps of obtaining the plurality of preset sensitive words include: Multiple existing sensitive words are expanded with similar-phonetic characters to obtain multiple preset sensitive words.

8. A sensitive word processing device, characterized in that: include: Get unit, determine unit, merge unit and filter unit; The acquisition unit is used to acquire a plurality of candidate sensitive words in the text to be filtered, and position information of each of the candidate sensitive words in the text to be filtered; The determining unit is used to determine the inclusion relationship between the plurality of candidate sensitive words according to the plurality of candidate sensitive words and the plurality of position information corresponding to the plurality of candidate sensitive words; The merging unit is used to merge the multiple candidate sensitive words according to the inclusion relationship to obtain a target sensitive word; The filtering unit is used to perform sensitive word filtering on the target sensitive words in the text to be filtered to obtain filtered text.

9. A computer device, characterized in that: The computer device comprises a processor and a memory: The memory is used to store a computer program and transmit the computer program to the processor; The processor is configured to execute the method according to any one of claims 1 to 7 according to the instructions in the computer program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and when the computer program is executed by a processor, it is used to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Sensitive information determining method, device, equipment and storage medium

    CN111539206A

  • Sensitive word recognition method and device, electronic equipment and storage medium

    CN114298039A

  • Text auditing method and device, electronic equipment, storage medium and product

    CN115952792A

  • Sensitive word filtering method and device, equipment and storage medium

    CN117312540A

  • Method and system for identifying variant words in text and extracting sensitive words

    CN117725161A