A text processing method and device

By deleting and adding target symbols, and using the classification model to standardize the beginning, end and main text of legal documents, the problem of format confusion in the process of standardizing the format conversion of legal documents is solved, and the reading and machine analysis effects of the documents are improved.

CN112183032BActive Publication Date: 2024-10-01ZHONGKE DINGFU BEIJING TECH DEV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011136241.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-21
Publication Date
2024-10-01
Estimated Expiration
2040-10-21

AI Technical Summary

Technical Problem

Standardized legal documents are prone to format confusion during the format conversion and entry process, resulting in reading difficulties and poor machine analysis results.

Method used

Provides a text processing method by deleting target symbols, standardizing the beginning, end, and main text parts according to rules and classification models, and adding newline symbols to restore the standardized format.

Benefits of technology

It effectively solves the difficulty of reading and machine analysis caused by irregular formats, and improves the convenience of reading legal documents and the effect of machine learning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112183032B_ABST
    Figure CN112183032B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a text processing method and device, the text processing method comprising: deleting all target symbols included in the text to be processed, wherein the target symbols include a change symbol or at least one punctuation mark; adding the target symbols to the beginning part and the end part of the text to be processed respectively according to a first rule; dividing the main text part included in the text to be processed into at least one chapter according to a classification model, and adding the line break symbol to the end of each chapter in the at least one chapter, wherein the main text part is the remaining part of the text to be processed except the beginning part and the end part. Some embodiments of the present application process the beginning, end and main text parts included in the text to be processed into texts in standard formats respectively, which can effectively solve the problem of difficulty in reading or difficulty in machine learning due to the non-standard format of the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing, and specifically, embodiments of the present application relate to a text processing method and device. Background Art

[0002] Judgment documents are documents with rigorous writing and standardized format. For example, in a standardized judgment document, the judgment court, document type and case number at the beginning of the document are all presented in a single line, and the judges, trial date and clerk at the end of the document are also presented in a single line. The rest of the content is presented as a paragraph as a line, and a line refers to text with a line break symbol. This standardized format is not only convenient for reading, but also for machine analysis.

[0003] In contrast to standardized legal documents, when relevant methods are used to convert the format of standardized legal documents, collect or enter them into a system or device (for example, standard legal documents are transcoded based on HTML format, or transcoded based on OCR format, or due to reasons such as non-standard document entry), a large number of legal documents (for example, judicial documents) have chaotic formats (for example, errors such as missing line breaks or illegal line breaks), which not only makes it difficult to read the legal documents, but also affects the effect of machine analysis and learning based on the legal documents. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a text processing method and device. The text processing method and device of some embodiments of the present application can convert non-standard documents into documents with standardized formats, so as to improve the effect of machine learning or analysis based on these legal documents in standardized formats.

[0005] In a first aspect, some embodiments of the present application provide a text processing method, which includes: deleting all target symbols included in the text to be processed, wherein the target symbols include line break symbols or at least one punctuation mark; adding the target symbols to the beginning part and the end part of the text to be processed respectively according to a first rule; dividing the main text part included in the text to be processed into at least one chapter according to a classification model, and adding the line break symbols at the end of each chapter in the at least one chapter, wherein the main text part is the remaining part of the text to be processed except the beginning part and the end part.

[0006] Some embodiments of the present application process the header part, tail part and body part of the text to be processed into texts in standard formats, which can effectively solve the problem of difficulty in reading or machine learning due to the non-standard format of the document.

[0007] In some embodiments, before deleting all target symbols included in the text to be processed, the text processing method further includes: confirming that the input text belongs to the text to be processed.

[0008] Some embodiments of the present application confirm whether the input text is non-standard text through analysis, and then format the screened text files with non-standard formats (i.e., the text to be processed) by adding target symbols.

[0009] In some embodiments, the confirmation that the input text belongs to the text to be processed includes: confirming that the document type of the input text belongs to the target document type, wherein the target document type includes: a judgment, a ruling, a mediation or an execution; confirming that the input text meets preset conditions, wherein the preset conditions include confirming that the format of at least a part of the header part and the tail part included in the input text meets a first set condition, or confirming that the body of the input text meets a second set condition.

[0010] Some embodiments of the present application obtain the text to be processed by identifying the non-standard format in the input text of the screened target document type, so as to format the input text that needs to be processed in a targeted manner, thereby improving the processing efficiency of the system, avoiding the waste of resources caused by processing standard files that do not need to be processed, or affecting the processing of non-standard documents (i.e., documents to be processed) due to the processing of standard files.

