Text classification model training method, text classification processing method and device

By constructing positive and negative sample datasets to train a text classification model, and utilizing semantic coherence to identify noisy data, the problem of semantic incoherence in speech quality inspection caused by noise is solved, thereby improving the accuracy of noise identification and reducing the false recognition rate.

CN116150351BActive Publication Date: 2026-05-12MASHANG CONSUMER FINANCE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
MASHANG CONSUMER FINANCE CO LTD
Filing Date
2022-07-11
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

In voice quality inspection, noise mixed into call data leads to semantic incoherence and speech confusion in the translation results of speech recognition technology. Existing voiceprint recognition technology has difficulty accurately identifying noisy data, resulting in a high false recognition rate.

Method used

Construct positive and negative sample datasets, train a text classification model, and use semantic coherence to identify noisy data. This includes converting speech samples into text samples, selecting noisy samples and continuous text samples, constructing positive and negative sample sets for iterative training, and using semantic coherence at the text level for noise identification.

Benefits of technology

It improves the accuracy of noise data recognition, reduces the false recognition rate, avoids the interference of noise data on the translation results of call text, and ensures semantic coherence.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116150351B_ABST
    Figure CN116150351B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a text classification model training method, a text classification processing method and device. The training method comprises the following steps: converting N speech samples into N text samples, each text sample comprising at least M sentences, M and N being integers greater than 1; selecting at least one sentence from each text sample as a noise sample to form a noise sample set; using at least one noise sample in the noise sample set and continuous multiple sentences in at least one text sample to construct a positive sample data set, and using the continuous multiple sentences in the at least one text sample to construct a negative sample data set; and iteratively training a text classification model to be trained using the positive sample data set and the negative sample data set. The embodiment of the application can solve the problem of incoherent semantics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a training method for a text classification model, a text classification processing method, and an apparatus. Background Technology

[0002] Automatic Speech Recognition (ASR) is a technology that converts human speech into text. Speech recognition is a multidisciplinary field that is closely related to acoustics, phonetics, linguistics, and digital signal processing theory.

[0003] When conducting voice quality inspection, noise often gets mixed into the call data when the agent robot talks to the customer. When using ASR to convert the recorded data into text, the noise data is also translated out, which will interfere with the translation result of the call text and cause semantic incoherence. Summary of the Invention

[0004] This application provides a method for training a text classification model, a text classification processing method, and an apparatus to solve the problem of semantic incoherence.

[0005] In a first aspect, this application provides a training method for a text classification model, comprising: converting N speech samples into N text samples, each text sample comprising at least M sentences, wherein M and N are both integers greater than 1; selecting at least one sentence from each text sample as noise samples to form a noise sample set; constructing a positive sample dataset using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and constructing a negative sample dataset using multiple consecutive sentences from at least one text sample; and inputting the training samples from the positive sample dataset and the training samples from the negative sample dataset into the text classification model to be trained for iterative training.

[0006] As can be seen, this embodiment trains the text classification model at the text level. The constructed negative sample dataset contains multiple consecutive sentences; since these sentences are consecutive, the negative samples in the negative sample dataset possess semantic coherence. Conversely, each positive sample in the positive sample dataset contains multiple consecutive sentences and noise; therefore, the positive samples in the positive sample dataset lack semantic coherence. When training the text classification model, the constructed positive sample dataset is used to learn about the noisy positive samples, and the constructed negative sample dataset is used to learn about the coherent text without noise samples. This allows the trained text classification model to identify noisy data based on semantic coherence, thereby solving the problem of semantic incoherence in the translation of spoken text.

[0007] Secondly, this application provides a text classification processing method, comprising: acquiring speech data to be recognized; converting the speech data into text data, the text data including at least M sentences, where M is an integer greater than 1; inputting the sentences to be recognized from the M sentences in the text data into a text classification model for classification processing, obtaining a classification result output by the text classification model, the classification processing being used to classify the sentences to be recognized in the text data; and determining the category of the sentences to be recognized in the text data based on the classification result, the category including a noise category or a non-noise category.

[0008] As can be seen, when the embodiments of this application use a text classification model to identify noise data, they use the semantic coherence of the text data at the text level to identify noise data that causes semantic incoherence, so that the identified noise data can be removed in the subsequent process, avoiding the noise data from interfering with the translation results of the call text and causing semantic incoherence.

[0009] Thirdly, this application provides a training apparatus for a text classification model, comprising: a conversion module for converting N speech samples into N text samples, each text sample comprising at least M sentences, where M and N are both integers greater than 1; a selection module for selecting at least one sentence from each text sample as noise samples to form a noise sample set; a construction module for constructing a positive sample dataset using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and constructing a negative sample dataset using multiple consecutive sentences from the at least one text sample; and a training module for iteratively training the text classification model to be trained using the positive sample dataset and the negative sample dataset.

[0010] Fourthly, this application provides a text classification processing apparatus, comprising: an acquisition module for acquiring speech data to be recognized; a conversion module for converting the speech data into text data, the text data including at least M sentences, where M is an integer greater than 1; a processing module for inputting the sentences to be recognized from the M sentences in the text data into a text classification model for classification processing, thereby obtaining a classification result output by the text classification model, the classification processing being used to classify the sentences to be recognized in the text data; and a determination module for determining the category of the sentences to be recognized in the text data based on the classification result, the category including a noise category or a non-noise category.

