Text recognition methods
By encoding and extracting features from text sequences and optimizing topic tags by combining contextual relationships, the problem of topic identification that cannot be fully structured in the entire dialogue in existing technologies is solved, and accurate topic tag prediction for multi-turn dialogues is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2023-01-11
- Publication Date
- 2026-04-21
AI Technical Summary
Existing dialogue topic identification schemes cannot fully structure the entire dialogue and cannot effectively identify the topics of multi-turn dialogues.
By acquiring text sequences and their attribute information, an encoder is used to encode the text and attribute information, extract semantic encoding vectors and initial topic labels, combine contextual relationships to perform text prediction, and optimize topic label determination.
It improves the prediction accuracy of dialogue topic tags, better identifies topics in multi-turn dialogues, and optimizes the structured processing of text.
Smart Images

Figure CN116304022B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of computer technology, and in particular to text recognition methods. Background Technology
[0002] Smart products are now integrated into all aspects of people's lives, providing convenience. Smart sales products aim to analyze and structure telephone sales calls. This structuring involves dividing the text into paragraphs and displaying the main theme of each paragraph, making the sales call easy to read, understand, and evaluate quickly. Furthermore, it allows for the extraction of best practices and sales techniques to improve the efficiency of telephone sales teams. In smart sales products, dialogue analysis is fundamental. For example, dialogue analysis converts spoken conversations into text, then breaks down rounds of dialogue into a series of themes to describe the entire conversation process.
[0003] Current dialogue topic identification schemes mainly identify the core sentences in the dialogue text, but cannot fully structure the entire dialogue. Therefore, a better solution is urgently needed. Summary of the Invention
[0004] In view of this, embodiments of this specification provide two text recognition methods. One or more embodiments of this specification also relate to two text recognition devices, a model training method, a model training device, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the embodiments of this specification, a text recognition method is provided, comprising:
[0006] Obtain a text sequence and text attribute information corresponding to at least two texts in the text sequence;
[0007] Encode the at least two texts and the text attribute information to obtain a target encoding vector;
[0008] Based on the relationship between the context encoding vectors in the target encoding vector, feature extraction is performed on the target encoding vector to obtain the semantic encoding vector and the initial topic label;
[0009] Based on the semantic encoding vector and the initial topic label, a text prediction task is performed to determine the target topic label corresponding to the at least two texts.
[0010] According to a second aspect of the embodiments of this specification, a text recognition device is provided, comprising:
[0011] The data acquisition module is configured to acquire a text sequence and text attribute information corresponding to at least two texts in the text sequence;
[0012] The data encoding module is configured to encode the at least two texts and the text attribute information to obtain a target encoding vector;
[0013] The first prediction module is configured to extract features from the target encoding vector based on the relationship between the context encoding vectors in the target encoding vector, and obtain a semantic encoding vector and initial topic labels;
[0014] The second prediction module is configured to perform a text prediction task based on the semantic encoding vector and the initial topic label to determine the target topic label corresponding to the at least two texts.
[0015] According to a third aspect of the embodiments of this specification, a text recognition method is provided, applied to a cloud-side device, comprising:
[0016] Obtain dialogue statements and text attribute information corresponding to at least two statements in the dialogue statements from the terminal device;
[0017] Encode the at least two statements and the text attribute information to obtain a target encoding vector;
[0018] Based on the relationship between the context encoding vectors in the target encoding vector, feature extraction is performed on the target encoding vector to obtain the semantic encoding vector and the initial topic label;
[0019] Based on the semantic encoding vector and the initial topic tags, a text prediction task is performed to determine the target topic tags corresponding to the at least two statements, and the target topic tags corresponding to the at least two statements are sent to the end device.
[0020] According to a fourth aspect of the embodiments of this specification, a text recognition device is provided, applied to a cloud-based device, comprising:
[0021] The data acquisition module is configured to acquire dialogue statements and text attribute information corresponding to at least two statements in the dialogue statements from the terminal device.
[0022] The data encoding module is configured to encode the at least two statements and the text attribute information to obtain a target encoding vector;
[0023] The first prediction module is configured to extract features from the target encoding vector based on the relationship between the context encoding vectors in the target encoding vector, and obtain a semantic encoding vector and initial topic labels;
[0024] The second prediction module is configured to perform a text prediction task based on the semantic encoding vector and the initial topic tags, determine the target topic tags corresponding to the at least two statements, and send the target topic tags corresponding to the at least two statements to the end device.
[0025] According to a fifth aspect of the embodiments of this specification, a model training method is provided, applied to a cloud-side device, comprising:
[0026] Obtain the first type of text, the second type of text, and the first label of the first type of text from the sample text sequence from the end device;
[0027] Based on the first type of text and the first tag of the first type of text, determine the second tag of the second type of text;
[0028] A first text prediction model is trained based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text, and the parameters of the first text prediction model are sent to the edge device.
[0029] According to a sixth aspect of the embodiments of this specification, a model training apparatus is provided, applied to a cloud-side device, comprising:
[0030] The data acquisition module is configured to acquire a first type of text, a second type of text, and a first label of the first type of text from a sample text sequence from an end-side device;
[0031] The tag determination module is configured to determine the second tag of the second type of text based on the first type of text and the first tag of the first type of text;
[0032] The model training module is configured to train a first text prediction model based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text, and send the parameters of the first text prediction model to the edge device.
[0033] According to a seventh aspect of the embodiments of this specification, a computing device is provided, comprising:
[0034] Memory and processor;
[0035] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described text recognition method.
[0036] According to an eighth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the text recognition method described above.
[0037] According to a ninth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text recognition method.
[0038] This specification provides a text recognition method, which includes: acquiring a text sequence and text attribute information corresponding to at least two texts in the text sequence; encoding the at least two texts and the text attribute information to obtain a target encoding vector; extracting features from the target encoding vector based on the relationship between context encoding vectors in the target encoding vector to obtain a semantic encoding vector and initial topic labels; and performing a text prediction task based on the semantic encoding vector and the initial topic labels to determine the target topic labels corresponding to the at least two texts. By encoding at least two texts and text attribute information to obtain the target encoding vector, since the target encoding vector is composed of encoding vectors corresponding to texts in the text sequence, the context of the text sequence can be associated, and the initial topic labels of the text can be determined based on the associated context. This further optimizes the topic labels of at least two texts, thereby determining the target topic labels and improving the accuracy of the predicted labels. Attached Figure Description
[0039] Figure 1 This is a schematic diagram illustrating a scenario of a text recognition method provided in one embodiment of this specification;
[0040] Figure 2a This is a flowchart illustrating a text recognition method provided in one embodiment of this specification;
[0041] Figure 2b This is a model architecture diagram of a text recognition method provided in one embodiment of this specification;
[0042] Figure 2c This is a schematic diagram of model training for a text recognition method provided in one embodiment of this specification;
[0043] Figure 3 This is a schematic diagram of the structure of a text recognition device provided in one embodiment of this specification;
[0044] Figure 4a This is a flowchart of another text recognition method provided in one embodiment of this specification;
[0045] Figure 4bThis is a schematic diagram of the first result of another text recognition method provided in one embodiment of this specification;
[0046] Figure 4c This is a schematic diagram of the second result of another text recognition method provided in one embodiment of this specification;
[0047] Figure 5 This is a schematic diagram of the structure of another text recognition device provided in one embodiment of this specification;
[0048] Figure 6 This is a flowchart illustrating a model training method provided in one embodiment of this specification;
[0049] Figure 7 This is a schematic diagram of the structure of a model training device provided in one embodiment of this specification;
[0050] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0051] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0052] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0053] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0054] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0055] Conditional random fields (CRFs) are discriminative probability models and a type of random field. They are often used to label or analyze sequence data, such as natural language text or biological sequences.
[0056] Transformer model: a type of neural network that learns context by tracking relationships in sequence data.
[0057] BERT encoder: A Transformer-based encoder.
[0058] This specification provides two text recognition methods, two text recognition devices, a model training method, a model training device, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.
[0059] See Figure 1 , Figure 1 The illustration shows a scenario diagram of a text recognition method according to an embodiment of this specification, which specifically includes the following steps.
[0060] Taking the application of this text recognition method to add labels to a dialogue between at least two people as an example, in a dialogue between two people, multiple rounds of dialogue text are generated. These multiple rounds of dialogue text, along with speaker information 130 and dialogue round information 140, are input to a processing device. The processing device acquires a text sequence 110 of the multiple rounds of dialogue text, and text attribute information 120 corresponding to at least two texts in the text sequence 110. This text attribute information 120 includes speaker information 130 and dialogue round information 140. The at least two texts and the text attribute information 120 are encoded to obtain a target encoding vector 150. Based on the relationship between context encoding vectors in the target encoding vector 150, feature extraction is performed on the target encoding vector 150 to obtain a semantic encoding vector and initial topic labels 160. A text prediction task is performed based on the semantic encoding vector and the initial topic labels 160 to determine the target topic labels 170 corresponding to at least two texts.
[0061] The embodiments in this specification obtain a target encoding vector by encoding at least two texts and text attribute information. This allows the context of the text sequence to be associated, and the initial topic tags of the texts to be determined based on the associated context. This enables further optimization of the topic tags of at least two texts, thereby determining the target topic tag and improving the accuracy of the predicted tag.
[0062] See Figure 2a , Figure 2aA flowchart of a text recognition method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0063] Step 202: Obtain the text sequence and the text attribute information corresponding to at least two texts in the text sequence.
[0064] Specifically, a text sequence can be a sequence of multiple texts, where text can be understood as any type of statement; for example, a text sequence consisting of multiple rounds of dialogue. Text attribute information can include speaker identifiers and dialogue round identifiers. For example, the speaker identifier is "Xiaoming", and the dialogue round identifier is "1", indicating that this is the first sentence in the entire dialogue sequence.
[0065] In practical applications, during a dialogue, multiple rounds of dialogue text are generated. These dialogue texts can form a text sequence, and these sequences will carry some attribute information. For example, the dialogue sent by Xiaoming carries the speaker identifier "Xiaoming". These dialogues will also have dialogue round information. For example, Xiaoming sends the first dialogue text, and the first dialogue text carries the dialogue round identifier "1".
[0066] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX," ... Xiaohong: "Okay, goodbye." Xiaoming's "Hello" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "1." Similarly, Xiaohong's "Who are you?" carries the speaker identifier "Xiaohong" and the dialogue turn identifier "2." Xiaoming's "I am XXX" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "3."
[0067] The embodiments in this specification obtain a text sequence and text attribute information corresponding to at least two texts in the text sequence, thereby enabling topic prediction of the text sequence in subsequent steps.
[0068] In some dialogues, the conversation can be very long, and correspondingly, there are many rounds of dialogue, resulting in a large amount of data. Based on this, a segment of the dialogue can be extracted as a dialogue sequence, that is, the long dialogue can be divided into multiple segments and identified separately. The specific method is as follows.
[0069] In some embodiments, before obtaining the text sequence and the text attribute information corresponding to at least two texts in the text sequence, the method further includes:
[0070] Get the initial text and define the text selection window;
[0071] The text sequence is determined from the initial text based on the text selection window.
[0072] The initial text can be the entire dialogue text, such as a two-hour dialogue text. The text selection window is used to extract a segment of dialogue text from the initial text. For example, from a dialogue with 1000 rounds, the text selection window can extract a sequence of text with a window length of 20, that is, extract 20 rounds of dialogue each time.
[0073] In practical applications, if there is a large amount of dialogue text, the amount of data to be processed at one time will become huge. Due to the limitations of processing resources and processing time, the entire dialogue text can be divided into multiple groups through windows, and each group can be processed separately.
[0074] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX", ... Xiaohong: "Okay, goodbye." This conversation has a total of 1000 rounds. Therefore, by selecting text sequences using a text selection window with a window length of 20, 50 sets of text sequences can be obtained.
[0075] It should be noted that, in order to ensure that the text relationships between the top and bottom can be used at the window boundaries, there will be some overlap between the text in the window. The specific implementation method is described below.
[0076] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX," ... Xiaohong: "Okay, goodbye." This conversation has a total of 1000 rounds. We can use a text selection window with a window length of 20 and a step size of 16 to extract the text sequence. The first window is 1-20, the second window is 17-36, the third window is 33-42, and so on. Text extraction is performed sequentially using the above method, meaning there is an overlap of 4 rounds of dialogue between adjacent windows.
[0077] In the case of long text, this embodiment of the specification extracts a segment of text from the entire text using a text selection window, which reduces the pressure on processing resources and allows for targeted processing of a specific segment of text, thus improving personalization capabilities.
[0078] Step 204: Encode the at least two texts and the text attribute information to obtain the target encoding vector.
[0079] Specifically, the target encoding vector can be obtained by combining the encoding vector obtained by encoding the text and the encoding vector obtained by encoding the text attribute information.
[0080] In practice, after obtaining the text sequence and its corresponding text attribute information, the text sequence and its corresponding text attribute information can be encoded into a code that a computer can recognize. During this process, the contextual information of the text sequence is combined to enable subsequent topic prediction based on the contextual information of the text sequence.
[0081] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX," ... Xiaohong: "Okay, goodbye." Xiaoming's "Hello" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "1." Similarly, Xiaohong's "Who are you?" carries the speaker identifier "Xiaohong" and the dialogue turn identifier "2." Xiaoming's "I am XXX" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "3." The text "Hello," along with the speaker identifier "Xiaoming" and the dialogue turn identifier "1," is encoded; the text "Who are you?", along with the speaker identifier "Xiaohong" and the dialogue turn identifier "2," is encoded; the text "I am XXX," along with the speaker identifier "Xiaoming" and the dialogue turn identifier "3," is encoded, and so on, until the entire dialogue between Xiaoming and Xiaohong is encoded.
[0082] Correspondingly, if the entire dialogue text is divided into windows to obtain a text sequence, the specific encoding method for the entire dialogue text is as follows.
[0083] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX," ... Xiaohong: "Okay, goodbye." This conversation has a total of 1000 rounds. Using a text selection window with a window length of 20, the text sequence can be selected, resulting in 50 sets of text sequences. Each time, one set of text sequences and its corresponding text attribute information are encoded. Then, subsequent steps are executed. After the final step, obtaining the target topic tags for this set of text sequences, the next set of text sequences and its corresponding text attribute information are encoded.
[0084] The embodiments in this specification obtain a target encoding vector by encoding at least two texts and text attribute information, so that the context information of the texts in the text sequence can be associated and encoded into a recognizable encoding vector.
[0085] Furthermore, in the process of encoding the text sequence and the corresponding text attribute information, it is necessary to encode the text sequence based on a text encoder. The text attribute information can be encoded based on any encoder, and the specific implementation method is as follows.
[0086] In one possible implementation, encoding the at least two texts and the text attribute information to obtain a target encoding vector includes:
[0087] The at least two texts are input into the first encoding network layer of the text prediction model to obtain the first encoding vector;
[0088] The text attribute information corresponding to the at least two texts is input into the second encoding network layer in the text prediction model to obtain the second encoding vector;
[0089] The target encoding vector is determined based on the first encoding vector and the second encoding vector.
[0090] The first encoding network layer can be a network layer corresponding to a text encoder for text, such as the BERT encoder, and the second encoding network layer can be any encoder, which is not limited in this embodiment.
[0091] In practical applications, text can be input into a BERT encoder to obtain a first encoded vector, and text attribute information can be input into another encoder to obtain a second encoded vector. The target encoded vector is then determined based on the first and second encoded vectors.
[0092] Continuing with the example above, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX," ... Xiaohong: "Okay, goodbye." Xiaoming's "Hello" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "1." Correspondingly, Xiaohong's "Who are you?" carries the speaker identifier "Xiaohong" and the dialogue turn identifier "2." Xiaoming: "I am XXX" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "3." The text "Hello" is input into the BERT encoder to obtain the first encoding vector for the first round. The speaker identifier "Xiaoming" and the dialogue round identifier "1" are encoded to obtain the second encoding vector for the first round. The text "Who are you?", the speaker identifier "Xiaohong", and the dialogue round identifier "2" are encoded in the same way to obtain the first and second encoding vectors for the second round. The text "I am XXX", the speaker identifier "Xiaoming", and the dialogue round identifier "3" are encoded to obtain the first and second encoding vectors for the third round, and so on, until the dialogue between Xiaoming and Xiaohong is fully encoded. The first and second encoding vectors of all rounds are combined to obtain the target encoding vector.
[0093] The embodiments in this specification use an encoder specifically for text encoding to encode the text, and also encode the text attribute information, so that the contextual information of the text can be included in the encoding vector. This allows for label prediction based on the contextual information in subsequent steps.
[0094] Furthermore, to preserve the contextual relationships within the text sequence, the encoding vectors need to be combined sequentially according to the order of the text within the sequence. The specific implementation method is as follows.
[0095] In one possible implementation, determining the target encoding vector based on the first encoding vector and the second encoding vector includes:
[0096] Determine a target text and other texts besides the target text from the at least two texts;
[0097] Obtain the first encoding vector and the second encoding vector corresponding to the target text, as well as the first encoding vector and the second encoding vector corresponding to the other text;
[0098] Based on the first encoding vector and the second encoding vector corresponding to the target text, a block encoding vector corresponding to the target text is determined; and based on the first encoding vector and the second encoding vector corresponding to the other text, a block encoding vector corresponding to the other text is determined.
[0099] The target encoding vector is determined based on the block encoding vector corresponding to the target text and the block encoding vectors corresponding to the other texts.
[0100] The block coding vector can be understood as a coding vector obtained by combining the first coding vector and the second coding vector corresponding to a round.
[0101] In practical applications, encoding can be performed sequentially according to rounds. For example, the text and text attribute information of the first round can be encoded first to obtain the group encoding vector of the first round. Then, the group encoding vectors of other rounds can be obtained in sequence. These encoding vectors can be combined in order to obtain the target encoding vector.
[0102] For example, inputting the text "Hello" into the BERT encoder yields the first encoding vector for the first round. Encoding the speaker identifier "Xiaoming" and the dialogue round identifier "1" yields the second encoding vector for the first round. Combining the first and second encoding vectors yields the group encoding vector for the first round. Similarly, encoding the text "Who are you?", the speaker identifier "Xiaohong", and the dialogue round identifier "2" yields the first and second encoding vectors for the second round. Combining these vectors yields the group encoding vector for the second round. Encoding the text "I am XXX", the speaker identifier "Xiaoming", and the dialogue round identifier "3" yields the first and second encoding vectors for the third round. Combining these vectors yields the group encoding vector for the third round. This process continues until all of Xiaoming and Xiaohong's dialogue is encoded. Finally, combining the first and second encoding vectors from all rounds yields the target encoding vector.
[0103] The embodiments in this specification combine the encoded vectors of the text in a text sequence sequentially to preserve the order and contextual information.
[0104] Step 206: Based on the relationship between the context encoding vectors in the target encoding vector, perform feature extraction on the target encoding vector to obtain the semantic encoding vector and the initial topic label.
[0105] The context encoding vector can be the encoding vector within the target encoding vector that has a contextual relationship. The semantic encoding vector can be the encoding vector after feature extraction.
[0106] In practical applications, the target encoding vector can be input into the prediction module of the text prediction model. The prediction module can then focus on encoding vectors with contextual relationships and perform feature extraction to obtain the processed semantic encoding vector and initial topic labels.
[0107] For example, inputting the text "Hello" into the BERT encoder yields the first encoding vector for the first round. Encoding the speaker identifier "Xiaoming" and the dialogue round identifier "1" yields the second encoding vector for the first round. Combining the first and second encoding vectors yields the group encoding vector for the first round. Similarly, encoding the text "Who are you?", the speaker identifier "Xiaohong", and the dialogue round identifier "2" yields the first and second encoding vectors for the second round. Combining these vectors yields the group encoding vector for the second round. Encoding the text "I am XXX", the speaker identifier "Xiaoming", and the dialogue round identifier "3" yields the first and second encoding vectors for the third round. Combining these vectors yields the group encoding vector for the third round. This process continues until all of Xiaoming and Xiaohong's dialogue is encoded. Finally, combining the first and second encoding vectors from all rounds yields the target encoding vector. The target encoding vector is input into the prediction module to obtain the semantic encoding vector and the initial topic label for each round. The initial topic label for the first round is "opening remarks", the initial topic label for the second round is "opening remarks", and the initial topic label for the third round is "opening remarks".
[0108] The embodiments in this specification extract features from the target encoding vector by utilizing the relationship between the context encoding vectors in the target encoding vector, thereby obtaining a semantic encoding vector and initial topic labels, so that subsequent steps can be optimized based on the initial topic labels.
[0109] Specifically, the prediction module mentioned above may include a feature extraction network layer and a classification network layer, thereby outputting a semantic encoding vector and initial topic labels. The specific implementation method is as follows.
[0110] In one possible implementation, the step of extracting features from the target encoding vector based on the relationship between context encoding vectors in the target encoding vector to obtain a semantic encoding vector and initial topic labels includes:
[0111] The target encoding vector is input into the feature extraction network layer in the text prediction model. In the feature extraction network layer, features are extracted from the target encoding vector according to the relationship between the context encoding vectors in the target encoding vector to obtain the semantic encoding vector.
[0112] The semantic encoding vector is input into the classification network layer of the text prediction model to determine the initial topic labels corresponding to the at least two texts.
[0113] The feature extraction network layer can be a BI-GRU network layer, and the classification network layer can be a classification network layer that generates predicted probabilities based on the output of the BI-GRU network layer, or it can be a classification network layer that directly outputs labels. This specification does not limit the specific implementation of the embodiments.
[0114] In practical applications, the target encoding vector can be input into a BI-GRU network layer to obtain a semantic encoding vector. This semantic encoding vector is then input into a classification network layer to obtain the probability of the topic label corresponding to each text in the text sequence. For example, the probability of the topic label corresponding to the text in the first round might be: "opening remarks" 80%, "greetings" 20%. The topic label with the highest probability can be selected as the topic label corresponding to the text in the first round. This process can be used to obtain the initial topic labels for all rounds.
[0115] Continuing with the previous example, the entire dialogue between Xiaoming and Xiaohong is encoded. The first and second encoding vectors from all rounds are combined to obtain the target encoding vector. This target encoding vector is then input into the BI-GRU network layer to obtain the semantic encoding vector. This semantic encoding vector is then input into the classification network layer to obtain the probability of the topic label for each round. Based on the probability of the topic label for each round, the initial topic label for each round is selected. The initial topic label for the first round is "opening remarks," the initial topic label for the second round is "opening remarks," and the initial topic label for the third round is "opening remarks."
[0116] The embodiments in this specification obtain semantic encoding vectors through the BI-GRU network layer, and then input the semantic encoding vectors into the classification network layer to obtain the probability of the topic label corresponding to each text in the text sequence. This allows for preliminary prediction of the text sequence and parsing of the context information in the text sequence, thereby enabling subsequent steps to more accurately predict the target topic label.
[0117] Furthermore, the embodiments of this specification can form a separate text recognition method based on the above method. According to the above method, topic tags corresponding to some sentences in the text sequence can be output. The specific implementation method is as follows.
[0118] In some embodiments, the text prediction model includes a second text prediction model;
[0119] Accordingly, after performing feature extraction on the target encoding vector to obtain the semantic encoding vector, the method further includes:
[0120] The semantic encoding vector is input into the classification network layer of the second text prediction model to determine the initial topic label probabilities corresponding to the at least two texts;
[0121] Based on the initial topic tag probability and the tag probability threshold, the target topic tag corresponding to at least one text in the text sequence is determined.
[0122] The second text prediction model can be a model that outputs topic labels only for the topic sentences in the text sequence. The label probability threshold can be a threshold used to determine whether to output topic labels.
[0123] In practical applications, in some cases, it is only necessary to predict the topic tags of the topic sentences in the text sequence, without needing to predict the topic tags of the entire text, or without needing to optimize the topic tags of the text in the text sequence. It should be noted that the topic sentences mentioned above refer to sentences that can express the central idea of multi-turn dialogues.
[0124] For example, in a conversation between Xiaoming and Xiaohong, the following dialogue text is included: Xiaoming: "Hello." Xiaohong: "Who are you?" Xiaoming: "I am XXX", ... Xiaohong: "Okay, goodbye." Xiaoming's "Hello" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "1". Similarly, Xiaohong's "Who are you?" carries the speaker identifier "Xiaohong" and the dialogue turn identifier "2". Xiaoming's "I am XXX" carries the speaker identifier "Xiaoming" and the dialogue turn identifier "3". The text "Hello" is input into the BERT encoder to obtain the first encoding vector for the first turn. The speaker identifier "Xiaoming" and the dialogue turn identifier "1" are encoded to obtain the second encoding vector for the first turn. The first and second encoding vectors of the first turn are combined to obtain the group encoding vector for the first turn. The text "Who are you?", along with the speaker identifier "Xiaohong" and the dialogue round identifier "2", are encoded in the manner described above to obtain the first and second encoding vectors for the second round. These vectors are then combined to obtain the group encoding vector for the second round. Similarly, the text "I am XXX", along with the speaker identifier "Xiaoming" and the dialogue round identifier "3", are encoded to obtain the first and second encoding vectors for the third round. This process is repeated until all of Xiaoming and Xiaohong's dialogue is encoded. The first and second encoding vectors from all rounds are then combined to obtain the target encoding vector. This target encoding vector is input into the prediction module to obtain the semantic encoding vector and the initial topic label for each round. The probability of the initial topic label for the first round being "opening remarks" is 50%, and the probability of the initial topic label for the first round being "greetings" is 50%. The probability of the initial topic tag being "opening remarks" in the second round is 70%, the probability of the initial topic tag being "greetings" in the second round is 30%, the probability of the initial topic tag being "opening remarks" in the third round is 90%, the probability of the initial topic tag being "greetings" in the third round is 10%, and when the tag probability threshold is 80%, the target topic tag for the third round is output.
[0125] The embodiments in this specification can utilize the BI-GRU network layer to obtain semantic encoding vectors, and then input the semantic encoding vectors into the classification network layer to obtain the probability of the topic label corresponding to each text in the text sequence. By limiting which labels to output through a threshold, the accurate subject label of the topic sentence can be obtained.
[0126] Step 208: Perform a text prediction task based on the semantic encoding vector and the initial topic label to determine the target topic label corresponding to the at least two texts.
[0127] The text prediction task can be a task that optimizes the initial topic labels of a text sequence. Correspondingly, the target topic labels can be the optimized topic labels.
[0128] In practical applications, determining the topic tag corresponding to a text based on the probability of the topic tag, such as selecting the topic tag with the highest probability, may lead to illogical issues, i.e., it may differ from the actual meaning of the text. Therefore, it is necessary to determine the target topic tag based on the relationship between the text and other texts in the text sequence.
[0129] For example, the target encoding vector is input into the prediction module to obtain the semantic encoding vector and the initial topic label for each round. The probability of the initial topic label for the first round being "opening remarks" is 50%, and the probability of the initial topic label for the first round being "small talk" is 50%. The probability of the initial topic label for the second round being "opening remarks" is 30%, the probability of the initial topic label for the second round being "small talk" is 70%, the probability of the initial topic label for the third round being "opening remarks" is 90%, and the probability of the initial topic label for the third round being "small talk" is 10%. Then, the probability of the initial topic label for the second round being "opening remarks" is changed to 70%, and the probability of the initial topic label for the second round being "small talk" is changed to 30%.
[0130] The embodiments in this specification further perform a text prediction task on the initial topic tags to make the topic tags of the text more accurate, thereby avoiding the generation of logically flawed topic tags, and can form structured topic tags for multiple rounds of text.
[0131] Furthermore, the optimization of topic labels corresponding to text in a text sequence can be achieved by adding a network layer to the model to optimize the topic labels corresponding to text in the text sequence. The specific implementation method is as follows.
[0132] Accordingly, the text prediction model in the embodiments of this specification includes a first text prediction model;
[0133] Accordingly, the step of performing a text prediction task based on the semantic encoding vector and the initial topic tags to determine the target topic tags corresponding to the at least two texts includes:
[0134] The initial topic labels corresponding to the at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to obtain the target topic labels corresponding to the at least two texts.
[0135] The first text prediction model can be a model that optimizes the topic labels corresponding to the texts in the text sequence after obtaining the initial topic labels. The label prediction network layer can be a CRF-based network layer, the purpose of which is to optimize the topic labels corresponding to the texts in the text sequence.
[0136] In practical applications, the initial topic tags and the semantic encoding vector can be processed using a CRF-based network layer to optimize the topic tags corresponding to the text in the text sequence, thereby outputting the target topic tags.
[0137] For example, inputting the target encoding vector into the prediction module yields a semantic encoding vector and initial topic labels for each round. The probability of the initial topic label being "opening remarks" in the first round is 50%, and the probability of it being "greetings" is also 50%. The probability of the initial topic label being "opening remarks" in the second round is 70%, the probability of it being "greetings" is 30%, and the probability of it being "opening remarks" in the third round is 90%, and the probability of it being "greetings" is 10%. Therefore, if the probability of the initial topic label being "opening remarks" in the second round is changed to 70%, and the probability of it being "greetings" is changed to 30%, then the output label for these three rounds will be "opening remarks."
[0138] The embodiments in this specification utilize a CRF-based network layer to optimize the topic tags corresponding to the text in a text sequence, thereby making the output tags more accurate.
[0139] Specifically, Conditional Random Fields (CRFs) are a class of discriminative models best suited for prediction tasks, where adjacent contextual information or states influence the current prediction. The specific implementation is described below.
[0140] In some embodiments, inputting the initial topic labels corresponding to the at least two texts and the semantic encoding vector into the label prediction network layer of the first text prediction model to obtain the target topic labels corresponding to the at least two texts includes:
[0141] The initial topic labels corresponding to at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to determine the relationship between the text to be processed and the previous text of the text to be processed, wherein the text to be processed is any text in the text sequence other than the first text;
[0142] Based on the relationship between the text to be processed and the preceding text, and the initial topic tags of the preceding text, the initial topic tags of the text to be processed are adjusted to obtain the target topic tags corresponding to the at least two texts.
[0143] The text to be processed can be any text in the text sequence except the first text, and the preceding text can be the text adjacent to the text to be processed in the text sequence.
[0144] In practical applications, conditional random fields can be used to make the output focus on the contextual information in the text sequence, thereby enabling optimization of the topic tags corresponding to the text in the text sequence.
[0145] For example, the target encoding vector is input into the prediction module to obtain the semantic encoding vector and the initial topic label for each round. The probability of the initial topic label being "opening remarks" in the first round is 50%, and the probability of it being "greetings" is also 50%. The probability of the initial topic label being "opening remarks" in the second round is 70%, and the probability of it being "greetings" is 30%. The probability of the initial topic label being "opening remarks" in the third round is 90%, and the probability of it being "greetings" is 10%. Since the label for the first round is "opening remarks," the probability of the initial topic label being "opening remarks" in the second round is changed to 70%, and the probability of it being "greetings" is changed to 30%. The output then shows the label for all three rounds as "opening remarks."
[0146] The embodiments in this specification improve accuracy by paying attention to contextual information and changing the initial topic tags to more logical tags.
[0147] Furthermore, before using the first text prediction model, it is necessary to train the first text prediction model to improve the accuracy of the prediction.
[0148] Specifically, the steps for training the first text prediction model include:
[0149] Obtain the first type of text, the second type of text, and the first label of the first type of text from the sample text sequence;
[0150] Based on the first type of text and the first tag of the first type of text, determine the second tag of the second type of text;
[0151] The first text prediction model is trained based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text.
[0152] The first type of text can be the text corresponding to the topic sentence in the above embodiments, and correspondingly, the first tag can be the topic tag corresponding to the topic sentence. The second type of text can be any text other than the text corresponding to the topic sentence, and correspondingly, the second tag can be...
[0153] In practical applications, the model is trained using labels at two scales: core sentence topics and smooth topics. The core sentence topic labels can be understood as the labels used to train the second text prediction model, while the smooth topic labels can be understood as the labels used to train the first text prediction model. After training, the model is used for topic recognition prediction, predicting the corresponding smooth topic labels for each turn in the entire dialogue, thus forming easily observable and understandable topic fragments. See also... Figure 2b , Figure 2b This diagram illustrates the model architecture of a text recognition method. The model takes a dialogue sequence, speaker information (salesperson or customer), and turn information as input, each turn being encoded using a BERT encoder and encoding layer. All turns within a certain window length are then combined as the dialogue context encoding, which is input into a Bi-GRU feature extraction network layer to fuse the context information. This is then mapped to the final output through a label prediction network layer (Conditional Random Field), and supervised by smooth topic labels. Simultaneously, a second text prediction model can be trained by inputting the same dialogue context encoding into another Bi-GRU to obtain context information, and then directly supervising it with core sentence topic labels. This structure combines the learning of labels at both the topic fragment and core sentence scales, allowing them to share the same encoding components and learn from each other. It also incorporates the CRF module commonly used in sequence labeling, resulting in more accurate boundaries for smooth topic labels and a greater tendency to output large, continuous smooth topic labels, leading to more reasonable topic fragments.
[0154] Specifically, the loss function used to train the first text prediction model is as follows:
[0155]
[0156] Where N represents the length of the training batch, and C represents the window length. This represents a smoothed topic label sequence for the i-th training data. This represents all possible label sequences. The function represents the scoring function in CRF, and its calculation is as follows: ,in Represents a sequence The tag for the C round, Here is the transition matrix of the CRF. The Bi-GRU round c represents the smoothed topic prediction. The predicted probability value on the label.
[0157] Accordingly, the loss function for training the second text prediction model is as follows:
[0158]
[0159] Where N represents the length of the training batch, C represents the window length, and K represents the number of classes. This represents the 0 / 1 representation of the true label of the i-th sample in the c-th round on the k-th category. This represents the probability value of the Bi-GRU predicting the core sentence topic in the k-th class during the c-th round of the i-th training data.
[0160] Finally, the call is analyzed using a model. The model takes an entire call as input, segments it according to window size, and predicts the core sentence topic and smoothed topic for each sentence within the window. After prediction, all connected topics are merged into a topic segment, and the highest score of the core sentence topic is taken as the topic segment score. The core sentence result is then used as the representative sentence of that topic segment. The final topic recognition dialogue analysis result is obtained.
[0161] Furthermore, the first text prediction model and the second text prediction model can be trained as a single model. The total loss function for training as a single model is shown below:
[0162]
[0163] in This represents the weighting parameter.
[0164] This specification's embodiments employ a multi-scale joint learning method. By smoothing the labels corresponding to topic fragments, these labels, along with the core sentence, are jointly learned by the topic recognition model, resulting in better performance. Furthermore, a CRF layer is used to further optimize the smoothed topic labels, making the output more continuous, reducing fragmentation, and making the analyzed results easier to understand and more logically structured.
[0165] Before training the first text prediction model, it is necessary to determine a topic label for all texts, and the specific implementation method is as follows.
[0166] In some embodiments, determining the second tag of the second type of text based on the first type of text and the first tag of the first type of text includes:
[0167] Determine the positional relationship between the first type of text and the second type of text, and determine the second tag of the second type of text based on the positional relationship using the first tag of the first type of text.
[0168] The positional relationship can be either before or after.
[0169] In practical applications, corresponding rules can be set to allow the topic tags of manually set topic sentences to be extended to the tags of other sentences, thereby training the model.
[0170] Specifically, the method for processing topic tags to obtain smooth topic tags is as follows.
[0171] The step of determining the second tag of the second type of text based on the positional relationship using the first tag of the first type of text includes:
[0172] If there are no other first-type texts before the target first-type text, the first tag of the target first-type text is used as the second tag of the second-type text before the target first-type text, wherein the target first-type text is any one of the first-type texts, and the other first-type texts are first-type texts other than the target first-type text;
[0173] If there is no other first-type text following the target first-type text, the first tag of the target first-type text shall be used as the second tag of the second-type text following the target first-type text;
[0174] If there are other first-type texts preceding the target first-type text, the first tag of the target first-type text shall be used as the second tag of the preceding adjacent second-type text;
[0175] If there are other first-type texts after the target first-type text, the first tag of the target first-type text is used as the second tag of the target second-type text that follows the target first-type text. The target second-type text is the second-type text between the target first-type text and the next other first-type text, and the target second-type text is not adjacent to the next other first-type text.
[0176] In practical application, the first step is to obtain manually tagged core sentence categories, which represent the dialogue topic embodied by the core sentence. A smoothing process is then applied to assign tags to non-core sentences above and below the core sentence, creating smoothed topic tags. Specifically, the smoothing process works as follows: if all core sentences are sales statements, and there is no core sentence above the current core sentence, then all sentences above it are categorized as the topic of the current core sentence. If a core sentence exists above it, then the sentence preceding the current core sentence is tagged as the topic of the current core sentence. If there is no core sentence below the current core sentence, then all sentences below it are categorized as the topic of the current core sentence. If a core sentence exists, then the next core sentence is found, and the second-to-last sentence between the current core sentence and the next core sentence is tagged as the topic of the current core sentence. After this smoothing process, all sentence cycles are tagged with smoothed topic tags.
[0177] Further, see Figure 2c , Figure 2c This is a schematic diagram illustrating the model training of a text recognition method provided in one embodiment of this specification. After obtaining the smoothed topic labels, the core sentence labels and smoothed topic labels can be input as follows: Figure 2b The model is trained within the shown model structure, enabling it to predict topic segments more accurately.
[0178] This specification provides a text recognition method, which includes: acquiring a text sequence and text attribute information corresponding to at least two texts in the text sequence; encoding the at least two texts and the text attribute information to obtain a target encoding vector; extracting features from the target encoding vector based on the relationship between context encoding vectors in the target encoding vector to obtain a semantic encoding vector and initial topic labels; and performing a text prediction task based on the semantic encoding vector and the initial topic labels to determine the target topic labels corresponding to the at least two texts. By encoding at least two texts and text attribute information to obtain a target encoding vector, the context of the text sequence can be associated, and the initial topic labels of the text can be determined based on the associated context, thereby further optimizing the topic labels of at least two texts, determining the target topic labels, and improving the accuracy of the predicted labels.
[0179] Corresponding to the above method embodiments, this specification also provides embodiments of a text recognition device. Figure 3 A schematic diagram of the structure of a text recognition device according to one embodiment of this specification is shown. Figure 3 As shown, the device includes:
[0180] The data acquisition module 302 is configured to acquire a text sequence and text attribute information corresponding to at least two texts in the text sequence;
[0181] The data encoding module 304 is configured to encode the at least two texts and the text attribute information to obtain a target encoding vector;
[0182] The first prediction module 306 is configured to extract features from the target encoding vector based on the relationship between the context encoding vectors in the target encoding vector, and obtain a semantic encoding vector and an initial topic label;
[0183] The second prediction module 308 is configured to perform a text prediction task based on the semantic encoding vector and the initial topic label to determine the target topic label corresponding to the at least two texts.
[0184] In one possible implementation, the data encoding module 304 is further configured as follows:
[0185] The at least two texts are input into the first encoding network layer of the text prediction model to obtain the first encoding vector;
[0186] The text attribute information corresponding to the at least two texts is input into the second encoding network layer in the text prediction model to obtain the second encoding vector;
[0187] The target encoding vector is determined based on the first encoding vector and the second encoding vector.
[0188] In one possible implementation, the data encoding module 304 is further configured as follows:
[0189] Determine a target text and other texts besides the target text from the at least two texts;
[0190] Obtain the first encoding vector and the second encoding vector corresponding to the target text, as well as the first encoding vector and the second encoding vector corresponding to the other text;
[0191] Based on the first encoding vector and the second encoding vector corresponding to the target text, a block encoding vector corresponding to the target text is determined; and based on the first encoding vector and the second encoding vector corresponding to the other text, a block encoding vector corresponding to the other text is determined.
[0192] The target encoding vector is determined based on the block encoding vector corresponding to the target text and the block encoding vectors corresponding to the other texts.
[0193] In one possible implementation, the first prediction module 306 is further configured as follows:
[0194] The target encoding vector is input into the feature extraction network layer in the text prediction model. In the feature extraction network layer, features are extracted from the target encoding vector according to the relationship between the context encoding vectors in the target encoding vector to obtain the semantic encoding vector.
[0195] The semantic encoding vector is input into the classification network layer of the text prediction model to determine the initial topic labels corresponding to the at least two texts.
[0196] In one possible implementation, the second prediction module 308 is further configured as follows:
[0197] The text prediction model includes a first text prediction model;
[0198] Accordingly, the step of performing a text prediction task based on the semantic encoding vector and the initial topic tags to determine the target topic tags corresponding to the at least two texts includes:
[0199] The initial topic labels corresponding to the at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to obtain the target topic labels corresponding to the at least two texts.
[0200] In one possible implementation, the second prediction module 308 is further configured as follows:
[0201] The initial topic labels corresponding to at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to determine the relationship between the text to be processed and the previous text of the text to be processed, wherein the text to be processed is any text in the text sequence other than the first text;
[0202] Based on the relationship between the text to be processed and the preceding text, and the initial topic tags of the preceding text, the initial topic tags of the text to be processed are adjusted to obtain the target topic tags corresponding to the at least two texts.
[0203] In one possible implementation, the second prediction module 308 is further configured as follows:
[0204] Obtain the first type of text, the second type of text, and the first label of the first type of text from the sample text sequence;
[0205] Based on the first type of text and the first tag of the first type of text, determine the second tag of the second type of text;
[0206] The first text prediction model is trained based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text.
[0207] In one possible implementation, the second prediction module 308 is further configured as follows:
[0208] Determine the positional relationship between the first type of text and the second type of text, and determine the second tag of the second type of text based on the positional relationship using the first tag of the first type of text.
[0209] In one possible implementation, the second prediction module 308 is further configured as follows:
[0210] If there are no other first-type texts before the target first-type text, the first tag of the target first-type text is used as the second tag of the second-type text before the target first-type text, wherein the target first-type text is any one of the first-type texts, and the other first-type texts are first-type texts other than the target first-type text;
[0211] If there is no other first-type text following the target first-type text, the first tag of the target first-type text shall be used as the second tag of the second-type text following the target first-type text;
[0212] If there are other first-type texts preceding the target first-type text, the first tag of the target first-type text shall be used as the second tag of the preceding adjacent second-type text;
[0213] If there are other first-type texts after the target first-type text, the first tag of the target first-type text is used as the second tag of the target second-type text that follows the target first-type text. The target second-type text is the second-type text between the target first-type text and the next other first-type text, and the target second-type text is not adjacent to the next other first-type text.
[0214] In one possible implementation, the first prediction module 306 is further configured as follows:
[0215] The text prediction model includes a second text prediction model;
[0216] Accordingly, after performing feature extraction on the target encoding vector to obtain the semantic encoding vector, the method further includes:
[0217] The semantic encoding vector is input into the classification network layer of the second text prediction model to determine the initial topic label probabilities corresponding to the at least two texts;
[0218] Based on the initial topic tag probability and the tag probability threshold, the target topic tag corresponding to at least one text in the text sequence is determined.
[0219] In one possible implementation, the data acquisition module 302 is further configured as follows:
[0220] Get the initial text and define the text selection window;
[0221] The text sequence is determined from the initial text based on the text selection window.
[0222] This specification provides a text recognition method, wherein the text recognition device includes: acquiring a text sequence and text attribute information corresponding to at least two texts in the text sequence; encoding the at least two texts and the text attribute information to obtain a target encoding vector; extracting features from the target encoding vector based on the relationship between context encoding vectors in the target encoding vector to obtain a semantic encoding vector and initial topic labels; and performing a text prediction task based on the semantic encoding vector and the initial topic labels to determine target topic labels corresponding to the at least two texts. By encoding at least two texts and text attribute information to obtain a target encoding vector, the context of the text sequence can be associated, and the initial topic labels of the text can be determined based on the associated context, thereby further optimizing the topic labels of at least two texts, determining the target topic labels, and improving the accuracy of the predicted labels.
[0223] The above is an illustrative scheme of a text recognition device according to this embodiment. It should be noted that the technical solution of this text recognition device and the technical solution of the above-described text recognition method belong to the same concept. For details not described in detail in the technical solution of the text recognition device, please refer to the description of the technical solution of the above-described text recognition method.
[0224] See Figure 4a , Figure 4a The present specification also provides a flowchart of another text recognition method, which is applied to a cloud-side device and includes:
[0225] Step 402: Obtain the dialogue statement and the text attribute information corresponding to at least two statements in the dialogue statement from the terminal device;
[0226] Step 404: Encode the at least two statements and the text attribute information to obtain the target encoding vector;
[0227] Step 406: Based on the relationship between the context encoding vectors in the target encoding vector, perform feature extraction on the target encoding vector to obtain the semantic encoding vector and the initial topic label;
[0228] Step 408: Perform a text prediction task based on the semantic encoding vector and the initial topic tags to determine the target topic tags corresponding to the at least two statements, and send the target topic tags corresponding to the at least two statements to the end device.
[0229] In one embodiment, during a sales conversation with a customer, the conversation is recorded on a mobile device. The recorded conversation is then transcribed into text, generating multi-turn dialogue text. This multi-turn dialogue text, along with speaker information and dialogue turn information, is input to a cloud-based device. The cloud-based device acquires the text sequence of the multi-turn dialogue text and text attribute information corresponding to at least two texts in the text sequence. This text attribute information includes speaker information and dialogue turn information. The at least two texts and the text attribute information are encoded to obtain a target encoding vector. Based on the relationship between context encoding vectors in the target encoding vector, feature extraction is performed on the target encoding vector to obtain a semantic encoding vector and initial topic labels. A text prediction task is performed based on the semantic encoding vector and the initial topic labels to determine the target topic labels corresponding to at least two texts. The cloud-based device sends the target topic labels to the mobile device. See also Figure 4b , Figure 4b This is a schematic diagram illustrating the first result of another text recognition method provided in one embodiment of this specification, displaying the dialogue content of each round, as well as the core sentence topic and smoothing topic, on the screen of a mobile device. Further, see... Figure 4c , Figure 4c This is a schematic diagram illustrating the second result of another text recognition method provided in one embodiment of this specification. The call topic can also be displayed in the form of cards, allowing for a clear visual representation of the proportion of relevant call content based on the length of the topic. Furthermore, clicking on the corresponding card displays the corresponding audio content.
[0230] The text recognition method described in this specification encodes at least two texts and their attribute information to obtain a target encoding vector. It can associate the context of a text sequence and determine initial topic tags based on the associated context. This allows for further optimization of the topic tags of at least two texts, thereby determining the target topic tag and improving the accuracy of the predicted tag. Furthermore, it leverages the computing power and processing resources of cloud devices, enhancing the efficiency and convenience of text recognition.
[0231] Corresponding to the above method embodiments, this specification also provides another embodiment of a text recognition device. Figure 5 A schematic diagram of another text recognition device provided in one embodiment of this specification is shown. Figure 5 As shown, this device is applied to cloud-side equipment and includes:
[0232] The data acquisition module 502 is configured to acquire dialogue statements and text attribute information corresponding to at least two statements in the dialogue statements from the terminal device.
[0233] The data encoding module 504 is configured to encode the at least two statements and the text attribute information to obtain a target encoding vector;
[0234] The first prediction module 506 is configured to extract features from the target encoding vector based on the relationship between the context encoding vectors in the target encoding vector, and obtain a semantic encoding vector and an initial topic label;
[0235] The second prediction module 508 is configured to perform a text prediction task based on the semantic encoding vector and the initial topic tags, determine the target topic tags corresponding to the at least two statements, and send the target topic tags corresponding to the at least two statements to the end device.
[0236] The above is an illustrative scheme of a text recognition device according to this embodiment. It should be noted that the technical solution of this text recognition device and the technical solution of the above-described text recognition method belong to the same concept. For details not described in detail in the technical solution of the text recognition device, please refer to the description of the technical solution of the above-described text recognition method.
[0237] This manual also provides a model training method; see [link / reference] Figure 6 , Figure 6 A flowchart of a model training method applied to cloud-side devices is shown, including:
[0238] Step 602: Obtain the first type of text, the second type of text, and the first tag of the first type of text from the sample text sequence from the end device;
[0239] Step 604: Determine the second tag of the second type of text based on the first type of text and the first tag of the first type of text;
[0240] Step 606: Train a first text prediction model based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text, and send the parameters of the first text prediction model to the end device.
[0241] The model training method in this embodiment is the same as the model training steps in the above embodiments, and the corresponding steps can be found in the above description, so they will not be repeated here. By performing model training on a cloud device, the computing power and processing resources of the cloud device can be utilized, improving the efficiency and convenience of model training.
[0242] Corresponding to the above method embodiments, this specification also provides embodiments of a model training device. Figure 7 A schematic diagram of a model training apparatus provided in one embodiment of this specification is shown. Figure 7 As shown, the device includes: applied to cloud-side equipment, including:
[0243] The data acquisition module 702 is configured to acquire a first type of text, a second type of text, and a first label of the first type of text from a sample text sequence from an end device;
[0244] The tag determination module 704 is configured to determine the second tag of the second type of text based on the first type of text and the first tag of the first type of text;
[0245] The model training module 706 is configured to train a first text prediction model based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text, and send the parameters of the first text prediction model to the end device.
[0246] The above is an illustrative scheme of a model training device according to this embodiment. It should be noted that the technical solution of this model training device and the technical solution of the model training method described above belong to the same concept. For details not described in detail in the technical solution of the model training device, please refer to the description of the technical solution of the model training method described above.
[0247] Figure 8 A structural block diagram of a computing device 800 according to one embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.
[0248] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0249] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0250] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 800 can also be a mobile or stationary server.
[0251] The processor 820 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the aforementioned data processing method. The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the aforementioned text recognition method belong to the same concept; details not described in detail in the technical solution of the computing device can be found in the description of the technical solution of the aforementioned text recognition method.
[0252] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described text recognition method.
[0253] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the text recognition method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the text recognition method described above.
[0254] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described text recognition method.
[0255] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the aforementioned text recognition method belong to the same concept. Details not described in detail in the computer program's technical solution can be found in the description of the technical solution of the aforementioned text recognition method.
[0256] 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.
[0257] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0258] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0259] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0260] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A text recognition method, comprising: Obtain initial text, determine a text selection window based on the dialogue turn of the initial text, and determine a text sequence from the initial text based on the text selection window; Obtain the text sequence and text attribute information corresponding to at least two texts in the text sequence, wherein the text attribute information includes speaker information and dialogue turn information; The at least two texts and the text attribute information are encoded. The at least two texts are input into the first encoding network layer in the text prediction model to obtain the first encoding vector. The text attribute information corresponding to the at least two texts is input into the second encoding network layer in the text prediction model to obtain the second encoding vector. The target encoding vector is obtained based on the first encoding vector and the second encoding vector. Based on the relationship between the context encoding vectors in the target encoding vector, feature extraction is performed on the target encoding vector to obtain the semantic encoding vector and the initial topic label; The method for obtaining the semantic encoding vector and the initial topic label includes: inputting the target encoding vector into the prediction module in the text prediction model, and extracting features by focusing on the context encoding vector through the prediction module to obtain the semantic encoding vector and the initial topic label. The prediction module includes a BI-GRU network layer. Based on the semantic encoding vector and the initial topic label, a text prediction task is performed through a first text prediction model to determine the target topic labels corresponding to the at least two texts. Specifically, the first text prediction model represents a model that optimizes the topic labels corresponding to the texts in the text sequence after obtaining the initial topic label. The first text prediction model includes a label network prediction layer based on CRF. After obtaining the semantic encoding vector, the method for obtaining the target topic label includes: inputting the semantic encoding vector into the classification network layer in the second text prediction model to determine the initial topic label probabilities corresponding to the at least two texts; and determining the target topic label corresponding to at least one text in the text sequence based on the initial topic label probabilities and the label probability threshold, wherein the second text prediction model is a model that outputs topic labels for topic sentences in the text sequence.
2. The method according to claim 1, wherein obtaining the target encoding vector based on the first encoding vector and the second encoding vector comprises: Determine a target text and other texts besides the target text from the at least two texts; Obtain the first encoding vector and the second encoding vector corresponding to the target text, as well as the first encoding vector and the second encoding vector corresponding to the other text; Based on the first encoding vector and the second encoding vector corresponding to the target text, a block encoding vector corresponding to the target text is determined; and based on the first encoding vector and the second encoding vector corresponding to the other text, a block encoding vector corresponding to the other text is determined. The target encoding vector is determined based on the block encoding vector corresponding to the target text and the block encoding vectors corresponding to the other texts.
3. The method according to claim 1, wherein extracting features from the target encoding vector based on the relationship between context encoding vectors in the target encoding vector to obtain a semantic encoding vector and initial topic labels includes: The target encoding vector is input into the feature extraction network layer in the text prediction model. In the feature extraction network layer, features are extracted from the target encoding vector according to the relationship between the context encoding vectors in the target encoding vector to obtain the semantic encoding vector. The semantic encoding vector is input into the classification network layer of the text prediction model to determine the initial topic labels corresponding to the at least two texts.
4. The method according to claim 1 or 3, wherein the text prediction model includes a first text prediction model; Accordingly, the step of determining the target topic labels corresponding to the at least two texts by performing a text prediction task through a first text prediction model based on the semantic encoding vector and the initial topic labels includes: The initial topic labels corresponding to the at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to obtain the target topic labels corresponding to the at least two texts.
5. The method according to claim 4, wherein inputting the initial topic labels corresponding to the at least two texts and the semantic encoding vector into the label prediction network layer of the first text prediction model to obtain the target topic labels corresponding to the at least two texts includes: The initial topic labels corresponding to the at least two texts and the semantic encoding vector are input into the label prediction network layer in the first text prediction model to determine the relationship between the text to be processed and the previous text of the text to be processed, wherein the text to be processed is any text in the text sequence other than the first text; Based on the relationship between the text to be processed and the preceding text, and the initial topic tags of the preceding text, the initial topic tags of the text to be processed are adjusted to obtain the target topic tags corresponding to the at least two texts.
6. The method according to claim 4, wherein the step of training the first text prediction model includes: Obtain the first type of text, the second type of text, and the first label of the first type of text from the sample text sequence; Based on the first type of text and the first tag of the first type of text, determine the second tag of the second type of text; The first text prediction model is trained based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text.
7. The method according to claim 6, wherein determining the second tag of the second type of text based on the first type of text and the first tag of the first type of text comprises: Determine the positional relationship between the first type of text and the second type of text, and determine the second tag of the second type of text based on the positional relationship using the first tag of the first type of text.
8. The method according to claim 7, wherein determining the second tag of the second type of text based on the positional relationship using the first tag of the first type of text comprises: If there are no other first-type texts before the target first-type text, the first tag of the target first-type text is used as the second tag of the second-type text before the target first-type text, wherein the target first-type text is any one of the first-type texts, and the other first-type texts are first-type texts other than the target first-type text; If there is no other first-type text following the target first-type text, the first tag of the target first-type text shall be used as the second tag of the second-type text following the target first-type text; If there are other first-type texts preceding the target first-type text, the first tag of the target first-type text shall be used as the second tag of the preceding adjacent second-type text; If there are other first-type texts after the target first-type text, the first tag of the target first-type text is used as the second tag of the target second-type text that follows the target first-type text. The target second-type text is the second-type text between the target first-type text and the next other first-type text, and the target second-type text is not adjacent to the next other first-type text.
9. The method of claim 1, wherein the text sequence comprises dialogue text of at least two statements.
10. A text recognition method, applied to a cloud-based device, comprising: The device acquires a dialogue statement and text attribute information corresponding to at least two statements in the dialogue statement. The method of acquiring the dialogue statement includes: acquiring the dialogue statement, determining a text selection window based on the dialogue turn of the dialogue statement, and determining a text sequence from the dialogue statement based on the text selection window. The text attribute information includes speaker information and dialogue turn information. The at least two statements and the text attribute information are encoded. The at least two statements are input into the first encoding network layer in the text prediction model to obtain the first encoding vector. The text attribute information corresponding to the at least two statements is input into the second encoding network layer in the text prediction model to obtain the second encoding vector. The target encoding vector is obtained based on the first encoding vector and the second encoding vector. Based on the relationship between the context encoding vectors in the target encoding vector, feature extraction is performed on the target encoding vector to obtain the semantic encoding vector and the initial topic label; The method for obtaining the semantic encoding vector and the initial topic label includes: inputting the target encoding vector into the prediction module in the text prediction model, and extracting features by focusing on the context encoding vector through the prediction module to obtain the semantic encoding vector and the initial topic label. The prediction module includes a BI-GRU network layer. Based on the semantic encoding vector and the initial topic label, a text prediction task is performed through a first text prediction model to determine the target topic labels corresponding to the at least two sentences. Specifically, the first text prediction model represents a model that optimizes the topic labels corresponding to the texts in the text sequence after obtaining the initial topic labels. The first text prediction model includes a label network prediction layer based on CRF. After obtaining the semantic encoding vector, the method for obtaining the target topic label includes: inputting the semantic encoding vector into the classification network layer in the second text prediction model to determine the initial topic label probabilities corresponding to the at least two sentences; determining the target topic label corresponding to at least one text in the text sequence based on the initial topic label probabilities and the label probability threshold, wherein the second text prediction model is a model that outputs topic labels for topic sentences in the text sequence, and sending the target topic labels corresponding to the at least two sentences to the end device.
11. A model training method applied to cloud-side devices, comprising: Obtain the first type of text, the second type of text, and the first label of the first type of text from the sample text sequence from the end device; Based on the first type of text and the first tag of the first type of text, determine the second tag of the second type of text; A first text prediction model is trained based on the first type of text, the first label of the first type of text, the second type of text, and the second label of the second type of text. The parameters of the first text prediction model are sent to the end device. The first text prediction model is used in the text recognition method of claim 1.
Citation Information
Patent Citations
Address information text extraction method and related equipment
CN111104802A
Named entity identification method and system based on semi-supervised small sample expansion
CN112183099A