Text auditing method, related device, equipment and storage medium
By performing character filtering and matching link assembly on the input text, the inaccuracy and incompleteness of the existing text review methods when facing complex evasion methods are solved, and more efficient violation identification and review effects are achieved.
Patent Information
- Application Number
- CN202510026504.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2045-01-08
AI Technical Summary
When faced with complex evasion methods, the existing text review methods are inaccurate and incomplete, making it difficult to effectively identify illegal content.
By filtering the input text character, including character culling and variant conversion, we obtain the text to be reviewed in natural language, and assemble multiple matching methods according to the application scenario to form a matching link, and combine the series and parallel connection methods to review the text to be reviewed. Review.
It improves the comprehensiveness and accuracy of text review, can more effectively identify complex violation content, and adapt to violation forms in different application scenarios.
Smart Images

Figure CN119416790A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a text review method and related devices, equipment and storage media. Background Art
[0002] With the rapid development of information technology, massive amounts of data such as human-to-human conversation data, human-computer conversation data, and user-published data are generated. Therefore, it is particularly important to automatically review the data content to ensure its compliance.
[0003] At present, the existing review methods have a certain effect in dealing with direct and explicit illegal content, but they are unable to cope with the increasingly complex circumvention methods (such as replacement of similar characters, splitting of Chinese characters, replacement of homophones, homophony and harmonious meaning, etc.), and they show problems such as inaccurate and incomplete review. In view of this, how to improve the comprehensiveness and accuracy of text review has become an issue that needs to be solved urgently. Summary of the invention
[0004] The main technical problem solved by this application is to provide a text review method and related devices, equipment and storage media, which can improve the comprehensiveness and accuracy of text review.
[0005] In order to solve the above-mentioned technical problems, the first aspect of the present application provides a text review method, comprising: performing character filtering based on an input text to obtain a text to be reviewed expressed in a natural language, and assembling several matching methods based on the application scenario of the input text to obtain a matching link; wherein, character filtering includes at least one of character removal and variant conversion, the matching link includes at least one matching method, and the matching methods in the matching link are assembled in at least one connection method of series or parallel connection; based on the matching link, the text to be reviewed is reviewed to obtain a review result; wherein the review result includes whether the input text involves illegal content.
[0006] In order to solve the above-mentioned technical problems, the second aspect of the present application provides a text review device, including: a filtering assembly module and a result acquisition module, the filtering assembly module is used to perform character filtering based on the input text to obtain a text to be reviewed expressed in a natural language, and assemble several matching methods based on the application scenario of the input text to obtain a matching link; wherein, character filtering includes at least one of character removal and variant conversion, the matching link contains at least one matching method, and the matching methods in the matching link are assembled in at least one connection method of series or parallel; the result acquisition module is used to review the text to be reviewed based on the matching link to obtain a review result; wherein the review result includes whether the input text involves illegal content.
[0007] In order to solve the above technical problems, the third aspect of the present application provides an electronic device, which at least includes a memory and a processor coupled to each other, the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the text review method in the above first aspect.
[0008] In order to solve the above technical problems, the fourth aspect of the present application provides a computer-readable storage medium storing program instructions that can be executed by a processor, and the program instructions are used to implement the text review method of the first aspect.
[0009] The above scheme performs character filtering based on the input text to obtain the text to be reviewed expressed in natural language, and assembles several matching methods based on the application scenario of the input text to obtain a matching link, and the character filtering includes at least one of character removal and variant conversion, and the matching link includes at least one matching method, and the matching methods in the matching link are assembled in at least one connection method of series connection and parallel connection, and then the text to be reviewed is reviewed based on the matching link to obtain the review result, and the review result includes whether the input text involves illegal content. Therefore, on the one hand, through the pre-step of character filtering, the input text can be converted into natural language expression, which helps to strengthen the recognition ability of complex violations in subsequent reviews. On the other hand, according to the application scenario, the matching method is assembled to obtain a matching link, and different matching methods can be adaptively combined in different modes such as series connection, parallel connection, and series-parallel combination, which helps to adapt to different forms of illegal content that may appear in the application scenario. Therefore, the comprehensiveness and accuracy of text review can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a flowchart of an embodiment of the present application text review method; Figure 2a It is a schematic diagram of an embodiment of character filtering of the present application; Figure 2b is a schematic diagram of an embodiment of a matching link of the present application; Figure 2c This is a schematic diagram of an embodiment of regular matching of the present application; Figure 3 It is a schematic diagram of the framework of an embodiment of the text review device of the present application; Figure 4 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application; Figure 5 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0011] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0012] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0013] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the fragment " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.
[0014] See also Figure 1 , Figure 1 This is a flow chart of an embodiment of the present application text review method. Specifically, it may include the following steps: Step S11: Character filtering is performed based on the input text to obtain the text to be reviewed expressed in natural language, and several matching methods are assembled based on the application scenario of the input text to obtain a matching link.
[0015] In one implementation scenario, the input text may be at least one of the user input text and the machine output text during human-computer dialogue. Exemplarily, taking the use of a large language model to implement human-computer dialogue as an example, the input text may include at least one of the input content and the output content of the large language model. Alternatively, the input text may be user input text during human-to-human dialogue. Alternatively, the input text may also be user-published text (such as text published on self-media platforms, etc.). It should be noted that the above examples are only a few possible examples of input text, and the specific content of the input text is not limited here. Of course, before processing the input text, a request for monitoring permission for the input text may be prompted in advance, and after obtaining the authorization license for the monitoring permission, the process steps in the disclosed embodiment are executed to review the input text.
[0016] In the embodiment of the present disclosure, character filtering may include at least one of character removal and variant conversion. Figure 2a , Figure 2a Schematic diagram of an embodiment of character filtering. Figure 2aAs shown, as a possible implementation, character filtering may include character elimination. Exemplarily, character elimination may include, but is not limited to, eliminating whitespace characters, eliminating kaomoji, etc. As another implementation, character filtering may include variant conversion. Exemplarily, variant conversion may include, but is not limited to: language case conversion (e.g., converting П in Russian to P in English), pinyin character conversion (e.g., converting "药Pin" to "药品"), similar character conversion (e.g., converting "甲请" to "申请"), Chinese character splitting and conversion (e.g., converting "贝反卖" to "贩卖"), etc. Specific types of variant conversion are not further exemplified herein. Additionally, variant conversion may be specifically implemented through a variant dictionary. For example, various variant dictionaries such as a language case conversion dictionary, a pinyin character conversion dictionary, a similar character conversion dictionary, a Chinese character splitting and conversion dictionary, etc. may be collected, and then the various variant dictionaries are used to process the characters in the input text. As yet another possible example, character filtering may further include character elimination and variant conversion performed successively, so as to gradually normalize the input text, and finally convert the input text containing various circumvention means into a text to be reviewed expressed in natural language.
[0017] In the embodiments of the present disclosure, the matching link includes at least one matching method, and the matching methods in the matching link are assembled in at least one connection method of series and parallel. It should be noted that several matching methods may include, but are not limited to: sensitive word matching, regular expression matching, semantic matching, etc. Specific types of matching methods are not limited herein. As a possible example, the matching methods in the matching link may be assembled in a series connection method; as another possible example, the matching methods in the matching link may be assembled in a parallel connection method; as yet another possible example, the matching methods in the matching link may be assembled in series and parallel connection methods. For example, if the matching link includes three matching methods, for the sake of distinction, they may be respectively referred to as: matching method 1, matching method 2, and matching method 3. Among them, matching method 1 and matching method 2 may be assembled in a parallel connection method, and matching method 3 is assembled with matching method 2 in a series connection method. Of course, the above examples are merely several possible examples of the matching link, and specific configurations and specific contents of the matching link are not limited herein.
[0018] In an implementation scenario, the application scenarios of the input text may include, but are not limited to: person-to-person conversation, human-machine conversation, user posting, etc. Additionally, the application scenarios may not be limited thereto. For example, the application scenario "person-to-person conversation" may be further refined into: one-on-one single chat person-to-person conversation, multi-person group chat person-to-person conversation, etc. It should be noted that the above examples are merely several possible examples of the application scenarios of the input text in the actual application process, and application scenarios of the input text are not further exemplified herein.
[0019] In an implementation scenario, different matching methods can be selected to assemble in different connection methods according to different application scenarios of the input text to obtain matching links. For example, when the application scenario is more complex, more matching methods can be selected to assemble in a more complex connection method; or, when the application scenario is simpler, fewer matching methods can be selected to assemble in a simpler connection method. In other words, the complexity of the application scenario is positively correlated with the total number of matching methods selected, and is also positively correlated with the complexity of the connection method selected. Please refer to Figure 2b , Figure 2b Schematic diagram of an embodiment of a matching link. Figure 2b As shown, as a special example, the matching link may include sensitive word matching, regular matching and semantic matching connected in series, so that when the text to be reviewed is reviewed based on the matching link, different matching methods from simple (but slightly worse performance) to complex (but better performance) can be experienced in sequence, which helps to improve the review efficiency of the text review.
[0020] Step S12: Review the text to be reviewed based on the matching link to obtain the review result.
[0021] In the disclosed embodiment, the audit result includes whether the input text involves illegal content. Exemplarily, the audit result may include that the input text involves illegal content; or, the audit result may include that the input text does not involve illegal content. In addition, in the case where the audit result includes that the input text involves illegal content, as a possible example, the input text can be shielded, such as in a person-to-person dialogue scenario, the input text can be shielded to cancel the delivery of the input text to the communication peer; or, as in a human-computer dialogue scenario, when the input text is the input content of a human-computer dialogue system (such as a large language model), the input text can be shielded to cancel the delivery of the input text to the human-computer dialogue system, and when the input text is the output content of the human-computer dialogue system, the input text can be shielded to cancel the delivery of the input text to the user terminal. Of course, the above examples are only several possible implementation examples that may be taken for the input text when the input text involves illegal content in the actual application process. Other possible implementation methods are not limited here, and no examples are given one by one.
[0022] In one implementation scenario, when the matching link includes sensitive word matching, a sensitive word matching tree can be constructed based on the sensitive word library, and the sensitive word library includes several sensitive words involving illegal content. The pronunciation units represented by each node on any path in the sensitive word matching tree are sequentially combined into a pronunciation sequence of sensitive words, so that in response to the pronunciation unit represented by the node being an initial consonant unit of a flat tongue and a retroflex tongue sound, the pronunciation unit represented by the node can be completed to be an initial consonant unit containing both a flat tongue and a retroflex tongue sound, and then the text to be reviewed is matched based on the sensitive word matching tree to obtain the output result of the sensitive word matching, and when the sensitive word matching turns on fuzzy matching of front and back nasals, the pronunciation unit and the back nasals in the text to be reviewed are automatically ignored in the process of matching the text to be reviewed based on the sensitive word matching tree, and the output result includes whether the illegal content is hit. The above method, by completing the pronunciation unit represented by the node as an initial consonant unit of a flat and retroflex consonant, and automatically ignoring the pronunciation unit and the back nasal sound in the text to be reviewed when the fuzzy matching of the front and back nasal sounds is turned on for the sensitive word matching, can achieve fuzzy matching of sensitive words such as flat and retroflex consonants and front and back nasal sounds.
[0023] In a specific implementation scenario, the sensitive word library can be pre-built. For example, different sensitive word libraries can be loaded according to different application scenarios, or a unified sensitive word library can be loaded, and the specific content in the sensitive word library is not limited here.
[0024] In a specific implementation scenario, in the AC automaton solution, each dictionary tree node is usually 1 character. Now it is optimized and transformed so that each tree node can have an optional character set. In this way, when the pinyin word is constructed in the tree, the initial consonants corresponding to the flat and retroflex consonants (z corresponds to zh, c corresponds to ch, s corresponds to sh) will be generalized into the corresponding character set in the tree node. For example, the flat and retroflex consonants → chi dun. In the traditional matching tree, the pinyin chi string of the word "chi" may construct a tree node of c→h→i. After the transformation, the construction method of this string will become (c, ch)→(i), so that no matter whether the original text is ci or chi, it can be matched.
[0025] In a specific implementation scenario, after the front and back nasal rhyme fuzzy feature is turned on, when encountering front and back nasal rhyme scenarios such as an / ang, en / eng, in / ing, the corresponding back nasal rhyme g letter in the original text and tree node will be automatically ignored.
[0026] In one implementation scenario, see Figure 2c , Figure 2c Schematic diagram of an embodiment of regular matching. Figure 2cAs shown, in the case where the matching link includes regular matching, a regular expression library can be obtained, and the regular expression library includes several regular expressions, and the regular expression is used to hit the illegal content, and based on the regular expression library, an index tree for filtering regular expressions is constructed, and different paths in the index tree represent different regular expressions, so that the index tree can be traversed based on the text to be reviewed to select the regular expression as the candidate expression, and then the candidate expression after reconstruction using the finite state automaton can be matched with the text to be reviewed to obtain the output result of the regular match, and the output result includes whether the illegal content is hit. The above method, by first constructing an index tree to preliminarily filter out the regular expressions suspected to be in compliance as candidate expressions, and then matching the text to be reviewed based on the candidate expression after reconstruction using the finite state automaton, on the one hand, by using the index tree for screening, it helps to improve the screening efficiency of regular expressions, especially in the case of massive regular expressions, and on the other hand, by using the finite state automaton to reconstruct the regular expression and then match the text to be reviewed, it can improve the matching efficiency.
[0027] In a specific implementation scenario, as a possible example, after obtaining the regular expression library, the deterministic substring of the regular expression can be extracted as the index key of the regular expression, and the deterministic substring is a string that is used to filter whether it is suspected to match the regular expression, and then an index tree is constructed based on the index keys of each regular expression. Exemplarily, in general, as long as the regular expression can extract a "(one or more) deterministic substring" as an index key, there is an opportunity to accelerate its indexing. For example, (1) fixed prefix: such as ^abc\d+, the prefix is abc, followed by a bunch of numbers. It can be decomposed into: a fixed string prefix "abc"; followed by a "must appear at least once" form; (2) fixed suffix: a suffix-determined pattern like \d{4}\.jpg$; (3) contains simple characters or patterns in the middle: such as abc.*def, the part between abc and def is processed with wildcards; (4) does not contain complex loops, lookahead / lookbehind, backtracking, etc. After extracting these "deterministic substrings", they can be used as index keys and the AC automatic mechanism can be used to build an index tree. On this basis, when entering the text to be reviewed, you can first go through the index tree to exclude the regular expressions corresponding to the "deterministic substrings" that have not been hit. The remaining ones are the regular expressions that are suspected to be matched, which helps to greatly reduce the subsequent precise matching pressure, thereby improving the overall matching efficiency.
[0028] In a specific implementation scenario, as another possible example, as a possible supplement to the aforementioned index tree construction process, complex matching patterns can be parsed and the tree node class can be expanded to support the complex characteristics of regular expressions. For example, for characters and character sets, they can be directly added to the subsequent nodes of the current node; or, for selection ('|'), a branch node can be created to process each selected part separately and merge at the end; or, for quantifiers, the current node or combination node can be marked as optional (?), repeated (* or +); or, for grouping, it can be processed as a whole, such as creating a virtual root node to indicate the beginning and end of the grouping, etc. Of course, the above examples are only a few supplementary examples for building an index tree when certain complex situations occur in regular expressions. Other possible situations are not limited here, and examples are not given one by one.
[0029] In a specific implementation scenario, after the candidate expressions are screened, they can be reconstructed based on the candidate expressions to obtain a nondeterministic finite automaton (NFA), and then converted based on the nondeterministic finite automaton to obtain a deterministic finite automaton (DFA), so as to match the text to be reviewed based on the deterministic finite automaton to obtain the output result of the regular match. It should be noted that the specific process of converting from regular expressions to NFA and then from NFA to DFA can refer to the technical details of regular expressions and finite state machines (FSA), which will not be repeated here. In addition, in the process of matching the text to be reviewed based on the deterministic finite automaton, the current state can be initialized as the initial state, and the text to be reviewed can be read character by character. Then, the target state to which the current character is transferred from the initial state is queried in the finite automaton, and the initial state is updated as the target state, so that it can be detected whether the latest initial state is an accepting state, and then in response to the latest initial state being an accepting state, the output result is determined to include hitting the illegal content, and in response to the latest initial state not being an accepting state, the step of reading the text to be reviewed character by character is returned to execute, that is, the above-mentioned state transfer and other process steps can be continued for the next character until all the characters in the text with review are read. For ease of understanding, the core idea and main process of using DFA to match the text to be reviewed are briefly described below. First, the core idea of using DFA to match the text to be reviewed is introduced: the text to be reviewed "walks" the state transition of the automaton character by character, and once it enters the "accepting state (final state)", it means that the matching pattern has been found. If our requirement is "as long as there is any illegal content in the text, it is judged to be illegal", then as long as there is a situation of entering the accepting state once, the text can be immediately judged to be illegal.The main process includes the following steps: (1) Initialization: Set the current state of the automaton to the "initial state" (startstate); (2) Read the text to be reviewed character by character: Start from the first character of the text, read one character c at a time, and query "which state S{\prime} should be transferred to after encountering character c from S" (which may be a "dead state" or the next valid state) in the transition table of the minimized DFA according to the current state S and the input character c; (3) Update the current state: Update the current state to the next state S{\prime} just found. If the state is an accepting state (final / accepting state), it means that so far (the substring at this position) has matched at least one pattern we are concerned about. In the "check violation" scenario, this usually means that it is possible to directly determine that the text contains illegal content. If you need to continue to find more matching positions, you can continue to read forward without stopping; if you only need to "whether it is illegal", then you can stop judging at this time and give the result "text violation"; (4) Continue to read the text: If the automaton never enters the accepting state until the text is completely read, it means that there is no pattern in the text that can be recognized by the automaton (that is, no violation); (5) Output the result: According to whether it has entered the accepting state, output "hit illegal content" or "missed illegal content". The above method, by converting the candidate expression to NFA, then converting NFA to DFA, and minimizing DFA, matches the text to be reviewed based on this, and performs state transfer character by character in combination with the latest current state during the matching process, so as to determine whether the illegal content is hit based on whether the latest current state after the transfer is the accepting state, which can greatly improve the matching efficiency of whether there is a violation.
[0030] In one implementation scenario, when the matching link includes semantic matching, the text to be reviewed can be identified based on the semantic recognition model to obtain the output result of the semantic matching, and the output result includes whether the illegal content is hit. It should be noted that the semantic recognition model may include but is not limited to network structures such as Transformer, and the network structure contained in the semantic recognition model is not limited here. In addition, the semantic recognition model may specifically include a feature extraction network (such as Encoder encoder, etc.) for extracting text semantic features of the text to be reviewed, and may include a violation prediction network (such as Decoder decoder, etc.) for prediction based on text semantic features to output whether the illegal content is hit. Of course, the above example is only a possible architecture of the semantic recognition model, and the model architecture of the semantic recognition model will not be given one by one here.
[0031] In one implementation scenario, in order to further improve the audit efficiency, when the output result of any matching method on the matching link includes hitting illegal content, the matching link can be jumped out and the audit result can be directly determined as the input text involving illegal content. Figure 2b , to match the link Figure 2b As shown in the example, when based on Figure 2b During the review process of the text to be reviewed, if the matching method "sensitive word matching" is reached and the output result includes illegal content, you can directly jump out. Figure 2b The matching link shown in the figure stops executing the subsequent matching methods of the matching method "sensitive word matching" in the matching link, and directly determines that the audit result is that the input text involves illegal content. In addition, in the process of auditing the text to be audited based on the matching link, each time after obtaining the output result of the matching method on the matching link, in response to the output result including no illegal content, the matching methods on the matching link can be continued in the existing order. Please continue to refer to Figure 2b If the matching method "Sensitive Word Matching" is reached and its output includes no illegal content, you can continue to run the matching method "Regular Expression", and so on. Figure 2b The matching link shown is used as an example of a possible example of "short circuit jump after hit" and "continue running if no hit", and other possible situations will not be given examples one by one here. In the above method, in the process of auditing the text to be audited based on the matching link, in response to the output result of any matching method on the matching link including a hit of illegal content, the matching link is jumped out, and the audit result is directly determined as the input text involving illegal content, which helps to improve the audit efficiency while ensuring the audit effect and audit performance as much as possible. Of course, in the case of relatively loose requirements on audit efficiency, in the process of auditing the text to be audited based on the matching link, in response to the output result of any matching method on the matching link including a hit of illegal content, the matching link can also continue to run without jumping out of the matching link.
[0032] The above scheme performs character filtering based on the input text to obtain the text to be reviewed expressed in natural language, and assembles several matching methods based on the application scenario of the input text to obtain a matching link, and the character filtering includes at least one of character removal and variant conversion, and the matching link includes at least one matching method, and the matching methods in the matching link are assembled in at least one connection method of series connection and parallel connection, and then the text to be reviewed is reviewed based on the matching link to obtain the review result, and the review result includes whether the input text involves illegal content. Therefore, on the one hand, through the pre-step of character filtering, the input text can be converted into natural language expression, which helps to strengthen the recognition ability of complex violations in subsequent reviews. On the other hand, according to the application scenario, the matching method is assembled to obtain a matching link, and different matching methods can be adaptively combined in different modes such as series connection, parallel connection, and series-parallel combination, which helps to adapt to different forms of illegal content that may appear in the application scenario. Therefore, the comprehensiveness and accuracy of text review can be improved.
[0033] See also Figure 3 , Figure 3 It is a schematic diagram of the framework of an embodiment of the text audit device of the present application. The text audit device 30 includes: a filtering assembly module 31 and a result acquisition module 32. The filtering assembly module 31 is used to perform character filtering based on the input text to obtain the text to be audited expressed in natural language, and assemble several matching methods based on the application scenario of the input text to obtain a matching link; wherein, the character filtering includes at least one of character removal and variant conversion, the matching link includes at least one matching method, and the matching methods in the matching link are assembled in at least one connection mode of series connection and parallel connection; the result acquisition module 32 is used to audit the text to be audited based on the matching link to obtain the audit result; wherein, the audit result includes whether the input text involves illegal content.
[0034] In the above scheme, the text audit device 30 performs character filtering based on the input text to obtain the text to be audited expressed in natural language, and assembles several matching methods based on the application scenario of the input text to obtain a matching link, and the character filtering includes at least one of character removal and variant conversion, and the matching link includes at least one matching method, and the matching method in the matching link is assembled in at least one connection method of series connection and parallel connection, and then the text to be audited is audited based on the matching link to obtain the audit result, and the audit result includes whether the input text involves illegal content. Therefore, on the one hand, through the pre-step of character filtering, the input text can be converted into natural language expression, which helps to strengthen the recognition ability of complex violations in subsequent audits. On the other hand, according to the application scenario, the matching method is assembled to obtain a matching link, and different matching methods can be adaptively combined in different modes such as series connection, parallel connection, and series-parallel combination, which helps to adapt to different forms of illegal content that may appear in the application scenario. Therefore, the comprehensiveness and accuracy of text audit can be improved.
[0035] In some disclosed embodiments, when the matching link includes a sensitive word match, the text review device 30 includes a matching tree construction module for constructing a sensitive word matching tree based on a sensitive word library; wherein the sensitive word library includes a number of sensitive words involving illegal content, and the pronunciation units represented by each node on any path in the sensitive word matching tree are sequentially combined into a pronunciation sequence of the sensitive word; the text review device 30 includes a node completion module for responding to the pronunciation unit represented by the node being an initial consonant unit of a flat tongue and a retroflex tongue sound, completing the pronunciation unit represented by the node to be an initial consonant unit containing both a flat tongue and a retroflex tongue sound; the text review device 30 includes a matching tree review module for matching the text to be reviewed based on the sensitive word matching tree to obtain an output result of the sensitive word matching; wherein, when the sensitive word matching turns on fuzzy matching of front and back nasals, in the process of matching the text to be reviewed based on the sensitive word matching tree, the pronunciation unit and the back nasals in the text to be reviewed are automatically ignored, and the output result includes whether the illegal content is hit.
[0036] In some disclosed embodiments, when the matching link includes a regular match, the text review device 30 includes an expression library acquisition module for acquiring a regular expression library; wherein the regular expression library includes a number of regular expressions, and the regular expressions are used to hit illegal content; the text review device 30 includes an index tree construction module for constructing an index tree for filtering regular expressions based on the regular expression library; wherein different paths in the index tree represent different regular expressions respectively; the text review device 30 includes an expression screening module for traversing the index tree based on the text to be reviewed to select a regular expression as a candidate expression; the text review device 30 includes an expression review module for matching the text to be reviewed based on the candidate expression after reconstruction using a finite state automaton to obtain an output result of the regular match; wherein the output result includes whether the illegal content is hit.
[0037] In some disclosed embodiments, the expression review module includes a reconstruction submodule for reconstructing based on the candidate expression to obtain an uncertain finite automaton; the expression review module includes a conversion submodule for converting based on the uncertain finite automaton to obtain a deterministic finite automaton; the expression review module includes a matching submodule for matching the text to be reviewed based on the deterministic finite automaton to obtain a regular matching output result.
[0038] In some disclosed embodiments, the matching submodule includes an initialization unit for initializing the current state to be an initial state; the matching submodule includes a reading unit for reading the text to be reviewed character by character; the matching submodule includes a query unit for querying the target state to which the current character is transferred from the initial state in a finite automaton, and updating the initial state to the target state; the matching submodule includes a detection unit for detecting whether the latest initial state is an accepting state; the matching submodule includes a determination unit for determining that the output result includes a hit on illegal content in response to the latest initial state being an accepting state; the matching submodule includes a loop unit for returning to the step of reading the text to be reviewed character by character in response to the latest initial state not being an accepting state.
[0039] In some disclosed embodiments, the index tree construction module includes an extraction submodule for extracting deterministic substrings of regular expressions as index keys of the regular expressions; wherein the deterministic substrings are strings that are screened to see whether they are suspected of matching the regular expression; and the index tree construction module includes a construction submodule for constructing an index tree based on the index keys of each regular expression.
[0040] In some disclosed embodiments, when the matching link includes a semantic match, the text review device 30 includes a semantic recognition module for identifying the text to be reviewed based on a semantic recognition model to obtain an output result of the semantic match; wherein the output result includes whether the illegal content is hit.
[0041] In some disclosed embodiments, the text review device 30 includes a short-circuit jump-out module, which is used to jump out of the matching link in response to the output result of any matching method on the matching link including hitting illegal content during the review process of the text to be reviewed based on the matching link, and directly determine that the review result is that the input text involves illegal content.
[0042] In some disclosed embodiments, the matching link includes sensitive word matching, regular matching, and semantic matching connected in series; and / or the input text includes at least one of input content and output content of a large language model.
[0043] See also Figure 4 , Figure 4 It is a schematic diagram of the framework of an embodiment of an electronic device of the present application. The electronic device 40 includes at least a memory 41 and a processor 42 coupled to each other, the memory 41 stores at least program instructions, and the processor 42 is used to execute the program instructions to implement the steps in any of the above-mentioned text review method embodiments. For details, please refer to the aforementioned disclosed embodiments, which will not be repeated here. As a possible example, the electronic device 40 may include but is not limited to an office notebook, a smart phone, a tablet computer, a learning machine, a server, etc., and the specific type of the electronic device 40 is not limited here.
[0044] Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above-mentioned intelligent dialogue method embodiments. The processor 42 can also be called a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 42 can be implemented by an integrated circuit chip.
[0045] In the above scheme, the electronic device 40 performs character filtering based on the input text to obtain the text to be reviewed expressed in natural language, and assembles several matching methods based on the application scenario of the input text to obtain a matching link, and the character filtering includes at least one of character removal and variant conversion, and the matching link includes at least one matching method, and the matching method in the matching link is assembled in at least one connection method of series connection and parallel connection, and then the text to be reviewed is reviewed based on the matching link to obtain the review result, and the review result includes whether the input text involves illegal content. Therefore, on the one hand, through the pre-step of character filtering, the input text can be converted into natural language expression, which helps to strengthen the recognition ability of complex violations in subsequent reviews. On the other hand, according to the application scenario, the matching method is assembled to obtain a matching link, and different matching methods can be adaptively combined in different modes such as series connection, parallel connection, and series-parallel combination, which helps to adapt to different forms of illegal content that may appear in the application scenario. Therefore, the comprehensiveness and accuracy of text review can be improved.
[0046] See also Figure 5 , Figure 5 The figure is a schematic diagram of a framework of an embodiment of a computer-readable storage medium 50 of the present application. The computer-readable storage medium 50 stores program instructions 51 that can be executed by a processor, and the program instructions 51 are used to implement the steps in any of the above-mentioned text review method embodiments.
[0047] In the above scheme, the computer-readable storage medium 50 performs character filtering based on the input text to obtain the text to be reviewed expressed in natural language, and assembles several matching methods based on the application scenario of the input text to obtain a matching link, and the character filtering includes at least one of character removal and variant conversion, and the matching link includes at least one matching method, and the matching method in the matching link is assembled in at least one connection method of series connection and parallel connection, and then the text to be reviewed is reviewed based on the matching link to obtain the review result, and the review result includes whether the input text involves illegal content. Therefore, on the one hand, through the pre-step of character filtering, the input text can be converted into natural language expression, which helps to strengthen the recognition ability of complex violations in subsequent reviews. On the other hand, according to the application scenario, the matching method is assembled to obtain a matching link, and different matching methods can be adaptively combined in different modes such as series connection, parallel connection, and series-parallel combination, which helps to adapt to different forms of illegal content that may appear in the application scenario. Therefore, the comprehensiveness and accuracy of text review can be improved.
[0048] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0049] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0050] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0051] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0052] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0053] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0054] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A text review method, characterized in that: include: Character filtering is performed based on the input text to obtain a text to be reviewed expressed in a natural language, and a plurality of matching methods are assembled based on the application scenario of the input text to obtain a matching chain; wherein the character filtering includes at least one of character elimination and variant conversion, the matching chain includes at least one of the matching methods, and the matching methods in the matching chain are assembled in at least one connection mode of series connection or parallel connection; The text to be reviewed is reviewed based on the matching link to obtain a review result; wherein the review result includes whether the input text involves illegal content.
2. The method according to claim 1, characterized in that In the case where the matching link includes a sensitive word match, the method includes: Based on the sensitive word library, a sensitive word matching tree is constructed; wherein the sensitive word library contains a number of sensitive words involving illegal content, and the pronunciation units represented by each node on any path in the sensitive word matching tree are sequentially combined into a pronunciation sequence of the sensitive word; In response to the pronunciation unit represented by the node being an initial consonant unit of a flat tongue consonant and a retroflex consonant, completing the pronunciation unit represented by the node to be an initial consonant unit including both a flat tongue consonant and a retroflex consonant; The text to be reviewed is matched based on the sensitive word matching tree to obtain an output result of the sensitive word matching; wherein, when the sensitive word matching turns on fuzzy matching of front and back nasals, in the process of matching the text to be reviewed based on the sensitive word matching tree, the pronunciation unit and the back nasals in the text to be reviewed are automatically ignored, and the output result includes whether illegal content is hit.
3. The method according to claim 1, characterized in that In the case where the matching link includes a regular match, the method includes: Obtain a regular expression library; wherein the regular expression library contains a plurality of regular expressions, and the regular expressions are used to hit illegal content; Based on the regular expression library, an index tree for filtering the regular expression is constructed; wherein different paths in the index tree represent different regular expressions respectively; Traversing the index tree based on the text to be reviewed to select the regular expression as a candidate expression; The text to be reviewed is matched based on the candidate expression reconstructed by using a finite state automaton to obtain the output result of the regular match; wherein the output result includes whether illegal content is hit.
4. The method according to claim 3, characterized in that The matching of the text to be reviewed based on the candidate expression after reconstruction using a finite state automaton to obtain the output result of the regular matching includes: Reconstructing based on the candidate expression to obtain an uncertain finite automaton; Performing conversion based on the uncertain finite automaton to obtain a deterministic finite automaton; The text to be reviewed is matched based on the determined finite automaton to obtain the output result of the regular match.
5. The method according to claim 4, characterized in that The matching of the to-be-audited text based on the determined finite automaton to obtain the output result of the regular matching includes: Initialize the current state to the initial state, and read the text to be reviewed character by character; Inquiring in the finite automaton the target state to which the initial state is transferred after encountering the current character, and updating the initial state to the target state; Detect whether the latest initial state is an accepting state; In response to the latest initial state being the acceptance state, determining that the output result includes hitting illegal content; In response to the latest initial state not being the accepting state, returning to the step of reading the text to be reviewed character by character.
6. The method according to claim 3, characterized in that: The step of constructing an index tree for filtering the regular expression based on the regular expression library comprises: Extracting a deterministic substring of the regular expression as an index key of the regular expression; wherein the deterministic substring is a string that is screened to determine whether it is suspected to match the regular expression; The index tree is constructed based on the index keys of the regular expressions.
7. The method according to claim 1, characterized in that In the case where the matching link includes a semantic match, the method includes: The text to be reviewed is identified based on a semantic recognition model to obtain an output result of the semantic matching; wherein the output result includes whether illegal content is found.
8. The method according to claim 1, characterized in that In the process of reviewing the text to be reviewed based on the matching link, the method further includes: In response to the output result of any of the matching methods on the matching link including hitting illegal content, the matching link is jumped out, and the audit result is directly determined to be that the input text involves illegal content.
9. The method according to any one of claims 1 to 8, characterized in that: The matching link includes sensitive word matching, regular matching and semantic matching connected in series; And / or, the input text includes at least one of input content and output content of a large language model.
10. A text review device, characterized in that: include: A filtering and assembling module, configured to perform character filtering based on an input text to obtain a text to be reviewed expressed in a natural language, and to assemble a plurality of matching methods based on an application scenario of the input text to obtain a matching chain; wherein the character filtering includes at least one of character elimination and variant conversion, the matching chain includes at least one of the matching methods, and the matching methods in the matching chain are assembled in at least one connection mode of series connection or parallel connection; The result acquisition module is used to audit the text to be audited based on the matching link to obtain an audit result; wherein the audit result includes whether the input text involves illegal content.
11. An electronic device, characterized in that: The invention at least comprises a memory and a processor coupled to each other, wherein the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the text review method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the text review method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Identity authentication method based on regular expression
CN104038344A
Multi-mode regular expression matching method and apparatus
CN104899264A
Text auditing method and device, equipment and medium
CN111506708A
Medical insurance medication auditing method and device, electronic equipment and storage medium
CN116525136A
Text sensitive word detection method and device, equipment and storage medium
CN117435720A