[0011] Fifthly, this application provides an electronic device, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the method as described in the first or second aspect.

[0012] In a sixth aspect, this application provides a computer-readable storage medium that, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the method described in the first or second aspect. Attached Figure Description

[0013] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:

[0014] Figure 1 A flowchart illustrating a training method for a text classification model provided in an embodiment of this application;

[0015] Figure 2 A flowchart illustrating a text classification processing method provided in an embodiment of this application;

[0016] Figure 3 A schematic diagram of the structure of a training device for a text classification model provided in an embodiment of this application;

[0017] Figure 4 This is a schematic diagram of the structure of a text classification processing device provided in an embodiment of this application;

[0018] Figure 5 This is a schematic diagram of an electronic device provided as an embodiment of the present specification. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this application.

[0020] The terms "first," "second," etc., used in this specification and claims are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in this specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0021] As mentioned before, during voice quality inspection, noise often gets mixed into the call data when agents talk to customers. When using ASR to convert the recorded data into text, the noise data is translated out, which interferes with the translation of the call text, resulting in problems such as semantic incoherence and speech confusion.

[0022] In one related technology, voiceprint recognition technology is commonly used to identify the speaker in recorded data. Also known as speaker identification technology, voiceprint recognition is a core intelligent voice technology that uses a computer system to automatically identify the speaker. This technology is based on the unique personality information of the speaker contained in the voice, using computer and information recognition technology to automatically identify the speaker corresponding to the current voice. It also identifies and removes noise data in the call recording. However, because the audio frequency information of noise data is short, and noise data is superimposed on the speaker's voice data, voiceprint recognition technology cannot correctly identify noise data. Noise data is difficult to identify correctly, and may even lead to normal conversation data between the two parties being misidentified as noise data. The accuracy rate of noise data identification is low, and the misidentification rate of noise data is high.

[0023] To avoid interference from noise data in the translation of call text, leading to semantic incoherence and speech confusion, and to improve the accuracy of noise data recognition while reducing the false recognition rate, this application aims to provide a training method for a text classification model and a subsequent scheme for text classification based on the text classification model. For the training method of the text classification model, N call text samples are converted into N text samples, each text sample including at least M sentences, where M and N are both integers greater than 1; at least one sentence is selected from each text sample as a noise sample to form a noise sample set; a positive sample dataset is constructed using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and a negative sample dataset is constructed using multiple consecutive sentences from at least one text sample; the text classification model to be trained is iteratively trained using the positive and negative sample datasets. Thus, this embodiment trains the text classification model at the text level. The constructed negative sample dataset contains multiple consecutive sentences; since these sentences are continuous, the negative samples in the negative sample dataset possess semantic coherence. Conversely, each positive sample in the positive sample dataset contains multiple consecutive sentences and noise; therefore, the positive samples in the positive sample dataset lack semantic coherence. When training the text classification model, the constructed positive sample dataset is used to learn about positive samples containing noise, and the constructed negative sample dataset is used to learn about coherent text without noise samples. This allows the trained text classification model to identify noise data based on semantic coherence. Furthermore, compared to voiceprint recognition technology, the method of identifying noise data at the text level provided in this embodiment is not affected by audio information, thus accurately identifying noise data in call text, improving the accuracy of noise data identification, and reducing the false identification rate of noise data.

[0024] For text classification processing methods, the following steps are taken: First, the speech data to be recognized is acquired. This speech data is then converted into text data, which includes M sentences, where M is an integer greater than 1. The sentences to be recognized from the M sentences in the text data are input into a text classification model for classification processing. The classification results are then obtained, and the classification process is used to categorize the sentences to be recognized in the text data. Based on the classification results, the category of the sentences to be recognized in the text data is determined, which may include noise or non-noise categories. Thus, in this embodiment, when using a text classification model to recognize noise data, the ability to identify the semantic coherence of text is utilized to identify noise data that causes semantic incoherence. If the input sentence to be recognized is semantically incoherent, it is determined to be noise data, so that the identified noise data can be removed in subsequent processes. This avoids noise data interfering with the translation results of the spoken text, leading to semantic incoherence and speech confusion. Furthermore, compared to voiceprint recognition technology, the method of identifying noise data at the text level provided in this application embodiment is not affected by audio information, thereby accurately identifying noise data in the call text, improving the accuracy of noise data identification, and reducing the false identification rate of noise data.

[0025] It should be understood that the text classification processing method and the text classification model training method provided in the embodiments of this application can both be executed by an electronic device or by software installed in an electronic device, specifically by a terminal device or a server device. The text classification processing method and the text classification model training method can be executed by the same electronic device, or they can be executed by different electronic devices.

[0026] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0027] Please refer to Figure 1 This is a flowchart illustrating a training method for a text classification model, provided as an embodiment of this specification, and applied to an electronic device. The method may include:

[0028] Step S101: Convert N voice samples into N text samples.

[0029] Each text sample includes at least M sentences, where M and N are both integers greater than 1.

