Text processing method and device
By extracting and correcting erroneous words in the trial records and correcting them based on the domain word collocation information, the problem of low accuracy of trial records in the prior art is solved, and the quality and accuracy of text data are improved.
Patent Information
- Application Number
- CN201910760655.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-16
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2039-08-16
AI Technical Summary
The accuracy of the trial records obtained by voice conversion of recordings during the trial in the prior art is low, which leads to the clerk's need to make a lot of corrections and limited auxiliary effects.
By extracting wrong words from text information, including grammatical errors, vocabulary errors, and spelling errors, and obtaining corrected words based on word collocation information in the field to which the text information belongs, the text information is finally corrected to obtain the revised text information.
It improves the accuracy of text data obtained by speech recognition, reduces the modification rate of artificial modification, provides high-quality data for the subsequent use of text information, and solves the problem of inaccurate term word recognition in different fields.
Smart Images

Figure CN112395863B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text processing, and in particular to a text processing method and device. Background Art
[0002] As people's legal awareness increases, there are more and more cases, and the traditional judicial trial model is inefficient. Artificial intelligence has more and more application needs and scenarios in the judicial field. A common scenario is that more and more cases need to be heard, and the workload of court clerks has also increased greatly. Recording and video equipment has entered the court in large numbers and gradually assisted the work of court clerks to record the trial during the trial.
[0003] However, there is a natural gap between the text obtained from the court trial recording and the version recorded by the clerk. The purpose of speech recognition (Automatic Speech Recognition, ASR) is to correctly recognize the original speech content of the speaker, that is, spoken language, while the transcript that the clerk needs to record is required to be concise and standardized, in written language. Therefore, the court trial record obtained through speech recognition still requires a lot of revisions by the clerk, and the auxiliary effect on the clerk's work is limited.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a text processing method and device to at least solve the technical problem in the prior art that the accuracy of the trial record obtained by voice conversion of the recording during the trial process is low.
[0006] According to one aspect of an embodiment of the present invention, a text processing method is provided, comprising: extracting erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; obtaining correction words corresponding to the erroneous words based on word collocation information of the field to which the text information belongs, wherein the word collocation information is obtained based on corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain corrected text information.
[0007] According to another aspect of an embodiment of the present invention, a text processing method is also provided, comprising: receiving voice information; displaying first text information, wherein the first text information is text information obtained by recognizing voice information; displaying second text information, wherein incorrect words in the first text information are extracted, and based on word collocation information of the field to which the first text information belongs, correction words corresponding to the incorrect words are obtained, and the first text information is corrected based on the correction words to obtain the second text information, the word collocation information is obtained through the corpus of the field to which the text information belongs, and the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors.
[0008] According to another aspect of an embodiment of the present invention, a text processing method is also provided, including: recording during a trial to obtain voice data of the trial; and extracting erroneous words that are incorrectly recognized in terms of terminology from text information; based on word collocation information in the legal field, obtaining correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on corpus in the legal field; and correcting the text information based on the correction words to obtain corrected text information.
[0009] According to another aspect of an embodiment of the present invention, a text processing device is also provided, including: an extraction module, used to extract erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; an acquisition module, used to obtain correction words corresponding to the erroneous words based on word collocation information of the field to which the text information belongs, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and a correction module, used to correct the text information based on the correction words to obtain the corrected text information.
[0010] According to another aspect of an embodiment of the present invention, a storage medium is also provided, the storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to perform the following steps: extracting erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, spelling errors; based on word collocation information of the field to which the text information belongs, obtaining correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain the corrected text information.
[0011] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein the following steps are performed when the program is running: extracting erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; based on word collocation information of the field to which the text information belongs, obtaining correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain the corrected text information.
[0012] In an embodiment of the present invention, erroneous words are extracted from text information, and based on the word collocation information of the field to which the text information belongs, the corrected words corresponding to the erroneous words are obtained; thereby, the text information is finally corrected based on the corrected words to obtain the corrected text information, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs. Through the above-mentioned embodiments of the present application, incorrectly recognized terms and words in the text data obtained by voice data recognition are corrected, thereby reducing the modification rate of manual modification, providing high-quality data for the subsequent use of text information, and solving the problem of incorrect recognition of terms and words in the field to which the text data obtained due to the same voice recognition for voice data in all fields, and further solving the problem of low accuracy of the trial records obtained by voice conversion of recordings during the trial in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0014] Figure 1 A hardware structure block diagram of a computer terminal (or mobile device) for implementing a text processing method is shown;
[0015] Figure 2 is a flowchart of a text processing method according to Example 1 of the present application;
[0016] Figure 3 is a schematic diagram of processing a recording in a trial according to Embodiment 1 of the present application;
[0017] Figure 4 is a schematic diagram of a text processing method according to Example 1 of the present application;
[0018] Figure 5 is a flowchart of a text processing method according to Embodiment 2 of the present application;
[0019] Figure 6is a schematic diagram of a display interface for processing voice information during a trial according to Embodiment 2 of the present application;
[0020] Figure 7 This is an embodiment of a text processing method according to Embodiment 3 of the present application;
[0021] Figure 8 is a schematic diagram of a text processing device according to Embodiment 4 of the present application;
[0022] Fig. 9 is a schematic diagram of a text processing device according to Embodiment 5 of the present application;
[0023] Fig.10 is a schematic diagram of a text processing device according to Embodiment 6 of the present application; and
[0024] Fig.11 It is a structural block diagram of a computer terminal according to Example 7 of the present application. DETAILED DESCRIPTION
[0025] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0027] Example 1
[0028] According to an embodiment of the present invention, an embodiment of a text processing method is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0029] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing a text processing method. Figure 1 As shown, the computer terminal 10 (or mobile device 10) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0030] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).
[0031] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the text processing method in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned text processing method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0032] The transmission module 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0033] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).
[0034] It should be noted that, in some optional embodiments, the above Figure 1 The computer device (or mobile device) shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. It should be noted that Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the above-described computer device (or mobile device).
[0035] Under the above operating environment, this application provides Figure 2 The processing method of the text shown. Figure 2 It is a flowchart of a text processing method according to application embodiment 1.
[0036] S21, extracting incorrect words from the text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors.
[0037] Specifically, the above text information may be historical trial data in text type, or may be text information obtained by recognizing voice information.
[0038] As an optional embodiment, before extracting erroneous words from text information, input voice data may also be received; the text information may be obtained based on the voice data in any of the following ways: performing voice recognition on the voice data to obtain the text information; extracting keywords from the voice data, and combining the keywords to obtain the text information.
[0039] The voice data may be recording data obtained by recording in a scenario where voice information needs to be recorded. For example, it may be recording data recorded during a trial. During the trial, persons with different identities, such as the judge, the defendant, the plaintiff, and the lawyer, speak through microphones with different identifiers and sound pickup devices. Different microphones are recorded as different persons, so that the voice data of different persons during the trial can be obtained. ASR can be performed on the voice data of different persons to obtain text information of different persons.
[0040] After obtaining the voice data, voice recognition can be performed directly on the voice data to obtain text information; keywords can also be extracted from the voice data, where the keywords refer to words with practical meanings, for example, words other than modal particles and spoken expressions, and text information can be obtained based on keyword combinations, thereby removing redundant information in the voice data before correcting the text information.
[0041] In an optional embodiment, during the trial, the voice information during the trial is recorded by a recording device to obtain the above-mentioned voice data, and then voice recognition is performed on the recorded trial data to obtain text information corresponding to the voice data.
[0042] Figure 3 is a schematic diagram of processing a recording in a trial according to Example 1 of the present application, combined with Figure 3 As shown, first, the case entity in the recognition result can be corrected through the case entity error recognition module; then the correction result can be input into the colloquial error type recognition model to correct the modal particles, colloquial expressions, pause words, and repeated words in the text information; the correction result is input into the legal terminology correction module, and the legal terminology correction module corrects the misrecognized terminology through the method provided in the embodiment of the present application; finally, the correction result can also be input into the punctuation restoration module to restore the punctuation information in the voice data, so as to finally obtain a trial record that has a higher similarity to the clerk's record and requires less modification by the clerk.
[0043] Specifically, since the general field speech recognition method is still used during speech recognition, the grammatical errors, vocabulary errors and spelling errors mentioned above may be terminology words, that is, professional terms in the field to which the text information belongs. For example, the legal field has its corresponding terminology words, and the civil engineering field also has its terminology words. That is, terminology words are prone to errors during the recognition process.
[0044] In the above scheme, the reasons for the occurrence of incorrect words may include the following: 1. Due to inaccurate speech recognition, the originally correct terms in the speech data are recognized as incorrect words; 2. The terms in the speech data are expressed incorrectly or non-standardly, and they are accurately recognized as words of text information during the speech recognition process.
[0045] In an optional embodiment, the extraction of incorrect words can be performed through a word database of the field to which the text information belongs. For example, the terminology in the text information can be first extracted, and then the terminology is compared with the terminology in the word database to determine whether the terminology in the text information is accurate.
[0046] S23, based on the word collocation information of the field to which the text information belongs, obtaining a correction word corresponding to the wrong word, wherein the word collocation information is obtained according to the corpus of the field to which the text information belongs.
[0047] Specifically, the above-mentioned word collocation information is obtained based on the corpus of the field to which the text information belongs.
[0048] In an optional embodiment, the word collocation information may include a neural network model for predicting word collocation. The neural network model may be used to learn the collocation mode of the corpus in the field to which the text information belongs, thereby obtaining the above-mentioned modified words.
[0049] In another optional embodiment, the above-mentioned word collocation information may also be a word collocation table, which is obtained by collecting statistics on the collocation of terms in the corpus in this field.
[0050] S25, correcting the text information based on the correction word to obtain the corrected text information.
[0051] In an optional embodiment, the erroneous words in the text information may be replaced with their corresponding corrected words, thereby obtaining corrected text information.
[0052] It should be noted that the number of the correction words obtained in step S25 may be multiple, so before correcting the text information based on the correction words, one with the highest accuracy can be selected from the multiple correction words.
[0053] Since the revised text information has corrected the terminology, it is more closely related to the field to which it belongs. This can reduce the clerk's modification rate on the one hand, and provide better data quality for subsequent trial summaries and element identification analysis on the other hand.
[0054] It can be seen that the solution provided by the above-mentioned embodiment of the present application extracts the wrong words that are incorrectly recognized for the terminology from the text information, and obtains the correction words corresponding to the wrong words based on the word collocation information of the field to which the text information belongs; thereby finally correcting the text information based on the correction words to obtain the corrected text information, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs. Through the above-mentioned embodiment of the present application, the incorrectly recognized terminology in the text data obtained by voice data recognition is corrected, thereby reducing the modification rate of manual modification, providing high-quality data for the subsequent use of text information, and solving the problem of incorrect recognition of terminology in the field to which it belongs in the text data obtained due to the same voice recognition for voice data in all fields, and further solving the problem of low accuracy of the trial records obtained by voice conversion of recordings during the trial in the prior art.
[0055] As an optional embodiment, extracting incorrect words from text information includes: segmenting the text information according to a word database of the field to which the text information belongs to obtain multiple words included in the text information; scoring the words based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; scoring the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data from the field to which the text information belongs; and determining whether the word is an incorrect word by comparing the first score and the second score with a preset score.
[0056] In the above steps, the text information is first segmented. It should be noted that the above steps use the word database of the field to which the text information belongs to segment the text information, so that the segmentation result conforms to the characteristics of the field to which the text information belongs.
[0057] In the solution of the present application, the language model scores a word based on one or more preceding words, and is used to determine the probability of the word appearing, that is, the rationality of its appearance.
[0058] The difference between the first language model and the second language model is that their training data is different. The training data of the first language model is sample data from at least two fields, that is, the first language model is actually a language model of a general field; while the training data of the second language model is sample data from the field to which the text information belongs, that is, the second language model is a professional language model. Using the two models to score words respectively can determine the rationality of words from multiple dimensions.
[0059] When determining incorrect words based on scoring, a score threshold may be set. If both the first score and the second score are lower than the score threshold, it means that the rationality of the word is low in both general and professional fields, and therefore the word is an incorrect word.
[0060] As an optional embodiment, the first score includes a first sub-score and a second sub-score. Scoring the words based on the first language model to obtain the first score includes: scoring the words based on the N-gram first language model to obtain the first sub-score; scoring the words based on the M-gram first language model to obtain the second sub-score, where M is not equal to N; the second score includes a third sub-score and a fourth sub-score. Scoring the words based on the second language model to obtain the second score includes: scoring the words based on the N-gram second language model to obtain the third sub-score; scoring the words based on the M-gram second language model to obtain the fourth sub-score.
[0061] In an optional embodiment, the above N may be 2, and M may be 3, that is, each word is scored by bigram1 (first language model of bigram), trigram1 (first language model of trigram), and bigram2 (second language model of bigram), trigram2 (second language model of trigram), thereby improving the prudence of the scoring results and reducing the situation of misrecognition.
[0062] As an optional embodiment, determining whether a word is an incorrect word is performed by comparing the first score and the second score with a preset score, including: determining that the word is an incorrect word when the first sub-score, the second sub-score, the third sub-score, and the fourth sub-score are all less than the preset score; or determining that the word is not an incorrect word when any one or more of the first sub-score, the second sub-score, the third sub-score, and the fourth sub-score is greater than or equal to the preset score.
[0063] In the above steps, when the four scores are all less than the preset scores, the word is determined to be an incorrect word.
[0064] Specifically, the above steps are used to identify the location where the error occurs, that is, the erroneous word, from the text information. Figure 4is a schematic diagram of a text processing method according to Example 1 of the present application. In an optional embodiment, still taking the legal field as an example, Figure 4 As shown, the above steps can be performed by a general language model and a legal professional language model, and specifically include the following steps:
[0065] S41, train a general language model, that is, an ngram language model for a general domain. The corpus can come from Chinese Wikipedia data, and 3-gram can be used.
[0066] S42, training the legal professional language model, that is, the ngram language model in the legal field. The corpus can come from the court transcripts of the clerk version, as well as the judgment documents, etc., and 3-gram can also be used.
[0067] S43, import the word pair list into two n-gram models respectively, obtain the 2-gram and 3-gram scores of the two models, a total of four scores, if the four scores are all lower than a certain threshold, then the word is considered to be wrong. The threshold is a manually selected number, for example, the threshold can be selected as -5.5.
[0068] As an optional embodiment, the word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods. Based on the word collocation information of the field to which the text information belongs, the correction words corresponding to the wrong words are obtained, including: obtaining the prefix and postposition of the wrong word, wherein the prefix is used to indicate the words before the wrong word, and the postposition is used to indicate the words after the wrong word; searching for the corresponding word collocation method in the word collocation information according to the prefix and postposition; searching for the corresponding word collocation method in the word collocation information according to the prefix and postposition, and determining the target word collocation method according to the probability of the found word collocation method; determining the correction word corresponding to the wrong word according to the words that are collocated with the prefix and postposition in the target word collocation method.
[0069] After the erroneous words in the text information are identified, the correction words corresponding to each erroneous word are acquired.
[0070] Specifically, the above-mentioned prefixes and postpositions are the words before the wrong word and the words after the wrong word, respectively. It should be noted that not all words before and after the wrong word can be used as prefixes and postpositions. In an optional embodiment, the prefixes and postpositions are not only located before and after the wrong word, but also have a part of speech such as nouns, adjectives, verbs, etc., which have practical meanings. Words of the parts of speech such as quantifiers, pronouns, auxiliary words, conjunctions, prepositions, etc. are not used as prefixes and postpositions.
[0071] In the above scheme, the word collocation information includes: different word collocation modes and corresponding probabilities of the word collocation modes. After obtaining the prefix and the postposition, based on the prefix, the word collocation after the prefix is obtained in the word collocation information, and based on the postposition, the word collocation before the postposition is obtained in the word collocation information, thereby obtaining multiple collocation modes, and then based on the probability of each collocation mode, one or more words are selected as the correction words.
[0072] It should also be noted that the collocation with the highest probability can be selected as the target word collocation, and the collocation with the top n probabilities can also be selected as the target word collocation.
[0073] As an optional embodiment, the correction word corresponding to the erroneous word is determined according to the words that are collocated with the prefix and the postposition in the target word collocation method, including: determining that the words that are collocated with the prefix and the postposition in the target word collocation method are the first candidate correction words; and selecting at least one correction word from the first candidate correction words according to the phonetic information of the first candidate correction words.
[0074] The above steps are used to select at least one correction word from the first candidate correction words. In an optional embodiment, the selection can be made based on the phonetic information of the first candidate correction word.
[0075] As an optional embodiment, selecting a correction word from a first set of candidate correction words based on the phonetic information of the correction word includes: obtaining distance information between the phonetic information of the first candidate correction word and the phonetic information of the incorrect word; obtaining the longest common substring between the phonetic information of the first candidate correction word and the phonetic information of the incorrect word; determining a score of the first candidate correction word based on the distance information and the longest common substring; and selecting a correction word from the first set of candidate correction words based on the score of the first candidate correction word.
[0076] In an optional embodiment, the distance information between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word can be calculated in the following manner: first determine the first vector corresponding to the phonetic information of the first candidate corrected word, and then determine the second vector corresponding to the phonetic information of the incorrect word. The distance information between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word can be determined based on the distance between the first vector and the second vector.
[0077] In another optional embodiment, the distance information may also be determined by the edit distance between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word.
[0078] In the above steps, the longest common substring and the distance information have corresponding weight values, and the two can be weighted according to their corresponding weight values to obtain the score of the first candidate modified word.
[0079] As an optional embodiment, a correction word is selected from the first candidate correction words according to the score, including: selecting multiple second candidate correction words from the first candidate correction words in order of high to low scores; using multiple second candidate correction words to replace the wrong words to obtain multiple candidate text information; scoring the multiple candidate text information through a language model; and determining the second candidate correction word corresponding to the candidate text information with the highest score as the correction word.
[0080] In the above steps, the first candidate correction word is used to replace the wrong word to obtain multiple candidate text information. The multiple candidate words are substituted back into the n-gram model for score comparison, and the one with the higher score is selected for correction and replacement.
[0081] In an optional embodiment, still combined with Figure 4 As shown, the corrected words corresponding to the wrong words can be determined through the following steps.
[0082] S51, obtaining the prefix and postposition of the wrong word according to the current wrong word. The prefix and postposition here are the same as the above concepts and will not be repeated here.
[0083] S52, obtaining candidate modifiers according to the term matching table, and searching the term matching table for candidate words using the prefix and postposition.
[0084] Specifically, the term collocation table is the aforementioned word collocation information, wherein the obtained candidate correction word is the aforementioned first candidate correction word.
[0085] S52, similarity calculation module. First, obtain the pinyin of the word to be corrected and the word collocation table, calculate the edit distance and LCS weighted score of the pinyin of the wrong word and the pinyin of each word in the candidate word set, and take the first few words that exceed the threshold as the second candidate words. The specific formula is 0.5*edit distance+0.8*LCS.
[0086] The above step determines the second candidate correction word by calculating the similarity between the first candidate correction word and the wrong word, and the first few words exceeding the threshold are the second candidate correction words mentioned above.
[0087] S53, sorting according to the language model scores. The candidate words are substituted for the suspected wrong words and substituted back into the n-gram model for score comparison, and the one with the higher score is selected for correction and replacement.
[0088] There are many types of language models that can be used here. It can be the aforementioned n-gram general field language model, the aforementioned n-gram legal field language model, or other language models, which are not limited here.
[0089] As an optional embodiment, the method further includes: obtaining word collocation information, wherein obtaining word collocation information includes: obtaining corpus of the field to which the text information belongs; segmenting the corpus, and extracting target words from the segmentation results, wherein the target words are words specified in the field to which the text information belongs; obtaining a first probability of the target word and an adjacent word appearing together, and a second probability of the target word and an interval word appearing together; and determining the word collocation information based on the first probability and the second probability.
[0090] Specifically, the target word is a term in the field to which the text information belongs, the adjacent word is a word that has an adjacent position relationship with the target word, and the interval word is a word that has a specified window distance with the target word.
[0091] In an optional embodiment, after obtaining a target word, the adjacent words and the spaced words of the target word are searched in the corpus, and the probability of the target word and each adjacent word and the spaced word co-occurring is obtained. Then the target word and each adjacent word or the spaced word form a corresponding word collocation mode, and the probability of co-occurrence is used as the probability of the word collocation mode, and stored together with the word collocation mode, so as to obtain the above-mentioned word collocation information. When storing, it can be stored in a table, so that a word collocation table can be obtained.
[0092] As an optional embodiment, the interval word is a word that meets the following conditions: the interval word is a preset window length from the target word; and the interval word belongs to any part of speech of a noun, a verb, or an adjective.
[0093] Specifically, the above steps are used to determine meaningful interval words, the window length can be between 1-5, nouns, verbs or adjectives are all words with practical meanings, so words of these parts of speech are selected as interval words. In an optional embodiment, the interval words can be selected in the following way: after determining the target word, search for words forward or backward according to the specified window length, and determine whether the searched word is any one of nouns, verbs or adjectives. If the judgment result is yes, the word is determined to be an interval word.
[0094] In an optional embodiment, still combined with Figure 4 As shown in the figure, word collocation information can be mined through the following steps:
[0095] S61, the collected legal corpus, includes judicial documents data and court transcript data of the clerk version.
[0096] S62, segment the collected corpus and identify the legal terms therein, i.e., the terminology in this field.
[0097] S63, counting the co-occurrence probabilities of adjacent words and spaced words, and mining a term collocation table according to the co-occurrence probabilities. At least one word in the term collocation table must be a legal term.
[0098] As an optional embodiment, after segmenting the text information according to a word database of the field to which the text information belongs to obtain multiple words included in the text information, the method also includes: segmenting the text information according to punctuation marks in the text information to obtain segmented clauses; removing punctuation marks; and normalizing the digital information in the text information according to preset symbols.
[0099] Specifically, the word segmentation of the text information and the above steps are all processes for preprocessing the text information. The punctuation marks in the above text information are the punctuation marks of the original ASR text. After the word segmentation result is segmented using the punctuation marks of the original ASR, the above punctuation marks are deleted.
[0100] After the above punctuation, you can also normalize the numbers in the text information, that is, replace the numbers in the text information with a unified special symbol. For example, you can use <num>Replace all numbers.
[0101] In an optional embodiment, still combined with Figure 4 As shown, still taking the voice information in the trial process as an example, after the trial voice information is recognized to obtain text information, the text information can be pre-processed to facilitate the use of subsequent processing modules. The words spoken by multiple roles can be input in chronological order. The total number can be controlled, and the general window is set to 10. The roles can include: the presiding judge, plaintiff 1, defendant 1, the plaintiff's attorney, and the defendant's attorney, etc.
[0102] The specific preprocessing steps are:
[0103] S71, segmenting the text information.
[0104] Specifically, a dictionary in the legal field may be added to analyze text information, and the method of constructing the dictionary in the legal field is not limited.
[0105] S72, segmenting the original ASR text according to the punctuation marks.
[0106] The punctuation marks of the original ASR text are the punctuation marks obtained after performing speech recognition on the speech data.
[0107] S73, remove punctuation marks from the clauses obtained after segmentation.
[0108] S74, normalizing the numbers in the text information using special symbols.
[0109] Example 2
[0110] According to an embodiment of the present invention, an embodiment of a text processing method is also provided. Figure 5 is a flowchart of a text processing method according to Example 2 of the present application, combined with Figure 5 As shown, the method comprises the following steps:
[0111] Step S51, receiving voice information.
[0112] Specifically, the above-mentioned voice data may be recording data obtained by recording in a scenario where voice information needs to be recorded. For example, it may be recording data recorded during a trial. During the trial, persons with identities such as the judge, the defendant, the plaintiff, and the lawyer speak through microphones with different identifiers and sound pickup devices, and different microphones are recorded as different persons, so that the voice data of different persons during the trial can be obtained.
[0113] Step S53: displaying the first text information, wherein the first text information is text information obtained by recognizing the voice information.
[0114] In an optional embodiment, during the trial, the voice information during the trial is recorded by a recording device to obtain the above-mentioned voice data, and then voice recognition is performed on the recorded trial data to obtain text information corresponding to the voice data.
[0115] Step S55, displaying the second text information, wherein incorrect words in the first text information are extracted, and based on the word collocation information of the field to which the first text information belongs, corrected words corresponding to the incorrect words are obtained, and the first text information is corrected based on the corrected words to obtain the second text information, the word collocation information is obtained through the corpus of the field to which the text information belongs, and the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors.
[0116] Specifically, since the general field speech recognition method is still used during speech recognition, the grammatical errors, vocabulary errors and spelling errors mentioned above may be terminology words, that is, professional terms in the field to which the text information belongs. For example, the legal field has its corresponding terminology words, and the civil engineering field also has its terminology words. That is, terminology words are prone to errors during the recognition process.
[0117] In the above scheme, the reasons for the occurrence of incorrect words may include the following: 1. Due to inaccurate speech recognition, the originally correct terms in the speech data are recognized as incorrect words; 2. The terms in the speech data are expressed incorrectly or non-standardly, and they are accurately recognized as words of text information during the speech recognition process.
[0118] In an optional embodiment, the extraction of incorrect words can be performed through a word database of the field to which the text information belongs. For example, the terminology in the text information can be first extracted, and then the terminology is compared with the terminology in the word database to determine whether the terminology in the text information is accurate.
[0119] Specifically, the above-mentioned word collocation information is obtained based on the corpus of the field to which the text information belongs.
[0120] In an optional embodiment, the word collocation information may include a neural network model for predicting word collocation. The neural network model may be used to learn the collocation mode of the corpus in the field to which the text information belongs, thereby obtaining the above-mentioned modified words.
[0121] In another optional embodiment, the above-mentioned word collocation information may also be a word collocation table, which is obtained by collecting statistics on the collocation of terms in the corpus in this field.
[0122] In an optional embodiment, the erroneous words in the text information may be replaced with their corresponding corrected words, thereby obtaining corrected text information.
[0123] It should be noted that the number of the correction words obtained in step S25 may be multiple, so before correcting the text information based on the correction words, one with the highest accuracy can be selected from the multiple correction words.
[0124] Figure 6 2 is a schematic diagram of a display interface for processing voice information during a trial according to Embodiment 2 of the present application. Figure 6 As shown in the figure, the ASR language conversion version (text information directly converted from voice data) and the NLP-generated clerk version (corrected text information) will be displayed in the same interface, and the trial recording can be played at the same time. Since the corrected text information corrects the terminology, it makes the corrected text information more consistent with the field to which it belongs, which can reduce the clerk's modification rate on the one hand, and provide better data quality for subsequent trial summaries and element recognition analysis on the other hand.
[0125] It can be seen that the solution provided by the above-mentioned embodiment of the present application extracts the wrong words that are incorrectly recognized for the terminology from the text information, and obtains the correction words corresponding to the wrong words based on the word collocation information of the field to which the text information belongs; thereby finally correcting the text information based on the correction words to obtain the corrected text information, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs. Through the above-mentioned embodiment of the present application, the incorrectly recognized terminology in the text data obtained by voice data recognition is corrected, thereby reducing the modification rate of manual modification, providing high-quality data for the subsequent use of text information, and solving the problem of incorrect recognition of terminology in the field to which it belongs in the text data obtained due to the same voice recognition for voice data in all fields, and further solving the problem of low accuracy of the trial records obtained by voice conversion of recordings during the trial in the prior art.
[0126] The text processing method in this embodiment also includes other steps of the text processing method in Example 1, which will not be repeated here.
[0127] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0128] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of various embodiments of the present invention.
[0129] Example 3
[0130] According to an embodiment of the present invention, an embodiment of a text processing method is also provided. Figure 7 is a text processing method embodiment according to embodiment 3 of the present application, combined with Figure 7 As shown, the method comprises the following steps:
[0131] S71, recording the court trial to obtain voice data of the court trial.
[0132] Specifically, the above-mentioned voice data is the audio recording data recorded during the trial. During the trial, persons with different identities, such as the judge, the defendant, the plaintiff, and the lawyer, speak through microphones with different identifiers and sound pickup devices. Different microphones are recorded as different persons, so that the voice data of different persons during the trial can be obtained.
[0133] S73, recognizing text information from the voice data, and extracting erroneous words resulting from incorrect recognition of terminology from the recognized text information.
[0134] Specifically, the above-mentioned terminology refers to professional terms in the legal field.
[0135] In the above scheme, errors in terminology recognition may include the following: 1. Due to inaccurate speech recognition, the originally correct terminology in the speech data is recognized as an incorrect word; 2. The terminology in the speech data is expressed incorrectly or non-standardly, and it is accurately recognized as a word of text information during the speech recognition process.
[0136] In an optional embodiment, the extraction of incorrect words can be performed through a word database in the legal field. For example, the terminology in the text information can be first extracted, and then the terminology is compared with the terminology in the word database to determine whether the terminology in the text information is accurate.
[0137] S75, based on the word collocation information in the legal field, obtaining a correction word corresponding to the erroneous word, wherein the word collocation information is obtained based on the corpus in the legal field.
[0138] In an optional embodiment, the word collocation information may include a neural network model for predicting word collocation. The collocation mode of the legal field corpus can be learned through the neural network model to obtain the above-mentioned modified words.
[0139] In another optional embodiment, the above-mentioned word collocation information may also be a word collocation table, which is obtained by collecting statistics on the collocation of terms in the corpus in this field.
[0140] S77, correcting the text information based on the correction word to obtain the corrected text information.
[0141] In an optional embodiment, the erroneous words in the text information may be replaced with their corresponding corrected words, thereby obtaining corrected text information.
[0142] It should be noted that the number of the correction words obtained in step S25 may be multiple, so before correcting the text information based on the correction words, one with the highest accuracy can be selected from the multiple correction words.
[0143] Since the revised text information has corrected the terminology, it is more closely related to the legal field. This can reduce the clerk's modification rate on the one hand, and provide better data quality for subsequent trial summaries and element identification analysis on the other hand.
[0144] It can be seen that the solution provided by the above embodiment of the present application is to record the trial process to obtain the voice data of the trial; identify the text information from the voice data, and extract the wrong words that are incorrectly recognized for the terminology from the identified text information; obtain the correction words corresponding to the wrong words based on the word collocation information in the legal field, wherein the word collocation information is obtained according to the corpus in the legal field; and correct the text information based on the correction words to obtain the corrected text information. . Through the above embodiment of the present application, the incorrectly recognized terminology in the text data obtained by voice data recognition is corrected, thereby reducing the modification rate of manual modification, providing high-quality data for the subsequent use of text information, solving the problem of incorrect recognition of the terminology in the legal field in the text data obtained by the same voice recognition for voice data in all fields, and further solving the problem of low accuracy of the trial record obtained by voice conversion of the recording during the trial in the prior art.
[0145] As an optional embodiment, extracting erroneous words that are incorrectly recognized for terminology from recognized text information includes: segmenting the text information according to a word database of the field to which the text information belongs, to obtain a plurality of words included in the text information; scoring the words based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; scoring the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data from the field to which the text information belongs; and determining whether the word is an erroneous word by comparing the first score and the second score with a preset score.
[0146] As an optional embodiment, the word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods. Based on the word collocation information of the field to which the text information belongs, the correction words corresponding to the wrong words are obtained, including: obtaining the prefix and postposition of the wrong word, wherein the prefix is used to indicate the words before the wrong word, and the postposition is used to indicate the words after the wrong word; searching for the corresponding word collocation method in the word collocation information according to the prefix and postposition, and determining the target word collocation method according to the probability of the found word collocation method; determining the correction words corresponding to the wrong word according to the words that are collocated with the prefix and postposition in the target word collocation method.
[0147] It should be noted that the text processing method in this embodiment also includes other steps of the text processing method in Example 1, which will not be repeated here.
[0148] Example 4
[0149] According to an embodiment of the present invention, there is also provided a text processing device for implementing the text processing method in the above embodiment 1. Figure 8 is a schematic diagram of a text processing device according to Embodiment 4 of the present application, such as Figure 8 As shown, the device 800 includes:
[0150] The extraction module 802 is used to extract incorrect words from the text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors.
[0151] The acquisition module 804 is used to acquire the corrected words corresponding to the wrong words based on the word collocation information of the field to which the text information belongs, wherein the word collocation information is obtained according to the corpus of the field to which the text information belongs.
[0152] The correction module 806 is used to correct the text information based on the correction words to obtain the corrected text information.
[0153] It should be noted that the above extraction module 802, acquisition module 804 and correction module 806 correspond to steps S21 to S27 in Example 1, and the four modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above Example 1. It should be noted that the above modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0154] As an optional embodiment, the first recognition module includes: a first word segmentation submodule, which is used to segment text information according to a word database of the field to which the text information belongs, and obtain multiple words included in the text information; a first scoring submodule, which is used to score the words based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; a second scoring submodule, which is used to score the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data from the field to which the text information belongs; and a first determination submodule, which is used to determine whether a word is an incorrect word by comparing the first score and the second score with a preset score.
[0155] As an optional embodiment, the first score includes a first sub-score and a second sub-score, and the first scoring submodule includes: a first scoring unit, used to score the words based on the N-gram first language model to obtain a first sub-score; a second scoring unit, used to score the words based on the M-gram first language model to obtain a second sub-score, wherein M is not equal to N; the second scoring submodule includes: a third scoring unit, used to score the words based on the N-gram second language model to obtain a third sub-score; and a fourth scoring unit, used to score the words based on the M-gram second language model to obtain a fourth sub-score.
[0156] As an optional embodiment, the first determination submodule includes: a first determination unit, used to determine that a word is an incorrect word when the first sub-score, the second sub-score, the third sub-score and the fourth sub-score are all less than a preset score; or a second determination unit, used to determine that a word is not an incorrect word when any one or more of the first sub-score, the second sub-score, the third sub-score and the fourth sub-score is greater than or equal to a preset score.
[0157] As an optional embodiment, the word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods, and the acquisition module includes: a first acquisition submodule, used to acquire the prefix and postposition of the wrong word, wherein the prefix is used to indicate the word before the wrong word, and the postposition is used to indicate the word after the wrong word; a search submodule, used to search for the corresponding word collocation method in the word collocation information according to the prefix and postposition, and determine the target word collocation method according to the probability of the found word collocation method; a second determination submodule, used to determine the correction word corresponding to the wrong word according to the words collocated with the prefix and postposition in the target word collocation method.
[0158] As an optional embodiment, the second determination submodule includes: a first determination subunit, used to determine that the word that is collocated with the prefix and the postposition in the target word collocation method is a first candidate correction word; a selection subunit, used to select a correction word from the first candidate correction words according to the phonetic information of the first candidate correction word.
[0159] As an optional embodiment, the first selection subunit includes: a first acquisition subunit, used to acquire the distance information between the phonetic information of the first candidate correction word and the phonetic information of the incorrect word; a second acquisition subunit, used to acquire the longest common substring between the phonetic information of the first candidate correction word and the phonetic information of the incorrect word; a second determination subunit, used to determine the score of the first candidate correction word based on the distance information and the longest common substring; and a second selection subunit, used to select at least one correction word from the first candidate correction words based on the score of the first candidate correction word.
[0160] As an optional embodiment, the second selection subunit includes: a third selection subunit, used to select multiple second candidate correction words from the first candidate correction words in order of scores from high to low; a replacement subunit, used to use multiple second candidate correction words to replace erroneous words to obtain multiple candidate text information; a scoring subunit, used to score the multiple candidate text information through a language model; a third determination subunit, used to determine that the second candidate correction word corresponding to the candidate text information with the highest score is the correction word.
[0161] As an optional embodiment, the above-mentioned device also includes: a generation module, which is used to obtain word collocation information, wherein the generation module includes: a second acquisition submodule, which is used to obtain corpus in the field to which the text information belongs; an extraction submodule, which is used to segment the corpus and extract target words from the segmentation results, wherein the target words are specified words in the field to which the text information belongs; a second segmentation submodule, which is used to obtain a first probability of the target word and an adjacent word appearing together, and a second probability of the target word and an interval word appearing together; a third determination submodule, which is used to determine the word collocation information based on the first probability and the second probability.
[0162] As an optional embodiment, the interval word is a word that meets the following conditions: the interval word is a preset window length from the target word; and the interval word belongs to any part of speech of a noun, a verb, or an adjective.
[0163] As an optional embodiment, after segmenting the text information according to a word database of the field to which the text information belongs to obtain a plurality of words included in the text information, the device further includes:
[0164] The segmentation submodule is used to segment the text information according to the punctuation marks in the text information to obtain the segmented clauses; the cleaning submodule is used to remove the punctuation marks; the normalization submodule is used to normalize the digital information in the text information according to the preset symbols.
[0165] As an optional embodiment, the above-mentioned device also includes: a receiving module for receiving input voice data; a second recognition module for obtaining text information based on the voice data in any of the following ways: performing voice recognition on the voice data to obtain text information; extracting keywords from the voice data and combining the keywords to obtain text information.
[0166] Example 5
[0167] According to an embodiment of the present invention, there is also provided a text processing device for implementing the text processing method in the above embodiment 1. Fig. 9 is a schematic diagram of a text processing device according to Embodiment 5 of the present application, such as Fig. 9 As shown, the device 900 includes:
[0168] The receiving module 902 is used to receive voice information.
[0169] The first display module 904 is used to display first text information, wherein the first text information is text information obtained by recognizing voice information.
[0170] The second display module 906 is used to display the second text information, wherein the incorrect words in the first text information are extracted, and based on the word collocation information of the field to which the first text information belongs, the corrected words corresponding to the incorrect words are obtained, and the first text information is corrected based on the corrected words to obtain the second text information, the word collocation information is obtained through the corpus of the field to which the text information belongs, and the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors.
[0171] It should be noted that the above-mentioned receiving module 902, the first display module 904 and the second display module 906 correspond to steps S51 to S57 in Example 2, and the three modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules, as part of the device, can be run in the computer terminal 10 provided in Example 1.
[0172] Example 6
[0173] According to an embodiment of the present invention, there is also provided a text processing device for implementing the text processing method in the above-mentioned embodiment 3. Fig.10 is a schematic diagram of a text processing device according to Example 6 of the present application, such as Fig.10 As shown, the device 100 includes:
[0174] The recording module 1002 is used to record the court trial and obtain the voice data of the court trial.
[0175] The extraction module 1004 is used to recognize text information from the voice data and extract erroneous words resulting from incorrect recognition of terminology from the recognized text information.
[0176] The acquisition module 1006 is used to acquire the corrected words corresponding to the incorrect words based on the word collocation information in the legal field, wherein the word collocation information is obtained based on the corpus in the legal field.
[0177] The correction module 1008 is used to correct the text information based on the correction words to obtain the corrected text information.
[0178] It should be noted that the recording module 1002, extraction module 1004, acquisition module 1006 and correction module 1008 correspond to steps S51 to S57 in Example 3, and the examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the above-mentioned modules as part of the device can be run in the computer terminal 10 provided in Example 1.
[0179] As an optional embodiment, the acquisition module includes: a word segmentation submodule, which is used to segment the text information according to a word database of the field to which the text information belongs, and obtain multiple words included in the text information; a first scoring submodule, which is used to score the words based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; a second scoring submodule, which is used to score the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data from the field to which the text information belongs; and a comparison submodule, which is used to determine whether a word is an incorrect word by comparing the first score and the second score with a preset score.
[0180] As an optional embodiment, the word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods, and the acquisition module includes: an acquisition submodule, used to acquire the prefix and postposition of the wrong word, wherein the prefix is used to indicate the word before the wrong word, and the postposition is used to indicate the word after the wrong word; a search submodule, used to search for the corresponding word collocation method in the word collocation information according to the prefix and postposition, and determine the target word collocation method according to the probability of the found word collocation method; a determination submodule, used to determine the correction word corresponding to the wrong word according to the words collocated with the prefix and postposition in the target word collocation method.
[0181] Example 7
[0182] The embodiment of the present invention can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.
[0183] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of the computer network.
[0184] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the text processing method: extracting erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; based on the word collocation information of the field to which the text information belongs, obtaining the correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain the corrected text information.
[0185] Optionally, Fig.11 is a structural block diagram of a computer terminal according to Embodiment 7 of the present application. Fig.11 As shown, the computer terminal A may include: one or more (only one is shown in the figure) processors 1102 , a memory 1104 , and a peripheral interface 1106 .
[0186] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the text processing method and device in the embodiment of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned text processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the terminal A via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0187] The processor can call the information and application programs stored in the memory through the transmission device to perform the following steps: extracting erroneous words from the text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; based on the word collocation information of the field to which the text information belongs, obtaining the correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain the corrected text information.
[0188] Optionally, the processor may also execute program code for the following steps: segmenting the text information according to a word database of the field to which the text information belongs to obtain a plurality of words included in the text information; scoring the words based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; scoring the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data from the field to which the text information belongs; and determining whether a word is an incorrect word by comparing the first score and the second score with a preset score.
[0189] Optionally, the processor may also execute program code of the following steps: the first score includes a first sub-score and a second sub-score, scoring the word based on the N-gram first language model to obtain the first sub-score; scoring the word based on the M-gram first language model to obtain the second sub-score, wherein M is not equal to N; scoring the word based on the N-gram second language model to obtain the third sub-score; and scoring the word based on the M-gram second language model to obtain the fourth sub-score.
[0190] Optionally, the processor may also execute program code for the following steps: determining that a word is an incorrect word when the first sub-score, the second sub-score, the third sub-score, and the fourth sub-score are all less than a preset score; or determining that a word is not an incorrect word when any one or more of the first sub-score, the second sub-score, the third sub-score, and the fourth sub-score is greater than or equal to a preset score.
[0191] Optionally, the processor may also execute the program code of the following steps: the word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods, obtaining the prefix and postposition of the wrong word, wherein the prefix is used to indicate the word before the wrong word, and the postposition is used to indicate the word after the wrong word; searching the corresponding word collocation method in the word collocation information according to the prefix and postposition, and determining the target word collocation method according to the probability of the found word collocation method; determining the correction word corresponding to the wrong word according to the words that are collocated with the prefix and postposition in the target word collocation method.
[0192] Optionally, the processor may also execute the following program code: determining that the word that is collocated with the prefix and the postposition in the target word collocation mode is the first candidate correction word; and selecting a correction word from the first candidate correction words according to the phonetic information of the first candidate correction word.
[0193] Optionally, the processor may also execute the program code of the following steps: obtaining the distance information between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word; obtaining the longest common substring between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word; determining the score of the first candidate corrected word based on the distance information and the longest common substring; and selecting at least one corrected word from the first candidate corrected words based on the score of the first candidate corrected word.
[0194] Optionally, the processor may also execute the program code of the following steps: selecting multiple second candidate correction words from the first candidate correction words in descending order of scores; using multiple second candidate correction words to replace erroneous words to obtain multiple candidate text information; scoring the multiple candidate text information through a language model; and determining the second candidate correction word corresponding to the candidate text information with the highest score as the correction word.
[0195] Optionally, the processor may also execute the program code of the following steps: obtaining word collocation information, wherein obtaining word collocation information includes: obtaining a corpus in the field to which the text information belongs; segmenting the corpus, and extracting target words from the segmentation results, wherein the target words are words specified in the field to which the text information belongs; obtaining a first probability of the target word and an adjacent word appearing together, and a second probability of the target word and an interval word appearing together; and determining the word collocation information based on the first probability and the second probability.
[0196] Optionally, the interval words are words that meet the following conditions: they are separated from the target words by a preset window length; and they belong to any part of speech among nouns, verbs, or adjectives.
[0197] Optionally, the processor may also execute the following program code: after segmenting the text information according to a word database of the field to which the text information belongs to obtain multiple words included in the text information, segment the text information according to the punctuation marks in the text information to obtain segmented clauses; clear the punctuation marks; and normalize the digital information in the text information according to preset symbols.
[0198] Optionally, the processor may also execute program code of the following steps: before extracting erroneous words from text information, receiving input voice data; and recognizing and obtaining text information from the voice data.
[0199] By adopting the embodiment of the present invention, a method for processing text is provided. Wrong words that are incorrectly recognized for terminology are extracted from text information, and based on the word collocation information of the field to which the text information belongs, the correction words corresponding to the wrong words are obtained; thus, the text information is finally corrected based on the correction words to obtain the corrected text information, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs. Through the above-mentioned embodiment of the present application, the incorrectly recognized terminology in the text data obtained by voice data recognition is corrected, thereby reducing the modification rate of manual modification, providing high-quality data for the subsequent use of text information, solving the problem of incorrect recognition of terminology in the field to which it belongs in the text data obtained due to the same voice recognition for voice data in all fields, and further solving the problem of low accuracy of the trial records obtained by voice conversion of recordings during the trial in the prior art.
[0200] It can be understood by those skilled in the art that Fig.11 The structure shown is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a handheld computer, a mobile Internet device (Mobile Internet Devices, MID), a PAD, or other terminal devices. Fig.11 The structure of the electronic device is not limited. For example, the computer terminal 11 may also include Fig.11 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Fig.11 Different configurations shown.
[0201] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0202] Example 8
[0203] The embodiment of the present invention further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the text processing method provided in the first embodiment.
[0204] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0205] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: extracting erroneous words from text information, wherein the erroneous words include at least one of the following types: grammatical errors, vocabulary errors, spelling errors; based on word collocation information of the field to which the text information belongs, obtaining correction words corresponding to the erroneous words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs; and correcting the text information based on the correction words to obtain corrected text information.
[0206] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0207] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0208] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0209] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0210] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0211] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0212] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.< / num>
Claims
1. A text processing method, characterized in that: include: Extracting incorrect words from the text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; Based on the word collocation information of the field to which the text information belongs, obtaining a correction word corresponding to the erroneous word, wherein the word collocation information is obtained according to the corpus of the field to which the text information belongs, and the word collocation information includes a neural network model for predicting word collocation; Modifying the text information based on the modification words to obtain modified text information; Wherein, based on the word collocation information, obtaining the corrected word corresponding to the wrong word includes: The neural network model is used to learn the collocation mode of the corpus in the field to which the text information belongs; and the correction words are obtained based on the collocation mode.
2. The method according to claim 1, characterized in that: Extract wrong words from text information, including: Segmenting the text information according to a word database of the field to which the text information belongs, to obtain a plurality of words included in the text information; Scoring the word based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; Scoring the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data of the field to which the text information belongs; By comparing the first score and the second score with a preset score, it is determined whether the word is an incorrect word.
3. The method according to claim 2, characterized in that The first score includes a first sub-score and a second sub-score. The word is scored based on the first language model to obtain the first score, including: Scoring the word based on the first language model of N-gram to obtain a first sub-score; Scoring the word based on the first language model of M-gram to obtain a second sub-score, wherein M is not equal to N; The second score includes a third sub-score and a fourth sub-score. The word is scored based on the second language model to obtain the second score, including: Scoring the word based on the N-gram second language model to obtain a third sub-score; The word is scored based on the second language model of the M-gram to obtain a fourth sub-score.
4. The method according to claim 3, characterized in that Determining whether the word is the wrong word by comparing the first score and the second score with a preset score includes: When the first sub-score, the second sub-score, the third sub-score and the fourth sub-score are all less than the preset score, determining that the word is an incorrect word; or When any one or more of the first sub-score, the second sub-score, the third sub-score, and the fourth sub-score is greater than or equal to the preset score, it is determined that the word is not the wrong word.
5. The method according to claim 1, characterized in that The word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods. Based on the word collocation information of the field to which the text information belongs, obtaining the correction word corresponding to the wrong word includes: Acquire a prefix and a postposition of the incorrect word, wherein the prefix is used to indicate a word before the incorrect word, and the postposition is used to indicate a word after the incorrect word; Searching for a corresponding word collocation in the word collocation information according to the prefix and the postposition, and determining a target word collocation according to the probability of the found word collocation; According to the words collocated with the antecedent word and the postposition in the target word collocation mode, a correction word corresponding to the erroneous word is determined.
6. The method according to claim 5, characterized in that Determining the corrected word corresponding to the wrong word according to the words collocated with the antecedent and the postposition in the target word collocation mode includes: Determining, in the target word collocation method, a word collocated with the antecedent and the postposition as a first candidate modified word; The correction word is selected from the first candidate correction words according to the phonetic information of the first candidate correction words.
7. The method according to claim 6, characterized in that Selecting a correction word from the first candidate correction words according to the phonetic information of the first candidate correction words comprises: Acquire the distance information between the phonetic information of the first candidate corrected word and the phonetic information of the wrong word; Obtaining the longest common substring between the phonetic information of the first candidate corrected word and the phonetic information of the incorrect word; Determining a score of the first candidate modified word according to the distance information and the longest common substring; At least one of the modification terms is selected from the first candidate modification terms according to the scores of the first candidate modification terms.
8. The method according to claim 7, characterized in that Selecting at least one of the modifying terms from the first candidate modifying terms according to the scores of the first candidate modifying terms comprises: Selecting a plurality of second candidate modification words from the first candidate modification words in descending order of the scores; Using the plurality of second candidate correction words to replace the erroneous words, to obtain a plurality of candidate text information; Scoring the multiple candidate text information using a language model; The second candidate correction word corresponding to the candidate text information with the highest score is determined to be the correction word.
9. The method according to claim 6, characterized in that The method further includes: obtaining word collocation information, wherein obtaining word collocation information includes: Acquire corpus of the field to which the text information belongs; Segmenting the corpus, and extracting target words from the segmentation results, wherein the target words are words specified in the field to which the text information belongs; Obtaining a first probability that the target word and an adjacent word appear together, and a second probability that the target word and an interval word appear together; The word collocation information is determined according to the first probability and the second probability.
10. The method according to claim 9, characterized in that The spacer words are words that meet the following conditions: A preset window length is set between the target word and the target word; Any part of speech that is a noun, verb, or adjective.
11. The method according to claim 1, characterized in that: After segmenting the text information according to a word database of the field to which the text information belongs to obtain a plurality of words included in the text information, the method further includes: Segmenting the text information according to punctuation marks of the text information to obtain segmented clauses; removing said punctuation; The digital information in the text information is normalized according to preset symbols.
12. The method according to claim 1, characterized in that Before extracting the wrong words from the text information, the method further includes: Receiving input voice data; Obtain the text information according to the voice data in any of the following ways: Performing speech recognition on the speech data to obtain the text information; Keywords are extracted from the voice data, and the keywords are combined to obtain the text information.
13. A text processing method, characterized in that: include: Receive voice messages; Displaying first text information, wherein the first text information is text information obtained by recognizing the voice information; Displaying second text information, wherein the incorrect words in the first text information are extracted, and based on the word collocation information of the field to which the first text information belongs, the corrected words corresponding to the incorrect words are obtained, and the first text information is corrected based on the corrected words to obtain the second text information, the word collocation information is obtained through the corpus of the field to which the text information belongs, the word collocation information includes a neural network model for predicting word collocation, and the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; Wherein, based on the word collocation information, obtaining the corrected word corresponding to the wrong word includes: The neural network model is used to learn the collocation mode of the corpus in the field to which the text information belongs; and the correction words are obtained based on the collocation mode.
14. A text processing method, characterized in that: include: Record the trial process to obtain the voice data of the trial; Recognize text information from the voice data, and extract erroneous words that are incorrectly recognized in terms of terminology from the recognized text information; Based on the collocation information of words in the legal field, obtaining the corrected words corresponding to the erroneous words, wherein the collocation information of words is obtained according to the corpus of the legal field, and the collocation information of words includes a neural network model for predicting collocation of words; Modifying the text information based on the modification words to obtain modified text information; Wherein, based on the word collocation information, obtaining the corrected word corresponding to the wrong word includes: The neural network model is used to learn the collocation mode of the corpus in the field to which the text information belongs; and the correction words are obtained based on the collocation mode.
15. The method according to claim 14, characterized in that Extracting erroneous words that are incorrectly recognized for terminology from the recognized text information includes: Segmenting the text information according to a word database of the field to which the text information belongs, to obtain a plurality of words included in the text information; Scoring the word based on a first language model to obtain a first score, wherein the first language model is obtained by training sample data from at least two fields; Scoring the words based on a second language model to obtain a second score, wherein the second language model is obtained by training sample data of the field to which the text information belongs; By comparing the first score and the second score with a preset score, it is determined whether the word is an incorrect word.
16. The method according to claim 14, characterized in that The word collocation information includes: different word collocation methods and the probabilities corresponding to the word collocation methods. Based on the word collocation information of the field to which the text information belongs, obtaining the correction word corresponding to the wrong word includes: Acquire a prefix and a postposition of the incorrect word, wherein the prefix is used to indicate a word before the incorrect word, and the postposition is used to indicate a word after the incorrect word; Searching for a corresponding word collocation in the word collocation information according to the prefix and the postposition, and determining a target word collocation according to the probability of the found word collocation; According to the words collocated with the antecedent word and the postposition in the target word collocation mode, a correction word corresponding to the erroneous word is determined.
17. A text processing device, characterized in that: include: An extraction module, used to extract incorrect words from text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, spelling errors; An acquisition module, configured to acquire a correction word corresponding to the erroneous word based on word collocation information of the field to which the text information belongs, wherein the word collocation information is obtained based on corpus of the field to which the text information belongs, and the word collocation information includes a neural network model for predicting word collocation; A correction module, used for correcting the text information based on the correction words to obtain the corrected text information; The acquisition module is further used for: using the neural network model to learn the collocation mode of the corpus in the field to which the text information belongs; and acquiring the modified words based on the collocation mode.
18. A storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the following steps: extracting incorrect words from text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; based on word collocation information of the field to which the text information belongs, obtaining corrected words corresponding to the incorrect words, wherein the word collocation information is obtained based on the corpus of the field to which the text information belongs, and the word collocation information includes a neural network model for predicting word collocation; correcting the text information based on the corrected words to obtain corrected text information; when the program is running, the device where the storage medium is located is controlled to also execute the following steps: using the neural network model to learn the collocation method of the corpus of the field to which the text information belongs; and obtaining the corrected words based on the collocation method.
19. A processor, characterized in that: The processor is used to run a program, wherein the program executes the following steps when it is running: extracting incorrect words from text information, wherein the incorrect words include at least one of the following types: grammatical errors, vocabulary errors, and spelling errors; based on word collocation information of the field to which the text information belongs, obtaining corrected words corresponding to the incorrect words, wherein the word collocation information is obtained based on corpus of the field to which the text information belongs, and the word collocation information includes a neural network model for predicting word collocation; correcting the text information based on the corrected words to obtain corrected text information; the program also executes the following steps when it is running: using the neural network model to learn the collocation method of the corpus of the field to which the text information belongs; and obtaining the corrected words based on the collocation method.
Citation Information
Patent Citations
Voice interaction text error correction method and device, terminal and storage medium
CN108595431A