Method and apparatus for verifying consistency of elements in text
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-11
- Publication Date
- 2026-08-11
AI Technical Summary
然而,无论是识别还是验证都会带来巨大的工作量,人工处理文本的效率无法与如此巨大的工作量相匹配
Smart Images

Figure CN115688754B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of character recognition, and in particular to a method and apparatus for verifying the consistency of elements in text. Background Technology
[0002] In processing text, staff need to identify the text content and associate words within it with specific elements. The associated words for a specific element become its element value. For example, a civil judgment might describe the plaintiff's information as "XXX, male, born January 1, 1998." When processing a civil judgment, staff need to associate "XXX" with the plaintiff's name, "male" with the plaintiff's gender, and "born January 1, 1998" with the plaintiff's date of birth. Text is rarely independent; staff must ensure the consistency of elements between related texts, that is, ensure that the element values are consistent.
[0003] In existing technologies, manual identification of elements in text and verification of consistency between elements in related texts are required. However, both identification and verification involve a huge workload, and the efficiency of manual text processing cannot keep up with such a massive workload. Summary of the Invention
[0004] To overcome the problems existing in related technologies, this specification provides a method and apparatus for verifying the consistency of elements in text.
[0005] According to a first aspect of the embodiments of this specification, a method for verifying the consistency of elements in text is provided, the method comprising:
[0006] Obtain the text to be verified and a pre-defined feature value table, which records the correspondence between labels, features, and feature values;
[0007] Based on the text content of the text to be verified, the tags associated with the text to be verified are determined, and based on the correspondence between the tags and the elements recorded in the element value table, the elements corresponding to the tags associated with the text to be verified are determined as text elements.
[0008] Based on the elements to be extracted contained in the text elements, the text elements are one-hot encoded, and a one-hot matrix is generated.
[0009] The probability of each text element corresponding to each word in at least a portion of the text content of the text to be verified is calculated based on the one-hot matrix, and the text element with the highest probability is determined as the element of the corresponding word.
[0010] Extract words corresponding to the elements in at least a portion of the text content to be verified as the elements to be extracted, and use the extracted words as the element values of the elements to be extracted in the text to be verified;
[0011] The element values of the elements to be extracted in the text to be verified are compared with the element values of the elements to be extracted recorded in the element value table to verify the consistency between the text to be verified and the elements to be extracted in the element value table.
[0012] According to a second aspect of the embodiments of this specification, a method for training a probability model is provided, the method comprising:
[0013] Obtain a training sample set, wherein each set of samples in the training sample set includes: word vectors of words in at least a portion of the text content of the training text, a one-hot matrix generated based on the elements to be extracted contained in the text elements corresponding to the training text, and the actual element values of the elements to be extracted.
[0014] The training sample set is input into a probability model, and the training sample set is processed by the probability model as follows: extracting word vector features of the word vectors; inputting the extracted word vector features into a convolutional neural network, and generating a feature matrix for the words in the at least part of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of the text element corresponding to each word;
[0015] The text element with the highest probability is identified as the element corresponding to the word;
[0016] Extract the corresponding elements from at least a portion of the text content of the training text as words of the elements to be extracted, and use the extracted words as the predicted element values of the elements to be extracted;
[0017] The probability model is optimized based on the actual element value and the predicted element value of the element to be extracted, so that the probability model can be used to calculate the probability of the text element corresponding to the word.
[0018] According to a third aspect of the embodiments of this specification, an apparatus for verifying the consistency of elements in text, the apparatus comprising:
[0019] The acquisition unit is used to acquire the text to be verified and a pre-set element value table, wherein the element value table records the correspondence between labels, elements and element values;
[0020] The determining unit is used to determine the tags associated with the text to be verified based on the text content of the text to be verified, and to determine the elements corresponding to the tags associated with the text to be verified as text elements based on the correspondence between tags and elements recorded in the element value table.
[0021] The encoding unit is used to perform one-hot encoding on the text elements based on the elements to be extracted contained in the text elements, and generate a one-hot matrix.
[0022] The calculation unit is used to calculate the probability of the text element corresponding to each word in at least a part of the text content of the text to be verified according to the one-hot matrix, and to determine the text element with the highest probability as the element of the corresponding word.
[0023] An extraction unit is used to extract words that correspond to the elements to be extracted from at least a portion of the text content of the text to be verified, and to use the extracted words as the element values of the elements to be extracted in the text to be verified.
[0024] The verification unit is used to compare the element value of the element to be extracted in the text to be verified with the element value of the element to be extracted recorded in the element value table, so as to verify the consistency between the text to be verified and the element to be extracted in the element value table.
[0025] According to a fourth aspect of the embodiments of this specification, a training apparatus for a probability model, the apparatus comprising:
[0026] The acquisition unit is used to acquire a training sample set. Each set of samples in the training sample set includes: word vectors of words in at least a portion of the text content of the training text, a one-hot matrix generated based on the elements to be extracted contained in the text elements corresponding to the training text, and the actual element values of the elements to be extracted.
[0027] An input unit is configured to input the training sample set into a probability model, and to process the training sample set by the probability model as follows: extracting word vector features of the word vectors; inputting the extracted word vector features into a convolutional neural network, and generating a feature matrix for the words in the at least part of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of the text element corresponding to each word;
[0028] The identification unit is used to identify the text element with the highest probability as the element corresponding to the word;
[0029] An extraction unit is used to extract words that correspond to the elements to be extracted from at least a portion of the text content of the training text, and to use the extracted words as the predicted element values of the elements to be extracted.
[0030] An optimization unit is used to optimize the probability model based on the actual element value of the element to be extracted and the predicted element value of the element to be extracted, so that the probability model can be used to calculate the probability of the text element corresponding to the word.
[0031] According to a fifth aspect of the embodiments of this specification, an electronic device is provided, comprising:
[0032] processor;
[0033] Memory used to store processor-executable instructions;
[0034] The processor implements the method as described in the first or second aspect by running the executable instructions.
[0035] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer instructions thereon, which, when executed by a processor, implement the steps of the method as described in the first or second aspect.
[0036] The technical solutions provided in the embodiments of this specification may include the following beneficial effects:
[0037] In this embodiment, tags associated with the text to be verified are determined based on its content, and the elements corresponding to these tags are identified as text elements. Based on the elements to be extracted contained within these text elements, one-hot encoding is performed on the text elements to generate a one-hot matrix. The probability of each text element corresponding to each word in at least a portion of the text content to be verified is then calculated using this one-hot matrix. Because the one-hot matrix is incorporated into the probability calculation, the weight of the elements to be extracted is increased, thereby improving the accuracy of text content recognition. By using the words corresponding to the elements to be extracted as element values and comparing these values with those recorded in the element value table, the consistency between the text to be verified and the elements in the element value table is verified. This allows for verification of element consistency without manual identification and verification, improving the efficiency of text processing.
[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this specification. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this specification and, together with the description, serve to explain the principles of this specification.
[0040] Figure 1 This is a flowchart illustrating a method for verifying the consistency of elements in text according to an exemplary embodiment.
[0041] Figure 2 This is a schematic diagram illustrating a judgment format according to an exemplary embodiment of this specification.
[0042] Figure 3This is a schematic diagram of a cross-validation graph of elements according to an exemplary embodiment of this specification.
[0043] Figure 4 This is a schematic diagram of a uniquely heated matrix according to an exemplary embodiment of this specification.
[0044] Figure 5 This is a schematic diagram illustrating a probability model according to an exemplary embodiment of this specification.
[0045] Figure 6 This is a flowchart illustrating a training method for a probability model according to an exemplary embodiment of this specification.
[0046] Figure 7 This is a hardware structure diagram of a computer device containing the document processing apparatus in the embodiments of this specification.
[0047] Figure 8 This specification illustrates a block diagram of an apparatus for verifying the consistency of elements in text, based on an exemplary embodiment.
[0048] Figure 9 This specification illustrates a block diagram of a training apparatus for a probability model according to an exemplary embodiment. Detailed Implementation
[0049] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.
[0050] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0051] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0052] The embodiments described in this specification will now be described in detail.
[0053] Before introducing methods for verifying the consistency of elements in text, let's first explain in detail the relationship between text and elements. Text is a document type used by computers to record and store textual information, rather than images, sounds, or formatted data. The text content in the text corresponds to elements; as mentioned earlier, words within the text can be associated with specific elements, and these words can serve as the element value of the associated element. From now on, when referring to "elements in text," we mean words in the text that correspond to elements.
[0054] Figure 1 This is a flowchart illustrating a method for verifying the consistency of elements in text according to an exemplary embodiment, as shown in this specification. Figure 1 As shown, the method includes at least the following steps:
[0055] Step 102: Obtain the text to be verified and a pre-set element value table, wherein the element value table records the correspondence between labels, elements and element values.
[0056] The text to be verified is text whose element consistency has not been verified. In a judicial setting, the text to be verified may include at least one of the following: judgment, complaint, or power of attorney. Figure 2 This specification is a schematic diagram illustrating a judgment format according to an exemplary embodiment, such as... Figure 2 As shown, a judgment can contain many types of elements. Among them, the elements "Court Name," "Document Type," and "Case Number" belong to the title category; elements such as "Plaintiff's Name," "Plaintiff's Ethnicity," and "Defendant's Name" belong to the basic information of the litigants; and elements such as "Cause of Action" and "Case Filing Date" belong to the categories of case details and trial process. Of course, the judgment also includes elements related to the plaintiff's claims and the defendant's responses, which will not be explained in detail here.
[0057] The feature value table records the correspondence between labels, features, and feature values. Features are associated with words in the text content, while labels are associated with paragraphs within the text content. Each paragraph of the text content is associated with a corresponding label; a paragraph can contain multiple words, and a label can correspond to multiple features. Of course, labels for different paragraphs can be the same or different. Figure 2 As shown, "title" can be used as a tag, and the tag "title" corresponds to three elements: "court name", "document type", and "case number".
[0058] Plaintiff Information Company Name Tiantian Co., Ltd. Business License Plaintiff Information residence xx City xx Square Business License Plaintiff Information legal representative day by day Business License Defendant Information Name Xiaoming Defendant's ID Card Defendant Information ID number 333333333 Defendant's ID Card Defendant Information address XX City, XX Residential Area Defendant's ID Card Claims principal 1111 yuan indictment
[0059] Table 1
[0060] The element value table can be generated based on the text associated with the text to be verified. For example, in a judicial scenario, the text to be verified is a judgment, and the text associated with the judgment could be a power of attorney, a complaint, the defendant's ID card, etc. Table 1 is a schematic diagram of an element value table according to an exemplary embodiment of this specification. The element value table in Table 1 includes four parts of information: label, element, element value, and element source. There are three types of labels: plaintiff information, defendant information, and claim. The plaintiff information corresponds to three elements: company name, address, and legal representative. The defendant information corresponds to three elements: name, ID number, and address. The claim corresponds to one element: principal amount. Each element records its corresponding element value and element source. The element source is the source of the element's element value. For example, the plaintiff's company name is "Tiantian Co., Ltd.", and this element value comes from the business license, which is the text associated with the text to be verified.
[0061] The feature value table can be generated manually by relevant staff based on text associated with the text to be verified. Specifically, the staff can compile it based on their work experience. Figure 3 The cross-validation graph shown records the elements that need to be validated and their sources. Staff can further obtain the text associated with the text to be validated based on the source of the elements recorded on the cross-validation graph, and generate an element value table based on the text associated with the text to be validated.
[0062] Step 104: Determine the tags associated with the text to be verified based on the text content of the text to be verified, and determine the elements corresponding to the tags associated with the text to be verified as text elements based on the correspondence between tags and elements recorded in the element value table.
[0063] As mentioned earlier, each paragraph in the text to be verified is associated with a tag. In one embodiment, determining the tags associated with the text to be verified based on its text content includes: generating a character vector matrix for each paragraph of the text to be verified, where each element of the character vector matrix is the character vector of each character in the corresponding paragraph; performing dimensionality reduction on the character vector matrix of each paragraph of the text to be verified to obtain segment vectors; generating a segment vector matrix for the text to be verified based on the segment vectors corresponding to all paragraphs in the text to be verified; and inputting the segment vector matrix into a pre-trained tagging model to obtain tags corresponding to each paragraph of the text to be verified.
[0064] There are many ways to vectorize text content. Specifically, the text content of each paragraph can be input into a language model to obtain the character vector corresponding to each character in the paragraph. Of course, the vectorization method is not limited to this, and this specification does not restrict it.
[0065] The structure of the character vector matrix V can be [X1, X2, X3…Xj], where j is the longest length of the paragraph, and Xj is the character vector corresponding to the j-th character in the paragraph. Dimensionality reduction is performed on the character vector matrix V corresponding to each paragraph. Specifically, the concept of embedding in deep learning can be used to extract vector features from the paragraph and convert the two-dimensional character vector matrix into a one-dimensional vector. After the conversion, the segment vectors corresponding to all paragraphs can generate a segment vector matrix F [F1, F2, F3…Fn] for the text to be verified, where Fn is the segment vector corresponding to the n-th paragraph in the text to be verified. Inputting the segment vector matrix F corresponding to the text to be verified into the labeling model yields the labeled text to be verified, as shown in Table 2. Each paragraph of the text content corresponds to a label, and different paragraphs can correspond to the same label. For example, the label "title" corresponds to the three paragraphs: court name, document type, and case number.
[0066]
[0067] Table 2
[0068] Step 106: Based on the elements to be extracted contained in the text elements, perform one-hot encoding on the text elements and generate a one-hot matrix;
[0069] The elements to be extracted can be set by the user, and the number of elements to be extracted is less than the number of text elements. Taking Table 2 as an example: there are three tags corresponding to the text to be verified shown in Table 2, namely: title, basic information of litigation participants, case origin, and trial process. Among them, the elements corresponding to the title are "court name, document type, case number", the elements corresponding to the basic information of litigation participants are "plaintiff's name, plaintiff's date of birth, plaintiff's address, defendant's name, defendant's address, and defendant's legal representative", and the elements corresponding to the case origin and trial process are "cause of action, filing time, applicable procedure, court hearing procedure, litigation participants present in court, and litigation participants not present in court". The final result is shown in Table 3, which is divided into three parts: tags, elements, and element IDs. The correspondence between tags and elements can be obtained from the element value table. The element ID is used to uniquely identify the elements in the text to be verified and is also used to generate a one-hot matrix.
[0070] title Court Name 1 title Document Types 2 title Case number 3 Basic information of the participants in the litigation Plaintiff's name 4 Basic information of the participants in the litigation Plaintiff's date of birth 5 Basic information of the participants in the litigation Plaintiff's address 6 Basic information of the participants in the litigation Defendant's name 7 Basic information of the participants in the litigation Defendant's address 8 Basic information of the participants in the litigation Legal representative of the defendant 9 Case Background and Trial Process Cause of Action 10 Case Background and Trial Process Case filing time 11 Case Background and Trial Process Applicable Procedures 12 Case Background and Trial Process Court proceedings 13 Case Background and Trial Process Participants in the litigation who appeared in court 14 Case Background and Trial Process Participants in litigation who did not appear in court 15
[0071] Table 3
[0072] In one embodiment, the user sets the elements to be extracted as those corresponding to "Case Origin and Trial Process": cause of action, filing date, applicable procedure, court hearing procedure, participants present in court, and participants absent from court. The corresponding element IDs are 10, 11, 12, 13, 14, and 15, and their corresponding element indices are also 10, 11, 12, 13, 14, and 15. After one-hot encoding of the text elements, the generated one-hot matrix is as follows: Figure 4 As shown, the element "cause of action" is the element to be extracted, and its corresponding element ID is 10. Therefore, the element in the 10th row and 10th column of the one-hot matrix is 1. Thus, the elements in the 11th row and 11th column, 12th row and 12th column, 13th row and 13th column, 14th row and 14th column, and 15th row and 15th column of the one-hot matrix are all 1, and the remaining elements are all 0.
[0073] Step 108: Calculate the probability of the text element corresponding to each word in at least a portion of the text content of the text to be verified based on the one-hot matrix, and determine the text element with the highest probability as the element of the corresponding word.
[0074] In the text to be verified, the same element may appear in different paragraphs corresponding to different tags. As shown in Table 2, the plaintiff Xiaoming's name appears in the first paragraph corresponding to the tag "Basic Information of Litigation Participants" and in the paragraph corresponding to the tag "Case Background and Trial Process." Undoubtedly, the plaintiff's name recorded in the "Basic Information of Litigation Participants" is more accurate than the plaintiff's name recorded in the "Case Background and Trial Process." Therefore, the plaintiff's name in the "Basic Information of Litigation Participants" should be used as the element value for "Plaintiff's Name." It is easy to see that extracting a specific element from the paragraph corresponding to a specific tag can make the element extraction results more accurate.
[0075] In one embodiment, at least a portion of the text to be verified is a paragraph to be extracted corresponding to a tag corresponding to the element to be extracted; the step of calculating the probability of the text element corresponding to each word in the at least a portion of the text content of the text to be verified based on the one-hot matrix includes: calculating the probability of the text element corresponding to each word in the paragraph to be extracted based on the one-hot matrix.
[0076] Assuming the elements to be extracted are: cause of action, filing date, applicable procedure, court proceedings, participants in court, and participants not present, all six elements correspond to "case origin and trial process." Therefore, the paragraph labeled "case origin and trial process" is identified as the paragraph to be extracted, and the probability is calculated only for this paragraph. This embodiment calculates the probability only for the paragraph to be extracted, avoiding the influence of other paragraphs on the probability results and improving the accuracy of the probability calculation.
[0077] The process of calculating the probability of the text element corresponding to a word is similar to the process of associating tags. Taking Table 3 as an example, Table 3 contains 15 text elements, indicating that each word in the text content of Table 3 has 15 possible text elements, each corresponding to a probability of one of the 15 text elements. For example, "Xiaoming" in Table 2 has 15 possibilities. Obviously, the text element with the highest probability is the plaintiff's name, so the element corresponding to Xiaoming is "plaintiff's name," and "Xiaoming" is the element value of the element "plaintiff's name."
[0078] Before adding the one-hot matrix, all text element probabilities are calculated with equal weight, and the probability calculation results are determined solely based on word vector features. After adding the one-hot matrix, the weight of the extracted elements is increased, thus increasing the probability of each element. For example, in the probability calculation for the date "January 1, 2010" in Table 2, the probabilities corresponding to the elements "plaintiff's date of birth" and "case filing date" would originally be relatively high. However, since "case filing date" is the element to be extracted, after adding the one-hot matrix, the probability corresponding to "case filing date" will be significantly greater than the probability corresponding to "plaintiff's date of birth." This makes the probability calculation results more accurate, and the extracted elements are also more accurate.
[0079] In one embodiment, calculating the probability of a text element corresponding to each word in at least a portion of the text content of the text to be verified based on the one-hot matrix includes: inputting the word vectors of the words in at least a portion of the text content of the text to be verified into a pre-trained probability model, so as to process the word vectors by the probability model as follows: extracting word vector features of the word vectors; inputting the extracted word vector features into a convolutional neural network and generating a feature matrix for the words in at least a portion of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of a text element corresponding to each word.
[0080] The following is combined Figure 5 A detailed introduction to probability models is provided. For example... Figure 5 As shown, the probabilistic model may include a feature extraction layer, a weight configuration layer, and a probability calculation layer. After inputting the one-hot matrix and word vectors into the probabilistic model, the model can extract word vector features from the word vectors in the feature extraction layer and input the extracted word vector features into a convolutional neural network, thereby generating a feature matrix for the words in at least a portion of the text content. Since the features of individual word vectors are limited and insufficient to meet the computational needs of the probabilistic model, to improve the accuracy of probability calculation, the word vector features can be input into the convolutional neural network to obtain more features. The resulting feature matrix is then input into the weight configuration layer and multiplied with the one-hot matrix to obtain the target matrix. The probabilistic model can then input the obtained target matrix into the probability calculation layer to calculate the probability of the text elements corresponding to the words and output the calculation results.
[0081] This embodiment provides a probability model that calculates the probability of elements corresponding to words based on a one-hot matrix, increases the weight of the elements to be extracted, improves the accuracy of the probability calculation results, and thus improves the precision of element extraction.
[0082] Step 110: Extract words corresponding to the elements in at least a portion of the text content to be verified as the elements to be extracted, and use the extracted words as the element values of the elements to be extracted in the text to be verified.
[0083] Step 112: Compare the element value of the element to be extracted in the text to be verified with the element value of the element to be extracted recorded in the element value table to verify the consistency between the text to be verified and the element to be extracted in the element value table.
[0084] In one embodiment, during the judicial case filing stage, the text to be verified is case materials related to the case; the method further includes: submitting the case for filing if the element value of the element to be extracted in the text to be verified is consistent with the element value of the element to be extracted in the element value table. In a judicial setting, relevant personnel need to process case materials related to the case to ensure the consistency of elements in the related case materials, and submit the case for filing if the consistency verification of elements in the case materials passes.
[0085] Figure 6 This is a flowchart illustrating a training method for a probabilistic model according to an exemplary embodiment of this specification. The method may include at least the following steps:
[0086] Step 602: Obtain a training sample set. Each set of samples in the training sample set includes: word vectors of words in at least a portion of the text content of the training text, a one-hot matrix generated based on the elements to be extracted contained in the text elements corresponding to the training text, and the actual element values of the elements to be extracted.
[0087] Step 604: Input the training sample set into the probability model to process the training sample set as follows: extract the word vector features of the word vectors; input the extracted word vector features into the convolutional neural network and generate a feature matrix for the words in the at least part of the text content; multiply the feature matrix by the one-hot matrix, and input the result of the multiplication into the probability calculation layer to calculate the probability of the text element corresponding to each word.
[0088] Step 606: Identify the text element with the highest probability as the element corresponding to the word.
[0089] Step 608: Extract the corresponding elements from at least a portion of the text content of the training text as words of the elements to be extracted, and use the extracted words as the predicted element values of the elements to be extracted.
[0090] Step 610: Optimize the probability model based on the actual element value and the predicted element value of the element to be extracted, so that the probability model can be used to calculate the probability of the text element corresponding to the word.
[0091] Specifically, a weight matrix can be set, and the dot product of this weight matrix with the one-hot matrix and the eigenvalue matrix can be further multiplied to obtain the target matrix. Probability calculations can then be performed on the target matrix. When the probabilistic model needs optimization, the values of the elements in the weight matrix can be modified to optimize the model. Of course, the method of model optimization is not limited to the weight matrix, and this specification does not impose any restrictions on this.
[0092] There are many methods to determine whether a probabilistic model needs optimization. For example, the cost function can be used to calculate the cost of the actual and predicted feature values. If the cost value is greater than a preset threshold, the probabilistic model is determined to need optimization; if the cost value is not greater than the preset threshold, the probabilistic model is determined not to need optimization. Of course, the method for determining optimization is not limited to the cost function, and this specification does not impose any restrictions on it.
[0093] Corresponding to the embodiments of the foregoing methods, this specification also provides embodiments of the apparatus and the terminal to which it is applied.
[0094] The embodiments of the document processing apparatus described in this specification can be applied to computer devices, such as servers or terminal devices. The apparatus embodiments can be implemented through software, hardware, or a combination of both. Taking software implementation as an example, as a logically defined apparatus, it is formed by the processor in which it processes the file, reading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 7 As shown, Figure 7 This is a hardware structure diagram of a computer device containing the document processing apparatus as described in the embodiments of this specification, except... Figure 7 In addition to the processor 710, memory 730, network interface 720, and non-volatile memory 740 shown, the server or electronic device in the embodiment may also include other hardware depending on the actual function of the computer device, which will not be described in detail here.
[0095] like Figure 8 As shown, Figure 8 This is a block diagram illustrating an apparatus for verifying the consistency of elements in text according to an exemplary embodiment of this specification, the apparatus comprising:
[0096] The acquisition unit 801 is used to acquire the text to be verified and a pre-set element value table, wherein the element value table records the correspondence between labels, elements and element values;
[0097] The determining unit 802 is used to determine the tags associated with the text to be verified based on the text content of the text to be verified, and to determine the elements corresponding to the tags associated with the text to be verified as text elements based on the correspondence between the tags and elements recorded in the element value table.
[0098] The encoding unit 803 is used to perform one-hot encoding on the text elements according to the elements to be extracted contained in the text elements, and generate a one-hot matrix.
[0099] The calculation unit 804 is used to calculate the probability of the text element corresponding to each word in at least a part of the text content of the text to be verified according to the one-hot matrix, and to determine the text element with the highest probability as the element of the corresponding word.
[0100] Extraction unit 805 is used to extract words whose corresponding elements are the elements to be extracted from at least a portion of the text content of the text to be verified, and to use the extracted words as the element values of the elements to be extracted in the text to be verified.
[0101] The verification unit 806 is used to compare the element value of the element to be extracted in the text to be verified with the element value of the element to be extracted recorded in the element value table, so as to verify the consistency between the text to be verified and the element to be extracted in the element value table.
[0102] Optionally, the determining unit 802 is specifically used for:
[0103] Generate a character vector matrix for each paragraph of the text to be verified, where each element of the character vector matrix is the character vector of each character in the corresponding paragraph;
[0104] The character vector matrix of each paragraph of the text to be verified is reduced in dimensionality to obtain the segment vector;
[0105] A segment vector matrix for the text to be verified is generated based on the segment vectors corresponding to all paragraphs in the text to be verified, and the segment vector matrix is input into a pre-trained label model to obtain a label corresponding to each paragraph of the text to be verified.
[0106] Optionally, at least a portion of the text to be verified is a paragraph to be extracted that corresponds to the tag of the element to be extracted;
[0107] The determining unit 802 is specifically used to: calculate the probability of the text element corresponding to each word in the paragraph to be extracted based on the one-hot matrix.
[0108] Optionally, the computing unit 804 is specifically configured to: input the word vectors of at least a portion of the text content to be verified into a pre-trained probability model, so as to process the word vectors through the probability model as follows: extract the word vector features of the word vectors; input the extracted word vector features into a convolutional neural network and generate a feature matrix for the words in the at least a portion of the text content; multiply the feature matrix by the one-hot matrix, and input the result of the multiplication into the probability computing layer to calculate the probability of the text element corresponding to each word.
[0109] Optionally, the feature value table is generated based on the text associated with the text to be verified.
[0110] Optionally, in a judicial setting, the text to be verified includes at least one of the following: a judgment, a complaint, or a power of attorney.
[0111] Optionally, during the judicial filing stage, the text to be verified is case material related to the case;
[0112] Also includes:
[0113] Submission unit 807 is used to submit a case for filing if the element value of the element to be extracted in the text to be verified is consistent with the element value of the element to be extracted in the element value table.
[0114] like Figure 9 As shown, Figure 9 This is a block diagram illustrating a training apparatus for a probabilistic model according to an exemplary embodiment of this specification, the apparatus comprising:
[0115] The acquisition unit 901 is used to acquire a training sample set. Each set of samples in the training sample set includes: word vectors of words in at least a part of the text content of the training text, a one-hot matrix generated according to the elements to be extracted contained in the text elements corresponding to the training text, and the actual element value of the elements to be extracted.
[0116] Input unit 902 is used to input the training sample set into a probability model, so that the training sample set is processed by the probability model as follows: extracting word vector features of the word vectors; inputting the extracted word vector features into a convolutional neural network and generating a feature matrix for the words in the at least part of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of the text element corresponding to each word;
[0117] The determination unit 903 is used to identify the text element with the highest probability as the element corresponding to the word;
[0118] Extraction unit 904 is used to extract words that correspond to the elements to be extracted from at least a portion of the text content of the training text, and use the extracted words as the predicted element values of the elements to be extracted.
[0119] The optimization unit 905 is used to optimize the probability model based on the actual element value of the element to be extracted and the predicted element value of the element to be extracted, so that the probability model can be used to calculate the probability of the text element corresponding to the word.
[0120] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0121] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0122] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0123] Other embodiments of this specification will readily occur to those skilled in the art upon consideration of the specification and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this specification are indicated by the following claims.
[0124] It should be understood that this specification is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this specification is limited only by the appended claims.
[0125] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A method for verifying the consistency of elements in text, characterized in that, The method includes: Obtain the text to be verified and a pre-defined feature value table, which records the correspondence between labels, features, and feature values; Based on the text content of the text to be verified, the tags associated with the text to be verified are determined, and based on the correspondence between the tags and the elements recorded in the element value table, the elements corresponding to the tags associated with the text to be verified are determined as text elements. Based on the elements to be extracted contained in the text elements, the text elements are one-hot encoded, and a one-hot matrix is generated. The word vectors of at least a portion of the text content to be verified are input into a pre-trained probability model, and the word vectors are processed by the probability model as follows: extracting word vector features; inputting the extracted word vector features into a convolutional neural network to generate a feature matrix for the words in the at least a portion of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of the text element corresponding to each word; extracting the words corresponding to the elements in the at least a portion of the text content to be verified as the elements to be extracted, and using the extracted words as the element values of the elements to be extracted in the text to be verified; The element values of the elements to be extracted in the text to be verified are compared with the element values of the elements to be extracted recorded in the element value table to verify the consistency between the text to be verified and the elements to be extracted in the element value table.
2. The method according to claim 1, characterized in that, The step of determining the tags associated with the text to be verified based on its text content includes: Generate a character vector matrix for each paragraph of the text to be verified, where each element of the character vector matrix is the character vector of each character in the corresponding paragraph; The character vector matrix of each paragraph of the text to be verified is reduced in dimensionality to obtain the segment vector; A segment vector matrix for the text to be verified is generated based on the segment vectors corresponding to all paragraphs in the text to be verified, and the segment vector matrix is input into a pre-trained label model to obtain a label corresponding to each paragraph of the text to be verified.
3. The method according to claim 2, characterized in that, At least a portion of the text to be verified is a paragraph to be extracted that corresponds to the tag of the element to be extracted; The step of calculating the probability of each text element corresponding to each word in at least a portion of the text content of the text to be verified based on the one-hot matrix includes: calculating the probability of each text element corresponding to each word in the paragraph to be extracted based on the one-hot matrix.
4. The method according to claim 1, characterized in that, The element value table is generated based on the text associated with the text to be verified.
5. The method according to claim 1, characterized in that, In a judicial setting, the text to be verified includes at least one of the following: a judgment, a complaint, or a power of attorney.
6. The method according to claim 1, characterized in that, During the judicial filing stage, the text to be verified is case material related to the case; the method also includes: If the element value of the element to be extracted in the text to be verified is consistent with the element value of the element to be extracted in the element value table, the case shall be submitted for filing.
7. A training method for a probabilistic model, characterized in that, The probability model is used to implement the method of any one of claims 1-6, the method comprising: Obtain a training sample set, wherein each set of samples in the training sample set includes: word vectors of words in at least a portion of the text content of the training text, a one-hot matrix generated based on the elements to be extracted contained in the text elements corresponding to the training text, and the actual element values of the elements to be extracted. The training sample set is input into a probability model, and the training sample set is processed by the probability model as follows: extracting word vector features of the word vectors; inputting the extracted word vector features into a convolutional neural network, and generating a feature matrix for the words in the at least part of the text content; multiplying the feature matrix by the one-hot matrix, and inputting the result of the multiplication into a probability calculation layer to calculate the probability of the text element corresponding to each word; The text element with the highest probability is identified as the element corresponding to the word; Extract the corresponding elements from at least a portion of the text content of the training text as words of the elements to be extracted, and use the extracted words as the predicted element values of the elements to be extracted; The probability model is optimized based on the actual element value and the predicted element value of the element to be extracted, so that the probability model can be used to calculate the probability of the text element corresponding to the word.
8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor implements the method as described in any one of claims 1-7 by executing the executable instructions.
9. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by the processor, this instruction implements the steps of the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Legal judgment document information extraction method
CN111783399A
Consistency inspection method for standard elements
CN112395854A