Blacklist text matching method and device based on twin network

By using a convolutional neural network and a multi-head self-attention module in Siamese networks for text feature extraction and matching, the problem of character-level deformation in blacklist text recognition in existing technologies is solved, and efficient and accurate blacklist text matching is achieved.

CN121880533APending Publication Date: 2026-04-17PICC INFORMATION TECH CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
PICC INFORMATION TECH CO LTD
Filing Date
2026-02-04
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively handle subtle character-level distortions such as spelling errors and homophones when identifying blacklisted text, and their processing speed is slow, making it difficult to handle the processing and changes of blacklisted data on the order of millions.

Method used

A convolutional neural network module of Siamese network is used for local feature extraction, combined with a multi-head self-attention module for global feature extraction, and similarity matching is performed through a pre-set blacklist text feature library. The feature library is used to store blacklist text features and perform efficient comparison.

Benefits of technology

It improves the effectiveness of blacklist text matching, effectively identifies fine-grained changes such as spelling distortions and character insertions, and enhances processing speed and efficiency, making it suitable for processing blacklist data of millions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121880533A_ABST
    Figure CN121880533A_ABST
Patent Text Reader

Abstract

The invention discloses a blacklist text matching method and device based on a twin network. The blacklist text matching method and device are used for improving matching effectiveness for blacklist texts. According to the scheme, the method comprises the steps of obtaining a to-be-matched text; performing local feature extraction on the to-be-matched text through a convolutional neural network module of the twin network to obtain local features of the to-be-matched text; performing global feature extraction on the local features of the to-be-matched text through a multi-head self-attention module of the twin network to obtain global features of the to-be-matched text; and determining a blacklist text meeting a preset similarity condition with the global feature of the to-be-matched text from a preset blacklist text feature library, the preset blacklist text feature library comprising a plurality of blacklist text features, and any blacklist text feature being obtained by performing feature extraction on the preset blacklist text through a twin network.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method and apparatus for blacklist text matching based on twin networks. Background Technology

[0002] In the field of artificial intelligence, large models can be used to identify sensitive content in text. For example, semantic recognition can be performed on the text to be matched, and the text can be semantically compared with blacklisted texts to determine whether the text to be matched contains sensitive content.

[0003] In some application scenarios, texts containing sensitive content may circumvent the above-mentioned semantic-based sensitive content identification by using misspellings, homophones, special symbols, etc., resulting in missed detection of sensitive content.

[0004] How to improve the matching effectiveness of blacklisted texts is the technical problem that this application aims to solve. Summary of the Invention

[0005] The purpose of this application is to provide a blacklist text matching method and apparatus based on twin networks to improve the matching effectiveness for blacklist text.

[0006] Firstly, a blacklist text matching method based on Siamese networks is provided, including: Get the text to be matched; The convolutional neural network module of the Siamese network is used to perform local feature extraction on the text to be matched, thereby obtaining the local features of the text to be matched; The multi-head self-attention module of the Siamese network performs global feature extraction on the local features of the text to be matched, thereby obtaining the global features of the text to be matched; The blacklist texts that satisfy the preset similarity condition with the global features of the text to be matched are determined from the preset blacklist text feature library. The preset blacklist text feature library includes multiple blacklist text features, and any one of the blacklist text features is obtained by performing feature extraction on the preset blacklist text through the Siamese network.

[0007] Secondly, a blacklist text matching device based on twin networks is provided, comprising: The module retrieves the text to be matched. The local feature extraction module performs local feature extraction on the text to be matched through the convolutional neural network module of the Siamese network to obtain the local features of the text to be matched; The global feature extraction module performs global feature extraction on the local features of the text to be matched through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched; The determination module determines blacklisted texts from a preset blacklisted text feature library that satisfy a preset similarity condition with the global features of the text to be matched. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted text through the twin network.

[0008] Thirdly, an electronic device is provided, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method of the first aspect.

[0009] Fourthly, a computer-readable storage medium is provided on which a computer program is stored, which, when executed by a processor, implements the steps of the method of the first aspect.

[0010] Fifthly, a computer program product is provided, comprising a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of the method of the first aspect.