[0011] In some embodiments, confirming that the input text satisfies preset conditions includes: deleting the beginning part and the ending part from the input text according to a rule vocabulary to obtain the main text part; confirming that the ratio of the number of lines without punctuation marks before the line break symbol included in the main text part to the total number of lines of the main text part is greater than a set first threshold; or confirming that the ratio of the total number of lines included in the main text part to the total number of words is greater than a second threshold.

[0012] Some embodiments of the present application use a quantitative method (eg, setting a threshold) to identify format irregularities in the text content, thereby improving the accuracy of identifying the text to be processed.

[0013] In some embodiments, the text to be processed includes a judgment and a ruling, the header part includes the judgment court, the document type and the case number, and the tail part includes the judge, the trial date and the clerk; the first set condition includes that the line break symbol after at least one of the judgment court, the document type, the case number, the judge, the trial date and the clerk is not standardized.

[0014] Some embodiments of the present application filter out the text to be processed by identifying missing line breaks or redundant line break symbols (ie, non-standard line break symbols) at the beginning and end of the text.

[0015] In some embodiments, the text to be processed belongs to a judgment or a ruling, the front part of the judgment and the ruling includes the judgment court, document type and case number, and the back part of the judgment and the ruling includes: judges, trial date and clerk; adding the target symbol to the front part and the back part of the text to be processed according to the first rule includes: adding the line break symbol after each of the judgment court, the document type, the case number, the judges, the trial date and the clerk identified according to multiple regular expressions.

[0016] Some embodiments of the present application use multiple regular expressions to normalize the irregular formatting issues of lack of line breaks or excessive line breaks at the beginning and end of a text, thereby obtaining more standardized beginning and end parts of the text.

[0017] In some embodiments, the classification model includes sentence classification algorithm models corresponding one by one to multiple document types, and the multiple document types include: first-instance judgments, second-instance judgments, retrial judgments, rulings, mediation documents or execution documents; dividing the main text part included in the text to be processed into at least one chapter according to the classification model, and adding the target symbol to the end of each chapter in the at least one chapter, including: confirming the document type corresponding to the text to be processed; confirming the target sentence classification algorithm model adopted according to the document type; identifying the starting sentences of each chapter from multiple sentences obtained by segmenting the main text part according to the target sentence classification algorithm model; dividing the chapters according to the starting sentences, and adding the line break symbol to the end of each chapter.

[0018] Some embodiments of the present application can divide each chapter by identifying the starting sentence of each chapter, thereby improving the speed and accuracy of chapter recognition.

[0019] In some embodiments, dividing the chapters according to the starting sentence and adding the line break symbol at the end of each chapter includes: when it is confirmed that a first sentence is identified as the starting sentence of a first chapter and a second sentence is identified as the starting sentence of a second chapter adjacent to the first chapter, confirming that the first sentence and all sentences between the first sentence and the second sentence belong to the first chapter.

[0020] Some embodiments of the present application identify the portion between two starting sentences as a chapter, that is, some embodiments of the present application identify the complete content of each chapter by identifying the starting sentence and the sentences between two adjacent starting sentences, thereby improving the completeness of the identified content of each chapter.

[0021] In some embodiments, the identifying the starting sentences of each chapter from a plurality of sentences obtained by segmenting the main text portion according to the target sentence classification algorithm model includes: when a third sentence and a fourth sentence following the third sentence are both identified as the starting sentences of the third chapter, then confirming that the third sentence is the starting sentence of the third chapter.

[0022] Some embodiments of the present application provide a method for handling when two starting sentences are identified in a chapter, so that the structural emotions of the identified chapters are non-overlapping.

[0023] In some embodiments, the text processing method also includes: confirming the names of the chapters and adding corresponding chapter names to the chapters; providing the beginning part, the end part and the main text part to perform further machine analysis on the beginning part, the end part and the main text part.

[0024] Some embodiments of the present application can facilitate the speed of subsequent machine learning by adding chapter titles to each chapter.

[0025] In a second aspect, some embodiments of the present application provide a text processing device, comprising: a symbol processing module, configured to delete all target symbols included in the text to be processed, wherein the target symbols include line break symbols or at least one punctuation mark; a head and tail processing module, configured to add the target symbols to the head part and the tail part of the text to be processed respectively according to a first rule; a text processing module, configured to divide the text part included in the text to be processed into at least one chapter according to a classification model, and add the line break symbol to the end of each chapter in the at least one chapter, wherein the text part is the remaining part of the text to be processed except the head part and the tail part.

[0026] In a third aspect, some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, and when the program is executed by a processor, the method described in the first aspect above can be implemented.

[0027] In a fourth aspect, some embodiments of the present application provide an information processing device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor can implement the text processing method described in the first aspect when executing the computer program. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 A schematic diagram of the composition of a text processing system provided in an embodiment of the present application;

[0030] Figure 2 A flowchart of a text processing method provided in an embodiment of the present application;

