A document desensitization storage method for smart office system
By calculating the similarity and repetition rate of the document title and content, combined with Huffman coding and DTW algorithm, the overall similarity and difference of the document is evaluated, which solves the problem of the inability of traditional methods to accurately identify the unique information of the document and achieves the accuracy of the document. Desensitization and information protection.
Patent Information
- Application Number
- CN202410968934.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-19
AI Technical Summary
Traditional document desensitization methods cannot accurately identify and protect unique information in documents, leading to the risk of information leakage. It is also difficult to accurately assess document similarity, affecting the uniqueness identification and comparison of content.
By obtaining the title information, content information and keywords of the document, calculate the similarity and repetition rate of the title and content, and combine the Huffman coding and DTW algorithm to evaluate the overall similarity and difference of the document, and then carry out targeted desensitization deal with.
It achieves accurate identification and protection of document content, reduces the risk of information leakage, and improves the accuracy of document uniqueness assessment and the pertinence of desensitization processing.
Smart Images

Figure CN118520504B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a document desensitizing storage method for a smart office system. Background Art
[0002] In today's highly developed Internet society, we enjoy many conveniences brought by the Internet, but we also face the risk of information leakage. With the increasing emphasis on information confidentiality and personal privacy protection, document information confidentiality has become particularly critical. However, when dealing with sensitive documents, traditional desensitization methods often fail to accurately identify and protect unique information in documents, thus posing a risk of leakage. These methods may ignore the structural information of the document, such as the number of sentences, total number of words, etc., and it is difficult to accurately capture the true meaning of keywords in context, resulting in low accuracy in document similarity assessment, which in turn affects the effective identification and comparison of the uniqueness of document content. Summary of the invention
[0003] The present invention provides a document desensitization storage method for a smart office system to solve the existing problems.
[0004] The document desensitization storage method for a smart office system of the present invention adopts the following technical solution:
[0005] An embodiment of the present invention provides a document desensitization storage method for a smart office system, the method comprising the following steps:
[0006] Obtain the title information and content information of each document and the title keywords in the title information; obtain the number of sentences and the total number of words in the content information of each document; obtain the repetition rate between the content information of any two documents and the repetition rate between the title information; in the same document, obtain the number of sentences containing the title keywords in the document content information;
[0007] Record any two documents as a target document and a reference document respectively; obtain the title similarity between the target document and the reference document based on the keywords in the target document title information and the repetition rate between the target document and the reference document title information; obtain the content similarity between the target document and the reference document based on the content information, the total number of words in the content information, the number of sentences, the number of sentences containing the title keywords and the repetition rate between them;
[0008] According to the title similarity and content similarity between the target document and the reference document, the overall similarity between the target document and the reference document is obtained;
[0009] Based on the overall similarity between the target document and the reference document, similar documents of the target document are obtained; based on the number of similar documents of the target document, the repetition rate and the total number of words between the document content information of the target document and each similar document, the difference coefficient of the target document is obtained; based on the difference coefficient of the target document, the number of sentences containing each title keyword in the target document content information and the number of keywords in the title information, the uniqueness of the target document is obtained; based on the uniqueness of the target document, the target document is desensitized and kept confidential.
[0010] Preferably, the step of obtaining the title similarity between the target document and the reference document based on the keywords in the target document title information and the repetition rate between the target document and the reference document title information includes the following specific steps:
[0011] Convert several title keywords in the target document and the reference document title information into keyword vectors;
[0012] Combining any keyword vector in the target document title information with any keyword vector in the reference document title information to form a title keyword vector combination, thereby obtaining several title keyword vector combinations; calculating the cosine similarity of each title keyword vector combination;
[0013] The title similarity between the target document and the reference document is obtained according to the cosine similarity of each title keyword vector combination of the target document and the reference document title information, the number of title keyword vector combinations, and the repetition rate between the title information.
[0014] Preferably, the step of obtaining the title similarity between the target document and the reference document according to the cosine similarity of each title keyword vector combination of the target document and the reference document title information, the number of title keyword vector combinations, and the repetition rate between the title information includes the following specific steps:
[0015]
[0016] Where: Indicates the title similarity between the target document and the reference document. The first column that indicates the title information of the target document and the reference document The cosine similarity of the keyword vector combination, The number of title keyword vector combinations representing the target document and the reference document title information, Indicates the repetition rate of the title information of the target document and the reference document. It represents an exponential function with a natural constant as the base, where e is a natural constant.
[0017] Preferably, the method of obtaining the content similarity between the target document and the reference document according to the content information, the total number of words, the number of sentences, the number of sentences containing title keywords and the repetition rate of the content information of the target document and the reference document comprises the following specific steps:
[0018] Obtain the keyword weight index of the target document according to the total number of words, sentences, and sentences containing title keywords in the content information of the target document and the reference document;
[0019] The content information of each document is encoded using the Huffman coding method to obtain a coding sequence; the DTW algorithm is used to calculate the coding sequence similarity between the target document and the reference document;
[0020] The content similarity between the target document and the reference document is obtained based on the keyword weight index of the target document, the repetition rate between the content information of the target document and the reference document, and the coding sequence similarity.
[0021] Preferably, the method of obtaining the content similarity between the target document and the reference document according to the keyword weight index of the target document, the repetition rate between the content information of the target document and the reference document, and the coding sequence similarity includes the following specific steps:
[0022]
[0023] Where: Indicates the content similarity between the target document and the reference document. Indicates the number of sentences containing title keywords in the target document content information. The number of sentences representing the content information of the target document, Indicates the total number of words in the target document content information. Indicates the number of sentences containing title keywords in the reference document content information. The number of sentences representing the content information of the reference document, Indicates the total number of words in the reference document content information. Indicates the encoding sequence similarity between the target document and the reference document, Indicates the repetition rate between the target document and the reference document content information. represents an exponential function with a natural constant as base, Indicates taking the absolute value, Indicates the keyword weight index of the target document.
[0024] Preferably, the step of obtaining the overall similarity between the target document and the reference document based on the title similarity and content similarity between the target document and the reference document comprises the following specific steps:
[0025]
[0026] Where: Represents the overall similarity between the target document and the reference document. Indicates the content similarity between the target document and the reference document. Indicates the title similarity between the target document and the reference document. To preset the first constant, is the preset second constant.
[0027] Preferably, the step of obtaining similar documents of the target document according to the overall similarity between the target document and the reference document comprises the following specific steps:
[0028] Among the overall similarities between the target document and each other document except the target document, other documents whose overall similarity is greater than a preset threshold are recorded as similar class documents of the target document.
[0029] Preferably, the step of obtaining the difference coefficient of the target document according to the number of similar documents of the target document, the repetition rate and the total number of words between the document content information of the target document and each similar document comprises the following specific steps:
[0030]
[0031] Where: represents the difference coefficient of the target document, Indicates the number of similar documents to the target document. Indicates the target document and The repetition rate between the document content information of similar documents, Indicates the total number of words in the target document content information. Indicates the target document and The absolute value of the difference in the total number of words in the document content information of similar documents.
[0032] Preferably, the uniqueness of the target document is obtained according to the difference coefficient of the target document, the number of sentences containing each title keyword in the content information of the target document, and the number of keywords in the title information, and the specific steps include the following:
[0033]
[0034] Where: Indicates the uniqueness of the target document, represents the difference coefficient of the target document, Indicates that the target document content information contains The number of sentences containing keywords in the title, The number of keywords representing the target document title information, Represents an exponential function with a natural constant as its base.
[0035] Preferably, the desensitizing and confidentiality processing of the target document according to the uniqueness of the target document includes the following specific steps:
[0036] When the uniqueness of the target document is greater than or equal to a first preset threshold, the target document is desensitized and kept confidential; when the uniqueness of the target document is less than the first preset threshold, the target document is not desensitized and kept confidential.
[0037] The beneficial effects of the technical solution of the present invention are: by analyzing and extracting key data of the document, such as title keywords, content information, the number of sentences in the document, the total number of words and other information; by calculating the repetition rate and similarity between any two documents, including the comparison of titles and contents, the uniqueness of the document content is more comprehensively evaluated; the present invention can accurately identify the uniqueness of the document, thereby performing targeted information desensitization and confidentiality processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 The present invention is a flowchart of the steps of a document desensitization storage method for a smart office system. DETAILED DESCRIPTION
[0040] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the document desensitization storage method for a smart office system proposed by the present invention, its specific implementation method, structure, features and effects are described in detail as follows in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0042] The following is a detailed description of a document desensitizing storage method for a smart office system provided by the present invention in conjunction with the accompanying drawings.
[0043] See also Figure 1, which shows a flowchart of a document desensitization storage method for a smart office system provided by an embodiment of the present invention, the method comprising the following steps:
[0044] Step S001: Obtain the title information and content information of each document and the title keywords in the title information; obtain the number of sentences and the total number of words in the content information of each document; obtain the repetition rate between the content information of any two documents and the repetition rate between the title information; in the same document, obtain the number of sentences containing title keywords in the document content information.
[0045] Select several documents to be analyzed, and obtain the title information and content information of each document, as well as several title keywords of the title information.
[0046] In this embodiment, the title keywords are extracted by using the TF-IDF extraction algorithm, and this is used as an example for description. Other methods may be used in other implementations, and this embodiment does not limit this.
[0047] Count the number of sentences and total number of words in each document content information.
[0048] In this embodiment, the python-docx library is used to read the document content by paragraphs, and natural language markers such as periods are used to segment sentences to obtain the number of sentences. Python-docx is a well-known technology, and the specific method is not described in detail here.
[0049] It should be noted that, in this embodiment, the total number of words in the document content information is expressed in kilowords (KWords, i.e., thousand words).
[0050] Obtain the repetition rate between content information of any two documents and the repetition rate between title information; and in the same document, obtain the number of sentences containing title keywords in the document content information.
[0051] In this embodiment, the repetition rate is obtained by a text comparison algorithm, wherein the text comparison algorithm is a well-known technology and the specific method will not be elaborated in detail here.
[0052] It should be noted that office documents such as contract texts and legal documents have their own unique fixed formats and common contents. The parts with greater differences may involve important information, that is, this part of the content is often the key part that needs to be desensitized.
[0053] Step S002: record any two documents as a target document and a reference document respectively; obtain the title similarity between the target document and the reference document based on the keywords in the target document title information and the repetition rate between the target document and the reference document title information; obtain the content similarity between the target document and the reference document based on the content information of the target document and the reference document, the total number of words in the content information, the number of sentences, the number of sentences containing title keywords and the repetition rate between them.
[0054] Documents of the same type have similarities, such as important contract documents. Contract texts have regular distribution as a whole, including specific terms, consistent structure, grammatical semantic rules, and digital date specifications. Contract texts are divided into title, body, and signature parts, and the similarity of contract documents is calculated based on these characteristics.
[0055] For several title keywords in any two document title information, the keywords are converted into keyword vectors by FastText. The FastText algorithm is a well-known technology and will not be described in detail in this embodiment.
[0056] Let any two documents be called target document and reference document respectively.
[0057] Any keyword vector in the target document title information is combined with any keyword vector in the reference document title information to form a title keyword vector combination, thereby obtaining several title keyword vector combinations. The cosine similarity of each title keyword vector combination is calculated. It should be noted that keyword vectors in the same document title information are not combined.
[0058] This embodiment provides a calculation method for obtaining document title similarity as follows:
[0059]
[0060] Where: Indicates the title similarity between the target document and the reference document. The first column that indicates the title information of the target document and the reference document The cosine similarity of the keyword vector combination, The number of title keyword vector combinations representing the target document and the reference document title information, Indicates the repetition rate of the title information of the target document and the reference document. It represents an exponential function with a natural constant as the base, where e is a natural constant.
[0061] In addition to title information, office documents of the same nature also have certain similarities in content, such as the document's composition structure, length, repetition, etc.
[0062] Each document content information is encoded using the Huffman coding method to obtain a coding sequence. The DTW algorithm is used to calculate the coding sequence similarity between the target document and the reference document. The Huffman coding method and the DTW algorithm are well-known technologies and are not described in detail in this embodiment.
[0063] This embodiment provides a calculation method for obtaining document content similarity as follows:
[0064]
[0065] Where: Indicates the content similarity between the target document and the reference document. Indicates the number of sentences containing title keywords in the target document content information. The number of sentences representing the content information of the target document, Indicates the total number of words in the target document content information. Indicates the number of sentences containing title keywords in the reference document content information. The number of sentences representing the content information of the reference document, Indicates the total number of words in the reference document content information. Indicates the encoding sequence similarity between the target document and the reference document, Indicates the repetition rate between the target document and the reference document content information. represents an exponential function with a natural constant as base, Indicates taking the absolute value, Indicates the keyword weight index of the target document.
[0066] Step S003: Obtain the overall similarity between the target document and the reference document according to the title similarity and content similarity between the target document and the reference document.
[0067] This implementation provides a calculation method for obtaining the overall similarity between the target document and other documents as follows:
[0068]
[0069] Where: Represents the overall similarity between the target document and the reference document. Indicates the content similarity between the target document and the reference document. Indicates the title similarity between the target document and the reference document. To preset the first constant, is the preset second constant.
[0070] In this embodiment, the first constant is preset is 0.7, and the second constant is preset It is 0.3, and this is used as an example for description. Other implementations may be set to other values, and this embodiment does not limit this. It should be noted that the preset first constant is the weight corresponding to the content similarity between two different documents, and the preset second constant is the weight of the title similarity between two different documents. It should be understood that the sum of the weights of the two is 1. The larger the value of the preset first constant is, the more attention is paid to the content similarity when measuring the overall similarity between two different documents; the larger the value of the preset second constant is, the more attention is paid to the title similarity when measuring the overall similarity between two different documents. Therefore, this embodiment gives a specific example, and the preset first constant is 0.7, and the preset second constant is 0.3. In other embodiments, the implementer can set it according to the specific implementation scenario, but it is necessary to ensure and The sum of is 1.
[0071] Step S004: Based on the overall similarity between the target document and the reference document, obtain similar documents of the target document; based on the number of similar documents of the target document, the repetition rate and the total number of words between the document content information of the target document and each similar document, obtain the difference coefficient of the target document; based on the difference coefficient of the target document, the number of sentences containing each title keyword in the target document content information and the number of keywords in the title information, obtain the uniqueness of the target document; desensitize and keep the target document confidential based on the uniqueness of the target document.
[0072] Among the overall similarities between the target document and each other document except the target document, other documents whose overall similarity is greater than a preset threshold are recorded as similar class documents of the target document.
[0073] This implementation provides a method for calculating the uniqueness coefficient of the target document as follows:
[0074]
[0075] Where: represents the difference coefficient of the target document, Indicates the number of similar documents to the target document. Indicates the target document and The repetition rate between the document content information of similar documents, Indicates the total number of words in the target document content information. Indicates the target document and The absolute value of the difference in the total number of words in the document content information of similar documents.
[0076] In the above formula, The larger the value, the more similar the target document is to the The greater the difference between similar documents, the more unique and important the target document is.
[0077]
[0078] Where: Indicates the uniqueness of the target document, represents the difference coefficient of the target document, Indicates that the target document content information contains The number of sentences containing keywords in the title, The number of keywords representing the target document title information, Represents an exponential function with a natural constant as its base.
[0079] The above formula shows that the uniqueness of each keyword in the target document is relatively high, unique, and important, so the target document needs to be desensitized and saved.
[0080] This embodiment determines whether to perform desensitization and confidentiality processing on the target document through a preset threshold. When the uniqueness of the document is high, that is, the importance of the document is high, the document is desensitized and confidentiality processing is performed, and desensitized storage is performed to reduce the risk of information leakage; when the uniqueness of the document is low, the confidentiality requirement of the document is low, and therefore no desensitization processing is performed.
[0081] Specifically, when the uniqueness of the target document is greater than or equal to a first preset threshold, the target document is desensitized and kept confidential; when the uniqueness of the target document is less than the first preset threshold, the target document is not desensitized and kept confidential.
[0082] In this embodiment, the first preset threshold is 0.8, which is used as an example for description. Other methods may be used in other implementations, and this embodiment does not limit this.
[0083] So far, the present invention is completed.
[0084] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A document desensitization storage method for smart office systems. It is characterized in that The method comprises the following steps: Obtain the title information and content information of each document and the title keywords in the title information; obtain the number of sentences and the total number of words in the content information of each document; obtain the repetition rate between the content information of any two documents and the repetition rate between the title information; in the same document, obtain the number of sentences containing the title keywords in the document content information; Record any two documents as a target document and a reference document respectively; obtain the title similarity between the target document and the reference document based on the keywords in the target document title information and the repetition rate between the target document and the reference document title information; obtain the content similarity between the target document and the reference document based on the content information, the total number of words in the content information, the number of sentences, the number of sentences containing the title keywords and the repetition rate between them; According to the title similarity and content similarity between the target document and the reference document, the overall similarity between the target document and the reference document is obtained; According to the overall similarity between the target document and the reference document, similar documents of the target document are obtained; according to the number of similar documents of the target document, the repetition rate and the total number of words between the document content information of the target document and each similar document, the difference coefficient of the target document is obtained; according to the difference coefficient of the target document, the number of sentences containing each title keyword in the content information of the target document and the number of keywords in the title information, the uniqueness of the target document is obtained; according to the uniqueness of the target document, the target document is desensitized and kept confidential; The specific steps of obtaining the difference coefficient of the target document according to the number of similar documents of the target document, the repetition rate and the total number of words between the document content information of the target document and each similar document are as follows: Where: represents the difference coefficient of the target document, Indicates the number of similar documents to the target document. Indicates the target document and The repetition rate between the document content information of similar documents, Indicates the total number of words in the target document content information. Indicates the target document and The absolute value of the difference in the total number of words in the document content information of similar documents; The specific steps of obtaining the uniqueness of the target document according to the difference coefficient of the target document, the number of sentences containing each title keyword in the content information of the target document, and the number of keywords in the title information are as follows: Where: Indicates the uniqueness of the target document, represents the difference coefficient of the target document, Indicates that the target document content information contains The number of sentences containing keywords in the title, The number of keywords representing the target document title information, represents an exponential function with a natural constant as base; The specific steps of desensitizing and confidentializing the target document according to the uniqueness of the target document are as follows: When the uniqueness of the target document is greater than or equal to a first preset threshold, the target document is desensitized and kept confidential; when the uniqueness of the target document is less than the first preset threshold, the target document is not desensitized and kept confidential.
2. According to the document desensitization storage method for a smart office system as described in claim 1, It is characterized in that The specific steps of obtaining the title similarity between the target document and the reference document based on the keywords in the target document title information and the repetition rate between the target document and the reference document title information are as follows: Convert several title keywords in the target document and the reference document title information into keyword vectors; Combining any keyword vector in the target document title information with any keyword vector in the reference document title information to form a title keyword vector combination, thereby obtaining several title keyword vector combinations; calculating the cosine similarity of each title keyword vector combination; The title similarity between the target document and the reference document is obtained according to the cosine similarity of each title keyword vector combination of the target document and the reference document title information, the number of title keyword vector combinations, and the repetition rate between the title information.
3. According to the document desensitization storage method for a smart office system as described in claim 2, It is characterized in that The method of obtaining the title similarity between the target document and the reference document according to the cosine similarity of each title keyword vector combination of the target document and the reference document title information, the number of title keyword vector combinations, and the repetition rate between the title information includes the following specific steps: Where: Indicates the title similarity between the target document and the reference document. The first column that indicates the title information of the target document and the reference document The cosine similarity of the keyword vector combination, The number of title keyword vector combinations representing the target document and the reference document title information, Indicates the repetition rate of the title information of the target document and the reference document. It represents an exponential function with a natural constant as the base, where e is a natural constant.
4. According to the document desensitization storage method for a smart office system as described in claim 1, It is characterized in that The method of obtaining the content similarity between the target document and the reference document according to the content information, the total number of words, the number of sentences, the number of sentences containing title keywords and the repetition rate of the content information of the target document and the reference document includes the following specific steps: Obtain the keyword weight index of the target document according to the total number of words, sentences, and sentences containing title keywords in the content information of the target document and the reference document; The content information of each document is encoded using the Huffman coding method to obtain a coding sequence; the DTW algorithm is used to calculate the coding sequence similarity between the target document and the reference document; The content similarity between the target document and the reference document is obtained based on the keyword weight index of the target document, the repetition rate between the content information of the target document and the reference document, and the coding sequence similarity.
5. According to the document desensitization storage method for a smart office system as described in claim 4, It is characterized in that The specific steps of obtaining the content similarity between the target document and the reference document according to the keyword weight index of the target document, the repetition rate between the content information of the target document and the reference document and the similarity of the coding sequence include the following: Where: Indicates the content similarity between the target document and the reference document. Indicates the number of sentences containing title keywords in the target document content information. The number of sentences representing the content information of the target document, Indicates the total number of words in the target document content information. Indicates the number of sentences containing title keywords in the reference document content information. The number of sentences representing the content information of the reference document, Indicates the total number of words in the reference document content information. Indicates the encoding sequence similarity between the target document and the reference document, Indicates the repetition rate between the target document and the reference document content information. represents an exponential function with a natural constant as base, Indicates taking the absolute value, Indicates the keyword weight index of the target document.
6. According to the document desensitization storage method for a smart office system as described in claim 1, It is characterized in that The step of obtaining the overall similarity between the target document and the reference document based on the title similarity and content similarity between the target document and the reference document includes the following specific steps: Where: Represents the overall similarity between the target document and the reference document. Indicates the content similarity between the target document and the reference document. Indicates the title similarity between the target document and the reference document. To preset the first constant, is the preset second constant.
7. According to the document desensitization storage method for a smart office system as described in claim 1, It is characterized in that The specific steps of obtaining similar documents of the target document according to the overall similarity between the target document and the reference document are as follows: Among the overall similarities between the target document and each other document except the target document, other documents whose overall similarity is greater than a preset threshold are recorded as similar class documents of the target document.
