Document processing method, device and equipment
By identifying and calculating the correlation of text features of documents to be stamped, the document category is automatically determined and stamped, which solves the problem of low stamping efficiency of electronic documents, realizes automated stamping, and improves stamping efficiency and accuracy.
Patent Information
- Application Number
- CN202410811996.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-17
AI Technical Summary
In the process of stamping electronic documents, when there are many documents to be stamped, it is necessary to manually specify the stamp position and electronic seal category, resulting in low stamping efficiency.
By identifying and extracting the title text features and body text features of the document to be stamped, calculating its correlation under each document category, automatically determining the document category, and stamping according to the preset stamping position and electronic seal category, realizing automated stamping .
It improves the efficiency of printing electronic documents, reduces manual intervention, and improves the flexibility and accuracy of printing.
Smart Images

Figure CN118657138A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a document processing method, device and equipment. Background Art
[0002] As the traditional office model gradually changes to the information-based office model, the circulation form of paper documents has also begun to change to the circulation form of electronic documents. In order to ensure the validity of electronic documents and give them the same visual credibility as traditional paper documents, the concept of electronic seals has emerged. Electronic seals use digital signature technology to achieve the non-tamperability of documents and the non-copyability of seal impressions, thereby improving the security of documents.
[0003] When using an electronic seal to stamp an electronic document, the person using the seal usually needs to specify the location in the electronic document that needs to be stamped and the type of electronic seal. The stamping device then completes the stamping of the electronic document based on the seal user's instructions. When there are a large number of electronic documents to be stamped, the seal user also needs to spend a lot of time indicating the location to stamp. It can be seen that the current efficiency of stamping electronic documents is low. Summary of the invention
[0004] The present application provides a document processing method, device and equipment for improving the stamping efficiency of electronic documents.
[0005] In a first aspect, an embodiment of the present application provides a document processing method, comprising: identifying and extracting title text features and body text features of a document to be printed; determining a first relevance of the title text features under each document category, and determining a second relevance of the body text features under each document category; determining the document category of the document to be printed based on the first relevance and the second relevance; determining at least one printing position in the document to be printed and the electronic seal category of each printing position based on the document category of the document to be printed, and stamping the document to be printed.
[0006] In an embodiment of the present application, by identifying the title text features and the main text features in the document to be printed, the first relevance of the title text features in each document category and the second relevance of the main text features in each document category are calculated respectively, and the total relevance of the document to be printed in each document category is calculated based on the first relevance and the second relevance, and the document category to be printed is determined according to the total relevance, and then based on at least one pre-set printing position under the document category and the electronic seal category of each printing position, automatic printing is realized without manual specification of printing information, thereby realizing automatic printing of electronic documents and improving the printing efficiency of electronic documents.
[0007] In a possible implementation, determining the first relevance of the title text feature in each document category includes: performing word segmentation processing on the title text feature according to a pre-stored corpus to obtain at least one first keyword; determining the first word frequency of the at least one first keyword in each document category, and the first inverse document word frequency of the at least one first keyword in each document category; determining the relevance of the at least one first keyword to each document category according to the first word frequency under each document category and the first inverse document word frequency under each document category; determining the first relevance of the title text feature in each document category according to the relevance of the at least one first keyword to each document category.
[0008] In this embodiment, when determining the first relevance, both the number of times each keyword appears in each document category and the frequency of each keyword not appearing in the document category are considered. Compared with the method of directly determining the document category based on the word frequency of the keyword, the method described in the embodiment of the present application is more accurate.
[0009] In a possible implementation, determining the second relevance of the main text feature in each document category includes: performing word segmentation processing on the main text feature according to a pre-stored corpus to obtain a plurality of second keywords; determining the second word frequencies of the plurality of second keywords in each document category, and the second inverse document word frequencies of the plurality of second keywords in each document category; determining the relevance of the plurality of second keywords to each document category according to the second word frequencies under each document category and the second inverse document word frequencies under each document category; determining the second relevance of the main text feature in each document category according to the relevance of the plurality of second keywords to each document category.
[0010] In a possible implementation, the second relevance of the main text feature in each document category is determined based on the relevance of the multiple second keywords to each document category, including: based on a preset threshold and the relevance of the multiple second keywords to each document category, determining a keyword with a relevance greater than the preset threshold from the multiple second keywords as a target keyword; and determining the second relevance of the main text feature in each document category based on the relevance of the target keyword to each document category.
[0011] In this embodiment, since the main text includes many keywords, and the relevance of some keywords in some document categories is low, these keywords have little effect on the document category of the document to be printed. Therefore, these keywords are eliminated when calculating the main text features, thereby reducing the number of keywords used to calculate the second relevance, which is beneficial to improving calculation efficiency.
[0012] In a possible implementation, the document category of the document to be printed is determined based on the first relevance and the second relevance, including: determining the document category of the document to be printed based on a first weight corresponding to the title text feature and the first relevance, and a second weight corresponding to the body text feature and the second relevance.
[0013] In this embodiment, the influence of the title text features and the body text features on the document category of the document to be printed is taken into consideration, and the influence can be represented as a weight value. Therefore, based on the first weight and the second weight, the first correlation and the second correlation, the document category of the document to be printed is determined more accurately.
[0014] In a possible implementation, the document category of the document to be printed is determined based on the first relevance and the second relevance, including: determining the total relevance of the document to be printed under each document category based on the first relevance and the second relevance; and determining the document category with the highest total relevance under each document category as the document category of the document to be printed.
[0015] In a possible implementation, the method further includes: identifying and extracting text feature information of each sample document in a sample document set, the sample document set including printed history documents of various document categories, the text feature information including title text features and body text features; determining a third relevance of the title text features of each sample document under each document category, and a fourth relevance of the body text features of each sample document under each document category; determining the first weight and the second weight based on the third relevance of the title text features of each sample document under each document category, the fourth relevance of the body text features of each sample document under each document category, and the document category of each sample document, in combination with a preset fitting algorithm.
[0016] In this embodiment, the first weight of the title text feature and the second weight of the body text feature are obtained by fitting and calculating the correlation of the title text features and the body text features of the historical printed documents under each document category, so that the first weight and the second weight have high reference value, which is beneficial to improving the accuracy of determining the document category of the document to be printed.
[0017] In a second aspect, an embodiment of the present application provides a document processing device, comprising: an extraction module, used to identify and extract title text features and body text features of a document to be printed; a determination module, used to determine a first relevance of the title text features under each document category, and to determine a second relevance of the body text features under each document category; the determination module is also used to determine the document category of the document to be printed based on the first relevance and the second relevance; a printing module, used to determine at least one printing position in the document to be printed and the electronic seal category of each printing position based on the document category of the document to be printed, and to stamp the document to be printed.
[0018] In a possible implementation, the determination module is specifically used to: perform word segmentation processing on the title text feature according to a pre-stored corpus to obtain at least one first keyword; determine the first word frequency of the at least one first keyword under each document category, and the first inverse document word frequency of the at least one first keyword under each document category; determine the relevance of the at least one first keyword to each document category according to the first word frequency under each document category and the first inverse document frequency under each document category; determine the first relevance of the title text feature under each document category according to the relevance of the at least one first keyword to each document category.
[0019] In a possible implementation, the determination module is specifically used to: perform word segmentation processing on the main text feature according to a pre-stored corpus to obtain multiple second keywords; determine the second word frequency of the multiple second keywords under each document category, and the second inverse document word frequency of the multiple second keywords under each document category; determine the relevance of the multiple second keywords to each document category according to the second word frequency under each document category and the second inverse document frequency under each document category; determine the second relevance of the main text feature under each document category according to the relevance of the multiple second keywords to each document category.
[0020] In a possible implementation, the determination module is specifically used to: determine a keyword with a relevance greater than the preset threshold from the multiple second keywords as a target keyword based on a preset threshold and the relevance of the multiple second keywords to each document category; and determine the second relevance of the main text feature under each document category based on the relevance of the target keyword to each document category.
[0021] In a possible implementation, the determination module is specifically used to determine the document category of the document to be printed based on the first weight and the first relevance corresponding to the title text feature, and the second weight and the second relevance corresponding to the body text feature.
[0022] In a possible implementation, the determination module is specifically used to: determine the total relevance of the document to be printed under each document category based on the first relevance and the second relevance; and determine the document category with the highest total relevance under each document category as the document category of the document to be printed.
[0023] In a possible implementation, the extraction module is further used to identify and extract text feature information of each sample document in a sample document set, the sample document set including printed history documents of various document categories, and the text feature information including title text features and body text features; the determination module is further used to determine the third relevance of the title text features of each sample document under each document category, and the fourth relevance of the body text features of each sample document under each document category; and determine the first weight and the second weight based on the third relevance of the title text features of each sample document under each document category, the fourth relevance of the body text features of each sample document under each document category, and the document category of each sample document, in combination with a preset fitting algorithm.
[0024] In a third aspect, an embodiment of the present application provides a document processing device, comprising: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the method described in the first aspect and any possible implementation manner above by executing the instructions stored in the memory.
[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect and any possible implementation manner above.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enables the method described in the first aspect and any possible implementation manner as described above to be implemented.
[0027] Regarding the beneficial effects of the second to fifth aspects, reference can be made to the contents described in the first aspect above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of an application scenario of a document processing method provided in an embodiment of the present application;
[0029] Figure 2 A flowchart of a document processing method provided in an embodiment of the present application;
[0030] Figure 3 A schematic diagram of the structure of a document processing device provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of the structure of a document processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0033] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.
[0034] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0035] In the technical solution of this application, the acquisition, transmission, storage, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0036] At present, the automatic use of seals for electronic documents is realized by setting the correspondence between the document template and the seal information. The document template is set with the seal location and seal type. However, in actual applications, when the document to be used for printing is matched with the document template, it is usually matched according to the layout of the document template, but the document to be used for printing is not all standard documents to be used for printing that match the document template, and there are also some non-standard documents. For example, in the financial field, financial institutions usually need to connect with multiple customers, and each customer has different information required. Therefore, when providing corresponding information to each customer, it is necessary to extract the information required by this customer from the standard document and regenerate a document to be used for printing. The layout of the regenerated document to be used for printing is usually different from the layout and format of the standard document. As a result, this type of non-standard document cannot be matched with the document template, and thus cannot be automatically used for printing. The staff needs to manually indicate the seal location and electronic seal type, and the efficiency of printing is low.
[0037] In view of this, an embodiment of the present application provides a document processing method, in which the title text features and the body text features of the document to be printed are extracted, and the first relevance of the title text features to each document category and the second relevance of the body text features to each document category are respectively calculated. Based on the first relevance and the second relevance, the total relevance of the document to be printed to each document category is determined, and then based on the total relevance of the document to be printed to each document category, the document category of the document to be printed can be determined, so that based on at least one pre-configured printing position in the document category and the electronic seal category of each printing position, automatic stamping of the document to be printed is achieved, which solves the technical problem in the prior art that non-standard documents cannot be automatically stamped due to the mismatch between non-standard documents and document templates, and is conducive to improving the printing efficiency of non-standard documents.
[0038] In order to better understand the technical solution provided by the embodiments of the present application, Figure 1 A brief description of the application scenarios to which the embodiments of the present application are applicable is provided.
[0039] Please refer to Figure 1 , is a schematic diagram of an application scenario of a document processing method provided in an embodiment of the present application. Figure 1 As shown, the scenario diagram includes a device 110 and a document processing apparatus 120 , and wired or wireless communication can be performed between the device 110 and the document processing apparatus 120 .
[0040] The device 110 may refer to a device with functions such as electronic document storage, sending, receiving, and generation. The device may be, for example, a terminal device or a server. The terminal device includes but is not limited to a mobile phone, a personal computer (PC), a tablet computer, a laptop computer, a PDA, and a mobile internet device (MID). The document processing device 120 refers to a device or module with data processing capabilities and electronic seal stamping functions. When the document processing device 120 is a module, the document processing device 120 may specifically be a functional module on the device 110 or in other devices, and the embodiments of the present application do not limit this.
[0041] Exemplarily, the document processing device 120 may receive the document to be printed from the device 110, extract the title text features and the body text features in the document to be printed, determine the document category of the document to be printed based on the title text features and the body text features, and then stamp the document to be printed according to the document category of the document to be printed. The specific implementation method of the document processing device 120 determining the document category of the document to be printed and stamping the document to be printed according to the document category of the document to be printed will be described in detail below.
[0042] Please refer to Figure 2 , is a flowchart of a document processing method provided in an embodiment of the present application. The following is a flowchart of a document processing device executing Figure 2 The document processing device is, for example, Figure 1 The document processing device 120 is shown.
[0043] S201, identifying and extracting the title text features and body text features of the document to be printed.
[0044] The document to be printed can be an electronic document in various formats, such as doc, docx, pdf, ofd, etc. The title text feature refers to the text content from the title part of the document to be printed. In particular, when the document to be printed is an untitled document, the text content of the beginning part of the document to be printed is used as the title part. The beginning part can specifically refer to the text content of the first line or the second line of the document to be printed. The body text feature refers to the text content of the main part (body part) of the document to be printed. In the embodiment of the present application, the body part can refer to the text content of the document to be printed except the title part.
[0045] After receiving the document to be printed, the document processing device can identify the document to be printed in combination with the pre-configured position information of the title part and the position information of the text part, and extract the title text features and the text features of the text.
[0046] S202, determining a first relevance of a title text feature in each document category, and determining a second relevance of a body text feature in each document category.
[0047] The document category is pre-configured in the document processing device, and the number of document categories is multiple. The first relevance under each document category is used to indicate the degree of association or similarity between the title text feature and each document category. The second relevance under each document category is used to indicate the degree of association or similarity between the body text feature and each document category.
[0048] The following is a detailed description of the manner in which the document processing apparatus determines the first relevance of the title text feature under each document category.
[0049] The document processing device performs word segmentation processing on the title text features according to a pre-stored corpus to obtain at least one first keyword, wherein the corpus stores keywords corresponding to various document categories.
[0050] The document processing device may determine the first word frequency of the at least one first keyword in each document category, and the first inverse document word frequency of the at least one first keyword in each document category. The following takes a first keyword as an example to illustrate the manner in which the document processing device determines the first word frequency and the first inverse document word frequency of the first keyword in each document category.
[0051] The document processing device counts the number of times the first keyword appears in each document category and the total number of keywords in each document category, and determines the first word frequency of the first keyword in each document category according to the number of times the first keyword appears in each document category and the total number of keywords in each document category. Exemplarily, a calculation formula for determining the first word frequency of the first keyword in each document category is as follows.
[0052] First word frequency = the number of times the first keyword appears in each document category / the total number of keywords in each document category
[0053] For example, the first keyword appears 5 times in document category A, and the total number of keywords in document category A is 100, then the first word frequency = 5 / 100 = 0.05.
[0054] The document processing device counts the number of document categories in which the first keyword does not appear in all document categories, and the total number of all document categories, and determines the first inverse document frequency of the first keyword in each document category according to the number of document categories in which the first keyword does not appear and the total number of all document categories. Exemplarily, a calculation formula for determining the first inverse document frequency of the first keyword in each document category is as follows.
[0055] First inverse document word frequency = the number of document categories where the first keyword does not appear / the total number of all document categories
[0056] For example, there are 15 document categories pre-configured in the document processing device, and the first keyword does not appear in 5 document categories, then the first inverse document word frequency = 5 / 15≈0.33.
[0057] It should be understood that the manner in which the document processing device determines the first term frequency and the first inverse document term frequency of each first keyword in each document category is the same, and can refer to the manner in which the document processing device determines the first term frequency and the first inverse document term frequency of a first keyword in each document category, which will not be repeated here.
[0058] Based on the above method, the document processing device can determine the first word frequency of at least one first keyword in each document category, and the first inverse document word frequency of at least one first keyword in each document category. Then, the relevance of at least one first keyword to each document category can be determined based on the first word frequency in each document category and the first inverse document word frequency in each document category. The specific method for the document processing device to determine the relevance of a first keyword to each document category is described below.
[0059] The document processing device may determine the relevance of the first keyword in each document category based on the first word frequency of the first keyword in each document category and the first inverse document word frequency in each document category. Exemplarily, the document processing device may use the product of the first word frequency and the first inverse document word frequency as the relevance of the first keyword in each document category.
[0060] Taking the case where the number of at least one first keyword is one, the relevance of the first keyword in each document category can be expressed as [x1 x2 x3…xn], where x1 can represent the relevance of the first keyword in document category 1, x2 can represent the relevance of the first keyword in document category 2, and so on. If the number of at least one first keyword is multiple, the relevance of the at least one first keyword in each document category can be represented by a matrix. Taking the case where the number of at least one first keyword is M and there are N document categories, the relevance of the at least one first keyword in each document category is an M*N matrix, which can also represent a probability distribution of the M first keywords to the N document categories.
[0061] The document processing device may determine the relevance of at least one first keyword to each document category as the first relevance of the title text feature in each document category. Specifically, the document processing device may determine the sum of the relevances of at least one first keyword to each document category as the first relevance of the title text feature in each document category.
[0062] For example, taking at least one first keyword as keyword 1 and keyword 2, the relevance of keyword 1 in category A documents is 0.01, and the relevance of keyword 2 in category A documents is 0.3, then the first relevance of the title text feature in category A documents is 0.3+0.01=0.31.
[0063] The following is a detailed description of the manner in which the document processing apparatus determines the second relevance of the main text feature under each document category.
[0064] The document processing device can perform word segmentation processing on the main text features according to the pre-stored corpus to obtain multiple second keywords, and determine the second word frequencies of the multiple second keywords under each document category, as well as the second inverse document word frequencies of the multiple second keywords under each document category. Furthermore, the document processing device can determine the relevance of the multiple second keywords to each document category according to the second word frequencies under each document category and the second inverse document word frequencies under each document category, thereby determining the second relevance of the main text features under each document category.
[0065] The specific content of the corpus can refer to the content described above. The document processing device can determine the second word frequency, the second inverse document word frequency and the second relevance by referring to the first word frequency, the first inverse document word frequency and the first relevance, which will not be repeated here.
[0066] In a possible implementation, after determining the relevance of multiple second keywords to each document category, the document processing device may determine a keyword with a relevance greater than the preset threshold from the multiple second keywords as a target keyword based on the preset threshold and the relevance of the multiple second keywords to each document category, and determine the second relevance of the body text feature under each document category based on the relevance of the target keyword to each document category. The preset threshold may be pre-configured in the document processing device, and the preset threshold may be set according to actual needs, for example, the preset threshold may be 0 or 0.00001, which is not limited in the embodiments of the present application.
[0067] Since the main text contains a lot of content, the number of second keywords obtained after the main text is segmented is also large, so multiple second keywords can be filtered to reduce the amount of calculation. At the same time, it can also avoid unnecessary second keywords affecting the classification results of the documents to be printed.
[0068] S203: Determine the document category of the document to be printed according to the first relevance and the second relevance.
[0069] Specifically, the document processing device can determine the sum of the first relevance of the title text feature in each document category and the second relevance of the body text feature in each document category as the total relevance of the document to be printed in each document category, and determine the document category with the highest total relevance in each document category as the document category of the document to be printed.
[0070] For example, the document categories include A, B, and C. The total relevance of the document to be printed under category A is 0.53, the total relevance of the document to be printed under category B is 0.34, and the total relevance of the document to be printed under category C is 0.94. The document processing device determines the document category of the document to be printed as category C.
[0071] In a possible implementation, the document processing device is also pre-configured with a first weight corresponding to the title text feature and a second weight corresponding to the body text feature. The first weight can be understood as the degree of influence of the title text feature on the document category of the document to be printed, and the second weight can be understood as the degree of influence of the body text feature on the document category of the document to be printed. Therefore, the document processing device can also determine the total relevance of the document to be printed in each document category based on the first weight and the first correlation, the second weight and the second correlation, so as to determine the document category of the document to be printed. Specifically, the document processing device can determine a first product result of the first weight and the first correlation, a second product result of the second weight and the second correlation, and determine the sum of the first product result and the second product result as the total correlation.
[0072] The first weight and the second weight may be set by a staff member based on work experience, or may be obtained by calculation. The following describes a method for calculating the first weight and the second weight.
[0073] The document processing device can determine the first weight of the title text feature and the second weight of the body text feature according to the text feature information of each sample document in the sample document set and the document category of each sample document. The sample document set includes the used printed history documents of each document category, and the text feature information includes the title text feature and the body text feature.
[0074] Specifically, the document processing device can identify and extract text feature information of each sample document in the sample document set, and determine the third relevance of the title text feature of each sample document under each document category, and the fourth relevance of the body text feature of each sample document under each document category. The specific manner in which the document processing device determines the third relevance and the fourth relevance can correspond to the content of determining the first relevance in the previous text, and will not be repeated here.
[0075] Then, the document processing device can determine the first weight and the second weight according to the third relevance of the title text feature of each sample document under each document category, the fourth relevance of the body text feature of each sample document under each document category, and the document category of each sample document, in combination with a preset fitting algorithm. The document processing device can be pre-configured with a value range of the first weight and the second weight, and during the fitting process, the first weight and the second weight always meet the value range.
[0076] Exemplarily, taking the first weight as a, the second weight as b, the third correlation of the title text feature of each sample document as D1, the fourth correlation of the body text feature as D2, a, b∈(0,1) as an example, the method of fitting the first weight and the second weight by the document processing device is illustrated.
[0077] Set a=0.00001, b=0.00001 as the first fitting, the total relevance of each sample document Y=a*D1+b*D2, determine the document category of each sample document based on Y, and compare whether the document category determined based on Y matches the actual document category of each sample document. Further, the document processing device calculates the loss function=the number of sample documents that failed to match / the total number of sample documents, and obtains the unmatched rate K. The total number of sample documents refers to the number of sample documents participating in this fitting.
[0078] a and b are incremented with a step size of 0.000001, all possibilities of a and b in (0, 1) are traversed, and the K value is calculated again. The fitting is continued until a=0.999999 and b=0.999999, and multiple new mismatch rates K are obtained.
[0079] The document processing device takes the values a and b of the case where the non-matching rate K value is the smallest from among the multiple non-matching rates as weight values.
[0080] It should be noted that the first weight and the second weight can also be calculated by machine learning algorithms, deep learning algorithms and other methods, which are not listed here one by one.
[0081] S204, determining at least one seal position in the document to be stamped and the electronic seal type of each seal position according to the document type of the document to be stamped, and stamping the document to be stamped.
[0082] In each of the multiple document categories configured by the document processing device, at least one seal position corresponding to each document category and the electronic seal category required for each seal position are stored.
[0083] Therefore, after determining the document category of the document to be stamped, the document processing device can determine at least one stamping position in the document to be stamped and the electronic seal category of each stamping position according to the document category of the document to be stamped, and stamp the document to be stamped. The specific implementation method of the document processing device stamping the document to be stamped can correspond to the stamping method in the prior art, and the embodiment of the present application does not limit this.
[0084] Through the above method, the documents to be printed are classified by title text features and body text features, which solves the technical problem in the prior art that the document format of non-standard documents does not match the document template, resulting in the inability to automatically print non-standard documents, and improves the flexibility of automatic printing of electronic documents. At the same time, under the method described in the embodiment of the present application, the problem of completing the printing of non-standard documents with manual assistance is solved, and the efficiency of automatic printing of electronic documents is improved.
[0085] Based on the same inventive concept, an embodiment of the present application provides a document processing device, which is used to implement any of the above document processing methods, for example Figure 2 The document processing method shown, and the device can also realize the functions of the document processing device mentioned above.
[0086] Please refer to Figure 3 , is a schematic diagram of the structure of a document processing device provided in an embodiment of the present application. Figure 3 As shown, the document processing device 300 includes an extraction module 301, a determination module 302 and a printing module 303.
[0087] Exemplarily, the extraction module 301 is used to identify and extract the title text features and the body text features of the document to be printed; the determination module 302 is used to determine the first relevance of the title text features under each document category, and to determine the second relevance of the body text features under each document category; the determination module 302 is also used to determine the document category of the document to be printed based on the first relevance and the second relevance; the printing module 303 is used to determine at least one printing position in the document to be printed and the electronic seal category of each printing position based on the document category of the document to be printed, and to stamp the document to be printed.
[0088] In a possible implementation, the determination module 302 is specifically used to: perform word segmentation processing on the title text feature according to a pre-stored corpus to obtain at least one first keyword; determine the first word frequency of at least one first keyword in each document category, and the first inverse document word frequency of at least one first keyword in each document category; determine the relevance of at least one first keyword to each document category according to the first word frequency under each document category and the first inverse document frequency under each document category; determine the first relevance of the title text feature in each document category according to the relevance of at least one first keyword to each document category.
[0089] In a possible implementation, the determination module 302 is specifically used to: perform word segmentation processing on the main text features according to a pre-stored corpus to obtain multiple second keywords; determine the second word frequencies of the multiple second keywords in each document category, and the second inverse document word frequencies of the multiple second keywords in each document category; determine the relevance of the multiple second keywords to each document category according to the second word frequencies under each document category and the second inverse document frequency under each document category; determine the second relevance of the main text features in each document category according to the relevance of the multiple second keywords to each document category.
[0090] In a possible implementation, the determination module 302 is specifically used to: determine a keyword with a relevance greater than a preset threshold from multiple second keywords as a target keyword based on a preset threshold and the relevance of multiple second keywords to each document category; determine the second relevance of the main text feature in each document category based on the relevance of the target keyword to each document category.
[0091] In a possible implementation, the determination module 302 is specifically used to determine the document category of the document to be printed based on a first weight and a first relevance corresponding to the title text feature, and a second weight and a second relevance corresponding to the body text feature.
[0092] In a possible implementation, the determination module 302 is specifically used to: determine the total relevance of the document to be printed in each document category based on the first relevance and the second relevance; and determine the document category with the highest total relevance in each document category as the document category of the document to be printed.
[0093] In a possible implementation, the extraction module 301 is further used to identify and extract text feature information of each sample document in the sample document set, the sample document set includes printed history documents of various document categories, and the text feature information includes title text features and body text features; the determination module 302 is further used to determine the third relevance of the title text features of each sample document under each document category, and the fourth relevance of the body text features of each sample document under each document category; and determine the first weight and the second weight based on the third relevance of the title text features of each sample document under each document category, the fourth relevance of the body text features of each sample document under each document category, and the document category of each sample document, in combination with a preset fitting algorithm.
[0094] Based on the same inventive concept, an embodiment of the present application provides a document processing device, which is used to implement any of the above document processing methods, for example Figure 2 The document processing method shown, and the device can also realize the functions of the document processing device mentioned above.
[0095] Please refer to Figure 4 , is a schematic diagram of the structure of a document processing device provided in an embodiment of the present application. Figure 4 As shown, the document processing device 400 includes at least one processor 401 and a memory 402 communicatively connected to the at least one processor 401 .
[0096] The processor 401 may be a general-purpose processor or a dedicated processor. The processor 401 may include, for example, a baseband processor or a central processing unit. The baseband processor may be used to process communication protocols and communication data. The central processing unit may be used to control the document processing device 400, execute software programs and / or process data. Different processors may be independent devices or may be arranged in one or more processing circuits, for example, integrated in one or more dedicated integrated circuits.
[0097] In one embodiment, the memory 402 stores instructions that can be executed by at least one processor 401. The at least one processor 401 implements the functions of the aforementioned document processing device by executing the instructions stored in the memory 402, and accordingly, can also implement the steps performed by the aforementioned document processing device.
[0098] In this embodiment, the document processing device 400 can also implement the functions of the previous document processing device 300, and at least one processor 401 in the document processing device 400 can also implement the functions of the previous document extraction module 301, the determination module 302 and the printing module 303.
[0099] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes any of the above-mentioned document processing methods, for example, Figure 2 The document processing method shown.
[0100] Based on the same inventive concept, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enables any of the above-mentioned document processing methods, for example, Figure 2 The document processing method shown is implemented.
[0101] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0102] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0103] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0105] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A document processing method, characterized in that: include: Identify and extract title text features and body text features of the document to be printed; Determine a first relevance of the title text feature under each document category, and determine a second relevance of the body text feature under each document category; Determining the document category of the document to be printed according to the first relevance and the second relevance; According to the document category of the document to be stamped, at least one stamping position in the document to be stamped and the electronic seal category of each stamping position are determined, and the document to be stamped is stamped.
2. The method according to claim 1, characterized in that Determining a first relevance of the title text feature under each document category includes: According to a pre-stored corpus, the title text feature is segmented to obtain at least one first keyword; Determine a first word frequency of the at least one first keyword under each document category, and a first inverse document word frequency of the at least one first keyword under each document category; Determining, according to the first word frequency under each document category and the first inverse document word frequency under each document category, the relevance of the at least one first keyword to each document category; According to the relevance of the at least one first keyword to each document category, a first relevance of the title text feature under each document category is determined.
3. The method according to claim 1 or 2, characterized in that: Determining a second relevance of the body text feature under each document category includes: According to a pre-stored corpus, the text features are segmented to obtain a plurality of second keywords; Determine a second word frequency of the plurality of second keywords under each of the document categories, and a second inverse document word frequency of the plurality of second keywords under each of the document categories; Determining, according to the second word frequency under each document category and the second inverse document word frequency under each document category, the relevance of the plurality of second keywords to each document category; According to the relevance of the plurality of second keywords to each document category, a second relevance of the body text feature under each document category is determined.
4. The method according to claim 3, characterized in that Determining the second relevance of the body text feature to each document category according to the relevance of the plurality of second keywords to each document category includes: According to a preset threshold and the relevance of the plurality of second keywords to each document category, determining a keyword having a relevance greater than the preset threshold from the plurality of second keywords as a target keyword; According to the relevance of the target keyword to each document category, a second relevance of the body text feature under each document category is determined.
5. The method according to claim 1, characterized in that Determining the document category of the document to be printed according to the first relevance and the second relevance includes: The document category of the document to be printed is determined based on the first weight and the first relevance corresponding to the title text feature, and the second weight and the second relevance corresponding to the body text feature.
6. The method according to claim 1 or 5, characterized in that: Determining the document category of the document to be printed according to the first relevance and the second relevance includes: Determining the total relevance of the document to be printed under each document category according to the first relevance and the second relevance; The document category with the highest total relevance under each document category is determined as the document category of the document to be printed.
7. The method according to claim 5, characterized in that The method further comprises: Identify and extract text feature information of each sample document in a sample document set, wherein the sample document set includes printed history documents of various document categories, and the text feature information includes title text features and body text features; Determine a third relevance of the title text feature of each sample document under each document category, and a fourth relevance of the body text feature of each sample document under each document category; The first weight and the second weight are determined based on the third relevance of the title text features of each sample document under each document category, the fourth relevance of the body text features of each sample document under each document category, and the document category of each sample document, in combination with a preset fitting algorithm.
8. A document processing device, characterized in that: include: An extraction module, used for identifying and extracting the title text features and the body text features of the document to be printed; A determination module, used to determine a first relevance of the title text feature under each document category, and to determine a second relevance of the body text feature under each document category; The determination module is further used to determine the document category of the document to be printed according to the first relevance and the second relevance; The stamping module is used to determine at least one stamping position in the document to be stamped and the electronic stamp type of each stamping position according to the document type of the document to be stamped, and to stamp the document to be stamped.
9. A document processing device, characterized in that: include: at least one processor, and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method according to any one of claims 1 to 7 by executing the instructions stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.
11. A computer program product, characterized in that The invention comprises computer instructions, which, when executed on a computer, enable the method according to any one of claims 1 to 7 to be implemented.
Citation Information
Cited By
Text classification methods, systems, devices, and media
JP7840628B1