[0031] Figure 3 A block diagram of the text processing device provided in an embodiment of the present application;

[0032] Figure 4 A block diagram of the information processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0034] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0035] Judgment documents are documents with rigorous writing and standardized formats. However, due to the transcoding process of documents in different formats, the use of optical character recognition (OCR) technology to identify documents, or the irregular input of individual documents, some judgment documents have chaotic formats, which results in poor results for subsequent machine learning or analysis based on these chaotic legal documents.

[0036] The following example comparison of two judicial documents shows the difference between a standard judicial document and a non-standard judicial document caused by an error in the line break symbol.

[0037] (I) Examples of standardized judgment documents are as follows:

[0038] Nanjing District People's Court

[0039] Civil ruling

[0040] (2011) Pu Minchu Zi No.

[0041] The plaintiff is a Nanjing company, whose domicile is at a certain building, a certain number, a certain road, a certain district in Nanjing.

[0042] Legal representative: Ni Moumou, general manager.

[0043] The entrusted agent is Xu, a lawyer at a law firm in Jiangsu.

[0044] The defendant Yin was born on a certain day of a certain month of a certain year.

[0045] In a case involving a contract dispute between the plaintiff, a Nanjing company, and the defendant, Yin, this court heard the case. On a certain day of a certain month of a certain year, the plaintiff, a Nanjing company, filed an application to withdraw the lawsuit with this court.

[0046] This court believes that the plaintiff Nanjing Company's application to withdraw the lawsuit does not violate the law and is an exercise of litigation rights in accordance with the law and should be approved. In accordance with the provisions of Article 131, paragraph 1, and Article 140, paragraph 1, item (5) of the Civil Procedure Law of the People's Republic of China, the ruling is as follows:

[0047] The plaintiff, a Nanjing company, was allowed to withdraw the lawsuit.

[0048] The case handling fee has been reduced by half to 25 yuan, which shall be borne by the plaintiff, a Nanjing company.

[0049] Acting Judge Xu

[0050] Year Month Day

[0051] Clerk Tan

[0052] (II) The following are some irregular judgment documents caused by converting judgment documents in HTML format into text format (i.e., TXT format):

[0053] Civil ruling of a district people's court in Nanjing (2011) Pu Min Chu Zi No. The plaintiff is Nanjing Company Management Co., Ltd., whose domicile is at a certain building at a certain number on a certain road in a certain district in Nanjing.

[0054] Legal representative: Ni, general manager.

[0055] The entrusted agent is Xu, a lawyer at a law firm in Jiangsu.

[0056] The defendant Yin was born on a certain day of a certain month of a certain year.

[0057] In a case involving a contract dispute between the plaintiff, a Nanjing company, and the defendant, Yin, this court heard the case. On a certain day of a certain month of a certain year, the plaintiff, a Nanjing company, filed an application to withdraw the lawsuit with this court.

[0058] This court believes that the plaintiff Nanjing Company's application to withdraw the lawsuit does not violate the law and is an exercise of litigation rights in accordance with the law and should be approved. In accordance with the provisions of Article 131, paragraph 1, and Article 140, paragraph 1, item (5) of the Civil Procedure Law of the People's Republic of China, the ruling is as follows:

[0059] The plaintiff, a Nanjing company, was allowed to withdraw the lawsuit.

[0060] The case acceptance fee has been halved to 25 yuan, to be borne by the plaintiff, a Nanjing company. Acting judge Xu Date of year Clerk Tan

[0061] Combining the above two judgment documents, it can be seen that in a standardized judgment document, the judgment court, document type and case number included in the beginning of the document are all presented in a single line, and the judges, trial date and clerks included in the end of the document are also presented in a single line, while the other contents in the document (i.e. the text content) are all presented as a paragraph as a line, and a line refers to text with a line break symbol. This standardized format is not only convenient for reading, but also conducive to machine analysis. However, when converting judgment documents in HTML format to TXT format or in judgment documents processed by OCR, there are errors such as missing line breaks and illegal line breaks. For example, in some judgment documents, all line break symbols are lost, and ultimately the entire text has only one line break symbol. Missing line breaks is not only not conducive to reading, but also hinders machine analysis of judgment documents and causes errors. Illegal line breaks are generally caused by the optical character recognition (OCR) program recognizing characters in an image manner without natural language post-processing the analysis results. The existence of illegal line breaks will cause information extraction and matching to fail.

[0062] The technical solution of the embodiment of the present application is explained below in conjunction with the accompanying drawings. Compared with the situation where the technical solution of the embodiment of the present application is not adopted, the technical solution of the embodiment of the present application can effectively solve the above-mentioned problem of symbol confusion, thereby improving the effect of machine learning or improving the accuracy of extraction and matching of text information based on natural language processing.

