Short message consistency checking method, device and equipment, storage medium and product
By identifying and evaluating keyword feature indicators of SMS messages and templates, and combining matching degree and semantic similarity, the problem of not being able to identify deep inconsistencies in existing technologies has been solved, thereby improving the accuracy and reliability of SMS consistency verification.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-13
AI Technical Summary
Existing SMS verification solutions are unable to effectively identify deep-seated inconsistencies such as semantic bias, resulting in low verification accuracy.
By identifying keywords in target SMS messages and SMS templates, multi-dimensional feature indicators of shared and unique keywords are calculated. Combining matching degree, difference degree, and semantic similarity, the consistency of SMS messages is comprehensively evaluated.
This improves the accuracy and reliability of SMS consistency verification, avoids misjudgments or omissions, and ensures the consistency between SMS content and template.
Smart Images

Figure CN121665197A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a method, apparatus, device, storage medium and product for verifying SMS consistency. Background Technology
[0002] In SMS sending services, ensuring consistency between SMS content and template is crucial, directly impacting the security and compliance of SMS delivery. However, existing SMS verification solutions have significant limitations: they can only achieve literal matching between SMS content and template, failing to effectively identify deeper inconsistencies such as semantic deviations, resulting in low verification accuracy. Summary of the Invention
[0003] This application provides a method, apparatus, device, storage medium, and product for SMS consistency verification, in order to solve the problem that the prior art cannot effectively identify deep-seated inconsistencies such as semantic deviations, resulting in low verification accuracy.
[0004] To achieve the above objectives, embodiments of this application provide a method for verifying SMS consistency, including: Identify the primary keyword of the target SMS message and the secondary keyword of the SMS template; Based on the first keyword and the second keyword, determine the common keywords between the target SMS and the SMS template, as well as the first unique keyword of the target SMS compared to the SMS template; Based on the shared keywords, calculate the matching degree between the target SMS and the SMS template; Based on the first unique keyword, calculate the degree of difference between the target SMS and the SMS template; Calculate the semantic similarity between the target SMS and the SMS template; The consistency test result of the target SMS is obtained based on the matching degree, the difference degree, and the semantic similarity.
[0005] As an improvement to the above solution, the step of calculating the matching degree between the target SMS and the SMS template based on the shared keywords includes: Calculate the first multi-dimensional feature index of the second keyword; The first multi-dimensional feature indicators of the common keywords are fused to obtain a first fusion value; The first multi-dimensional feature index of the second keyword is fused to obtain the second fusion value; The matching degree is obtained based on the first fusion value and the second fusion value.
[0006] As an improvement to the above solution, the step of fusing the first multi-dimensional feature indicators of the common keywords to obtain a first fusion value includes: For each of the common keywords, the first multi-dimensional feature indicators of the common keywords are multiplied together to obtain the first product result; The first product results of all the shared keywords are added together to obtain the first fusion value.
[0007] As an improvement to the above scheme, the step of fusing the first multi-dimensional feature indicators of the second keyword to obtain a second fusion value includes: For each of the second keywords, the first multidimensional feature indicators of the second keywords are multiplied together to obtain the second product result; The second product results of all the second keywords are added together to obtain the second fusion value.
[0008] As an improvement to the above scheme, obtaining the matching degree based on the first fusion value and the second fusion value includes: The matching degree is obtained by dividing the first fusion value by the second fusion value.
[0009] As an improvement to the above scheme, the first multi-dimensional feature index includes: The term frequency-inverse document frequency of the second keyword; The similarity between the second keyword and the SMS template; The contextual relevance of the second keyword; The sentiment value of the second keyword.
[0010] As an improvement to the above scheme, the term frequency-inverse document frequency of the second keyword is calculated using the TF-IDF algorithm.
[0011] As an improvement to the above scheme, the similarity between the second keyword and the SMS template is calculated using the BM25 algorithm.
[0012] As an improvement to the above scheme, the contextual relevance of the second keyword is obtained through the following steps; Construct a word co-occurrence matrix of all the second keyword and its surrounding words; The frequency of occurrence of the second keyword is calculated based on the word co-occurrence matrix and used as the contextual relevance of the second keyword.
[0013] As an improvement to the above scheme, the sentiment value of the second keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values.
[0014] As an improvement to the above solution, the step of calculating the difference between the target SMS and the SMS template based on the first unique keyword includes: Calculate the second multi-dimensional feature index of the first unique keyword; The second multi-dimensional feature index of the first unique keyword is fused to obtain a third fusion value; The degree of difference is obtained based on the third fusion value and the number of first keywords in the target SMS message.
[0015] As an improvement to the above scheme, the fusion of the second multi-dimensional feature indicators of the first unique keyword to obtain a third fusion value includes: The third fusion value is obtained by multiplying the second multi-dimensional feature indicators of all the first unique keywords.
[0016] As an improvement to the above scheme, the step of obtaining the difference degree based on the third fusion value and the number of first keywords in the target SMS message includes: The difference degree is obtained by dividing the third fusion value by the number of first keywords in the target SMS.
[0017] As an improvement to the above scheme, the second multi-dimensional feature index includes: The number of the first unique keywords; The Jaccard similarity coefficient between the set composed of the first keyword and the set composed of the second keyword; The average sentiment value of the first unique keyword; The average risk of the first unique keyword.
[0018] As an improvement to the above scheme, the average sentiment value of the first unique keyword is obtained through the following steps: The sentiment value of the first unique keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values; The sentiment values of all the first unique keywords are averaged to obtain the average sentiment value of the first unique keyword.
[0019] As an improvement to the above solution, the average risk of the first unique keyword is obtained through the following steps: The risk value of the first unique keyword is obtained through a preset risk identification model; wherein, the risk identification model includes the correspondence between keywords and risk values; The average risk value of all the first unique keywords is calculated by averaging them.
[0020] As an improvement to the above scheme, the semantic similarity is obtained at least based on a first semantic similarity, which is acquired through the following steps: The target SMS and the SMS template are represented by semantic vectors to obtain a first semantic vector representation and a second semantic vector representation. Calculate the first probability distribution of the first semantic vector representation in each of its own semantic units; Calculate the second probability distribution of the second semantic vector representation in each of its own semantic units; Calculate the JS divergence based on the first probability distribution and the second probability distribution; The first semantic similarity is obtained based on the JS divergence.
[0021] As an improvement to the above scheme, the semantic similarity is obtained at least based on a second semantic similarity, which is acquired through the following steps: The target SMS message and the SMS message template are input into a preset semantic similarity model to obtain the second semantic similarity; wherein, the semantic similarity model is trained from sentence samples.
[0022] As an improvement to the above scheme, obtaining the consistency check result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity includes: If the matching degree is greater than a preset matching degree threshold, the difference degree is less than a preset difference degree threshold, and the semantic similarity is greater than a preset semantic similarity threshold, then the target SMS message passes the consistency check.
[0023] As an improvement to the above scheme, the preset matching threshold is determined by at least one of the SMS type, sending scenario, and user group.
[0024] As an improvement to the above scheme, the preset difference threshold is determined by at least one of the SMS type, sending scenario, and user group.
[0025] As an improvement to the above scheme, the preset semantic similarity threshold is determined by at least one of the following: SMS type, sending scenario, and user group.
[0026] As an improvement to the above scheme, before identifying the first keyword of the target SMS and the second keyword of the SMS template, the method further includes: Obtain the original target SMS message and the original SMS message template; The original target SMS message is preprocessed to obtain the target SMS message; The original SMS template is preprocessed to obtain the SMS template.
[0027] As an improvement to the above solution, the method further includes: Users who create the original SMS template must register with their real names. Authorization management is implemented for users and applications using the aforementioned SMS template.
[0028] To achieve the above objectives, embodiments of this application also provide a text message consistency verification device, comprising: The identification module is used to identify the first keyword of the target SMS message and the second keyword of the SMS template. The determining module is used to determine, based on the first keyword and the second keyword, common keywords between the target SMS and the SMS template, and a first unique keyword of the target SMS compared to the SMS template; The first calculation module is used to calculate the matching degree between the target SMS and the SMS template based on the shared keywords; The second calculation module is used to calculate the degree of difference between the target SMS and the SMS template based on the first unique keyword; The third calculation module is used to calculate the semantic similarity between the target SMS and the SMS template; The verification module is used to obtain the consistency verification result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity.
[0029] To achieve the above objectives, this application also provides a text message consistency verification device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the text message consistency verification method as described above.
[0030] To achieve the above objectives, embodiments of this application also provide a computer-readable storage medium, the computer-readable storage medium including a stored computer program; wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the SMS consistency verification method as described above.
[0031] To achieve the above objectives, embodiments of this application also provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the SMS consistency verification method as described above.
[0032] Compared with existing technologies, the present application provides a method, apparatus, device, storage medium, and product for SMS consistency verification. This involves identifying a first keyword of the target SMS and a second keyword of the SMS template; determining common keywords between the target SMS and the SMS template, as well as a first unique keyword of the target SMS compared to the SMS template, based on the first and second keywords; calculating the matching degree between the target SMS and the SMS template based on the common keywords; calculating the difference degree between the target SMS and the SMS template based on the first unique keyword; calculating the semantic similarity between the target SMS and the SMS template; and obtaining the consistency verification result of the target SMS based on the matching degree, the difference degree, and the semantic similarity. Therefore, the present application comprehensively evaluates the consistency between the target SMS and the SMS template by integrating three dimensions: matching degree, difference degree, and semantic similarity, effectively avoiding misjudgments or omissions, and improving the accuracy and reliability of the verification. Attached Figure Description
[0033] Figure 1 This is a flowchart of a text message consistency verification method provided in an embodiment of this application; Figure 2 This is a structural block diagram of a text message consistency verification device provided in an embodiment of this application; Figure 3 This is a structural block diagram of a text message consistency verification device provided in an embodiment of this application. Detailed Implementation
[0034] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0035] In the description of this application, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0036] In this application description, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0037] In this application description, the terms "first," "second," etc., are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus. The term "based on" means "at least partially based on." The term "according to" means "at least partially according to." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments." The term "and / or" means at least one of the connected objects, such as A and / or B, indicating three cases: including only A, only B, and both A and B. Unless otherwise stated, the term "multiple" means two or more.
[0038] See Figure 1 , Figure 1 This is a flowchart of a text message consistency verification method provided in an embodiment of this application. The text message consistency verification method includes: S1. Identify the first keyword of the target SMS message and the second keyword of the SMS template; This application embodiment identifies keywords from a target SMS message and an SMS template. The identified keywords in the target SMS message are referred to as the first keyword, and the keywords in the SMS template are referred to as the second keyword. These keywords can be identified, for example, using Natural Language Processing (NLP) technology. The target SMS message can be a message to be sent, which is sent after a consistency check is passed. The SMS template is pre-stored on a server, and a consistency check is performed between the template and the target SMS message to determine whether the target SMS message matches the SMS template.
[0039] S2. Based on the first keyword and the second keyword, determine the common keywords between the target SMS and the SMS template, and the first unique keyword of the target SMS compared to the SMS template; It's worth noting that the shared keywords between the target SMS and the SMS template refer to the same keywords in both, specifically the same keywords in the first and second keywords. The first unique keyword of the target SMS compared to the SMS template refers to a keyword present in the target SMS but not in the SMS template.
[0040] S3. Calculate the matching degree between the target SMS and the SMS template based on the shared keywords; This application's embodiments can calculate the matching degree between a target SMS message and an SMS template based on shared keywords. A higher matching degree indicates greater consistency between the target SMS message and the SMS template. For example, the matching degree can be determined based on the number of shared keywords.
[0041] S4. Calculate the degree of difference between the target SMS and the SMS template based on the first unique keyword; This application embodiment can calculate the degree of difference between the target SMS and the SMS template based on the first unique keyword. The smaller the degree of difference, the higher the consistency between the target SMS and the SMS template. For example, the degree of difference can be determined based on the number of the first unique keywords.
[0042] S5. Calculate the semantic similarity between the target SMS and the SMS template; This application's embodiments can combine Natural Language Processing (NLP) technology to calculate the semantic similarity between the target SMS message and the SMS template. For example, it can be calculated using cosine similarity, which is not limited here.
[0043] S6. Based on the matching degree, the difference degree, and the semantic similarity, obtain the consistency test result of the target SMS.
[0044] This application embodiment comprehensively evaluates the consistency between the target SMS and the SMS template by integrating three dimensions: matching degree, difference degree, and semantic similarity, effectively avoiding misjudgment or omission, and improving the accuracy and reliability of verification.
[0045] In an optional embodiment, calculating the matching degree between the target SMS and the SMS template based on the shared keywords includes: Calculate the first multi-dimensional feature index of the second keyword; The first multi-dimensional feature indicators of the common keywords are fused to obtain a first fusion value; The first multi-dimensional feature index of the second keyword is fused to obtain the second fusion value; The matching degree is obtained based on the first fusion value and the second fusion value.
[0046] It's worth noting that the second keyword of the SMS template includes: common keywords and second unique keywords of the SMS template compared to the target SMS. The second unique keyword refers to a keyword that exists in the SMS template but not in the target SMS. Therefore, the first multi-dimensional feature indicators of the second keyword include: the first multi-dimensional feature indicators of the common keywords and the first multi-dimensional feature indicators of the second unique keywords.
[0047] This application embodiment utilizes a first multi-dimensional feature index of shared keywords to obtain a first fusion value; utilizes a second multi-dimensional feature index of second keywords to obtain a second fusion value; finally, based on the first and second fusion values, the matching degree between the target SMS and the SMS template is obtained, which not only reduces computational complexity but also improves the accuracy of the matching degree.
[0048] In an optional embodiment, fusing the first multi-dimensional feature indicators of the common keywords to obtain a first fusion value includes: For each of the common keywords, the first multi-dimensional feature indicators of the common keywords are multiplied together to obtain the first product result; The first product results of all the shared keywords are added together to obtain the first fusion value.
[0049] This application embodiment reduces computational complexity and improves verification efficiency by multiplying and summing the first multi-dimensional feature indicators of all common keywords.
[0050] In an optional embodiment, fusing the first multi-dimensional feature indicators of the second keyword to obtain a second fusion value includes: For each of the second keywords, the first multidimensional feature indicators of the second keywords are multiplied together to obtain the second product result; The second product results of all the second keywords are added together to obtain the second fusion value.
[0051] This application embodiment reduces computational complexity and improves verification efficiency by multiplying and summing the first multidimensional feature indicators of all second keywords.
[0052] In an optional embodiment, obtaining the matching degree based on the first fusion value and the second fusion value includes: The matching degree is obtained by dividing the first fusion value by the second fusion value.
[0053] This application embodiment uses the result of dividing the first fusion value by the second fusion value as the matching degree, which can focus on the information of common keywords, making the matching degree more consistent with the goal of consistency verification of SMS template, and improving the accuracy of consistency verification.
[0054] Optionally, the first multi-dimensional feature index includes: The second keyword's term frequency-inverse document frequency (TF-IDF) can be calculated, for example, using the TF-IDF algorithm. Second keyword Term frequency - inverse document frequency ,
[0055]
[0056] In the formula, Indicates the second keyword word frequency, Indicates the second keyword Number of times it appears in the SMS template This indicates the number of times each word appears in the SMS template; Indicates the second keyword Inverse document frequency, This indicates the total number of SMS templates in the SMS template set. This indicates that the SMS template set contains a second keyword. The number of documents.
[0057] The TF-IDF algorithm reflects the importance of keywords in text and its ability to distinguish different texts. A higher value indicates that the word is crucial in the current SMS template and appears less frequently in other SMS templates.
[0058] The similarity between the second keyword and the SMS template; for example, calculated using the BM25 algorithm: Second keyword similarity .
[0059] In the formula, Indicates the second keyword A morpheme, Indicates morpheme SMS templates The relevance weights are usually obtained from the inverse document frequency; Indicates morpheme SMS templates The relevance score, Indicates the second keyword The total number of morphemes, where i is an integer.
[0060] The BM25 (Best Matching 25, Information Retrieval) algorithm is used in information retrieval to measure the importance of keywords in a document, and it performs exceptionally well with short texts. It balances keyword frequency and distribution, avoiding the problem of excessive weighting of high-frequency keywords in long texts, while also considering the importance of keywords in documents of different lengths.
[0061] The contextual relevance of the second keyword is obtained, for example, through the following steps: Construct a word co-occurrence matrix of all the second keyword and its surrounding words; calculate the frequency of the second keyword based on the word co-occurrence matrix, and use this as the contextual relevance of the second keyword. For example, corresponding to common keyword 1, it appears with surrounding word 1 in the target SMS message, and with surrounding words 1, 2, and 3 respectively in the SMS template. That is, in the target SMS message, it is: common keyword 1 - surrounding word 1; in the SMS template, it is: common keyword 1 - surrounding word 1, common keyword 1 - surrounding word 2, common keyword 1 - surrounding word 3. Then, the contextual relevance of common keyword 1 = the number of times common keyword 1 - surrounding word 1 appears in the target SMS message / the number of times common keyword 1 - each surrounding word appears in the SMS template = 1 / 3.
[0062] The contextual relevance of the second keyword can reflect its semantics in a specific context.
[0063] The sentiment value of the second keyword. For example, it can be obtained through a preset sentiment recognition model; wherein the sentiment recognition model includes the correspondence between keywords and sentiment values, and can be trained based on keyword samples and corresponding label sentiment values.
[0064] Sentiment scores are used to measure the emotional tendency of keywords, removing negative emotions (such as intimidation and violence), and range from -1 to 1. The sentiment recognition model is as follows: ① Use pre-trained sentiment analysis models such as VADER (Valence Aware Dictionary and sEntiment Reasoner, a dictionary and rule-based sentiment analysis tool) and TextBlob (an open-source SMS template processing library written in Python), input keywords, and output sentiment values. ② Dictionary-based sentiment analysis: Using a sentiment dictionary, each sentiment word has a predefined sentiment value, and the sentiment value of keywords is calculated by matching them. ③ Deep learning models: Using models such as RNN (Recurrent Neural Network) and BERT (Bidirectional Encoder Representations from Transformers), input keywords and output sentiment values.
[0065] Specifically, the matching degree is calculated according to the following formula. :
[0066] In the formula, This represents the total number of keywords. The number of the second keyword in the SMS template. Keywords Term frequency - inverse document frequency, Keywords Similarity to SMS templates, Keywords Contextual relevance, Keywords The emotional value.
[0067] Assuming the SMS template is "Dear user, your verification code is 1234, please check." and the target SMS is "Dear user, your verification code is 5678, please check.", the first multi-dimensional feature indicators are shown in Table 1.
[0068] Table 1
[0069] Mole: 0.8×0.7×0.6×0.5+ 0.6×0.6×0.7×0.6 + 0.7×0.65×0.8×0.7 +1.2×1.0×0.9×0.8 + 0.5×0.5×0.4×0.3 + 0.9×0.8×0.7×0.6 = 0.168 + 0.1512+ 0.238 + 0.648 + 0.03 + 0.2016 = 1.4368.
[0070] Denominator: Since the keywords in the SMS template are the same as the common keywords, the denominator is also 1.4368.
[0071] Match rate: .
[0072] In an optional embodiment, calculating the difference between the target SMS and the SMS template based on the first unique keyword includes: Calculate the second multi-dimensional feature index of the first unique keyword; The second multi-dimensional feature index of the first unique keyword is fused to obtain a third fusion value; The degree of difference is obtained based on the third fusion value and the number of first keywords in the target SMS message.
[0073] This application's embodiments utilize a second multi-dimensional feature index based on the first unique keyword to obtain the degree of difference between the target SMS and the SMS template, which not only reduces computational complexity but also improves matching accuracy.
[0074] In an optional embodiment, fusing the second multi-dimensional feature indicators of the first unique keyword to obtain a third fusion value includes: The third fusion value is obtained by multiplying the second multi-dimensional feature indicators of all the first unique keywords.
[0075] This application embodiment reduces computational complexity and improves verification efficiency by multiplying the second multi-dimensional feature indicators of all first unique keywords.
[0076] In an optional embodiment, obtaining the difference degree based on the third fusion value and the number of first keywords in the target SMS message includes: The difference degree is obtained by dividing the third fusion value by the number of first keywords in the target SMS.
[0077] This application focuses on the information of the first unique keyword, making the difference more consistent with the goal of consistency verification of SMS template, and improving the accuracy of consistency verification.
[0078] Optionally, the second multi-dimensional feature index includes: The number of the first unique keywords; The Jaccard similarity coefficient between the set composed of the first keyword and the set composed of the second keyword; The average sentiment value of the first unique keyword; wherein, it is obtained through the following steps: The sentiment value of the first unique keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values; this sentiment recognition model is similar to the sentiment recognition model described above, and will not be repeated here.
[0079] The sentiment values of all the first unique keywords are averaged to obtain the average sentiment value of the first unique keyword.
[0080] The average risk of the first unique keyword; it is obtained through the following steps: The risk value of the first unique keyword is obtained through a preset risk identification model; wherein, the risk identification model includes the correspondence between keywords and risk values; specifically, it can be obtained by training keyword samples with corresponding tag risk values.
[0081] The average risk value of all the first unique keywords is calculated by averaging them.
[0082] Suppose the target text message reads: "Your bank account has unusual activity. Please click the link to view it immediately."
[0083] Using a risk dictionary (one of the risk identification models), the first unique keywords such as "bank account", "abnormal activity", "click immediately", and "link" were found. The risk scores for each word in the risk dictionary were 0.8, 0.7, 0.6, and 0.9.
[0084] The calculated average risk is: (0.8 + 0.7 + 0.6 + 0.9) / 4 = 0.75.
[0085] Specifically, the degree of difference is calculated according to the following formula. :
[0086] In the formula, The number of unique keywords. Target SMS SMS templates The Jaccard similarity coefficient between them The sentiment average of the first unique keyword. The average risk of the first unique keyword. The number of primary keywords in the target SMS message.
[0087] Assuming the SMS template is "Dear user, your bill has been generated, please check.", the actual SMS is "Dear user, your monthly spending list has been generated, please check.", the second multi-dimensional feature indicators are shown in Table 2.
[0088] Table 2
[0089] Difference: .
[0090] In an optional embodiment, the semantic similarity is obtained at least based on a first semantic similarity, which is acquired through the following steps: The target SMS and the SMS template are represented by semantic vectors to obtain a first semantic vector representation and a second semantic vector representation. Calculate the first probability distribution of the first semantic vector representation in each of its own semantic units; Calculate the second probability distribution of the second semantic vector representation in each of its own semantic units; Calculate the JS divergence based on the first probability distribution and the second probability distribution; The first semantic similarity is obtained based on the JS divergence.
[0091] This application utilizes Jensen-Shannon divergence (JS divergence) to calculate semantic similarity, which is more effective at capturing subtle differences in the deep semantic distribution of semantic units, thus improving verification accuracy and reliability. Specifically, JS divergence is inversely proportional to the first semantic similarity; for example, the first semantic similarity can be directly used as the semantic similarity, and the JS divergence can be converted into a semantic similarity. .
[0092] In one optional embodiment, the semantic similarity is obtained at least based on a second semantic similarity, which is acquired through the following steps: The target SMS message and the SMS message template are input into a preset semantic similarity model to obtain the second semantic similarity; wherein, the semantic similarity model is trained from sentence samples.
[0093] The embodiments of this application can utilize a pre-trained semantic similarity model to obtain semantic similarity, thereby improving the accuracy and reliability of verification.
[0094] Specifically, semantic similarity is calculated according to the following formula. :
[0095] In the formula, This represents semantic similarity, typically ranging from 0 to 1. A value closer to 1 indicates greater semantic similarity between the text message and the template; a value closer to 0 indicates greater semantic difference.
[0096] : Represents the semantic vector of the SMS template at the th position. The probability distribution of each semantic unit. It reflects the feature strength of the SMS template on that semantic unit.
[0097] : Represents the semantic vector of the target SMS message at the th position. The probability distribution of each semantic unit. It reflects the feature strength of the text message on that semantic unit.
[0098] : Represents the dimension of the semantic vector, that is, the total number of semantic units.
[0099] : Preset weights.
[0100] The second semantic similarity is obtained using a pre-trained semantic similarity model.
[0101] Assuming the SMS template is "Dear user, your bill has been generated, please check.", and the actual SMS is "Dear user, your monthly expense list has been generated, please check.", the semantic vectors calculated using the pre-trained model are shown in Table 3: Table 3
[0102] Calculate JS divergence:
[0103] semantic similarity . The larger the value, the more semantically similar the text message and the text message template are.
[0104] In an optional embodiment, obtaining the consistency check result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity includes: If the matching degree is greater than a preset matching degree threshold, the difference degree is less than a preset difference degree threshold, and the semantic similarity is greater than a preset semantic similarity threshold, then the target SMS message passes the consistency check.
[0105] In this embodiment of the application, the target SMS message is determined to pass the consistency check when the matching degree is greater than a preset matching degree threshold, the difference degree is less than a preset difference degree threshold, and the semantic similarity is greater than a preset semantic similarity threshold. Otherwise, the target SMS message fails the consistency check.
[0106] Furthermore, if the target SMS passes the consistency check, it is allowed to be sent; otherwise, the corresponding recording, warning, and blocking operations are performed according to the preset inconsistency handling strategy, and a detailed verification report is generated for further analysis and optimization. It also supports manual review and secondary verification of inconsistent SMS.
[0107] For example, statistical analysis of consistency check results can generate multi-dimensional statistical reports, including the total number of checks, the number of inconsistent checks, and the verification status of different types of SMS messages. Machine learning algorithms can be used to mine and analyze the verification data, automatically optimizing verification strategies and template matching rules to improve the overall performance and accuracy of the system.
[0108] Optionally, the preset matching threshold, preset difference threshold, and preset semantic similarity threshold are determined by at least one of the SMS type, sending scenario, and user group.
[0109] This application embodiment determines a preset matching threshold, a preset difference threshold, and a preset semantic similarity threshold based on at least one of the following: SMS type, sending scenario, and user group. This enables dynamic adjustment of the thresholds, avoiding over- or under-verification. While ensuring verification accuracy, it significantly improves verification efficiency, adapting to different types of SMS messages, varying sending scenarios, and diverse user needs, thus exhibiting greater versatility and adaptability. Here, "user group" refers to the group of users receiving the target SMS message.
[0110] For example, for high-risk scenarios (such as loan and financial SMS messages), the preset matching threshold, preset difference threshold, and preset semantic similarity threshold can be increased to ensure that the target SMS message is strictly consistent with the SMS template, thereby reducing the risk of fraud.
[0111] In an optional embodiment, before identifying the first keyword of the target SMS and the second keyword of the SMS template, the method further includes: Obtain the original target SMS message and the original SMS message template; The original target SMS message is preprocessed to obtain the target SMS message; The original SMS template is preprocessed to obtain the SMS template.
[0112] It is worth noting that before sending the SMS, this application preprocesses the original target SMS and the original SMS template, including special character removal, word segmentation, simplified / traditional Chinese conversion, generalized word group conversion, stop word removal, name removal, short link identification and removal, semantic analysis, etc., to improve data support for subsequent multi-dimensional calculations and improve the accuracy and efficiency of verification.
[0113] In an optional embodiment, the method further includes: Users who create the original SMS template must register with their real names. Authorization management is implemented for users and applications using the aforementioned SMS template.
[0114] Before sending SMS messages, this application embodiment also requires real-name registration of the user who wrote the original SMS template and authorization management of the user and application using the SMS template, which can ensure the legal use of the SMS template.
[0115] This application embodiment constructs a complete closed-loop verification process from real-name registration, preprocessing, multi-dimensional calculation to consistency verification and subsequent processing, so as to promptly detect and handle the problem of inconsistency between the target SMS and the SMS template.
[0116] See Figure 2 , Figure 2 This is a structural block diagram of a text message consistency verification device 10 provided in an embodiment of this application. The text message consistency verification device 10 includes: The identification module 11 is used to identify the first keyword of the target SMS and the second keyword of the SMS template; The determining module 12 is used to determine, based on the first keyword and the second keyword, common keywords between the target SMS and the SMS template, and a first unique keyword of the target SMS compared to the SMS template; The first calculation module 13 is used to calculate the matching degree between the target SMS and the SMS template based on the common keywords; The second calculation module 14 is used to calculate the degree of difference between the target SMS and the SMS template based on the first unique keyword; The third calculation module 15 is used to calculate the semantic similarity between the target SMS and the SMS template; The verification module 16 is used to obtain the consistency verification result of the target SMS based on the matching degree, the difference degree and the semantic similarity.
[0117] Optionally, calculating the matching degree between the target SMS and the SMS template based on the shared keywords includes: Calculate the first multi-dimensional feature index of the second keyword; The first multi-dimensional feature indicators of the common keywords are fused to obtain a first fusion value; The first multi-dimensional feature index of the second keyword is fused to obtain the second fusion value; The matching degree is obtained based on the first fusion value and the second fusion value.
[0118] Optionally, fusing the first multi-dimensional feature indicators of the common keywords to obtain a first fusion value includes: For each of the common keywords, the first multi-dimensional feature indicators of the common keywords are multiplied together to obtain the first product result; The first product results of all the shared keywords are added together to obtain the first fusion value.
[0119] Optionally, fusing the first multi-dimensional feature indicators of the second keyword to obtain a second fusion value includes: For each of the second keywords, the first multidimensional feature indicators of the second keywords are multiplied together to obtain the second product result; The second product results of all the second keywords are added together to obtain the second fusion value.
[0120] Optionally, obtaining the matching degree based on the first fusion value and the second fusion value includes: The matching degree is obtained by dividing the first fusion value by the second fusion value.
[0121] Optionally, the first multi-dimensional feature index includes: The term frequency-inverse document frequency of the second keyword; The similarity between the second keyword and the SMS template; The contextual relevance of the second keyword; The sentiment value of the second keyword.
[0122] Optionally, the term frequency-inverse document frequency of the second keyword is calculated using the TF-IDF algorithm.
[0123] Optionally, the similarity between the second keyword and the SMS template is calculated using the BM25 algorithm.
[0124] Optionally, the contextual relevance of the second keyword is obtained through the following steps; Construct a word co-occurrence matrix of all the second keyword and its surrounding words; The frequency of occurrence of the second keyword is calculated based on the word co-occurrence matrix and used as the contextual relevance of the second keyword.
[0125] Optionally, the sentiment value of the second keyword is obtained through a preset sentiment recognition model; wherein the sentiment recognition model includes the correspondence between keywords and sentiment values.
[0126] Optionally, calculating the difference between the target SMS and the SMS template based on the first unique keyword includes: Calculate the second multi-dimensional feature index of the first unique keyword; The second multi-dimensional feature index of the first unique keyword is fused to obtain a third fusion value; The degree of difference is obtained based on the third fusion value and the number of first keywords in the target SMS message.
[0127] Optionally, the process of fusing the second multi-dimensional feature indicators of the first unique keyword to obtain a third fusion value includes: The third fusion value is obtained by multiplying the second multi-dimensional feature indicators of all the first unique keywords.
[0128] Optionally, obtaining the difference degree based on the third fusion value and the number of first keywords in the target SMS message includes: The difference degree is obtained by dividing the third fusion value by the number of first keywords in the target SMS.
[0129] Optionally, the second multi-dimensional feature index includes: The number of the first unique keywords; The Jaccard similarity coefficient between the set composed of the first keyword and the set composed of the second keyword; The average sentiment value of the first unique keyword; The average risk of the first unique keyword.
[0130] Optionally, the sentiment average of the first unique keyword is obtained through the following steps: The sentiment value of the first unique keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values; The sentiment values of all the first unique keywords are averaged to obtain the average sentiment value of the first unique keyword.
[0131] Optionally, the average risk of the first unique keyword is obtained through the following steps: The risk value of the first unique keyword is obtained through a preset risk identification model; wherein, the risk identification model includes the correspondence between keywords and risk values; The average risk value of all the first unique keywords is calculated by averaging them.
[0132] Optionally, the semantic similarity is obtained at least based on a first semantic similarity, which is acquired through the following steps: The target SMS and the SMS template are represented by semantic vectors to obtain a first semantic vector representation and a second semantic vector representation. Calculate the first probability distribution of the first semantic vector representation in each of its own semantic units; Calculate the second probability distribution of the second semantic vector representation in each of its own semantic units; Calculate the JS divergence based on the first probability distribution and the second probability distribution; The first semantic similarity is obtained based on the JS divergence.
[0133] Optionally, the semantic similarity is obtained at least based on a second semantic similarity, which is acquired through the following steps: The target SMS message and the SMS message template are input into a preset semantic similarity model to obtain the second semantic similarity; wherein, the semantic similarity model is trained from sentence samples.
[0134] Optionally, obtaining the consistency check result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity includes: If the matching degree is greater than a preset matching degree threshold, the difference degree is less than a preset difference degree threshold, and the semantic similarity is greater than a preset semantic similarity threshold, then the target SMS message passes the consistency check.
[0135] Optionally, the preset matching threshold is determined by at least one of the SMS type, sending scenario, and user group.
[0136] Optionally, the preset difference threshold is determined by at least one of the SMS type, sending scenario, and user group.
[0137] Optionally, the preset semantic similarity threshold is determined by at least one of the following: SMS type, sending scenario, and user group.
[0138] Optionally, before identifying the first keyword of the target SMS and the second keyword of the SMS template, the device further includes: A preprocessing module is used to obtain the original target SMS and the original SMS template; preprocess the original target SMS to obtain the target SMS; and preprocess the original SMS template to obtain the SMS template.
[0139] Optionally, the device further includes: The registration module is used to register the real names of the users who wrote the original SMS template. The authorization module is used to manage the authorization of users and applications that use the SMS template.
[0140] It is worth noting that the working process of each module in the SMS consistency verification device 10 described in this application embodiment can refer to the working process of the SMS consistency verification method described in the above embodiment and achieve the same beneficial effect, and will not be repeated here.
[0141] Furthermore, this application also provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to perform the SMS consistency verification method as described in any of the above embodiments.
[0142] Furthermore, this application also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the SMS consistency verification method as described in any of the above embodiments.
[0143] See Figure 3 , Figure 3This is a structural block diagram of an SMS consistency verification device 20 provided in an embodiment of this application. The SMS consistency verification device 20 includes: a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, it implements the steps in the above-described SMS consistency verification method embodiments. Alternatively, when the processor 21 executes the computer program, it implements the functions of each module / unit in the above-described device embodiments.
[0144] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the SMS consistency verification device 20.
[0145] The SMS consistency verification device 20 may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art will understand that the schematic diagram is merely an example of the SMS consistency verification device 20 and does not constitute a limitation on the device. It may include more or fewer components than illustrated, or combine certain components, or use different components. For example, the SMS consistency verification device 20 may also include input / output devices, network access devices, buses, etc.
[0146] The processor 21 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor 21 is the control center of the SMS conformance verification device 20, connecting all parts of the SMS conformance verification device 20 via various interfaces and lines.
[0147] The memory 22 can be used to store the computer programs and / or modules. The processor 21 implements various functions of the SMS consistency verification device 20 by running or executing the computer programs and / or modules stored in the memory 22 and calling the data stored in the memory 22. The memory 22 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0148] The modules / units integrated into the SMS consistency verification device 20, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processor 21, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.
[0149] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0150] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.
Claims
1. A method for verifying SMS consistency, characterized in that, include: Identify the primary keyword of the target SMS message and the secondary keyword of the SMS template; Based on the first keyword and the second keyword, determine the common keywords between the target SMS and the SMS template, as well as the first unique keyword of the target SMS compared to the SMS template; Based on the shared keywords, calculate the matching degree between the target SMS and the SMS template; Based on the first unique keyword, calculate the degree of difference between the target SMS and the SMS template; Calculate the semantic similarity between the target SMS and the SMS template; The consistency test result of the target SMS is obtained based on the matching degree, the difference degree, and the semantic similarity.
2. The SMS consistency verification method as described in claim 1, characterized in that, The step of calculating the matching degree between the target SMS and the SMS template based on the shared keywords includes: Calculate the first multi-dimensional feature index of the second keyword; The first multi-dimensional feature indicators of the common keywords are fused to obtain a first fusion value; The first multi-dimensional feature index of the second keyword is fused to obtain the second fusion value; The matching degree is obtained based on the first fusion value and the second fusion value.
3. The SMS consistency verification method as described in claim 2, characterized in that, The step of fusing the first multi-dimensional feature indicators of the common keywords to obtain a first fusion value includes: For each of the common keywords, the first multi-dimensional feature indicators of the common keywords are multiplied together to obtain the first product result; The first product results of all the shared keywords are added together to obtain the first fusion value.
4. The SMS consistency verification method as described in claim 2, characterized in that, The step of fusing the first multi-dimensional feature indicators of the second keyword to obtain the second fusion value includes: For each of the second keywords, the first multidimensional feature indicators of the second keywords are multiplied together to obtain the second product result; The second product results of all the second keywords are added together to obtain the second fusion value.
5. The SMS consistency verification method as described in claim 2, characterized in that, The step of obtaining the matching degree based on the first fusion value and the second fusion value includes: The matching degree is obtained by dividing the first fusion value by the second fusion value.
6. The SMS consistency verification method as described in claim 2, characterized in that, The first multi-dimensional feature index includes: The term frequency-inverse document frequency of the second keyword; The similarity between the second keyword and the SMS template; The contextual relevance of the second keyword; The sentiment value of the second keyword.
7. The SMS consistency verification method as described in claim 6, characterized in that, The term frequency-inverse document frequency of the second keyword was calculated using the TF-IDF algorithm.
8. The SMS consistency verification method as described in claim 6, characterized in that, The similarity between the second keyword and the SMS template is calculated using the BM25 algorithm.
9. The SMS consistency verification method as described in claim 6, characterized in that, The contextual relevance of the second keyword is obtained through the following steps; Construct a word co-occurrence matrix of all the second keyword and its surrounding words; The frequency of occurrence of the second keyword is calculated based on the word co-occurrence matrix and used as the contextual relevance of the second keyword.
10. The SMS consistency verification method as described in claim 6, characterized in that, The sentiment value of the second keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values.
11. The SMS consistency verification method as described in claim 1, characterized in that, The step of calculating the difference between the target SMS and the SMS template based on the first unique keyword includes: Calculate the second multi-dimensional feature index of the first unique keyword; The second multi-dimensional feature index of the first unique keyword is fused to obtain a third fusion value; The degree of difference is obtained based on the third fusion value and the number of first keywords in the target SMS message.
12. The SMS consistency verification method as described in claim 11, characterized in that, The process of fusing the second multi-dimensional feature indicators of the first unique keyword to obtain a third fusion value includes: The third fusion value is obtained by multiplying the second multi-dimensional feature indicators of all the first unique keywords.
13. The SMS consistency verification method as described in claim 11, characterized in that, The process of obtaining the difference degree based on the third fusion value and the number of first keywords in the target SMS message includes: The difference degree is obtained by dividing the third fusion value by the number of first keywords in the target SMS.
14. The SMS consistency verification method as described in claim 11, characterized in that, The second multi-dimensional feature index includes: The number of the first unique keywords; The Jaccard similarity coefficient between the set composed of the first keyword and the set composed of the second keyword; The average sentiment value of the first unique keyword; The average risk of the first unique keyword.
15. The SMS consistency verification method as described in claim 14, characterized in that, The sentiment average of the first unique keyword is obtained through the following steps: The sentiment value of the first unique keyword is obtained through a preset sentiment recognition model; wherein, the sentiment recognition model includes the correspondence between keywords and sentiment values; The sentiment values of all the first unique keywords are averaged to obtain the average sentiment value of the first unique keyword.
16. The SMS consistency verification method as described in claim 14, characterized in that, The average risk of the first unique keyword is obtained through the following steps: The risk value of the first unique keyword is obtained through a preset risk identification model; wherein, the risk identification model includes the correspondence between keywords and risk values; The average risk value of all the first unique keywords is calculated by averaging them.
17. The SMS consistency verification method as described in claim 1, characterized in that, The semantic similarity is obtained at least based on a first semantic similarity, which is acquired through the following steps: The target SMS and the SMS template are represented by semantic vectors to obtain a first semantic vector representation and a second semantic vector representation. Calculate the first probability distribution of the first semantic vector representation in each of its own semantic units; Calculate the second probability distribution of the second semantic vector representation in each of its own semantic units; Calculate the JS divergence based on the first probability distribution and the second probability distribution; The first semantic similarity is obtained based on the JS divergence.
18. The SMS consistency verification method as described in claim 1, characterized in that, The semantic similarity is obtained at least based on a second semantic similarity, which is acquired through the following steps: The target SMS message and the SMS message template are input into a preset semantic similarity model to obtain the second semantic similarity; wherein, the semantic similarity model is trained from sentence samples.
19. The SMS consistency verification method as described in claim 1, characterized in that, The step of obtaining the consistency test result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity includes: If the matching degree is greater than a preset matching degree threshold, the difference degree is less than a preset difference degree threshold, and the semantic similarity is greater than a preset semantic similarity threshold, then the target SMS message passes the consistency check.
20. The SMS consistency verification method as described in claim 19, characterized in that, The preset matching threshold is determined by at least one of the following: SMS type, sending scenario, and user group.
21. The SMS consistency verification method as described in claim 19, characterized in that, The preset difference threshold is determined by at least one of the following: SMS type, sending scenario, and user group.
22. The SMS consistency verification method as described in claim 19, characterized in that, The preset semantic similarity threshold is determined by at least one of the following: SMS type, sending scenario, and user group.
23. The SMS consistency verification method as described in claim 1, characterized in that, Before identifying the first keyword of the target SMS and the second keyword of the SMS template, the method further includes: Obtain the original target SMS message and the original SMS message template; The original target SMS message is preprocessed to obtain the target SMS message; The original SMS template is preprocessed to obtain the SMS template.
24. The SMS consistency verification method as described in claim 23, characterized in that, The method further includes: Users who create the original SMS template must register with their real names. Authorization management is implemented for users and applications using the aforementioned SMS template.
25. A text message consistency verification device, characterized in that, include: The identification module is used to identify the first keyword of the target SMS message and the second keyword of the SMS template. The determining module is used to determine, based on the first keyword and the second keyword, common keywords between the target SMS and the SMS template, and a first unique keyword of the target SMS compared to the SMS template; The first calculation module is used to calculate the matching degree between the target SMS and the SMS template based on the shared keywords; The second calculation module is used to calculate the degree of difference between the target SMS and the SMS template based on the first unique keyword; The third calculation module is used to calculate the semantic similarity between the target SMS and the SMS template; The verification module is used to obtain the consistency verification result of the target SMS message based on the matching degree, the difference degree, and the semantic similarity.
26. A text message consistency verification device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements the SMS consistency verification method as described in any one of claims 1 to 24.
27. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform the SMS consistency verification method as described in any one of claims 1 to 24.
28. A computer program product, characterized in that, It includes a computer program / instruction that, when executed by a processor, implements the SMS consistency verification method as described in any one of claims 1 to 24.