CN110852083A - Method and device for generating short message template - Google Patents

Method and device for generating short message template Download PDF

Info

Publication number
CN110852083A
CN110852083A CN201911032770.3A CN201911032770A CN110852083A CN 110852083 A CN110852083 A CN 110852083A CN 201911032770 A CN201911032770 A CN 201911032770A CN 110852083 A CN110852083 A CN 110852083A
Authority
CN
China
Prior art keywords
short message
characteristic value
word segmentation
generating
segmentation information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911032770.3A
Other languages
Chinese (zh)
Inventor
余文胜
杨奎
刘舒
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENZHEN MONTNETS TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN MONTNETS TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SHENZHEN MONTNETS TECHNOLOGY Co Ltd filed Critical SHENZHEN MONTNETS TECHNOLOGY Co Ltd
Priority to CN201911032770.3A priority Critical patent/CN110852083A/en
Publication of CN110852083A publication Critical patent/CN110852083A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The application is applicable to the technical field of computers, and provides a method for generating a short message template, which comprises the following steps: determining a first short message and a second short message from the sample short messages; respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message; determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value; and generating a short message template based on the first short message and the third short message. According to the method, the short message template is automatically extracted according to the sample short message, the short message template can be generated timely and intelligently, and the efficiency of sending the short message of the merchant is improved.

Description