[0063] Please see Figure 1 , Figure 1 A composition diagram of a text processing system provided for some embodiments of the present application. Figure 1 The text processing system includes an input device 100 for outputting input text that needs to be formatted, a processing server 200 for normalizing the input text received from the input device 100, and a training server 300 for generating a classification model and providing it to the processing server 200. Figure 1As shown, the processing server 200 also feeds back the processed text file in a standard format to the input device 100, so that the input device 100 and the processing server 200 are interconnected through the network. The network includes, but is not limited to, a mobile communication access network (for example, a 4G or 5G communication network) and a core network.

[0064] The input device 100 , the processing server 200 , and the training server 300 may all be a computing device including a processor and a memory.

[0065] It should be noted that Figure 1 Only a schematic diagram of the composition of the text processing system of some embodiments of the present application is shown. It can be understood that in some embodiments of the present application, the functions of at least two of the input device 100, the processing server 200 and the training server 300 can be integrated into the same hardware entity. That is, in some embodiments of the present application, the input device 100 and the processing server 200 are located in the same hardware entity, and in some other embodiments of the present application, the processing server 200 and the training server 300 belong to the same hardware entity.

[0066] Combine the following Figure 2 The text processing method executed on the processing server 200 is exemplified.

[0067] like Figure 2 As shown, some embodiments of the present application provide a text processing method, which includes: S110, deleting all target symbols included in the text to be processed, wherein the target symbols include line break symbols or at least one punctuation mark; S120, adding the target symbols to the beginning part and the end part of the text to be processed respectively according to the first rule; S130, dividing the main text part included in the text to be processed into at least one chapter according to the classification model, and adding the line break symbol at the end of each chapter in the at least one chapter, wherein the main text part is the remaining part of the text to be processed except the beginning part and the end part.

[0068] The text processing method implemented in the present application includes S110, S120 and S130 as exemplified below.

[0069] The target symbols recorded in S110 of some embodiments of the present application include line break symbols or one or more of punctuation marks. For example, in some embodiments, the target symbol is a line break symbol, and correspondingly, S110 is specifically to delete all line break symbols included in the text to be processed. In other embodiments, the target symbol is a full stop, and correspondingly, S110 is specifically to delete all full stops included in the text to be processed. In some embodiments, the target symbols include line break symbols and full stops (i.e., one of the punctuation marks), then executing S110 means deleting all line break symbols and full stops included in the text to be processed. For example, when the target symbol is a line break symbol, for an irregular text with only one line caused by the loss of some line break symbols, executing S110 of the embodiments of the present application means deleting the last line break symbol in the full text.

[0070] The first rule of S120 in some embodiments of the present application includes multiple regular expressions to be replaced and the regular expressions after replacement corresponding to each regular expression to be replaced one by one. As shown in Table 1 below, this table shows some regular expressions for the beginning part of the judgment document. The regular expressions to be replaced are composed of keywords or key phrases extracted from the beginning part and the end part of the text and wildcards, and the regular expressions after replacement are composed of standard text descriptions and standard punctuation marks extracted from the beginning part and the end part of the text. It can be understood that by using the regular expressions to be replaced, the irregular descriptions in the beginning part and the end part of the text can be recognized, and by using the regular expressions after replacement, all the recognized irregular descriptions can be replaced with the standard format. For example, when the target symbol is a line break symbol, the beginning part after replacement includes a standard line break symbol, and the standard line break symbol includes the appropriate position and number of line break symbols. For example, the string to be replaced in the first row of Table 1 is: (行\s*政|执\s*行|审\s*查)\s*裁\s*定\s*书[\s,]*. The result after replacement is: \1裁定书\n, where the string in the small parentheses in the string to be replaced is a group, and “\1” in the result after replacement refers to the first group. “\1” in the result after replacement of the regular expression in the first row of Table 1 refers to the two characters “行政”. In Python, “\1” is used to represent the first group, which is a kind of regular reserved word. In Java and some other tools, it is written as $1.

[0071] For example, by using the regular expression in the first row of Table 1, “行政裁定书,” can be replaced after replacement to become:

[0072] Administrative ruling

[0073] As an example of the present application, the target symbol includes a line break symbol, the text to be processed belongs to a judgment or a ruling, the header part of the judgment and the ruling includes the judgment court, document type and case number, and the tail part of the judgment and the ruling includes: judge, trial date and clerk; S120 includes: adding the line break symbol to each of the identified judgment court, document type, case number, judge, trial date and clerk according to multiple regular expressions.

[0074] Table 1 Rules replace part of the vocabulary

[0075]

[0076]