[0030] Specifically, N can be an integer not less than 1. N voice samples can be at least one of the following: recordings of conversations between two real people, personal recordings, and recordings of conversations between a robot and a real person. The voice samples contain voice content, and the text samples contain text content corresponding to the voice content.

[0031] For each speech sample, before converting the speech to text, the silences at the beginning and end of the speech are removed to reduce interference with subsequent speech-to-text conversion. ASR (Automatic Speech Reduction) technology is used to convert each speech sample into text, and the converted text is used as a text sample. Each text sample includes at least M sentences, which are arranged sequentially according to the chronological order of the speech content in the speech sample, forming a series of M consecutive sentences. There is a semantic connection between consecutive sentences within the M sentences.

[0032] Step S103: Select at least one sentence from each text sample as a noise sample to form a noise sample set.

[0033] Specifically, one or more sentences are randomly selected from each of the obtained text samples as noise samples, and these multiple noise samples form a noise sample set. When multiple sentences are randomly selected as noise samples from each text sample, these multiple sentences can be consecutive sentences or multiple non-consecutive sentences randomly selected from a single text sample.

[0034] Step S105: Construct a positive sample dataset using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and construct a negative sample dataset using multiple consecutive sentences from at least one text sample.

[0035] Specifically, the positive sample dataset includes multiple positive samples, which can be formed by concatenating the beginning and end of multiple consecutive sentences from each text sample with the beginning and end of noise samples from the noise sample set. The negative sample dataset includes multiple negative samples, which can be formed by concatenating the beginning and end of multiple consecutive sentences from each text sample.

[0036] There are various ways to construct a positive sample dataset. As one possible implementation of this application, constructing a positive sample dataset by using at least one noise sample and at least one consecutive sentence in a text sample from a noise sample set includes: constructing n1 positive samples, performing a first annotation on each of the n1 positive samples to obtain n1 positive samples with the first annotation, and the n1 positive samples with the first annotation constitute the positive sample dataset.

[0037] In each positive sample construction process, m consecutive sentences are randomly selected from at least M sentences in any one of the at least one text sample, and at least one noise sample is randomly selected from the noise sample set. The m consecutive sentences are then concatenated end-to-end, and then concatenated end-to-end with the at least one noise sample to obtain the positive sample. The m consecutive sentences are placed first, and the at least one noise sample is placed last, where m is less than M. In practical scenarios, m can be taken as 2 to 4 to ensure the training speed of the text classification model. Limiting the number of consecutive sentences selected avoids the problem of excessively large numbers of sentences leading to low training speed and efficiency of the text classification model.

[0038] Specifically, in each positive sample construction process, m consecutive sentences are randomly selected from any text sample. These m consecutive sentences are semantically related and are concatenated in chronological order, with earlier sentences ranked first and later sentences ranked last. At least one noise sample is randomly selected from the noise sample set and concatenated with the last sentence of the m consecutive sentences. When multiple noise samples are selected, they can be concatenated arbitrarily; this embodiment does not impose any limitations on this. The arbitrarily concatenated noise sample can be considered a single sentence. This positive sample construction process is performed n1 times, resulting in n1 positive samples. Each positive sample includes at least one additional noise sample after each of the m consecutive sentences, meaning each positive sample contains m+1 sentences. After obtaining n1 positive samples, each positive sample is formatted as "sentence 1-sentence 2-sentence 3-…-sentence m-sentence m+1", and a first label (first annotation) is added to each positive sample, for example, using label "1".

[0039] The process of constructing positive samples reveals that each positive sample contains m+1 sentences. The first m sentences are consecutive, while the last sentence is randomly selected or spliced ​​together. Therefore, semantically, the last sentence is highly likely to be disjointed from the first m sentences. Consequently, the last sentence can be considered noise data relative to the preceding m consecutive sentences. In real-world phone call scenarios, the voices of third parties or other noise from the external environment can randomly mix into the recorded call data. Therefore, by randomly selecting m consecutive sentences and at least one noise sample, the text classification model trained exhibits stronger generalization ability and better meets the needs of real-world scenarios.

[0040] Furthermore, there are various ways to construct a positive sample dataset. In one possible implementation, step S105 includes: selecting multiple consecutive sentences from at least M sentences in at least one text sample, and constructing a positive sample dataset using at least one noise sample in the noise sample set and multiple consecutive sentences from at least M sentences in at least one text sample; selecting multiple consecutive sentences from at least M sentences in at least one text sample, and constructing negative samples by selecting multiple consecutive sentences from at least M sentences in at least one text sample; wherein, the number of times to select multiple consecutive sentences from at least M sentences in each text sample is determined based on the number of sentences in each text sample. If the number of sentences in a text sample is greater than the average number of sentences in N text samples, the number of times to select is selected as a first value; if the number of sentences in a text sample is not greater than the average number of sentences in N text samples, the number of times to select is selected as a second value, and the first value is greater than the second value.

[0041] Specifically, for the same text sample, the number of sentences in each text sample is different. We can limit the number of times we select m consecutive sentences from the same text sample to avoid sample duplication caused by selecting too many consecutive m sentences, thus preventing sample redundancy. Specifically, the number of times to select m consecutive sentences from each text sample can be determined based on the number of sentences in each text sample, where the m consecutive sentences selected in each selection are different. In other words, the value of the selection count depends on the total number of sentences in the text sample; the number of times to select m consecutive sentences from each text sample is determined according to the total number of sentences in each text sample.