Method and device for generating short message template
Technical Field
The application belongs to the technical field of computers, and particularly relates to a method and a device for generating a short message template.
Background
In order to improve the efficiency of sending short messages, many merchants edit and send short messages by using a short message platform. The platform stores templates of various short messages in advance, a merchant calls the templates to edit the short messages and then sends the short messages, when the existing templates cannot meet the requirements of the merchant, the template requirements are required to be provided for the platform side, the platform side sets a new template according to the requirements of the merchant, and the merchant can call the new template. In the existing method for sending the short message, a merchant cannot update an available template in real time, and the short message sending efficiency is low.
Disclosure of Invention
The embodiment of the application provides a method and a device for generating a short message template, which can solve the problems that a merchant cannot update an available template in real time and the short message sending efficiency is low.
In a first aspect, an embodiment of the present application provides a method for generating a short message template, including:
determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message;
determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value;
and generating a short message template based on the first short message and the third short message.
Further, the calculating a first feature value corresponding to the first short message and a second feature value corresponding to the second short message respectively includes:
and respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message based on a preset characteristic value calculation strategy.
Further, the calculating a first feature value corresponding to the first short message and a second feature value corresponding to the second short message based on a preset feature value calculation policy includes:
extracting first word segmentation information in the first short message from the first short message based on a word segmentation information extraction strategy;
extracting second word segmentation information in the second short message from the second short message based on a word segmentation information extraction strategy;
performing hash calculation on the first segmentation information based on a preset hash algorithm to obtain a first characteristic value;
and carrying out Hash calculation on the second word segmentation information based on a preset Hash algorithm to obtain a second characteristic value.
Further, the determining, from the second short message, a third short message similar to the first short message based on the first feature value and the second feature value includes:
screening a target characteristic value from the second characteristic values based on the first characteristic value and a preset similar short message screening condition;
and marking the short message information corresponding to the target characteristic value as a third short message similar to the first short message.
Further, the screening out a target characteristic value from the second characteristic value based on the first characteristic value and a preset similar short message screening condition includes:
calculating Hamming distance information between the first characteristic value and the second characteristic value;
and when the Hamming distance information is smaller than a preset threshold value, marking the second characteristic value as a target characteristic value.
Further, the generating a short message template based on the first short message and the third short message includes:
determining the same short message content and different short message contents based on the first short message and the third short message, and taking the different short message contents as variable parameters;
and generating a short message template according to the same short message content and the variable parameter.
Further, the determining the same short message content based on the first short message and the third short message includes:
respectively acquiring fourth word segmentation information in the first short message and third word segmentation information in the third short message based on the word segmentation extraction strategy;
extracting the same first target word segmentation information in the fourth word segmentation information and the third word segmentation information as the same short message content;
and extracting different second target word segmentation information in the fourth word segmentation information and the third word segmentation information as different short message contents, and taking the different short message contents as variable parameters.
In a second aspect, an embodiment of the present application provides a device for generating a short message template, including:
the first determining unit is used for determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
the first calculation unit is used for calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message respectively;
a second determining unit, configured to determine, based on the first feature value and the second feature value, a third short message similar to the first short message from the second short message;
and the first generating unit is used for generating a short message template based on the first short message and the third short message.
Further, the first calculation unit includes:
and the second calculating unit is used for calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message respectively based on a preset characteristic value calculating strategy.
Further, the second calculating unit is specifically configured to:
extracting first word segmentation information in the first short message from the first short message based on a word segmentation information extraction strategy;
extracting second word segmentation information in the second short message from the second short message based on a word segmentation information extraction strategy;
performing hash calculation on the first segmentation information based on a preset hash algorithm to obtain a first characteristic value;
and carrying out Hash calculation on the second word segmentation information based on a preset Hash algorithm to obtain a second characteristic value.
Further, the second determination unit includes:
the screening unit is used for screening a target characteristic value from the second characteristic value based on the first characteristic value and a preset similar short message screening condition;
and the first marking unit is used for marking the short message information corresponding to the target characteristic value as a third short message similar to the first short message.
Further, the screening unit is specifically configured to:
calculating Hamming distance information between the first characteristic value and the second characteristic value;
and when the Hamming distance information is smaller than a preset threshold value, marking the second characteristic value as a target characteristic value.
Further, the first generating unit includes:
a third determining unit, configured to determine the same short message content and different short message contents based on the first short message and the third short message, and use the different short message contents as variable parameters;
and the second generating unit is used for generating a short message template according to the same short message content and the variable parameter.
Further, the third determining unit is specifically configured to:
respectively acquiring fourth word segmentation information in the first short message and third word segmentation information in the third short message based on the word segmentation extraction strategy;
extracting the same first target word segmentation information in the fourth word segmentation information and the third word segmentation information as the same short message content;
and extracting different second target word segmentation information in the fourth word segmentation information and the third word segmentation information as different short message contents, and taking the different short message contents as variable parameters.
In a third aspect, an embodiment of the present application provides a short message template generating device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the short message template generating method according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the method for generating a short message template according to the first aspect is implemented.
In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the method for generating a short message template according to the first aspect.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
In the embodiment of the application, a first short message and a second short message are determined from sample short messages; respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message; determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value; and generating a short message template based on the first short message and the third short message. According to the method, the short message template is automatically extracted according to the sample short message, the short message template can be generated timely and intelligently, and the efficiency of sending the short message of the merchant is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flowchart of a method for generating a short message template according to a first embodiment of the present application;
fig. 2 is a schematic flow chart of another method for generating a short message template according to a second embodiment of the present application;
fig. 3 is a schematic flowchart of a refinement at S202 in another method for generating a short message template according to a second embodiment of the present application;
fig. 4 is a schematic flow chart of another method for generating a short message template according to a third embodiment of the present application;
fig. 5 is a schematic flowchart of a refinement at S303 in another method for generating a short message template according to a third embodiment of the present application;
fig. 6 is a schematic flow chart of another method for generating a short message template according to a fourth embodiment of the present application;
fig. 7 is a schematic flowchart of a refinement at S404 in another method for generating a short message template according to a fourth embodiment of the present application;
fig. 8 is a schematic diagram of a short message template generating apparatus according to a fifth embodiment of the present application;
fig. 9 is a schematic diagram of a device for generating a short message template according to a sixth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method for generating a short message template according to a first embodiment of the present application. The execution subject of the method for generating the short message template in the embodiment is equipment with a function of generating the short message template, and specifically, the execution subject can be equipment such as a mobile terminal, a computer, a server and the like. The method for generating the short message template shown in fig. 1 may include:
s101: determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two.
The device obtains a sample short message, wherein the sample short message may be pre-stored in the device or may be obtained by the device from other devices through a network. The sample short message is the existing short message, namely the short message from which the merchant needs to extract the short message template. The number of the sample short messages is at least three, and can also be more than three, and it can be understood that the more the number of the sample short messages is, the more accurate the short message template obtained based on the sample short messages is.
The device determines a first short message and a second short message from the sample short messages, wherein the first short message is a short message meeting the preset requirement, the second short message is a short message except the first short message in the sample short messages, and the number of the second short messages is at least two. Specifically, a preset requirement for screening a first short message from sample short messages is preset in the device, and the device screens out the first short message meeting the preset requirement from the sample short messages based on the preset requirement, for example, the preset requirement may be that when the sample short messages include preset keywords, the sample short messages can be used as the first short messages to mark the sample short messages as the first short messages. The annoying preset requirement may also be other requirements, and is not limited herein. And after the first short message is determined from the sample short messages, the sample short messages except the first short message are the second short messages.
S102: and respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message.
The equipment respectively calculates a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message. Because the short message template corresponding to the finally obtained sample short message is always the information coexisting in all sample short messages, the short message is subjected to feature extraction, so that the coexisting information in the sample short message is obtained. The characteristic value of the short message is used for judging the similar characteristic of the text information in the short message. The device is preset with a calculation strategy used for calculating the characteristic value of the short message, and the device respectively calculates a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message based on the calculation strategy.
S103: and determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value.
And the equipment determines a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value. Specifically, because the feature value of the short message is used for judging the similar feature of the text information in the short message, the similar feature between the first short message and the second short message can be judged through the first feature value and the second feature value, so that the similarity degree between the first short message and the second short message can be judged. The device determines a third short message similar to the first short message in the second short message by comparing the first characteristic value with the second characteristic value, for example, when difference information between the second characteristic value and the first characteristic value is smaller than a preset condition, it determines that the second short message corresponding to the second characteristic value is the third short message similar to the first short message.
S104: and generating a short message template based on the first short message and the third short message.
The device generates a short message template according to the first short message and a third short message, wherein the third short message is a short message similar to the first short message, the device can extract the same content from the first short message and the third short message, the same content can comprise the same keywords, the position information of each keyword of the same content in the template is obtained, and the short message template is generated according to the same content and the position information.
In the embodiment of the application, a first short message and a second short message are determined from sample short messages; respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message; determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value; and generating a short message template based on the first short message and the third short message. According to the method, the short message template is automatically extracted according to the sample short message, the short message template can be generated timely and intelligently, and the efficiency of sending the short message of the merchant is improved.
Referring to fig. 2, fig. 2 is a schematic flow chart of another method for generating a short message template according to a second embodiment of the present application. The execution subject of the method for generating the short message template in the embodiment is equipment with a function of generating the short message template, and specifically, the execution subject can be equipment such as a mobile terminal, a computer, a server and the like. In order to accurately obtain a first feature value corresponding to a first short message and a second feature value corresponding to a second short message, so as to accurately obtain a short message template, the difference between the present embodiment and the first embodiment is S202, where S201 in the present embodiment is the same as S101 in the first embodiment, S203 to S204 in the present embodiment are the same as S103 to S104 in the first embodiment, and S202 is a further refinement of S102. As shown in fig. 2, S202 is specifically as follows:
s202: and respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message based on a preset characteristic value calculation strategy.
The device is preset with a characteristic value calculation strategy, the preset characteristic value calculation strategy is used for calculating a characteristic value corresponding to the short message, wherein the preset characteristic value calculation strategy can be a hash function, and the device can calculate a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message through the hash function. For example, the calculation may be performed by a hash algorithm or a message digest algorithm. The Hash algorithm is to convert binary strings with any length into character strings with fixed length through calculation, and the conversion process is the Hash algorithm; the main characteristic of the message digest algorithm is that no key is needed in the encryption process, the encrypted data cannot be decrypted, and the same ciphertext can be obtained only by inputting the same plaintext data and performing the same message digest algorithm.
Further, in order to accurately obtain the first characteristic value corresponding to the first short message and the second characteristic value corresponding to the second short message, so as to accurately obtain the short message template, S202 may include S2021 to S2024, as shown in fig. 3, where S2021 to S2024 are specifically as follows:
s2021: and extracting first word segmentation information in the first short message from the first short message based on a word segmentation information extraction strategy.
The device is preset with a word segmentation information extraction strategy, the word segmentation information extraction strategy is used for extracting word segmentation information from the short messages, the word segmentation information is a keyword in each short message, and the device extracts the first word segmentation information in the first short message from the first short message based on the word segmentation information extraction strategy. For example, a segmentation library may be preset in the device, the device traverses the first short message based on the preset segmentation library, obtains a segmentation identical to a segmentation in the preset segmentation library from the first short message, and marks the segmentation as first segmentation information.
S2022: and extracting second word segmentation information in the second short message from the second short message based on a word segmentation information extraction strategy.
The specific method for extracting the second segmentation information in the second short message from the second short message in S2022 is the same as S2021, and reference may be specifically made to the related description of S2021, which is not described herein again.
S2023: and carrying out Hash calculation on the first segmentation information based on a preset Hash algorithm to obtain a first characteristic value.
The equipment performs Hash calculation on the first segmentation information based on a preset Hash algorithm to obtain a first characteristic value. After the equipment acquires the first word segmentation information, performing hash calculation on each first word segmentation to obtain a first characteristic value; the first feature may be obtained by adding a weighted value of each piece of word segmentation information to a hash value obtained by the hash calculation. Specifically, after the device acquires the first segmentation information, the device acquires position information corresponding to the first segmentation information, where the position information is the position of the first segmentation information in the first short message, and obtains a weight value of each first segmentation information based on the first segmentation information and the position information thereof, where corresponding weight values are different when the same segmentation information is in different position information. For example, when the first segmentation information is the "verification code", when the first segmentation information is at the position P1, the weight is W1, and when the first segmentation information is at the position P2, the weight value is W2.
Next, the first short message content is "your user is good, and the verification code of this time is 1234. "for example, an implementation manner of obtaining the feature value of the short message is specifically described:
the first word segmentation information of the first short message is as follows: honor (5), user (4), hello (3), this time (2), verification code (1), "where the number inside the parentheses after the word segmentation information indicates the weight value of the word.
The hash value obtained by each word segmentation is as follows:
respect: 101011
The user: 101111
You are good: 101010
This time: 111011
Verification code: 001011
The calculation result after adding the weight (calculation is performed with 1 in the hash value as a number 1 and 0 as a number-1):
respect: +5-5+5-5+5+5
The user: +4-4+4+4+4+4
You are good: +3-3+3-3+3-3
This time: +2+2+2-2+2+2
Verification code: -1-1+1-1+1+1
And longitudinally combining and accumulating the calculation result added with the weight to obtain a result: 13-11+15-7+15+10, and obtaining the characteristic value of the short message as 101011 after dimensionality reduction (decimal number is reduced into binary number, each digit is greater than 0 and is recorded as 1, and each digit is less than 0 and is recorded as 0).
S2024: and carrying out Hash calculation on the second word segmentation information based on a preset Hash algorithm to obtain a second characteristic value.
The calculation manner of the second feature value in S2024 is the same as that in S2023, and reference may be specifically made to the related description in S2023, which is not described herein again.
Referring to fig. 4, fig. 4 is a schematic flow chart of another method for generating a short message template according to a third embodiment of the present application. The execution subject of the method for generating the short message template in the embodiment is equipment with a function of generating the short message template, and specifically, the execution subject can be equipment such as a mobile terminal, a computer, a server and the like. In order to accurately acquire a third short message similar to the first short message and thus acquire an accurate short message template, the present embodiment differs from the first embodiment in S303 to S304, where S301 to S302 in the present embodiment are the same as S101 to S102 in the first embodiment, S305 in the present embodiment is the same as S104 in the first embodiment, and S303 to S304 are further refinements of S103. S303-S304 as shown in FIG. 4 are specifically as follows:
s303: and screening a target characteristic value from the second characteristic values based on the first characteristic value and a preset similar short message screening condition.
And presetting similar short message screening conditions in the equipment, wherein the preset similar short message screening conditions are used for screening a target characteristic value corresponding to a short message similar to the first short message from the second characteristic value. And the equipment screens out a target characteristic value from the second characteristic value based on the first characteristic value and a preset similar short message screening condition. The target characteristic value is a characteristic value corresponding to a short message similar to the first short message, and the preset similar short message screening condition can be set to mark the second characteristic value as the target characteristic value when a difference value between the second characteristic value and the first characteristic value meets the preset condition.
Further, in order to accurately obtain the target feature value, S303 may include S3031 to S3032, as shown in fig. 5, S3031 to S3032 specifically are as follows:
s3031: calculating Hamming distance information between the first feature value and the second feature value.
The apparatus calculates hamming distance information between a first characteristic value and a second characteristic value, the hamming distance being used in data transmission error control coding, the hamming distance being a concept that indicates the different number of corresponding bits of two (same length) words, we denote the hamming distance between two words x, y with d (x, y). And carrying out exclusive OR operation on the two character strings, and counting the number of 1, wherein the number is the Hamming distance. For example:
the first short message is: "the honored user is good, your passcode is 1234 this time. ", the first characteristic value is calculated as: 101011.
the second short message A is as follows: "the user respected is your good, your verification code this time is 1234. ", the second characteristic value is calculated as: 100011, the hamming distance information between the first eigenvalue and the second eigenvalue is 1.
The second short message B is: "you are checking for registration, the check code is 1111. ", the second characteristic value is calculated as: 110001, the hamming distance information between the first eigenvalue and the second eigenvalue is 3.
S3032: and when the Hamming distance information is smaller than a preset threshold value, marking the second characteristic value as a target characteristic value.
The device stores a preset threshold value, and the preset threshold value is used for judging Hamming distance information so as to determine a target characteristic value. And the equipment judges the size between the Hamming distance information and a preset threshold value, and marks the second characteristic value as a target characteristic value when the Hamming distance information is smaller than the preset threshold value. The preset threshold value may be self-defined, and may be generally defined as 5 or other values according to actual situations. For example:
the first short message is: "the honored user is good, your passcode is 1234 this time. ", the first characteristic value is calculated as: 101011.
the second short message A is as follows: "the user respected is your good, your verification code this time is 1234. ", the second characteristic value is calculated as: 100011, the hamming distance information between the first eigenvalue and the second eigenvalue is 1.
The second short message B is: "you are checking for registration, the check code is 1111. ", the second characteristic value is calculated as: 110001, the hamming distance information between the first eigenvalue and the second eigenvalue is 3.
And if the preset threshold is defined as 2 and the Hamming distance information corresponding to the second short message A is smaller than the preset threshold, marking the second characteristic value corresponding to the second short message A as the target characteristic value.
S304: and marking the short message information corresponding to the target characteristic value as a third short message similar to the first short message.
And the equipment marks the short message information corresponding to the target characteristic value as a third short message similar to the first short message. The equipment does not carry out subsequent processing on the short message which is not similar to the first short message.
Referring to fig. 6, fig. 6 is a schematic flow chart of another method for generating a short message template according to a fourth embodiment of the present application. The execution subject of the method for generating the short message template in the embodiment is equipment with a function of generating the short message template, and specifically, the execution subject can be equipment such as a mobile terminal, a computer, a server and the like. In order to accurately generate the short message template, the present embodiment differs from the first embodiment in S404 to S405, where S401 to S403 in the present embodiment are the same as S101 to S103 in the first embodiment, and S404 to S405 are further refinements of S104. As shown in fig. 6, S404 to S405 are specifically as follows:
s404: and determining the same short message content and different short message contents based on the first short message and the third short message, and taking the different short message contents as variable parameters.
The device obtains the same short message content and different short message contents in the first short message and the third short message, wherein the device can traverse the first short message and the third short message to obtain the same short message content and different short message contents. After the same short message content and different short message contents are acquired, the different short message contents are used as variable parameters, namely the positions of the different short message contents are replaceable parameters, and the variable parameters are used for generating a short message template together with the same short message contents.
Further, in order to accurately acquire the same short message content and different short message contents, S404 may include S4041 to S4043, as shown in fig. 7, S4041 to S4043 specifically include the following:
s4041: and respectively acquiring fourth word segmentation information in the first short message and third word segmentation information in the third short message based on the word segmentation extraction strategy.
The specific method for acquiring the fourth segmentation information in the first short message and the third segmentation information in the third short message in S4041 is the same as S2021, and reference may be specifically made to the related description of S2021, which is not described herein again.
S4042: and extracting the same first target word segmentation information in the fourth word segmentation information and the third word segmentation information as the same short message content.
The device traverses the fourth word segmentation information and the third word segmentation information, and extracts the same word segmentation information in the fourth word segmentation information and the third word segmentation information, namely the first target word segmentation information, as the same short message content. For example, the first short message is: "the honored user is good, your verification code is 1234" this time, the fourth word information is: "respect" (1), "of" (2), "user" (3), "good" (4), "you" (5), "this time" (6), "of" (7), "verification code" (8), "yes" (9), "1" (10), "2" (11), "3" (12), "4" (13). Wherein, the number in the parentheses after each first participle is the preset number of the participle.
The third short message A is as follows: "the user respected is your good, your verification code this time is 1234. The third participle information of the third short message a is: "respect" (1), "of" (2), "user" (3), "hello" (14), "you" (15), "this time" (6), "of" (7), "verification code" (8), "yes" (9), "1" (10), "2" (11), "3" (12), and "4" (13).
The third short message B is: "the respected user is good, your passcode this time is 5678. The third participle information of the "third short message B is: "respect" (1), "of" (2), "user" (3), "good" (4), "you" (5), "this time" (6), "of" (7), "verification code" (8), "yes" (9), "5" (16), "6" (17), "7" (18), "8" (19).
Acquiring a set of preset numbers of a first short message, a third short message A and a third short message B:
a first short message: {1,2,3,4,5,6,7,8,9, 10, 11, 12, 13},
a third short message A: {1,2,3, 14, 15,6,7,8,9, 10, 11, 12, 13}
A third short message B: {1,2,3,4,5,6,7,8,9, 16, 17, 18, 19}
The same part in the three sets is taken as: {1, 2, 3, 6, 7, 8, 9}, the extracted same short message content is: "respect", "user", "this", "verification code" and "yes".
S4043: and extracting different second target word segmentation information in the fourth word segmentation information and the third word segmentation information as different short message contents, and taking the different short message contents as variable parameters.
The device extracts the fourth word segmentation information and different second target word segmentation information in the third word segmentation information as different short message contents, and uses the different short message contents as variable parameters, and a specific extraction mode can participate in the related description in S4042, which is not described herein again.
S405: and generating a short message template according to the same short message content and the variable parameter.
The equipment generates a short message template according to the same short message content and the variable parameter, wherein the same short message content is used as a fixed character in the short message template, and the variable parameter is used for setting a variable filling position in the short message template.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Please refer to fig. 8, fig. 8 is a schematic diagram of a short message template generating device according to a fifth embodiment of the present application. The units included are used to perform the steps in the embodiments corresponding to fig. 1-7. Please refer to the related description of the embodiments corresponding to fig. 1 to fig. 7. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 8, the short message template generating device 8 includes:
a first determining unit 810, configured to determine a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
a first calculating unit 820, configured to calculate a first feature value corresponding to the first short message and a second feature value corresponding to the second short message respectively;
a second determining unit 830, configured to determine, based on the first feature value and the second feature value, a third short message similar to the first short message from the second short message;
a first generating unit 840, configured to generate a short message template based on the first short message and the third short message.
Further, the first calculation unit 820 includes:
and the second calculating unit is used for calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message respectively based on a preset characteristic value calculating strategy.
Further, the second calculating unit is specifically configured to:
extracting first word segmentation information in the first short message from the first short message based on a word segmentation information extraction strategy;
extracting second word segmentation information in the second short message from the second short message based on a word segmentation information extraction strategy;
performing hash calculation on the first segmentation information based on a preset hash algorithm to obtain a first characteristic value;
and carrying out Hash calculation on the second word segmentation information based on a preset Hash algorithm to obtain a second characteristic value.
Further, the second determining unit 830 includes:
the screening unit is used for screening a target characteristic value from the second characteristic value based on the first characteristic value and a preset similar short message screening condition;
and the first marking unit is used for marking the short message information corresponding to the target characteristic value as a third short message similar to the first short message.
Further, the screening unit is specifically configured to:
calculating Hamming distance information between the first characteristic value and the second characteristic value;
and when the Hamming distance information is smaller than a preset threshold value, marking the second characteristic value as a target characteristic value.
Further, the first generating unit 840 includes:
a third determining unit, configured to determine the same short message content and different short message contents based on the first short message and the third short message, and use the different short message contents as variable parameters;
and the second generating unit is used for generating a short message template according to the same short message content and the variable parameter.
Further, the third determining unit is specifically configured to:
respectively acquiring fourth word segmentation information in the first short message and third word segmentation information in the third short message based on the word segmentation extraction strategy;
extracting the same first target word segmentation information in the fourth word segmentation information and the third word segmentation information as the same short message content;
and extracting different second target word segmentation information in the fourth word segmentation information and the third word segmentation information as different short message contents, and taking the different short message contents as variable parameters.
Fig. 9 is a schematic diagram of a device for generating a short message template according to a sixth embodiment of the present application. As shown in fig. 9, the short message template generating device 9 of this embodiment includes: a processor 90, a memory 91 and a computer program 92 stored in the memory 91 and operable on the processor 90, such as a short message template generating program. The processor 90 executes the computer program 92 to implement the steps in the above-mentioned apparatus and method for generating a short message template, for example, steps 101 to 104 shown in fig. 1. Alternatively, the processor 90, when executing the computer program 92, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 810 to 840 shown in fig. 8.
Illustratively, the computer program 92 may be partitioned into one or more modules/units that are stored in the memory 91 and executed by the processor 90 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used for describing the execution process of the computer program 92 in the short message template generating device 9. For example, the computer program 92 may be divided into a first determining unit, a generating unit, a first calculating unit, a second determining unit, and a first generating unit, and each unit has the following specific functions:
the first determining unit is used for determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
the first calculation unit is used for calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message respectively;
a second determining unit, configured to determine, based on the first feature value and the second feature value, a third short message similar to the first short message from the second short message;
and the first generating unit is used for generating a short message template based on the first short message and the third short message.
The device for generating the short message template may include, but is not limited to, a processor 90 and a memory 91. Those skilled in the art will appreciate that fig. 9 is only an example of the short message template generating device 9, and does not constitute a limitation to the short message template generating device 9, and may include more or less components than those shown in the drawings, or combine some components, or different components, for example, the short message template generating device may further include an input/output device, a network access device, a bus, etc.
The Processor 90 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 91 may be an internal storage unit of the short message template generating device 9, such as a hard disk or a memory of the short message template generating device 9. The memory 91 may also be an external storage device of the short message template generating device 9, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like equipped on the short message template generating device 9. Further, the memory 91 may also include both an internal storage unit and an external storage device of the short message template generating device 9. The memory 91 is used for storing the computer program and other programs and data required by the short message template generating device 9. The memory 91 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. . Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method for generating a short message template is characterized by comprising the following steps:
determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message;
determining a third short message similar to the first short message from the second short message based on the first characteristic value and the second characteristic value;
and generating a short message template based on the first short message and the third short message.
2. The method for generating the short message template as claimed in claim 1, wherein the calculating a first feature value corresponding to the first short message and a second feature value corresponding to the second short message respectively comprises:
and respectively calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message based on a preset characteristic value calculation strategy.
3. The method for generating the short message template as claimed in claim 2, wherein the calculating a first feature value corresponding to the first short message and a second feature value corresponding to the second short message based on a preset feature value calculating policy respectively comprises:
extracting first word segmentation information in the first short message from the first short message based on a word segmentation information extraction strategy;
extracting second word segmentation information in the second short message from the second short message based on a word segmentation information extraction strategy;
performing hash calculation on the first segmentation information based on a preset hash algorithm to obtain a first characteristic value;
and carrying out Hash calculation on the second word segmentation information based on a preset Hash algorithm to obtain a second characteristic value.
4. The method of claim 1, wherein the determining a third short message similar to the first short message from the second short message based on the first feature value and the second feature value comprises:
screening a target characteristic value from the second characteristic values based on the first characteristic value and a preset similar short message screening condition;
and marking the short message information corresponding to the target characteristic value as a third short message similar to the first short message.
5. The method for generating the short message template as claimed in claim 4, wherein the step of screening out the target feature value from the second feature value based on the first feature value and a preset similar short message screening condition comprises:
calculating Hamming distance information between the first characteristic value and the second characteristic value;
and when the Hamming distance information is smaller than a preset threshold value, marking the second characteristic value as a target characteristic value.
6. The method for generating the short message template according to any one of claims 1 to 5, wherein the generating the short message template based on the first short message and the third short message comprises:
determining the same short message content and different short message contents based on the first short message and the third short message, and taking the different short message contents as variable parameters;
and generating a short message template according to the same short message content and the variable parameter.
7. The method of claim 6, wherein the determining the same short message content and different short message content based on the first short message and the third short message and using the different short message content as a variable parameter comprises:
respectively acquiring fourth word segmentation information in the first short message and third word segmentation information in the third short message based on the word segmentation extraction strategy;
extracting the same first target word segmentation information in the fourth word segmentation information and the third word segmentation information as the same short message content;
and extracting different second target word segmentation information in the fourth word segmentation information and the third word segmentation information as different short message contents, and taking the different short message contents as variable parameters.
8. A device for generating a short message template is characterized by comprising:
the first determining unit is used for determining a first short message and a second short message from the sample short messages; the first short message is a short message meeting a preset requirement, the second short message is a short message except the first short message in the sample short message, and the number of the second short messages is at least two;
the first calculation unit is used for calculating a first characteristic value corresponding to the first short message and a second characteristic value corresponding to the second short message respectively;
a second determining unit, configured to determine, based on the first feature value and the second feature value, a third short message similar to the first short message from the second short message;
and the generating unit is used for generating a short message template based on the first short message and the third short message.
9. A device for generating a short message template, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN201911032770.3A 2019-10-28 2019-10-28 Method and device for generating short message template Pending CN110852083A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911032770.3A CN110852083A (en) 2019-10-28 2019-10-28 Method and device for generating short message template

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911032770.3A CN110852083A (en) 2019-10-28 2019-10-28 Method and device for generating short message template