[0077] It should be noted that the meanings of the symbols in Table 1 are as follows: "\s" refers to a space, "*" refers to matching 0 to n times, "[]" refers to matching a single character in the brackets, "|" represents the meaning of or, "?" refers to matching 0 or 1 times, "\n" refers to matching a newline, "\1" refers to retaining the contents in the first set of brackets, "\2" refers to retaining the contents in the second set of brackets, and "\3" refers to retaining the contents in the third set of brackets.

[0078] It should be noted that, in some embodiments of the present application, S120 also includes replacing errors in the OCR corpus according to the rule vocabulary. For example, the "O, o" representing the date recognized in the OCR corpus is replaced with the number 0 according to the rule vocabulary.

[0079] In some embodiments, the classification model includes sentence classification algorithm models corresponding one by one to multiple document types, and the multiple document types include: first-instance judgments, second-instance judgments, retrial judgments, rulings, mediation documents or execution documents; S130 includes: confirming the document type corresponding to the text to be processed; confirming the target sentence classification algorithm model adopted according to the document type; identifying the starting sentences of each chapter from multiple sentences obtained by segmenting the main text according to the target sentence classification algorithm model; dividing the chapters according to the starting sentences, and adding the line break symbols to the end of each chapter.

[0080] In order to accurately determine the sentences included in each chapter, as an example, S130 divides the chapters according to the starting sentence, and adds the line break symbol at the end of each chapter, including: when it is confirmed that the first sentence is identified as the starting sentence of the first chapter, and the second sentence is identified as the starting sentence of the second chapter adjacent to the first chapter, it is confirmed that the first sentence and all sentences between the first sentence and the second sentence belong to the first chapter.

[0081] In order to avoid repetition between the chapters obtained by division, as an example, S130 identifies the starting sentences of the chapters from the multiple sentences obtained by segmenting the main text part according to the target sentence classification algorithm model, including: when the third sentence and the fourth sentence after the third sentence are both identified as the starting sentences of the third chapter, the third sentence is confirmed to be the starting sentence of the third chapter.

[0082] In order to save the resources of the processing server 200 and process the input non-standard text to be processed in a targeted manner, such as Figure 2 As shown, before S110 of some embodiments of the present application, the text processing method further includes: S100, confirming that the input text belongs to the text to be processed. That is to say, some embodiments of the present application confirm whether the input text belongs to a non-standard text by analyzing the input text, and then format the screened text file with a non-standard format by adding target symbols. Some embodiments of the present application determine the text to be processed by identifying the type of input text and the non-standard format of the corresponding type of document, which can improve the processing efficiency of the system and avoid waste of resources caused by processing standard files that do not need to be processed or affecting the processing of non-standard documents that really need to be processed due to the standardization of standard files that do not need to be processed.

[0083] The following is an illustrative description of S100 provided in some embodiments of the present application.

[0084] In some embodiments, S100 includes: confirming that the document type of the input text belongs to the target document type, wherein the target document type includes: judgment, ruling, mediation, or execution; confirming that the input text meets a preset condition, wherein the preset condition includes confirming that the format of at least a part of the header part and the tail part included in the input text meets a first set condition, or confirming that the body part of the input text meets a second set condition. For example, the target symbol includes a line break symbol, the text to be processed includes a judgment and a ruling, the header part includes the judgment court, the document type and the case number, and the tail part includes the judge, the trial date and the clerk; the first set condition includes that the line break symbol after at least one of the judgment court, the document type, the case number, the judge, the trial date and the clerk is not standardized, and the non-standardization includes the lack of the line break symbol or the existence of redundant line break symbols.

[0085] In some embodiments, S100 includes: confirming that the document type of the input text belongs to the target document type, wherein the target document type includes: judgment, ruling, mediation, or execution; confirming that the input text meets a preset condition, wherein the preset condition includes confirming that the format of at least a part of the header part and the tail part included in the input text meets a first set condition, or confirming that the body part of the input text meets a second set condition. For example, the target symbol is a line break symbol, and S100 includes confirming that the input text meets the preset condition, including: deleting the header part and the tail part from the input text according to the rule vocabulary to obtain the body part; confirming that the ratio of the number of lines without punctuation marks before the line break symbol included in the body part to the total number of lines in the body part is greater than a set first threshold; or confirming that the ratio of the total number of lines included in the body part to the total number of words is greater than a second threshold. For example, the first threshold is one tenth, and the second threshold is one fiftieth, that is, after removing the beginning and the end of the text using the rule word list: the number of lines without punctuation before the line break / the total number of lines > 1 / 10; or after removing the beginning and the end of the text using the rule word list: the total number of lines / the total number of words > 1 / 50. When the target document type corresponding to the input text is a ruling or judgment, the beginning part of the ruling or judgment includes the ruling court, document type and case number, and the end part includes the judge, trial date and clerk.