[0011] In this embodiment, firstly, the text to be matched is obtained. Then, local feature extraction is performed on the text to be matched using the convolutional neural network module of the Siamese network to obtain local features of the text to be matched. The convolutional neural network module can perform character-level feature extraction, achieving feature extraction for local text areas. Next, global feature extraction is performed on the local features of the text to be matched using the multi-head self-attention module of the Siamese network to obtain global features of the text to be matched. The multi-head self-attention module can perform context-based global feature extraction, achieving global feature extraction based on the aforementioned local text features, so that the obtained global text features can simultaneously represent both local and global features. Finally, blacklisted texts that meet the preset similarity condition with the global features of the text to be matched are determined from a preset blacklisted text feature library. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted texts using the Siamese network. For fine-grained text variations such as spelling changes and character insertions in blacklist text matching applications, the solution provided in this application takes into account multi-level features at both the character level and the global semantic level during feature extraction, effectively improving the matching effectiveness of blacklist text for various text variations in this scenario. Specifically, the blacklist text features in the preset blacklist text feature library are obtained by performing feature extraction on the blacklist text using a Siamese network. Using this Siamese network to perform feature extraction on the text to be identified and performing comparison according to preset similarity conditions effectively improves the matching effectiveness of blacklist text. Attached Figure Description