Publications (1)

Publication Number Publication Date
CN110852083A true CN110852083A (en) 2020-02-28

Family

ID=69598942

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911032770.3A Pending CN110852083A (en) 2019-10-28 2019-10-28 Method and device for generating short message template

Country Status (1)

Country Link
CN (1) CN110852083A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114117376B (en) * 2022-01-28 2022-04-15 蘑菇物联技术(深圳)有限公司 Identity authentication method, method for distributing dynamic password and corresponding equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221558A (en) * 2008-01-22 2008-07-16 安徽科大讯飞信息科技股份有限公司 Method for automatically extracting sentence template
CN106547738A (en) * 2016-11-02 2017-03-29 北京亿美软通科技有限公司 A kind of overdue short message intelligent method of discrimination of the financial class based on text mining
CN107493370A (en) * 2016-06-12 2017-12-19 阿里巴巴集团控股有限公司 Traffic Profile determines method, flow information recognition methods and device
CN107748739A (en) * 2017-10-19 2018-03-02 上海大汉三通通信股份有限公司 A kind of extracting method and relevant apparatus of short message text masterplate

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221558A (en) * 2008-01-22 2008-07-16 安徽科大讯飞信息科技股份有限公司 Method for automatically extracting sentence template
CN107493370A (en) * 2016-06-12 2017-12-19 阿里巴巴集团控股有限公司 Traffic Profile determines method, flow information recognition methods and device
CN106547738A (en) * 2016-11-02 2017-03-29 北京亿美软通科技有限公司 A kind of overdue short message intelligent method of discrimination of the financial class based on text mining
CN107748739A (en) * 2017-10-19 2018-03-02 上海大汉三通通信股份有限公司 A kind of extracting method and relevant apparatus of short message text masterplate

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114117376B (en) * 2022-01-28 2022-04-15 蘑菇物联技术(深圳)有限公司 Identity authentication method, method for distributing dynamic password and corresponding equipment

