Text segmentation methods and training methods, devices, electronic equipment, and storage media
By acquiring and annotating training corpora with sentence segmentation information, the neural network model is pre-trained and fine-tuned to construct a text segmentation model, which solves the problem of inaccurate sentence segmentation in speech recognition and improves the accuracy and readability of text segmentation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2026-03-17
AI Technical Summary
Existing speech recognition technology cannot accurately segment sentences, resulting in poor readability of the output text.
By acquiring training corpora containing and without sentence segmentation information, adding sentence segmentation information and labeling it, and using a neural network model for pre-training and fine-tuning, a text sentence segmentation model is constructed.
It improves the accuracy of text segmentation and enhances the readability of the output text.
Smart Images

Figure CN114239554B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer natural language processing technology, and in particular to a text segmentation method and training method, device, electronic device, and storage medium. Background Technology
[0002] Currently, voice communication is becoming increasingly common, but the output text obtained through speech recognition technology often lacks sentence breaks (e.g., punctuation marks), resulting in poor readability of the recognized output text.
[0003] With the continuous development of deep learning technology, trained neural network models can be used to predict the sentence segmentation information of text obtained from speech recognition. For example, the Conditional Random Field (CRF) model can be used to predict the sentence segmentation information of text obtained from speech recognition. However, the accuracy of sentence segmentation using the CRF model is low. Summary of the Invention
[0004] In view of this, embodiments of this specification provide a text segmentation method, training method, device, electronic device, and storage medium that can improve the accuracy of segmentation.
[0005] First, this specification provides a text segmentation training method, including:
[0006] Obtain a first training corpus containing sentence segmentation information and a second training corpus without sentence segmentation information, respectively;
[0007] Add sentence segmentation information to the second training corpus to obtain the third training corpus;
[0008] Add annotation information related to sentence segmentation to the first training corpus and the third training corpus respectively;
[0009] The first training corpus is input into a preset neural network model, and the preset neural network model is pre-trained to obtain an initial text segmentation model;
[0010] The third training corpus is input into the initial text segmentation model, and the initial text segmentation model is fine-tuned to obtain the text segmentation model.
[0011] Optionally, the sentence segmentation information includes punctuation information;
[0012] The step of adding annotation information related to sentence segmentation information to the first training corpus and the third training corpus includes: performing word segmentation on the first training corpus and the third training corpus respectively to obtain word units corresponding to each corpus;
[0013] Based on the punctuation information at the preset positions of the word units corresponding to each corpus, annotation information is added to the word units corresponding to each corpus.
[0014] Optionally, before adding annotation information to the word units corresponding to each corpus based on the punctuation information at preset positions of the word units corresponding to each corpus, the method further includes:
[0015] Data cleaning is performed on the word units corresponding to each corpus in the first training corpus and the third training corpus.
[0016] Optionally, before adding annotation information to the word units corresponding to each corpus based on the punctuation information at preset positions of the word units corresponding to each corpus, the method further includes:
[0017] Based on a preset set of punctuation marks, identify the punctuation mark information at preset positions of word units corresponding to each corpus;
[0018] When a punctuation mark at a preset position corresponding to a word unit in each corpus is identified in the preset punctuation mark set, the punctuation mark at the preset position corresponding to the word unit in each corpus is converted into a preset punctuation mark.
[0019] Optionally, the punctuation marks at the preset positions of the word units corresponding to each corpus include sentence-ending marks, which include at least one of the following: exclamation mark, question mark, and ellipsis;
[0020] The preset punctuation marks include the period.
[0021] Optionally, adding sentence segmentation information to the second training corpus to obtain the third training corpus includes: when the obtained second training corpus is a speech training corpus, performing speech recognition on the speech training corpus to obtain the corresponding speech data text;
[0022] Sentence segmentation information is added to the speech data text to obtain the third training corpus.
[0023] Optionally, the preset neural network model includes an encoding layer, a time-recurrent neural network layer, and a conditional random field network layer;
[0024] The step of inputting the first training corpus into a preset neural network model and pre-training the preset neural network model to obtain an initial text segmentation model includes:
[0025] The first training corpus is input into the encoding layer, and the first training corpus is encoded by the encoding layer to obtain the corresponding encoding vector matrix;
[0026] The encoding vector corresponding to the first training corpus is input into the recurrent neural network layer, and the recurrent neural network layer performs bidirectional operations on the encoding vector matrix corresponding to the first training corpus to obtain the bidirectional encoding vector matrix corresponding to the first training corpus.
[0027] The bidirectional encoding vector matrix corresponding to the first training corpus is input into the conditional random field network layer, and the negative log-likelihood function of the sentence segmentation information sequence of the first training corpus is calculated through the conditional random field network layer based on the sentence segmentation information of the first training corpus, and used as the loss function.
[0028] The loss function is minimized using the backpropagation algorithm, and the preset neural network model is iteratively trained to obtain an initial text segmentation model.
[0029] Accordingly, embodiments of this specification also provide a text segmentation method, including:
[0030] Get the text to be segmented;
[0031] The text to be segmented is input into the text segmentation model to obtain and output the segmentation result;
[0032] The text segmentation model is obtained by fine-tuning the initial text segmentation model with a third training corpus containing annotation information related to segmentation information; the initial text segmentation model is obtained by inputting a first training corpus containing annotation information related to segmentation information into a preset neural network model for training; the first training corpus contains segmentation information; and the third training corpus is obtained by adding segmentation information to a second training corpus that does not contain segmentation information.
[0033] Optionally, the text segmentation model includes: an encoding layer, a time recurrent neural network layer, and a conditional random field network layer;
[0034] The step of inputting the text to be segmented into the text segmentation model, obtaining the segmentation result, and outputting it includes:
[0035] The text to be segmented is input into the encoding layer, and the text to be segmented is encoded by the encoding layer to obtain the corresponding encoding vector matrix;
[0036] The encoding vector corresponding to the text to be segmented is input into the time recurrent neural network layer. The time recurrent neural network layer performs bidirectional operations on the encoding vector matrix corresponding to the text to be segmented to obtain the bidirectional encoding vector matrix corresponding to the text to be segmented.
[0037] The bidirectional encoding vector matrix corresponding to the text to be segmented is input into the Conditional Random Field (CRF) network layer. The CRF network layer decodes the bidirectional encoding vector matrix corresponding to the text to be segmented to obtain the corpus with segmentation information corresponding to the text to be segmented and outputs it.
[0038] Accordingly, embodiments of this specification also provide a training device for a text segmentation model, comprising:
[0039] The corpus acquisition module is suitable for acquiring a first training corpus containing sentence segmentation information and a second training corpus that does not contain sentence segmentation information;
[0040] The sentence segmentation information addition module is suitable for adding sentence segmentation information to the second training corpus to obtain the third training corpus;
[0041] The annotation information adding module is adapted to add annotation information to the first training corpus and the third training corpus;
[0042] The training module is adapted to input the first training corpus into a preset neural network model, pre-train the preset neural network model, and obtain an initial text segmentation model.
[0043] The fine-tuning module is adapted to input the third training corpus into the initial text segmentation model, fine-tune the initial text segmentation model, and obtain the text segmentation model.
[0044] Accordingly, embodiments of this specification also provide a text segmentation device, including:
[0045] The text acquisition module is suitable for acquiring text to be segmented.
[0046] The processing module is adapted to input the text to be segmented into the text segmentation model, obtain the segmentation result, and output it.
[0047] The text segmentation model is obtained by fine-tuning the initial text segmentation model with a third training corpus containing annotation information related to segmentation information; the initial text segmentation model is obtained by inputting a first training corpus containing annotation information related to segmentation information into a preset neural network model for training; the first training corpus contains segmentation information; and the third training corpus is obtained by adding segmentation information to a second training corpus that does not contain segmentation information.
[0048] This specification also provides an electronic device, including a memory and a processor, wherein the memory is adapted to store one or more computer instructions, and the processor, when executing the computer instructions, performs the steps of the training method described above; or performs the steps of the text segmentation method described above.
[0049] This specification also provides a computer-readable storage medium storing computer instructions that, when executed, perform the steps of the training method described in any of the preceding claims; or perform the steps of the text segmentation method described in any of the preceding claims.
[0050] The text segmentation training scheme of this embodiment involves adding segmentation information to a second training corpus that does not contain segmentation information, resulting in a third training corpus. After adding annotation information related to the segmentation information to the first and third training corpora, the first training corpus is first input into a preset neural network model and trained to obtain an initial text segmentation model. Then, the third training corpus is input into the initial text segmentation model, and the initial text segmentation model is fine-tuned to obtain a final text segmentation model. By using the above training scheme, the preset neural network model is first trained with the first training corpus containing annotation information, enabling the preset neural network model to deeply capture the relationship between the training corpus and its annotation information. Then, the preset neural network model is fine-tuned with the third training corpus containing annotation information. Compared to a model directly trained with the first training corpus, the text segmentation model obtained using the scheme of this embodiment has better generalization ability and versatility, thereby improving the accuracy of segmentation when using the text segmentation model to segment text.
[0051] Furthermore, before adding annotation information to the word units corresponding to each corpus based on the punctuation information at the preset positions of the word units corresponding to each corpus, data cleaning is performed on the word units corresponding to each corpus in the first training corpus and the third training corpus. This can correct and remove non-standard word units, thereby enabling the addition of correct annotation information to the word units and preventing the preset neural network model from learning non-standard annotation information usage.
[0052] Furthermore, based on a preset set of punctuation marks, the punctuation mark information at preset positions of word units corresponding to each corpus is identified; when the punctuation mark information at preset positions of word units corresponding to each corpus is identified in the preset set of punctuation marks, the punctuation marks at preset positions of word units corresponding to each corpus are converted into preset punctuation marks. By converting the punctuation marks at preset positions of word units corresponding to each corpus into preset punctuation marks when the punctuation mark information of word units corresponding to each corpus is identified in the preset set of punctuation marks, the workload of annotation information can be reduced, and the training speed of the preset neural network model can be improved. Attached Figure Description
[0053] To more clearly illustrate the technical solutions of the embodiments of this specification, the drawings used in the description of the embodiments of this specification or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0054] Figure 1 A flowchart of a text segmentation training method according to an embodiment of this specification is shown;
[0055] Figure 2 A flowchart illustrating a method for adding annotation information to a training corpus according to an embodiment of this specification is shown;
[0056] Figure 3 A flowchart of a punctuation mark type conversion method for a training corpus is shown in an embodiment of this specification;
[0057] Figure 4 A flowchart illustrating a training method for a text segmentation model in an embodiment of this specification is shown;
[0058] Figure 5 A flowchart of a text segmentation method according to an embodiment of this specification is shown;
[0059] Figure 6 This document shows a schematic diagram of the structure of a text segmentation model in one embodiment of this specification.
[0060] Figure 7 This specification illustrates a text segmentation training device in an embodiment.
[0061] Figure 8 A schematic diagram of the structure of a text segmentation device according to an embodiment of this specification is shown;
[0062] Figure 9 A schematic diagram of the result of an electronic device according to an embodiment of this specification is shown. Detailed Implementation
[0063] As mentioned earlier, although trained neural network models can be used to predict the sentence segmentation information of the identified text, the accuracy of the predicted sentence segmentation is low.
[0064] To address the aforementioned problems, embodiments of this specification provide a training method for text segmentation, comprising adding segmentation information to a second training corpus that does not contain segmentation information to obtain a third training corpus, and after adding annotation information related to the segmentation information to the first training corpus and the third training corpus, firstly inputting the first training corpus into a preset neural network model and training it to obtain an initial text segmentation model, then inputting the third training corpus into the initial text segmentation model, and fine-tuning the initial text segmentation model to obtain a final text segmentation model.
[0065] By first training a pre-defined neural network model with labeled first training corpus, the pre-defined neural network model can deeply capture the relationship between the training corpus and its labeled information. Then, the pre-defined neural network model is fine-tuned with labeled third training corpus. Compared with the model obtained by directly training with the first training corpus, the text segmentation model obtained by adopting the scheme in this embodiment has better generalization ability and versatility, thereby improving the accuracy of sentence segmentation when using the text segmentation model to segment text.
[0066] To enable those skilled in the art to better understand and implement the embodiments of this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings.
[0067] In the embodiments of this specification, in order to improve the accuracy of sentence segmentation and enhance the readability of the text, a training corpus with annotation information can be established first, and the obtained training corpus can be used to train a preset neural network model to obtain a text segmentation model. The trained text segmentation model can then be used to segment text without segmentation information.
[0068] Reference Figure 1 The flowchart shown is a training method for text segmentation, which may include the following steps:
[0069] S11, Obtain the first training corpus containing sentence segmentation information.
[0070] In practice, the wider the source of the first training corpus containing punctuation information and the more standardized the annotation of punctuation information, the more beneficial it is for the subsequent pre-training of the neural network model, which can increase the universality and accuracy of the trained model. Therefore, on the one hand, in order to make the source of the first training corpus wider, corpus can be obtained from different fields as much as possible; on the other hand, in order to make the use of punctuation information in the first training corpus more standardized, corpus that has been proofread can be obtained.
[0071] For example, the first training corpus may include: news corpus, encyclopedia entry corpus, and academic paper corpus that are biased towards written language; and chat corpus, hot topic corpus, and commentary corpus that are biased towards spoken language.
[0072] S12, the second training corpus, which includes both the obtained and unincluded punctuation information.
[0073] In specific implementation, the second training corpus, which does not contain punctuation information, can be obtained in the same way as the first training corpus. It can be obtained from multiple different domains, either from corpora without punctuation information or from proofread corpora without punctuation information, thereby increasing the versatility and accuracy of the text punctuation model. In this embodiment of the invention, the difference from the first training corpus is that the amount of data in the second training corpus can be less than that in the first training corpus.
[0074] For example, in order to accurately predict the punctuation marks in unpunctuated text from one or more specific industry sectors, a second training corpus can be obtained by acquiring corpora from one or more specific sectors. For instance, to predict the punctuation marks in unpunctuated text from the financial sector, the second training corpus could include corpora from the financial sector that do not contain sentence segmentation information.
[0075] In practice, the first and second training corpora can be a single sentence, a paragraph containing multiple sentences, or a document containing many sentences. This specification does not limit the specific format of the acquired training corpora, as long as they meet the format requirements for training corpora.
[0076] S13, add sentence segmentation information to the second training corpus to obtain the third training corpus.
[0077] In practice, if the amount of the second training corpus is small, manual annotation can be used to add sentence segmentation information to the second training corpus in order to improve the accuracy of the sentence segmentation information of the obtained third training corpus.
[0078] S14, add annotation information related to sentence segmentation information to the first training corpus.
[0079] S15, add annotation information related to sentence segmentation information to the third training corpus.
[0080] In specific implementation, by adding annotation information related to sentence segmentation information to the first training corpus and the third training corpus, it is possible to obtain the label combination between sentence segmentation information and annotation information, avoiding the situation of too many invalid labels. Thus, when using the first training corpus and the third training corpus to train the preset neural network model, the accuracy of the text sentence segmentation model in predicting sentence segmentation information can be improved.
[0081] S16, input the first training corpus into a preset neural network model, pre-train the preset neural network model to obtain an initial text segmentation model.
[0082] In a specific implementation, as an optional example, the preset neural network model may include: an encoding layer, a time recurrent neural network layer, and a conditional random field network layer. The preset neural network model is pre-trained using the first training corpus, and the resulting initial text segmentation model can deeply capture the information of the text context.
[0083] S17, the third training corpus is input into the initial text segmentation model, and the initial text segmentation model is fine-tuned to obtain the text segmentation model.
[0084] Specifically, by fine-tuning the initial text segmentation model with annotation information related to segmentation information, the resulting text segmentation model has better generalization ability and versatility.
[0085] It should be noted that the timing of obtaining the first and second training corpora is not limited to the above-mentioned order of steps. For example, the second training corpora can be obtained after pre-training the preset neural network model and before fine-tuning the initial text segmentation model, and the second training corpora can be processed to obtain the third training corpora. Moreover, the embodiments of this specification do not limit the order in which annotation information related to segmentation information is added to the first and third training corpora.
[0086] The above-described text segmentation training method first trains a preset neural network model with a first training corpus containing labeled information, enabling the preset neural network model to deeply capture the relationship between the training corpus and its labeled information. Then, the preset neural network model is fine-tuned with a third training corpus containing labeled information. Compared with the model obtained by directly training with the first training corpus, the text segmentation model obtained by the scheme in this embodiment has better generalization ability and versatility, thereby improving the accuracy of sentence segmentation when using the text segmentation model to segment text.
[0087] In practice, the training corpus containing sentence segmentation information is text data with pause information. For example, the training corpus may contain punctuation marks, which are the sentence segmentation information in the training corpus. Based on the punctuation marks, annotation information related to the sentence segmentation information can be added to the training corpus.
[0088] When the obtained training corpus does not contain sentence segmentation information, sentence segmentation information can be added to the training corpus without sentence segmentation information based on manual annotation, and then annotation information related to sentence segmentation information can be added to the training corpus.
[0089] In a specific embodiment of this specification, the sentence segmentation information may include punctuation information. Through the punctuation information, annotation information can be added to the training corpus.
[0090] Refer to Figure 2 As shown in the flowchart of a method for adding annotation information to a training corpus, in some embodiments of this specification, it may specifically include the following steps:
[0091] S21. Perform word segmentation on the first training corpus and the third training corpus respectively to obtain word units corresponding to each corpus.
[0092] In specific implementation, a word is the basic unit of a text, and there is no sentence segmentation information between consecutive words. Therefore, it is necessary to perform word segmentation on the first training corpus and the third training corpus to obtain word units corresponding to each corpus, so that the text that needs to be added with information annotation is converted into corresponding words.
[0093] As a specific example, the aforementioned word segmentation process can be carried out by using a word segmentation dictionary or other word segmentation units. Compare the segmented corpus with each word in the word segmentation dictionary, and when a word in the corpus is the same as a word in the word segmentation dictionary, set the corresponding word as the word of the corpus.
[0094] It can be understood that the word segmentation unit corresponds to the smallest sentence composition unit of the language type of the first training corpus and the third training corpus. For example, the smallest sentence composition unit of Chinese is a "character", and the smallest sentence composition unit of English is a "word". Therefore, the specific expression of the word segmentation unit is determined by the language types of the first training corpus and the second training corpus. In the embodiments of this specification, the language types of the first training corpus and the second training corpus are the same.
[0095] In specific implementation, the training corpus of the corresponding language type can be selected according to the language type of the text that needs to be annotated or processed subsequently, so as to train a sentence segmentation model of different language types.
[0096] [[ID=**********]]
[0097] In specific implementation, after word segmentation of the corpus, multiple different types of word units can be obtained. For example, when the training corpus is English, it may include words, punctuation marks before and after words, etc.; when the training corpus is Chinese, it may include characters, punctuation marks before and after characters, the词性 of characters, sentence components, etc.
[0098] As can be seen from the foregoing, punctuation information can be used as a type of sentence segmentation information. Therefore, in the embodiments of this specification, annotation information can be added to the word units corresponding to each corpus based on the punctuation information at the preset positions of the word units corresponding to each corpus.
[0099] The punctuation information at the preset position of the word unit may include punctuation information before the word unit and punctuation information after the word unit. Considering that the first word unit of the starting sentence of most training corpora is not a punctuation mark, the embodiments of this specification can add annotation information to the word units corresponding to each corpus based on the punctuation information after the word units corresponding to each corpus.
[0100] By adding annotation information to each word unit, the label combination between the punctuation information and the annotation information of each word can be obtained, avoiding the situation of too many invalid labels. Thus, when the preset neural network model is trained using the first training corpus and the third training corpus, the accuracy of the text segmentation model in predicting segmentation information can be improved.
[0101] In practice, before adding annotation information to the word units corresponding to each corpus, data cleaning can be performed on the word units corresponding to each corpus in the first training corpus and the third training corpus to correct obviously non-standard punctuation marks, such as punctuation mark types in sentences that do not match the language type of the training corpus.
[0102] As a specific example, when the training corpus is Chinese, the punctuation marks in the sentences are half-width characters. In this case, the half-width punctuation marks should be corrected to full-width characters. When the training corpus is English, the punctuation marks in the sentences are full-width characters. In this case, the full-width punctuation marks should be corrected to half-width characters.
[0103] In another specific implementation, data cleaning is performed on the word units corresponding to each corpus in the first training corpus and the third training corpus. This can be used to remove punctuation marks that cannot be used at the beginning of a sentence. For example, if there are punctuation marks that should not appear consecutively in a sentence, or if there are punctuation marks that are not at the end of a sentence, these non-standard punctuation marks can be deleted.
[0104] Therefore, through the above data cleaning operations, non-standard word units can be corrected and removed, thereby adding correct annotation information to word units and preventing the preset neural network model from learning non-standard annotation information usage.
[0105] In practical applications, some training corpora are too long, resulting in a large number and variety of punctuation marks after word segmentation. Some of these punctuation marks do not affect the readability of the text. Furthermore, the more types of punctuation marks there are, the greater the annotation workload and the longer the training time for the model. Therefore, some types of punctuation marks can be converted to other types to reduce the workload of annotation and improve the training speed of the pre-defined neural network model.
[0106] Reference Figure 3 The flowchart shown in this specification illustrates a method for converting punctuation marks in a training corpus. Specifically, it may include the following steps:
[0107] S31, based on a preset set of punctuation marks, identify the punctuation mark information at the preset position of the word unit corresponding to each corpus.
[0108] S32, when a punctuation mark at a preset position corresponding to a word unit in each corpus is identified in the preset punctuation mark set, the punctuation mark at the preset position corresponding to the word unit in each corpus is converted into a preset punctuation mark.
[0109] In practical implementation, in order to achieve automatic conversion of punctuation mark types, a punctuation mark set can be preset. After segmenting the first and third training corpora containing punctuation mark information, the punctuation marks in the first and third training corpora are identified according to the preset punctuation mark set. When the same punctuation mark is identified, the punctuation mark at the preset position of the word unit corresponding to each corpus is converted into the preset punctuation mark.
[0110] As a specific example, the preset punctuation mark set can be: {? ! …}.
[0111] The punctuation marks at the preset positions of the word units corresponding to each corpus include sentence-ending marks, which include at least one of the following: exclamation mark, question mark, and ellipsis.
[0112] The preset punctuation marks may include periods.
[0113] It is understood that the “{}” in this article is only used to limit the scope of the examples and is not an essential part of representing the content of the training corpus. Those skilled in the art can use other symbols that are not easily confused to limit the scope of the training corpus.
[0114] It is understood that the above embodiments are merely illustrative examples and are not intended to limit the specific implementation. In the actual implementation process, different types of punctuation marks can be flexibly converted according to actual needs to add annotation information to the training corpus.
[0115] To facilitate understanding, the following specific example will be used to explain in detail the process of adding annotation information related to punctuation marks to the training corpus involved in the embodiments of this specification.
[0116] If the obtained training corpus containing punctuation marks is: {ok, I like apples. What about you?}, after segmenting the training corpus, we obtain 10 word units: {ok, I like apples. What about you?}.
[0117] Since the training corpus is in English, the full-width punctuation mark "," is corrected to the half-width punctuation mark ","; the full-width punctuation mark "." is corrected to the half-width punctuation mark "."; then, the sentence ending mark "?" is converted to a period ".", resulting in the processed training corpus: {ok,I like apples.What about you.}. Based on the punctuation mark type after each word unit, annotation information is added to each word unit.
[0118] In a specific embodiment, the punctuation mark after "ok" is "," and its annotation information can be set to "C"; there is no punctuation mark after "I", "like", "What", and "about", and its annotation information can be set to "O"; the punctuation mark after "apples" and "you" is ".", and its annotation information can be set to "B".
[0119] It should be noted that after adding annotation information to the word unit based on the punctuation marks following the word unit, the punctuation marks need to be deleted. Thus, the annotation information corresponding to the training corpus is: {CO OBOOB}, and the training corpus with annotation information is: {ok CIO like O apples B What O about O you B}.
[0120] For some special symbols, such as #, @, &, etc., when annotating information, special symbols can be treated as words or characters, and the special symbols can be annotated according to the type of punctuation mark following them. For example, for the training corpus 123@qq, the annotation information of the special symbol "@" can be set to "O".
[0121] It is understood that the above process of adding annotation information to the word units corresponding to each corpus is only an illustrative example. For example, the annotation information for each word unit can also be characters such as numbers, English abbreviations corresponding to punctuation marks, etc. The embodiments in this specification do not limit the specific character types used to represent the annotation information, as long as the characters used to represent the annotation information can distinguish different punctuation marks.
[0122] It is also understandable that the above example is based on English as the training corpus. In actual implementation, other language types of training corpus, such as Chinese, can be selected according to actual needs.
[0123] In specific implementation, the second training corpus obtained without sentence segmentation information may be speech training corpus, and the sentence segmentation model cannot recognize the speech training corpus. Therefore, when the second training corpus obtained is speech training corpus, speech recognition is performed on the speech training corpus to obtain the corresponding speech data text; sentence segmentation information is added to the speech data text to obtain the third training corpus.
[0124] Specifically, when the second training corpus is speech training corpus, the acquired speech training corpus is first subjected to speech recognition, and the speech training corpus is converted into corresponding text data as speech data text. Then, according to the reading habits and rules of the existing text corpus, sentence segmentation information (i.e. punctuation marks) is added to the speech data text by manual annotation, thereby obtaining the third training corpus.
[0125] In practice, the first training corpus can be obtained in various ways. For example, at least one of the following methods can be used to obtain the first training corpus:
[0126] Extracting text data containing punctuation marks from the internet;
[0127] Manually input text data containing punctuation marks.
[0128] The second training corpus can also be obtained in various ways. For example, one or more of the following methods can be used to obtain the second training corpus:
[0129] Extracting text data from the internet that does not contain punctuation marks from a predetermined domain;
[0130] Manually enter text data that does not contain punctuation marks into a preset field;
[0131] Voice data is captured from the Internet and then processed through speech recognition to obtain corresponding text data.
[0132] After adding annotation information related to sentence segmentation to the first training corpus and the third training corpus as described above, each word unit corresponding to each corpus in the first training corpus and the third training corpus has corresponding annotation information. The first training corpus and the second training corpus with annotation information related to sentence segmentation can be input into a preset neural network model to train the preset neural network model.
[0133] In practice, the initial text segmentation model can be pre-trained using the first training corpus to obtain the initial text segmentation model.
[0134] Reference Figure 4 The flowchart of a text segmentation model training method described in the embodiments of this specification is shown below. In some embodiments of this specification, the preset neural network model may include an encoding layer, a time recurrent neural network layer, and a conditional random field network layer.
[0135] The step of inputting the first training corpus into a preset neural network model and pre-training the preset neural network model to obtain an initial text segmentation model can be performed according to the following steps:
[0136] S41, the first training corpus is input into the encoding layer, and the first training corpus is encoded by the encoding layer to obtain the corresponding encoding vector matrix.
[0137] S42, the encoding vector corresponding to the first training corpus is input into the time recurrent neural network layer, and the encoding vector matrix corresponding to the first training corpus is bidirectionally operated on by the time recurrent neural network layer to obtain the bidirectional encoding vector matrix corresponding to the first training corpus.
[0138] S43, the bidirectional encoding vector matrix corresponding to the first training corpus is input into the conditional random field network layer, and the negative log-likelihood function of the sentence segmentation information sequence of the first training corpus is calculated through the conditional random field network layer based on the sentence segmentation information of the first training corpus, and used as the loss function.
[0139] S44, the backpropagation algorithm is used to minimize the loss function, and the preset neural network model is iteratively trained to obtain the initial text segmentation model.
[0140] By constructing a corresponding loss function based on the annotation information of the third training corpus and its corresponding corpus with sentence segmentation information, and using the backpropagation method to fine-tune the parameters of the neural network model, the value of the loss function is reduced, enabling the text segmentation model to converge quickly, shortening the training time, and improving the accuracy of the text segmentation model.
[0141] In other embodiments of this specification, the parameters of the neural network model can be fine-tuned using the gradient descent method to reduce the value of the loss function.
[0142] In practical implementation, if the initial text segmentation model trained on the first training corpus is directly used to predict the segmentation information (punctuation marks) of the text corpus converted from the speech training corpus, the accuracy of the prediction results will be low due to the differences between the speech training corpus and the text corpus. Therefore, it is necessary to fine-tune the parameters of the obtained initial text segmentation model. In the embodiments of this specification, the parameters of the initial text segmentation model can be adjusted in the following ways:
[0143] The annotation information of the third training corpus is obtained from the initial text segmentation model, and the third training corpus is input into the encoding layer. The first training corpus is then encoded by the encoding layer to obtain the corresponding encoding vector matrix.
[0144] The encoding vector corresponding to the third training corpus is input into the recurrent neural network layer, and the recurrent neural network layer performs bidirectional operations on the encoding vector matrix corresponding to the third training corpus to obtain the bidirectional encoding vector matrix corresponding to the third training corpus.
[0145] The bidirectional encoding vector matrix corresponding to the third training corpus is input into the conditional random field network layer, and the negative log-likelihood function of the sentence segmentation information sequence of the third training corpus is calculated through the conditional random field network layer based on the sentence segmentation information of the third training corpus, and used as the loss function.
[0146] The loss function is minimized using the backpropagation algorithm, and the preset initial text segmentation model is iteratively trained to obtain the initial text segmentation model.
[0147] By first training a pre-defined neural network model with labeled first training corpus, the pre-defined neural network model can deeply capture the relationship between the training corpus and its labeled information. Then, the pre-defined neural network model is fine-tuned with labeled third training corpus. Compared with the model obtained by directly training with the first training corpus, the obtained text segmentation model has better generalization ability and versatility, thereby improving the accuracy of sentence segmentation when using the text segmentation model to segment text.
[0148] After the above training process, a text segmentation model can be obtained. Using the text segmentation model, texts without segmentation information (including corpus texts and texts obtained through speech conversion) can be segmented, that is, segmentation information can be added.
[0149] Reference Figure 5 The flowchart shown in this specification illustrates a text segmentation method in some embodiments. Specifically, in some embodiments of this specification, the method includes the following steps:
[0150] S51, obtain the text to be segmented.
[0151] In specific implementation, the text to be segmented can be obtained from multiple different fields. Specifically, one or more of the following methods can be used to obtain the text to be segmented: capturing text data without punctuation marks from the Internet in a preset field; manually entering text data without punctuation marks from the preset field; capturing voice data from the Internet and obtaining the corresponding text data through voice recognition and annotation.
[0152] The text to be segmented can be a sentence, a paragraph containing multiple sentences, a document containing many sentences, or text converted from speech corpus.
[0153] S52, input the text to be segmented into the text segmentation model, obtain the segmentation result and output it.
[0154] The text segmentation model is obtained by fine-tuning the initial text segmentation model with a third training corpus containing annotation information related to segmentation information; the initial text segmentation model is obtained by inputting a first training corpus containing annotation information related to segmentation information into a preset neural network model for training; the first training corpus contains segmentation information; and the third training corpus is obtained by adding segmentation information to a second training corpus that does not contain segmentation information.
[0155] The text segmentation method described above, which pre-trains a preset neural network model using a first training corpus with annotations related to the segmentation information to obtain a preliminary text segmentation model, and then fine-tunes the preliminary text segmentation model using a third training corpus with annotations related to the segmentation information, has better generalization ability and versatility than the model obtained using only the first training corpus. The resulting text segmentation results are also more accurate.
[0156] In some optional examples of the embodiments described in this specification, the preset neural network model may include: an encoding layer, a time-recurrent neural network layer, and a conditional random field network layer;
[0157] The process of inputting the text to be segmented into the text segmentation model, obtaining the segmentation result, and outputting it specifically includes:
[0158] The text to be segmented is input into the encoding layer, and the text to be segmented is encoded by the encoding layer to obtain the corresponding encoding vector matrix;
[0159] The encoding vector corresponding to the text to be segmented is input into the time recurrent neural network layer. The time recurrent neural network layer performs bidirectional operations on the encoding vector matrix corresponding to the text to be segmented to obtain the bidirectional encoding vector matrix corresponding to the text to be segmented.
[0160] The bidirectional encoding vector matrix corresponding to the text to be segmented is input into the Conditional Random Field (CRF) network layer. The CRF network layer decodes the bidirectional encoding vector matrix corresponding to the text to be segmented to obtain the corpus with segmentation information corresponding to the text to be segmented and outputs it.
[0161] The following specific example illustrates in detail the process of segmenting text to be segmented using the text segmentation model in the embodiments of this specification.
[0162] Reference Figure 6 The diagram shown is a structural schematic of a text segmentation model in an embodiment of this specification. In this embodiment, as shown... Figure 6 As shown, the text segmentation model 60 may include an encoding layer 62, a time recurrent neural network layer 63, and a conditional random field network layer 64, and optionally, an input layer 61 and an output layer 65.
[0163] As a specific example, the coding layer 62 may be a Roberta network layer, and the time recurrent neural network layer 63 may be a bidirectional long short-term memory network layer.
[0164] In practical implementation, the input layer 61 can obtain the length of the text to be segmented and embed word vectors for each segmentation unit according to the pre-set BPE vocabulary. Each segmentation unit corresponds to one word vector (i.e., ...). Figure 6 (A square in the middle input layer 61).
[0165] After word segmentation, the word units are encoded by the coding layer 62 to obtain a coding vector matrix M1: [bs, n, dim], where bs represents the number of samples of the text to be segmented at one time, n represents the character length of the text to be segmented, the character length includes the length of the text to be segmented itself and the start symbol CLS and end symbol SEP at both ends of the text to be segmented, and dim represents the word vector of the text to be segmented.
[0166] For example, for the text to be segmented {Ok I like apples how about you}, its corresponding encoding vector matrix is M1: [1, 9, 512].
[0167] The matrix M1: [bs, n, dim] is used as the input to the recurrent neural network layer 63. After passing through two LSTM layers, the matrix M1: [bs, n, dim] is bidirectionally operated on in two directions, i.e., concatenated, to obtain the bidirectional encoding vector matrix M2: [bs, n, dim*2]. This matrix M2: [bs, n, dim*2] is used as the input to the conditional random field network layer 64. The conditional random field network layer 64 decodes M2: [bs, n, dim*2] to obtain the sentence segmentation result, which is then output through the output layer 65.
[0168] For example, through the above process, we can obtain the sentence segmentation result: {Ok,I like apples.how about you.}.
[0169] This specification also provides an apparatus corresponding to the above-described text segmentation training method, which will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0170] Reference Figure 7 The diagram shown is a structural schematic of a text segmentation training device according to an embodiment of this specification. In this embodiment, the text segmentation training device 70 may include:
[0171] The corpus acquisition module 71 is adapted to acquire a first training corpus containing sentence segmentation information and a second training corpus not containing sentence segmentation information;
[0172] The sentence segmentation information addition module 72 is adapted to add sentence segmentation information to the second training corpus to obtain the third training corpus;
[0173] The annotation information adding module 73 is adapted to add annotation information to the first training corpus and the third training corpus;
[0174] Training module 74 is adapted to input the first training corpus into a preset neural network model, pre-train the preset neural network model, and obtain an initial text segmentation model;
[0175] The fine-tuning module 75 is adapted to input the third training corpus into the initial text segmentation model, fine-tune the initial text segmentation model, and obtain the text segmentation model.
[0176] In specific implementation, when the obtained second training corpus, which does not contain punctuation information, is speech training corpus, before adding punctuation information to it to obtain the third training corpus, it is necessary to recognize the speech training corpus to obtain the corresponding text data. Therefore, the punctuation information adding module 72 may include:
[0177] The speech recognition submodule 721 is adapted to perform speech recognition on the acquired second training corpus when it is a speech training corpus, to obtain the corresponding speech data text.
[0178] The sentence segmentation information addition module 722 is coupled to the speech recognition submodule 721 and is adapted to add sentence segmentation information to the speech data text to obtain the third training corpus.
[0179] In specific implementation, the sentence segmentation information may include punctuation information, and the annotation information adding module 73 may include:
[0180] Word segmentation submodule 731 is adapted to segment the first training corpus and the third training corpus into words respectively to obtain word units corresponding to each corpus;
[0181] The annotation information adding submodule 732 is adapted to add annotation information to the word units corresponding to each corpus based on the punctuation information of the preset positions of the word units corresponding to each corpus.
[0182] In practical applications, for training corpora that clearly use standard punctuation marks, data cleaning can be performed to correct or delete obviously non-standard punctuation marks. Therefore, the annotation information adding module 73 may also include:
[0183] The data cleaning submodule 733 is coupled to the annotation information adding module 732 and the word segmentation submodule 731 respectively, and is adapted to perform data cleaning on the word units corresponding to each corpus in the first training corpus and the third training corpus.
[0184] In practical implementation, when reading text corpora, some punctuation marks do not affect the readability of the text. In this case, some types of punctuation marks can be converted to other types of punctuation marks to reduce the workload of annotation information and improve the training speed of the preset neural network model. Therefore, the annotation information adding module 73 may also include:
[0185] The punctuation recognition submodule 734 is coupled to the word segmentation submodule 731 and is adapted to recognize the punctuation information of the word units at preset positions corresponding to each corpus according to a preset set of punctuation marks.
[0186] The punctuation conversion module 735 is coupled to the punctuation recognition submodule 734 and the annotation information addition module 732 respectively, and is adapted to convert the punctuation at the preset position of the word unit corresponding to each corpus into the preset punctuation when the punctuation is recognized in the preset punctuation set.
[0187] As a specific example, the preset punctuation mark set can be: {? ! …}.
[0188] The punctuation marks at the preset positions of the word units corresponding to each corpus include sentence-ending marks, which include at least one of the following: exclamation mark, question mark, and ellipsis.
[0189] The preset punctuation marks may include periods.
[0190] Using the aforementioned text segmentation training device, a preset neural network model is first trained with a first training corpus containing labeled information, enabling the preset neural network model to deeply capture the relationship between the training corpus and its labeled information. Then, the preset neural network model is fine-tuned with a third training corpus containing labeled information. Compared with the model obtained by directly training with the first training corpus, the resulting text segmentation model has better generalization ability and versatility, thereby improving the accuracy of sentence segmentation when using the text segmentation model to segment text.
[0191] The specific implementation of each module of the above-mentioned text segmentation training device can be found in the detailed descriptions of the aforementioned embodiments, and will not be elaborated here.
[0192] Accordingly, embodiments of this specification also provide apparatus corresponding to the above-described text segmentation method, which will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0193] Reference Figure 8 The diagram shown is a structural schematic of a text segmentation device according to an embodiment of this specification. In this embodiment, the text segmentation device 80 may include:
[0194] Text acquisition module 81 is suitable for acquiring text to be segmented;
[0195] The processing module 82 is adapted to input the text to be segmented into the text segmentation model, obtain the segmentation result, and output it.
[0196] The text segmentation model is obtained by sequentially inputting a first training corpus and a third training corpus containing annotation information related to segmentation information into a preset neural network model for training; the first training corpus contains segmentation information; and the third training corpus is obtained by adding segmentation information to a second training corpus that does not contain segmentation information.
[0197] Using the above-mentioned text segmentation device, the text segmentation model is obtained by pre-training a preset neural network model with a first training corpus containing annotation information related to the segmentation information, and then fine-tuning the preliminary text segmentation model with a third training corpus containing annotation information related to the segmentation information. Compared with the model obtained by using only the first training corpus, the text classification model in the embodiments of this specification has better generalization ability and versatility, and the accuracy of the obtained text segmentation results is higher.
[0198] This specification also provides an electronic device for implementing text segmentation processing, such as... Figure 9 As shown, the electronic device 90 may include a memory 91 and a processor 92, wherein the memory 91 is adapted to store one or more computer instructions, and when the processor 92 executes the computer instructions, it performs the steps of the training method described in any of the foregoing embodiments, or the steps of the sentence segmentation method described in any of the foregoing embodiments.
[0199] In specific implementation, such as Figure 9 As shown, the electronic device 90 may also include an expansion interface 93, which is suitable for connecting with other devices to achieve data interaction.
[0200] Among them, electronic equipment 90 can be general-purpose or special-purpose computer equipment, or more specifically, it can be a server or computer terminal, such as personal computer equipment, portable terminal equipment, etc.
[0201] In practice, the memory 91, processor 92, and expansion interface 93 can be connected via a bus.
[0202] In specific implementations, the processor can be implemented by processing chips such as a central processing unit (CPU), a graphics processing unit (GPU), or a field-programmable gate array (FPGA), or by an application-specific integrated circuit (ASIC) or one or more integrated circuits configured to implement the embodiments of this specification.
[0203] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device.
[0204] This specification also provides a computer-readable storage medium storing computer instructions. When these computer instructions are executed, they can perform the steps of the training method or the text segmentation method described in any of the foregoing embodiments. The computer-readable storage medium can be any suitable readable storage medium such as an optical disc, a hard disk drive, or a solid-state drive. The instructions stored on the computer-readable storage medium execute the steps of the training method or the text segmentation method described in any of the foregoing embodiments, which will not be elaborated further.
[0205] The computer-readable storage medium may include, for example, any suitable type of memory cell, memory device, memory article, memory medium, storage device, storage article, storage medium and / or storage cell, such as memory, removable or non-removable medium, erasable or non-erasable medium, writable or rewritable medium, digital or analog medium, hard disk, floppy disk, optical disc read-only memory (CD-ROM), recordable optical disc (CD-R), rewritable optical disc (CD-RW), optical disc, magnetic medium, magneto-optical medium, removable memory card or disk, various types of digital universal optical disc (DVD), magnetic tape, cassette tape, etc.
[0206] Computer instructions may include any suitable type of code implemented using any appropriate high-level, low-level, object-oriented, visual, compiled, and / or interpreted programming language, such as source code, compiled code, interpreted code, executable code, static code, dynamic code, encrypted code, etc.
[0207] It should be understood that terms such as "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with terms such as "first" and "second" may explicitly or implicitly include one or more of that feature. Furthermore, terms such as "first" and "second" are used to distinguish similar objects and are not necessarily used to describe a specific order or indicate importance. It is understood that such terms can be used interchangeably where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein.
[0208] While the embodiments disclosed in this specification are as described above, they are not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the embodiments in this specification. Therefore, the scope of protection of the embodiments in this specification should be determined by the scope defined in the claims.
Claims
1. A training method of text disfluency, characterized in that, The method comprises the following steps: obtain a first training corpus containing sentence breaking information and a second training corpus not containing sentence breaking information respectively; add sentence breaking information to the second training corpus to obtain a third training corpus; add annotation information related to the sentence breaking information to the first training corpus and the third training corpus respectively; input the first training corpus into a preset neural network model, pre-train the preset neural network model, and obtain an initial text sentence breaking model; the preset neural network model comprises an encoding layer, a time recurrent neural network layer and a conditional random field network layer; the inputting of the first training corpus into the preset neural network model, the pre-training of the preset neural network model and the obtaining of the initial text sentence breaking model comprise the following steps: inputting the first training corpus into the encoding layer, encoding the first training corpus through the encoding layer to obtain a corresponding encoding vector matrix; inputting the encoding vector corresponding to the first training corpus into the time recurrent neural network layer, performing bidirectional operation on the encoding vector matrix corresponding to the first training corpus through the time recurrent neural network layer to obtain a bidirectional encoding vector matrix corresponding to the first training corpus; inputting the bidirectional encoding vector matrix corresponding to the first training corpus into the conditional random field network layer, and calculating the negative log-likelihood function of the sentence breaking information sequence of the first training corpus through the conditional random field network layer according to the sentence breaking information of the first training corpus, and taking the negative log-likelihood function as a loss function; minimizing the loss function by using a back propagation algorithm, iteratively training the preset neural network model, and obtaining the initial text sentence breaking model; input the third training corpus into the initial text sentence breaking model, fine-tune the initial text sentence breaking model, and obtain a text sentence breaking model.
2. The training method of claim 1, wherein, The sentence breaking information comprises punctuation information; The adding of the annotation information related to the sentence breaking information to the first training corpus and the third training corpus comprises the following steps: perform word segmentation on the first training corpus and the third training corpus respectively to obtain word units corresponding to each corpus; add annotation information to the word units corresponding to each corpus according to the punctuation information at preset positions of the word units.
3. The training method of claim 2, wherein, Before the adding of the annotation information to the word units corresponding to each corpus according to the punctuation information at preset positions of the word units, the method further comprises the following steps: perform data cleaning on the word units corresponding to each corpus in the first training corpus and the third training corpus.
4. The training method of claim 2, wherein, Before the adding of the annotation information to the word units corresponding to each corpus according to the punctuation information at preset positions of the word units, the method further comprises the following steps: identify the punctuation information at preset positions of the word units corresponding to each corpus according to a preset punctuation symbol set; when the punctuation symbol at the preset positions of the word units corresponding to each corpus is identified in the preset punctuation symbol set, convert the punctuation symbol at the preset positions of the word units corresponding to each corpus into a preset punctuation symbol.
5. The training method of claim 4, wherein, The punctuation marks corresponding to the preset positions of the word units of the corpora include a sentence end mark, and the sentence end mark includes at least one of an exclamation mark, a question mark and an ellipsis. The preset punctuation mark includes a period.
6. The training method of claim 1, wherein, The adding of the sentence breaking information to the second training corpus to obtain a third training corpus includes: When the obtained second training corpus is a voice training corpus, performing voice recognition on the voice training corpus to obtain corresponding voice data text; Adding sentence breaking information to the voice data text to obtain the third training corpus.
7. A text disambiguation method, characterized by, It includes: Obtaining a text to be punctuated; inputting the text to be punctuated into a text breaking model to obtain a breaking result and outputting the breaking result; The text breaking model is obtained by fine-tuning an initial text breaking model by using a third training corpus having annotation information related to sentence breaking information; the initial text breaking model is obtained by inputting a first training corpus having annotation information related to sentence breaking information into a preset neural network model; the first training corpus contains sentence breaking information; and the third training corpus is obtained by adding sentence breaking information to a second training corpus that does not contain sentence breaking information; The text breaking model includes an encoding layer, a time recurrent neural network layer and a conditional random field network layer; inputting the text to be punctuated into the text breaking model to obtain a breaking result and outputting the breaking result includes: inputting the text to be punctuated into the encoding layer, encoding the text to be punctuated by using the encoding layer to obtain a corresponding encoding vector matrix; inputting the encoding vector corresponding to the text to be punctuated into the time recurrent neural network layer, performing bidirectional operation on the encoding vector matrix corresponding to the text to be punctuated by using the time recurrent neural network layer to obtain a bidirectional encoding vector matrix corresponding to the text to be punctuated; and inputting the bidirectional encoding vector matrix corresponding to the text to be punctuated into the conditional random field network layer, decoding the bidirectional encoding vector matrix corresponding to the text to be punctuated by using the conditional random field network layer to obtain a corpus corresponding to the text to be punctuated and having sentence breaking information and outputting the corpus. 8.A device for training a text disfluency model, comprising: It includes: A corpus acquisition module is adapted to acquire a first training corpus containing sentence breaking information and a second training corpus not containing sentence breaking information; A sentence breaking information adding module is adapted to add sentence breaking information to the second training corpus to obtain a third training corpus; An annotation information adding module is adapted to add annotation information to the first training corpus and the third training corpus. The training module is adapted to input the first training corpus into a preset neural network model, pre-train the preset neural network model, and obtain an initial text sentence breaking model; wherein the preset neural network model comprises an encoding layer, a time recurrent neural network layer, and a conditional random field network layer; the inputting of the first training corpus into the preset neural network model and the pre-training of the preset neural network model to obtain the initial text sentence breaking model comprises: inputting the first training corpus into the encoding layer, encoding the first training corpus through the encoding layer, and obtaining a corresponding encoding vector matrix; inputting the corresponding encoding vector of the first training corpus into the time recurrent neural network layer, performing bidirectional operation on the corresponding encoding vector matrix of the first training corpus through the time recurrent neural network layer, and obtaining a bidirectional encoding vector matrix corresponding to the first training corpus; inputting the bidirectional encoding vector matrix corresponding to the first training corpus into the conditional random field network layer, and calculating a negative log-likelihood function of a sentence breaking information sequence of the first training corpus through the conditional random field network layer according to the sentence breaking information of the first training corpus, and taking the negative log-likelihood function as a loss function; adopting a back propagation algorithm to minimize the loss function, iteratively training the preset neural network model, and obtaining the initial text sentence breaking model; The fine-tuning module is adapted to input the third training corpus into the initial text sentence breaking model, fine-tune the initial text sentence breaking model, and obtain a text sentence breaking model.
9. A text disambiguation apparatus characterized by comprising: The text acquisition module is adapted to acquire a text to be broken up into sentences; The processing module is adapted to input the text to be broken up into sentences into the text sentence breaking model, obtain a sentence breaking result, and output the sentence breaking result; The text sentence breaking model is obtained by fine-tuning an initial text sentence breaking model by using a third training corpus having annotation information related to sentence breaking information; the initial text sentence breaking model is obtained by inputting a first training corpus having annotation information related to sentence breaking information into a preset neural network model; the first training corpus contains sentence breaking information; and the third training corpus is obtained by adding sentence breaking information to a second training corpus that does not contain sentence breaking information. The text breaking model comprises an encoding layer, a time recurrent neural network layer and a conditional random field network layer. The inputting of the text to be broken into the text breaking model, the obtaining of a breaking result and the outputting comprise: inputting the text to be broken into the encoding layer, encoding the text to be broken by the encoding layer to obtain a corresponding encoding vector matrix; inputting the encoding vector corresponding to the text to be broken into the time recurrent neural network layer, performing bidirectional operation on the encoding vector matrix corresponding to the text to be broken by the time recurrent neural network layer to obtain a bidirectional encoding vector matrix corresponding to the text to be broken; inputting the bidirectional encoding vector matrix corresponding to the text to be broken into the conditional random field network layer, decoding the bidirectional encoding vector matrix corresponding to the text to be broken by the conditional random field network layer to obtain corpus with breaking information corresponding to the text to be broken and outputting the corpus.
10. An electronic device comprising a memory and a processor, wherein, The memory is adapted to store one or more computer instructions, and when the processor runs the computer instructions, the steps of the training method according to any one of claims 1 to 6 are executed; or the steps of the text breaking method according to claim 7 are executed.
11. A computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions run to execute the steps of the training method according to any one of claims 1 to 6; or the steps of the text breaking method according to claim 7 are executed.
Citation Information
Patent Citations
Text punctuation model establishment method, punctuation method and device and computer equipment
CN107247706A
Punctuation mark labeling model and training method and device thereof, and storage medium
CN110674629A