[0042] The number of selections can be determined based on the average number of sentences in N text samples. Specifically, if the number of sentences in a text sample is greater than the average number of sentences in N text samples, the selection count is set to a first value; if the number of sentences in a text sample is not greater than the average number of sentences in N text samples, the selection count is set to a second value. For example, if the number of sentences in a text sample is greater than the average number of sentences in N text samples, the selection count is set to 2; if the number of sentences in a text sample is not greater than the average number of sentences in N text samples, the selection count is set to 1. Furthermore, the values ​​of the first and second values ​​can be determined according to the actual scenario requirements, and this embodiment does not impose any limitations on them. In this way, limiting the number of times m consecutive sentences are selected from the same text sample prevents the problem of sample duplication caused by selecting too many consecutive m sentences from the same text sample, avoids sample redundancy, and further improves the training efficiency of the text classification model.

[0043] There are various ways to construct a negative sample dataset. As one possible implementation method in this application, constructing a negative sample dataset using multiple sentences in a text sample includes: constructing n2 negative samples, performing a second annotation on each of the n2 negative samples to obtain n2 negative samples with second annotations, and constructing a negative sample dataset from the n2 negative samples with second annotations.

[0044] The specific implementation for constructing each negative sample involves randomly selecting m+1 consecutive sentences from at least M sentences in any one of the text samples, concatenating the first and last sentences of the m+1 consecutive sentences to obtain the negative sample dataset, where m+1 is less than M. In practical scenarios, m can be taken as 2 to 4 to ensure the training speed of the text classification model, and limiting the number of consecutive sentences selected avoids the problem of excessively large numbers of sentences leading to low training speed and efficiency of the text classification model.

[0045] Specifically, in each negative sample construction process, m+1 consecutive sentences are randomly selected from any one of the at least one text sample. These m+1 consecutive sentences are semantically related and are concatenated in chronological order, with earlier sentences listed first and later sentences last. This process is repeated n2 times to obtain n2 negative samples, each consisting of m+1 sentences. After obtaining the n2 negative samples, each negative sample is formatted as "sentence 1-sentence 2-sentence 3-…-sentence m-sentence m+1", and a second label (second annotation) is added to each negative sample, for example, using label "0". It is important to note that the first label must be different from the second label to distinguish between negative and positive samples.

[0046] The process of constructing negative samples reveals that each negative sample contains m+1 sentences, and these m+1 sentences are consecutive, meaning they are semantically related. This facilitates the text classification model's learning of semantic coherence. Therefore, by randomly selecting m+1 consecutive sentences, the trained text classification model exhibits stronger generalization ability and better meets the needs of real-world scenarios.

[0047] Furthermore, for the same text sample, the number of times the m+1 consecutive sentences are selected from the same text sample can be limited to avoid sample duplication caused by selecting too many consecutive sentences from the same text sample, thus avoiding sample redundancy. Specifically, the number of consecutive sentences selected from each text sample can be determined based on the number of sentences in each text sample; the consecutive m+1 sentences selected in each text sample will be different. In other words, the value of the selection count depends on the total number of sentences in the text sample, and the number of consecutive sentences selected from each text sample is determined according to the total number of sentences in each text sample.

[0048] Specifically, the number of selections can be determined based on the average number of sentences in N text samples. Specifically, if the number of sentences in a text sample is greater than the average number of sentences in N text samples, the selection count is set to the first value; if the number of sentences in a text sample is not greater than the average number of sentences in N text samples, the selection count is set to the second value. For example, if the number of sentences in a text sample is greater than the average number of sentences in N text samples, the selection count is set to 2; if the number of sentences in a text sample is not greater than the average number of sentences in N text samples, the selection count is set to 1. Furthermore, the values ​​of the first and second values ​​can be determined according to the actual scenario requirements, and this embodiment does not impose any limitations on them. In this way, limiting the number of times m+1 consecutive sentences are selected from the same text sample prevents excessive selection of m+1 consecutive sentences from the same text sample, thus avoiding sample redundancy and further improving the training efficiency of the text classification model.

[0049] Furthermore, to further improve the accuracy of the text classification model in recognizing noisy data, the number of negative samples n2 can be greater than the number of positive samples n1. Specifically, the number of negative samples n2 can be an integer multiple of the number of positive samples n1. This is because by increasing the number of negative samples and increasing the proportion of negative samples in all samples, the text classification model can learn more semantically coherent and continuous sentences. The text classification model can then more accurately identify the noisy data that causes semantic incoherence, thereby further improving the accuracy of the text classification model in recognizing noisy data.

[0050] Step S107: Iteratively train the text classification model to be trained using the positive sample dataset and the negative sample dataset.

[0051] Specifically, after obtaining the aforementioned positive and negative sample datasets, they are input into the text classification model to be trained for iterative training. The text classification model learns to understand positive samples containing noisy samples and coherent text without noisy samples, until the model parameters reach their optimal level, enabling the text classification model to recognize semantic coherence. When using the trained text classification model to identify noisy data, the model utilizes the semantic coherence of the text to identify noisy data lacking semantic coherence, facilitating the subsequent removal of identified noisy data. The network used in the text classification model can be machine learning methods such as Logistic Regression (LR), Long Short-Term Memory (LSTM), Text CNN, or Bidirectional Encoder Representation from Transformers (BERT).