Similar Documents

Publication Publication Date Title
CN108985066B (en) Intelligent contract security vulnerability detection method, device, terminal and storage medium
CN109344154B (en) Data processing method, device, electronic equipment and storage medium
CN110597814B (en) Structured data serialization and deserialization method and device
CN108664471B (en) Character recognition error correction method, device, equipment and computer readable storage medium
CN108764951B (en) User similarity obtaining method and device, equipment and storage medium
CN112214402B (en) Code verification algorithm selection method, device and storage medium
CN112533209A (en) Black product identification method and black product identification device
CN109145651B (en) Data processing method and device
CN112468658A (en) Voice quality detection method and device, computer equipment and storage medium
CN111177362B (en) Information processing method, device, server and medium
CN113806350B (en) Management method and system for improving security of big data transaction platform
CN110852083A (en) Method and device for generating short message template
CN113505595A (en) Text phrase extraction method and device, computer equipment and storage medium
CN113032524A (en) Trademark infringement identification method, terminal device and storage medium
CN112949290A (en) Text error correction method and device and communication equipment
CN116955590A (en) Training data screening method, model training method and text generation method
CN111324645B (en) Block chain data processing method and device
WO2021097624A1 (en) File processing method, file processing apparatus, and terminal device
CN113742738A (en) Model parameter safety protection method, safety protection device and computer device
CN115658976A (en) Equipment fingerprint analysis method and system based on locality sensitive hashing
CN113220949B (en) Construction method and device of private data identification system
CN112579061B (en) Method, device, system and storage medium for data transfer between android components
CN113722321A (en) Data export method and device and electronic equipment
CN109033070B (en) Data processing method, server and computer readable medium
CN111651979A (en) Error correction method and device for vehicle attributes, storage medium and terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination