Document recognition method and device, computer device and storage medium
The document recognition method based on text information matching and confidence calculation solves the problem of low efficiency of traditional document recognition and realizes the automatic and rapid recognition of documents.
Patent Information
- Application Number
- CN202111122096.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-24
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2041-09-24
AI Technical Summary
Traditional document recognition methods are inefficient and difficult to quickly and accurately identify electronic documents on different devices.
By extracting the text information of the document to be identified and matching it with the reference document element set, the confidence level of the document elements is calculated to automatically determine whether the document is an official document.
It realizes the automatic recognition of official documents, improves the recognition efficiency and accuracy, and can quickly screen out official documents.
Smart Images

Figure CN114049644B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a document recognition method, apparatus, computer equipment, and storage medium. Background Art
[0002] With the widespread use of and dependence on the internet, various electronic files are stored, transmitted, and used on different devices. Some of these files may be confidential, and official documents, as important documents for party and government agencies in their official activities, are the primary source of confidential documents. However, confidential documents can be leaked by internal personnel through non-technical means (internal leaks, unintentional leaks, etc.) or by external criminals through technical means (including hacker intrusions, software vulnerabilities, etc.). Therefore, in order to address internal and external threats to electronic official documents, it is imperative to identify electronic official documents among those stored, transmitted, and used on different devices.
[0003] In traditional technology, the method of document recognition is to manually read the entire document to achieve the recognition of the document. However, the efficiency of document recognition using traditional technology is low. Summary of the Invention
[0004] Based on this, it is necessary to provide a document recognition method, device, computer equipment and storage medium that can improve the efficiency of document recognition in order to address the above technical problems.
[0005] A method for identifying official documents, comprising:
[0006] Get the file to be identified;
[0007] Extracting text information from the file to be identified;
[0008] matching the text information with reference document elements in a reference document element set to obtain a first document element set, wherein the first document element set is composed of first document elements in the text information that successfully match the reference document elements;
[0009] Calculating a target confidence level corresponding to the to-be-identified document based on a first confidence level corresponding to a first document element in the first document element set;
[0010] If the target confidence meets the official document similarity condition, the document to be identified is determined to be an official document.
[0011] In one embodiment, calculating the target confidence level corresponding to the to-be-identified document based on the first confidence level corresponding to the first document element in the first document element set includes:
[0012] Obtaining location information of the first official document element in the document to be identified;
[0013] determining a position relationship between the first official document elements according to the position information;
[0014] selecting a target first official document element satisfying a reference position relationship from the first official document element set according to the position relationship;
[0015] calculating a target confidence degree corresponding to the to-be-recognized file according to a first confidence degree corresponding to the target first official document element.
[0016] In one of the embodiments, the method further comprises:
[0017] if there is no target first official document element satisfying a reference position relationship from the first official document element set according to the position relationship, determining that the to-be-recognized file is a non-official document.
[0018] In one of the embodiments, the first official document elements include a copy number, a classified level and a classified period, an urgency degree, a document-issuing organ symbol, a document-issuing number, a document-issuing person, a title, a document-writing date, a document-copying organ and a document-issuing date, and the position information includes a page number and a line number.
[0019] the page number corresponding to the copy number = the page number corresponding to the classified level and the classified period = the page number corresponding to the urgency degree = the page number corresponding to the document-issuing organ symbol = the page number corresponding to the document-issuing number = the page number corresponding to the document-issuing person = the page number corresponding to the title, and the line number corresponding to the copy number < the line number corresponding to the classified level and the classified period < the line number corresponding to the urgency degree < the line number corresponding to the document-issuing organ symbol < the line number corresponding to the document-issuing number < the line number corresponding to the document-issuing person < the line number corresponding to the title.
[0020] the page number corresponding to the title = the page number corresponding to the document-writing date = the page number corresponding to the document-copying organ = the page number corresponding to the document-issuing date, and the line number corresponding to the title < the line number corresponding to the document-writing date < the line number corresponding to the document-copying organ < the line number corresponding to the document-issuing date.
[0021] or,
[0022] the page number corresponding to the title < the page number corresponding to the document-writing date = the page number corresponding to the document-copying organ = the page number corresponding to the document-issuing date, and the line number corresponding to the document-writing date < the line number corresponding to the document-copying organ < the line number corresponding to the document-issuing date.
[0023] In one of the embodiments, the layout parameters include a font size, a font color, an alignment mode and a line number, and the calculation of the target confidence degree corresponding to the to-be-recognized file according to the first confidence degree corresponding to the first official document element in the first official document element set comprises:
[0024] obtain gear information matched with each first official document element in the first official document element set;
[0025] determine a first confidence degree corresponding to each first official document element according to the gear information matched with the first official document element;
[0026] obtain a layout parameter corresponding to each first official document element;
[0027] determine a second confidence degree corresponding to each first official document element according to whether the layout parameter meets a preset official document layout condition;
[0028] calculate a target confidence degree corresponding to the to-be-recognized file according to the first confidence degree and the second confidence degree.
[0029] In one of the embodiments, the calculation of the target confidence degree corresponding to the to-be-recognized file according to the first confidence degree and the second confidence degree comprises:
[0030] calculate an initial confidence degree corresponding to the to-be-recognized file according to the first confidence degree corresponding to each first official document element in the first official document element set;
[0031] if the initial confidence degree meets an initial official document similarity condition, add the initial confidence degree and the second confidence degree to obtain the target confidence degree corresponding to the to-be-recognized file.
[0032] In one of the embodiments, the determination of the second confidence degree corresponding to each first official document element according to whether the layout parameter meets the preset official document layout condition comprises:
[0033] if the font size meets a preset size condition, obtain a confidence degree corresponding to the font size;
[0034] if the font color meets a preset color condition, obtain a confidence degree corresponding to the font color;
[0035] if the alignment mode meets a preset alignment condition, obtain a confidence degree corresponding to the alignment mode;
[0036] if the line number meets a preset line number condition, obtain a confidence degree corresponding to the line number;
[0037] calculate the second confidence degree corresponding to each first official document element according to the confidence degree corresponding to the font size, the confidence degree corresponding to the font color, the confidence degree corresponding to the alignment mode, and the confidence degree corresponding to the line number.
[0038] In one of the embodiments, the method further comprises:
[0039] If the initial confidence degree does not satisfy the initial official document similarity condition, it is determined that the file to be identified is not an official document.
[0040] In one of the embodiments, the matching of the text information with the reference official document elements in the reference official document element set to obtain the first official document element set comprises:
[0041] obtaining a regular expression corresponding to the reference official document element in the reference official document element set;
[0042] matching the text information with the regular expression to obtain the first official document element set.
[0043] In one of the embodiments, after it is determined that the file to be identified is an official document if the target confidence degree satisfies the official document similarity condition, the method further comprises:
[0044] extracting the first official document element satisfying the official document similarity condition from the file to be identified and sending the first official document element to an upper-layer business system to instruct the upper-layer business system to display the first official document element satisfying the official document similarity condition.
[0045] A device for identifying an official document, the device comprising:
[0046] a file obtaining module configured to obtain a file to be identified;
[0047] a text extracting module configured to extract text information in the file to be identified;
[0048] an element matching module configured to match the text information with reference official document elements in a reference official document element set to obtain a first official document element set, wherein the first official document element set is composed of first official document elements in the text information that are successfully matched with the reference official document elements;
[0049] a confidence degree calculating module configured to calculate a target confidence degree corresponding to the file to be identified according to first confidence degrees corresponding to the first official document elements in the first official document element set;
[0050] an official document determining module configured to determine that the file to be identified is an official document if the target confidence degree satisfies an official document similarity condition.
[0051] A computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0052] obtaining a file to be identified;
[0053] extracting text information in the file to be identified;
[0054] matching the text information with reference official document elements in a reference official document element set to obtain a first official document element set, wherein the first official document element set is composed of first official document elements in the text information that are successfully matched with the reference official document elements;
[0055] calculating a target confidence degree corresponding to the to-be-identified file according to first confidence degrees corresponding to first official document elements in the first official document element set;
[0056] if the target confidence degree satisfies an official document similarity condition, determining that the to-be-identified file is an official document.
[0057] A computer readable storage medium, having stored thereon a computer program, the computer program being executed by a processor to implement the following steps:
[0058] obtaining a to-be-identified file;
[0059] extracting text information in the to-be-identified file;
[0060] matching the text information with reference official document elements in a reference official document element set to obtain a first official document element set, wherein the first official document element set is composed of first official document elements in the text information that are successfully matched with the reference official document elements;
[0061] calculating a target confidence degree corresponding to the to-be-identified file according to first confidence degrees corresponding to first official document elements in the first official document element set;
[0062] if the target confidence degree satisfies an official document similarity condition, determining that the to-be-identified file is an official document.
[0063] The official document identification method, device, computer device and storage medium described above first match text information in a to-be-identified file with reference official document elements to determine first official document elements, then calculate a target confidence degree corresponding to the to-be-identified file according to first confidence degrees corresponding to the first official document elements, and determine a to-be-identified file with a higher confidence degree as an official document. Thus, automatic identification of official documents can be realized, which is conducive to improving the identification efficiency of official documents. BRIEF DESCRIPTION OF DRAWINGS
[0064] Figure 1 a flowchart of an official document identification method in one embodiment;
[0065] Figure 2 a flowchart of an official document identification method in another embodiment;
[0066] Figure 3 an explanatory diagram of official document element quantitative calculation in one embodiment;
[0067] Figure 4An explanatory diagram of quantification of layout parameters in one embodiment;
[0068] Figure 5 A structural block diagram of a document recognition device in one embodiment;
[0069] Figure 6 An internal structural diagram of a computer device in one embodiment. DETAILED DESCRIPTION
[0070] In order to make the purposes, technical solutions and advantages of the present application clearer, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0071] In one embodiment, as shown in Figure 1 A document recognition method is provided, and the present embodiment is exemplified by the method applied to a server. It should be understood that the method can also be applied to a terminal, and can also be applied to a system including a terminal and a server, and is realized through the interaction of the terminal and the server. In the present embodiment, the method includes the following steps:
[0072] Step S102, obtaining a to-be-recognized file.
[0073] The to-be-recognized file refers to an electronic file to be recognized. The electronic file can be a document.
[0074] Specifically, the server obtains a to-be-recognized file. The to-be-recognized file can contain layout parameters, such as Office Word documents, pdf, rtf, and ofd format files; or can not contain layout parameters, such as Office Excel and PowerPoint documents, CHM and TXT format files.
[0075] Step S104, extracting text information in the to-be-recognized file.
[0076] Specifically, the server extracts text information in the to-be-recognized file. Optionally, the server uses a character recognition technology, such as an optical character recognition technology, to recognize the text information in the to-be-recognized file.
[0077] Step S106, matching the text information with reference document elements in a reference document element set to obtain a first document element set.
[0078] The first document element set is composed of first document elements in the text information that are successfully matched with the reference document elements.
[0079] The reference document element set is a set composed of at least one reference document element.
[0080] Specifically, the server matches the text information with the reference official document elements in the set of reference official document elements to obtain a first set of official document elements. Optionally, if the text information contains a certain reference official document element, the text information is successfully matched with the reference official document element, and the matched official document element in the text information is determined as a first official document element. Optionally, the reference official document element corresponds to a regular expression pattern matching rule. In an embodiment, the server obtains a regular expression corresponding to the reference official document element in the set of reference official document elements, and matches the text information with the regular expression to obtain the first set of official document elements. Optionally, the regular expression is constructed based on the extracted official document element features in the official document template and the scalability information matched with the official document element features. The scalability is used to reflect the available capacity in the official document element feature matching process.
[0081] In step S108, the target confidence corresponding to the to-be-identified file is calculated according to the first confidence corresponding to the first official document element in the first set of official document elements.
[0082] The higher the first confidence is, the higher the influence degree of the official document element on the official document recognition is, and the to-be-identified file is more likely to be an official document. Conversely, the lower the first confidence is, the lower the influence degree of the official document element on the official document recognition is, and the to-be-identified file is more likely to be a non-official document.
[0083] Specifically, the first confidence corresponding to each official document element can be pre-set, so that after the server obtains the first official document element, the first confidence corresponding to the first official document element is obtained according to the pre-set corresponding relationship, and then the target confidence corresponding to the to-be-identified file is calculated. The calculation method of the target confidence can be to accumulate the first confidence corresponding to the first official document element.
[0084] In step S110, if the target confidence satisfies the official document similarity condition, the to-be-identified file is determined as an official document.
[0085] Specifically, the server determines whether the confidence satisfies the official document similarity condition. If yes, the to-be-identified file is determined as an official document. If no, the to-be-identified file is determined as a non-official document. Optionally, the official document similarity condition can be greater than or equal to a confidence threshold. The official document similarity condition can also be within a confidence interval.
[0086] In the above official document recognition method, the text information in the to-be-identified file is first matched with the reference official document elements to determine the first official document element, then the target confidence corresponding to the to-be-identified file is calculated according to the first confidence corresponding to the first official document element, and the to-be-identified file with higher confidence is determined as an official document. Thus, the automatic recognition of official documents can be realized, which is conducive to improving the recognition efficiency of official documents.
[0087] In one embodiment, a possible implementation of step S108, "calculating a target confidence level corresponding to the document to be identified based on the first confidence level corresponding to the first document element in the first document element set," is described. Based on the above embodiment, step S108 can be specifically implemented by the following steps:
[0088] Step S1082, obtaining the position information of the first document element in the document to be identified;
[0089] Step S1084, determining the positional relationship between the first document elements based on the position information;
[0090] Step S1086, selecting a target first document element whose positional relationship satisfies a reference positional relationship from the first document element set;
[0091] Step S1088: Calculate the target confidence level corresponding to the document to be identified based on the first confidence level corresponding to the target first document element.
[0092] Specifically, the server obtains location information of the first document element in the document to be identified. Optionally, the location information includes one or more of a line number or a page number. In one embodiment, the location information includes both the line number and the page number. Optionally, the location information can be expressed as coordinates in a coordinate system constructed based on the document to be identified.
[0093] Then, the server determines the positional relationship between the first document elements based on the position information. Taking the line number and page number as an example, if the page number of the document element "copy number" is Px and the line number is Lx, and the page number of the document element "urgency" is Py and the line number is Ly. The server determines whether the "copy number" and the "urgency" are on the same page by comparing the size of Px and Py. If Px = Py, it means that the "copy number" and the "urgency" are on the same page; if Px ≠ Py, it means that the "copy number" and the "urgency" are not on the same page. The server determines the order of the lines where the "copy number" and the "urgency" are located by comparing the size of Lx and Ly. If Lx > Ly, it means that the "urgency" comes first and the "copy number" comes second; if Lx = Ly, it means that the "copy number" and the "urgency" are on the same line; if Lx < Ly, it means that the "copy number" comes first and the "urgency" comes second.
[0094] The server then selects a target first document element from the set of first document elements whose positional relationship satisfies a reference positional relationship. The reference positional relationship is determined in the document template based on the order of the document elements. Optionally, if the positional relationship is the same as the reference positional relationship, then the reference positional relationship is satisfied.
[0095] Finally, the server calculates a target confidence corresponding to the to-be-identified file according to the first confidence corresponding to the target first official document element. The confidence can be calculated by accumulating the first confidence corresponding to the target first official document element.
[0096] In this embodiment, by filtering the official document elements with invalid position relationships, the amount of data for official document determination is reduced, and the accuracy of official document determination is improved.
[0097] In one embodiment, the first official document element includes at least one of a serial number, a classified level and a classified period, an urgency level, a sending organ symbol, a sending document number, a sender, a title, a writing date, a copy organ, or an issuing date.
[0098] Based on this, in one embodiment, the page number corresponding to the serial number = the page number corresponding to the classified level and the classified period = the page number corresponding to the urgency level = the page number corresponding to the sending organ symbol = the page number corresponding to the sending document number = the page number corresponding to the sender = the page number corresponding to the title, and the line number corresponding to the serial number < the line number corresponding to the classified level and the classified period < the line number corresponding to the urgency level < the line number corresponding to the sending organ symbol < the line number corresponding to the sending document number < the line number corresponding to the sender < the line number corresponding to the title.
[0099] The page number corresponding to the title = the page number corresponding to the writing date = the page number corresponding to the copy organ = the page number corresponding to the issuing date, and the line number corresponding to the title < the line number corresponding to the writing date < the line number corresponding to the copy organ < the line number corresponding to the issuing date; or, the page number corresponding to the title < the page number corresponding to the writing date = the page number corresponding to the copy organ = the page number corresponding to the issuing date, and the line number corresponding to the writing date < the line number corresponding to the copy organ < the line number corresponding to the issuing date.
[0100] In one embodiment, the method further includes the following steps:
[0101] In step S107, if there is no target first official document element with a position relationship satisfying the reference position relationship in the first official document element set, the to-be-identified file is determined as a non-official document.
[0102] Specifically, if the position relationship between all the first official document elements does not satisfy the reference position relationship, the to-be-identified file is determined as a non-official document. Alternatively, if the position relationship is not the same as the reference position relationship, the position relationship does not satisfy the reference position relationship.
[0103] In this embodiment, the to-be-identified file with the position relationship between all the first official document elements not satisfying the reference position relationship is determined as a non-official document, and accurate identification of non-official documents is achieved.
[0104] In an embodiment, a possible implementation of the above step S108 "calculating the target confidence corresponding to the to-be-recognized file according to the first confidence corresponding to each first official document element in the first official document element set" is involved. Based on the above embodiment, step S108 can be implemented through the following steps:
[0105] Step S1081, obtaining gear information matched with each first official document element in the first official document element set;
[0106] Step S1082, determining the first confidence corresponding to each first official document element according to the gear information matched with each first official document element;
[0107] Step S1085, determining the second confidence corresponding to each first official document element according to whether the layout parameter meets the preset official document layout condition;
[0108] Step S1087, calculating the target confidence corresponding to the to-be-recognized file according to the first confidence and the second confidence.
[0109] Optionally, the layout parameter includes one or more of font size, font color, alignment mode or position. The layout parameter can obtain a corresponding layout score after being quantized.
[0110] Specifically, after the server obtains each first official document element, the server determines the gear information matched with each first official document element according to the association relationship between the official document element and the gear information. For example, the official document elements are divided into four gears in advance, each gear corresponds to a plurality of official document elements, and each gear corresponds to different confidence. In this way, the importance of different official document elements for official document recognition can be distinguished. The server determines the first confidence corresponding to each first official document element according to the gear information matched with each first official document element. For example, assuming that the first official document element is "issue number", according to the association relationship between the issue number and gear 1, it is determined that the first official document element "issue number" matches gear 1, and then the confidence 40 associated with gear 1 is taken as the first confidence corresponding to the first official document element "issue number".
[0111] And the server obtains the layout parameters corresponding to each first official document element, the layout parameters being extracted from the to-be-identified file, for example, the layout parameters can include font size, font color, alignment mode and line number. Then, the server determines the second confidence corresponding to each first official document element according to whether the layout parameters meet the preset official document layout condition. Optionally, if the font size meets the preset size condition, the confidence corresponding to the font size is obtained; if the font color meets the preset color condition, the confidence corresponding to the font color is obtained; if the alignment mode meets the preset alignment condition, the confidence corresponding to the alignment mode is obtained; if the line number meets the preset line number condition, the confidence corresponding to the line number is obtained; and the second confidence corresponding to each first official document element is calculated according to the confidence corresponding to the font size, the confidence corresponding to the font color, the confidence corresponding to the alignment mode and the confidence corresponding to the line number. Optionally, the confidences corresponding to different types of layout parameters are accumulated to obtain the second confidence corresponding to each first official document element. Finally, the server adds the first confidence and the second confidence to obtain the target confidence corresponding to the to-be-identified file.
[0112] In this embodiment, the official document is determined based on the official document element and the layout parameter corresponding thereto, and the accuracy of the determination of the official document is improved.
[0113] In one embodiment, a possible implementation of the above step S1087 "calculating the target confidence corresponding to the to-be-identified file according to the first confidence and the second confidence" is involved. On the basis of the above embodiment, step S1087 can be implemented through the following steps:
[0114] Step S108a, calculating the initial confidence corresponding to the to-be-identified file according to the first confidence corresponding to each first official document element in the first official document element set;
[0115] Step S108b, if the initial confidence meets the initial official document similarity condition, adding the initial confidence and the second confidence to obtain the target confidence corresponding to the to-be-identified file.
[0116] Specifically, the server accumulates the first confidences corresponding to all the first official document elements to obtain the initial confidence corresponding to the to-be-identified file. If the initial confidence meets the initial official document similarity condition, the server adds the initial confidence and the second confidence to obtain the target confidence corresponding to the to-be-identified file. Optionally, the initial official document similarity condition can be greater than or equal to a confidence threshold. The initial official document similarity condition can also be located in a confidence interval.
[0117] In this embodiment, it can be preliminarily determined whether the to-be-identified file is an official document, and non-official documents are eliminated, which is beneficial to the rapid determination of the official document in the subsequent step. In one embodiment, the method further includes the following steps:
[0118] Step S108c, if the initial confidence degree does not satisfy the initial official document similarity condition, determining that the to-be-identified file is a non-official document.
[0119] Specifically, if the initial confidence degree is less than the confidence degree threshold or is not located in the confidence degree interval, the server determines that the to-be-identified file is a non-official document.
[0120] In this embodiment, the to-be-identified file whose initial confidence degree does not satisfy the initial official document similarity condition is determined as a non-official document, and accurate identification of the non-official document is realized.
[0121] In one embodiment, the method further includes the following steps:
[0122] Step S110, extracting a first official document element satisfying the official document similarity condition from the to-be-identified file and sending the first official document element to the upper-layer business system to instruct the upper-layer business system to display the first official document element satisfying the official document similarity condition.
[0123] Specifically, the server sends the first official document element successfully matched with the reference official document element group to the upper-layer business system. The upper-layer business system displays the first official document element through a display.
[0124] Next, an embodiment of the present application will be described in combination with a specific application scenario. Please refer to Figure 2 and Figure 3 The method includes the following steps:
[0125] Step S202, obtaining a to-be-identified file.
[0126] Specifically, the server obtains a to-be-identified file.
[0127] Step S204, extracting content and generating corresponding position information.
[0128] Specifically, the server extracts the text content of the to-be-identified file in step S202 by text and position extraction technology, and then generates corresponding position information for each extracted line of text content, for example, the line number and the page code of the page where the line of text content is located, denoted as (P, L). Wherein, P represents the page code, and L represents the line number.
[0129] Step S206, matching official document elements and obtaining corresponding position information.
[0130] Specifically, the server utilizes a pre-constructed official document element pattern matching rule library storing at least one official document element pattern matching rule corresponding to a reference official document element set, and adopts an open-source regular expression matching engine to perform official document element pattern matching on the text content in step S204. If the official document element matching is successful, the official document element and its corresponding position information of the matching success are recorded. Otherwise, the official document determination ends, indicating that the to-be-identified file is not an official document file, and no official document element is extracted.
[0131] Step S208, filtering the position information of the matched official document element.
[0132] Specifically, the server utilizes a pre-constructed official document element position filtering rule set storing a reference position relationship, filters the position information corresponding to the official document element matched in step S206, retains the official document element with valid position information, and discards the official document element with invalid position information. If the position information corresponding to the official document element matched is all invalid, the official document determination ends, indicating that the to-be-identified file is not an official document file, and no official document element is extracted.
[0133] Step S210, determining whether the to-be-identified file is an official document.
[0134] Specifically, the server utilizes a pre-constructed official document element confidence quantification calculation rule set to quantitatively calculate all the official document elements and their layout parameters obtained after the filtering in step S208 and obtain the confidence, determines whether the confidence is greater than or equal to a preset official document determination confidence threshold, and if yes, determines that the to-be-identified file is an official document; otherwise, the to-be-identified file is not an official document.
[0135] Step S212, extracting the matched official document element.
[0136] Specifically, if it is determined in step S210 that the to-be-identified file is an official document file, all the official document elements obtained after the filtering in step S208 are extracted into the corresponding fields of the official document element structure, and the official document element structure is sent to an upper business system for use by the upper business system.
[0137] In one embodiment, as shown in Table 1, there are 15 official document formats (document types) and their descriptions.
[0138]
[0139]
[0140] Table 1
[0141] In one embodiment, the process of constructing the rule base of pattern matching of document elements is involved. Specifically, first, a plurality of reference document elements, for example, 10, applicable to pattern recognition are selected as the judgment features of the document. As shown in Table 2, the 10 reference document features can be, for example, the serial number, the secret level and the secret period, the urgency, the issuing organ mark, the document number, the signer, the title, the writing date, the copy organ and the printing date.
[0142]
[0143]
[0144]
[0145] Table 2: Arrangement rules of each element of the document format
[0146] Then, the unique features of the above-mentioned 10 reference document elements and their scalability are determined, as shown in Table 3.
[0147]
[0148]
[0149]
[0150]
[0151] Table 3: Document elements with unique features and scalability of their matching rules
[0152] Subsequently, according to the document element features of the reference document elements and the scalability information matched with the document element features, the regular expression pattern matching rules corresponding to the reference document elements are determined, each pattern matching rule is numbered, and the open-source regular expression matching engine is used to generate the rule base of the document element pattern matching, so as to obtain the first set of document elements by rule matching screening.
[0153] In one embodiment, the process of constructing the rule base of pattern matching of document elements is involved. Specifically, first, a plurality of reference document elements, for example, 10, applicable to pattern recognition are selected as the judgment features of the document. As shown in Table 2, the 10 reference document features can be, for example, the serial number, the secret level and the secret period, the urgency, the issuing organ mark, the document number, the signer, the title, the writing date, the copy organ and the printing date.
[0154] 2.1 If one of the matched first document elements is "serial number", its position is recorded as (Px, Lx), and:
[0155] 2.1.1 If one of the remaining matched first document elements is "secret level and secret period", its position is recorded as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0156] 2.1.2 If one of the remaining matched first document elements is "urgency level" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0157] 2.1.3 If one of the remaining matched first document elements is "issuing organ sign" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0158] 2.1.4 If one of the remaining matched first document elements is "document number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0159] 2.1.5 If one of the remaining matched first document elements is "signer" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0160] 2.1.6 If one of the remaining matched first document elements is "title" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0161] 2.1.7 If one of the remaining matched first document elements is "date of composition" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0162] 2.1.8 If one of the remaining matched first document elements is "cc organ" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0163] 2.1.9 If one of the remaining matched first document elements is "date of issuance" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py.
[0164] 2.2 If one of the matched first document elements is "classification and secrecy period" and its position is noted as (Px, Lx), and:
[0165] 2.2.1 If one of the remaining matched first document elements is "copy number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0166] 2.2.2 If one of the remaining matched first document elements is "urgency level" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0167] 2.2.3 If one of the remaining matched first document elements is "issuing organ sign" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0168] 2.2.4 If one of the remaining matched first document elements is "document number" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0169] 2.2.5 If one of the remaining matched first document elements is "signer" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0170] 2.2.6 If one of the remaining matched first document elements is "title" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0171] 2.2.7 If one of the remaining matched first document elements is "date of drafting" whose position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0172] 2.2.8 If one of the remaining matched first document elements is "cc organ" whose position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0173] 2.2.9 If one of the remaining matched first document elements is "date of issuance" whose position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py.
[0174] 2.3 If one of the matched first document elements is "urgency level" whose position is noted as (Px, Lx), and:
[0175] 2.3.1 If one of the remaining matched first document elements is "copy number" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0176] 2.3.2 If one of the remaining matched first document elements is "classification and secrecy period" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0177] 2.3.3 If one of the remaining matched first document elements is "issuing organ sign" whose position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0178] 2.3.4 If one of the remaining matched first diplomatic document elements is "document number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0179] 2.3.5 If one of the remaining matched first diplomatic document elements is "issuer" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0180] 2.3.6 If one of the remaining matched first diplomatic document elements is "title" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0181] 2.3.7 If one of the remaining matched first diplomatic document elements is "date of composition" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0182] 2.3.8 If one of the remaining matched first diplomatic document elements is "recipient office" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0183] 2.3.9 If one of the remaining matched first diplomatic document elements is "date of issuance" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py.
[0184] 2.4 If one of the matched first diplomatic document elements is "issuer's mark" and its position is noted as (Px, Lx), and:
[0185] 2.4.1 If one of the remaining matched first diplomatic document elements is "copy number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0186] 2.4.2 If one of the remaining matched first diplomatic document elements is "classification and period of secrecy" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0187] 2.4.3 If one of the remaining matched first diplomatic document elements is "urgency" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0188] 2.4.4 If one of the remaining matched first diplomatic document elements is "document number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0189] 2.4.5 If one of the remaining matched first document elements is "issuer" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0190] 2.4.6 If one of the remaining matched first document elements is "title" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly;
[0191] 2.4.7 If one of the remaining matched first document elements is "date of composition" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0192] 2.4.8 If one of the remaining matched first document elements is "cc" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0193] 2.4.9 If one of the remaining matched first document elements is "date of issuance" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py.
[0194] 2.5 If one of the matched first document elements is "document number" and its position is noted as (Px, Lx), and:
[0195] 2.5.1 If one of the remaining matched first document elements is "part number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0196] 2.5.2 If one of the remaining matched first document elements is "classification and security period" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0197] 2.5.3 If one of the remaining matched first document elements is "urgency" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0198] 2.5.4 If one of the remaining matched first document elements is "issuer's mark" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0199] 2.5.5 If one of the remaining matched first document elements is "issuer" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx <= Ly;
[0200] 2.5.6 If one of the remaining matched first document elements is "title" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| < 5;
[0201] 2.5.7 If one of the remaining matched first document elements is "date of composition" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0202] 2.5.8 If one of the remaining matched first document elements is "cc" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py;
[0203] 2.5.9 If one of the remaining matched first document elements is "date of issuance" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px < Py.
[0204] 2.6 If one of the matched first document elements is "issuer" and its position is noted as (Px, Lx), and:
[0205] 2.6.1 If one of the remaining matched first document elements is "copy number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0206] 2.6.2 If one of the remaining matched first document elements is "classification and security period" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0207] 2.6.3 If one of the remaining matched first document elements is "urgency" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0208] 2.6.4 If one of the remaining matched first document elements is "issuing agency marker" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0209] 2.6.5 If one of the remaining matched first document elements is "document number" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx >= Ly;
[0210] 2.6.6 If one of the remaining matched first document elements is "title" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| < 5;
[0211] 2.6.7 If one of the remaining matched first document elements is "Date of Composition" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py;
[0212] 2.6.8 If one of the remaining matched first document elements is "Transmitting Office" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py;
[0213] 2.6.9 If one of the remaining matched first document elements is "Date of Issuance" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py.
[0214] 2.7 If one of the matched first document elements is "Title" and its location is noted as (Px, Lx), and:
[0215] 2.7.1 If one of the remaining matched first document elements is "Part Number" and its location is noted as (Py, Ly), then either Px == Py and Lx > Ly;
[0216] 2.7.2 If one of the remaining matched first document elements is "Classification and Security Period" and its location is noted as (Py, Ly), then either Px == Py and Lx > Ly;
[0217] 2.7.3 If one of the remaining matched first document elements is "Urgency" and its location is noted as (Py, Ly), then either Px == Py and Lx > Ly;
[0218] 2.7.4 If one of the remaining matched first document elements is "Transmitting Office Mark" and its location is noted as (Py, Ly), then either Px == Py and Lx > Ly;
[0219] 2.7.5 If one of the remaining matched first document elements is "Authorizing Office Number" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| < 5;
[0220] 2.7.6 If one of the remaining matched first document elements is "Author" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| < 5;
[0221] 2.7.7 If one of the remaining matched first document elements is "Date of Composition" and its location is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py;
[0222] 2.7.8 If one of the remaining matched first document elements is "cc to", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py;
[0223] 2.7.9 If one of the remaining matched first document elements is "date of issue", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px < Py.
[0224] 2.8 If one of the matched first document elements is "date of drafting", whose position is noted as (Px, Lx), and:
[0225] 2.8.1 If one of the remaining matched first document elements is "copy number", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0226] 2.8.2 If one of the remaining matched first document elements is "classification and period of secrecy", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0227] 2.8.3 If one of the remaining matched first document elements is "urgency", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0228] 2.8.4 If one of the remaining matched first document elements is "sender's mark", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0229] 2.8.5 If one of the remaining matched first document elements is "sender's number", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0230] 2.8.6 If one of the remaining matched first document elements is "sender's name", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0231] 2.8.7 If one of the remaining matched first document elements is "title", whose position is noted as (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0232] 2.8.8 If one of the remaining matched first document elements is "cc to", whose position is noted (Py, Ly), then either Px == Py and Lx < Ly, or (Px + 1) <= Py.
[0233] 2.8.9 If one of the remaining matched first document elements is "date of issue", whose position is noted (Py, Ly), then either Px == Py and Lx < Ly, or (Px + 1) <= Py.
[0234] 2.9 If one of the matched first document elements is "cc to", whose position is noted (Px, Lx), and:
[0235] 2.9.1 If one of the remaining matched first document elements is "copy number", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0236] 2.9.2 If one of the remaining matched first document elements is "classification and security period", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0237] 2.9.3 If one of the remaining matched first document elements is "urgency", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0238] 2.9.4 If one of the remaining matched first document elements is "sender's sign", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0239] 2.9.5 If one of the remaining matched first document elements is "sender's number", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0240] 2.9.6 If one of the remaining matched first document elements is "signer", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0241] 2.9.7 If one of the remaining matched first document elements is "title", whose position is noted (Py, Ly), then either Px == Py and |Lx - Ly| > 5, or Px > Py;
[0242] 2.9.8 If one of the remaining matched first diplomatic document elements is "Date of Composition" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0243] 2.9.9 If one of the remaining matched first diplomatic document elements is "Date of Issue" and its position is noted as (Py, Ly), then there should be: Px == Py and Lx < Ly, or (Px + 1) <= Py.
[0244] 2.10 If one of the matched first diplomatic document elements is "Date of Issue" and its position is noted as (Px, Lx), and:
[0245] 2.10.1 If one of the remaining matched first diplomatic document elements is "Part Number" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0246] 2.10.2 If one of the remaining matched first diplomatic document elements is "Classification and Security Limitation" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0247] 2.10.3 If one of the remaining matched first diplomatic document elements is "Urgency" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0248] 2.10.4 If one of the remaining matched first diplomatic document elements is "Issuing Authority Mark" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0249] 2.10.5 If one of the remaining matched first diplomatic document elements is "Document Number" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0250] 2.10.6 If one of the remaining matched first diplomatic document elements is "Signatory" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0251] 2.10.7 If one of the remaining matched first diplomatic document elements is "Title" and its position is noted as (Py, Ly), then there should be: Px == Py and |Lx - Ly| > 5, or Px > Py;
[0252] 2.10.8 If the remaining matched one of the first set of document elements is "date of drafting", whose position is recorded as (Py, Ly), then there should be: Px == Py and Lx > Ly;
[0253] 2.10.9 If the remaining matched one of the first set of document elements is "copy to", whose position is recorded as (Py, Ly), then there should be: Px == Py and Lx > Ly.
[0254] In one embodiment, the construction of the set of rules for the confidence quantification of a document element involves the document element grading information that characterizes the importance of the document element, such as
[0255] as shown in Table 4.
[0256]
[0257]
[0258] Table 4 document element grading information that characterizes the importance of the document element
[0259] In one embodiment, the construction of the set of rules for the confidence quantification of a document element involves the document element grading information that characterizes the importance of the document element, such as
[0260] 3.1 First confidence calculation of a document element:
[0261] The initial confidence is the sum of the first confidences of the 4 grades of the document element.
[0262] 3.1.1 Rule for the first confidence calculation of Grade 1:
[0263] 3.1.1.1 If Grade 1 matches to 0 document elements, then the first confidence of Grade 1 is equal to 0.
[0264] 3.1.1.2 If Grade 1 matches to the document element "document number", then the first confidence of Grade 1 is equal to 40.
[0265] 3.1.2 Rule for the first confidence calculation of Grade 2:
[0266] If Grade 1 matches to 0 document elements, then there should be:
[0267] 3.1.2.1 If Grade 2 matches to 0 document elements, then the first confidence of Grade 2 is equal to 0.
[0268] 3.1.2.2 If Grade 2 matches to any one of the two document elements "document issuing organ sign" and "title", then the first confidence of Grade 2 is equal to 30.
[0269] 3.1.2.3 If the position 2 matches all the official document elements in both "Originator's Mark" and "Title", the first confidence degree of position 2 equals to 40 points (i.e. the upgrading processing is performed) ;
[0270] If the position 1 matches the official document element "Document No.", there is:
[0271] 3.1.2.4 If the position 2 matches 0 official document elements, the first confidence degree of position 2 equals to 0 point;
[0272] 3.1.2.5 If the position 2 matches any one of the official document elements in both "Originator's Mark" and "Title", the first confidence degree of position 2 equals to 20 points (i.e. the downgrading processing is performed) ;
[0273] 3.1.2.6 If the position 2 matches all the official document elements in both "Originator's Mark" and "Title", the first confidence degree of position 2 equals to 30 points;
[0274] 3.1.3 The score calculation rule of position 3:
[0275] If the position 1 matches 0 official document elements and the position 2 matches 0 official document elements, there is:
[0276] 3.1.3.1 If the position 3 matches 0 official document elements, the first confidence degree of position 3 equals to 0 point;
[0277] 3.1.3.2 If the position 3 matches any one of the official document elements in "Confidential Level and Secrecy Period", "Date of Composition" and "Date of Issuance", the first confidence degree of position 3 equals to 20 points;
[0278] 3.1.3.3 If the position 3 matches any two of the official document elements in "Confidential Level and Secrecy Period", "Date of Composition" and "Date of Issuance", the first confidence degree of position 3 equals to 30 points (i.e. the upgrading processing is performed) ;
[0279] 3.1.3.4 If the position 3 matches all the official document elements in "Confidential Level and Secrecy Period", "Date of Composition" and "Date of Issuance", the first confidence degree of position 3 equals to 50 points (i.e. the upgrading processing is performed) ;
[0280] If the position 1 matches 0 official document elements and the position 2 matches any one of the official document elements in both "Originator's Mark" and "Title", there is:
[0281] 3.1.3.5 If the position 3 matches 0 official document elements, the first confidence degree of position 3 equals to 0 point;
[0282] 3.1.3.6 If the level 3 matches any one of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 10 points (i.e. downgrading processing is performed);
[0283] 3.1.3.7 If the level 3 matches any two of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 20 points;
[0284] 3.1.3.8 If the level 3 matches all of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 40 points (i.e. upgrading processing is performed);
[0285] If the level 1 matches 0 document elements and the level 2 matches all of the two document elements of "issuing organ sign" and "title", then:
[0286] 3.1.3.9 If the level 3 matches 0 document elements, the first confidence level of level 3 is equal to 0 point;
[0287] 3.1.3.10 If the level 3 matches any one of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 20 points;
[0288] 3.1.3.11 If the level 3 matches any two of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 30 points (i.e. upgrading processing is performed);
[0289] 3.1.3.12 If the level 3 matches all of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 40 points (i.e. upgrading processing is performed);
[0290] If the level 1 matches the document element of "document number" and the level 2 matches 0 document elements, then:
[0291] 3.1.3.13 If the level 3 matches 0 document elements, the first confidence level of level 3 is equal to 0 point;
[0292] 3.1.3.14 If the level 3 matches any one of the three document elements of "secret level and security period", "date of composition" and "date of issue", the first confidence level of level 3 is equal to 10 points (i.e. downgrading processing is performed);
[0293] 3.1.3.15 If the third level 3 matches any two of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 20 points;
[0294] 3.1.3.16 If the third level 3 matches all of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 30 points (i.e. the upgrade processing is performed);
[0295] If the first level 1 matches the document element "document number" and the second level 2 matches any one of the two document elements "issuing organ sign" and "title", then:
[0296] 3.1.3.17 If the third level 3 matches 0 document elements, the first confidence level of the third level 3 is equal to 0 point;
[0297] 3.1.3.18 If the third level 3 matches any one of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 10 points (i.e. the downgrade processing is performed);
[0298] 3.1.3.19 If the third level 3 matches any two of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 20 points;
[0299] 3.1.3.20 If the third level 3 matches all of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 30 points (i.e. the upgrade processing is performed);
[0300] If the first level 1 matches the document element "document number" and the second level 2 matches all of the two document elements "issuing organ sign" and "title", then:
[0301] 3.1.3.21 If the third level 3 matches 0 document elements, the first confidence level of the third level 3 is equal to 0 point;
[0302] 3.1.3.22 If the third level 3 matches any one of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 10 points (i.e. the downgrade processing is performed);
[0303] 3.1.3.23 If the third level 3 matches any two of the three document elements "secret level and security period", "date of composition" and "date of issue", the first confidence level of the third level 3 is equal to 20 points;
[0304] 3.1.3.24 If all the document elements in "confidentiality level and confidentiality period", "date of formulation" and "date of issue" are matched, the first confidence level of gear 3 is equal to 20 points;
[0305] 3.1.4 Gear 4 score calculation rule:
[0306] 3.1.4.1 If the total score of the previous three gears is 0, the first confidence level of gear 4 is equal to the number of document elements matched in "number", "urgency", "issuer" and "copying organ" multiplied by 10 points;
[0307] 3.1.4.2 If the total score of the previous three gears is [20, 50), the first confidence level of gear 4 is equal to the number of document elements matched in "number", "urgency", "issuer" and "copying organ" multiplied by 10 points;
[0308] 3.1.4.3 If the total score of the previous three gears is [50, 70], the first confidence level of gear 4 is equal to the number of document elements matched in "number", "urgency", "issuer" and "copying organ" multiplied by 5 points;
[0309] 3.1.4.4 If the total score of the previous three gears is 80, when any one of the document elements in "number", "urgency", "issuer" and "copying organ" is matched, the first confidence level of gear 4 is equal to 10 points;
[0310] 3.1.4.5 If the total score of the previous three gears is 90, no matter whether "number", "urgency", "issuer" and "copying organ" are matched, the first confidence level of gear 4 is always equal to 0 points (because the full score of the confidence level is 100 points, the remaining 10 points are needed for the confidence level calculation of the document element layout parameter).
[0311] Optionally, after determining the first confidence level of each gear, the first confidence levels of each gear are accumulated to obtain an initial confidence level. The initial confidence level is in [0, 30), and it is determined that the to-be-identified file is a non-document. The initial confidence level is in [30, 50), and it is determined that the to-be-identified file is a suspected document. The initial confidence level is in [50, 70), and it is determined that the to-be-identified file is a non-standard document. The initial confidence level is in [70, 100], and it is determined that the to-be-identified file is a standard document. The standard document meets the paper requirements, layout and printing and binding requirements, and the arrangement rules of each element of the document format commonly used by party and government organs, and meets the style of the document.
[0312] 3.2 Document element layout parameter proximity calculation:
[0313] The document element layout parameter includes four elements of "font size", "font color", "alignment mode" and "position". The total score of the document element layout parameter similarity degree is 10, which is uniformly distributed to the layout parameters corresponding to the 10 reference document elements, that is, the score of each element of the layout parameter is 0.25. The layout parameter similarity degree calculation rule can be referred to Figure 4 .
[0314] In the embodiment of the application, the scalable regular expression pattern matching rule is used to match the document element features, and the generalization ability of the quantifiable and interpretable document judgment algorithm is used, so that the problem of unquantifiable interpretation in the traditional technology is effectively solved, and the accuracy of document recognition is greatly improved.
[0315] It should be understood that, although Figures 1-2 the steps in the flowchart are shown in order according to the arrows, these steps are not necessarily executed in order according to the arrows. Unless otherwise specified in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, Figures 1-2 at least part of the steps in may include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with other steps or steps or stages in other steps.
[0316] Figure 5 In one embodiment, as shown in , a document recognition apparatus is provided, comprising:
[0317] The file acquisition module 302 is configured to acquire a to-be-recognized file.
[0318] The text extraction module 304 is configured to extract text information in the to-be-recognized file.
[0319] The element matching module 306 is configured to match the text information with reference document elements in a reference document element set to obtain a first document element set, wherein the first document element set is composed of first document elements in the text information that are successfully matched with the reference document elements.
[0320] The confidence degree calculation module 308 is configured to calculate a target confidence degree corresponding to the to-be-recognized file according to first confidence degrees corresponding to the first document elements in the first document element set.
[0321] The document judgment module 310 is configured to determine that the to-be-recognized file is a document if the target confidence degree satisfies a document similarity condition.
[0322] The above official document recognition device first determines the first official document elements through matching between the text information in the to-be-recognized document and the reference official document elements, then calculates the target confidence degree corresponding to the to-be-recognized document according to the first confidence degree corresponding to the first official document elements, and determines the to-be-recognized document with a higher confidence degree as an official document. Thus, automatic recognition of official documents can be realized, and the recognition efficiency of official documents can be improved.
[0323] In one embodiment, the confidence degree calculation module 308 is specifically configured to acquire position information of the first official document elements in the to-be-recognized document; determine the position relationship between the first official document elements according to the position information; select target first official document elements from the first official document element set, the position relationship of which satisfies the reference position relationship; and calculate the target confidence degree corresponding to the to-be-recognized document according to the first confidence degree corresponding to the target first official document elements.
[0324] In one embodiment, the confidence degree calculation module 308 is specifically configured to acquire gear information matched with each first official document element in the first official document element set; determine the first confidence degree corresponding to each first official document element according to the gear information matched with each first official document element; acquire the layout parameter corresponding to each first official document element; determine the second confidence degree corresponding to each first official document element according to whether the layout parameter satisfies the preset official document layout condition; and calculate the target confidence degree corresponding to the to-be-recognized document according to the first confidence degree and the second confidence degree.
[0325] In one embodiment, the confidence degree calculation module 308 is specifically configured to calculate the initial confidence degree corresponding to the to-be-recognized document according to the first confidence degree corresponding to each first official document element in the first official document element set; if the initial confidence degree satisfies the initial official document similarity condition, add the initial confidence degree and the second confidence degree to obtain the target confidence degree corresponding to the to-be-recognized document.
[0326] In one embodiment, the confidence degree calculation module 308 is specifically configured to acquire the confidence degree corresponding to the font size if the font size satisfies the preset size condition; acquire the confidence degree corresponding to the font color if the font color satisfies the preset color condition; acquire the confidence degree corresponding to the alignment mode if the alignment mode satisfies the preset alignment condition; acquire the confidence degree corresponding to the line number if the line number satisfies the preset line number condition; and calculate the second confidence degree corresponding to each first official document element according to the confidence degree corresponding to the font size, the confidence degree corresponding to the font color, the confidence degree corresponding to the alignment mode, and the confidence degree corresponding to the line number.
[0327] In one embodiment, the element matching module 306 is specifically configured to acquire the regular expression corresponding to the reference official document element in the reference official document element set; and match the text information with the regular expression to obtain the first official document element set.
[0328] In one embodiment, the method further comprises:
[0329] An element extraction module is configured to extract first official document elements satisfying the official document similarity condition from the to-be-identified document, and send the first official document elements to the upper-layer business system to instruct the upper-layer business system to display the first official document elements satisfying the official document similarity condition.
[0330] The specific limitations of the official document identification device can refer to the limitations of the official document identification method described above, and will not be described here. Each module in the above official document identification device can be realized by software, hardware, and combinations thereof, in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor invokes and executes the operations corresponding to each of the above modules.
[0331] In one embodiment, a computer device is provided, which can be a server, and an internal structure diagram thereof can be as shown in Figure 6 The computer device includes a processor, a memory, and a network interface connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is configured to communicate with an external terminal through a network connection. The computer program is executed by the processor to implement an official document identification method.
[0332] Those skilled in the art can understand that Figure 6 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0333] In one embodiment, a computer device is provided, which includes a memory and a processor, and the memory stores a computer program. The processor implements the following steps when executing the computer program:
[0334] Obtaining a to-be-identified document;
[0335] Extracting text information in the to-be-identified document;
[0336] Matching the text information with reference official document elements in a reference official document element set to obtain a first official document element set, wherein the first official document element set is composed of first official document elements in the text information that are successfully matched with the reference official document elements;
[0337] According to the first confidence degree corresponding to the first document element in the first document element set, a target confidence degree corresponding to the to-be-identified file is calculated;
[0338] If the target confidence degree satisfies the document similarity condition, the to-be-identified file is determined as a document.
[0339] In the computer device, first, the first document elements are determined through the matching between the text information in the to-be-identified file and the reference document elements, then according to the first confidence degrees corresponding to the first document elements, the target confidence degree corresponding to the to-be-identified file is calculated, and the to-be-identified file with higher confidence degree is determined as a document. Thus, the automatic identification of the document can be realized, and the identification efficiency of the document is improved.
[0340] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0341] The position information of the first document elements in the to-be-identified file is obtained, the position relationship between the first document elements is determined according to the position information, the target first document elements with the position relationship satisfying the reference position relationship are selected from the first document element set, and the target confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degrees corresponding to the target first document elements.
[0342] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0343] If there is no target first document element with the position relationship satisfying the reference position relationship in the first document element set, the to-be-identified file is determined as a non-document.
[0344] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0345] The gear information matched with each first document element in the first document element set is obtained, the first confidence degrees corresponding to each first document element are determined according to the gear information matched with each first document element, the typesetting parameters corresponding to each first document element are obtained, the second confidence degrees corresponding to each first document element are determined according to whether the typesetting parameters satisfy the preset document typesetting condition, and the target confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degrees and the second confidence degrees.
[0346] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0347] According to the first confidence degrees corresponding to each first document element in the first document element set, an initial confidence degree corresponding to the to-be-identified file is calculated, if the initial confidence degree satisfies the initial document similarity condition, the initial confidence degree and the second confidence degree are added to obtain the target confidence degree corresponding to the to-be-identified file.
[0348] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0349] If the font size meets the preset size condition, a confidence degree corresponding to the font size is obtained; if the font color meets the preset color condition, a confidence degree corresponding to the font color is obtained; if the alignment mode meets the preset alignment condition, a confidence degree corresponding to the alignment mode is obtained; if the line number meets the preset line number condition, a confidence degree corresponding to the line number is obtained; and the second confidence degrees corresponding to the respective first official document elements are calculated according to the confidence degree corresponding to the font size, the confidence degree corresponding to the font color, the confidence degree corresponding to the alignment mode, and the confidence degree corresponding to the line number.
[0350] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0351] If the initial confidence degree does not meet the initial official document similarity condition, the to-be-identified file is determined to be a non-official document.
[0352] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0353] The regular expression corresponding to the reference official document element in the set of reference official document elements is obtained; and the text information is matched with the regular expression to obtain the set of first official document elements.
[0354] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0355] From the to-be-identified file, the first official document elements meeting the official document similarity condition are extracted and sent to the upper-layer business system to instruct the upper-layer business system to display the first official document elements meeting the official document similarity condition.
[0356] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0357] The to-be-identified file is obtained.
[0358] The text information in the to-be-identified file is extracted.
[0359] The text information is matched with the reference official document elements in the set of reference official document elements to obtain the set of first official document elements, wherein the set of first official document elements is composed of the first official document elements in the text information that are successfully matched with the reference official document elements;
[0360] The target confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degrees corresponding to the first official document elements in the set of first official document elements.
[0361] If the target confidence degree meets the official document similarity condition, the to-be-identified file is determined to be an official document.
[0362] In the computer readable storage medium, a first official document element is determined by matching the text information in the to-be-identified file with the reference official document element, and then a target confidence degree corresponding to the to-be-identified file is calculated according to a first confidence degree corresponding to the first official document element, and the to-be-identified file with a higher confidence degree is determined as an official document. Thus, automatic identification of the official document can be realized, and the identification efficiency of the official document is improved.
[0363] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0364] The position information of the first official document element in the to-be-identified file is obtained, the position relationship between the first official document elements is determined according to the position information, the target first official document element with the position relationship satisfying the reference position relationship is selected from the first official document element set, and the target confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degree corresponding to the target first official document element.
[0365] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0366] If there is no target first official document element with the position relationship satisfying the reference position relationship in the first official document element set, the to-be-identified file is determined as a non-official document.
[0367] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0368] The gear information matched with each first official document element in the first official document element set is obtained, the first confidence degree corresponding to each first official document element is determined according to the gear information matched with each first official document element, the layout parameter corresponding to each first official document element is obtained, the second confidence degree corresponding to each first official document element is determined according to whether the layout parameter satisfies the preset official document layout condition, and the target confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degree and the second confidence degree.
[0369] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0370] The initial confidence degree corresponding to the to-be-identified file is calculated according to the first confidence degree corresponding to each first official document element in the first official document element set, and if the initial confidence degree satisfies the initial official document similarity condition, the target confidence degree corresponding to the to-be-identified file is obtained by adding the initial confidence degree and the second confidence degree.
[0371] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0372] If the font size meets the preset size condition, a confidence degree corresponding to the font size is obtained; if the font color meets the preset color condition, a confidence degree corresponding to the font color is obtained; if the alignment mode meets the preset alignment condition, a confidence degree corresponding to the alignment mode is obtained; if the line number meets the preset line number condition, a confidence degree corresponding to the line number is obtained; and the second confidence degrees corresponding to the respective first official document elements are calculated according to the confidence degree corresponding to the font size, the confidence degree corresponding to the font color, the confidence degree corresponding to the alignment mode, and the confidence degree corresponding to the line number.
[0373] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0374] If the initial confidence degree does not meet the initial official document similarity condition, it is determined that the file to be recognized is not an official document.
[0375] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0376] A regular expression corresponding to the reference official document element in the set of reference official document elements is obtained; and the text information is matched with the regular expression to obtain the set of first official document elements.
[0377] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0378] From the file to be recognized, the first official document element meeting the official document similarity condition is extracted and sent to the upper-layer business system to instruct the upper-layer business system to display the first official document element meeting the official document similarity condition.
[0379] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium and can include the processes of the above-mentioned embodiments when executed. Any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include at least one of a non-volatile and volatile memory. The non-volatile memory can include a read-only memory (ROM), a magnetic tape, a floppy disk, a flash memory, or an optical storage, etc. The volatile memory can include a random access memory (RAM) or an external cache memory. As an illustration but not limitation, the RAM can be in various forms such as a static random access memory (SRAM) or a dynamic random access memory (DRAM), etc.
[0380] Any combination of the technical features in the above embodiments can be made. For the sake of brevity, not all possible combinations are described, however, it should be understood that the scope of protection includes all possible combinations.
[0381] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that, for ordinary skilled persons in the art, without departing from the concept of the present application, a number of modifications and improvements can be made, which are all within the scope of protection of the present application. Therefore, the scope of protection of the patent of the present application should be subject to the appended claims.
Claims
1. A method of identifying a document, characterized by, The method comprises: acquiring a to-be-identified file; extracting text information in the to-be-identified file; matching the text information with reference official document elements in a set of reference official document elements to obtain a first set of official document elements, wherein the first set of official document elements is composed of first official document elements in the text information that are successfully matched with the reference official document elements; calculating a target confidence degree corresponding to the to-be-identified file according to first confidence degrees corresponding to the first official document elements in the first set of official document elements; if the target confidence degree satisfies an official document similarity condition, determining that the to-be-identified file is an official document; the calculation of the target confidence degree corresponding to the to-be-identified file according to the first confidence degrees and the second confidence degrees comprises: acquiring gear information matched with each first official document element in the first set of official document elements; determining first confidence degrees corresponding to the first official document elements according to the gear information matched with the first official document elements; acquiring layout parameters corresponding to each first official document element; determining second confidence degrees corresponding to the first official document elements according to whether the layout parameters satisfy a preset official document layout condition; and calculating the target confidence degree corresponding to the to-be-identified file according to the first confidence degrees and the second confidence degrees.
2. The method according to claim 1, characterized in that The first official document elements include a serial number, a classified level and a confidential period, an urgency degree, a document-issuing organ sign, a document-issuing number, a signer, a title, a document composition date, a document-issuing organ, and a document-issuing date; and the position information includes a page number and a line number. The page number corresponding to the serial number = the page number corresponding to the classified level and the confidential period = the page number corresponding to the urgency degree = the page number corresponding to the document-issuing organ sign = the page number corresponding to the document-issuing number = the page number corresponding to the signer = the page number corresponding to the title, and the line number corresponding to the serial number < the line number corresponding to the classified level and the confidential period < the line number corresponding to the urgency degree < the line number corresponding to the document-issuing organ sign < the line number corresponding to the document-issuing number < the line number corresponding to the signer < the line number corresponding to the title. The page number corresponding to the title = the page number corresponding to the document composition date = the page number corresponding to the document-issuing organ = the page number corresponding to the document-issuing date, and the line number corresponding to the title < the line number corresponding to the document composition date < the line number corresponding to the document-issuing organ < the line number corresponding to the document-issuing date. Alternatively, The page number corresponding to the title < the page number corresponding to the document composition date = the page number corresponding to the document-issuing organ = the page number corresponding to the document-issuing date, and the line number corresponding to the document composition date < the line number corresponding to the document-issuing organ < the line number corresponding to the document-issuing date.
3. The method of claim 1, wherein, The calculation of the target confidence degree corresponding to the to-be-identified file according to the first confidence degrees and the second confidence degrees comprises: calculating an initial confidence degree corresponding to the to-be-identified file according to the first confidence degrees corresponding to each first official document element in the first set of official document elements; if the initial confidence degree satisfies an initial official document similarity condition, adding the initial confidence degree and the second confidence degree to obtain the target confidence degree corresponding to the to-be-identified file.
4. The method according to claim 1 or 3, characterized in that, The layout parameters comprise font size, font color, alignment mode and line number, and the second confidence degrees corresponding to the first official document elements are determined according to whether the layout parameters meet preset official document layout conditions. If the font size meets preset size conditions, a confidence degree corresponding to the font size is obtained. If the font color meets preset color conditions, a confidence degree corresponding to the font color is obtained. If the alignment mode meets preset alignment conditions, a confidence degree corresponding to the alignment mode is obtained. If the line number meets preset line number conditions, a confidence degree corresponding to the line number is obtained. The second confidence degrees corresponding to the first official document elements are calculated according to the confidence degree corresponding to the font size, the confidence degree corresponding to the font color, the confidence degree corresponding to the alignment mode and the confidence degree corresponding to the line number.
5. The method of claim 3, wherein, The method further comprises: If the initial confidence degree does not meet initial official document similarity conditions, the file to be identified is determined as a non-official document.
6. The method of claim 1, wherein, The text information is matched with reference official document elements in a reference official document element set to obtain a first official document element set, comprising: A regular expression corresponding to the reference official document elements in the reference official document element set is obtained. The text information is matched with the regular expression to obtain the first official document element set.
7. The method of claim 1, wherein, After the target confidence degree meets official document similarity conditions, the method further comprises: First official document elements meeting official document similarity conditions are extracted from the file to be identified and sent to an upper-layer business system to instruct the upper-layer business system to display the first official document elements meeting official document similarity conditions.
8. A document identification apparatus, characterized by comprising: The apparatus comprises: A file acquisition module is configured to acquire a file to be identified. A text extraction module is configured to extract text information in the file to be identified. An element matching module is configured to match the text information with reference official document elements in a reference official document element set to obtain a first official document element set, wherein the first official document element set is composed of first official document elements in the text information that are successfully matched with the reference official document elements. A confidence degree calculation module is configured to calculate a target confidence degree corresponding to the file to be identified according to first confidence degrees corresponding to first official document elements in the first official document element set. An official document determination module is configured to determine the file to be identified as an official document if the target confidence degree meets official document similarity conditions. The confidence degree calculation module is specifically configured to obtain gear information matched with each first official document element in the first official document element set, determine first confidence degrees corresponding to the first official document elements according to the gear information matched with the first official document elements, obtain layout parameters corresponding to the first official document elements, determine second confidence degrees corresponding to the first official document elements according to whether the layout parameters meet preset official document layout conditions, and calculate the target confidence degree corresponding to the file to be identified according to the first confidence degrees and the second confidence degrees. 9.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-8 when the computer program is executed by the processor. The processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program. The processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, which is executed by a processor, implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Official document judgment method and judgment system based on named entities
CN111626057A
Official document text recognition method and device based on feature association
CN112507968A