[0052] The text classification model training method disclosed in this application trains the model at the text level. The constructed negative sample dataset contains multiple consecutive sentences, which, due to their continuity, possess semantic coherence. Conversely, each positive sample in the positive sample dataset contains multiple consecutive sentences and noise, thus lacking semantic coherence. During training, the model learns from the noisy positive samples using the constructed positive sample dataset and from the coherent text without noise using the constructed negative sample dataset. This allows the trained model to identify noisy data based on semantic coherence.

[0053] Corresponding to the above methods, embodiments of this application also provide a text classification processing method, capable of based on Figure 1 The text classification model trained by the method shown performs text classification processing on the voice data of a call, thereby identifying noise data in the voice data.

[0054] Please refer to Figure 2 This is a flowchart illustrating a text classification processing method provided in one embodiment of this specification, applied to an electronic device. The method may include:

[0055] Step S201: Obtain the speech data to be recognized.

[0056] Specifically, the voice data to be identified can be at least one of the following: recordings of conversations between two real people, personal recordings, and recordings of conversations between a robot and a real person. In actual call scenarios, when two people are talking or recording individually, the voices of third parties or other noises in the external environment will be randomly mixed into the recording. The voice data carries the actual recording data of the two parties or the individual recording and the external noise data.

[0057] Step S203: Convert the voice data into text data.

[0058] Specifically, for the speech data to be recognized, before converting the speech to text, the silences at the beginning and end of the speech data need to be removed to reduce interference with the subsequent speech-to-text conversion. ASR technology is then used to convert the speech data into text data. The text data includes at least M sentences, where M is an integer greater than 1. The M sentences are arranged sequentially according to the chronological order of the speech content in the speech data, forming a series of M consecutive sentences. There is a semantic connection between any two consecutive sentences within the M sentences.

[0059] Step S205: Input multiple consecutive sentences from the M sentences in the text data into the text classification model for classification processing, and obtain the classification result output by the text classification model.

[0060] In this context, multiple consecutive sentences include sentences to be identified, and classification processing is used to classify the sentences to be identified in the text data.

[0061] Specifically, when inputting the sentence to be identified from M sentences in the text data into the text classification model, in order to ensure the consistency of the training samples of the text classification model with the format of the sentence to be identified, and to improve the accuracy of noise recognition in the text classification model, the input of the sentence to be identified from the M sentences in the text data into the text classification model for classification processing includes: determining the m consecutive sentences before the sentence to be identified from the M sentences, where m is less than M; concatenating the first and last parts of the m consecutive sentences with the sentence to be identified to obtain a concatenated sentence, wherein the m consecutive sentences are placed first and the sentence to be identified is placed last; and inputting the concatenated sentence into the text classification model for classification processing to obtain the classification result output by the text classification model.

[0062] Specifically, the sentence to be identified is located in the text data obtained from the above steps. The m consecutive sentences preceding the sentence to be identified are extracted in chronological order and concatenated according to the format "sentence 1 - sentence 2 - ... - sentence m - text to be identified". The combined text is then input into a text classification model for classification processing, and the category of the text is output. It is worth noting that, as mentioned in the above embodiment, during the training of the text classification model, both positive and negative samples consist of m+1 data points with a specific format. Therefore, to ensure the recognition accuracy of this text classification model, the format and number of sentences in the input text must be the same as those in the positive and negative samples used in the training samples.

[0063] Step S207: Determine the category of the sentence to be identified in the text data based on the classification results.

[0064] The categories include noise categories or non-noise categories.

[0065] Specifically, according to the first and second labels marked when training the text classification model as described in the above embodiments, if the category is the first label, it means that the text to be identified is noise data; if the category is the second label, it means that the text to be identified is not noise data. In subsequent processing, if it is noise data, the text to be identified will be removed from the text data.

[0066] The text classification processing method provided in this application identifies noise data by utilizing the semantic coherence of text data at the text level. This allows for the removal of identified noise data in subsequent processes, preventing it from interfering with the translation of the call text and causing semantic incoherence and speech confusion. Furthermore, compared to voiceprint recognition technology, the text-level noise data identification method provided in this application is not affected by audio information, thus accurately identifying noise data in the call text, improving the accuracy of noise data identification, and reducing the false identification rate of noise data.

[0067] In practical applications of text classification models, some text may be misidentified. To further improve the recognition accuracy of the text classification model, one possible approach is to expand the misidentified text to obtain new training samples. These new training samples are then input into the text classification model to train it again, resulting in a new text classification model. The learning ability of the new model is further enhanced, thereby improving the recognition accuracy of the text classification model.

[0068] The expansion of the misidentified text can be achieved by: finding j texts that are semantically similar to the misidentified text, which can be calculated using text similarity. Then, the misidentified text in the sequence "Sentence 1 - Sentence 2 - ... - Sentence m - Misidentified text" is replaced sequentially with j similar texts to obtain j expanded sample data. These j expanded sample data, along with the j+1 sample data from "Sentence 1 - Sentence 2 - ... - Sentence m - Misidentified text", are added to the training set to retrain the text classification model. The value of j can be determined based on the actual scenario requirements, and this embodiment does not impose any limitations on it.