[0086] It should be noted that the first threshold and the second threshold can be obtained in the following ways: annotate a certain number of corpora. Classify the corpora into two categories: corpora that need to be preprocessed and corpora that do not need to be preprocessed; calculate the value of "rows without punctuation before line breaks / total number of lines" and the value of "total number of lines / total number of words" in the annotated corpora; take the rows without punctuation before line breaks / total number of lines = 0 and the total number of lines / total number of words = 1 / 100 as the initial state, take an appropriate learning rate, such as "0.01", "0.001" (as shown in Table 2), increase the values ​​of the two respectively, until they grow to 1, use this method to classify the annotated corpora, and take the values ​​of the two with the largest accuracy as the first threshold and the second threshold respectively.

[0087] Table 2 Correspondence between the first threshold and the second threshold and the accuracy

[0088]

[0089]

[0090] That is to say, as some specific examples of this application, the text of the judgment document recognized by OCR can be considered to belong to the text to be processed; when it is uncertain whether the input document belongs to the text to be processed, the document type can be first determined according to the case number. If the document type is not a judgment, ruling, mediation, or execution, it is confirmed that it does not belong to the text to be processed. For the document type is a judgment, ruling, mediation, or execution, the following judgment is required to confirm that it belongs to the text to be processed, that is, if the input text meets any of the following three conditions, it is confirmed that it belongs to the text to be processed: 1) Use the rule word list to identify that the format of the beginning or end of the text is not standardized; 2) After removing the beginning and end of the text using the rule word list: the line without punctuation before the line break / total number of lines> the first threshold (for example, the first threshold is 1 / 10); 3) After removing the beginning and end of the text using the rule word list: the total number of lines / total number of words> the second threshold (for example, the second threshold is 1 / 50). The selection method of the first threshold and the second threshold can refer to the description above. The reason why the second threshold for OCR text is chosen as one-fiftieth includes at least the following reasons: total number of words / total number of lines = average number of words per line. According to incomplete statistics, if it is an OCR text, there is a line break after each formal line break. After removing the beginning and end of the text, the average number of words per line is about 34.5 words, and the total number of lines / total number of words = 1 / 34.5. If it is a standard text, after removing the beginning and end of the text, the average number of words per line is about 121.2 words, and the total number of lines / total number of words = 1 / 121.2. Taking into account the characteristics of OCR text, the empirical value of 1 / 50 was selected. Regarding the first threshold, generally speaking, after removing the beginning and end of the standard document, it is a natural paragraph. The end of the natural paragraph must be the end of the sentence, and the sentence generally ends with a semicolon, period, question mark, ellipsis, or exclamation mark, so the threshold can be set to 0. However, it is not ruled out that there are such documents where the evidence or legal provisions are listed in the form of line breaks. For example:

[0091] The evidence provided includes:

[0092] ID card

[0093] Original household registration book

[0094] Hospital diagnosis certificate

[0095] In this case, removing the line break will make the originally standardized text non-standard and irreversible. Therefore, the first threshold is set to 1 / 10 to prevent accidental touches to a certain extent. Regarding the second threshold: In theory, an OCR text has a line break after each formal line break. So if a line is longer and the text is smaller, the average number of words per line will be larger. Generally speaking, the number of words in a judgment document will not exceed 50 per line, so the second threshold is set to 1 / 50.

[0096] In order to execute S130 (i.e., the analysis process based on the model obtained by modeling), some embodiments of the present application need to obtain the classification model of S130 by training the relevant models in advance, that is, some embodiments of the present application also include S135 training to obtain the classification model (i.e., the modeling process).

[0097] As an example, S135 includes: screening corpora that can be used as training corpora and classifying the corpora according to document types; annotating the corpora using a chapter analysis rule model to form training corpora; and training a sentence classification algorithm model based on the training corpus to locate the starting sentences of each chapter.

[0098] The steps included in S135 are described below as examples.

[0099] The first step is to select suitable corpus for training and classify it according to the document type.

[0100] The suitable prediction used as training prediction needs to meet the following requirements at the same time: use the regular vocabulary to identify the format specifications of the beginning or end of the text; after removing the beginning and end of the text using the regular vocabulary: the number of lines without punctuation before the line break / total number of lines <1 / 20; after removing the beginning and end of the text using the regular vocabulary: the total number of lines / total number of words >1 / 50; the total number of words in the text >50.

[0101] For the corpus selected as suitable for training corpus, the type of document is determined by case number and divided into the following categories: first-instance judgment, second-instance judgment, retrial judgment, ruling, mediation document, and execution document.

