Sensitive word detection method and device, computer device and storage medium
By matching character sequences and sensitive word information in speech data and combining them with feature fusion of a sensitive word detection model, the problem of low accuracy in sensitive word detection in existing technologies is solved, and higher detection accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2022-08-11
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, the accuracy of sensitive word detection in speech recognition is low, especially in the presence of noise and multiple phonemes, making it difficult to accurately identify sensitive words in speech data.
By converting speech data into character sequences and matching them with N sensitive word information to form a set of sensitive word pairs, the data is input into a sensitive word detection model for feature fusion. The features of text characters and sensitive word information are combined to improve detection accuracy.
It enhances the recognition and boundary localization capabilities of the sensitive word detection model, improves the accuracy of sensitive word detection, and can more accurately identify sensitive words in speech data.
Smart Images

Figure CN116127001B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of speech recognition technology, and in particular to a sensitive word detection method, apparatus, computer device, and storage medium. Background Technology
[0002] Monitoring the service quality of customer service systems is a crucial component of business management. With the increasingly widespread application of internet information technology, intelligent voice quality inspection methods can be used to monitor voice data in customer service systems in real time, identifying any sensitive words that could negatively impact service quality during conversations with customers.
[0003] In related technologies, the text corresponding to the speech data is usually identified first, and then character matching is performed on the text corresponding to the speech data based on a pre-defined dictionary of sensitive words to determine whether the text contains sensitive words. However, in practice, it has been found that the accuracy of this sensitive word detection method is low due to the influence of noise in the speech data, matching methods, and other phonemes. Therefore, how to perform high-quality sensitive word detection on speech has become one of the key research issues in this field. Summary of the Invention
[0004] This application provides a sensitive word detection method, apparatus, computer device, and storage medium to overcome the technical problem of low accuracy in sensitive word detection during speech recognition in the prior art.
[0005] In a first aspect, embodiments of this application provide a sensitive word detection method, the method comprising:
[0006] Acquire the speech data to be detected;
[0007] The speech data is processed by speech-to-text recognition to determine the character sequence corresponding to the speech data, wherein the character sequence contains multiple text characters;
[0008] The character sequence is matched with N sensitive word information to determine the sensitive word pair set corresponding to the voice data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information; N is a positive integer.
[0009] The sensitive word pair set is input into the sensitive word detection model, and the detection result output by the sensitive word detection model is obtained. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information and output the detection result based on the fused features.
[0010] Based on the detection results, the sensitive word information included in the voice data to be detected is determined.
[0011] Secondly, embodiments of this application provide a sensitive word detection device, the device comprising:
[0012] Acquisition unit, used to acquire the speech data to be detected;
[0013] The recognition unit is used to perform speech-to-text recognition processing on the speech data and determine the character sequence corresponding to the speech data, wherein the character sequence contains multiple text characters.
[0014] A matching unit is used to match the character sequence with N sensitive word information to determine the sensitive word pair set corresponding to the voice data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information; N is a positive integer.
[0015] The detection unit is used to input the set of sensitive word pairs into the sensitive word detection model and obtain the detection result output by the sensitive word detection model. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information and output the detection result based on the fused features; and to determine the sensitive word information included in the speech data to be detected based on the detection result.
[0016] Thirdly, embodiments of this application provide a computer device, including: at least one processor and a memory;
[0017] The memory stores computer-executed instructions;
[0018] The at least one processor executes the computer execution instructions stored in the memory, causing the at least one processor to perform the sensitive word detection method designed as described in the first aspect above.
[0019] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the sensitive word detection method designed in the first aspect above.
[0020] Fifthly, embodiments of this application provide a computer program product, including computer instructions, which, when executed by a processor, implement the sensitive word detection method designed in the first aspect above.
[0021] By using the above-mentioned sensitive word detection method, the sensitive word detection model provided in this application integrates the features of text characters and the features of sensitive word information for vocabulary enhancement. This allows the sensitive word detection model to learn not only information at the text character level but also information at the vocabulary level. Based on information at multiple levels, the recognition ability and boundary localization ability of the sensitive word detection model can be enhanced, thereby improving the accuracy of sensitive word detection. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A schematic diagram illustrating the implementation environment of a sensitive word detection method provided in this application embodiment;
[0024] Figure 2 A flowchart illustrating a sensitive word detection method provided in an embodiment of this application;
[0025] Figure 3 A schematic diagram illustrating feature fusion as provided in an embodiment of this application;
[0026] Figure 4 This is a schematic diagram illustrating a process for sensitive word detection using a sensitive word detection model, provided as an embodiment of this application.
[0027] Figure 5 This is a schematic diagram of the structure of a sensitive word detection model provided in an embodiment of this application;
[0028] Figure 6 A structural block diagram of a sensitive word detection device provided in an embodiment of this application;
[0029] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0030] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0031] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0032] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0033] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0034] Monitoring the service quality of customer service systems is a crucial component of business management. With the increasingly widespread application of internet information technology, intelligent voice quality inspection methods are commonly used to monitor voice data in customer service systems in real time, identifying sensitive words that could negatively impact service quality during customer calls. Two commonly used sensitive word detection methods are as follows:
[0035] In the first approach, the text corresponding to the speech data is typically identified first. Then, based on a pre-defined dictionary of sensitive words, character matching is performed on the corresponding text to determine whether it contains sensitive words. Sensitive word detection using this method is simple, easy to maintain, requires no large amount of labeled data, and has good scalability.
[0036] However, the first method of sensitive word detection typically lacks generalization ability. For example, if a pre-defined dictionary of sensitive words includes the phrase "give a bad review," then during the sensitive word detection process, the intelligent detection system often fails to effectively identify similar phrases like "click to give a bad review," resulting in a low recognition rate for these sensitive words. Furthermore, the aforementioned sensitive word detection methods also struggle with semantic understanding of context. For instance, a sensitive word in the pre-defined dictionary might be considered abusive in isolation, but within a specific sentence or context, it could simply be a qualifier rather than an abusive term, potentially leading to misidentification during the sensitive word recognition process.
[0037] In the second approach, a sensitive word detection model can be built based on deep learning. For example, a Bi-directional Long Short-Term Memory (Bi-LSTM) model and a Conditional Random Field (CRF) model can be used to construct the sensitive word detection model. The input of this sensitive word detection model is word vectors. The model extracts text features and finally uses a classification layer to obtain entity information, which is used to identify sensitive words.
[0038] However, the second method of sensitive word detection, relying solely on deep learning, still cannot effectively understand text based on context or intent. For example, both "If you don't pay me back, I'll file a complaint against you" and "Hello sir, our complaint hotline is 12315" contain the sensitive word "complaint," but the "complaint" in the first sentence aligns with the intent of sensitive word detection. Therefore, the accuracy of the second method of sensitive word detection remains relatively low.
[0039] To address the aforementioned issues, this application provides a sensitive word detection method. Specifically, the method first matches the character sequence corresponding to the speech data with N sensitive word information entries to obtain a set of sensitive word pairs corresponding to the speech data. Further, this set of sensitive word pairs is input into a sensitive word detection model for detection. The sensitive word detection model fuses the features of the text characters in each word pair with the features of the sensitive word information and outputs the detection result based on the fused features. Because the sensitive word detection model provided in this application fuses the features of text characters and the features of sensitive word information for vocabulary enhancement, it can learn not only information at the text character level but also information at the word level. Based on information at multiple levels, the model's recognition and boundary localization capabilities are enhanced, thereby improving the accuracy of sensitive word detection.
[0040] The following describes the application scenarios of the sensitive word detection method provided in this disclosure.
[0041] In some embodiments, the sensitive word detection method provided in this application can be applied to the quality monitoring of a customer service system. After a customer service representative completes communication with a customer through the customer service system, voice data from the call can be collected, and the sensitive word detection method provided in this application can be used to detect whether sensitive words appear in the voice data, thereby evaluating the quality of customer service based on the detected sensitive words.
[0042] In other embodiments, the sensitive word detection method provided in this application can also be applied to live streaming monitoring scenarios. When a broadcaster is live streaming, the voice data during the live stream can be acquired, and the sensitive word detection method can be used to detect whether sensitive words appear in the voice data. When sensitive words are detected, measures such as warnings, traffic limiting, and shutdown can be implemented to ensure the quality of the live stream.
[0043] It should be noted that the above two application scenarios do not constitute a limitation on this application. The sensitive word detection method provided in this application can be applied to any scenario where sensitive word detection is performed.
[0044] Figure 1 This is a schematic diagram illustrating the implementation environment of a sensitive word detection method provided in an embodiment of this application. For example... Figure 1 As shown, the implementation environment of this sensitive word detection method may include computer device 101, or computer device 101 and server 102. Computer device 101 can be connected to server 102 via a wireless or wired network.
[0045] When sensitive word detection is required, computer device 101 can collect voice data input by the user. Then, computer device 101 can process the voice data using the sensitive word detection method described above to determine whether the voice data contains sensitive words. Alternatively, computer device 101 can interact with server 102, which can then process the voice data using the sensitive word detection method described above to determine whether the voice data contains sensitive words. The sensitive word recognition result is then returned to computer device 101.
[0046] The computer device 101 can be a tablet computer, a computer with wireless transceiver capabilities, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in a smart home, etc. In this embodiment, the device for implementing the terminal's functions can be the terminal itself, or a device capable of supporting the terminal in implementing those functions, such as a chip system, which can be installed in the terminal. In this embodiment, the chip system can consist of chips, or it can include chips and other discrete components.
[0047] Server 102 can be, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of computers or network servers. Among them, cloud computing is a type of distributed computing, which is a super virtual computer composed of a group of loosely coupled computers.
[0048] It is understood that the above-mentioned sensitive word detection method can be implemented by the computer equipment provided in the embodiments of this application. The computer equipment can be part or all of a certain device, such as the above-mentioned terminal device or server.
[0049] The technical solutions of the embodiments of this application will be described in detail below with specific examples. The following specific examples can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0050] refer to Figure 2 , Figure 2 This is a flowchart illustrating a sensitive word detection method provided in this application embodiment. The execution subject of this embodiment is a computer device, and this embodiment relates to the process of sensitive word detection. The sensitive word detection method includes the following steps:
[0051] S201: Acquire the speech data to be detected.
[0052] It should be understood that the embodiments of this application do not limit the source of voice data, and the source of voice data varies in different application scenarios. In some embodiments, voice data may come from terminal devices, such as recordings of users communicating with service personnel; or, voice data may be call data generated when users talk to service personnel through terminal devices.
[0053] In other embodiments, the voice data may come from a server. For example, the server of a customer service system stores voice data generated by users interacting with customers through the customer service system, and the voice data in the customer service system server can be obtained. Similarly, the server of a live streaming application system stores a lot of voice data generated during the live streaming process, and the voice data obtained in step S201 may also be from the server of the live streaming application system.
[0054] It should be understood that the sensitive words involved in the embodiments of this application can be words or phrases that violate preset rules. The preset rules can be set according to business needs. For example, in a service scenario, "complaint" can be set as a sensitive word; or, the preset rules can also be social rules, such as setting words with abusive connotations as sensitive words.
[0055] S202: Perform speech-to-text recognition processing on the speech data to determine the character sequence corresponding to the speech data. The character sequence contains multiple text characters.
[0056] It should be noted that the speech-to-text recognition processing method is not limited in the embodiments of this application. Any automatic speech recognition (ASR) technology can be used, such as a hidden Markov model (HMM) or an end-to-end speech recognition based on a deep neural network.
[0057] The aforementioned character sequence can be a sequence of text characters contained in the speech data. In some embodiments, the text characters recognized from the speech data can be divided according to speech segments. If the pause duration of speech at each time point in the speech data exceeds a preset duration, or if the speaker's role changes, the text character sequence can be divided into different speech segments before and after that time point. In other embodiments, the text characters can also be divided into different character sequences based on the contextual understanding between the text characters corresponding to the speech data.
[0058] For example, if the text characters corresponding to the voice data could include "I want to ask a question about A. Hello, the answer to A's question is B," it can be divided into two text segments: "I want to ask a question about A" and "Hello, the answer to A's question is B." Accordingly, the above two text characters can be divided into two different character sequences.
[0059] By dividing the text characters of different text segments into different character sequences, sensitive word detection can be performed based on the character sequences, reducing the amount of input required for sensitive word detection and improving the detection speed.
[0060] In some embodiments, the character sequence corresponding to the speech data refers to any one of at least one target character sequence corresponding to the speech data, which is selected from a plurality of character sequences corresponding to the speech data. Accordingly, the computer device can first determine the length of the text characters included in each of the plurality of character sequences corresponding to the speech data. Then, the computer device can determine at least one character sequence whose text character length is greater than a length threshold as at least one candidate character sequence. Finally, the computer device can select at least one target character sequence from the at least one candidate character sequence.
[0061] In this embodiment, the length threshold is not limited; for example, it can be set to two characters, five characters, etc. That is, character sequences whose length exceeds the length threshold can be considered candidate character sequences, while other character sequences can be considered invalid sequences. Invalid sequences require further processing.
[0062] It should be understood that the embodiments of this application do not limit how at least one target character sequence is selected from at least one candidate character sequence. In some embodiments, the roles corresponding to each candidate character sequence can be traversed sequentially, and two adjacent candidate character sequences with the same role can be merged. Finally, the merged candidate character sequence is determined as at least one target character sequence.
[0063] For example, the identification of the role corresponding to the above candidate character sequence can be determined by the timbre of the role in the speech segment corresponding to the candidate character sequence. Roles with the same timbre can be identified as the same role.
[0064] By merging two adjacent text paragraphs with the same character, errors caused by Voice Activity Detection (VAD) can be reduced, and the phenomenon of the same keyword appearing in different character sequences due to pauses can be reduced, thus ensuring semantic coherence.
[0065] S203: Match the character sequence with N sensitive word information to determine the sensitive word pair set corresponding to the speech data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information.
[0066] In this application, after the computer device determines the character sequence corresponding to the voice data, it can match the character sequence with N sensitive word information respectively, thereby determining the set of sensitive word pairs corresponding to the voice data. Here, N is an integer greater than or equal to 1.
[0067] It should be understood that sensitive word information refers to information related to sensitive words. For example, sensitive word information may include a sensitive word itself, as well as the pinyin corresponding to that sensitive word. This application does not limit the type of sensitive words. In some embodiments, sensitive words may include abusive words, business-related words (e.g., complaints), and words that violate relevant regulations.
[0068] In some embodiments, the aforementioned sensitive word information can be stored in a corresponding database and updated in real time according to user instructions. Since some sensitive words are related to business scenarios and contextual information, the sensitive words stored in the database can also be assigned corresponding weights, which are used to characterize the degree of ambiguity of the sensitive word.
[0069] For example, sensitive words with a high probability of ambiguity can be assigned a larger weight, such as 1. Sensitive words with a moderate probability of ambiguity can be assigned a medium weight, such as 0.5. Sensitive words with a low probability of ambiguity can be assigned a smaller weight, such as 0.25.
[0070] It should be noted that the sensitive words in the above database can be stored in the form of a dictionary, and the above dictionary can include a text dictionary and a pinyin dictionary, so that sensitive word detection can be performed from two dimensions of text and pinyin.
[0071] In some embodiments, in the database, a sensitive word information includes a first type of information and a second type of information. The first type of information included in any sensitive word information is used to represent the text corresponding to any sensitive word, and the second type of information included in any sensitive word information is used to represent the pinyin corresponding to any sensitive word.
[0072] Exemplarily, the above sensitive word information can be in the form of a vector. Correspondingly, the first type of information included in the sensitive word information can be a first vector representing the text corresponding to the sensitive word, and the second type of information included in the sensitive word information can be a second vector representing the pinyin corresponding to the sensitive word.
[0073] It should be understood that the embodiments of the present application do not limit the implementation manner of how to determine the sensitive word information. In some embodiments, the computer device can first obtain M sensitive word information to be matched from the database. Subsequently, the computer device can determine the association degree between the scene information corresponding to the voice data and the M sensitive word information to be matched, and then determine the invalid sensitive word information in the M sensitive word information to be matched according to the association degree. Finally, the computer device filters out the invalid sensitive word information from the M sensitive word information to obtain N sensitive word information. Among them, both N and M are positive integers, and M is greater than N.
[0074] It should be noted that the sensitive words involved in the present application can be specially marked words that need attention. The sensitive word information involved in the present application can correspond to the sensitive words and can be one or more representation methods of the corresponding sensitive words. In other words, the sensitive word information refers to the information used to represent the sensitive words. For example, for a sensitive word "complaint", it is represented as "complaint" in text form; it can also be represented as "tousu" in pinyin form. Of course, the embodiments of the present application only list two possible representation methods. In practical applications, other representation methods can also be used, such as using the translation results of "complaint" in English, French, etc. as a kind of sensitive word information.
[0075] In some implementation manners, each sensitive word information can include the first type of information and the second type of information of the sensitive word corresponding to the sensitive word information. The first type is used to represent the text corresponding to any sensitive word, and the second type of information is used to represent the pinyin corresponding to the any sensitive word. Exemplarily, the first type of information can be a text vector corresponding to the sensitive word, and the second type of information can be a pinyin vector corresponding to the sensitive word.
[0076] Contextual information can be used to filter out contextually relevant sensitive words from the contextual information. For example, if the contextual information is a customer service context, then the contextual information can be used to filter out the sensitive word "complaint" which is relevant to the customer service context, while discarding other sensitive words that are irrelevant to the customer service context.
[0077] It should be understood that the correlation between the aforementioned scenario information and the sensitive words to be matched can be pre-set in the database. For example, sensitive word A can be set to different sensitive words for different scenarios. For the customer service scenario, the correlation of sensitive word A can be set to 0.7. For the live streaming scenario, the correlation of sensitive word A can be set to 0.4. Accordingly, if the correlation threshold is set to 0.5, then sensitive word A is a valid sensitive word in the customer service scenario, and an invalid sensitive word in the live streaming scenario.
[0078] Since a sensitive word in the database can include a first type of information and a second type of information to represent the text and pinyin corresponding to the sensitive word, respectively, the sensitive word pair vocabulary set can also include a subset of pinyin-based vocabulary pairs and a subset of text-based vocabulary pairs. A pinyin-based vocabulary pair in the pinyin-based subset includes a matching text character corresponding to a pinyin character and a second type of information; a text-based vocabulary pair in the text-based subset includes a matching text character and a first type of information.
[0079] Specifically, the number of first-type information matching a single text character is at least one, meaning that a single text character can be matched with the text corresponding to multiple sensitive words. Similarly, the number of second-type information matching the pinyin corresponding to a single text character is at least one, meaning that the pinyin corresponding to a single text character can be matched with the pinyin corresponding to multiple sensitive words.
[0080] For example, taking a subset of text-based word pairs as an example, if the text characters contained in the character sequence are "If you don't pay back the money, I'll file a complaint against you", the first type of sensitive word information includes "go to complain, complain about you, complain". When performing sensitive word matching, the eight text characters in the character sequence can be matched with the first type of sensitive word information respectively. Accordingly, the resulting text-based word pairs can include: (go, go to complain), (submit, go to complain), (submit, complain about you), (submit, complain), (complain, go to complain), (complain, complain about you), (complain, complain) and (you, complain about you).
[0081] For example, for a character sequence S c ={c1,c2,…,c n}, where S c A character sequence used to represent text characters, c1, c2, ..., c nThis refers to text characters within a character sequence. Using the first type of sensitive word information, S can be matched. c Any possible text-type word pair is then assigned to a subset of text-type word pairs, as shown in Formula (1).
[0082] S cw ={(c1,ws1),(c2,ws2),…,(c n ,ws n )} (1)
[0083] Among them, S cw For text-based word pairs, c n ws is the nth text character in the character sequence. n For characters containing the text character C n The first type of information is sensitive word information.
[0084] Correspondingly, taking a subset of pinyin-based word pairs as an example, sensitive word matching can also be performed by using the pinyin characters corresponding to the text characters in the character sequence. Sensitive words that contain the pinyin characters corresponding to any text character in the character sequence can be identified, and the pinyin characters and the sensitive words containing the pinyin characters can be combined into word pairs.
[0085] For example, if the pinyin sequence composed of the text characters in the character sequence is “zai buhuan qian jiu qu tou su ni”, the second type of sensitive word information includes “qu tou su,tou su,tousu ni”. When performing sensitive word matching, the above eight pinyin characters can be matched with the second type of sensitive word information respectively. Accordingly, the resulting pinyin word pairs may include: (qu, qu tou su), (tou, tou su ni), (tou, qu tou su), (tou, tou su), (su, qu tou su), (su, tou su ni), (su, tou su) and (ni, tou su ni).
[0086] For example, the sequence of pinyin characters corresponding to the text characters in the character sequence is S. p ={p1,p2,…,p n}, where S p Used to represent the pinyin sequence composed of pinyin characters, p1, p2, ..., p n These are Pinyin characters. Using the second type of information from sensitive words, S can be matched. p Any possible pinyin word pair is then assigned to a pinyin word pair subset, as shown in Formula (2).
[0087] S pw ={(p1,wp1),(p2,wp2),…,(p n ,wp n (2)
[0088] Among them, S pw For a subset of phonetic word pairs, p n For the nth pinyin character, wp n For characters containing the pinyin character p n The second type of information is sensitive word information.
[0089] It should be noted that the aforementioned subsets of pinyin-based vocabulary pairs and subsets of text-based vocabulary pairs constitute the sensitive word pair vocabulary set.
[0090] In this application, a set of sensitive word pairs corresponding to the speech data is determined by identifying sensitive word information that matches each text character in the character sequence. Since the determined set of sensitive word pairs contains possible sensitive words for each text character in the character sequence, the detection results are more comprehensive and accurate when the sensitive word pair set is subsequently used for sensitive word detection.
[0091] S204: Input the set of sensitive word pairs into the sensitive word detection model and obtain the detection results output by the sensitive word detection model. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information, and output the detection results based on the fused features.
[0092] In this application, once the server determines the set of sensitive word pairs, it can input the set of sensitive word pairs into the sensitive word detection model and obtain the detection results output by the sensitive word detection model.
[0093] It should be understood that the embodiments of this application do not limit the sensitive word detection model. In some embodiments, the sensitive word detection model includes a first fusion layer, a second fusion layer, and a classification layer. The first fusion layer is connected to the second fusion layer, and the second fusion layer is connected to the classification layer. For example, the first fusion layer can be a pre-trained Bidirectional Encoder Representation from Transformers (BERT) algorithm layer, and the second fusion layer can be a model-level algorithm layer.
[0094] The first fusion layer is used to fuse multiple first-class information matching each text character to obtain the first word feature of each text character, and to fuse multiple second-class information matching the pinyin corresponding to each text character to obtain the second word feature corresponding to each text character; and to combine the first word feature, the second word feature, and the feature of each text character to obtain the first latent vector feature of each text character.
[0095] For example, Figure 3 This is a schematic diagram illustrating feature fusion as provided in an embodiment of this application. Figure 3 As shown, the first fusion layer may include a BERT module, a text embedding module, and a pinyin embedding module.
[0096] The text embedding module is used to extract and fuse each text character C1-C in the character sequence. n The corresponding first type of information WS1-WS n The first word feature is obtained. The pinyin embedding module is used to extract and fuse each text character C1-C in the character sequence. n The corresponding second type of information PS1-PS n Thus, the second word feature was obtained.
[0097] The BERT module consists of the BERT embedding structure and an L-layer Transformer structure. The BERT embedding structure is used to extract features from text characters in a character sequence, and the K-layer Transformer structure outputs each text character C1-C1. n The characteristics are as follows: L and K are integers greater than zero, and L is greater than K.
[0098] After completing feature extraction, continue to refer to Figure 3 Based on the attention mechanism, the first word feature, the second word feature, and the feature of each text character can be combined, and then transformed by the remaining LK layer Transformer structure to output the first latent vector feature of each text character in the character sequence.
[0099] The second fusion layer is used to fuse the first latent vector feature of each text character with the target vector corresponding to each text character to obtain the second latent vector feature of each text character; the target vector corresponding to each text character is determined based on the longest first-class information among multiple first-class information that matches each text character.
[0100] The classification layer is used to determine the classification information corresponding to each text character based on the second latent vector feature of each text character, and to determine the detection result based on the classification information corresponding to each text character.
[0101] In some embodiments, the plurality of text characters includes a target text character. The first fusion layer is specifically configured to first determine the target text character, the first similarity data between each of the plurality of first-class information matching the target text character, the pinyin corresponding to the target text character, and the second similarity data between each of the plurality of second-class information matching the pinyin corresponding to the target text character. Secondly, based on the first similarity data between the target text character and each of the first-class information, the plurality of first-class information matching the target text character is weighted and fused to determine the first word feature of the target text character. Thirdly, based on the second similarity data between the target text character and each of the second-class information, the plurality of second-class information matching the target text character is weighted and fused to determine the second word feature of the target text character. Finally, the first word feature, the second word feature, and the feature of the target text character are combined to form the first latent vector feature of the target text character.
[0102] It should be noted that, in the embodiments of this application, any text character in the character sequence corresponding to the voice data can be the target text character.
[0103] It should be understood that the embodiments of this application do not limit how the first similarity data and the second similarity data are calculated. In some embodiments, they can be calculated using a bilinear transformation matrix.
[0104] It should be understood that the embodiments of this application do not limit how the first word feature and the second word feature are fused. In some embodiments, the first similarity data and the second similarity data can be used as weights, and the first word feature and the second word feature can be obtained by weighted summation.
[0105] It should be understood that the embodiments of this application do not limit how the first latent vector feature is composed. It can be obtained by adding the first word feature of the target text character, the second word feature of the target text character, and the feature of the target text character.
[0106] In some embodiments, the second fusion layer described above may first determine the target vector corresponding to the target text character based on the longest first-class information among multiple first-class information matching the target text character. Then, the weights of the target vectors corresponding to the target text characters are obtained, and these weights characterize the degree of ambiguity of the target vectors. Finally, based on the weights of the target vectors corresponding to the target text characters, the target vectors corresponding to the target text characters and the first latent vector features corresponding to the target text characters are fused to obtain the second latent vector features corresponding to the target text characters.
[0107] It should be understood that the weights of the target vectors involved in the embodiments of this application can be determined by querying a database.
[0108] It should be understood that the embodiments of this application do not limit how the second latent vector feature is determined. In some embodiments, the second latent vector feature can be obtained by multiplying the target vector by the weight and then adding the first latent vector feature.
[0109] In some embodiments, the classification layer described above is specifically used to input the second latent vector features of the target text character into a normalized exponential function for classification probability mapping, and to use the classification probabilities of different sensitive words output by the normalized exponential function as the classification information corresponding to the target text character.
[0110] The aforementioned classification probabilities may include the probability of sensitive words belonging to the target text character and / or the probability of sensitive words not belonging to the target text character.
[0111] It should be noted that the embodiments of this application do not limit the structure of the sensitive word detection model. In some embodiments, it can be a Transformer structure. Transformers have stronger contextual understanding and semantic feature extraction capabilities, thereby further improving the accuracy of sensitive word detection.
[0112] S205: Determine the sensitive word information included in the speech data to be detected based on the detection results.
[0113] The detection results may include classification information for each text character in the character sequence corresponding to the speech data. Specifically, the classification information for each text character includes the probability that each text character belongs to each of the N sensitive word information categories. This classification probability may include the probability of belonging to the sensitive word information corresponding to the text character, or the probability of not belonging to the sensitive word information corresponding to the text character. It should be understood that this application embodiment does not limit how the sensitive word information included in the speech data to be detected is determined based on the detection results.
[0114] In some embodiments, determining the sensitive word information included in the voice data to be detected based on the detection results may specifically include: determining the sensitive word information that matches each text character based on the classification probability of each text character in the character sequence corresponding to the voice data belonging to each of the N sensitive word information; and determining the sensitive word information that matches each text character as the sensitive word information included in the voice data.
[0115] As an optional implementation, a preset classification probability threshold can be established. If the classification probability is the probability of including sensitive word information corresponding to a text character, then in the specific implementation, for each text character, sensitive word information with a classification probability greater than the classification probability threshold is determined to match that text character. For example, the text character sequence includes text character 1 and text character 2, and N sensitive word information includes sensitive word information 1 and sensitive word information 2. The classification information of text character 1 includes a classification probability 11 of text character 1 belonging to sensitive word information 1 and a classification probability 12 of text character 1 belonging to sensitive word information 2; the classification information of text character 2 includes a classification probability 21 of text character 2 belonging to sensitive word information 1 and a classification probability 22 of text character 2 belonging to sensitive word information 2. Assuming that classification probabilities 12 and 21 are greater than the classification probability threshold, sensitive word information 2 can be determined as a sensitive word matching text character 1, and sensitive word information 1 can be determined as a sensitive word matching text character 2. Furthermore, both sensitive word information 1 and sensitive word information 2 are considered as sensitive word information contained in the voice data.
[0116] As another optional implementation, if the classification probability is the probability of including sensitive word information corresponding to text characters, then sensitive word information with a classification probability less than the classification probability threshold can be determined as sensitive word information corresponding to each character.
[0117] It should be understood that the classification probability threshold values in the embodiments of this application are not limited and can be determined based on the recognition accuracy of sensitive words. For example, the classification probability threshold can be 0.4, 0.5, 0.6, etc.
[0118] The sensitive word detection model provided in this application enhances vocabulary by fusing features from multiple dimensions. Compared to a single character-based sensitive word recognition model, the sensitive word recognition model in this application learns more vocabulary-level information in addition to characters, which helps to enhance the detection capability and boundary localization capability of the sensitive word detection model.
[0119] Furthermore, by incorporating Pinyin features, the number of features in the model is increased, allowing the sensitive word detection model to learn more information. This also effectively alleviates the problems caused by ASR sensitive word recognition errors and improves the fault tolerance of the ASR engine.
[0120] The sensitive word detection method provided in this application first acquires the speech data to be detected and performs speech-to-text recognition processing on the speech data to determine the character sequence corresponding to the speech data, which contains multiple text characters. Second, the character sequence is matched with N sensitive word information to determine the sensitive word pair set corresponding to the speech data. Third, the sensitive word pair set is input into a sensitive word detection model, and the detection result output by the sensitive word detection model is obtained. This sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information. Finally, the sensitive word information included in the speech data to be detected is determined based on the detection result. Through the above sensitive word detection method, since the sensitive word detection model provided in this application fuses the features of text characters and the features of sensitive word information for vocabulary enhancement, the sensitive word detection model can learn not only information at the text character level but also information at the word level. Based on information at multiple levels, the recognition ability and boundary localization ability of the sensitive word detection model can be enhanced, thereby improving the accuracy of sensitive word detection.
[0121] Based on the above embodiments, the following section uses a target text character among multiple text characters as an example to specifically introduce the detection process of the sensitive word detection model. Figure 4 This is a schematic diagram illustrating a process for sensitive word detection using a sensitive word detection model, provided as an embodiment of this application. Figure 5 This is a schematic diagram of the structure of a sensitive word detection model provided in an embodiment of this application, as shown below. Figure 4 and Figure 5 As shown, it includes:
[0122] S301: Determine the target text character, the first similarity data between each of the multiple first-class information that matches the target text character, and the second similarity data between each of the multiple second-class information that matches the pinyin corresponding to the target text character.
[0123] It should be understood that the information in the first fusion layer of the input sensitive word detection model can include the target text characters and their corresponding pinyin. That is, the character sequence S cw Any text character in the text can be used as the target text character input to the sensitive word detection model, and the corresponding pinyin sequence S of the character sequence is... pw Any pinyin character in the text can also be the first fusion layer of the sensitive word detection model corresponding to the pinyin input of the target text character.
[0124] For example, S cw and S pw The token for the character at position i can be respectively and The text character at position i can be used as the target text character. It can be a feature of the i-th text character. Let i be the set of the first type of sensitive word information corresponding to the character at position i. This is the set of second-class information for sensitive word information corresponding to the character at position i.
[0125] in, It can be as shown in formula (3). It can be as shown in formula (4).
[0126]
[0127]
[0128] in, This refers to the first type of information corresponding to the m-th sensitive word information of the text character at position i. This is the second type of information corresponding to the m-th sensitive word information of the text character at position i.
[0129] It should be understood that if sensitive word information can be sensitive word vectors, then the first type of information and the second type of information can be in the form of vectors, that is, a first vector representing the text corresponding to the sensitive word and a second vector representing the pinyin corresponding to the sensitive word.
[0130] It should be noted that, in this application, before determining the first similarity data and the second similarity data, the features of the target text characters and the first and second vectors matching the target text characters can be dimensionally aligned respectively. This application does not limit the alignment method; in some embodiments, a non-linear transformation method can be used for alignment.
[0131] For example, dimensional alignment can be performed using formula (5).
[0132]
[0133] Where K can be w or p, that is, It can be The first vector in or The second vector in. d c d represents the feature dimension of the target text character. w Let b1 be the dimension of the first or second vector, and b2 be the bias coefficients.
[0134] If the target text character is the text character at the i-th position in the character sequence, then the set of the first or second vector after dimensional transformation is as shown in formula (6):
[0135]
[0136] Among them, V i Let K be the set of the first or second vector after the dimensional transformation at the i-th position. K can be w or p, that is, the set of the first vector or the set of the second vector. Let d be the m-th vector in the set at position i. c The feature dimension of the target text character.
[0137] It should be understood that the embodiments of this application do not limit how the first similarity data and the second similarity data are determined. In some embodiments, a method can be used... For the search vector, the set V of its corresponding first or second vector. i To obtain the value, if the target text character is the text character at the i-th position in the character sequence, the first similarity data and the second similarity data are calculated using the bilinear transformation matrix as shown in formula (6):
[0138]
[0139] Where, α i This represents either the first or second similarity data for the i-th position. V is the feature of the i-th text character. i It is the set of the first or second vector after the transformation of the i-th position dimension.
[0140] S302: Based on the first similarity data between the target text character and each type of information, multiple types of information that match the target text character are weighted and fused to determine the first word feature of the target text character.
[0141] It should be understood that the embodiments of this application do not limit how to perform weighted fusion to determine the first word feature. For example, the first word feature can be determined by formula (8).
[0142]
[0143] Among them, the text character at position i can be used as the target text character. The first word feature at the i-th position, For the j-th information of the first type at the i-th position, the first similarity data is... This represents the j-th type of information after the i-th position dimension transformation.
[0144] S303: Based on the second similarity data between the target text character and each second type of information, multiple second type of information that match the target text character are weighted and fused to determine the second word feature of the target text character.
[0145] It should be understood that the embodiments of this application do not limit how the second word feature is weighted and fused. For example, the second word feature can be determined by formula (9).
[0146]
[0147] Among them, the text character at position i can be used as the target text character. The second word feature at position i, For the second similarity data of the j-th second type of information at the i-th position, This represents the j-th type of second-class information after the i-th position dimension transformation.
[0148] S304: Combine the first word feature, the second word feature, and the feature of the target text character into the first latent vector feature of the target text character.
[0149] It should be understood that the embodiments of this application do not limit how the first latent vector feature is determined. In some embodiments, it can be determined by adding the features of the first word, the second word, and the text character.
[0150] For example, the method for determining the first latent vector feature is shown in formula (9):
[0151]
[0152] Among them, the text character at position i can be used as the target text character. The first latent vector feature, The feature of the i-th text character, The first word feature at the i-th position, The second word feature is at the i-th position.
[0153] S305: Based on the first type of information matching the target text character, the target vector corresponding to the target text character is determined by the first type of information with the longest length.
[0154] In this step, after the second fusion layer receives the first hidden vector feature sent by the first fusion layer, it can determine the target vector w with the longest length from multiple first-class information that matches the target text characters.
[0155] S306: Obtain the weight of the target vector corresponding to the target text character. The weight of the target vector is used to characterize the degree of ambiguity of the target vector.
[0156] It should be understood that the embodiments of this application do not limit the weight of the target vector corresponding to the target text characters. In some embodiments, different weights can be set in advance for each sensitive word information in the database. Based on the correspondence between sensitive word information and target vector, the weight of the target vector can be obtained based on the database.
[0157] S307: Based on the weight of the target vector corresponding to the target text character, fuse the target vector corresponding to the target text character and the first latent vector feature corresponding to the target text character to obtain the second latent vector feature corresponding to the target text character.
[0158] For example, suppose the input character sequence is S c After feature extraction by the first fusion layer, the sequence of the first latent vector is obtained as H = {h1, h2, h3, ..., hn}, where the matched target vector w is [ck, ck+l] with a length of l. Then, the second latent vector feature corresponding to the text character is obtained by vector weighted summation, as shown in formula (10).
[0159] h′ i =hi+a*w (10)
[0160] Where the text character at position i can be used as the target text character, k <= i <= k + m, h′ i Let be the second latent vector at position i, hi be the first latent vector at position i, a be the weight of the target vector, and w be the target vector.
[0161] Subsequently, the second implicit vectors of each text character can be combined into a second implicit vector sequence H = {h′1, h′2, h′3, ..., h′}. n}
[0162] S308: Input the second latent vector features of the target text character into the normalized exponential function for classification probability mapping, and use the classification probabilities of different sensitive words output by the normalized exponential function as the classification information corresponding to the target text character.
[0163] In some embodiments, each text character is treated as a sequence label, and the second latent vector of each text character can be directly input into the classification layer (e.g., softmax). By mapping the classification probability through the normalized exponential function, the classification probability of each text character for different sensitive words can be obtained, that is, the classification information corresponding to the target text character.
[0164] For example, the classification probability of different sensitive words can be determined by formula (11).
[0165]
[0166] in, For the classification information of the nth text character, W s b is the weighting coefficient. s Here, h is the bias coefficient, N is the length of the character sequence, and h is the bias coefficient. n Let h′ be the first implicit vector of the nth text character. n This is the second hidden feature of the nth text character.
[0167] It should be noted that in the above classification layer, the cross-entropy loss function can be used for sensitive words.
[0168] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as ROM, RAM, magnetic disk, or optical disk.
[0169] Corresponding to the sensitive word detection method in the above embodiment, Figure 6 This is a structural block diagram of a sensitive word detection device provided in an embodiment of this application. For ease of explanation, only the parts relevant to the embodiment of this application are shown. (Refer to...) Figure 6 The sensitive word detection device 400 includes: an acquisition unit 401, an identification unit 401, a matching unit 403, and a detection unit 404.
[0170] Acquisition unit 401 is used to acquire the speech data to be detected;
[0171] The recognition unit 402 is used to perform speech-to-text recognition processing on the speech data and determine the character sequence corresponding to the speech data, wherein the character sequence contains multiple text characters;
[0172] The matching unit 403 is used to match the character sequence with N sensitive word information to determine the sensitive word pair set corresponding to the speech data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information.
[0173] The detection unit 404 is used to input the set of sensitive word pairs into the sensitive word detection model and obtain the detection results output by the sensitive word detection model. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information, and output the detection results based on the fused features; and determine the sensitive word information included in the speech data to be detected based on the detection results.
[0174] In some embodiments, a sensitive word information includes a first type of information and a second type of information. The first type of information included in any sensitive word information is used to represent the text corresponding to any sensitive word, and the second type of information included in any sensitive word information is used to represent the pinyin corresponding to any sensitive word.
[0175] The sensitive word pair vocabulary set includes a subset of pinyin word pairs and a subset of text word pairs; a pinyin word pair in the pinyin word pair subset includes a pinyin character corresponding to a matching text character and a second type of information, and a text word pair in the text word pair subset includes a matching text character and a first type of information;
[0176] Among them, the number of first-class information matching a text character is at least one, and the number of second-class information matching the pinyin corresponding to a text character is at least one.
[0177] In some embodiments, the sensitive word detection model includes a first fusion layer, a second fusion layer, and a classification layer, wherein the first fusion layer is connected to the second fusion layer, and the second fusion layer is connected to the classification layer.
[0178] The first fusion layer is used to fuse multiple first-class information matching each text character to obtain the first word feature of each text character, and to fuse multiple second-class information matching the pinyin corresponding to each text character to obtain the second word feature corresponding to each text character; and to combine the first word feature, the second word feature, and the feature of each text character to obtain the first latent vector feature of each text character.
[0179] The second fusion layer is used to fuse the first latent vector features of each text character and the target vector corresponding to each text character to obtain the second latent vector features of each text character; the target vector corresponding to each text character is determined based on the longest first-class information among multiple first-class information that matches each text character;
[0180] The classification layer is used to determine the classification information corresponding to each text character based on the second latent vector feature of each text character, and to determine the detection result based on the classification information corresponding to each text character.
[0181] In some embodiments, the plurality of text characters includes a target text character, and the first fusion layer is specifically used for:
[0182] Determine the first similarity data between each of the first type of information that matches the target text character, and the second similarity data between each of the second type of information that matches the pinyin corresponding to the target text character;
[0183] Based on the first similarity data between the target text character and each type of information, multiple types of information that match the target text character are weighted and fused to determine the first word feature of the target text character;
[0184] Based on the second similarity data between the target text character and each second type of information, multiple second type information that match the target text character are weighted and fused to determine the second word feature of the target text character;
[0185] The first word feature, the second word feature, and the feature of the target text character are combined to form the first latent vector feature of the target text character.
[0186] In some embodiments, the second fusion layer is specifically used to: determine the target vector corresponding to the target text character based on the longest first type of information among multiple first type of information matching the target text character;
[0187] Obtain the weights of the target vectors corresponding to the target text characters. The weights of the target vectors are used to characterize the degree of ambiguity of the target vectors.
[0188] Based on the weights of the target vectors corresponding to the target text characters, the target vectors corresponding to the target text characters and the first latent vector features corresponding to the target text characters are fused to obtain the second latent vector features corresponding to the target text characters.
[0189] In some embodiments, the classification layer is specifically used to input the second latent vector features of the target text character into a normalized exponential function for classification probability mapping, and to use the classification probabilities of different sensitive words output by the normalized exponential function as the classification information corresponding to the target text character.
[0190] In some embodiments, the acquisition unit 401 is further configured to acquire M sensitive word information to be matched from the database; determine the correlation between the scene information corresponding to the voice data and the M sensitive word information to be matched; determine invalid sensitive words in the M sensitive word information to be matched based on the correlation; and filter out the invalid sensitive word information from the M sensitive word information to obtain N sensitive word information.
[0191] In some embodiments, the character sequence corresponding to the speech data refers to any one of at least one target character sequence selected from multiple character sequences corresponding to the speech data; the acquisition unit 401 is further configured to perform speech-to-text recognition processing on the speech data to obtain multiple character sequences corresponding to the speech data; determine the length of the text characters included in each character sequence; determine at least one character sequence whose text character length is greater than a length threshold as at least one candidate character sequence; and select at least one target character sequence from at least one candidate character sequence.
[0192] In some embodiments, the voice data includes voice segments of multiple characters, and each character sequence in the multiple character sequences corresponding to the voice data corresponds to a character. The acquisition unit 401 is further configured to sequentially traverse the characters corresponding to each candidate character sequence; merge two adjacent candidate character sequences with the same character; and determine at least one candidate character sequence after merging as at least one target character sequence.
[0193] The sensitive word detection device provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effect are similar, and will not be described again in this embodiment.
[0194] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 7 As shown, the computer device may include: multiple processors 501 and memory 502. Figure 7 This refers to a computer device with a single processor as an example.
[0195] The memory 502 is used to store programs. Specifically, the program may include program code, which includes computer operation instructions.
[0196] Memory 502 may include high-speed RAM memory, and may also include non-volatile memory, such as multiple disk drives.
[0197] The processor 501 is used to execute computer execution instructions stored in the memory 502 to implement the above-mentioned sensitive word detection method.
[0198] The processor 501 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application.
[0199] Optionally, in specific implementations, if the communication interface 503, memory 502, and processor 501 are implemented independently, then the communication interface 503, memory 502, and processor 501 can be interconnected via a bus to complete communication between them. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc., but this does not imply that there is only one bus or one type of bus.
[0200] Optionally, in a specific implementation, if the communication interface 503, memory 502, and processor 501 are integrated on a single chip, then the communication interface 503, memory 502, and processor 501 can communicate through an internal interface.
[0201] This application also provides a chip, including a processor and an interface. The interface is used to input and output data or instructions processed by the processor. The processor is used to execute the sensitive word detection method provided in the above method embodiments.
[0202] This application also provides a computer-readable storage medium, which may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. Specifically, the computer-readable storage medium stores program information, which is used in the aforementioned sensitive word detection method.
[0203] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the sensitive word detection method described above.
[0204] This application also provides a computer program that enables a computer to perform the above-described sensitive word detection method.
[0205] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the flow or function according to the embodiments of the present invention is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).
[0206] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting sensitive words, characterized in that, include: Acquire the speech data to be detected; The speech data is processed by speech-to-text recognition to determine the character sequence corresponding to the speech data, wherein the character sequence contains multiple text characters; The character sequence is matched with N sensitive word information to determine the sensitive word pair set corresponding to the voice data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information; N is a positive integer. The sensitive word pair set is input into the sensitive word detection model, and the detection result output by the sensitive word detection model is obtained. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information to obtain a first fusion result, and then fuse the first fusion result with the target vector to output the detection result according to the obtained second fusion result. Herein, each sensitive word information includes the text corresponding to the sensitive word and the pinyin corresponding to the sensitive word. The target vector is determined based on the longest text among the texts corresponding to the sensitive word that match each text character. Based on the detection results, the sensitive word information included in the voice data to be detected is determined.
2. The method according to claim 1, characterized in that, The first type of information included in any sensitive word information is used to characterize the text corresponding to the sensitive word, and the second type of information included in any sensitive word information is used to characterize the pinyin corresponding to the sensitive word; The sensitive word pair set includes a subset of pinyin word pairs and a subset of text word pairs; a pinyin word pair in the subset of pinyin word pairs includes a pinyin character corresponding to a matching text character and a second type of information, and a text word pair in the subset of text word pairs includes a matching text character and a first type of information; Among them, the number of first-class information matching a text character is at least one, and the number of second-class information matching the pinyin corresponding to a text character is at least one.
3. The method according to claim 2, characterized in that, The sensitive word detection model includes a first fusion layer, a second fusion layer, and a classification layer; the first fusion layer is connected to the second fusion layer, and the second fusion layer is connected to the classification layer. The first fusion layer is used to fuse multiple first-type information matching each text character to obtain the first word feature of each text character, and to fuse multiple second-type information matching the pinyin corresponding to each text character to obtain the second word feature corresponding to each text character; And by combining the first word feature, the second word feature, and the feature of each text character, the first latent vector feature of each text character is obtained; The second fusion layer is used to fuse the first latent vector feature of each text character and the target vector corresponding to each text character to obtain the second latent vector feature of each text character; the target vector corresponding to each text character is determined based on the longest first type of information among multiple first type information that matches each text character; The classification layer is used to determine the classification information corresponding to each text character based on the second latent vector feature of each text character, and to determine the detection result based on the classification information corresponding to each text character.
4. The method according to claim 3, characterized in that, The plurality of text characters includes the target text character, and the first fusion layer is specifically used for: The target text character is determined, and the first similarity data between each of the multiple first-class information that matches the target text character is determined, as well as the pinyin corresponding to the target text character and the second similarity data between each of the multiple second-class information that matches the pinyin corresponding to the target text character; Based on the first similarity data between the target text character and each type of information, multiple types of information that match the target text character are weighted and fused to determine the first word feature of the target text character; Based on the second similarity data between the target text character and each second type of information, multiple second type information that match the target text character are weighted and fused to determine the second word feature of the target text character; The first word feature, the second word feature, and the feature of the target text character are combined to form the first latent vector feature of the target text character.
5. The method according to claim 4, characterized in that, The second fusion layer is specifically used for: The target vector corresponding to the target text character is determined based on the longest first-class information among multiple first-class information matching the target text character. Obtain the weight of the target vector corresponding to the target text character, and the weight of the target vector is used to characterize the degree of ambiguity of the target vector; Based on the weight of the target vector corresponding to the target text character, the target vector corresponding to the target text character and the first latent vector feature corresponding to the target text character are fused to obtain the second latent vector feature corresponding to the target text character.
6. The method according to claim 5, characterized in that, The classification layer is used to input the second latent vector features of the target text character into a normalized exponential function for classification probability mapping, and to use the classification probabilities of different sensitive word information output by the normalized exponential function as the classification information corresponding to the target text character.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Retrieve M sensitive words to be matched from the database, where M is a positive integer greater than N; Determine the correlation between the scene information corresponding to the voice data and the M sensitive words to be matched; Based on the correlation degree, invalid sensitive word information is determined from the M sensitive word information to be matched; The invalid sensitive word information is filtered from the M sensitive words to obtain N sensitive word information.
8. The method according to any one of claims 1-6, characterized in that, The character sequence corresponding to the voice data refers to any one of the at least one target character sequence corresponding to the voice data, and the at least one target character sequence corresponding to the voice data is selected from the multiple character sequences corresponding to the voice data; Selecting at least one target character sequence from multiple character sequences corresponding to the speech data includes: Determine the length of the text characters included in each of the multiple character sequences corresponding to the speech data; At least one character sequence whose length is greater than a length threshold is identified as at least one candidate character sequence; Select at least one target character sequence from the at least one candidate character sequence.
9. The method according to claim 8, characterized in that, The voice data includes voice segments from multiple characters, and each character sequence in the multiple character sequences corresponding to the voice data corresponds to one character; Selecting at least one target character sequence from the at least one candidate character sequence includes: Iterate through the roles corresponding to each candidate character sequence in turn; Merge two adjacent candidate character sequences that have the same role. At least one candidate character sequence after merging is determined as at least one target character sequence.
10. A sensitive word detection device, characterized in that, The device includes: Acquisition unit, used to acquire the speech data to be detected; The recognition unit is used to perform speech-to-text recognition processing on the speech data and determine the character sequence corresponding to the speech data, wherein the character sequence contains multiple text characters. A matching unit is used to match the character sequence with N sensitive word information to determine the sensitive word pair set corresponding to the voice data. The sensitive word pair set contains multiple word pairs. A word pair is composed of a text character in the character sequence and its matching sensitive word information; N is a positive integer. The detection unit is used to input the set of sensitive word pairs into the sensitive word detection model and obtain the detection result output by the sensitive word detection model. The sensitive word detection model is used to fuse the features of the text characters in each word pair with the features of the sensitive word information to obtain a first fusion result, and then fuse the first fusion result with the target vector to output a detection result based on the obtained second fusion result; and to determine the sensitive word information included in the speech data to be detected based on the detection result; wherein, each sensitive word information includes the text corresponding to the sensitive word and the pinyin corresponding to the sensitive word, and the target vector is determined based on the longest text among the texts corresponding to the sensitive word that match each text character.
11. A computer device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1 to 9.