[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1a This is one of the flowcharts illustrating a blacklist text matching method based on a twin network, as an embodiment of this application. Figure 1b This is a schematic diagram of the twin network structure of a blacklist text matching method based on twin networks, which is an embodiment of this application; Figure 2 This is a second schematic flowchart of an embodiment of the blacklist text matching method based on twin networks in this application; Figure 3 This is the third flowchart of an embodiment of the blacklist text matching method based on twin networks in this application; Figure 4 This is the fourth flowchart of an embodiment of the blacklist text matching method based on twin networks in this application; Figure 5 This is the fifth flowchart of an embodiment of the blacklist text matching method based on twin networks in this application; Figure 6 This is a schematic diagram of a blacklist text matching device based on a twin network, which is an embodiment of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application. The drawing numbers in this application are only used to distinguish the various steps in the solution and are not used to limit the execution order of the various steps. The specific execution order is subject to the description in the specification.

[0014] In the field of artificial intelligence, recurrent neural networks (RNNs) can be used to extract text features, and then match them against blacklisted texts to identify sensitive content. However, this approach focuses on semantic information extraction and is not sensitive enough to subtle character-level variations (such as spelling errors, homophones, and special symbols), making it difficult to handle the complex variation matching requirements in blacklist scenarios. Moreover, RNN structures have slow inference speeds, making it difficult to process millions of blacklisted data points in real-world scenarios. Furthermore, once the blacklisted texts are added, deleted, or modified, the above identification methods struggle to keep up efficiently.

[0015] To address the problems existing in related technologies, embodiments of this application provide a blacklist text matching method based on twin networks, such as... Figure 1a As shown, it includes: S11: Get the text to be matched.

[0016] In practical applications, the text to be matched can vary depending on the application scenario. For example, the text to be matched could be comments from online communities. If the amount of text to be matched is large, this step can divide the text into multiple parts to be matched, and then identify each part of the text sequentially or in parallel in subsequent steps.

[0017] S12: Local feature extraction is performed on the text to be matched using the convolutional neural network module of the Siamese network to obtain the local features of the text to be matched.

[0018] In this step, the text to be matched is input into the Siamese network, and a Convolutional Neural Network (CNN) is used to perform character-level local feature extraction on the text. For example, the text is treated as a character sequence according to the order of the characters, and word-level features are extracted by sliding the convolutional kernel across the character sequence.

[0019] By using CNNs to perform local feature extraction, robustness to fine-grained changes such as spelling distortions, character insertions or deletions can be enhanced, enabling feature extraction for local text areas.

[0020] S13: Global feature extraction is performed on the local features of the text to be matched through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched.

[0021] In this step, the local text features extracted by the CNN module are input into the multi-head self-attention module (Transformer) to model text dependencies globally based on context, thereby achieving global feature extraction based on contextual semantics.

[0022] Using a multi-head self-attention module, this step extracts global text features targeting contextual semantics based on the aforementioned character-level local features. The resulting global text features can be separated from both fine-grained character-level local features and contextual semantic global features.

[0023] Among them, character-level fine-grained local features can effectively match and recognize changes in pronunciation and shape, character insertion, or deletion in blacklist text matching applications. Contextual semantic global features can improve matching effectiveness from a semantic dimension, focusing on the meaning expressed by words to achieve effective matching and recognition.

[0024] S14: Determine blacklisted texts from the preset blacklisted text feature library that satisfy the preset similarity condition with the global features of the text to be matched, wherein the preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted text through the Siamese network.

[0025] In this step, a matching query is performed in a preset blacklist text feature library based on the global features of the text to be matched mentioned above. The multiple blacklist text features included in the preset blacklist text feature library are also obtained through feature extraction using the aforementioned Siamese network. Since both the text to be matched and the blacklist texts undergo feature extraction using a Siamese network, the two types of features can be reliably compared for similarity. The feature comparison results effectively characterize the similarity between texts, thereby identifying the blacklist texts that match the text to be matched.

[0026] Optionally, the preset blacklist text feature library can be pre-constructed. That is, feature extraction is performed on multiple blacklist texts using the aforementioned Siamese network, and the preset blacklist text feature library is constructed based on the features of multiple blacklist texts. Thus, in this step, the blacklist texts that meet the preset similarity conditions can be determined by directly reading and comparing the features of each blacklist text in the preset blacklist text feature library.

[0027] Alternatively, multiple blacklisted texts can be input into the Siamese network in parallel with the text to be matched, allowing both the text to be matched and the multiple blacklisted texts to undergo feature extraction in parallel through the Siamese network. The blacklisted text features output by the Siamese network for the blacklisted texts are stored in a preset blacklisted text feature library. During comparison, the network performs matching comparisons against each blacklisted text feature in the preset blacklisted text feature library based on the global features of the text to be matched, to determine the blacklisted texts that meet the preset similarity criteria.

[0028] The solution provided in this application addresses fuzzy matching scenarios for blacklisted text, balancing feature matching at both the global semantic level and the local character level. This solution utilizes a Siamese network CNN+Transformer structure to achieve both local and global feature extraction. First, a CNN is used to process the text to be matched, capturing local features and character-level changes. Then, the output of the CNN is used as the input to a Transformer, ensuring that the Transformer performs semantic analysis based on the extracted important local features, thus obtaining feature extraction that considers both local characters and global semantics.

[0029] The solution provided in this application can understand and handle complex variations (such as synonym replacements and widespread spelling errors), and automatically learns the criteria for judging relevance without requiring manual rule setting. Furthermore, because this solution uses a feature library to store blacklisted text features, it is highly efficient for identifying and matching the text to be matched.

[0030] In this embodiment, firstly, the text to be matched is obtained. Then, local feature extraction is performed on the text to be matched using the convolutional neural network module of the Siamese network to obtain local features of the text to be matched. The convolutional neural network module can perform character-level feature extraction, achieving feature extraction for local text areas. Next, global feature extraction is performed on the local features of the text to be matched using the multi-head self-attention module of the Siamese network to obtain global features of the text to be matched. The multi-head self-attention module can perform context-based global feature extraction, achieving global feature extraction based on the aforementioned local text features, so that the obtained global text features can simultaneously represent both local and global features. Finally, blacklisted texts that meet the preset similarity condition with the global features of the text to be matched are determined from a preset blacklisted text feature library. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted texts using the Siamese network. For fine-grained text variations such as spelling changes and character insertions in blacklist text matching applications, the solution provided in this application takes into account multi-level features at both the character level and the global semantic level during feature extraction, effectively improving the matching effectiveness of blacklist text for various text variations in this scenario. Specifically, the blacklist text features in the preset blacklist text feature library are obtained by performing feature extraction on the blacklist text using a Siamese network. Using this Siamese network to perform feature extraction on the text to be identified and performing comparison according to preset similarity conditions effectively improves the matching effectiveness of blacklist text.

[0031] Based on the solutions provided in the above embodiments, optionally, such as Figure 1b As shown, the Siamese network includes an input layer, an embedding layer, and a pooling normalization layer; The input of the embedding layer is connected to the output of the input layer, and the output of the embedding layer is connected to the input of the pooling normalization layer. The embedding layer includes the convolutional neural network module and the multi-head self-attention module, and the output of the convolutional neural network module is connected to the input of the multi-head self-attention module.

[0032] The following example illustrates the structural functions of the twin network in this scheme.

[0033] In the solution provided in this application embodiment, the twin network includes an input layer, an embedding layer, and a pooling normalization layer.

[0034] The input layer is used for text input, such as inputting the text to be matched, or inputting the text to be matched along with blacklisted text to be compared. The input layer can perform preprocessing steps such as standardization on the input text according to preset rules, achieving effects such as case unification and removal of special characters, ensuring that the text for feature extraction conforms to the preset format, and improving the effectiveness of feature extraction.

[0035] Subsequently, the processing results from the input layer are fed into the embedding layer to perform feature extraction, obtaining feature vectors corresponding to the text. The embedding layer includes a CNN module and a Transformer module.

[0036] The CNN module can specifically include 1D-CNN, which can be used to extract local n-gram features of text, i.e., n-gram grammatical features, thereby enhancing robustness to fine-grained changes such as spelling distortions, character insertions, or deletions. The parameters of this CNN module, such as the kernel size, number of layers, and activation function, can be adjusted according to the actual data.

[0037] The output of the CNN module is fed into the Transformer module, which uses a multi-head self-attention mechanism to model the global dependencies of the text and extract deep semantic features. The number of Transformer layers, hidden units, attention heads, and other parameters of this Transformer module can be set according to requirements.

[0038] Pooling and normalization are used to perform pooling (such as average pooling and max pooling) and normalization on the output of the Transformer module to obtain fixed-length text feature vectors.

[0039] Optionally, the CNN module employs a configurable multi-layer convolutional structure and introduces a channel attention mechanism before the output to enhance the model's selective attention to key local patterns. The Transformer module receives the CNN-weighted semantic representation as input and further captures cross-character dependencies through multi-head self-attention. The overall model uses a Siamese network structure with shared weights and is trained under the guidance of a contrastive loss function, offering the advantage of fast convergence.

[0040] The solution provided in this application adopts a serial Siamese network structure. After the CNN output is processed by convolution stacking and layer normalization, it is directly input into the Transformer module for global feature modeling. This ensures that the Transformer's self-attention mechanism can model global dependencies while utilizing the fine-grained spelling features extracted by the CNN as prior information, effectively enhancing the ability to capture complex deformations such as typos, character insertions or deletions, and homophones, thereby improving the matching effectiveness for blacklisted text.

[0041] The serial Siamese network structure proposed in this scheme offers several technical advantages over parallel structures. Parallel structures require multi-head attention to weight the outputs of multiple learners during fusion, leading to semantic drift and difficulties in stabilizing the fusion weights. This scheme achieves global modeling of local feature enhancement through a serial structure, eliminating the need for cross-network fusion weight learning and enabling the model to directly achieve semantic unification within the same embedding space. This mechanism reduces parameter redundancy and improves convergence speed and stability.

[0042] Based on the solutions provided in the above embodiments, optionally, such as Figure 2 As shown, in step S12 above, local feature extraction is performed on the text to be matched using the convolutional neural network module of the Siamese network to obtain local features of the text to be matched, including: S21: The n-gram grammar feature extraction is performed on the text to be matched through the convolutional neural network module of the Siamese network to obtain local features of the text to be matched containing n-gram grammar features.

[0043] The solution provided in this application uses an n-gram feature extraction method performed by a CNN module, which can effectively capture local continuous features of text and effectively preserve character-level word morphological change information in the text. Moreover, by using different n-gram windows, local feature extraction of different granularities can be achieved, providing high flexibility.

[0044] For fine-grained text variations such as spelling distortions and character insertions in blacklist text matching applications, the solution provided in this application uses n-gram feature extraction to achieve targeted character-level feature extraction, which can effectively improve the effectiveness of blacklist text matching for various text variations in this scenario.

[0045] Based on the solutions provided in the above embodiments, optionally, such as Figure 3 As shown, in step S13 above, global feature extraction is performed on the local features of the text to be matched through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched, including: S31: The n-gram syntax features of the text to be matched are weighted and aggregated based on contextual semantics through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched.

[0046] In the solution provided in this application embodiment, the Transformer module performs weighted aggregation based on n-gram features to achieve global enhancement of n-gram character-level features, and realizes global feature extraction of contextual semantics based on character-level features.

[0047] Specifically, the multi-head self-attention module can learn aggregation patterns of different granularities based on n-gram features by multiple heads, thereby achieving long-distance feature extraction at the sentence and paragraph levels based on character-level n-gram features, and realizing global feature extraction for contextual semantics.

[0048] Based on the solutions provided in the above embodiments, optionally, such as Figure 4 As shown, before step S14 above, that is, before determining the blacklisted texts from the preset blacklisted text feature library that satisfy the preset similarity condition with the global features of the text to be matched, the method further includes: S41: Get the preset blacklist text.

[0049] In this step, multiple preset blacklist texts can be obtained, which may include sensitive words and various expressions of those words. These preset blacklist texts can be manually set or generated based on historical sensitive information.

[0050] S42: Local feature extraction is performed on the preset blacklist text through the convolutional neural network module of the Siamese network to obtain the local features of the blacklist text.

[0051] In this step, character-level local feature extraction is performed on the preset blacklist text through the CNN module of the Siamese network. This step is executed in the same way as S12 in the above embodiment.

[0052] S43: Global feature extraction is performed on the local features of the blacklisted text through the multi-head self-attention module of the Siamese network to obtain the global features of the blacklisted text.

[0053] In this step, based on the local features of the blacklist text extracted by the CNN module, global feature extraction is performed by the Transformer module. This step is the same as the execution method of S13 in the above embodiment.

[0054] S44: Store the global features of the blacklisted text into a preset blacklisted text feature library with vector retrieval function.

[0055] In this step, the global features of the blacklisted text output by the Transformer module are stored in a high-performance database such as Redis using efficient vector retrieval libraries such as FAISS. This solution effectively stores multiple blacklisted text features through the blacklisted text feature library. Simultaneously, based on vector retrieval, it enables efficient vector matching and comparison of the global features of the text to be identified, thereby improving the efficiency of blacklisted text matching and supporting rapid retrieval and dynamic updating of feature vectors.

[0056] In the scheme provided in this application, FAISS and Siamese networks work together to effectively improve the matching efficiency of feature vectors. Specifically, during the training phase, this scheme uses feature normalization and a shared embedding space design to ensure that the feature vectors output by the Siamese network maintain distance stability within Euclidean space. This design means that, within the same embedding space, the normalized vectors output by the model can make the semantic distance and Euclidean distance approximately linearly correspond, avoiding matching bias caused by scale differences. This ensures that the similarity results retrieved by FAISS directly reflect semantic similarity, thereby achieving efficient matching of blacklisted texts.

[0057] Compared to classification-based applications, this solution combines the efficient indexing features of FAISS with the feature representation capabilities of Siamese networks, enabling millisecond-level fuzzy retrieval in a blacklist database of millions of entries, while maintaining high consistency in heterogeneous texts (such as pinyin, English abbreviations, and mixed simplified and traditional Chinese characters).

[0058] Based on the solutions provided in the above embodiments, optionally, such as Figure 5 As shown, in step S14 above, determining blacklisted texts from a preset blacklisted text feature library that satisfy a preset similarity condition with the global features of the text to be matched includes: S51: Based on the vector retrieval function, query the preset blacklist text feature library for blacklist texts that meet the preset similarity conditions with the global features of the text to be matched, wherein the preset similarity conditions include that the distance between the blacklist text features corresponding to the blacklist text and the global features of the text to be matched is less than a preset distance.

[0059] In this scheme, a distance metric is used to determine the similarity between features, specifically Euclidean distance, cosine similarity, etc.

[0060] The solution provided in this application uses vector retrieval to perform efficient vector query and comparison. In practical applications, for a text matching request initiated by a user, the request is parsed to obtain the text to be matched. Then, based on the vector retrieval function, blacklisted texts that meet the preset similarity conditions with the global features of the text to be matched are queried from a preset blacklisted text feature library. The distance between the features of the text to be matched and each blacklisted text feature is calculated, and blacklisted text features with a distance less than a preset Euclidean distance are identified to determine the blacklisted texts that meet the preset similarity conditions.

[0061] Among them, the similarity matching standard can be flexibly adjusted by adjusting the preset distance. According to actual business needs, after identifying blacklist texts that meet the preset similarity conditions, the corresponding automatic alarm and manual combination can be executed.

[0062] Optionally, to further improve the accuracy and recall of the search, this solution introduces a threshold-based dynamic search strategy (adaptive topology). K). In this embodiment of the application, the system can automatically adjust the number of candidate results returned based on the similarity distribution of the query results. Specifically, when high-confidence matches are concentrated, the number of returned results is reduced to decrease false positives, and when the similarity distribution is relatively flat, the recall range is expanded, thereby achieving an adaptive balance between the hit rate and the false positive rate.