[0102] The second step is to use the chapter analysis rule model to mark each type of corpus separately to form a training corpus. For example, the analysis process of the chapter analysis rule model includes: first, determine the type of document according to the case number, and determine the sub-model to analyze according to the type of document. Secondly, the basic analysis method of the sub-model: according to the string at the beginning of each chapter, divide the document into several chapters. The category of the string at the beginning of each chapter is the name of the chapter, and the content from the starting string of the chapter to the starting string of the next chapter (that is, the first chapter that appears after it) is the content of the chapter.

[0103] The third step is to train the first-instance judgment, the second-instance judgment, the retrial judgment, the ruling, the mediation, and the execution documents separately to obtain their own sentence classification algorithm models. Specifically, with "." and "\n" as the cut-off points, the training is expected to perform sentence segmentation. According to the analysis results of the chapter analysis rule model, it can be known whether each sentence obtained by segmentation is the starting sentence of a certain chapter (for example, each chapter of the judgment can specifically include the party information, the trial process, and the plaintiff's lawsuit, and the corresponding starting sentences of each chapter include "party information starting sentence", "trial process starting sentence", "plaintiff's claim starting sentence", etc.). If it is not the starting sentence of a certain chapter, it is defined as "other".

[0104] It is understandable that after the sentence classification algorithm model corresponding to each document type is trained, the sentence classification algorithm model formed by the modeling process is used to classify sentences, and chapter analysis is performed based on this, that is, S130 is executed. As shown above, in some embodiments of the present application, S130 includes: first, according to the case number, the category of the document is analyzed, such as the first-instance judgment, the second-instance judgment, the retrial judgment, the ruling, the mediation document, and the execution document; secondly, according to the category of the document, the algorithm sentence classification model to be used is determined; then, the corpus is segmented, and the sentences in the corpus are classified using the algorithm sentence classification model; finally, based on the sentence segmentation in the above step, the corpus is analyzed for chapters, and the method is as follows: If a sentence is classified as the starting sentence of a chapter, then from the starting position of this sentence until the starting position of the next sentence identified as the beginning of another chapter, it is considered to be the content of this chapter. If there are two or more sentences that are analyzed as the starting sentences of the same chapter, the previous sentence shall prevail.

[0105] In order to facilitate subsequent information extraction or machine learning, in some embodiments of the present application, the text processing method further includes: confirming the names of the chapters and adding corresponding chapter names to the chapters; providing the beginning part, the end part and the body part to perform further machine analysis on the beginning part, the end part and the body part. Some embodiments of the present application can facilitate the speed of subsequent machine learning by adding chapter titles to each chapter.

[0106] Please refer to Figure 3 , Figure 3 It is shown that the present application embodiment provides a text processing device. It should be understood that the device is similar to the above Figure 2Corresponding to the method embodiment, the various steps involved in the above method embodiment can be executed. The specific functions of the device can be found in the description above. To avoid repetition, detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system of the device. The text processing device includes: a symbol processing module 101, which is configured to delete all target symbols included in the text to be processed, wherein the target symbol includes a line break symbol or at least one punctuation mark; a head and tail processing module 102, which is configured to add the target symbol to the beginning part and the end part of the text to be processed respectively according to the first rule; a text processing module 103, which is configured to divide the text part included in the text to be processed into at least one chapter according to the classification model, and add the line break symbol to the end of each chapter in the at least one chapter, wherein the text part is the remaining part of the text to be processed except the beginning part and the end part.

[0107] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the device described above can refer to Figure 2 The corresponding process in will not be elaborated here.

[0108] Some embodiments of the present application provide a computer-readable storage medium having a computer program stored thereon, which can implement the above-mentioned Figure 2 The method described.

[0109] like Figure 4 As shown, some embodiments of the present application provide an information processing device 400, including a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420, wherein the processor 420 reads the program from the memory 410 through a bus 430 and executes the computer program to achieve Figure 2 The text processing method.

[0110] Processor 420 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 420 can be a microprocessor.

[0111] The memory 410 may be used to store instructions executed by the processor 420 or data related to the execution of instructions. These instructions and / or data may include code to implement some or all functions of one or more modules described in the embodiments of the present application. The processor 420 of the present embodiment may be used to execute the instructions in the memory 410 to implement Figure 2The memory 410 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory or other memory known to those skilled in the art.

[0112] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0113] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0114] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable 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 methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0115] The above description is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application. It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0116] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0117] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

Claims