[0069] In addition, with the above Figure 1 Corresponding to the training method of the text classification model shown, this application embodiment also provides a training device for a text classification model. Figure 3 This is a schematic diagram of the structure of a training device 300 for a text classification model provided in an embodiment of this application. It includes: a conversion module 301, used to convert N speech samples into N text samples, each text sample including at least M sentences, where M and N are both integers greater than 1; a selection module 302, used to select at least one sentence from each text sample as a noise sample to form a noise sample set; a construction module 303, used to construct a positive sample dataset using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and to construct a negative sample dataset using multiple consecutive sentences from at least one text sample; and a training module 304, used to iteratively train the text classification model to be trained using the positive sample dataset and the negative sample dataset.

[0070] The text classification model training apparatus provided in this application trains the text classification model at the text level. The constructed negative sample dataset contains multiple consecutive sentences; since these sentences are consecutive, the negative samples in the negative sample dataset possess semantic coherence. Conversely, each positive sample in the positive sample dataset contains multiple consecutive sentences and noise; therefore, the positive samples in the positive sample dataset lack semantic coherence. When training the text classification model, the constructed positive sample dataset is used to learn about the noisy positive samples, and the constructed negative sample dataset is used to learn about the coherent text without noise samples. This allows the trained text classification model to identify noisy data based on semantic coherence.

[0071] In one possible implementation, the construction module 303 is further used to construct n1 positive samples, and to perform a first annotation on each of the n1 positive samples to obtain n1 positive samples with the first annotation. The n1 positive samples with the first annotation constitute a positive sample dataset. The specific implementation of constructing each positive sample is as follows: randomly select m consecutive sentences from at least M sentences in any one of the text samples, and randomly select at least one noise sample from the noise sample set, concatenate the first and last parts of the m consecutive sentences, and then concatenate the first and last parts of the m consecutive sentences with the at least one noise sample to obtain a positive sample. In this case, the m consecutive sentences are placed first, the at least one noise sample is placed last, and m is less than M.

[0072] In one possible implementation, the construction module 303 is further used to construct n2 negative samples, perform a second annotation on each of the n2 negative samples to obtain n2 negative samples with second annotations, and construct a negative sample dataset from the n2 negative samples with second annotations; the specific implementation of constructing each negative sample is as follows: randomly select m+1 consecutive sentences from at least M sentences in any one of the text samples, concatenate the beginning and end of the m+1 consecutive sentences to obtain a negative sample dataset, where m+1 is less than M.

[0073] In one possible implementation, n2 is an integer multiple of n1.

[0074] In one possible implementation, the construction module 303 is further configured to select multiple consecutive sentences from at least M sentences in at least one text sample, construct a positive sample dataset using at least one noise sample in the noise sample set and multiple consecutive sentences from at least M sentences in at least one text sample; select multiple consecutive sentences from at least M sentences in at least one text sample, and construct a negative sample dataset by selecting multiple consecutive sentences from at least M sentences in at least one text sample; wherein the number of times multiple consecutive sentences are selected from at least M sentences in each text sample is determined based on the number of sentences in each text sample; if the number of sentences in the text sample is greater than the average number of sentences in N text samples, the number of selections is a first value; if the number of sentences in the text sample is not greater than the average number of sentences in N text samples, the number of selections is a second value, and the first value is greater than the second value.

[0075] In addition, with the above Figure 2 Corresponding to the text classification processing method shown, this application also provides a text classification processing apparatus. Figure 4This is a schematic diagram of the structure of a text classification processing device 400 provided in an embodiment of this application, including: an acquisition module 401, used to acquire speech data to be recognized; a conversion module 402, used to convert the speech data into text data, the text data including at least M sentences, where M is an integer greater than 1; a processing module 403, used to input multiple consecutive sentences from the M sentences in the text data into a text classification model for classification processing, and obtain the classification result output by the text classification model, wherein the multiple consecutive sentences include the sentence to be recognized, and the classification processing is used to classify the sentence to be recognized in the text data; and a determination module 404, used to determine the category of the sentence to be recognized in the text data according to the classification result, the category including a noise category or a non-noise category.

[0076] The text classification processing device provided in this application identifies noise data by utilizing the text classification model to identify noise data that causes semantic incoherence at the text level. This facilitates the removal of identified noise data in subsequent processes, preventing noise data from interfering with the translation results of the call text and causing problems such as semantic incoherence and speech confusion.

[0077] In one possible implementation, the processing module 403 is further configured to determine the m consecutive sentences preceding the sentence to be identified from the M sentences, where m is less than M; concatenate the m consecutive sentences with the sentence to be identified to obtain a concatenated sentence, wherein the m consecutive sentences are placed before the sentence to be identified; and input the concatenated sentence into a text classification model for classification processing to obtain the classification result output by the text classification model.

[0078] Obviously, the text classification processing apparatus disclosed in the embodiments of this application can be used as the above-mentioned... Figure 2 The text classification processing method shown is the execution entity, thus enabling the text classification processing method to achieve... Figure 2 The functions implemented are the same, so they will not be described in detail here.