[0063] The solution provided in this application embodiment achieves local and global semantic level fusion based on the Siamese network-based serial CNN-Transformer structure, improving the model's robustness to complex deformations such as character perturbations and homophones.

[0064] This scheme introduces feature normalization and shared embedding space mechanisms to make the vector space more concentrated, and the FAISS retrieval results are highly consistent with semantic similarity.

[0065] This solution uses a dynamic retrieval strategy to adaptively adjust the recall scope, thereby achieving a balance between hit rate and false positive rate.

[0066] In blacklist fuzzy matching tasks, the model's accuracy, recall, and computational efficiency are significantly better than traditional parallel structures, demonstrating high engineering practicality.

[0067] This solution achieves deep fusion of local features and global semantics through "CNN output cascaded Transformer" and "normalized vector retrieval + adaptive retrieval strategy", resulting in better technical performance in blacklist fuzzy matching tasks.

[0068] The vectors in this scheme are generated by Siamese network learning, combining local character features with global semantic representation, making them more suitable for high-noise scenarios such as name matching and entity recognition.

[0069] To address the problems existing in related technologies, embodiments of this application provide a blacklist text matching device 60 based on twin networks, such as... Figure 6 As shown, it includes: Get module 61, get the text to be matched; The local feature extraction module 62 performs local feature extraction on the text to be matched through the convolutional neural network module of the Siamese network to obtain the local features of the text to be matched; The global feature extraction module 63 performs global feature extraction on the local features of the text to be matched through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched; The determination module 64 determines blacklisted texts from a preset blacklisted text feature library that satisfy a preset similarity condition with the global features of the text to be matched. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by feature extraction of the preset blacklisted text through the twin network.

