SMS management policy generation method, device, electronic device and storage medium
By constructing a keyword knowledge graph and combining character substring extraction and matching, a text message interception strategy is generated, which solves the problem of low accuracy in identifying spam text messages in existing technologies and achieves efficient interception of new variant spam text messages.
Patent Information
- Application Number
- CN202311546858.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-11-20
AI Technical Summary
Existing SMS content analysis technologies are inaccurate in identifying spam SMS messages and are unable to effectively block new variants of spam SMS messages.
A keyword knowledge graph is constructed. Based on the pre-defined keywords and their variants, extensions, and substitutions, the relationship between them is analyzed through character substring extraction and matching to identify and generate SMS blocking strategies.
It improves the accuracy of spam SMS blocking, enabling it to quickly identify and block new variants of spam SMS.
Smart Images

Figure CN118803604B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a method, apparatus, electronic device, and storage medium for generating SMS management strategies. Background Technology
[0002] SMS messages are used for daily communication, business promotion, and notifications. However, they are also used by criminals to send illegal information, causing annoyance to users and even financial losses. Therefore, analyzing SMS content and identifying spam messages is essential. Existing SMS content analysis techniques mainly include: 1. SMS text classification technology: AI models can be used to classify SMS messages. These models are supervised models, using a trained model to extract features of the current SMS message and classify it into its appropriate category. 2. SMS text clustering technology: Unsupervised text clustering compares the similarity of a large number of SMS messages and groups messages with high similarity into the same category. Text clustering algorithms are suitable for processing big data and analyzing texts with many categories and high uncertainty. 3. Keyword combination strategy analysis: Keyword combination strategies are formulated by experienced strategy experts and contain experiential knowledge for identifying spam messages. Text classification technology is suitable for texts with obvious classification features; however, SMS texts are short and feature-sparse, making it difficult to achieve good classification results. Moreover, the features of spam SMS messages often change, and new spam SMS content emerges, leading to changes in SMS text features and a deterioration in classification results. Text clustering technology is suitable for offline analysis of large amounts of SMS text. However, spam messages contain a variety of keyword variations, which may cause spam messages belonging to the same category to be grouped into different categories during clustering. Keyword combination strategies use "AND" and "OR" logic to match keywords appearing in SMS messages to identify spam. However, in the era of artificial intelligence, criminals use automated methods to generate numerous and rapidly changing combinations of malicious keyword variations. It is difficult for humans to discover new variant words or alternative words in time and configure them into strategies, resulting in missed SMS messages containing new variations. As a result, the accuracy of current spam SMS interception is low. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, and storage medium for generating SMS management strategies to solve the problem of low accuracy in current spam SMS interception.
[0004] In a first aspect, embodiments of this application provide a method for generating SMS management policies, including:
[0005] Get pending SMS messages;
[0006] Based on the SMS message to be processed, character substrings are extracted to obtain a substring set;
[0007] Keyword matching is performed based on the subset and the keyword knowledge graph to obtain the target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words.
[0008] A text message interception strategy is determined based on the target keywords and the keyword knowledge graph, and text messages are intercepted based on the text message interception strategy.
[0009] In one embodiment, the step of matching keywords based on the subset and the keyword knowledge graph to obtain target keywords includes:
[0010] Obtain keyword knowledge graph;
[0011] In the keyword knowledge graph, variant character matching is performed on the character substrings in the substring set to obtain the first candidate keyword;
[0012] If at least one target character substring fails to match in the variant character matching, then character similarity matching is performed based on each target character substring to obtain a second candidate keyword;
[0013] Based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, at least one initial keyword is determined;
[0014] Based on the initial keywords, keyword matching is performed to obtain the target keywords.
[0015] In one embodiment, the step of performing character similarity matching based on each of the target character substrings to obtain a second candidate keyword includes:
[0016] The character rarity is detected for each of the target character substrings to obtain character rarity information;
[0017] Determine rare substrings based on the character rarity information;
[0018] Based on the character similarity matching of the uncommon substring, a second candidate keyword is obtained.
[0019] In one embodiment, the step of performing character similarity matching based on the uncommon substring to obtain the second candidate keyword includes:
[0020] Construct a dictionary of keyword pinyin and stroke order based on keyword knowledge graph;
[0021] Based on the pinyin and stroke order dictionary, homophone and similar-looking substrings are matched to obtain second candidate keywords.
[0022] In one embodiment, the step of extracting a substring from the SMS message to be processed to obtain a substring set includes:
[0023] The SMS message to be processed is cleaned of invalid characters to obtain the target string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons.
[0024] The target string is split into characters, and the resulting substrings form a set of substrings.
[0025] In one embodiment, the step of performing keyword matching based on each of the initial keywords to obtain target keywords includes:
[0026] Determine the character position information of each character in the target string corresponding to the SMS message to be processed;
[0027] Determine the start and end positions of the initial keyword in the target string;
[0028] Based on the initial keywords and their start and end position information, the target string and its character position information, a global optimal word combination detection is performed to obtain the target keywords.
[0029] In one embodiment, after obtaining the target keyword by keyword matching based on the subset and the keyword knowledge graph, the method further includes:
[0030] The target keywords are expanded into the keyword knowledge graph.
[0031] Secondly, embodiments of this application provide a text message management strategy generation device, comprising:
[0032] The acquisition module is used to acquire SMS messages to be processed.
[0033] The extraction module is used to extract character substrings based on the SMS message to be processed, and obtain a substring set;
[0034] The matching module is used to perform keyword matching based on the subset and the keyword knowledge graph to obtain the target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words;
[0035] The determination module is used to determine an SMS interception strategy based on the target keywords and the keyword knowledge graph, and to intercept SMS messages based on the SMS interception strategy.
[0036] Thirdly, embodiments of this application provide an electronic device, including a processor and a memory storing a computer program, wherein the processor executes the program to implement the SMS management strategy generation method described in the first aspect.
[0037] Fourthly, embodiments of this application provide a storage medium, which is a computer-readable storage medium including a computer program. When the computer program is executed by a processor, it implements the SMS management strategy generation method described in the first aspect.
[0038] The SMS management strategy generation method, apparatus, electronic device, and storage medium provided in this application embodiment, through a keyword knowledge graph constructed from preset keywords and their variants, extensions, and substitutions, combined with keyword matching of substring sets extracted from the character substrings of the SMS to be processed, can quickly and accurately identify new keywords formed by variants, extensions, or substitutions of keywords in the SMS to be processed. Then, based on the matched target keywords and the keyword knowledge graph, an SMS blocking strategy can be quickly and accurately determined, making it convenient for relevant personnel to refer to the SMS blocking strategy for spam SMS blocking, thus improving the accuracy of spam SMS blocking. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a flowchart illustrating the SMS management strategy generation method provided in an embodiment of this application;
[0041] Figure 2 This is a schematic diagram of a scenario for the SMS management policy generation method provided in an embodiment of this application;
[0042] Figure 3 This is a schematic diagram of the functional modules of an embodiment of the SMS management strategy generation device of this application;
[0043] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0044] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0045] The following examples and... Figures 1-4The present invention provides a detailed description of the SMS management strategy generation method, apparatus, electronic device, and storage medium provided by the present invention.
[0046] in, Figure 1 A flowchart illustrating the SMS management strategy generation method provided in this application embodiment; Figure 2 This is a schematic diagram illustrating a scenario for the SMS management strategy generation method provided in an embodiment of this application.
[0047] Specifically, refer to Figure 1 This application provides a method for generating SMS management policies, which may include:
[0048] Step 100: Obtain the SMS messages to be processed;
[0049] It should be noted that the device identification method provided in this application can be executed by a server, computer equipment, such as a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic equipment, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA). The server or computer equipment in this application may be equipped with or connected to an SMS management policy generation device, and the SMS management policy generation method of this application can be completed by controlling the SMS management policy generation device.
[0050] The pending text messages in this application can be either those containing prohibited words or those not containing prohibited words. Pending text messages can also be those identified as spam.
[0051] Step 200: Extract character substrings from the SMS message to be processed to obtain a substring set;
[0052] This application can preprocess SMS messages, specifically by performing data cleaning, and then using the remaining characters after cleaning to form a target string.
[0053] Furthermore, the target string is segmented according to different combinations of characters, dividing it into multiple character substrings, and then forming a substring set from these substrings.
[0054] Step 300: Perform keyword matching based on the subset and keyword knowledge graph to obtain the target keywords;
[0055] It should be noted that this application can construct a keyword knowledge graph based on pre-defined keywords of prohibited terms. In this application, the pre-defined keywords of prohibited terms can be words summarized based on human experience.
[0056] Specifically, a keyword knowledge graph can be constructed by pre-setting keywords and the relationships between keywords. The relationships between keywords include variations, substitutions, and extensions.
[0057] This application utilizes statistical analysis and keyword combination strategies to determine the relationships between keywords, thereby constructing a keyword knowledge graph. In this application, the edges between two keywords in the keyword knowledge graph are unidirectional.
[0058] Given a set of keyword combination strategies S, using strategies (A|B|C) & (D) as examples, we introduce the concepts of keyword variants, substitutions, and extended relationships.
[0059] Keyword variant relationship: If two keywords A and B, where A is a common word and B contains some or all characters different from A, but share the same pinyin or similar character shape, and a person can associate B with the meaning of A, then there is a variant relationship between the two keywords. The common word A is the subject (with the highest word frequency, obtained by statistical analysis of the keyword combination strategy set S), and B is the variant word, with the direction pointing from the subject to the variant.
[0060] Keyword substitution relationship: If two keywords A and C have an "OR" logic in the keyword combination strategy, belong to the same spam SMS theme, and have a high cosine similarity of vectors, then A and C are substitutes for each other, with the direction from the higher frequency word to the lower frequency word.
[0061] Keyword Derivative Relationship: If two keywords A and D have an "AND" logic in the keyword combination strategy, and their frequency of occurrence in the strategy keyword set is less than a certain threshold, then there is a derivative relationship between A and D, with the direction pointing from the keyword with lower frequency to the keyword with higher frequency.
[0062] Therefore, this application can first perform precise matching between each character substring in the substring set and the keyword entries in the keyword knowledge graph, and use the successfully matched character substring as the first candidate keyword.
[0063] Furthermore, since variant spam messages contain a wide variety of variant keywords, these variant keywords generally include uncommon characters, and each Chinese character in the variant keyword has the same pinyin or similar shape as the corresponding Chinese character in the main word, no new variant keywords can be found through exact matching. Therefore, for character substrings in the substring set that fail to match, fuzzy matching algorithms can be used to further match the keyword entries in the keyword knowledge graph to discover new variant keywords, and the matched keywords are identified as second candidate keywords.
[0064] Furthermore, based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, a dynamic programming algorithm can be used to find the best word combination, and the resulting keyword can be determined as the target keyword.
[0065] It should be noted that after obtaining the target keywords through keyword matching based on subsets and keyword knowledge graphs, the process also includes:
[0066] Expand the target keywords into the keyword knowledge graph.
[0067] After obtaining the target keywords, this application can automatically expand the target keywords into the keyword knowledge graph to enrich the keyword knowledge in the keyword knowledge graph, which helps to enhance the ability to identify new variants of spam text messages.
[0068] Step 400: Determine SMS blocking strategies based on target keywords and keyword knowledge graphs, and then use these strategies to block SMS messages.
[0069] After obtaining the target keywords, this application can use a keyword knowledge graph as a basis to query the related words such as variations, extensions and substitutions of the target keywords, and generate SMS blocking strategies that can block new variations of SMS messages. This allows strategy specialists to refer to the strategies when formulating them, thereby improving the efficiency and quality of strategy formulation.
[0070] The SMS management strategy generation method provided in this application provides a keyword knowledge graph constructed from preset keywords and their variants, extensions, and alternative related words. By combining this knowledge graph with the substring set obtained by extracting character substrings from the SMS to be processed, keyword matching can be performed. This method can quickly and accurately identify new keywords formed by variants, extensions, or substitutions of existing keywords in the SMS to be processed. Furthermore, based on the matched target keywords and the keyword knowledge graph, an SMS blocking strategy can be quickly and accurately determined. This makes it easier for relevant personnel to refer to the SMS blocking strategy to block spam SMS messages, thus improving the accuracy of spam SMS blocking.
[0071] In one embodiment, character substring extraction is performed based on the SMS message to be processed to obtain a substring set, including:
[0072] Step 201: Clean up invalid characters in the SMS message to be processed to obtain the target string;
[0073] Step 202: Perform character segmentation on the target string, and form a substring set from the resulting character substrings.
[0074] After obtaining the SMS message to be processed, this application can perform data cleaning on invalid characters in the SMS message. Invalid characters include at least one of punctuation marks, English symbols, and emoticons.
[0075] Specifically, this application can remove punctuation marks, English symbols, and emoticons from the SMS message to be processed, retaining only Chinese characters, and forming the target string from the remaining Chinese characters.
[0076] Furthermore, the K-shingle technique can be used to split the target string into character segments, forming a set of substrings from the resulting segments. K-shingle is a text processing technique used to break text data into consecutive short segments.
[0077] In this application, for the target string, a shingle can be taken for every K consecutive characters. A K-shingle is the set of all substrings consisting of K consecutive characters. In one embodiment, the 2-shingle, 3-shingle, and 4-shingle of the target string can be extracted.
[0078] This embodiment removes noise by cleaning the data and extracts key features by performing K-shingle extraction, making the character substrings in the obtained substring set more accurate. This, in turn, makes the SMS blocking strategy determined based on the substring set more accurate, which helps to improve the accuracy of spam SMS blocking.
[0079] Furthermore, keyword matching is performed based on subsets and a keyword knowledge graph to obtain target keywords, including:
[0080] Step 301: Obtain the keyword knowledge graph;
[0081] Step 302: In the keyword knowledge graph, perform variant character matching on the character substrings in the substring set to obtain the first candidate keyword;
[0082] Step 303: If there is at least one target character substring that fails to match in the variant character matching, then perform character similarity matching based on each target character substring to obtain the second candidate keyword;
[0083] Step 304: Based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, determine at least one initial keyword;
[0084] Step 305: Perform keyword matching based on each initial keyword to obtain the target keyword.
[0085] This application allows access to a pre-constructed keyword knowledge graph.
[0086] Furthermore, for 2-shingle, 3-shingle, and 4-shingle substrings in the substring set, precise matching can be performed with the entries of preset keywords in the keyword knowledge graph. If the precisely matched entry is a variant of a keyword in the keyword knowledge graph, the entry is automatically restored to the keyword itself through the variant relationship and used as the first candidate keyword. Among these, the successfully matched entries serve as important keyword features for subsequent SMS analysis.
[0087] Furthermore, for at least one target character substring that fails to match during the variant character matching process, similarity matching based on homophones or similar shapes can be performed on each target character substring to obtain a second candidate keyword.
[0088] Furthermore, if only the first candidate keyword is matched based on the subset, then the first candidate keyword is used as the initial keyword.
[0089] If a first candidate keyword and a second candidate keyword are obtained based on substring matching, then the first candidate keyword and the second candidate keyword are used together as the initial keyword.
[0090] Furthermore, a dynamic programming algorithm can be used to find the best word combination from the initial keywords. Specifically, from the initial keywords of exact match and fuzzy match, the word combination with the highest sum of characters in the matching SMS message can be found as the target keyword.
[0091] This embodiment extracts a set of substrings from the text messages to be processed and combines them with a keyword knowledge graph for keyword matching. This allows for the rapid and accurate identification of new keywords formed by variations, extensions, or substitutions of existing keywords in the text messages. Furthermore, based on the matched target keywords and the keyword knowledge graph, a text message blocking strategy can be quickly and accurately determined. This facilitates the use of the text message blocking strategy by relevant personnel to intercept spam messages, thereby improving the accuracy of spam message blocking.
[0092] Furthermore, based on the similarity matching of each target character substring, second candidate keywords are obtained, including:
[0093] Step 3031: Perform character rarity detection on each target character substring to obtain character rarity information;
[0094] Step 3032: Determine rare substrings based on character rarity information;
[0095] Step 3033: Perform character similarity matching based on uncommon substrings to obtain the second candidate keyword.
[0096] This application utilizes fuzzy matching algorithms to further match keyword entries in a knowledge graph and discover novel variant keywords. Specifically, it involves two steps: filtering substrings containing uncommon characters and fuzzy matching based on homophones and similar-looking characters.
[0097] Specifically, there are:
[0098] Step 1: Filtering Substrings Containing Rare Characters: For each target character substring in the unmatched 2-shingle, 3-shingle, and 4-shingle sequences, the rarity of the character is calculated to determine if the substring contains a rare character. Substrings containing rare characters are retained (hereinafter referred to as rare substrings). Fuzzy keyword matching is then performed on all rare substrings. The formula for calculating the rarity of a character is shown below:
[0099]
[0100] Where ch represents any Chinese character, and n is the number of times the character ch appears in a common character dictionary. The common character dictionary can be constructed using an open-source news dataset. m is the critical frequency for distinguishing rare characters from common characters. When n is less than m, it is more likely to be a rare character. The rarity level of a Chinese character ranges from (0, 1], with values closer to 1 indicating higher rarity. Experiments showed that m was set to 20, and the rarity threshold was set to 0.4; that is, if the rarity level is greater than 0.4, the character is considered rare.
[0101] After obtaining the uncommon substrings, we can perform homophonic or similarity matching on each uncommon substring to obtain the second candidate keywords.
[0102] Furthermore, based on character similarity matching of uncommon substrings, second candidate keywords are obtained, including:
[0103] Step 30331: Construct a dictionary of the pinyin and stroke order of keywords based on the keyword knowledge graph;
[0104] Step 30332: Based on the dictionary of pinyin and stroke order, perform homophony and similarity matching on rare substrings to obtain the second candidate keyword.
[0105] Furthermore, we have:
[0106] Step 2: Fuzzy matching of homophones and similar-looking variant words: For the uncommon substrings selected in Step 1, the fuzzy matching method of homophones and similar-looking variant words is used to automatically discover variant keywords.
[0107] Specifically, first, all central node words (i.e., keywords) in the keyword knowledge graph are extracted to construct a dictionary of pinyin and stroke order sequences. Then, homophonic or shape-similar matching is performed on each rare substring. The matched ones are new variant words and are determined as the second candidate keywords. The shape similarity degree of two Chinese characters can be obtained by calculating the edit distance of the stroke order sequences of the two characters. If the edit distance is less than the set threshold (for example, 4), the two characters are considered similar. For example, the pinyin of the keyword entry "baccarat" in the keyword knowledge graph is "baijiale", and the pinyin of the rare substring "栢迦泺" is "baijialuo". Among the two words, "百家" and "栢迦" are homophonic matches, and "乐" and "泺" are shape-similar matches.
[0108] Examples of exact and fuzzy matching of keyword entries: Based on the keyword knowledge graph, exact and fuzzy matching of keyword entries are performed on 2-shingle, 3-shingle, and 4-shingle. The steps of exact matching hit the keywords: "preferential", "keep for reference", "address". Then, rare substrings are screened from the non-exactly matched substrings to obtain 2-shingle, 3-shingle, and 4-shingle containing rare characters; finally, "homophonic and shape-similar" variant word fuzzy matching is performed to obtain keyword variants.
[0109] This embodiment can automatically identify keywords in new variant spam messages based on the "homophonic and shape-similar" characteristics of variant keywords, so that the target keywords obtained by matching based on the identified keywords can be combined with the keyword knowledge graph to quickly and accurately determine the short message interception strategy, facilitating relevant personnel to refer to the short message interception strategy for spam message interception. Therefore, the accuracy of spam message interception can be improved.
[0110] In one embodiment, keyword matching is performed based on each initial keyword to obtain a target keyword, including:
[0111] Step 3051, determine the character position information of each character in the target string corresponding to the to-be-processed short message in the target string;
[0112] Step 3052, determine the start and end position information of the initial keyword in the target string;
[0113] Step 3053, based on each initial keyword and its start and end position information, the target string and its character position information, perform global best word combination detection to obtain the target keyword.
[0114] This application can use the dynamic programming algorithm to find the best word combination from each initial keyword as the target keyword.
[0115] In one embodiment, for the text message "Good news, [Company Name] limited-time offer, deposit 999 and enjoy up to 9999, address: ****.space", the set of keyword entries with exact matches is {offer, deposit, address}, and the set of variant keyword entries with fuzzy matches is {news, limited-time, enjoy, good news, [Company Name], limited-time offer}. Among them, there are overlapping words. For example, "news" and "good news", where "good news" is the best match, and "limited-time offer" and "deposit", where "limited-time offer" is the correct match.
[0116] The matching scheme for the best word combination should find a word combination in the set of keywords with exact and fuzzy matches (i.e., the initial keywords) that has the maximum sum of characters matched in the text message. Specifically, there are:
[0117] First, use the Aho-Corasick automaton to find the start and end positions of all candidate words (i.e., the initial keywords) in the preprocessed text message (i.e., the target string). And determine the character position information of each character in the target string corresponding to the text message to be processed in the target string.
[0118] Furthermore, based on each initial keyword and its start and end position information, the target string and its character position information, a table containing a digital matrix can be generated.
[0119] The first column of the table is all the initial keywords and their start and end positions. The initial keywords are arranged in ascending order of the start position. When the start positions of two initial keywords are the same, they are arranged in ascending order of the end position. The second row of the table is the position labels of the text message, and the first row is the content of the preprocessed text message (i.e., the target string). For example: for the entry "good news", the start position index in the preprocessed text message sequence is 0, and the end position index is 2, so the start and end positions of "good news" are recorded as (0, 3), which is the notation in list form. Similarly, the start and end positions of "news" are (1, 3).
[0120] In one embodiment, a 9*17 digital matrix can be formed in the table. The element value at the i-th row and j-th column of the matrix is denoted as a i,j , representing that when the text message content is from the 0th position to the j-th position, and the keywords to be matched are the first 0th word to the i-th word, the maximum sum of characters matched in the text message. For example, a 0,0 = 0, representing that when the text message content is "good", and the only keyword to be matched is "good news", the maximum sum of characters matched in the text message is 0. And a 1,2 = 3, representing that when the text message is "good news", and the keywords to be matched are "good news" and "news", the maximum sum of characters matched in the text message is 3. It can be obtained that after filling this digital matrix, the value in the lower right corner a 8,16It is the maximum value of the sum of the characters in the text message that can be matched by all the words to be matched.
[0121] The digital matrix can be gradually filled through the following recurrence formula:
[0122] For the 0th row (i = 0) of the digital matrix:
[0123] When j < end(w0), a 0,j = 0; It means that there is no matching word at this time, and the sum of the characters matched in the text message is equal to 0;
[0124] When j = end(w0), a 0,j = len(w0); It means that the first word is successfully matched, and the sum of the characters matched in the text message at this time is equal to the total number of characters of this word;
[0125] When j > end(w0), a 0,j = a 0,j-1 ; It means that after the word being matched ends in the text message, there is no word to be matched in the 0th row, and the sum of the characters matched in the text message no longer changes at this time.
[0126] Where a 0,j represents the element in the 0th row and the jth column of the digital matrix; w0 represents the 0th word to be matched, which is "好消螅" in this example; end(w0) is the ending position of the word w0. For example, the ending position of "好消螅(0, 3)" is 3 - 1 = 2; len(w0) is the number of characters of the word w0, which is 3.
[0127] For the ith row (i > 0) of the digital matrix, there is the following recurrence formula:
[0128] When j < end(w j ), a i,j = a i-1,j ; It means that when the word w j has not been successfully matched, the sum of the characters matched in the text message at this time is equal to the matching status of the jth column in the previous row.
[0129] When j = end(w j ), if k = j - len(w j ) < 0, a i,j = len(w j ), otherwise a i,j = max{a i,k + len(w j ), a i-1,j}; It means that the word w j is successfully matched. At this time, it is necessary to compare and select the sum of the characters in the text message when the word w j is selected with the sum of the characters in the text message when the word w j is not selected. a i,jChoose the larger value;
[0130] When j>end(w) j When ), a i,j =a i,j-1 The semicolon indicates that when the matched word ends in the text message, the sum of the matched characters in the text message equals the value to its left.
[0131] After filling in the number matrix, you can backtrack from the bottom right corner of the matrix, first from top to left (i.e., first check if the word in the current row is selected; if selected, backtrack forward to remove the length of the current word and continue checking) to output the best word combination. Let's assume the current element value is 'a'. ij :
[0132] 1. If a i-1,j =a i,j Then i = i - 1. This process continues until a... i-1, j≠a i,j ;
[0133] 2. If a i,j-1 =a i,j Then j = j-1. This cycle continues until a... i,j-1 ≠a i,j At this point, the word in the i-th row is selected as a candidate word, and the output is w. i At this point, let j = j - len(w) i Then repeat steps 1 and 2 above until the top left corner of the number matrix is reached.
[0134] Through the above loop, several optimal word combinations can be output as target keywords.
[0135] This embodiment uses a dynamic programming algorithm to find the best word combination from each initial keyword as the target keyword. It can quickly and accurately identify new keywords formed by variations, extensions, or substitutions of keywords in the SMS messages to be processed. Then, based on the matched target keywords and the keyword knowledge graph, it can quickly and accurately determine the SMS blocking strategy, which is convenient for relevant personnel to refer to the SMS blocking strategy to block spam SMS messages. Therefore, it can improve the accuracy of spam SMS blocking.
[0136] Figure 2 This is a schematic diagram illustrating a scenario for the SMS management policy generation method provided in this application embodiment, with reference to... Figure 2 In one embodiment, the SMS management policy generation method of this application may include the following steps:
[0137] The system retrieves an input text message, removes punctuation, English text, emoticons, etc., and retains only Chinese characters, thus completing the text message preprocessing.
[0138] Furthermore, K-shingles are extracted from the preprocessed SMS messages. Character substrings extracted from the K-shingle set are precisely matched with keyword entries in the keyword knowledge graph, and fuzzy matching of keyword entries is performed on character substrings that do not match precisely.
[0139] For the keyword sets of exact matching and fuzzy matching, a dynamic programming algorithm is used to find the best word combination as the target keyword.
[0140] Furthermore, the target keywords are automatically expanded into the keyword knowledge graph as variant knowledge of the knowledge graph.
[0141] Furthermore, based on the keyword knowledge graph, the system queries the variants, extensions, and alternative relational words of the target keywords, automatically generates SMS blocking strategies that can block new variant SMS messages, and then ends the process. This information is provided for strategy specialists to refer to when formulating strategies, thereby improving the efficiency and quality of strategy formulation.
[0142] The SMS management strategy generation method of this application can overcome the shortcomings of SMS classification and clustering techniques, which suffer from poor classification and clustering effects due to the sparse and scattered features of short texts. In addition, it can automatically analyze SMS text by utilizing the knowledge of keyword variations, substitutions, and extensions in keyword knowledge graphs, discover new variant words in SMS, and automatically generate strategies to block new variant SMS for strategy specialists to refer to, thereby improving the efficiency of strategy formulation and enhancing the recall and precision of the strategies.
[0143] Furthermore, this application also provides a text message management strategy generation device.
[0144] Reference Figure 3 , Figure 3 This is a schematic diagram of the functional modules of an embodiment of the SMS management strategy generation device of this application.
[0145] The SMS management policy generation device includes:
[0146] Module 310 is used to acquire SMS messages to be processed;
[0147] Extraction module 320 is used to extract character substrings based on the SMS message to be processed, and obtain a substring set;
[0148] The matching module 330 is used to perform keyword matching based on the subset and the keyword knowledge graph to obtain the target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words;
[0149] The determination module 340 is used to determine an SMS interception strategy based on the target keyword and the keyword knowledge graph, so as to intercept SMS messages based on the SMS interception strategy.
[0150] The SMS management strategy generation device provided in this application embodiment uses a keyword knowledge graph constructed from preset keywords and their variants, extensions, and alternative related words. Combined with keyword matching of the substring set obtained by extracting character substrings from the SMS to be processed, it can quickly and accurately identify new keywords formed by variants, extensions, or substitutions of keywords in the SMS to be processed. Then, based on the matched target keywords and the keyword knowledge graph, it can quickly and accurately determine the SMS blocking strategy, making it convenient for relevant personnel to refer to the SMS blocking strategy to block spam SMS, thus improving the accuracy of spam SMS blocking.
[0151] In one embodiment, the extraction module 320 is specifically used for:
[0152] The SMS message to be processed is cleaned of invalid characters to obtain the target string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons.
[0153] The target string is split into characters, and the resulting substrings form a set of substrings.
[0154] In one embodiment, the matching module 330 is specifically used for:
[0155] Obtain keyword knowledge graph;
[0156] In the keyword knowledge graph, variant character matching is performed on the character substrings in the substring set to obtain the first candidate keyword;
[0157] If at least one target character substring fails to match in the variant character matching, then character similarity matching is performed based on each target character substring to obtain a second candidate keyword;
[0158] Based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, at least one initial keyword is determined;
[0159] Based on the initial keywords, keyword matching is performed to obtain the target keywords.
[0160] In one embodiment, the matching module 330 includes a first matching unit, the first matching unit being used for:
[0161] The character rarity is detected for each of the target character substrings to obtain character rarity information;
[0162] Determine rare substrings based on the character rarity information;
[0163] Based on the character similarity matching of the uncommon substring, a second candidate keyword is obtained.
[0164] In one embodiment, the matching module 330 includes a second matching unit, the second matching unit being used for:
[0165] Construct a dictionary of keyword pinyin and stroke order based on keyword knowledge graph;
[0166] Based on the pinyin and stroke order dictionary, homophone and similar-looking substrings are matched to obtain second candidate keywords.
[0167] In one embodiment, the matching module 330 includes a third matching unit, the third matching unit being used for:
[0168] Determine the character position information of each character in the target string corresponding to the SMS message to be processed;
[0169] Determine the start and end positions of the initial keyword in the target string;
[0170] Based on the initial keywords and their start and end position information, the target string and its character position information, a global optimal word combination detection is performed to obtain the target keywords.
[0171] In one embodiment, the matching module 330 is further configured to:
[0172] The target keywords are expanded into the keyword knowledge graph.
[0173] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440, wherein the processor 410, the communication interface 420, and the memory 430 communicate with each other via the communication bus 440. The processor 410 can call a computer program in the memory 430 to execute the steps of the SMS management policy generation method, such as including:
[0174] Get pending SMS messages;
[0175] Based on the SMS message to be processed, character substrings are extracted to obtain a substring set;
[0176] Keyword matching is performed based on the subset and the keyword knowledge graph to obtain the target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words.
[0177] A text message interception strategy is determined based on the target keywords and the keyword knowledge graph, and text messages are intercepted based on the text message interception strategy.
[0178] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0179] On the other hand, embodiments of this application also provide a storage medium, which is a computer-readable storage medium storing a computer program. The computer program is used to cause a processor to execute the steps of the methods provided in the above embodiments, including, for example:
[0180] Get pending SMS messages;
[0181] Based on the SMS message to be processed, character substrings are extracted to obtain a substring set;
[0182] Keyword matching is performed based on the subset and the keyword knowledge graph to obtain the target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words.
[0183] A text message interception strategy is determined based on the target keywords and the keyword knowledge graph, and text messages are intercepted based on the text message interception strategy.
[0184] The computer-readable storage medium can be any available medium or data storage device that the processor can access, including but not limited to magnetic storage (e.g., floppy disk, hard disk, magnetic tape, magneto-optical disk (MO)), optical storage (e.g., CD, DVD, BD, HVD), and semiconductor storage (e.g., ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)).
[0185] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. 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. Those skilled in the art can understand and implement this without any creative effort.
[0186] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for generating SMS management strategies, characterized in that, include: Get pending SMS messages; Based on the SMS message to be processed, character substrings are extracted to obtain a substring set; Based on the aforementioned subset of strings and the keyword knowledge graph, keyword matching is performed to obtain the target keywords; The keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words; A text message interception strategy is determined based on the target keywords and the keyword knowledge graph, and text messages are intercepted based on the text message interception strategy. The process of matching keywords based on the subset and the keyword knowledge graph to obtain target keywords includes: Obtain keyword knowledge graph; In the keyword knowledge graph, variant character matching is performed on the character substrings in the substring set to obtain the first candidate keyword; If at least one target character substring fails to match in the variant character matching, then character similarity matching is performed based on each target character substring to obtain a second candidate keyword; Based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, at least one initial keyword is determined; Based on the initial keywords, keyword matching is performed to obtain the target keywords.
2. The SMS management strategy generation method according to claim 1, characterized in that, The second candidate keyword is obtained by matching the similarity of characters based on each of the target character substrings, including: The character rarity is detected for each of the target character substrings to obtain character rarity information; Determine rare substrings based on the character rarity information; Based on the character similarity matching of the uncommon substring, a second candidate keyword is obtained.
3. The SMS management strategy generation method according to claim 2, characterized in that, The second candidate keyword is obtained by performing character similarity matching based on the rare substring, including: Construct a dictionary of keyword pinyin and stroke order based on keyword knowledge graph; Based on the pinyin and stroke order dictionary, homophone and similar-looking substrings are matched to obtain second candidate keywords.
4. The SMS management strategy generation method according to claim 1, characterized in that, The step of extracting character substrings based on the SMS message to be processed to obtain a substring set includes: The SMS message to be processed is cleaned of invalid characters to obtain the target string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons. The target string is split into characters, and the resulting substrings form a set of substrings.
5. The SMS management strategy generation method according to claim 4, characterized in that, The step of matching keywords based on the initial keywords to obtain target keywords includes: Determine the character position information of each character in the target string corresponding to the SMS message to be processed; Determine the start and end positions of the initial keyword in the target string; Based on the initial keywords and their start and end position information, the target string and its character position information, a global optimal word combination detection is performed to obtain the target keywords.
6. The SMS management strategy generation method according to any one of claims 1-5, characterized in that, After obtaining the target keywords by matching keywords based on the subset and the keyword knowledge graph, the process further includes: The target keywords are expanded into the keyword knowledge graph.
7. A text message management strategy generation device, characterized in that, include: The acquisition module is used to acquire SMS messages to be processed. The extraction module is used to extract character substrings based on the SMS message to be processed, and obtain a substring set; The matching module is used to perform keyword matching based on the subset of strings and the keyword knowledge graph to obtain the target keywords; The keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative related words; The determination module is used to determine an SMS interception strategy based on the target keywords and the keyword knowledge graph, so as to intercept SMS messages based on the SMS interception strategy; The matching module is specifically used to acquire a keyword knowledge graph; in the keyword knowledge graph, variant character matching is performed on the character substrings in the substring set to obtain a first candidate keyword; if there is at least one target character substring that fails to match in the variant character matching, then character similarity matching is performed based on each target character substring to obtain a second candidate keyword; based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, at least one initial keyword is determined. Based on the initial keywords, keyword matching is performed to obtain the target keywords.
8. An electronic device comprising a processor and a memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the SMS management strategy generation method according to any one of claims 1 to 6.
9. A storage medium, said storage medium being a computer-readable storage medium, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the SMS management strategy generation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method for realizing fuzzy matching of Chinese short message with keyword
CN102323929A
Text detection method, device, computer equipment and readable storage medium
CN113569041A