1. A text processing method, It is characterized in that The text processing method comprises: Deleting all target symbols included in the text to be processed, wherein the target symbols include line break symbols or at least one punctuation mark; According to the first rule, the target symbol is added to the beginning part and the end part of the text to be processed respectively; Dividing the body part of the to-be-processed text into at least one chapter according to the classification model, and adding the line break symbol at the end of each chapter in the at least one chapter, wherein the body part is the remaining part of the to-be-processed text except the head part and the tail part; The document to be processed is a judgment or ruling, the first part of the judgment or ruling includes the judgment court, document type and case number, and the last part of the judgment or ruling includes: judge, trial date and clerk; Adding the target symbol to the first part and the last part of the text to be processed respectively according to the first rule comprises: According to a plurality of regular expressions, the line break symbol is added after each of the identified judgment court, the document type, the case number, the judge, the trial date and the clerk; Before deleting all target symbols included in the text to be processed, the text processing method further includes: confirming that the input text belongs to the text to be processed; The confirmation input text belongs to the text to be processed, including: Confirming that the document type of the input text belongs to the target document type, wherein the target document type includes: a judgment, a ruling, a mediation document, or an execution document; Confirming that the input text satisfies a preset condition, wherein the preset condition includes confirming that the format of at least a part of the header part and the footer part included in the input text satisfies a first set condition, or confirming that the body part of the input text satisfies a second set condition; The step of confirming that the input text meets a preset condition includes: Deleting the first part and the last part from the input text according to the rule word list to obtain the main text; Confirm that the ratio of the number of lines without punctuation marks before the line break symbol in the text part to the total number of lines in the text part is greater than a set first threshold; or confirm that the ratio of the total number of lines in the text part to the total number of words is greater than a second threshold.

2. The text processing method according to claim 1, It is characterized in that The documents to be processed include judgments and rulings, the first part of the documents includes the judgment court, document type and case number, and the last part of the documents includes the judge, trial date and clerk; The first set condition includes that the line break symbol after at least one of the judgment court, the document type, the case number, the judge, the trial date and the clerk is not standardized.

3. The text processing method according to claim 1, It is characterized in that The classification model includes sentence classification algorithm models corresponding to multiple types of documents, and the multiple types of documents include: first-instance judgment, second-instance judgment, retrial judgment, ruling, mediation or execution; The step of dividing the body of the to-be-processed text into at least one chapter according to the classification model, and adding the target symbol to the end of each chapter in the at least one chapter, comprises: Confirm the document type corresponding to the text to be processed; Confirming the target sentence classification algorithm model to be adopted according to the document type; Identifying the starting sentences of each chapter from a plurality of sentences obtained by segmenting the body part according to the target sentence classification algorithm model; The chapters are divided according to the starting sentence, and the line break symbol is added to the end of each chapter.

4. The text processing method according to claim 3, It is characterized in that The dividing of the chapters according to the starting sentence and adding the line break symbol at the end of each chapter comprises: When it is confirmed that the first sentence is identified as the starting sentence of the first chapter and the second sentence is identified as the starting sentence of the second chapter adjacent to the first chapter, it is confirmed that the first sentence and all sentences between the first sentence and the second sentence belong to the first chapter.

5. A text processing device, It is characterized in that The text processing device comprises: A symbol processing module, configured to delete all target symbols included in the text to be processed, wherein the target symbols include line break symbols or at least one punctuation mark; A head and tail processing module is configured to add the target symbol to the head part and the tail part of the text to be processed respectively according to the first rule; A text processing module is configured to divide the text part included in the to-be-processed text into at least one chapter according to the classification model, and add the target symbol to the end of each chapter in the at least one chapter, wherein the text part is the remaining part of the to-be-processed text except the text head part and the text tail part; The document to be processed is a judgment or ruling, the first part of the judgment or ruling includes the judgment court, document type and case number, and the last part of the judgment or ruling includes: judge, trial date and clerk; The head and tail processing module is also configured as follows: According to a plurality of regular expressions, the line break symbol is added after each of the identified judgment court, the document type, the case number, the judge, the trial date and the clerk; The symbol processing module is further configured to: before deleting all target symbols included in the text to be processed, confirm that the input text belongs to the text to be processed; The confirmation input text belongs to the text to be processed, including: Confirming that the document type of the input text belongs to the target document type, wherein the target document type includes: a judgment, a ruling, a mediation document, or an execution document; Confirming that the input text satisfies a preset condition, wherein the preset condition includes confirming that the format of at least a part of the header part and the footer part included in the input text satisfies a first set condition, or confirming that the body part of the input text satisfies a second set condition; The step of confirming that the input text meets a preset condition includes: Deleting the first part and the last part from the input text according to the rule word list to obtain the main text; Confirm that the ratio of the number of lines without punctuation marks before the line break symbol in the text part to the total number of lines in the text part is greater than a set first threshold; or confirm that the ratio of the total number of lines in the text part to the total number of words is greater than a second threshold.

6. An information processing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, in, When the processor executes the computer program, the text processing method described in any one of claims 1 to 4 can be implemented.