[0079] Figure 5 This is a schematic diagram of the structure of an electronic device according to one embodiment of this specification. Please refer to it. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and memory. The memory may include main memory, such as high-speed random-access memory (RAM), or non-volatile memory, such as at least one disk drive. Of course, the electronic device may also include other hardware required for other business operations.

[0080] The processor, network interface, and memory can be interconnected via an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0081] Memory is used to store programs. Specifically, programs may include program code, which includes computer operation instructions. Memory may include main memory and non-volatile memory, and provides instructions and data to the processor.

[0082] The processor reads the corresponding computer program from non-volatile memory into main memory and then runs it, forming a training device for the text classification model at the logical level. The processor executes the program stored in memory and specifically performs the following operations:

[0083] N speech samples are converted into N text samples, each text sample including at least M sentences, where M and N are both integers greater than 1; at least one sentence is selected from each text sample as a noise sample to form a noise sample set; a positive sample dataset is constructed using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and a negative sample dataset is constructed using multiple consecutive sentences from at least one text sample; the text classification model to be trained is iteratively trained using the positive sample dataset and the negative sample dataset.

[0084] Alternatively, the processor reads the corresponding computer program from non-volatile memory into memory and runs it, forming a text classification processing device at the logical level. The processor executes the program stored in memory and specifically performs the following operations: acquiring the speech data to be recognized; converting the speech data into text data, the text data including at least M sentences, where M is an integer greater than 1; inputting multiple consecutive sentences from the M sentences in the text data into a text classification model for classification processing, obtaining the classification result output by the text classification model, where the multiple consecutive sentences include the sentence to be recognized, and the classification processing is used to classify the sentence to be recognized in the text data; determining the category of the sentence to be recognized in the text data based on the classification result, the category including a noise category or a non-noise category.

[0085] The above is as described in this instruction manual. Figure 3The illustrated embodiments disclose the method performed by the training apparatus for the text classification model, or as described in this specification. Figure 4 The text classification processing apparatus disclosed in the illustrated embodiments can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.

[0086] It should be understood that the electronic device in the embodiments of this application can realize a training device for a text classification model. Figure 3 The functions or text classification processing apparatus of the illustrated embodiment are as follows: Figure 4 The embodiments illustrate the functionality. Since the principles are the same, the embodiments of this application will not be described again here.

[0087] Of course, in addition to software implementation, the electronic device described in this specification does not exclude other implementation methods, such as logic devices or a combination of hardware and software. In other words, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0088] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by a portable electronic device including multiple applications, enable the portable electronic device to perform... Figure 1The training method of the text classification model in the illustrated embodiment is specifically used to perform the following operations:

[0089] N speech samples are converted into N text samples, each text sample including at least M sentences, where M and N are both integers greater than 1; at least one sentence is selected from each text sample as a noise sample to form a noise sample set; a positive sample dataset is constructed using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and a negative sample dataset is constructed using multiple consecutive sentences from at least one text sample; the text classification model to be trained is iteratively trained using the positive sample dataset and the negative sample dataset.

[0090] This application also proposes a computer-readable storage medium that stores one or more programs, the programs including instructions that, when executed by a portable electronic device including multiple applications, enable the portable electronic device to perform... Figure 2 The text classification processing method shown in the embodiment is specifically used to perform the following operations:

[0091] Acquire the speech data to be recognized; convert the speech data into text data, the text data including at least M sentences, where M is an integer greater than 1; input multiple consecutive sentences from the M sentences in the text data into a text classification model for classification processing, and obtain the classification result output by the text classification model, the multiple consecutive sentences including the sentence to be recognized, the classification processing is used to classify the sentence to be recognized in the text data; determine the category of the sentence to be recognized in the text data based on the classification result, the category includes noise category or non-noise category.

[0092] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0093] In summary, the above are merely preferred embodiments of this specification and are not intended to limit the scope of protection of this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

[0094] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.

[0095] 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.

[0096] 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 limitation, 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.

[0097] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

Claims

1. A training method for a text classification model, characterized in that, The training method includes: N speech samples are converted into N text samples, each text sample comprising at least M sentences, where M and N are both integers greater than 1; At least one sentence is selected from each of the text samples as a noise sample to form a noise sample set; A positive sample dataset is constructed using at least one noise sample from the noise sample set and multiple consecutive sentences from at least one text sample, and a negative sample dataset is constructed using multiple consecutive sentences from the at least one text sample; the negative samples in the negative sample dataset are formed by concatenating the beginning and end of the multiple consecutive sentences, and the positive samples in the positive sample dataset are formed by concatenating the beginning and end of the multiple consecutive sentences and the noise samples from the noise sample set. The text classification model to be trained is iteratively trained using the positive sample dataset and the negative sample dataset.