[0070] The apparatus provided in this application first acquires the text to be matched. Then, a convolutional neural network module of the Siamese network performs local feature extraction on the text to be matched, obtaining local features of the text. The convolutional neural network module can perform character-level feature extraction, achieving feature extraction for local text areas. Next, a multi-head self-attention module of the Siamese network performs global feature extraction on the local features of the text to be matched, obtaining global features of the text to be matched. The multi-head self-attention module can perform context-based global feature extraction, achieving global feature extraction based on the aforementioned local text features, enabling the obtained global text features to simultaneously represent both local and global features. Finally, blacklisted texts that meet a preset similarity condition with the global features of the text to be matched are determined from a preset blacklisted text feature library. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted texts using the Siamese network. For fine-grained text variations such as spelling changes and character insertions in blacklist text matching applications, the solution provided in this application takes into account multi-level features at both the character level and the global semantic level during feature extraction, effectively improving the matching effectiveness of blacklist text for various text variations in this scenario. Specifically, the blacklist text features in the preset blacklist text feature library are obtained by performing feature extraction on the blacklist text using a Siamese network. Using this Siamese network to perform feature extraction on the text to be identified and performing comparison according to preset similarity conditions effectively improves the matching effectiveness of blacklist text.

[0071] In this application, the modules in the apparatus provided can also implement the method steps provided in the method embodiments. Alternatively, the apparatus provided in this application may include other modules besides those described above to implement the method steps provided in the method embodiments. Furthermore, the apparatus provided in this application can achieve the technical effects achievable by the method embodiments.

