Short message reply method and system, electronic equipment and storage medium
By extracting and training the user's historical reply data and generating a SMS reply model, the problem of inefficient existing SMS reply methods is solved, personalized and context-adapted SMS reply is achieved, and communication efficiency is improved.
Patent Information
- Application Number
- CN202411432453.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-21
AI Technical Summary
Existing SMS response methods are inefficient, especially when fast and accurate expression is required. The existing preset reply templates lack personalization and context adaptability, resulting in frequent modifications for users to adapt to specific situations.
By extracting and training the user's historical reply data, a SMS reply model is generated, and SMS reply suggestions are generated based on the current SMS message, improving reply efficiency and personalization.
It realizes the generation of personalized reply suggestions based on user historical data and current messages, improves the efficiency and accuracy of SMS reply, and adapts to communication needs in different situations.
Smart Images

Figure CN119493842A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of natural language processing technology, and in particular to a text message reply method, system, electronic device and storage medium. Background Art
[0002] SMS (Short Message Service) is a service that sends short messages to other mobile phones in a mobile phone network. Based on this service, users can directly send or receive text or digital information through mobile phones or other telecommunications terminals. When using traditional SMS services or instant messaging tools, users usually need to manually enter replies, which is inefficient in fast communication scenarios, especially for common or repetitive replies, which requires users to repeat the same or similar operations, which is very time-consuming and energy-consuming.
[0003] At present, in response to the above problems, the existing technical solution is to set a preset reply template, and the user can choose the content in the reply template to reply to the message, but the existing preset reply templates are fixed and universal. These templates often lack accuracy and relevance because they fail to fully understand the user's historical data and current communication context, and cannot generate personalized replies based on the user's personal reply habits and the current communication context content. This limits the user's ability to express quickly and accurately in various specific situations, and lacks personalization and context adaptability. When the content in the template does not match the current communication scenario, the user needs to modify the content in the reply template before replying to the text message, resulting in low efficiency in text message replies. Summary of the invention
[0004] The embodiments of the present application provide a text message reply method, system, electronic device and storage medium, which obtain feature data by extracting features from user historical reply data; train the feature data to generate a text message reply model, and use the text message reply model to generate text message reply suggestions based on the current text message. The present application can improve the efficiency of text message replies.
[0005] The embodiments of the present application provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for replying to a text message, the method comprising:
[0007] Get user historical reply data;
[0008] Extract features from the user's historical reply data to obtain feature data;
[0009] Train the feature data to generate a SMS reply model;
[0010] Get the current SMS message;
[0011] Through the SMS reply model, SMS reply suggestions are generated based on the current SMS message.
[0012] In some embodiments, the method further comprises:
[0013] Removing noise information from the user's historical reply data to obtain first processed data, wherein the noise information includes special symbols;
[0014] The first processed data is word segmented to obtain second processed data, wherein the user's historical reply data includes context information and reply information, and the second processed data includes a number of phrases corresponding to the context information and a number of phrases corresponding to the reply information.
[0015] In some embodiments, one piece of context information corresponds to one piece of reply information, and the method further includes:
[0016] Through the word embedding model, semantic analysis is performed on several phrases corresponding to the context information to obtain semantic feature results;
[0017] According to the semantic feature results, the context information and the reply information are clustered to classify the context information with the same semantic feature results and its corresponding reply information into the same topic classification set, thereby generating several topic classification sets.
[0018] In some embodiments, feature extraction is performed on the user's historical reply data to obtain feature data, including:
[0019] Through the word frequency statistical model, the frequencies of several phrases corresponding to the reply information in each topic classification set are counted to obtain the word frequency information corresponding to each topic classification set;
[0020] Perform syntactic analysis on the reply information to obtain the sentence structure corresponding to the reply information;
[0021] Feature extraction is performed on word frequency information and sentence structure to obtain first feature data, wherein the first feature data includes a first feature vector.
[0022] In some embodiments, training the feature data to generate a text message reply model includes:
[0023] Based on the machine learning algorithm, the first feature vector is classified to obtain several classification results;
[0024] Set sentiment tendency labels, and annotate the classification results according to the sentiment tendency labels to obtain sentiment annotation results;
[0025] The sentiment labeling results are trained to obtain a text message reply model, where each topic classification set corresponds to a text message reply model.
[0026] In some embodiments, the SMS reply model generates SMS reply suggestions based on the current SMS message, including:
[0027] According to the current SMS message, a semantic analysis is performed on the current SMS message to determine the topic classification set to which the current SMS message belongs;
[0028] Determine the SMS reply model corresponding to the topic classification set according to the topic classification set to which the current SMS message belongs;
[0029] Extracting features of the current short message to obtain second feature data of the current short message, wherein the second feature data includes a second feature vector;
[0030] The second feature vector is input into the SMS reply model to generate SMS reply suggestions.
[0031] In some embodiments, after generating the text message reply suggestion, the method further includes:
[0032] After generating multiple SMS reply suggestions, determining the priority of the SMS reply suggestions according to the relevance of the SMS reply suggestions to the current SMS message;
[0033] Obtaining feedback instructions from the user, wherein the feedback instructions include modification instructions and selection instructions;
[0034] If the feedback instruction is a modification instruction, the SMS reply suggestion is modified according to the modification instruction to obtain a modified SMS reply suggestion; the modified SMS reply suggestion is input into the SMS reply model to optimize the SMS reply model;
[0035] If the feedback instruction is a selection instruction, then according to the selection instruction, a text message reply suggestion corresponding to the selection instruction is obtained; and the priority of the text message reply suggestion corresponding to the selection instruction is increased to the highest priority.
[0036] In a second aspect, an embodiment of the present application provides a text message reply system, the system comprising:
[0037] A server, which is communicatively connected to a user terminal, is used to obtain historical reply data of the user; extract features from the historical reply data of the user to obtain feature data; train the feature data to generate a short message reply model; or receive a current short message sent by the user terminal; generate a short message reply suggestion based on the current short message through the short message reply model, and send the reply suggestion to the user terminal;
[0038] The user terminal is connected to the server for communication. The user terminal is used to obtain the current SMS message and send the current SMS message to the server.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0040] at least one processor; and
[0041] a memory communicatively connected to at least one processor; wherein,
[0042] The memory stores instructions that can be executed by at least one processor, and the instructions are executed by at least one processor so that the at least one processor can execute the text message reply method as described in the first aspect.
[0043] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable an electronic device to execute the text message reply method of the first aspect.
[0044] The beneficial effect of the implementation mode of the present application is: different from the prior art, the implementation mode of the present application provides a text message reply method, which includes: obtaining user historical reply data; performing feature extraction on the user's historical reply data to obtain feature data; training the feature data to generate a text message reply model; obtaining the current text message; performing feature extraction on the user's historical reply data to obtain feature data; training the feature data to generate a text message reply model, and through the text message reply model, generating text message reply suggestions according to the current text message, the present application can improve the efficiency of text message replies. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.
[0046] Figure 1 It is a structural diagram of a text message reply system provided in an embodiment of the present application;
[0047] Figure 2 A flowchart of a method for replying to a text message provided in an embodiment of the present application;
[0048] Figure 3 This is a schematic diagram of a process for preprocessing user historical reply data provided by an embodiment of the present application;
[0049] Figure 4 It is a schematic diagram of a process of generating a topic classification set provided by an embodiment of the present application;
[0050] Figure 5 yes Figure 2 A detailed flow chart of step S202 in FIG.
[0051] Figure 6 yes Figure 2 A detailed flow chart of step S203 in FIG.
[0052] Figure 7 yes Figure 2 A detailed flow chart of step S205 in FIG.
[0053] Figure 8 This is a flowchart of a process according to a user's feedback instruction provided by an embodiment of the present application;
[0054] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0055] Description of Figure Numbers:
[0056] Label name Label name 100 SMS reply system 101 User Terminal 102 server 901 Electronic devices 911 processor 912 Memory DETAILED DESCRIPTION
[0057] In order to facilitate the understanding of the present application, the present application is described in more detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that when an element is described as "fixed to" another element, it can be directly on the other element, or there can be one or more centered elements therebetween. When an element is described as "connected to" another element, it can be directly connected to the other element, or there can be one or more centered elements therebetween. The terms "vertical", "horizontal", "left", "right" and similar expressions used in this specification are for illustrative purposes only.
[0058] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in this specification and in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0059] The technical solution of the present application is described in detail below in conjunction with the accompanying drawings:
[0060] See also Figure 1 , Figure 1 It is a structural diagram of a text message reply system provided in an embodiment of the present application;
[0061] like Figure 1As shown, the SMS reply system 100 includes: a user terminal 101 and a server 102, wherein the user terminal 101 and the server 102 are connected via a network communication, wherein the network includes a wired network and / or a wireless network. It is understandable that the network includes wireless networks such as 2G, 3G, 4G, 5G, wireless LAN, Bluetooth, etc., and may also include wired networks such as serial cables and network cables.
[0062] The user terminal 101 is communicatively connected to the server 102, and is used to obtain the current SMS message and send the current SMS message to the server 102; or, receive the SMS reply suggestion sent by the server 102; specifically, the user terminal obtains the current SMS message, which is the message currently received in real time, and uploads the SMS message to the server, so that the server obtains the SMS reply suggestion according to the current SMS message through the SMS reply model. After the server generates the SMS reply suggestion, the server will send the SMS reply suggestion to the user terminal, and the user terminal receives the SMS reply suggestion sent by the server. In addition, the user terminal is also used to receive feedback instructions issued by the user, wherein the feedback instructions include modification instructions and selection instructions. The modification instruction refers to an instruction to modify the SMS reply suggestion, and the selection instruction refers to an instruction to select the SMS reply suggestion.
[0063] In the embodiment of the present application, the user terminal may be a device, or a component, integrated circuit, or chip in the terminal. The device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be 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 non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), etc., which is not specifically limited in the embodiment of the present application.
[0064] The server 102 is communicatively connected to the user terminal 101, and is used to obtain the user's historical reply data; perform feature extraction on the user's historical reply data to obtain feature data; perform training on the feature data to generate a short message reply model; or, receive the current short message sent by the user terminal 101; generate short message reply suggestions based on the current short message through the short message reply model, and send the reply suggestions to the user terminal 101; specifically, first, after the server obtains the user's historical reply data, the user's historical reply data is preprocessed: noise information in the user's historical reply data is removed to obtain first processed data, and the first processed data is segmented through a word segmentation tool to obtain second processed data, wherein the user's historical reply data includes context information and reply information, and the second processed data includes a number of phrases corresponding to the context information and a number of phrases corresponding to the reply information; then, a semantic analysis is performed on the several phrases corresponding to the context information through a word embedding model to obtain a semantic feature result; based on the semantic feature result, a clustering operation is performed on the context information and the reply information to divide the context information and its corresponding reply information with the same semantic feature result to the same topic classification set, and then generate several topic classification sets. Through the word frequency statistical model, the frequencies of several phrases corresponding to the reply information in each topic classification set are counted to obtain the word frequency information corresponding to each topic classification set, the reply information is syntactically analyzed to obtain the sentence structure corresponding to the reply information, and the word frequency information and the sentence structure are feature extracted to obtain the first feature data; finally, based on the machine learning algorithm, the first feature data is classified to obtain several classification results, and the sentiment tendency labels are set, and the classification results are annotated according to the sentiment tendency labels to obtain the sentiment annotation results, and the sentiment annotation results are trained to obtain the SMS reply model; or, after receiving the current SMS message sent by the user terminal, according to the current SMS message, the current SMS message is semantically analyzed to determine the topic classification set to which the current SMS message belongs, according to the topic classification set to which the current SMS message belongs, the SMS reply model corresponding to the topic classification set is determined, the feature extraction is performed on the current SMS message to obtain the second feature data of the current SMS message, and the second feature vector is input into the SMS reply model to generate SMS reply suggestions.
[0065] In an embodiment of the present application, the server 102 is also used to determine the priority of the SMS reply suggestions after generating multiple SMS reply suggestions, based on the degree of relevance of the SMS reply suggestions to the current SMS message; obtain a user feedback instruction sent by the user terminal; determine whether the feedback instruction is a modification instruction; modify the SMS reply suggestion according to the modification instruction to obtain a modified SMS reply suggestion; input the modified SMS reply suggestion into the SMS reply model to optimize the SMS reply model; if the feedback instruction is a selection instruction, obtain the SMS reply suggestion corresponding to the selection instruction according to the selection instruction; and increase the priority of the SMS reply suggestion corresponding to the selection instruction to the highest priority.
[0066] In the embodiment of the present application, the number of the server 102 may be one or more, and a plurality of servers may constitute a server cluster, for example, the server cluster includes a first server, a second server, ..., an Nth server, or the server cluster may be a cloud computing service center, which includes a plurality of servers. The servers in the embodiment of the present application include, but are not limited to, tower servers, rack servers, blade servers, and cloud servers. Preferably, the server is a cloud server (Elastic Compute Service, ECS).
[0067] In some embodiments, the SMS reply system may include two or more user terminals. For example, when the SMS reply system includes a first user terminal and a second user terminal, after the first user terminal receives the first current SMS message, the first current SMS message is uploaded to the server, so that the server obtains an SMS reply suggestion based on the current SMS message through an SMS reply model, and the server can send the SMS reply suggestion to the first user terminal through the cloud service; or, after the second user terminal receives the second current SMS message, the second current SMS message is uploaded to the server, so that the server obtains an SMS reply suggestion based on the current SMS message through the SMS reply model, and the server can send the SMS reply suggestion to the second user terminal through the cloud service.
[0068] In an embodiment of the present application, the implementation method of the present application provides a text message reply system, which includes: a server, which is communicatively connected to a user terminal, and the server is used to obtain user historical reply data; feature extraction is performed on the user historical reply data to obtain feature data; the feature data is trained to generate a text message reply model; or, a current text message sent by the user terminal is received; through the text message reply model, text message reply suggestions are generated according to the current text message, and the reply suggestions are sent to the user terminal; a user terminal, which is communicatively connected to the server, and the user terminal is used to obtain the current text message and send the current text message to the server; feature extraction is performed on the user historical reply data to obtain feature data; the feature data is trained to generate a text message reply model, and through the text message reply model, text message reply suggestions are generated according to the current text message. The present application can improve the efficiency of text message replies.
[0069] See also Figure 2 , Figure 2 A flowchart of a method for replying to a text message provided in an embodiment of the present application;
[0070] The SMS reply method is applied to an electronic device. Specifically, the execution subject of the method is one or more processors of the electronic device.
[0071] like Figure 2 As shown, the SMS reply method includes:
[0072] Step S201: Obtain user historical reply data;
[0073] Specifically, the user terminal obtains the user's historical reply data and sends the user's historical reply data to the server, so that the server pre-processes the user's historical reply data, wherein the user's historical reply data includes context information and reply information, the context information includes text in the form of interrogative sentences, affirmative sentences, etc., and the reply information refers to the content replied by the user according to the context information. For example, assuming the context information is: "What are your plans this morning?", then the user will reply according to the context information, and the reply information is: "I have a meeting in the morning". It can be understood that one piece of context information corresponds to one reply message.
[0074] Please refer to Figure 3 , Figure 3 This is a schematic diagram of a process for preprocessing user historical reply data provided by an embodiment of the present application;
[0075] like Figure 3 As shown in FIG. 1 , the process of preprocessing the user's historical reply data includes:
[0076] Step S301: removing noise information from the user's historical reply data to obtain first processed data;
[0077] Specifically, before generating the SMS reply model, the user's historical reply data needs to be preprocessed. First, a data cleaning operation is performed on the noise information in the user's historical reply data, where the noise information includes special symbols. The data cleaning operation includes deleting the special symbols in the user's historical reply data to obtain the first processed data.
[0078] In some embodiments, the noise information also includes punctuation marks and stop words, where stop words refer to certain functional words or words without actual meaning, and stop words include prepositions, conjunctions, articles, pronouns, etc., for example, "and", "in", "the", "a", "is", etc. The data cleaning operation includes deleting punctuation marks and filtering stop words in the user's historical reply data.
[0079] Step S302: performing word segmentation processing on the first processed data to obtain second processed data;
[0080] Specifically, the first processed data is segmented by a word segmentation tool to obtain the second processed data, wherein the word segmentation tool includes but is not limited to the jieba library, the Tokenizer word segmenter, and the Stanford word segmenter. The Python jieba library is a Chinese word segmentation tool, which can segment a Chinese text into words one by one, facilitating subsequent natural language processing tasks, such as text classification, sentiment analysis, etc. The jieba library can use a word segmentation method based on a prefix dictionary, in addition to being able to segment common words in Chinese, it can also process ambiguous words and new words in Chinese. When the user history recovery data is in Chinese, the first processed data is segmented by the jieba library in phython, and when the user history recovery data is in English, the first processed data is segmented by the Tokenizer word segmenter or the Stanford word segmenter, and the text is decomposed into word or phrase units to obtain the second processed data, so as to facilitate the subsequent formation of phrases through words or vocabulary, wherein the user history reply data includes context information and reply information, and the second processed data includes a number of phrases corresponding to the context information and a number of phrases corresponding to the reply information.
[0081] In some embodiments, if the user's historical reply data is in English, preprocessing the user's historical reply data also includes word form restoration: restoring words to their basic form in order to unify words with the same meaning but different forms. If the user's historical reply data is in Chinese, preprocessing the user's historical reply data also includes: setting the user's historical reply data to a text format with the same size and font to facilitate subsequent processing of data in a unified text format.
[0082] Please refer to Figure 4 , Figure 4It is a schematic diagram of a process of generating a topic classification set provided by an embodiment of the present application;
[0083] like Figure 4 As shown in FIG. 1 , the process of generating a topic classification set includes:
[0084] Step S401: using a word embedding model, semantic analysis is performed on a number of phrases corresponding to the context information to obtain semantic feature results;
[0085] Specifically, the word embedding model achieves semantic analysis by mapping words to a low-dimensional vector space and capturing the semantic relationship between words. The core of the word embedding model is to represent words as real vectors, which can capture the semantic similarity between words, so that words with similar semantics are closer in the vector space. In an embodiment of the present application, the basic principle of the word embedding model is to map words to a continuous high-dimensional vector space and characterize the semantics of words through context information. The word embedding model includes but is not limited to the Word2Vec model, the GloVe model, etc. For example, the phrases in the context information are converted into real vector form to obtain semantic feature results, wherein the semantic feature results include real vectors corresponding to the phrases in the context information, and the relative position of the real vectors in the space reflects the semantic relationship between the phrases, that is, the real vectors encode the semantic information of the words or phrases.
[0086] Step S402: performing a clustering operation on the context information and the reply information according to the semantic feature results, so as to classify the context information and the corresponding reply information with the same semantic feature results into the same topic classification set, thereby generating a plurality of topic classification sets;
[0087] Specifically, the semantic feature result includes a real number vector corresponding to a phrase in the context information. By calculating the similarity between the real number vectors corresponding to different context information, the context information and the reply information are clustered to divide the context information with the same semantic feature result and its corresponding reply information into the same topic classification set, thereby generating several topic classification sets. For example, a vector similarity threshold is set, and the cosine similarity of the two vectors is calculated. If the cosine similarity of the two vectors is greater than or equal to the similarity threshold, the context information corresponding to the vectors is divided into the same topic classification set. If the cosine similarity of the two vectors is less than the similarity threshold, the context information corresponding to the vectors is divided into different topic classification sets. In some embodiments, topics in user historical reply data can also be identified by using topic modeling technology (Latent Direct Allocation, LDA), wherein the principle of topic modeling technology is to assume that there are multiple topics, each group of topics is composed of a group of related words, and the topics in the text are obtained by analyzing the distribution of words in the text.
[0088] Step S202: extracting features from the user's historical reply data to obtain feature data;
[0089] For details, please refer to Figure 5 , Figure 5 yes Figure 2 A detailed flow chart of step S202 in FIG.
[0090] like Figure 5 As shown, step S202: extracting features from the user's historical reply data to obtain feature data, including:
[0091] Step S221: Using a word frequency statistical model, the frequencies of several word groups corresponding to the reply information in each topic classification set are counted to obtain word frequency information corresponding to each topic classification set;
[0092] Specifically, the word frequency statistical model includes the N-gram model. The N-gram model is a language model used to count the frequency of phrases. Its principle is to predict the Nth item based on the first (N-1) items, and to predict the probability of occurrence of a phrase by counting the number of times N words appear at the same time. In the context of extracting frequent phrases, the N-gram model can be used to identify and count the frequency of consecutive word sequences (i.e., phrases). The N-gram model includes a unigram model (N=1), a bigram model (N=2), and a trigram model (N=3), etc., wherein the bigram model and the trigram model take into account the contextual relationship of the words and can better reflect the laws of the language. Through the word frequency statistical model, the frequency of the corresponding phrases in the corresponding reply information in each topic classification set is counted to obtain the word frequency information corresponding to each topic classification set, wherein the value of N represents the length of the extracted phrase, for example, 1-gram represents the extraction of a phrase, 2-gram (or bigram) represents the extraction of a combination of two consecutive phrases, i.e., a phrase consisting of two phrases, and 3-gram (or trigram) represents the extraction of a combination of three consecutive phrases, that is, a phrase consisting of three phrases. When it is necessary to obtain the word frequency information of each phrase, the unigram model of the N-gram model is selected, and the word frequency information of each phrase is obtained through the unigram model of the N-gram model; when it is necessary to obtain the word frequency information of a phrase, the bigram model or trigram model of the N-gram model is selected to obtain the word frequency information of the phrase. It can be understood that the input data of the word frequency statistical model is the phrases in the reply information in the same topic classification set, so as to obtain the phrases or phrases frequently used by users in different topics, thereby improving the accuracy of generating SMS reply suggestions in the subsequent process.
[0093] Step S222: performing syntactic analysis on the reply information to obtain a sentence structure corresponding to the reply information;
[0094] Specifically, in natural language processing, the framework that uses the dependency relationship between words to describe the language structure is called dependency grammar, also known as dependency grammar. Dependency syntactic analysis is used to understand the relationship between sentence components, which helps to identify the main behaviors and objects in the conversation, so as to better understand the context. Dependency analysis of sentences is the process of revealing syntactic structure by analyzing the dependency relationship between words in a sentence. Dependency analysis identifies the grammatical components in a sentence, such as subject, predicate, object, etc., and analyzes the relationship between these components. The results of dependency analysis are usually displayed in the form of a dependency syntactic tree, in which the verb is the center of the sentence, and other components are directly or indirectly connected to the verb to indicate the dependency relationship between them. In an embodiment of the present application, the core predicate of the reply information is first determined, then the relationship between other words and the core predicate is identified, and finally these relationships are displayed in the form of a dependency syntax tree. The dependency syntax tree is a directed graph, in which the root node represents the core predicate of the entire sentence, and other nodes and edges represent the dependency relationships between words. The basic assumption of dependency relationship analysis is that the syntactic structure essentially contains the relationship between words and word pairs, thereby obtaining the sentence structure corresponding to the reply information, wherein the types of sentence structures include but are not limited to subject-predicate relationships, verb-object relationships, adverbial-predicate relationships, etc.
[0095] Step S223: extracting features from word frequency information and sentence structure to obtain first feature data;
[0096] Specifically, the word frequency information and the sentence structure are encoded through the Transformer encoder, and the word frequency information and the sentence structure are converted into a vector form to extract features of the word frequency information and the sentence structure to obtain first feature data, wherein the first feature data includes a first feature vector.
[0097] Step S203: training the feature data to generate a short message reply model;
[0098] For details, please refer to Figure 6 , Figure 6 yes Figure 2 A detailed flow chart of step S203 in FIG.
[0099] like Figure 6 As shown, step S203: training the feature data to generate a short message reply model, including:
[0100] Step S231: classifying the first feature data based on a machine learning algorithm to obtain a number of classification results;
[0101] Specifically, the machine learning algorithm includes an algorithm based on a Transformer model, which calculates the correlation between words through the Transformer model, classifies the first feature data, and obtains a number of classification results.
[0102] Step S232: setting a sentiment tendency label, and labeling the classification result according to the sentiment tendency label to obtain a sentiment labeling result;
[0103] Specifically, after obtaining several classification results, sentiment tendency labels are set. For example, the sentiment tendency labels are set to three categories: positive, negative, and neutral. It should be noted that the category of the sentiment tendency label can be set according to actual needs, and this application does not limit this. The labeling method includes but is not limited to NLP labeling, entity labeling, and text labeling. The classification results are labeled according to preset sentiment labels (such as positive, negative, and neutral) to obtain sentiment labeling results, so as to facilitate subsequent sentiment tendency training in step S233.
[0104] Step S233: training the emotion annotation results to obtain a text message reply model;
[0105] Specifically, the sentiment labeling result includes the first feature data and its corresponding sentiment tendency label. Through a supervised learning algorithm, such as a support vector machine, a random forest or a neural network, the sentiment labeling result is used as training data to train the sentiment labeling result and perform sentiment prediction, so that the model learns the association between the sentiment tendency label and the feature data, and obtains a text message reply model, wherein the neural network includes but is not limited to a convolutional neural network (CNN), a recurrent neural network (RNN) and a self-attention mechanism, etc.
[0106] Step S204: Get the current SMS message;
[0107] Specifically, the user terminal obtains a current SMS message, which is a message currently received in real time, and uploads the SMS message to a server, so that the server obtains an SMS reply suggestion according to the current SMS message through an SMS reply model.
[0108] Step S205: Generate SMS reply suggestions based on the current SMS message through the SMS reply model;
[0109] For details, please refer to Figure 7 , Figure 7 yes Figure 2 A detailed flow chart of step S205 in FIG.
[0110] like Figure 7 As shown, step S205: Generate SMS reply suggestions based on the current SMS message through the SMS reply model, including:
[0111] Step S251: According to the current short message, semantic analysis is performed on the current short message to determine the topic classification set to which the current short message belongs;
[0112] Specifically, a word segmentation tool is used to obtain a phrase in the current text message, and a semantic analysis is performed on the current text message to convert the phrase in the current text message into a real vector, obtain the real vector corresponding to each topic classification set, respectively calculate the cosine similarity between the real vector corresponding to the current text message and the real vector corresponding to each topic classification set, determine the maximum cosine similarity, and determine the topic classification set corresponding to the maximum cosine similarity based on the maximum cosine similarity, and determine the topic classification set as the topic classification set to which the current text message belongs. In some embodiments, the current text message can also be identified by using a topic modeling technology (Latent Dirichlet Allocation, LDA), wherein the principle of the topic modeling technology is to assume that there are multiple topics, each group of topics is composed of a group of related words, and the topic corresponding to the current text message is obtained by analyzing the distribution of words in the text.
[0113] Step S252: determining a text message reply model corresponding to the topic classification set according to the topic classification set to which the current text message belongs;
[0114] Specifically, one topic classification set corresponds to one SMS reply model. After determining the topic classification set to which the current SMS message belongs, the SMS reply model corresponding to the topic classification set is determined based on the topic classification set to which the current SMS message belongs.
[0115] Step S253: extracting features from the current short message to obtain second feature data of the current short message;
[0116] Specifically, through the convolutional neural network, feature extraction is performed on the current text message, and the current text message is converted into a second feature vector to obtain second feature data of the current text message, wherein the second feature data includes the second feature vector.
[0117] Step S254: inputting the second feature vector into the SMS reply model to generate SMS reply suggestions;
[0118] Specifically, the second feature vector is input into the SMS reply model. The SMS reply model calculates the cosine similarity between the second feature vector and the feature vector corresponding to the context information based on the second feature vector and the feature vector corresponding to the context information in the user's historical reply data, thereby determining the context information with the highest similarity and generating SMS reply suggestions based on the context information with the highest similarity.
[0119] Please refer to Figure 8 , Figure 8 This is a flowchart of a process according to a user's feedback instruction provided by an embodiment of the present application;
[0120] like Figure 8 As shown, the process of processing according to the user's feedback instruction includes:
[0121] Step S801: after generating a plurality of SMS reply suggestions, determining the priority of the SMS reply suggestions according to the relevance between the SMS reply suggestions and the current SMS message;
[0122] Specifically, the above-mentioned SMS reply model is a prediction model. By using activation functions such as sigmoid, softmax, etc. in the output layer of the model, these functions can map the output value to a probability value between 0 and 1, indicating the model's predicted probability for the positive class or the predicted probability for multiple categories. The predicted probability is the degree of relevance between the SMS reply suggestion and the current SMS message. It can be understood that in machine learning, probability is used to represent the model's prediction confidence for different categories. In an embodiment of the present application, after generating multiple SMS reply suggestions, the priority of the SMS reply suggestions is determined based on the degree of relevance between the SMS reply suggestions and the current SMS message, wherein the higher the degree of relevance between the SMS reply suggestions and the current SMS message, the higher the priority of the SMS reply suggestions. For example, when a certain SMS reply suggestion has the highest degree of relevance to the current SMS message, the priority of the SMS reply suggestion is determined as the highest priority.
[0123] Step S802: Obtaining user feedback instructions;
[0124] Specifically, the user terminal obtains the user's feedback instruction, wherein the feedback instruction includes a modification instruction and a selection instruction. The modification instruction refers to an instruction for modifying the SMS reply suggestion, and the selection instruction refers to an instruction for selecting the SMS reply suggestion.
[0125] Step S803: determining whether the feedback instruction is a modification instruction;
[0126] Specifically, it is determined whether the feedback instruction is a modification instruction. If the feedback instruction is a modification instruction, the process proceeds to step S804 ; if the feedback instruction is not a modification instruction, the process proceeds to step S806 .
[0127] Step S804: modify the SMS reply suggestion according to the modification instruction to obtain a modified SMS reply suggestion;
[0128] Specifically, if the user issues a modification instruction, after receiving the modification instruction, the user terminal modifies the SMS reply suggestion according to the modification instruction to obtain a modified SMS reply suggestion.
[0129] Step S805: inputting the modified SMS reply suggestion into the SMS reply model to optimize the SMS reply model;
[0130] Specifically, the present application uses machine learning algorithms (such as reinforcement learning) to continuously learn the user's selection behavior, and adjusts the priority of SMS reply suggestions based on these learning results. The user's editing and modification of the SMS reply suggestions is an important feedback that can be used to optimize and improve the SMS reply model. According to the design and objectives of the system, the system will use this behavior as a learning signal and input the modified SMS reply suggestions into the SMS reply model to optimize the SMS reply model and obtain the optimized SMS reply model. In the subsequent SMS reply process, the SMS reply suggestions are obtained through the optimized SMS reply model to improve the overall SMS reply quality and accuracy.
[0131] Step S806: according to the selection instruction, obtaining the SMS reply suggestion corresponding to the selection instruction;
[0132] Specifically, if the feedback instruction is not a modification instruction, it is determined that the feedback instruction is a selection instruction, and a text message reply suggestion corresponding to the selection instruction is obtained.
[0133] Step S807: raising the priority of the SMS reply suggestion corresponding to the selection instruction to the highest priority;
[0134] Specifically, according to the priority of the SMS reply suggestions, the sorting sequence of the SMS reply suggestions is determined. After the SMS reply suggestions corresponding to the selection instructions are obtained, the priority of the SMS reply suggestions corresponding to the selection instructions is raised to the highest priority. It can be understood that when the feedback instruction is a selection instruction, it means that there is a suggestion among the multiple SMS reply suggestions that meets the user's needs. Therefore, the priority of the SMS reply suggestion corresponding to the selection instruction is raised to the highest priority, so that the sorting of the SMS reply suggestion selected by the user can be raised to the first sequence. The system will facilitate the user to select the SMS reply suggestion the next time similar context information appears, thereby improving the efficiency of SMS replies.
[0135] In an embodiment of the present application, the implementation method of the present application provides a text message reply method, which includes: obtaining user historical reply data; performing feature extraction on the user's historical reply data to obtain feature data; training the feature data to generate a text message reply model; obtaining the current text message; performing feature extraction on the user's historical reply data to obtain feature data; training the feature data to generate a text message reply model, and through the text message reply model, generating text message reply suggestions according to the current text message. The present application can improve the efficiency of text message replies.
[0136] Please refer to Fig. 9 , Fig. 9It is a structural schematic diagram of an electronic device provided in an embodiment of the present application;
[0137] like Fig. 9 As shown, the electronic device 901 includes one or more processors 911 and a memory 912. Fig. 9 A processor 911 is taken as an example.
[0138] The processor 911 and the memory 912 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.
[0139] Processor 911 is used to provide computing and control capabilities to control electronic device 901 to perform corresponding tasks, for example, to control electronic device 901 to perform the SMS reply method in any one of the above-mentioned method embodiments, the SMS reply method including: obtaining user historical reply data; performing feature extraction on user historical reply data to obtain feature data; training the feature data to generate an SMS reply model; and obtaining the current SMS message.
[0140] By extracting features from historical user reply data, feature data is obtained; the feature data is trained to generate a text message reply model; and through the text message reply model, text message reply suggestions are generated according to the current text message. This application can improve the efficiency of text message replies.
[0141] The processor 911 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a hardware chip or any combination thereof; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0142] The second memory 912 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the SMS reply method in the embodiment of the present application. The processor 911 can implement the above by running the non-transitory software programs, instructions and modules stored in the second memory 912. Figure 2 Specifically, the second memory 912 may include a volatile memory (VM), such as a random access memory (RAM); the second memory 912 may also include a non-volatile memory (NVM), such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD) or other non-transitory solid-state storage device; the second memory 912 may also include a combination of the above-mentioned types of memories.
[0143] The second memory 912 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 912 may optionally include a memory remotely arranged relative to the processor 911, and these remote memories may be connected to the processor 911 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0144] One or more modules are stored in the processor 911, and when executed by the one or more processors 911, the SMS reply method in any of the above method embodiments is executed, for example, the SMS reply method described above is executed. Figure 2 The steps shown.
[0145] In the embodiment of the present application, the electronic device 901 may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The electronic device 901 may also include other components for realizing device functions, which will not be described in detail here.
[0146] The embodiment of the present application also provides a non-volatile computer-readable storage medium, such as a memory including a program code, and the program code can be executed by a processor to complete the SMS reply method in the above embodiment. For example, the non-volatile computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CDROM), a magnetic tape, a floppy disk, and an optical data storage device.
[0147] The embodiment of the present application also provides a computer program product, which includes one or more program codes, and the program codes are stored in a non-volatile computer-readable storage medium. The processor of the electronic device reads the program code from the non-volatile computer-readable storage medium, and the processor executes the program code to complete the method steps of the SMS reply method provided in the above embodiment.
[0148] A person skilled in the art will appreciate that all or part of the steps for implementing the above embodiments may be accomplished by hardware or by hardware associated with a program code, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0149] Through the description of the above implementation methods, a person of ordinary skill in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, can also be implemented by hardware. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the non-volatile computer-readable storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0150] 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 them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as mentioned above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for replying to a text message, characterized in that: The method comprises: Get user historical reply data; Extracting features from the user's historical reply data to obtain feature data; Training the feature data to generate a text message reply model; Get the current SMS message; Through the SMS reply model, SMS reply suggestions are generated according to the current SMS message.
2. The method according to claim 1, characterized in that The method further comprises: Removing noise information from the user's historical reply data to obtain first processed data, wherein the noise information includes special symbols; The first processed data is word segmented to obtain second processed data, wherein the user historical reply data includes context information and reply information, and the second processed data includes a number of phrases corresponding to the context information and a number of phrases corresponding to the reply information.
3. The method according to claim 2, characterized in that One piece of context information corresponds to one piece of reply information, and the method further includes: Using a word embedding model, semantic analysis is performed on a number of phrases corresponding to the context information to obtain semantic feature results; According to the semantic feature results, a clustering operation is performed on the context information and the reply information to classify the context information with the same semantic feature results and its corresponding reply information into the same topic classification set, thereby generating a plurality of topic classification sets.
4. The method according to claim 3, characterized in that: The extracting features of the user's historical reply data to obtain feature data includes: By using a word frequency statistical model, the frequencies of several word groups corresponding to the reply information in each topic classification set are counted to obtain word frequency information corresponding to each topic classification set; Performing syntactic analysis on the reply information to obtain a sentence structure corresponding to the reply information; Feature extraction is performed on the word frequency information and the sentence structure to obtain first feature data, wherein the first feature data includes a first feature vector.
5. The method according to claim 4, characterized in that The step of training the feature data to generate a short message reply model includes: Based on a machine learning algorithm, classify the first feature vector to obtain several classification results; Setting a sentiment tendency label, and annotating the classification result according to the sentiment tendency label to obtain a sentiment annotation result; The sentiment labeling results are trained to obtain a short message reply model, wherein each topic classification set corresponds to a short message reply model.
6. The method according to claim 1, characterized in that The generating of a text message reply suggestion according to the current text message through the text message reply model includes: According to the current short message, performing semantic analysis on the current short message to determine the topic classification set to which the current short message belongs; Determine, according to the topic classification set to which the current text message belongs, a text message reply model corresponding to the topic classification set; Extracting features of the current short message to obtain second feature data of the current short message, wherein the second feature data includes a second feature vector; The second feature vector is input into the SMS reply model to generate SMS reply suggestions.
7. The method according to claim 1, characterized in that After generating the SMS reply suggestion, the method further includes: After generating a plurality of SMS reply suggestions, determining the priority of the SMS reply suggestions according to the relevance of the SMS reply suggestions to the current SMS message; Obtaining feedback instructions from the user, wherein the feedback instructions include modification instructions and selection instructions; If the feedback instruction is a modification instruction, modify the SMS reply suggestion according to the modification instruction to obtain a modified SMS reply suggestion; input the modified SMS reply suggestion into the SMS reply model to optimize the SMS reply model; If the feedback instruction is a selection instruction, then according to the selection instruction, a text message reply suggestion corresponding to the selection instruction is obtained; and the priority of the text message reply suggestion corresponding to the selection instruction is increased to the highest priority.
8. A short message reply system, characterized in that: The system comprises: A server, communicatively connected to a user terminal, wherein the server is used to obtain historical reply data of the user; extract features from the historical reply data of the user to obtain feature data; train the feature data to generate a short message reply model; or receive a current short message sent by the user terminal; generate a short message reply suggestion based on the current short message through the short message reply model, and send the reply suggestion to the user terminal; The user terminal is communicatively connected to the server, and the user terminal is used to obtain the current SMS message and send the current SMS message to the server.
9. An electronic device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text message reply method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction, and when the computer program or instruction is executed, the SMS reply method according to any one of claims 1 to 7 is implemented.