2. The training method for the text classification model according to claim 1, characterized in that, The step of constructing a positive sample dataset using at least one noise sample from the noise sample set and multiple consecutive sentences from the at least one text sample includes: Construct n1 positive samples, and perform a first annotation on each of the n1 positive samples to obtain n1 positive samples with the first annotation. The n1 positive samples with the first annotation constitute the positive sample dataset. The specific implementation of constructing each positive sample is as follows: randomly select m consecutive sentences from at least M sentences in any one of the text samples, and randomly select at least one noise sample from the noise sample set, concatenate the first and last parts of the m consecutive sentences, and then concatenate the first and last parts of the m consecutive sentences with the at least one noise sample to obtain the positive sample, wherein the m consecutive sentences are placed first, the at least one noise sample is placed last, and m is less than M.

3. The training method for the text classification model according to claim 1, characterized in that, The construction of a negative sample dataset using multiple consecutive sentences from at least one text sample includes: Construct n2 negative samples, and perform a second label on each of the n2 negative samples to obtain n2 negative samples with second labels. The n2 negative samples with second labels constitute the negative sample dataset. The specific implementation of constructing each negative sample is as follows: randomly select m+1 consecutive sentences from at least M sentences in any one of the text samples, concatenate the first and last sentences of the consecutive m+1 sentences to obtain the negative sample dataset, where m+1 is less than M.

4. The training method for the text classification model according to claim 1, characterized in that, The step of constructing a positive sample dataset using at least one noise sample from the noise sample set and multiple sentences from the at least one text sample, and constructing a negative sample dataset using multiple sentences from the at least one text sample, includes: Select multiple consecutive sentences from at least M sentences in the at least one text sample, and construct a positive sample dataset using at least one noise sample in the noise sample set and multiple consecutive sentences from at least M sentences in the at least one text sample; A negative sample dataset is constructed by selecting multiple consecutive sentences from at least M sentences in the at least one text sample. The number of times a series of consecutive sentences are selected from at least M sentences in each text sample is determined based on the number of sentences in each text sample. If the number of sentences in the text sample is greater than the average number of sentences in N text samples, the number of selections shall be the first value. If the number of sentences in the text sample is not greater than the average number of sentences in N text samples, the number of selections is a second value, where the first value is greater than the second value.

5. A text classification processing method, characterized in that, include: Acquire the speech data to be recognized; The speech data is converted into text data, which includes at least M sentences, where M is an integer greater than 1; Multiple consecutive sentences from the M sentences in the text data are input into a text classification model for classification processing to obtain the classification result output by the text classification model. The multiple consecutive sentences include the sentence to be identified. The classification processing is used to classify the sentence to be identified in the text data. The text classification model is trained using a positive sample dataset and a negative sample dataset. The negative samples in the negative sample dataset are formed by concatenating the beginning and end of multiple consecutive sentences from at least one text sample. The positive samples in the positive sample dataset are formed by concatenating the beginning and end of multiple consecutive sentences from the at least one text sample and noise samples from the noise sample set. The category of the sentence to be identified in the text data is determined based on the classification result, and the category includes a noise category or a non-noise category.

6. The text classification processing method according to claim 5, characterized in that, The step of inputting multiple consecutive sentences from the M sentences in the text data into a text classification model for classification processing includes: Determine the m consecutive sentences preceding the sentence to be identified from the M sentences, where m is less than M; The first and last parts of the m consecutive sentences and the sentence to be identified are concatenated to obtain a concatenated sentence, wherein the m consecutive sentences are placed first and the sentence to be identified is placed last. The concatenated sentence is input into the text classification model for classification processing, and the classification result output by the text classification model is obtained.

7. A training device for a text classification model, characterized in that, include: A conversion module is used to convert N speech samples into N text samples, each of which includes at least M sentences, where M and N are both integers greater than 1; The selection module is used to select at least one sentence from each of the text samples as a noise sample to form a noise sample set; A construction module is used to construct a positive sample dataset using at least one noise sample in the noise sample set and multiple consecutive sentences in at least one text sample, and to construct a negative sample dataset using multiple consecutive sentences in the at least one text sample; the negative samples in the negative sample dataset are formed by concatenating the beginning and end of the multiple consecutive sentences, and the positive samples in the positive sample dataset are formed by concatenating the beginning and end of the multiple consecutive sentences and the noise samples in the noise sample set. The training module is used to iteratively train the text classification model to be trained using the positive sample dataset and the negative sample dataset.

8. A text classification processing device, characterized in that, include: The acquisition module is used to acquire the speech data to be recognized; A conversion module is used to convert the voice data into text data, wherein the text data includes at least M sentences, where M is an integer greater than 1; The processing module is used to input the sentences to be identified from the M sentences in the text data into a text classification model for classification processing, and to obtain the classification result output by the text classification model. The classification processing is used to classify the sentences to be identified in the text data. The text classification model is trained using a positive sample dataset and a negative sample dataset. The negative samples in the negative sample dataset are formed by concatenating the beginning and end of multiple consecutive sentences from at least one text sample. The positive samples in the positive sample dataset are formed by concatenating the beginning and end of multiple consecutive sentences from at least one text sample and noise samples from a noise sample set. The determination module is used to determine the category of the sentence to be identified in the text data based on the classification result, wherein the category includes a noise category or a non-noise category.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the training method of the text classification model as described in any one of claims 1 to 4, or the text classification processing method as described in claim 5 or 6.

10. A computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is able to perform the training method of the text classification model as described in any one of claims 1 to 4, or the text classification processing method as described in claim 5 or 6.