Text segmentation position recognition method and system, electronic device and storage medium
Features are extracted through CNN and Bi-LSTM models and combined with the CRF model and Viterbi algorithm to identify the sentence segmentation positions of speech recognition text data. This solves the problem of low accuracy caused by unsegmentation of speech recognition text data and improves the accuracy of subsequent tasks.
Patent Information
- Application Number
- CN202010626376.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-01
- Publication Date
- 2024-10-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, the text data obtained by speech recognition is not segmented, resulting in low accuracy in subsequent intent recognition, named entity recognition, classification tasks, etc.
The CNN model is used to extract local features of character vectors and the Bi-LSTM model is used to extract semantic features of word vectors. The CRF model and Viterbi algorithm are combined to identify the sentence segmentation positions of text data.
It improves the accuracy of subsequent intent recognition, named entity recognition, classification tasks, etc., and improves the recognition effect of text data through accurate sentence segmentation position processing.
Smart Images

Figure CN111753524B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a method and system for identifying text segmentation positions, electronic equipment and storage medium. Background Art
[0002] With the development of artificial intelligence technology, many repetitive tasks will be completed by machines, and customer service robots are an example. In order for customer service robots to better serve customers and downstream tasks, the accuracy of intent recognition and named entity recognition of customer words is crucial. The sentence segmentation function plays a bridging role in the above process. When the customer's words are too long to be correctly recognized or classified, the long sentence is truncated, that is, the long sentence is turned into a short sentence to improve the accuracy of subsequent intent recognition, named entity recognition, classification tasks, etc.
[0003] Currently, deep learning is widely used in the field of artificial intelligence. Models based on deep learning can achieve the function of feature extraction well as the number of layers increases. Compared with traditional machine learning methods, when using deep learning for engineering applications, the step of manual feature extraction is omitted and better results can often be achieved. Therefore, deep learning is widely used in the fields of text, image, audio, etc. Summary of the invention
[0004] The technical problem to be solved by the present invention is to overcome the defect in the prior art that the text data obtained by speech recognition has low accuracy in subsequent downstream tasks such as intent recognition, named entity recognition, and classification tasks due to the lack of sentence segmentation, and to provide a method and system for identifying the sentence segmentation position of the text, an electronic device, and a storage medium.
[0005] The present invention solves the above technical problems through the following technical solutions:
[0006] The present invention provides a method for identifying text segmentation positions, comprising the following steps:
[0007] Receiving text data after speech recognition, and splitting words in the text data into characters;
[0008] Mapping each character into a character vector, and using a CNN (Convolutional Neural Networks) model to extract local features of the character vector to obtain a first latent vector;
[0009] Mapping the words in the text data into word vectors, and extracting semantic features of each word vector using a Bidirectional Long Short-Term Memory (LSTM) model to obtain a second latent vector;
[0010] Concatenate the first latent vector and the second latent vector, perform linear transformation on the concatenated result, and then input it into a CRF (Conditional Random Field) model;
[0011] The output result of the CRF model is decoded using the Viterbi algorithm to extract the global optimal output sequence, and the label of each character vector is predicted and output according to the global optimal output sequence, wherein the label is used to indicate whether the corresponding character is followed by a sentence segmentation position;
[0012] All sentence segmentation positions of the text data are identified according to the label corresponding to each character.
[0013] Preferably, the step of identifying all sentence segmentation positions of the text data according to the label corresponding to each character specifically comprises the following steps:
[0014] If the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position, then determining whether the character string composed of the target character and the character at the next position is a word;
[0015] If not, then the target character is identified as a sentence segmentation position.
[0016] Preferably, the step of identifying all sentence segmentation positions of the text data according to the label corresponding to each character specifically comprises the following steps:
[0017] If the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position, and the target character is an English character, then determining whether the next position of the target character is an English character;
[0018] If not, then the target character is identified as a sentence segmentation position.
[0019] Preferably, the CNN model, the Bi-LSTM model and the CRF model are trained based on the following steps:
[0020] Adding a label to the target text data with manually marked segmentation positions to indicate whether it is a segmentation position;
[0021] Splitting words in the target text data into characters;
[0022] Map each character to a character vector, and use the CNN model to extract the local features of each character vector to obtain the first latent feature vector;
[0023] Mapping the words in the target text data into word vectors, and using the Bi-LSTM model to extract the semantic features of each word vector to obtain a second latent vector;
[0024] Concatenate the first latent vector and the second latent vector, and perform linear transformation on the concatenated result and input it into the CRF model;
[0025] Use the Viterbi algorithm to decode the output of the CRF model, extract the global optimal output sequence, and predict the label of each character vector based on the global optimal output sequence;
[0026] The parameters of the CNN model, the Bi-LSTM model, and the CRF model are adjusted according to the manually marked sentence segmentation positions and the predicted labels until the loss values corresponding to the predicted labels converge.
[0027] Preferably, before concatenating the first latent vector and the second latent vector, the following steps are included: concatenating the second latent vector according to the last dimension.
[0028] The present invention also provides a text segmentation position recognition system, comprising:
[0029] A receiving module, used for receiving text data after speech recognition, and splitting words in the text data into characters;
[0030] A local feature extraction module, used to map each character into a character vector, and use a CNN model to extract local features of the character vector to obtain a first latent vector;
[0031] A semantic feature extraction module, used to map the words in the text data into word vectors, and extract the semantic features of each word vector using a Bi-LSTM model to obtain a second latent vector;
[0032] A concatenation module, configured to concatenate the first latent vector and the second latent vector, and perform a linear transformation on the concatenation result and then input it into the CRF model;
[0033] A prediction module is used to decode the output result of the CRF model using the Viterbi algorithm, extract the global optimal output sequence, and predict and output the label of each character vector according to the global optimal output sequence, wherein the label is used to indicate whether the corresponding character is followed by a sentence segmentation position;
[0034] The recognition module is used to recognize all sentence segmentation positions of the text data according to the label corresponding to each character.
[0035] Preferably, the recognition module is specifically used to determine whether the character string consisting of the target character and the characters at the next position is a word when the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position; if not, recognize that the target character is followed by a sentence segmentation position.
[0036] Preferably, the recognition module is specifically used to determine whether the next position of the target character is an English character when the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position and the target character is an English character. If not, recognize that the target character is followed by a sentence segmentation position.
[0037] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned methods for identifying text segmentation positions when executing the computer program.
[0038] The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for identifying the text segmentation position described in any one of the above items are implemented.
[0039] The positive and progressive effects of the present invention are: using the CNN model to extract the local features of the character vectors in the text data to obtain the first latent vector, and using the Bi-LSTM model to extract the semantic features of the word vectors in the text data to obtain the second latent vector, and the first latent vector and the second latent vector are spliced, the splicing result is linearly transformed and input into the CRF model, and then the output result of the CRF model is decoded using the Viterbi algorithm, the global optimal output sequence is extracted, and the label of each character vector is predicted and output according to the global optimal output sequence, and finally all the segmentation positions of the text data are identified according to the label corresponding to each character. Compared with the prior art in which the text data obtained by speech recognition is not segmented, the local features and semantic features are extracted respectively by the CNN model and the Bi-LSTM model, and the CRF model is used as the output layer, so as to realize the identification of the text segmentation position, thereby improving the accuracy of the subsequent downstream tasks such as intent recognition, named entity recognition, and classification tasks. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 A flowchart of a method for identifying text segmentation positions provided in Example 1 of the present invention.
[0041] Figure 2 A framework diagram of a method for identifying text segmentation positions provided in Example 1 of the present invention.
[0042] Figure 3 A structural block diagram of a text segmentation position recognition system provided in Example 2 of the present invention.
[0043] Figure 4 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0044] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0045] Example 1
[0046] This embodiment provides a method for identifying the position of a text segment. Figure 1 , the text segmentation position recognition method comprises the following steps:
[0047] Step S101: receiving text data after speech recognition, and splitting words in the text data into characters.
[0048] In the specific implementation, the customer service robot converts human speech into text through ASR (Automatic Speech Recognition) to obtain the text data in step S101. Among them, the text data obtained after ASR speech recognition is some single words or words without any punctuation marks, such as ["Hello", "Excuse me", "Order", "No.", "Yes", "How much"]. The result without punctuation marks directly leads to the low accuracy of subsequent tasks, such as user speech intention matching, user speech scene recognition, user speech emotion classification, etc. However, segmenting the recognized text data and processing the segmented sentences for downstream tasks can greatly improve the accuracy of downstream tasks.
[0049] In this implementation, for the text data of ["Hello", "Excuse me", "Order", "No.", "Yes", "How much"], the word "Hello" is split into the characters "you" and "OK", the word "Excuse me" is split into the characters "please" and "ask", the word "Order" is split into the characters "Order" and "Single", and the word "How much" is split into the characters "more" and "less".
[0050] In an optional implementation, step S101 further includes preprocessing the text data and placing the obtained words into different sublists. After preprocessing, the text data in the above example places "hello", "please ask", "order", "number", "yes" and "how much" into six sublists respectively.
[0051] In an optional embodiment, the above preprocessing comprises the following steps:
[0052] Replace the numbers or English expressions in the text data with uniform English characters.
[0053] For example, English character l is used to replace numbers, and English character a is used to replace English expressions. For the text data ["Good morning", "guest", "booked", "read", "three", "room", "luxury", "double", "room", "C", "please ask", "order", "have", "receive", "have"], the result after preprocessing in this embodiment is ["a", "guest", "booked", "read", "l", "room", "luxury", "double", "room", "a", "please ask", "order", "have", "receive", "have"].
[0054] Step S102: Map each character into a character vector, and use the CNN model to extract local features of each character vector to obtain a first latent vector.
[0055] The first latent vector obtained in step S102 is a character-level latent feature.
[0056] In the above example, each character is mapped to a character vector (char Embed), for example, the character "you" is mapped to the character vector c1, the character "good" is mapped to the character vector c2, the character "please" is mapped to the character vector c3, the character "ask" is mapped to the character vector c4, the character "order" is mapped to the character vector c5, the character "single" is mapped to the character vector c6, the character "number" is mapped to the character vector c7, the character "is" is mapped to the character vector c8, the character "more" is mapped to the character vector c9, and the character "less" is mapped to the character vector c 10 .
[0057] CNN models are usually used as feature extractors for images. When CNN models are used to extract features from text data, the width of the Window size is set to 2, 3, and 4, and the length is set to the Embedding size of the input text data, which is equivalent to extracting bigram-char, tri-gram-char, and four-gram-char. After the pooling layer, the local features of the text data can be well extracted.
[0058] Reference Figure 2 , for the character vector c i , use the CNN model to extract local features and get the first latent vector
[0059] Step S103: Map the words in the text data into word vectors, and use the Bi-LSTM model to extract the semantic features of each word vector to obtain a second latent vector.
[0060] The second latent vector obtained in step S103 is a word-level latent feature.
[0061] Bi-LSTM is a commonly used feature extractor in NLP (Natural Language Processing). The cooperation between its input gate, forget gate and memory cells can effectively solve the problem that the RNN (Recurrent Neural Network) model cannot grasp the global information of the text. The addition operation between the forget gate and memory cells can also effectively solve the gradient attenuation problem of deep learning models when the sequence is too long.
[0062] In this implementation, for the text data of ["Hello", "Excuse me", "Order", "No.", "Yes", "How much"], the words therein are mapped into word vectors (Word Embed), for example, "Hello" is mapped into word vector x1, "Excuse me" is mapped into word vector x2, "Order" is mapped into word vector x3, "No." is mapped into word vector x4, "Yes" is mapped into word vector x5, and "How much" is mapped into word vector x6.
[0063] Reference Figure 2 , for the word vector x i , use Bi-LSTM to extract semantic features and get the second latent vector h at time i i :
[0064]
[0065]
[0066] Step S104: concatenate the first latent vector and the second latent vector, and perform linear transformation on the concatenated result and input it into the CRF model.
[0067] The Concat() method is used to concatenate two or more arrays. It does not change the existing arrays, but only returns a copy of the concatenated arrays. Figure 2 , the first vector and the second latent vector are concatenated. In a specific implementation, the concatenated result is linearly transformed and then input into the CRF model.
[0068] The CRF model can take into account both the probability of label->char injection and the probability of label->label transition. Therefore, the CRF model is used as the output layer after feature extraction to predict the label of the character vector.
[0069] In an optional embodiment, referring to Figure 2, before concatenating the above first hidden vector and the above second hidden vector, the following steps are included: perform a concatenation Concat process on the second hidden vector output in step S103 according to the last dimension.
[0070] Step S105: Use the Viterbi algorithm to decode the output result of the CRF model, extract the globally optimal output sequence, and predict and output the label of each character vector according to the globally optimal output sequence, where the label is used to characterize whether the position after the corresponding character is a sentence-breaking position.
[0071] The Viterbi algorithm has the characteristic of obtaining the globally optimal sequence and is responsible for the final decoding work of the output sequence of the CRF model.
[0072] In this embodiment, the cooperation of the CRF model with the CNN model and the Bi-LSTM model can perfectly realize the sentence-breaking position of the ASR-recognized text data.
[0073] Step S106: Identify all sentence-breaking positions of the text data according to the label corresponding to each character.
[0074] In an optional implementation manner, step S106 specifically includes:
[0075] If the label corresponding to the target character characterizes that the position after the target character is a sentence-breaking position, then determine whether the string formed by the target character and the character at the next position is a word;
[0076] If so, identify that the position after the target character is not a sentence-breaking position; if not, identify that the position after the target character is a sentence-breaking position.
[0077] In an example, for the character vector mapped from the target character "您", the label predicted and output in step S104 characterizes that the position after the target character "您" is a sentence-breaking position. By determining that the string "您好" formed by the target character "您" and the character "好" at the next position is a word, it is finally identified that the position after the target character "您" is not a sentence-breaking position. In this implementation manner, whether the formed string is a word is determined according to each substring of the input ASR recognition result. Among them, the text data received in step S101 is the result of word segmentation recognized by ASR.
[0078] In another example, for the character vector mapped from the target character "好", the label predicted and output in step S105 characterizes that the position after the target character "好" is a sentence-breaking position. By determining that the string "好请" formed by the target character "好" and the character "请" at the next position is not a word, it is finally identified that the position after the target character "好" is a sentence-breaking position.
[0079] In an alternative optional embodiment, the text data carries English characters, such as ["guest", "Zhang", "San", "of", "order", "number", "Can", "check", "it", "Thank", "you"]. Step S106 specifically includes:
[0080] If the tag corresponding to the target character indicates that the position after the target character is a sentence-breaking position, and the target character is an English character, then determine whether the next position of the target character is an English character.
[0081] If the next position of the target character is not an English character, then recognize that the position after the target character is a sentence-breaking position. In one example, for the character vector mapped by the target character "k" (the word it belongs to is "check"), the tag predicted and output by step S105 indicates that the position after the target character "k" is a sentence-breaking position. By determining that the next position of the target character "k", which is "one", is not an English character, it is finally recognized that the position after the target character "k" is a sentence-breaking position.
[0082] If the next position of the target character is an English character, then further determine whether the word where the target character is located and the word where the next English character is located are stored in two sub-lists respectively. If these two words are stored in two sub-lists respectively, then finally recognize that the position after the target character is a sentence-breaking position, and a space is added between these two words during decoding.
[0083] In one example, for the character vector mapped by the target character "k" (the word it belongs to is "Thank"), the tag predicted and output by step S105 indicates that the position after the target character "k" is a sentence-breaking position. By determining that the next position of the target character "k", which is "y", is an English character, and further determining that the word "Thank" where the target character "k" is located and the word "you" where the next English character "y" is located are stored in two sub-lists respectively, then finally recognize that the position after the target character "k" is a sentence-breaking position, and a space is added between these two words during decoding, that is, "Thank you" is output instead of "Thankyou".
[0084] In an optional embodiment, the text data carries numbers, such as ["guest", "of", "order", "number", "is", "2345433"]. To prevent incorrect breaking of numerical expressions, step S106 specifically includes:
[0085] If the tag corresponding to the target character indicates that the position after the target character is a sentence-breaking position, and the target character is a number, then determine whether the next position of the target character is a number. If the next position is also a number, then finally recognize that the position after the target character is not a sentence-breaking position.
[0086] In the above example, for the character vector mapped after the target character "2", the label representation output by step S105 predicts that the target character "2" is followed by a sentence break position. By judging that the next position "3" of the target character "2" is a number, it is finally recognized that the target character "2" is not followed by a sentence break position.
[0087] In an optional implementation, the CNN model in step S102, the Bi-LSTM model in step S103, and the CRF model in step S104 are trained based on the following steps:
[0088] Step S201: adding a label for indicating whether it is a sentence segmentation position to the target text data with manually marked sentence segmentation positions.
[0089] In an optional implementation, two labels are added to the target text data with manually marked sentence segmentation positions. Specifically, label O is added to the position where the sentence needs to be segmented, and label N is added to the characters at other positions. For example, for the manually marked target text data "Hello. This is Ctrip.com.", the label added is NONNNNNNNNO.
[0090] In another optional implementation, four labels are added to the target text data with manually marked segmentation positions. Specifically, label B is added to the beginning characters of a sentence, label I is added to the middle characters, label O is added to the previous position that needs to be disconnected, and label E is added to the position that needs to be disconnected. For example, for the target text data "Hello. This is Ctrip.com." with manually marked segmentation positions, the label added is BEBIIIIIIOE.
[0091] Step S202: split the words in the target text data into characters.
[0092] In an optional implementation, the target text data is preprocessed. Specifically, numbers or English expressions in the target text data are replaced with unified English characters.
[0093] It should be noted that the preprocessing performed in the training model stage and the actual use model stage is the same. In other words, if the target text data is preprocessed in the training model stage, the text data also needs to be preprocessed in the actual use model stage, that is, before executing step S102.
[0094] Step S203: Map each character into a character vector, and use the CNN model to extract local features of each character vector to obtain a first latent vector.
[0095] In the above example, the words in the target text data ["Hello", "I", "here", "am", "Ctrip", "travel", "network"] are split into "您", "好", "我", "这", "边", "是", "携", "程", "旅", "行", "网", and each character is mapped to a character vector. For example, the character "您" is mapped to the character vector c1, the character "好" is mapped to the character vector c2, and the character "我" is mapped to the character vector c3.
[0096] Step S204: Map the words in the target text data to word vectors, and use the Bi-LSTM model to extract the semantic features of each word vector to obtain the second hidden vector.
[0097] Step S205: Concatenate the first hidden vector and the second hidden vector, and input the concatenated result into the CRF model after linear transformation.
[0098] Step S206: Use the Viterbi algorithm to decode the output result of the CRF model, extract the globally optimal output sequence, and predict the label of each character vector according to the globally optimal output sequence.
[0099] Step S207: Adjust the parameters of the CNN model, the Bi-LSTM model, and the CRF model according to the manually marked sentence segmentation positions and the predicted labels until the loss value corresponding to the predicted labels converges.
[0100] In step S207, for each character vector, if the sentence segmentation position represented by the predicted label is different from the manually marked sentence segmentation position. For example, the predicted label represents that there is a sentence segmentation position after the character "您", but there is no manually marked sentence segmentation position after the character "您". This situation will cause the loss value corresponding to the model to increase. At this time, it is necessary to adjust the parameters of the CNN model, the Bi-LSTM model, and the CRF model, and then use the adjusted parameters to execute steps 203-207 again.
[0101] In step S207, for each character vector, if the sentence segmentation position represented by the predicted label is the same as the manually marked sentence segmentation position. For example, the predicted label represents that there is a sentence segmentation position after the character "好", and there is also a manually marked sentence segmentation position after the character "好". In this case, the loss value corresponding to the model will decrease. Determine whether the loss value is lower than the preset threshold, that is, determine whether the loss value has converged. If it has converged, stop adjusting the parameters of the CNN model, the Bi-LSTM model, and the CRF model. That is, the CNN model, the Bi-LSTM model, and the CRF model are trained, and the trained model can be used to predict the sentence segmentation position of the newly input text data.
[0102] In this embodiment, the CNN model, Bi-LSTM model and CRF model are used to learn the correct sentence segmentation samples that have been manually marked, and the information of the position where each sentence in the training sample needs to be broken is learned. Then, the model with a lower loss value is used to predict the newly input text data, so as to obtain the sentence segmentation position of the text data.
[0103] Example 2
[0104] This embodiment provides a text segmentation position recognition system, referring to Figure 3 The text segmentation position recognition system 20 includes a receiving module 21, a local feature extraction module 22, a semantic feature extraction module 23, a splicing module 24, a prediction module 25 and a recognition module 26.
[0105] The receiving module 21 is used to receive text data after speech recognition and split words in the text data into characters.
[0106] The local feature extraction module 22 is used to map each character into a character vector, and use the CNN model to extract the local features of the character vector to obtain a first latent vector.
[0107] The semantic feature extraction module 23 is used to map the words in the text data into word vectors, and use the Bi-LSTM model to extract the semantic features of each word vector to obtain a second latent vector.
[0108] The concatenation module 24 is used to concatenate the first latent vector and the second latent vector, and perform linear transformation on the concatenation result and input it into the CRF model.
[0109] The prediction module 25 is used to decode the output result of the CRF model using the Viterbi algorithm, extract the global optimal output sequence, and predict and output the label of the character vector according to the global optimal output sequence, wherein the label is used to indicate whether the character is followed by a sentence segmentation position.
[0110] The recognition module 26 is used to recognize all sentence segmentation positions of the text data according to the label corresponding to each character.
[0111] In an optional embodiment, the recognition module 26 is specifically used to determine whether the character string consisting of the target character and the characters at the next position is a word when the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position; if not, recognize that the target character is followed by a sentence segmentation position.
[0112] In another optional implementation, the recognition module 26 is specifically used to determine whether the next position of the target character is an English character when the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position and the target character is an English character; if not, recognize that the target character is followed by a sentence segmentation position.
[0113] Example 3
[0114] Figure 4 The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the method for identifying the text segmentation position of Example 1 is implemented when the processor executes the program. Figure 4 The electronic device 3 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0115] The electronic device 3 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 3 may include, but are not limited to: at least one processor 4, at least one memory 5, and a bus 6 connecting different system components (including the memory 5 and the processor 4).
[0116] The bus 6 includes a data bus, an address bus and a control bus.
[0117] The memory 5 may include a volatile memory, such as a random access memory (RAM) 51 and / or a cache memory 52 , and may further include a read-only memory (ROM) 53 .
[0118] The memory 5 may also include a program / utility 55 having a set (at least one) of program modules 54, such program modules 54 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0119] The processor 4 executes various functional applications and data processing by running the computer program stored in the memory 5, such as the method for identifying the text segmentation position of the first embodiment of the present invention.
[0120] The electronic device 3 may also communicate with one or more external devices 7 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 8. Furthermore, the model-generated device 3 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 9. As shown, the network adapter 9 communicates with other modules of the model-generated device 3 via a bus 6. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the model-generated device 3, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0121] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0122] Example 4
[0123] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method for identifying text segmentation positions in Embodiment 1 are implemented.
[0124] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0125] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the method for identifying text segmentation positions in Example 1.
[0126] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0127] Although the specific embodiments of the present invention are described above, it should be understood by those skilled in the art that this is only for illustration and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for identifying text segmentation positions, characterized in that: The following steps are involved: Receiving text data after speech recognition, and splitting words in the text data into characters; Map each character to a character vector, and use the CNN model to extract the local features of each character vector to obtain the first latent vector; Mapping the words in the text data into word vectors, and extracting semantic features of each word vector using a Bi-LSTM model to obtain a second latent vector; Concatenate the first latent vector and the second latent vector, and perform linear transformation on the concatenated result and input it into the CRF model; The output result of the CRF model is decoded using the Viterbi algorithm to extract the global optimal output sequence, and the label of each character vector is predicted and output according to the global optimal output sequence, wherein the label is used to indicate whether the corresponding character is followed by a sentence segmentation position; Identifying all sentence segmentation positions of the text data according to the label corresponding to each character specifically includes the following steps: If the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position, then determining whether the character string composed of the target character and the character at the next position is a word; if not, then identifying that the target character is followed by a sentence segmentation position; If the label corresponding to the target character indicates that the target character is followed by a sentence segmentation position, and the target character is an English character, it is determined whether the next position of the target character is an English character; if not, it is identified that the target character is followed by a sentence segmentation position.
2. The identification method according to claim 1, characterized in that: The CNN model, the Bi-LSTM model and the CRF model are trained based on the following steps: Adding a label to the target text data with manually marked segmentation positions to indicate whether it is a segmentation position; Splitting words in the target text data into characters; Map each character to a character vector, and use the CNN model to extract the local features of each character vector to obtain the first latent vector; Mapping the words in the target text data into word vectors, and using the Bi-LSTM model to extract the semantic features of each word vector to obtain a second latent vector; Concatenate the first latent vector and the second latent vector, and perform linear transformation on the concatenated result and input it into the CRF model; The output result of the CRF model is decoded using the Viterbi algorithm, the global optimal output sequence is extracted, and the label of each character vector is predicted and output according to the global optimal output sequence; The parameters of the CNN model, the Bi-LSTM model, and the CRF model are adjusted according to the manually marked sentence segmentation positions and the predicted labels until the loss values corresponding to the predicted labels converge.
3. The identification method according to claim 1, characterized in that: Before concatenating the first latent vector and the second latent vector, the following steps are included: concatenating the second latent vector according to the last dimension.
4. A text segmentation position recognition system, characterized in that: include: A receiving module, used for receiving text data after speech recognition, and splitting words in the text data into characters; A local feature extraction module, used to map each character into a character vector, and use a CNN model to extract local features of the character vector to obtain a first latent vector; A semantic feature extraction module, used to map the words in the text data into word vectors, and extract the semantic features of each word vector using a Bi-LSTM model to obtain a second latent vector; A concatenation module, configured to concatenate the first latent vector and the second latent vector, and perform a linear transformation on the concatenation result and then input it into the CRF model; A prediction module is used to decode the output result of the CRF model using the Viterbi algorithm, extract the global optimal output sequence, and predict and output the label of each character vector according to the global optimal output sequence, wherein the label is used to indicate whether the corresponding character is followed by a sentence segmentation position; The recognition module is used to recognize all the sentence segmentation positions of the text data according to the label corresponding to each character; specifically, when the label corresponding to the target character indicates that the target character is followed by the sentence segmentation position, determine whether the character string composed of the target character and the character at the next position is a word, and if not, recognize that the target character is followed by the sentence segmentation position; and when the label corresponding to the target character indicates that the target character is followed by the sentence segmentation position and the target character is an English character, determine whether the next position of the target character is an English character, and if not, recognize that the target character is followed by the sentence segmentation position.
5. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for identifying the text segmentation position according to any one of claims 1 to 3 is implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for identifying text segmentation positions according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Sentence segmentation model establishing method and device
CN111160004A
Chinese sentence semantic intelligent matching method and device based on multi-granularity fusion model
CN111310438A