[0072] Preferably, this application embodiment also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described embodiment of a blacklist text matching method based on twin networks and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0073] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described embodiment of a blacklist text matching method based on twin networks, and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0074] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. The computer program is operable to cause a computer to perform some or all of the steps of the above-described embodiment of a blacklist text matching method based on twin networks, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0075] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0076] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0077] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0078] These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0079] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0080] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0081] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0082] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0083] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0084] The above description is merely an embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of this application should be included within the scope of the claims of this application.

Claims

1. A blacklist text matching method based on a twin network, characterized in that, include: Get the text to be matched; The convolutional neural network module of the Siamese network is used to perform local feature extraction on the text to be matched, thereby obtaining the local features of the text to be matched; The multi-head self-attention module of the Siamese network performs global feature extraction on the local features of the text to be matched, thereby obtaining the global features of the text to be matched; The blacklist texts that satisfy the preset similarity condition with the global features of the text to be matched are determined from the preset blacklist text feature library. The preset blacklist text feature library includes multiple blacklist text features, and any one of the blacklist text features is obtained by performing feature extraction on the preset blacklist text through the Siamese network.

2. The method of claim 1, wherein, The convolutional neural network module of the Siamese network performs local feature extraction on the text to be matched, obtaining local features of the text to be matched, including: The convolutional neural network module of the Siamese network is used to extract n-gram grammatical features from the text to be matched, thereby obtaining local features of the text to be matched that contain n-gram grammatical features.

