Reversible natural language watermarking method oriented to semantic reservation
Semantic evaluation and prediction error processing in natural language watermarks are solved through NLTK and BERT models, and the problems of semantic distortion and extraction distortion caused by watermark embedding in the prior art are solved, and a reversible natural language watermark technology of semantic retention and lossless recovery are realized.
Patent Information
- Application Number
- CN202411346672.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2025-01-07
AI Technical Summary
The existing reversible natural language watermarking methods may cause semantic distortion when embedding watermark information, which cannot effectively retain the meaning of the original text, and may be distorted when extracting the watermark, which cannot restore the original text losslessly.
Using a reversible natural language watermarking method for semantic retention, the text is divided into sentences through NLTK and BERT models, and appropriate synonyms are selected for watermark embedding and extraction. Semantic similarity evaluation and prediction error vectors are used to ensure semantic consistency in the embedding and extraction process. sex.
The semantic similarity between the text embedded in the watermark and the original text is realized, and the original text can be restored losslessly when extracting the watermark, ensuring the integrity and accuracy of the information.
Smart Images

Figure CN119272246A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to applied cryptography, and in particular to a reversible natural language watermarking method oriented to semantics preservation. Background Art
[0002] Digital watermarking technology can embed specific information into multimedia data carriers to achieve traceability and copyright protection. Early natural language watermarking methods replaced some words in the text with their synonyms based on the language database. These methods did not consider the context of the target word when generating replacement candidates, and may not be able to select suitable synonyms for replacement, resulting in the modification of the overall meaning of the sentence.
[0003] In the military, medical and legal fields, there are strict requirements for the accuracy and integrity of information. The transmission and storage of information in these fields require high-quality carriers. Any slight modification or semantic distortion may bring disastrous consequences. In order to solve this problem, a reversible natural language watermarking technology is proposed. The main goal of this technology is to restore the original text without distortion while extracting the watermark. The existing reversible natural language watermarking methods mainly rely on synonym replacement to embed watermark information. The main idea of this method is to embed specific watermark information into the text by replacing certain words or phrases in the text without changing the semantics of the original text. In order to achieve the recoverability of synonyms, the semantic distance between the replaced synonyms and the original words may increase, resulting in embedding failure or a decrease in text quality. Summary of the invention
[0004] The purpose of the present invention is to provide a reversible natural language watermarking method for semantic preservation, which can make the text embedded with the watermark have semantic similarity with the original text and can restore the original text without distortion while extracting the watermark.
[0005] The objective of the present invention is achieved through the following technical solutions:
[0006] A reversible natural language watermarking method for semantic preservation, the method comprising:
[0007] Step 1: In the watermark embedding stage, the sender embeds the watermark into the original text so that the text after embedding the watermark has semantic similarity with the original text, and obtains the watermark text containing the watermark information;
[0008] Step 2: In the watermark extraction stage, the receiver extracts the watermark information from the watermark text and restores the original text losslessly.
[0009] It can be seen from the technical solution provided by the present invention that the method can make the text embedded with the watermark have semantic similarity with the original text, and can restore the original text without distortion while extracting the watermark. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0011] Figure 1 A schematic flow chart of a semantically-preserving reversible natural language watermarking method provided by an embodiment of the present invention;
[0012] Figure 2 A schematic diagram of the process of the watermark embedding stage according to an embodiment of the present invention;
[0013] Figure 3 A schematic diagram of a specific operation process of watermark embedding according to an embodiment of the present invention;
[0014] Figure 4 The figure is a schematic diagram of the specific process of watermark extraction and text recovery according to an embodiment of the present invention. DETAILED DESCRIPTION
[0015] The following is a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments, which does not constitute a limitation of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] like Figure 1 FIG. 1 is a flow chart of a reversible natural language watermarking method for semantics preservation provided by an embodiment of the present invention. The method comprises:
[0017] Step 1: In the watermark embedding stage, the sender embeds the watermark into the original text so that the text after embedding the watermark has semantic similarity with the original text, and obtains the watermark text containing the watermark information;
[0018] In this step, if Figure 2FIG. 1 is a process schematic diagram of the watermark embedding stage of an embodiment of the present invention. In the watermark embedding stage, the natural language processing tool NLTK is used to divide the original text into sentences. For each sentence, a word is selected from the given sentence as the target word target, and the target word target is replaced with the [MASK] word to obtain a sentence containing the [MASK] word. The BERT-based-uncased model is used to generate a replacement candidate word set C = {c0, c1, c2, c3, c4} for the [MASK] word of the sentence.
[0019] If the target word target is included in the replacement candidate word set C, the target word target in the replacement candidate word set C is marked as j, that is, c j =target, and the next word c of the target word target in the replacement candidate word set C is needed j+1 Perform semantic similarity evaluation. If the semantic similarity evaluation is passed, the current target word target is determined to be able to be used for watermark embedding, and the subscript of the current target word target in the alternative candidate word set C is recorded as the prediction error e i , that is, e i =j,e i Represents the i-th prediction error recorded, and also records the position information of the current target word target;
[0020] If the target word target is not in the candidate word set C or the next word of the target word target in the set C does not pass the semantic similarity evaluation, the current target word is skipped and the next word is selected as the target word;
[0021] In the specific implementation, the process of semantic similarity evaluation is: use the next word c of the target word target j+1 Replace the target word target in the original sentence to get a new sentence, and use the robust optimized BERT method model to determine whether the new sentence has an entailment relationship with the original sentence; if the probability that the new sentence has an entailment relationship with the original sentence is greater than 0.5, it is judged to pass the semantic similarity assessment;
[0022] Repeat the above operation to obtain a prediction error vector e = {e1, e2, ..., e i , ..., e n}, the value with the highest frequency in the prediction error vector e is recorded as the expansion value δ, and according to the expansion value δ and the prediction error e i To embed watermark, Figure 3 The figure is a schematic diagram of a specific operation process of watermark embedding according to an embodiment of the present invention, which specifically includes:
[0023] If the prediction error e i If it is less than the expansion value δ, no operation is performed;
[0024] If the prediction error e i If the embedded watermark bit is equal to the expansion value δ, the current target word target position is suitable for embedding watermark bits; and according to the embedded watermark bit, determine whether to replace the word. If the embedded watermark bit is 0, no word replacement is required; if the embedded watermark bit is 1, the next word of the target word in the replacement candidate word set C is used to replace the current target word, that is, target = c j+1 ;
[0025] If the prediction error e i If the value is greater than the expansion value δ, the next word of the target word in the candidate word set C is used to replace the current target word, that is, target = c j+1 ;
[0026] Through the above operation, the text embedded with the watermark has semantic similarity with the original text, and the watermark text containing the watermark information is obtained.
[0027] Step 2: In the watermark extraction stage, the receiver extracts the watermark information from the watermark text and restores the original text losslessly.
[0028] In this step, if Figure 4 The figure shows a schematic diagram of the specific process of watermark extraction and text recovery according to an embodiment of the present invention. In the watermark extraction stage, the natural language processing tool NLTK is used to divide the text into sentences. For each sentence, the target word target is replaced with the [MASK] word-gram according to the position information of the target word target provided in the watermark embedding stage. The [MASK] word-gram of the sentence is predicted using the BERT-based case-insensitive model to generate the same replacement candidate word set C = {c0, c1, c2, c3, c4} as in the watermark embedding stage. The current target word in the replacement candidate word set C is marked as the prediction error e′ i ;
[0029] According to the expansion value δ and prediction error e′ provided in the watermark embedding stage i Do the following:
[0030] If the prediction error e′ i If it is equal to the expansion value δ, the extracted watermark bit is 0, and there is no need to perform word replacement operation on the text;
[0031] If the prediction error e′ i Equal to the extension value + 1, that is, e′ i=δ+1, then the extracted watermark bit is 1, and the word in the current watermark text is replaced with the previous word of the current target word target in the replacement candidate word set C to achieve the purpose of restoring the text;
[0032] If the prediction error e′ i Greater than the expansion value +1, that is, e′ i >δ+1, then replace the word in the current watermark text with the previous word of the current target word target in the replacement candidate word set C to achieve the purpose of restoring the text;
[0033] Through the above operations, the watermark information can be extracted from the watermark text and the original text can be restored without loss.
[0034] It is worth noting that the contents not described in detail in the embodiments of the present invention belong to the prior art known to professional and technical personnel in the field.
[0035] For example, in the copyright protection scenario of academic papers, scientific research institutions need to embed copyright information in their published academic papers to prevent unauthorized copying and dissemination. However, the content and format of the paper cannot be significantly changed, otherwise it will affect its academic value and readability. The institution can use the reversible natural language watermarking technology proposed in the embodiment of the present invention to embed copyright information. The specific steps are as follows:
[0036] Copyright statements, author information, publication time and other information are embedded into the original paper text to obtain watermarked text. These watermark information are embedded in a hidden way and will not affect the appearance and readability of the text. The papers with embedded watermarks are published in academic journals and online platforms for readers to download and read.
[0037] For authorized users, they can extract the watermark from the watermarked text and restore the original text to ensure the integrity and accuracy of the paper content; for unauthorized users, they can only read the watermarked paper text.
[0038] If someone copies a paper without authorization, scientific research institutions can extract the embedded watermark information to prove the originality and ownership of the paper. When copyright disputes arise, it can provide strong evidentiary support and protect the legitimate rights and interests of authors and institutions.
[0039] In summary, in the watermark embedding stage, the method described in the embodiment of the present invention allows the user to customize the capacity of the embedded watermark according to the needs, and the text after the watermark is embedded has semantic similarity with the original text; in the watermark extraction stage, the watermark is extracted for tracing, and the original text can be restored without distortion. Thus, while providing a higher watermark embedding capacity, the high quality of the watermark text is retained as much as possible, and the reversibility also alleviates the impact of semantic distortion to a certain extent.
[0040] In addition, a person skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be implemented by instructing related hardware through a program, and the corresponding program can be stored in a computer-readable storage medium. The above-mentioned storage medium can be a read-only memory, a disk or an optical disk, etc.
[0041] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed in the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims. The information disclosed in the background technology section of this article is only intended to deepen the understanding of the overall background technology of the present invention, and should not be regarded as an admission or in any form that the information constitutes prior art known to those skilled in the art.
Claims
1. A reversible natural language watermarking method for semantic preservation, characterized in that: The method comprises: Step 1: In the watermark embedding stage, the sender embeds the watermark into the original text so that the text after embedding the watermark has semantic similarity with the original text, and obtains the watermark text containing the watermark information; Step 2: In the watermark extraction stage, the receiver extracts the watermark information from the watermark text and restores the original text losslessly.
2. The semantically preserved reversible natural language watermarking method according to claim 1, characterized in that: In step 1, in the watermark embedding stage, the natural language processing tool NLTK is used to divide the original text into sentences. For each sentence, a word is selected from the given sentence as the target word target, and the target word target is replaced with the [MASK] word to obtain a sentence containing the [MASK] word. The BERT-based case-insensitive model is used to generate a set of replacement candidate words C = {c0, c1, c2, c3, c4} for the [MASK] word of the sentence. If the target word target is included in the replacement candidate word set C, the target word target in the replacement candidate word set C is marked as j, that is, c j =target, and the next word c of the target word target in the replacement candidate word set C is needed j+1 Perform semantic similarity evaluation. If the semantic similarity evaluation is passed, the current target word target is determined to be able to be used for watermark embedding, and the subscript of the current target word target in the alternative candidate word set C is recorded as the prediction error e i , that is, e i =j,e i Represents the i-th prediction error recorded, and also records the position information of the current target word target; If the target word target is not in the candidate word set C or the next word of the target word target in the set C does not pass the semantic similarity evaluation, the current target word is skipped and the next word is selected as the target word; Repeat the above operation to obtain a prediction error vector e = {e1, e2, ..., e i , ..., e n }, the value with the highest frequency in the prediction error vector e is recorded as the expansion value δ, and according to the expansion value δ and the prediction error e i Watermark embedding includes: If the prediction error e i If it is less than the expansion value δ, no operation is performed; If the prediction error e i If the embedded watermark bit is equal to the expansion value δ, the current target word target position is suitable for embedding watermark bits; and according to the embedded watermark bit, it is determined whether to replace the word. If the embedded watermark bit is 0, no word replacement is required; if the embedded watermark bit is 1, the next word of the target word in the replacement candidate word set C is used to replace the current target word, that is, target t =c j+1 ; If the prediction error e i If the value is greater than the expansion value δ, the next word of the target word in the candidate word set C is used to replace the current target word, that is, target = c j+1 ; Through the above operation, the text embedded with the watermark has semantic similarity with the original text, and the watermark text containing the watermark information is obtained.
3. The semantically preserved reversible natural language watermarking method according to claim 1, characterized in that: In step 2, in the watermark extraction stage, the natural language processing tool NLTK is used to divide the text into sentences. For each sentence, the target word target is replaced with the [MASK] word according to the position information of the target word target provided in the watermark embedding stage. The [MASK] word of the sentence is predicted using the BERT-based case-insensitive model to generate the same replacement candidate word set C = {c0, c1, c2, c3, c4} as in the watermark embedding stage. The current target word in the replacement candidate word set C is marked as the prediction error e i ′; According to the expansion value δ and prediction error e provided in the watermark embedding stage i 'Perform the following operations: If the prediction error e i ′ is equal to the expansion value δ, then the extracted watermark bit is 0, and there is no need to perform word replacement operation on the text; If the prediction error e i ' is equal to the extension value + 1, that is, e i ′=δ+1, then the extracted watermark bit is 1, and the word in the current watermark text is replaced with the previous word of the current target word target in the replacement candidate word set C to achieve the purpose of restoring the text; If the prediction error e i ′ is greater than the expansion value + 1, that is, e i ′>δ+1, then replace the word in the current watermark text with the previous word of the current target word target in the replacement candidate word set c to achieve the purpose of restoring the text; Through the above operations, the watermark information can be extracted from the watermark text and the original text can be restored without loss.