Short message management strategy generation method and device, electronic equipment and storage medium
By building a keyword knowledge graph and character substring matching technology, we can identify and intercept variants, extensions or alternative keywords in spam text messages, solving the problem of low spam text message interception accuracy in the existing technology and improving the efficiency of spam text message interception. accuracy.
Patent Information
- Application Number
- CN202311546858.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-11-20
AI Technical Summary
The existing spam SMS interception technology has low accuracy and is difficult to effectively identify variants, extensions or alternative keywords in spam SMS, resulting in missed interception of new variant SMS messages.
By constructing a keyword knowledge graph based on preset keywords and their variants, extensions, and alternative related words, extract character substrings based on the text messages to be processed, perform keyword matching, identify the target keywords, and determine the text message based on the matching results. Interception strategy.
It improves the accuracy of intercepting spam text messages, can quickly identify and intercept new keywords formed by keyword variations, extensions or substitutions, and enhances the ability to identify new variant spam text messages.
Smart Images

Figure CN118803604A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for generating a short message management strategy. Background Art
[0002] SMS is used for daily communication, business promotion, message notification and other aspects. However, SMS is also used by criminals to publish illegal information, which brings trouble to users and even causes property loss to users. Therefore, it is very necessary to analyze the content of SMS and identify spam SMS. The existing SMS content analysis technologies mainly include: 1. SMS text classification technology: artificial intelligence models can be used to classify SMS. This type of model is a supervised model. The trained model is used to extract the features of the current SMS and classify it into its category. 2. SMS text clustering technology: text clustering compares the similarity of a large number of SMS texts unsupervisedly, and clusters SMS texts 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: The keyword combination strategy is formulated by experienced strategy experts and contains experience and knowledge for identifying spam SMS. Text classification technology is suitable for texts with obvious classification features. However, SMS text content is short and features are sparse, making it difficult to achieve good classification results. Moreover, the features of spam SMS texts often evolve, and new spam SMS content appears. The change of SMS text features leads to poor classification results. Text clustering technology is suitable for offline analysis of large amounts of text messages. However, there are various keyword variants in variant spam text messages. When clustering, spam text messages that originally belonged to the same category may be clustered into different categories. The keyword combination strategy uses "and" and "or" logic to match keywords that appear in text messages to identify spam text messages. However, in the era of artificial intelligence, criminals use automated means to generate many combinations of bad keyword variants that change quickly. It is difficult for humans to discover new variant words or alternative words in a timely manner and configure them into strategies, resulting in the omission of text messages containing new variants. As a result, the current accuracy of spam text message interception is low. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device and storage medium for generating a short message management strategy, so as to solve the problem of low accuracy in the current spam short message interception.
[0004] In a first aspect, an embodiment of the present application provides a method for generating a short message management strategy, comprising:
[0005] Get pending SMS messages;
[0006] Extracting character substrings based on the short message to be processed to obtain a substring set;
[0007] Perform keyword matching based on the subset set and the keyword knowledge graph to obtain target keywords; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words;
[0008] A text message interception strategy is determined based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
[0009] In one embodiment, the keyword matching based on the subset set and the keyword knowledge graph to obtain the target keyword includes:
[0010] Get keyword knowledge graph;
[0011] In the keyword knowledge graph, performing variant character matching on the character substrings in the substring set to obtain a first candidate keyword;
[0012] 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 of the target character substrings to obtain a second candidate keyword;
[0013] Determine at least one initial keyword based on the first candidate keyword, or the first candidate keyword and the second candidate keyword;
[0014] Keyword matching is performed based on each of the initial keywords to obtain a target keyword.
[0015] In one embodiment, performing character similarity matching based on each of the target character substrings to obtain a second candidate keyword includes:
[0016] Performing character rareness detection on each of the target character substrings to obtain character rareness information;
[0017] Determining an uncommon substring based on the character uncommonness information;
[0018] Based on the uncommon substring, character similarity matching is performed to obtain a second candidate keyword.
[0019] In one embodiment, performing character similarity matching based on the uncommon substring to obtain a second candidate keyword includes:
[0020] Build a dictionary of pinyin and stroke order of keywords based on the keyword knowledge graph;
[0021] Based on the pinyin and stroke order sequence dictionary, the uncommon substring is matched with homophones and similar shapes to obtain a second candidate keyword.
[0022] In one embodiment, the character substring extraction based on the short message to be processed to obtain a substring set includes:
[0023] Cleaning invalid characters from the short message to be processed to obtain a target character string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons;
[0024] The target character string is segmented into characters, and each character substring formed by the segmentation forms a substring set.
[0025] In one embodiment, performing keyword matching based on each of the initial keywords to obtain a target keyword includes:
[0026] Determine character position information of each character in a target character string corresponding to the short message to be processed in the target character string;
[0027] Determine the starting and ending position information of the initial keyword in the target character string;
[0028] Based on the initial keywords and their start and end position information, the target character string and its character position information, a global optimal word combination detection is performed to obtain the target keyword.
[0029] In one embodiment, after keyword matching is performed based on the subset set and the keyword knowledge graph to obtain the target keyword, the method further includes:
[0030] Expand the target keyword to the keyword knowledge graph.
[0031] In a second aspect, an embodiment of the present application provides a device for generating a short message management strategy, including:
[0032] The acquisition module is used to obtain the short messages to be processed;
[0033] An extraction module, used for extracting character substrings based on the short message to be processed to obtain a substring set;
[0034] A matching module, used for performing keyword matching based on the subset set and the keyword knowledge graph to obtain a target keyword; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words;
[0035] A determination module is used to determine a text message interception strategy based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
[0036] In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory storing a computer program, wherein when the processor executes the program, the method for generating a text message management strategy described in the first aspect is implemented.
[0037] In a fourth aspect, an embodiment of the present application provides a storage medium, which is a computer-readable storage medium and includes a computer program. When the computer program is executed by a processor, the method for generating a text message management strategy described in the first aspect is implemented.
[0038] The SMS management strategy generation method, device, electronic device and storage medium provided in the embodiments of the present application can quickly and accurately identify new keywords formed by variants, extensions or substitutions of keywords in the SMS to be processed by combining a keyword knowledge graph constructed by preset keywords and their variants, extensions, and substitute related words with keyword matching based on a substring set obtained by extracting character substrings from the SMS to be processed, and then can quickly and accurately determine the SMS interception strategy based on the matched target keywords combined with the keyword knowledge graph, so that relevant personnel can refer to the SMS interception strategy to intercept junk SMS, thereby improving the accuracy of junk SMS interception. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present application or the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0040] Figure 1 It is a flowchart of a method for generating a short message management strategy provided in an embodiment of the present application;
[0041] Figure 2 It is a scenario diagram of the method for generating a short message management strategy provided in an embodiment of the present application;
[0042] Figure 3 This is a functional module diagram of an embodiment of a device for generating a short message management strategy of the present application;
[0043] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] Below is a combination of the embodiments and Figure 1-Figure 4The SMS management strategy generation method, device, electronic device and storage medium provided by the present invention are described in detail.
[0046] in, Figure 1 A flowchart of a method for generating a short message management strategy provided in an embodiment of the present application; Figure 2 A scenario diagram of the SMS management strategy generation method provided in an embodiment of the present application.
[0047] Specifically, refer to Figure 1 , the embodiment of the present application provides a method for generating a short message management strategy, which may include:
[0048] Step 100, obtaining the short message to be processed;
[0049] It should be noted that the execution subject of the device identification method provided in the embodiment of the present application can be a server, a computer device, etc., such as a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc. The server or computer device of the present application can be provided with or connected to a short message management strategy generation device, and the short message management strategy generation method of the present application can be completed by controlling the short message management strategy generation device.
[0050] The SMS to be processed in this application may be a SMS containing illegal words or a SMS without illegal words. The SMS to be processed may also be a SMS identified as spam.
[0051] Step 200, extracting character substrings based on the short message to be processed to obtain a substring set;
[0052] The present application can pre-process the SMS to be processed, specifically, it can perform data cleaning, and form a target character string from the remaining characters after cleaning.
[0053] Furthermore, character segmentation is performed on the target character string according to different number of character combination requirements, the target character string is segmented into a plurality of character substrings, and each character substring forms a substring set.
[0054] Step 300, performing keyword matching based on the substring set and the keyword knowledge graph to obtain the target keyword;
[0055] It should be noted that in this application, a keyword knowledge graph can be constructed based on the keywords of the pre-set illegal words. In this application, the keywords of the pre-set illegal words can be words summarized based on artificial experience.
[0056] Specifically, a keyword knowledge graph can be formed by presetting keywords and the relationships between keywords. The relationships between keywords include variants, substitutions, and extended relationships.
[0057] This application can determine the relationship between keywords through statistical analysis and mining keyword combination strategies, thereby forming a keyword knowledge graph. The edge between two keywords in the keyword knowledge graph in this application is a unidirectional edge.
[0058] Suppose there is a set S of keyword combination strategies. Taking the strategies (A|B|C) & (D) as an example, the concepts of keyword variants, substitutions, and extended relationships are introduced.
[0059] Keyword variant relationship: If there are two keywords A and B, A is a common word, some or all of the characters in B are different from those in A, but they have the same pinyin or similar glyphs, and people can associate B with A after reading it, then there is a variant relationship between the two keywords, where the common word A is the entity (with the highest frequency, and the frequency is calculated by the keyword combination strategy set S), and B is the variant word, and the direction is from the entity to the variant.
[0060] Keyword substitution relationship: If two keywords A and C have an "or" logic in the keyword combination strategy, they belong to the same spam message topic, and the cosine similarity of the vectors of A and C is high, then A and C are in a substitution relationship with each other, and the direction is from the one with higher frequency to the one with lower frequency.
[0061] Keyword extended relationship: If two keywords A and D have "and" logic in the keyword combination strategy, and the number of times they appear in the strategy keyword set is less than a certain threshold, then there is an extended relationship between A and D, and the direction is from the lower frequency word to the higher frequency word.
[0062] Therefore, the present application may first accurately match each character substring in the substring set with the keyword entry in the keyword knowledge graph, and use the successfully matched character substring as the first candidate keyword.
[0063] Furthermore, since variant spam text messages contain a variety of variant keywords, these variant keywords generally contain rare characters, and each Chinese character in the variant keyword has the same pinyin or similar glyphs as the Chinese character in the corresponding position of the main word. New variant keywords cannot be discovered through exact matching. Therefore, for character substrings that fail to match in the substring set, a fuzzy matching algorithm can be used to further match the keyword entries in the keyword knowledge graph to discover new variant keywords, and the matched keywords are determined as the second candidate keywords.
[0064] Furthermore, a dynamic programming algorithm may be used to search for an optimal word combination based on the first candidate keyword, or the first candidate keyword and the second candidate keyword, and the obtained keyword may be determined as the target keyword.
[0065] It should be noted that after keyword matching based on the substring set and the keyword knowledge graph to obtain the target keyword, it also includes:
[0066] Expand the target keywords to the keyword knowledge graph.
[0067] After obtaining the target keyword, the present application can automatically expand the target keyword to 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, determining a text message interception strategy based on the target keyword and the keyword knowledge graph, and performing text message interception based on the text message interception strategy.
[0069] After obtaining the target keywords, this application can query the knowledge of related words such as keyword variants, extensions and substitutions in the target keywords based on the keyword knowledge graph, and generate SMS interception strategies that can intercept new variant SMS messages, so that strategy specialists can refer to them when formulating strategies, thereby improving the efficiency and quality of strategy formulation.
[0070] The SMS management strategy generation method provided in the embodiment of the present application can quickly and accurately identify new keywords formed by variants, extensions or substitutions of keywords in the SMS to be processed through a keyword knowledge graph constructed by preset keywords and their variants, extensions, and substitute related words, combined with keyword matching based on a substring set obtained by extracting character substrings from the SMS to be processed. Then, the SMS interception strategy can be quickly and accurately determined based on the matched target keywords combined with the keyword knowledge graph, making it convenient for relevant personnel to refer to the SMS interception strategy to intercept junk SMS, thereby improving the accuracy of junk SMS interception.
[0071] In one embodiment, character substrings are extracted based on the short message to be processed to obtain a substring set, including:
[0072] Step 201, clear invalid characters from the short message to be processed to obtain a target character string;
[0073] Step 202, character segmentation is performed on the target character string, and each character substring formed by the segmentation forms a substring set.
[0074] After obtaining the SMS to be processed, the present application can clean the invalid characters in the SMS to be processed, wherein the invalid characters include at least one of punctuation marks, English symbols, and emoticons.
[0075] Specifically, in the present application, punctuation marks, English symbols, and emoticons in the short message to be processed can be removed, and only Chinese characters can be retained, and the target character string can be formed by the remaining Chinese characters.
[0076] Furthermore, the target character string may be segmented by characters through the K-shingle technique, and each character substring formed by the segmentation forms a substring set. K-shingle is a text processing technique for segmenting text data into continuous short segments.
[0077] In the present application, for the target string, a shingle can be taken for every K consecutive characters, and the K-shingle is a set of substrings composed of all consecutive K characters. In one embodiment, the 2-shingle, 3-shingle, and 4-shingle of the target string can be extracted.
[0078] This embodiment can remove noise information by performing data cleaning, and can extract key features by performing K-shingle extraction, so that the character substrings in the obtained substring set are more accurate, thereby making the SMS interception strategy determined based on the substring set more accurate, which helps to improve the accuracy of spam SMS interception.
[0079] Furthermore, keyword matching is performed based on the substring set and the keyword knowledge graph to obtain target keywords, including:
[0080] Step 301, obtaining a keyword knowledge graph;
[0081] Step 302, in the keyword knowledge graph, performing variant character matching on the character substrings in the substring set to obtain a 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 character similarity matching is performed based on each target character substring to obtain a second candidate keyword;
[0083] Step 304, determining at least one initial keyword based on the first candidate keyword, or the first candidate keyword and the second candidate keyword;
[0084] Step 305: Perform keyword matching based on each initial keyword to obtain a target keyword.
[0085] A pre-built keyword knowledge graph can be obtained in this application.
[0086] Furthermore, for the character substrings such as 2-shingle, 3-shingle, and 4-shingle in the substring set, they can be accurately matched with the entries of the preset keywords in the keyword knowledge graph. If the accurately matched entry is a variant of a keyword in the keyword knowledge graph, the entry is automatically restored to the keyword body as the first candidate keyword through the variant relationship. Among them, the successfully matched entry is used as an important keyword feature for subsequent SMS analysis.
[0087] Furthermore, for at least one target character substring that fails to match in the variant character matching process, homophonic or similar similarity matching may be performed based on each target character substring, thereby obtaining a second candidate keyword.
[0088] Furthermore, if only the first candidate keyword is matched based on the subset set, the first candidate keyword is used as the initial keyword.
[0089] If the first candidate keyword and the second candidate keyword are obtained based on the subset set matching, the first candidate keyword and the second candidate keyword are used together as the initial keyword.
[0090] Furthermore, the best word combination can be found from each initial keyword through a dynamic programming algorithm, specifically, from each exact match and fuzzy match initial keyword, the word combination with the largest sum of characters in the matching text message is found as the target keyword.
[0091] This embodiment uses a substring set obtained by extracting character substrings from the SMS to be processed and combines it with the keyword knowledge graph for keyword matching, so as to quickly and accurately identify new keywords formed by variants, extensions or substitutions of keywords in the SMS to be processed, and then can quickly and accurately determine the SMS interception strategy based on the matched target keywords combined with the keyword knowledge graph, so that relevant personnel can refer to the SMS interception strategy to intercept junk SMS, thereby improving the accuracy of junk SMS interception.
[0092] Furthermore, character similarity matching is performed based on each target character substring to obtain a second candidate keyword, including:
[0093] Step 3031, performing character rareness detection on each target character substring to obtain character rareness information;
[0094] Step 3032, determining an uncommon substring based on the character uncommonness information;
[0095] Step 3033, perform character similarity matching based on the uncommon substring to obtain a second candidate keyword.
[0096] In this application, a fuzzy matching algorithm can be used to further match keyword entries in the knowledge graph to discover new variant keywords. Specifically, it can be divided into two steps: including rare word substring screening and "homophone and similar shape" fuzzy matching.
[0097] Specifically, there are:
[0098] Step 1: Filter substrings containing uncommon characters: For each target character substring in the unmatched 2-shingle, 3-shingle, and 4-shingle, determine whether the target character substring contains uncommon characters by calculating the character uncommonness information, and retain the target character substring containing uncommon characters, hereinafter referred to as uncommon substrings. Perform keyword fuzzy matching on all uncommon substrings. The formula for calculating the uncommonness of a character is as follows:
[0099]
[0100] Where ch represents any Chinese character, and n is the number of times the Chinese character ch appears in the dictionary of common characters. The dictionary of common characters 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 an uncommon character. The uncommonness range of Chinese characters is between (0, 1], and the closer it is to 1, the higher the uncommonness of the character. Through experiments, m is taken as 20, and the threshold for uncommon characters is set to 0.4, that is, if the uncommonness is greater than 0.4, the Chinese character is an uncommon character.
[0101] After obtaining the uncommon substrings, the second candidate keywords can be obtained by performing similarity matching on the uncommon substrings based on homophones or similar shapes.
[0102] Furthermore, character similarity matching is performed based on the uncommon substring to obtain a second candidate keyword, including:
[0103] Step 30331, constructing a dictionary of pinyin and stroke order of keywords based on the keyword knowledge graph;
[0104] Step 30332, based on the pinyin and stroke order column dictionary, perform homophonic and similar matching on the uncommon substring to obtain the second candidate keyword.
[0105] Further, there are:
[0106] Step 2: Fuzzy matching of "homophones and similar shapes" variant words: For the uncommon substrings selected in step 1, the "homophones and similar shapes" fuzzy matching method is used to automatically discover variant keywords.
[0107] Specifically, all the central node words (i.e., keywords) in the keyword knowledge graph are first extracted, a dictionary of pinyin and stroke sequence is constructed, and then each uncommon substring is matched with homophones or similar shapes. The matched ones are new variant words and determined as the second candidate keywords. The degree of similarity between the two Chinese characters can be obtained by comparing and calculating the edit distance of the stroke sequence 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 uncommon substring "Baijia Luo" is "baijialuo". Among the two words, "Baijia" and "Baijia" belong to homophone matches, and "Music" and "Luo" belong to similar matches.
[0108] Examples of exact and fuzzy matching of keyword terms: Based on the keyword knowledge graph, exact and fuzzy matching of keyword terms are performed on 2-shingle, 3-shingle, and 4-shingle. The exact matching step hits the keywords: "discount", "huicun", and "address". Then, uncommon substrings are filtered from the substrings that are not exactly matched to obtain 2-shingle, 3-shingle, and 4-shingle containing uncommon characters; finally, fuzzy matching of "homophone and similar shape" variant words is performed to obtain keyword variants.
[0109] This embodiment can automatically identify keywords in new variant spam text messages based on the "homonymous and similar in appearance" features of variant keywords, so that the text message interception strategy can be quickly and accurately determined based on the target keywords obtained by matching the identified keywords in combination with the keyword knowledge graph, making it convenient for relevant personnel to refer to the text message interception strategy to intercept spam text messages, thereby improving the accuracy of spam text message interception.
[0110] In one embodiment, keyword matching is performed based on each initial keyword to obtain a target keyword, including:
[0111] Step 3051, determining the character position information of each character in the target character string corresponding to the short message to be processed;
[0112] Step 3052, determining the start and end position information of the initial keyword in the target character string;
[0113] Step 3053, based on each initial keyword and its start and end position information, the target character string and its character position information, perform global optimal word combination detection to obtain the target keyword.
[0114] The present application can use a 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, Bargain 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, Bargain, Limited-time Offer}. Among them, there are overlapping words, such as "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 that matches the most characters in the text message from the sets of keywords with exact and fuzzy matches (i.e., the initial keywords). Specifically, there are:
[0117] First, use the AC (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 label of the text message, and the first row is the content of the preprocessed text message (i.e., the target string). For example: The start position subscript of the entry "Good news" in the preprocessed text message sequence is 0, and the end position subscript of "Good news" is 2, then the start and end positions of "Good news" are recorded as (0, 3), which is a list notation. 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 value of the characters matched in the text message. For example, a 0,0 = 0, representing that when the text message content is "Good", and the keyword to be matched is only "Good news", the maximum value of the 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 value of the 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; which means 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); which means the first word is successfully matched, and at this time the sum of the characters matched in the text message is equal to the total number of characters of this word;
[0125] When j > end(w0), a 0,j = a 0,j-1 ; which means that after the matching word ends in the text message, there are no more words to be matched in the 0th row, and at this time the sum of the characters matched in the text message no longer changes.
[0126] Where a 0,j represents the element in the jth column of the 0th row 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 ; which means that when the word w j has not been successfully matched, the sum of the characters matched in the text message 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}; which 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 a larger value;
[0130] When j>end(w j ), a i,j =a i,j-1 ; means that when the matched word ends in the SMS, the sum of the matched characters in the SMS is equal to the value on its left.
[0131] After the digital matrix is filled in, we can start from the lower right corner of the digital matrix and trace back from the top to the left (that is, first determine whether the word in the current row is selected. If it is selected, trace back to remove the length of the current word and continue to determine), and output the best word combination. Assume that the current element value is a ij :
[0132] 1. If a i-1,j =a i,j Then i=i-1. Repeat this cycle until a i-1, j≠a i,j ;
[0133] 2. If a i,j-1 =a i,j Then j = j-1. Repeat this cycle until a i,j-1 ≠a i,j , at this time the word in the i-th row is selected as a candidate word, and the output is w i . Now let j = j-len(w i ), and then repeat the above steps 1 and 2 until the upper left corner of the digital matrix is traversed.
[0134] Through the above cycle, several optimal word combinations can be output as target keywords.
[0135] This embodiment searches for the best word combination as the target keyword from each initial keyword based on a dynamic programming algorithm, and can quickly and accurately identify new keywords formed by variants, extensions or substitutions of keywords in the text messages to be processed, and then can quickly and accurately determine the text message interception strategy based on the matched target keywords combined with the keyword knowledge graph, so that relevant personnel can refer to the text message interception strategy to intercept junk text messages, thereby improving the accuracy of junk text message interception.
[0136] Figure 2 A schematic diagram of a scenario of a method for generating a short message management strategy provided in an embodiment of the present application, referring to Figure 2 In one embodiment, the method for generating a short message management strategy of the present application may include the following steps:
[0137] Get an input SMS, remove punctuation marks, English, emoticons, etc. from the SMS, and only keep Chinese characters, thereby completing SMS preprocessing.
[0138] Furthermore, K-shingle is extracted from the information of the preprocessed SMS, and character substrings in the substring set extracted by the K-shingle are precisely matched with keyword entries in the keyword knowledge graph, and fuzzy matching of keyword entries is performed on character substrings that are not precisely matched.
[0139] For exact matching and fuzzy matching keyword sets, a dynamic programming algorithm is used to find the best word combination as the target keyword.
[0140] Furthermore, the target keyword is automatically expanded into the keyword knowledge graph as variant knowledge of the knowledge graph.
[0141] In addition, based on the keyword knowledge graph, the variants, extensions, and alternative relationship word knowledge of the target keyword are queried, and the SMS interception strategy that can intercept new variant SMS is automatically generated to end the process for reference by strategy specialists when formulating strategies, so as to improve the efficiency and quality of strategy formulation.
[0142] The SMS management strategy generation method of the present application can make up for the shortcomings of SMS classification and clustering technology that have poor classification and clustering effects due to sparse and scattered short text features. In addition, it can use the variants, substitutions, and extended relationship knowledge of keywords in the keyword knowledge graph to automatically analyze SMS texts, discover new variant words in SMS, and automatically generate strategies that can intercept new variant SMS for reference by strategy specialists, thereby improving strategy formulation efficiency and enhancing the recall and precision of strategies.
[0143] Furthermore, the present application also provides a device for generating a text message management strategy.
[0144] Reference Figure 3 , Figure 3 This is a functional module diagram of an embodiment of a device for generating a short message management strategy according to the present application.
[0145] The short message management strategy generating device comprises:
[0146] The acquisition module 310 is used to acquire the short message to be processed;
[0147] An extraction module 320, configured to extract character substrings based on the short message to be processed to obtain a substring set;
[0148] A matching module 330 is used to perform keyword matching based on the subset set and the keyword knowledge graph to obtain a target keyword; the keyword knowledge graph is constructed based on the preset keyword and its variants, extensions, and alternative associated words;
[0149] The determination module 340 is used to determine a text message interception strategy based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
[0150] The SMS management strategy generation device provided in the embodiment of the present application can quickly and accurately identify new keywords formed by variants, extensions or substitutions of keywords in the SMS to be processed by combining a keyword knowledge graph constructed by preset keywords and their variants, extensions, and substitute associated words with keyword matching based on a substring set obtained by extracting character substrings from the SMS to be processed, and then can quickly and accurately determine the SMS interception strategy based on the matched target keywords combined with the keyword knowledge graph, so that relevant personnel can refer to the SMS interception strategy to intercept junk SMS, thereby improving the accuracy of junk SMS interception.
[0151] In one embodiment, the extraction module 320 is specifically used to:
[0152] Cleaning invalid characters from the short message to be processed to obtain a target character string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons;
[0153] The target character string is segmented into characters, and each character substring formed by the segmentation forms a substring set.
[0154] In one embodiment, the matching module 330 is specifically used for:
[0155] Get keyword knowledge graph;
[0156] In the keyword knowledge graph, performing variant character matching on the character substrings in the substring set to obtain a first candidate keyword;
[0157] 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 of the target character substrings to obtain a second candidate keyword;
[0158] Determine at least one initial keyword based on the first candidate keyword, or the first candidate keyword and the second candidate keyword;
[0159] Keyword matching is performed based on each of the initial keywords to obtain a target keyword.
[0160] In one embodiment, the matching module 330 includes a first matching unit, which is configured to:
[0161] Performing character rareness detection on each of the target character substrings to obtain character rareness information;
[0162] Determining an uncommon substring based on the character uncommonness information;
[0163] Based on the uncommon substring, character similarity matching is performed to obtain a second candidate keyword.
[0164] In one embodiment, the matching module 330 includes a second matching unit, and the second matching unit is configured to:
[0165] Build a dictionary of pinyin and stroke order of keywords based on the keyword knowledge graph;
[0166] Based on the pinyin and stroke order sequence dictionary, the uncommon substring is matched with homophones and similar shapes to obtain a second candidate keyword.
[0167] In one embodiment, the matching module 330 includes a third matching unit, wherein the third matching unit is configured to:
[0168] Determine character position information of each character in a target character string corresponding to the short message to be processed in the target character string;
[0169] Determine the starting and ending position information of the initial keyword in the target character string;
[0170] Based on the initial keywords and their start and end position information, the target character string and its character position information, a global optimal word combination detection is performed to obtain the target keyword.
[0171] In one embodiment, the matching module 330 is further configured to:
[0172] Expand the target keyword to the keyword knowledge graph.
[0173] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. 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 through the communication bus 440. The processor 410 may call a computer program in the memory 430 to execute the steps of the method for generating a short message management strategy, for example including:
[0174] Get pending SMS messages;
[0175] Extracting character substrings based on the short message to be processed to obtain a substring set;
[0176] Perform keyword matching based on the subset set and the keyword knowledge graph to obtain target keywords; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words;
[0177] A text message interception strategy is determined based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
[0178] In addition, the logic instructions in the above-mentioned memory 430 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0179] On the other hand, an embodiment of the present application further provides a storage medium, wherein the storage medium is a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to execute the steps of the methods provided in the above embodiments, for example, including:
[0180] Get pending SMS messages;
[0181] Extracting character substrings based on the short message to be processed to obtain a substring set;
[0182] Perform keyword matching based on the subset set and the keyword knowledge graph to obtain target keywords; the keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words;
[0183] A text message interception strategy is determined based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
[0184] The computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0185] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment 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 the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for generating a short message management strategy, characterized in that: include: Get pending SMS messages; Extracting character substrings based on the short message to be processed to obtain a substring set; Perform keyword matching based on the subset set and the keyword knowledge graph to obtain target keywords; The keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words; A text message interception strategy is determined based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
2. The method for generating a short message management strategy according to claim 1, characterized in that: The keyword matching based on the subset set and the keyword knowledge graph to obtain the target keyword includes: Get keyword knowledge graph; In the keyword knowledge graph, performing variant character matching 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 of the target character substrings to obtain a second candidate keyword; Determine at least one initial keyword based on the first candidate keyword, or the first candidate keyword and the second candidate keyword; Keyword matching is performed based on each of the initial keywords to obtain a target keyword.
3. The method for generating a short message management strategy according to claim 2, characterized in that: The performing character similarity matching based on each of the target character substrings to obtain a second candidate keyword includes: Performing character rareness detection on each of the target character substrings to obtain character rareness information; Determining an uncommon substring based on the character uncommonness information; Based on the uncommon substring, character similarity matching is performed to obtain a second candidate keyword.
4. The method for generating a short message management strategy according to claim 3, characterized in that: The method of performing character similarity matching based on the uncommon substring to obtain a second candidate keyword includes: Build a dictionary of pinyin and stroke order of keywords based on the keyword knowledge graph; Based on the pinyin and stroke order sequence dictionary, the uncommon substring is matched with homophones and similar shapes to obtain a second candidate keyword.
5. The method for generating a short message management strategy according to claim 2, characterized in that: The character substring extraction is performed based on the short message to be processed to obtain a substring set, including: Cleaning invalid characters from the short message to be processed to obtain a target character string; the invalid characters include at least one of punctuation marks, English symbols, and emoticons; The target character string is segmented into characters, and each character substring formed by the segmentation forms a substring set.
6. The method for generating a short message management strategy according to claim 5, characterized in that: The keyword matching based on each of the initial keywords to obtain the target keyword includes: Determine character position information of each character in a target character string corresponding to the short message to be processed in the target character string; Determine the starting and ending position information of the initial keyword in the target character string; Based on the initial keywords and their start and end position information, the target character string and its character position information, a global optimal word combination detection is performed to obtain the target keyword.
7. The method for generating a short message management strategy according to any one of claims 1 to 6, characterized in that: After performing keyword matching based on the subset set and the keyword knowledge graph to obtain the target keyword, the method further includes: Expand the target keyword to the keyword knowledge graph.
8. A device for generating a short message management strategy, characterized in that: include: The acquisition module is used to obtain the short messages to be processed; An extraction module, used for extracting character substrings based on the short message to be processed to obtain a substring set; A matching module, used for performing keyword matching based on the substring set and the keyword knowledge graph to obtain target keywords; The keyword knowledge graph is constructed based on preset keywords and their variants, extensions, and alternative associated words; A determination module is used to determine a text message interception strategy based on the target keyword and the keyword knowledge graph, so as to perform text message interception based on the text message interception strategy.
9. An electronic device comprising a processor and a memory storing a computer program, characterized in that: When the processor executes the computer program, the method for generating a text message management strategy according to any one of claims 1 to 7 is implemented.
10. A storage medium, the storage medium being a computer-readable storage medium, comprising a computer program, characterized in that: When the computer program is executed by a processor, the method for generating a short message management strategy according to any one of claims 1 to 7 is implemented.
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
Method and device for generating fraud-related short message interception template
CN114786184A
Keyword extraction method and device
CN115204156A
Cited By
Text detection method and device, electronic equipment and storage medium
CN119647477A
Intelligent short message platform management and control method and system based on multi-level risk control
CN120980457A
Intelligent short message platform management and control method and system based on multi-level risk control
CN120980457B
Text message management strategy generating method and apparatus, electronic device, and storage medium
WO2025108155A1