3. The method of claim 2, wherein, Global feature extraction is performed on the local features of the text to be matched using the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched, including: The multi-head self-attention module of the Siamese network performs weighted aggregation of the n-gram grammatical features of the text to be matched based on contextual semantics to obtain the global features of the text to be matched.

4. The method of claim 1, wherein, Before determining the blacklisted texts from the preset blacklisted text feature library that satisfy the preset similarity condition with the global features of the text to be matched, the process also includes: Retrieve the preset blacklist text; The convolutional neural network module of the Siamese network performs local feature extraction on the preset blacklist text to obtain the local features of the blacklist text; The global features of the blacklisted text are obtained by performing global feature extraction on the local features of the blacklisted text through the multi-head self-attention module of the Siamese network. The global features of the blacklisted text are stored in a preset blacklisted text feature library with vector retrieval function.

5. The method as described in claim 4, characterized in that, Determine blacklisted texts from a preset blacklisted text feature library that satisfy preset similarity conditions with the global features of the text to be matched, including: Based on the vector retrieval function, blacklist texts that meet the preset similarity conditions with the global features of the text to be matched are queried from the preset blacklist text feature library. The preset similarity conditions include that the distance between the blacklist text features corresponding to the blacklist text and the global features of the text to be matched is less than a preset distance.

6. The method according to any one of claims 1 to 5, characterized in that, The twin network includes an input layer, an embedding layer, and a pooling normalization layer; The input of the embedding layer is connected to the output of the input layer, and the output of the embedding layer is connected to the input of the pooling normalization layer. The embedding layer includes the convolutional neural network module and the multi-head self-attention module, and the output of the convolutional neural network module is connected to the input of the multi-head self-attention module.

7. A blacklist text matching device based on twin networks, characterized in that, include: The module retrieves the text to be matched. The local feature extraction module performs local feature extraction on the text to be matched through the convolutional neural network module of the Siamese network to obtain the local features of the text to be matched; The global feature extraction module performs global feature extraction on the local features of the text to be matched through the multi-head self-attention module of the Siamese network to obtain the global features of the text to be matched; The determination module determines blacklisted texts from a preset blacklisted text feature library that satisfy a preset similarity condition with the global features of the text to be matched. The preset blacklisted text feature library includes multiple blacklisted text features, and any one of the blacklisted text features is obtained by performing feature extraction on the preset blacklisted text through the twin network.

8. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform the steps of the method as described in any one of claims 1 to 6.