Customer feature extraction method, device, electronic device and storage medium
By using the trained two-way language model to semantic recognition of the service record text and performing similarity calculations with the seed sentences corresponding to the customer features, the problem of low accuracy in customer feature extraction in the prior art is solved, and higher extraction accuracy is achieved.
Patent Information
- Application Number
- CN202111538219.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-12-15
AI Technical Summary
The existing customer feature extraction methods have low accuracy and it is difficult to accurately identify customer feature information.
The trained two-way language model performs semantic recognition of the target service record text, and combines the seed sentences corresponding to multiple customer features to calculate the similarity between the target service record text and the seed sentences, thereby determining the target customer features.
It significantly improves the accuracy of customer feature extraction, making the extracted customer features more accurate and reliable.
Smart Images

Figure CN114118062B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a method, device, electronic device and storage medium for extracting customer features. Background Art
[0002] Natural Language Processing (NLP) is a cutting-edge technology that integrates linguistics, computer science, and machine learning. NLP technology is used to extract information with specific features, especially in the sales field. It can extract the characteristic information of different customers, allowing sales staff to provide services to customers more quickly and accurately based on the customer's characteristic information. However, it is found in practice that the existing customer feature extraction methods still have the problem of low accuracy. Summary of the invention
[0003] The embodiments of the present application disclose a customer feature extraction method, device, electronic device and storage medium, which greatly improve the accuracy of extracting customer features.
[0004] The embodiment of the present application discloses a customer feature extraction method, characterized in that the method includes: performing semantic recognition on the target service record text through a trained bidirectional language model to obtain a first semantic vector; performing semantic recognition on a seed sentence corresponding to each customer feature among multiple customer features through the bidirectional language model to obtain a second semantic vector corresponding to each seed sentence; determining the similarity between the target service record text and each seed sentence based on the first semantic vector and the second semantic vector of each seed sentence; and determining a target customer feature corresponding to the target service record text from the multiple customer features based on the similarity between the target service record text and each seed sentence.
[0005] In one embodiment, before inputting the target service record text into the trained bidirectional language model, the method further includes: selecting a first short text from the target service record text to be input; and performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector, including: inputting the first short text into the trained bidirectional language model; performing semantic recognition on the first short text through the bidirectional language model to obtain a first semantic vector.
[0006] In one embodiment, selecting a first short text from a target service record text to be input includes: matching the target service record text to be input with keywords corresponding to a plurality of customer characteristics, and selecting a first short text matching the keywords from the target service record text.
[0007] In one embodiment, matching the target service record text to be input with the keywords corresponding to the multiple customer characteristics respectively includes: performing sentence segmentation and text cleaning on the target service record text to be input to obtain multiple second short texts; matching the multiple second short texts with the keywords corresponding to the multiple customer characteristics respectively.
[0008] In one embodiment, determining the target customer feature corresponding to the target service record text based on the similarity between the target service record text and the respective seed sentences includes: when the maximum value of the similarity between the target service record text and the seed sentences corresponding to the first customer feature is greater than a set first threshold, determining the first customer feature as the target customer feature corresponding to the target service record text.
[0009] In one embodiment, determining the target customer feature corresponding to the target service record text based on the similarity between the target service record text and the respective seed sentences includes: when, among the multiple seed sentences corresponding to the second customer feature, the number of seed sentences having a similarity with the target service record text greater than a second threshold is greater than a third threshold, determining the second customer feature as the target customer feature corresponding to the target service record text.
[0010] In one embodiment, the bidirectional language model is trained using sample short texts corresponding to multiple customer features; the sample short text corresponding to each customer feature is screened out from a sample service record text and satisfies the expert rules corresponding to the customer feature; the expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to each customer feature.
[0011] The embodiment of the present application discloses a model training method, which includes: selecting seed sentences corresponding to each of a plurality of customer features from a sample service record text; screening sample short texts satisfying the expert rules from the sample service record text according to expert rules corresponding to the plurality of customer features, so as to obtain sample short texts corresponding to the plurality of customer features; the expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer feature; inputting two sample short texts into a bidirectional language model to be trained each time, and performing semantic recognition on the two sample short texts input by the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts; calculating predicted similarities of the two sample short texts according to the semantic vectors corresponding to the two sample short texts; calculating training losses according to the predicted similarities and the true similarities corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training losses.
[0012] In one embodiment, when the two sample short texts correspond to the same customer feature, the actual similarity corresponding to the two sample short texts is higher than the actual similarity corresponding to the two sample short texts when the two sample short texts correspond to different customer features.
[0013] In one embodiment, the step of selecting seed sentences corresponding to each of a plurality of customer features from a sample service record text comprises: for each of a plurality of customer features, inputting each phrase included in the sample service record text and an artificial keyword corresponding to the customer feature into a word vector model; determining a target keyword matching the artificial keyword from each phrase through the word vector model; and selecting a sentence containing the target keyword from the sample service record text as a seed sentence corresponding to the customer feature.
[0014] In one embodiment, after obtaining sample short texts corresponding to the multiple customer features respectively, and before inputting two sample short texts into the bidirectional language model to be trained, the method further includes: performing a data enhancement operation on the sample short texts; the data enhancement operation includes: at least one of synonym replacement, random insertion, random exchange, and random deletion.
[0015] The embodiment of the present application discloses a customer feature extraction device, which includes: a recognition module, which is used to perform semantic recognition on a target service record text through a trained bidirectional language model to obtain a first semantic vector; and, through the bidirectional language model, perform semantic recognition on a seed sentence corresponding to each customer feature among multiple customer features to obtain a second semantic vector corresponding to each seed sentence; a first determination module, which is used to determine the similarity between the target service record text and each seed sentence based on the first semantic vector and the second semantic vector of each seed sentence; and a second determination module, which is used to determine a target customer feature corresponding to the target service record text from the multiple customer features based on the similarity between the target service record text and each seed sentence.
[0016] The embodiment of the present application discloses a model training device, which includes: a selection module, which is used to select seed sentences corresponding to each of a plurality of customer features from a sample service record text; a screening module, which is used to screen sample short texts that meet the expert rules from the sample service record text according to the expert rules corresponding to the plurality of customer features, so as to obtain sample short texts corresponding to the plurality of customer features; the expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer feature; a prediction module, which is used to input two sample short texts into a bidirectional language model to be trained each time, and perform semantic recognition on the two input sample short texts through the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts; and, according to the semantic vectors corresponding to the two sample short texts, calculate the predicted similarity of the two sample short texts; an adjustment module, which is used to calculate the training loss according to the predicted similarity and the true similarity corresponding to the two sample short texts, and adjust the parameters in the bidirectional language model to be trained according to the training loss.
[0017] An embodiment of the present application discloses an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor implements any one of the customer feature extraction methods or model training methods disclosed in the embodiment of the present application.
[0018] An embodiment of the present application discloses a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, any one of the customer feature extraction methods or model training methods disclosed in the embodiment of the present application is implemented.
[0019] Compared with the related art, the embodiments of the present application have the following beneficial effects:
[0020] The target service record text and the seed sentence corresponding to each customer feature are input into the trained bidirectional language model to obtain the semantic vectors corresponding to the target service record text and the seed sentence, thereby calculating the similarity between the target service record text and the seed sentence based on the corresponding semantic vectors, and determining the target customer feature corresponding to the target service record text from multiple customer features. Since the trained bidirectional language model can perform contextual semantic recognition on the input service record text, the extracted customer features are more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 is a method flow chart of a method for extracting customer features disclosed in an embodiment;
[0023] Figure 2 is an example diagram of a method flow of another method for extracting customer features disclosed in an embodiment;
[0024] Figure 3 is a method flow diagram of a model training method disclosed in an embodiment;
[0025] Figure 4 is an example diagram of a method flow of another model training method disclosed in an embodiment;
[0026] Figure 5a is an example diagram of training a BERT model disclosed in an embodiment;
[0027] Figure 5b is an example diagram of extracting customer features based on a BERT model disclosed in an embodiment;
[0028] Figure 6 is a schematic diagram of the structure of a customer feature extraction device disclosed in an embodiment;
[0029] Figure 7 is a structural schematic diagram of a model training device disclosed in an embodiment;
[0030] Figure 8 The present invention is a schematic structural diagram of an electronic device disclosed in an embodiment. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0032] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0033] In the related art, the information extraction methods for text generally include the following:
[0034] 1. Regularized matching method based on expert rules
[0035] This type of method usually requires technicians to have a good understanding of the text content, which requires a huge amount of manual work. At the same time, expert rules limit the freedom of information extraction. If the expert rules cannot cover all text records of the information to be extracted, it will lead to low coverage and cannot fully cope with customer feature extraction in different scenarios. At the same time, the accuracy of this method is limited by expert rules. If the rules are not formulated accurately, information will be extracted incorrectly.
[0036] 2. Traditional numerical statistical method taking Term Frequency–Inverse Document Frequency (TF-IDF) as an example.
[0037] Taking the TF-IDF algorithm as an example, the TF-IDF algorithm can use indicators such as word occurrence probability to take the phrase with the highest TF-IDF as the keyword of the text, thereby extracting the customer's characteristic information. It can be seen that although this type of numerical statistical method can reduce labor costs, it ignores the semantics of the context of the phrase, that is, it ignores the order of the phrases and the semantic information of the text, resulting in inaccurate extracted features.
[0038] The embodiments of the present application disclose a method, device, electronic device and storage medium for extracting customer features, which greatly improve the accuracy of extracting customer features. Detailed descriptions are given below.
[0039] See also Figure 1 , Figure 1 The method flow diagram of the method for extracting customer features disclosed in an embodiment is shown. The method can be applied to various intelligent terminals, such as personal computers, backend servers of service platforms and other electronic devices, without specific limitation. The method can be used in various sales scenarios, such as car sales, real estate agency sales, etc.; it can also be applied to various service industries to extract customer features so that relevant personnel can provide better services to customers after understanding the customer features.
[0040] It should also be noted that the customer characteristics mentioned in the embodiment of the present invention can be understood as text used to describe the customer, so that the service personnel can have a more comprehensive understanding of the customer through the customer's characteristics and better customize better services for the customer.
[0041] like Figure 1 As shown, the method comprises the following steps:
[0042] 110. Perform semantic recognition on the target service record text by using the trained bidirectional language model to obtain a first semantic vector.
[0043] 120. Perform semantic recognition on seed sentences corresponding to each of the multiple customer features through a bidirectional language model to obtain a second semantic vector for each seed sentence.
[0044] Among them, the target service record text in the above step 110 can be a record text generated in various service processes. For different service fields, the target service record text has the characteristics of the corresponding fields. For example, for the automobile sales scenario, the obtained target service record text includes: follow-up notes during sales, feedback information from users during test drives, customer comments on cars and other texts.
[0045] The seed sentences in step 120 above can usually be a certain number of sentences that can be used to describe customer characteristics, which are manually selected by technicians based on the characteristics of different service fields. Each customer characteristic can correspond to one or more seed sentences, and different customer characteristics can correspond to different seed sentences.
[0046] In some embodiments, a technical solution for obtaining seed sentences corresponding to each customer feature is also provided, which is a solution for obtaining seed sentences non-manually, and details can be found in the following description.
[0047] The seed sentences corresponding to the respective customer features can be stored in the corresponding memory for use in Figure 1 The method shown is used when executing step 110 .
[0048] The bidirectional language model mentioned in the above steps 110 and 120 can be an autoencoder language model, i.e., a BERT (Bidirectional Encoder Representations from Transformers) model, an ELMo (Embedding from Language Models) model, or a RoBERTa (an enhanced version based on BERT) model. Among them, RoBERTa is an improved version of the BERT model, which not only has the characteristics of the BERT model, but also has more powerful data processing capabilities; EIMo uses a bidirectional long short-term memory (Bi-LSTM, Bidirectional Long Short-Term Memory) framework, which can recognize contextual semantics.
[0049] The bidirectional language model is obtained after training with a large number of sample service record texts. The bidirectional language model can perform semantic recognition on the target service record text and seed sentences based on the semantic information of the text to convert the target service record text and seed sentences into corresponding semantic vectors.
[0050] 130. Determine the similarity between the target service record text and each seed sentence according to the first semantic vector and the second semantic vector of each seed sentence.
[0051] The electronic device may calculate the similarity between the target service record text and each seed sentence by calculating the Euclidean distance, cosine similarity, etc. between the first semantic vector and the second semantic vector. The specific similarity is not limited. The similarity between the target service record text and each seed sentence can be used to characterize the semantic similarity between the target service record text and the seed sentence. The higher the similarity between the target service record text and the seed sentence, the more similar they are in semantics.
[0052] 140. According to the similarity between the target service record text and each seed sentence, determine the target customer features corresponding to the target service record text.
[0053] The electronic device may obtain a preset similarity rule, where the similarity rule is used to screen target customer features that match the target service record text from multiple customer features.
[0054] An example similarity rule may include: when the maximum value of the similarity between the service record text and the seed sentence corresponding to the first customer feature is greater than a set first threshold, the first customer feature is determined as the target customer feature corresponding to the target service record text. The first threshold can be set with reference to actual business needs and is not specifically limited. This exemplary similarity rule can filter out the seed sentence that is most similar to the target service record text, thereby determining the target customer feature corresponding to the target service record text as the first customer feature corresponding to the most similar seed sentence.
[0055] Another example similarity rule may include: when the number of seed sentences whose similarity with the target service record text is greater than a second threshold among the multiple seed sentences corresponding to the second customer feature is greater than a third threshold, the second customer feature is determined as the target customer feature corresponding to the target service record text. In actual application scenarios, such as the follow-up process of automobile sales, there may be many different expressions of text describing the same customer feature, and the differences between different texts are huge. For example, "The customer is from Ping An Bank" and "Mr. Liu came with a friend and the two people are from Bank of China" both express that the user's industry is the financial industry", but the similarity between the two sentences is low. This exemplary similarity rule only requires that there are enough seed sentences corresponding to the second customer feature that are similar to the target service record text, and the second customer feature can be extracted from the target service record text, which can reduce the impact of the reduced similarity between sentences due to different expressions on customer feature extraction.
[0056] This is an explanation for ease of understanding and is not intended to limit the embodiments of the present invention.
[0057] Through the above description of a customer feature extraction method provided by an embodiment of the present invention, in this method, the target service record text is input into the trained bidirectional language model, and based on the semantic vector output by the bidirectional language model, the similarity between the target service record text and the seed sentence corresponding to each customer feature is obtained, thereby obtaining the customer features that can be accurately extracted from the target service record text. In addition, since the trained bidirectional language model can perform contextual semantic recognition on the input service record text, the output features describing the customer are more accurate.
[0058] Furthermore, in the field of automobile sales, service record texts are usually sales records, in which a short text can contain a meaning, and the BERT model is more accurate in processing short texts when extracting features by similarity. In this embodiment, the maximum number of words in the text in the BERT model is preferably within 32 words, which can be increased, but if the text is too long, the similarity will be reduced, and it will be difficult to extract features by similarity. For example, "I have already bought a car" and "I have already bought a car, please don't call me", both sentences refer to "buy other cars" in the analysis scenario, but because the second sentence has "please don't call", the similarity of the two sentences is reduced, and it is difficult to extract the information of "buy other cars" in the second sentence. Therefore, before executing the service record text as step 110, the method may also include:
[0059] A first short text is selected from the target service record text to be input.
[0060] Accordingly, in the aforementioned step 110, the electronic device may input the first short text into the bidirectional language model, perform semantic recognition on the first short text through the bidirectional language model, and obtain a first semantic vector.
[0061] By performing the above operations, the features extracted for describing the customers are accurate.
[0062] In some embodiments, the electronic device may perform sentence segmentation processing on the target service record text to be input, so as to divide the target service record text into a plurality of short sentence texts. The electronic device may select a first short text from the short sentence texts obtained after the sentence segmentation processing. The sentence segmentation processing may be a processing of segmenting the target service record text into a plurality of short sentence texts based on punctuation marks.
[0063] An example of selecting the first short text from the short sentence text may include:
[0064] A text cleaning process is performed on the multiple short sentence texts, and the short sentence text retained after the text cleaning process is determined as the first short text. The text cleaning process may include synonym conversion, cleaning of invalid sentences, and the like.
[0065] Synonym conversion refers to converting different words that express the same meaning into the same word to reduce the problem of reduced similarity due to different expressions.
[0066] Cleaning invalid sentences refers to the process of removing invalid text from multiple short sentences, that is, removing short sentences that obviously cannot describe customer characteristics. For example, text cleaning can remove modal particles, time markers, transitional connecting sentences, etc. The definition of invalid text can be determined according to actual business needs, and there is no specific limitation.
[0067] The first short text obtained after the text cleaning operation can more accurately describe customer characteristics, so that the text input into the bidirectional language model is more conducive to model analysis of data and outputs more accurate target customer characteristics.
[0068] Another example of selecting the first short text from the short sentence text may include:
[0069] The target service record text to be input is matched with the keywords corresponding to multiple customer features, and the first short text matching the keywords is filtered out from the target service record text. The keywords corresponding to each customer feature can be manually selected and are most relevant to describing the customer feature. For example, in the new energy vehicle sales scenario, the description of "range anxiety" generally revolves around "range", "mileage", etc. In one embodiment, a technical solution is also provided for mining keywords corresponding to each customer feature from a sample service record text, which is a non-manual solution for obtaining keywords, as described in the following text. The electronic device can filter out a sentence including any keyword from the target service record text as the first short text.
[0070] In some embodiments, the electronic device may integrate the aforementioned sentence segmentation processing, text cleaning processing and keyword matching processing to select the first short text from the target service record text, which may specifically include:
[0071] The input target service record text is processed by sentence segmentation and text cleaning to obtain multiple second short texts; the multiple second short texts are matched with keywords corresponding to multiple customer characteristics, and the first short text matching the keyword is screened out from the multiple second short texts.
[0072] By screening the target service record text, on the one hand, the amount of data input into the bidirectional language model can be reduced, the amount of calculation required for the bidirectional language model to calculate the semantic vector can be reduced, the computational cost of the customer feature extraction method disclosed in the embodiment of the present application can be reduced, and the efficiency of customer feature extraction can be improved; on the other hand, the problem of information loss caused by the reduction in data volume can be reduced by matching keywords, thereby improving the accuracy of customer feature extraction.
[0073] In order to more clearly describe the customer feature extraction method disclosed in the embodiment of this application. Figure 2 , Figure 2 Another method for extracting customer features disclosed in an embodiment is specifically for an application scenario of automobile sales. In this application scenario, the target service record text may be an automobile sales follow-up record text. The extracted customer features may include: car purchase concerns, car purchase obstacles or car purchase reasons, etc., any one of which or any combination of several. The method includes:
[0074] 210. Perform sentence segmentation and text cleaning on the input automobile sales follow-up record text to obtain a plurality of second short texts.
[0075] As shown in Table 1, after the operation in step 210 is performed, a plurality of second short texts are obtained.
[0076]
[0077]
[0078] Table 1. Data comparison between automobile sales follow-up record text and the second short text
[0079] 220. Match the multiple second short texts with the keywords corresponding to the multiple customer characteristics.
[0080] The stored characteristic keywords may be manually designed by a technician before executing the method; or, the keywords may be mined from sample service record texts based on a non-artificial method.
[0081] Through the operation of step 220, invalid sentences or sentences that cannot describe customer characteristics are further eliminated, which can greatly reduce the amount of calculation of the semantic vector, reduce the amount of calculation, and improve the efficiency of customer feature extraction.
[0082] 230. Input the first short text and the seed sentences corresponding to each customer feature in the multiple customer features into the BERT model, perform semantic recognition on the first short text and each seed sentence through the BERT model, and obtain a first semantic vector and a second semantic vector of each seed sentence.
[0083] In the application scenario of automobile sales, the bidirectional language model can use the BERT model. Among them, the BERT model uses the masked language model (MLM) to train the model using the semantics of the words on the left and right, so that the BERT model can output the characteristics of the customer based on the semantics of the input text before and after.
[0084] Exemplarily, the customer feature may include "purchased other cars", and the seed sentences corresponding to "purchased other cars" may include: "purchased", "purchased other cars", "purchased other cars, no need to contact me".
[0085] 240. Determine the similarity between the automobile sales follow-up record text and each seed sentence based on the first semantic vector and the second semantic vector of each seed sentence.
[0086] In step 220, the trained BERT model is used to take the first short text and the seed sentence as inputs to obtain the BERT semantic vectors of each text. The cosine similarity of the semantic vectors can be calculated according to formula (1), and the cosine similarity is used to measure the similarity between the automobile sales follow-up record text and the seed sentence.
[0087]
[0088] Among them, U represents the first semantic vector of the first short text u, V i The i-th seed sentence v representing customer feature v i The second semantic vector of It is represented as the similarity set between the first short text u and the feature v, and n represents the number of seed sentences of the feature v.
[0089] For example, taking sample 1 as an example, the first short text is "ordered a car", and there are three seed sentences about the customer feature "purchased other cars", "purchased", "purchased other cars", and "purchased other cars, no need to find me", and the similarity set obtained by calculating the cosine similarity through formula (1) is shown in formula (2):
[0090] Sim={0.84,0.52,0.41} (2)
[0091] The specific expansion can be shown in Table 2:
[0092]
[0093] Table 2 Similarity calculation between the first short text and the seed sentence
[0094] 250. According to the similarity between the automobile sales follow-up record text and each seed sentence calculated in step 230, determine the target customer features corresponding to the automobile sales follow-up record text.
[0095] Among them, an example similarity rule includes: when the maximum similarity between the service record text and the seed sentence corresponding to the first customer feature is greater than a set first threshold, the first customer feature is determined as the target customer feature corresponding to the target service record text. That is, when the maximum similarity between the first short text u and the seed sentence of the customer feature v is greater than the first threshold θ, as shown in formula (3):
[0096] max(Sim u,v )>θ (3)
[0097] When the first short text and the customer feature v satisfy the similarity rule shown in formula (3), it can be considered that the first short text u describes the customer feature v. Therefore, the target customer feature corresponding to the automobile sales follow-up record text is determined as the customer feature v. The similarity rule can obtain features that accurately describe the customer.
[0098] Another example of similarity rule includes: when the number of seed sentences whose similarity with the target service record text is greater than a second threshold among the multiple seed sentences corresponding to the second customer feature is greater than a third threshold, the second customer feature is determined as the target customer feature corresponding to the target service record text. Specifically, as shown in formula (4), the similarity between the first short text u and the seed sentence of the customer feature v satisfies the following condition
[0099]
[0100] Among them, I(·) is the indicative function. When , its value is 1, otherwise it is 0, where α represents the second threshold; It can be expressed that when the first short text u and the i-th seed sentence v of the customer feature v i When the cosine similarity of the first short text u is greater than the second threshold, it is considered that the first short text u is similar to the seed sentence v. i have similarity; m refers to the minimum number of first short texts u whose similarity with the seed sentence is greater than a certain threshold; δ refers to the minimum proportion of the first short texts u whose similarity with the seed sentence is greater than a certain threshold, that is: 0<α<θ, m>0, 0<δ≤1.
[0101] It is understandable that when the length of the automobile sales follow-up record is long, it may include multiple first short texts matching keywords of different customer characteristics. For each first short text, the cosine similarity between the first short text and the seed sentences corresponding to different customer characteristics may be calculated.
[0102] When the first short text and the customer feature v satisfy the similarity rule shown in formula (4), it can be considered that the first short text u describes the customer feature v. Therefore, the target customer feature corresponding to the automobile sales follow-up record text is determined as the customer feature v. Formula (4) only requires that the number of sufficiently large similarities between the first short text and the seed sentence of a customer feature is greater than a certain number, and the first short text can be considered to describe the customer feature, thereby reducing the impact of reduced similarity due to different expressions.
[0103] The above formulas (3) and (4) are two exemplary matching rules, which are provided for facilitating the understanding of the embodiments of the present invention and should not be construed as limiting the embodiments of the present invention.
[0104] For example, the example in Table 2 satisfies formula (3), so the target customer feature matched to the customer with sample ID 1 can be determined as "whether to buy other cars: yes". For other users who are not matched, the target feature can be "whether to buy other cars: unknown".
[0105] By executing the operations of steps 210 to 250 above, the method realizes the extraction of customer features using the trained BERT model. Since the training of the BERT model includes the training of contextual semantics, the customer features extracted by the salesperson after using the BERT model are more accurate.
[0106] It should be understood that the "first customer feature" and "second customer feature" mentioned in the embodiments of the present application may be the same features or different features. Similarly, the "first threshold", "second threshold" and "third threshold" are only three thresholds for ease of explanation, and the values of the three thresholds are set by technical personnel.
[0107] Table 3 below illustrates the results of extracting target customer features using the BERT model in actual car sales. Target customer features include: the customer's industry, car user, whether they have a car, customer focus, whether they are interested in Tesla cars, whether they are interested in Toyota cars, or when they expect to buy a car, etc. By obtaining target customer features, sales staff can provide different sales strategies for specific customers, so as to better serve customers.
[0108]
[0109]
[0110] Table 3 Example of target customer feature extraction results
[0111] In the customer feature extraction method disclosed in the above embodiment, the trained bidirectional language model, the seed sentences corresponding to the multiple customer features, and the keywords corresponding to the multiple customer features are all conducive to improving the accuracy of customer feature extraction. It should be noted that the training of the bidirectional language model, the acquisition of seed sentences and keywords can all be performed before the customer feature extraction method disclosed in the above embodiment.
[0112] The following content introduces the training method of the bidirectional language model, the non-artificial seed sentence acquisition method, and the non-artificial keyword acquisition method.
[0113] See also Figure 3 As shown, an embodiment discloses a model training method, and the function of executing the method is to train the model to achieve Figure 1 , Figure 2The bidirectional language model of the method shown. The trained bidirectional language model can be an autoencoder language model, i.e., a BERT model, an ELMo model, or a RoBERTa model. The method can be applied to various electronic devices, such as personal computers, mobile phones, etc., without specific limitation. It should be noted that the electronic device applying the customer feature extraction method disclosed in the aforementioned embodiment and the electronic device applying the model training method disclosed in the embodiment of the present application can be the same electronic device or a different electronic device, without specific limitation.
[0114] like Figure 3 As shown, the method may include:
[0115] 310. Select a seed sentence corresponding to each of the plurality of customer features from the sample service record text.
[0116] It should be understood that the sample service record text input in step 310 is used to train the bidirectional language model, while the target service record text input in step 110 is for a specific customer, and the corresponding feature text is output for the customer through the bidirectional language model by recording the relevant information of the customer during the service process. The sample service record text belongs to training data, and its quantity is large.
[0117] The accuracy of the seed sentence obtained in step 310 plays an important role in the accuracy of the trained bidirectional language model and the accuracy of the customer features when extracting customer features. Therefore, the above example of selecting a seed sentence corresponding to each of the multiple customer features from the sample service record text may include:
[0118] The phrases included in the sample service record text and the artificial keywords corresponding to each customer feature are input into the word vector model, and the target keywords matching the artificial keywords are determined from each phrase through the word vector model; sentences containing the target keywords are selected from the sample service record text as seed sentences corresponding to the customer features.
[0119] Among them, the word vector model can convert phrases into word vectors based on semantics. The word vector model can be a word2vec model or a doc2vec model, but is not limited to this. The artificial keywords corresponding to each customer feature can be designed with reference to the specific characteristics of different application scenarios. The word vector model can convert phrases in the sample service record text and artificial keywords into corresponding word vectors, so as to calculate the similarity between the above phrases and artificial keywords based on the word vectors corresponding to the phrases and artificial keywords in the sample service record text. The aforementioned target keyword that matches the artificial keyword can be a keyword whose similarity with the artificial keyword is higher than the fourth threshold.
[0120] The sample service record text and the designed artificial keywords are used as input, and the similarity between phrases is calculated through the word vector model, so as to screen out the target keywords that are semantically similar to the artificial keywords, and further determine the sentences including the target keywords as seed sentences, so that the seed sentences obtained by non-artificial means can accurately describe the corresponding customer features, which is convenient for the subsequent training of the bidirectional language model. Furthermore, obtaining accurate seed sentences can also improve the accuracy of the output customer features in the subsequent application stage of the bidirectional language model.
[0121] 320. According to expert rules corresponding to multiple customer characteristics, sample short texts satisfying the expert rules are screened out from the sample service record texts.
[0122] The expert rules described in step 320 may be formulated based on the seed sentences corresponding to the customer characteristics, and the core elements used to describe the customer characteristics are extracted from the seed sentences. The expert rules may be manually extracted by technicians and may be expressed by regular expressions.
[0123] An expert rule is exemplarily provided in an embodiment of the present invention, which may be a Python re regular expression, wherein re is a standard library for rule matching in Python. Through the re regular expression, some pre-defined specific characters and combinations of these specific characters are used to form a regular string, and a filtering logic for the string is expressed through the regular characters.
[0124] 330. Input two sample short texts to the bidirectional language model to be trained each time, and perform semantic recognition on the two input sample short texts through the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively.
[0125] 340. Calculate the predicted similarity of the two sample short texts according to the semantic vectors corresponding to the two sample short texts.
[0126] 350. Calculate the training loss according to the predicted similarity and the true similarity corresponding to the two sample short texts, and adjust the parameters in the bidirectional language model to be trained according to the training loss.
[0127] In step 330, the two sample short texts input to the bidirectional language model to be trained each time may be sample short texts corresponding to the same customer feature or sample short texts corresponding to different customer features.
[0128] In some embodiments, the true similarity corresponding to two sample short texts may be manually annotated. However, the workload of manual annotation is huge. In other embodiments, the true similarity corresponding to two sample short texts may be determined based on the customer features corresponding to the two sample short texts. When the two sample short texts input correspond to the same customer feature, the true similarity corresponding to the two sample short texts is higher than the true similarity corresponding to the two sample short texts when they correspond to different customer features. Exemplarily, if the two sample short texts input correspond to the same customer feature, the true similarity corresponding to the two sample short texts may be 1; if the two sample short texts input correspond to different customer features, the true similarity corresponding to the two sample short texts may be -1.
[0129] In the aforementioned model training method, the similarity calculation tasks shown in step 340 and step 350 can be used to train the bidirectional language model to improve the sovereign introspection of the bidirectional language model for semantic vector extraction.
[0130] Through the above Figure 3 The method is described in detail, wherein the sample short texts corresponding to each customer feature are obtained by using the obtained seed sentences and the artificially designed expert rules, and the bidirectional language model is trained using the sample short texts corresponding to the same customer feature or corresponding to different customer features. The bidirectional language model at least includes the training of parameters related to context semantics, so that when the trained bidirectional language model is applied to customer features, the input sample service record text is subjected to context semantic recognition, and the features describing the customer obtained are more accurate.
[0131] Optionally, before executing step 310, a preprocessing operation may be performed on the sample service record text, wherein the preprocessing operation at least includes: performing sentence processing on the input sample service record text to obtain a plurality of third short texts. Accordingly, in the aforementioned step 310, selecting a sentence containing a target keyword from the sample service record text as a seed sentence corresponding to the customer feature may include: selecting a third short text containing a target keyword from a plurality of third short texts as a seed sentence corresponding to the customer feature.
[0132] Optionally, the preprocessing operation may further include: performing text cleaning processing on the third short text to remove the third short text that cannot be used to describe customer characteristics.
[0133] By adding the above-mentioned preprocessing operation to the input sample service record text, on the one hand, the sample service record text is divided into the third short text, the parameters in the trained bidirectional language model are more accurate, and there will be more accurate and excellent customer feature output in the subsequent model application; on the other hand, due to the text cleaning processing of the third short text, the third short text that cannot be used to describe customer features is removed; the workload of training the model can be reduced without reducing the criterion degree of the model.
[0134] Optionally, before semantic recognition is performed on two input sample short texts through the bidirectional language model to be trained; the method also includes: performing data enhancement operations on the sample short texts, and the data enhancement operations include: at least one of synonym replacement, random insertion, random exchange, and random deletion.
[0135] By adding data augmentation operations to this method, the problem of reduced precision caused by polysemous words can be reduced, thereby improving the processing accuracy of the trained bidirectional language model on the sample service record text.
[0136] like Figure 4 As shown, an embodiment of the present invention provides a method for model training. The model trained by the method can be used in a variety of sales scenarios, but is not limited to sales scenarios. In the application, the model trained by the method can extract the characteristics of the customer required by the salesperson based on the service record text input by the salesperson. The salesperson can use the output characteristics of the customer as useful information to carry out targeted activities, such as sales promotion, health management, etc. The method includes:
[0137] 410. Perform sentence segmentation and text cleaning on the input sample automobile sales text to obtain multiple third short texts.
[0138] Among them, the difference between the operation in step 410 and the operation in step 310 is that the third short text output in step 410 is used to train subsequent models, such as the BERT model or the word2vec model, and the trained model is used to extract customer features; the second short text output in step 310 is used to extract customer features, and when extracting customer features, the trained model is used.
[0139] 420. Select a seed sentence corresponding to each of the plurality of customer features from the plurality of third short texts.
[0140] Among them, the accuracy of obtaining the seed sentence plays an important role in the accuracy of the trained model and the accuracy of extracting customer features when extracting customer features. Therefore, the specific operation of obtaining the seed sentence in step 420 can be selected according to design needs.
[0141] An exemplary method for obtaining a seed sentence specifically includes:
[0142] A text that meets the design requirements is selected from the plurality of third short texts as a seed sentence. The design requirements may be a manually formulated strategy or the aforementioned expert rules.
[0143] Alternatively, preferably, another exemplary method for obtaining a seed sentence specifically includes:
[0144] Step 421: Use multiple third short texts as input to train the word2vec model.
[0145] Among them, the purpose of training the word2vec model is to enable the word2vec model to generate accurate word vectors based on semantics.
[0146] Step 422: input the artificial keywords corresponding to the customer features and the phrases in each third short text into the trained word2vec model to obtain word vectors output by the word2vec model corresponding to the artificial keywords and the phrases in the third short text.
[0147] Each third short text may be segmented into a plurality of phrases. The input in step 422 may be a plurality of phrases segmented from a plurality of third short texts. Furthermore, each customer feature may correspond to a plurality of artificial keywords. After each artificial keyword and each phrase segmented from the third short text is input into the trained word2vec model, a corresponding word vector may be obtained.
[0148] Step 423: Calculate the similarity between the artificial keyword and each phrase based on the corresponding word vectors.
[0149] For each phrase, similarity can be calculated based on the word vector with multiple artificial keywords corresponding to the same customer feature.
[0150] Step 424: Determine the target keyword that matches the artificial keyword based on the similarity between the artificial keyword and each phrase.
[0151] If the similarity between a certain artificial keyword and a certain phrase is greater than a fourth threshold, it can be determined that the phrase is a target keyword that matches the artificial keyword.
[0152] Step 425: Select sentences including the target keyword from the plurality of third short texts as seed sentences corresponding to the customer characteristics.
[0153] Among them, in step 422 to step 423, the trained word2vec model is used to calculate the similarity. Since the word2vec model can take into account the semantic context and has the characteristics of fast calculation speed, the word2vec model is used to obtain the seed sentence, which can make the subsequent BERT model trained based on the screened text more accurate.
[0154] For example, in the car sales scenario, for a customer feature of "already purchased other cars", the third short text that can express this customer feature can include phrases such as "already purchased", "bought", "purchased", and "already purchased". By using the artificial keywords designed by the designer in advance and the trained word2vec model, texts similar to the artificial keywords can be screened out from a large amount of sample car sales texts and stored as a keyword set.
[0155] Optionally, in step 425, the plurality of third short texts may include a plurality of sentences including the target keyword; and the number of seed sentences should not be too large. Therefore, the seed sentences can be further screened from the sentences including the target keyword. The screening rules may include: random selection, manual selection by technicians, etc., which are not specifically limited.
[0156] As shown in Table 4, an example of a seed sentence corresponding to the customer feature of "already purchased other cars" screened out in a car sales scenario.
[0157]
[0158] Table 4 Examples of seed sentences for "Other cars have been purchased"
[0159] 430. Filter out sample short texts satisfying expert rules corresponding to multiple customer characteristics from the multiple third short texts, where the expert rules are formulated based on the seed sentences obtained in step 420.
[0160] For ease of understanding, taking the car sales scenario as an example, for the customer feature of "whether to buy other cars", as shown in formula (5), the corresponding exemplary expert rules include:
[0161] P = [^ not not] [order to add replacement] formula (5)
[0162] [·] means that only one word in [] needs to appear, and [^·] means that the words in [] cannot be included. The expert rule shown in formula (5) is a Python re regularization expression.
[0163] It should be noted that, in step 430, it is sufficient to select sample short texts that satisfy an expert rule corresponding to a customer feature. When the number of third short texts is large, the selected sample short texts may cover multiple different customer features.
[0164] Exemplarily, according to the expert rule of formula (5), expert rule matching is performed to obtain a sample short text example that satisfies the expert rule, as shown in the following Table 5:
[0165]
[0166] Table 5 Sample short text describing “Other cars purchased”
[0167] The sample short texts selected in step 430 will be used as training data to train the BERT model.
[0168] Optionally, the training process of the BERT model provided by the embodiment of the present invention may further include: performing data enhancement operations on sample short texts, including: at least one operation such as synonym replacement, random insertion, random exchange, or random deletion; the problem of reduced accuracy caused by polysemous words can be reduced, and the sample size of training data can be expanded, thereby achieving improved processing accuracy of the text by the trained bidirectional language model.
[0169] 440, input two sample short texts each time, and perform semantic recognition on the two input sample short texts through the BERT model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively.
[0170] 450. Calculate the predicted similarity of the two sample short texts according to the semantic vectors corresponding to the two sample short texts.
[0171] 460. Calculate the training loss based on the predicted similarity and the true similarity corresponding to the two sample short texts, and adjust the parameters in the BERT model to be trained based on the training loss.
[0172] During training, sample short texts corresponding to the same customer characteristics can be used as similar texts, and sample short texts corresponding to different customer characteristics can be used as dissimilar texts; the true similarity corresponding to similar texts is higher than the true similarity corresponding to dissimilar texts. The BERT model is trained using similarity calculation as a downstream task.
[0173] In step 460, the loss is determined according to the predicted similarity and the real similarity corresponding to the two sample short texts, and the parameters of the BERT model to be trained are adjusted according to the loss to train the BERT similarity model. The calculated loss can be L1 loss, L2 loss, cross entropy loss, etc., but is not limited thereto.
[0174] For example, see Figure 5a , Figure 5a Shown is an example diagram of training a BERT model disclosed in an embodiment. Figure 5aThe training process shown may correspond to the aforementioned steps 440 to 450 .
[0175] like Figure 5a As shown, a pair of sample short texts, short text 1 and short text 2, can be input into the BERT model. Pooling operation is performed on the output of the BERT model to obtain the semantic vector U1 corresponding to short text 1 and the semantic vector U2 corresponding to short text 2.
[0176] Softmax Classifier is a commonly used structure in the classification model based on neural network, and its output is the probability of category. In the embodiment of the present application, the similarity calculation problem can be transformed into a classification problem, that is, the similarity of a pair of sample short texts can be divided into two categories: similarity and dissimilarity. Softmax Classifier can output the probability of similarity and dissimilarity of two sample short texts respectively.
[0177] Assume that sample short texts describing the same customer characteristics are similar, while sample short texts describing different customer characteristics are not similar. Based on this assumption, when two input sample short texts describe the same customer characteristics, their similarity label is 1; if they do not describe the same customer characteristics, their similarity label is -1.
[0178] Usually, the number of sample short texts obtained in step 430 is large enough to construct a sufficient number of sentence pairs as training samples for training the BERT similarity model.
[0179] As shown in Table 6, for the automobile sales scenario, an example provided by an embodiment of the present invention uses the sample short texts with the same customer characteristics as described in Table 5 as similar texts, and the similarity is 1, indicating that the two sentences are similar; the sample short texts that do not describe the same customer characteristics are used as dissimilar texts, and the similarity is -1, indicating that the two sentences are dissimilar. According to this rule, the loss is determined by predicting the similarity and the true similarity corresponding to the two sample short texts, and the parameters of the BERT model to be trained are adjusted according to the loss.
[0180]
[0181]
[0182] Table 6 BERT sample examples during model training
[0183] In addition, in order to accurately explain the difference between the BERT model training process and the application process. Figure 5b . Figure 5b The figure is an example diagram of customer feature extraction based on the BERT model disclosed in an embodiment. Figure 5b The BERT model shown in can be obtained by Figure 5a The model training process shown is obtained after training. Figure 5b The customer feature extraction process shown may correspond to steps 230 to 240 in the aforementioned embodiment.
[0184] like Figure 5b As shown, the first short text extracted from the target service record text and the seed sentence corresponding to a certain customer feature are output to the trained BERT model respectively. The output of the first short text by the BERT model is pooled to obtain a first semantic vector; the output of the seed sentence by the BERT model is pooled to obtain a second semantic vector. The cosine similarity between the first semantic vector and the second semantic vector is calculated to obtain the similarity between the first semantic vector and the seed sentence.
[0185] In summary, in the embodiments of the present application, seed sentences corresponding to different customer characteristics can be obtained through a large amount of sample service record texts, so as to specify expert rules corresponding to each customer characteristic based on the seed sentences, and sample short texts that meet the expert rules are screened out from the sample service record texts as training data to train the bidirectional language model. The generation of training data does not depend on the generation environment and business requirements of the sample service record texts. The sample service record texts do not need to be filled in according to the specified format, and are in line with the actual business scenarios. Moreover, only a small number of artificial keywords need to be designed in the early stage to mine a large number of seed sentences that accurately describe customer characteristics from the sample service record texts. Moreover, only a small number of expert rules need to be set based on the seed sentences to match a large number of sample short texts that can be used for model training, which greatly reduces labor costs and can effectively cover most of the user information.
[0186] See also Figure 6 , Figure 6 FIG. 1 is a schematic diagram of a structure of a customer feature extraction device disclosed in an embodiment. The device can be applied to electronic devices such as personal computers or servers, and is not specifically limited. Figure 6 As shown, the customer feature extraction device 600 may include: an identification module 610 , a first determination module 620 and a second determination module 630 .
[0187] The recognition module 610 is used to perform semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; and perform semantic recognition on the seed sentences corresponding to each of the multiple customer features through the bidirectional language model to obtain a second semantic vector corresponding to each seed sentence;
[0188] A first determination module 620, configured to determine the similarity between the target service record text and each seed sentence according to the first semantic vector and the second semantic vector of each seed sentence;
[0189] The second determination module 630 is configured to determine a target customer feature corresponding to the target service record text from the multiple customer features according to the similarity between the target service record text and the respective seed sentences.
[0190] In one embodiment, the customer feature extraction device further includes a preprocessing module for selecting a first short text from the target service record text to be input.
[0191] The recognition module 610 is further configured to input the first short text into a trained bidirectional language model; and perform semantic recognition on the first short text through the bidirectional language model to obtain a first semantic vector.
[0192] In one embodiment, the preprocessing module is further used to match the target service record text to be input with keywords corresponding to a plurality of customer characteristics, and filter out a first short text matching the keyword from the target service record text.
[0193] The above-mentioned bidirectional language model specifically includes:
[0194] Any one of the BERT model, ELMo model, and RoBERTa model.
[0195] In one embodiment, the preprocessing module is further used to perform sentence segmentation and text cleaning on the input target service record text to obtain multiple second short texts; and match the multiple second short texts with keywords corresponding to multiple customer features.
[0196] In one embodiment, the second determination module 630 is further configured to determine the first customer feature as the target customer feature corresponding to the target service record text when the maximum value of the similarity between the target service record text and the seed sentence corresponding to the first customer feature is greater than a set first threshold.
[0197] In one embodiment, the second determination module 630 is further used to determine the second customer feature as the target customer feature corresponding to the target service record text when the number of seed sentences whose similarity with the target service record text is greater than a second threshold among the multiple seed sentences corresponding to the second customer feature is greater than a third threshold.
[0198] It can be seen that the customer feature extraction device disclosed in the aforementioned embodiment is implemented, and the service record text is input into the trained bidirectional language model to obtain the similarity between the service record text and each seed sentence corresponding to the feature of the customer, so as to obtain the features that can accurately describe the customer. Since the trained bidirectional language model can perform contextual semantic recognition on the input service record text, the features described by the customer are more accurate.
[0199] See also Figure 7 , is a schematic diagram of the structure of a model training device disclosed in an embodiment. The device can be applied to electronic devices such as personal computers or servers, and is not specifically limited. Figure 7 As shown, the model training device 700 may include: a selection module 710, a screening module 720, a prediction module 730 and an adjustment module 740;
[0200] A selection module 710 is used to select a seed sentence corresponding to each of the plurality of customer features from the sample service record text;
[0201] A screening module 720 is used to screen out sample short texts satisfying the expert rules from the sample service record text according to the expert rules corresponding to the multiple customer features, so as to obtain sample short texts corresponding to the multiple customer features respectively; the expert rule corresponding to each customer feature is formulated based on the seed sentence corresponding to the customer feature;
[0202] The prediction module 730 is used to input two sample short texts into the bidirectional language model to be trained each time, and perform semantic recognition on the two sample short texts input by the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively; and calculate the predicted similarity of the two sample short texts according to the semantic vectors corresponding to the two sample short texts respectively;
[0203] The adjustment module 740 is used to calculate the training loss according to the predicted similarity and the true similarity corresponding to the two sample short texts, and adjust the parameters in the bidirectional language model to be trained according to the training loss.
[0204] Optionally, the true similarity corresponding to two sample short texts is determined based on the customer characteristics corresponding to the two sample short texts respectively; when the two sample short texts correspond to the same customer characteristics, the true similarity corresponding to the two sample short texts is higher than the true similarity corresponding to the two sample short texts when the two sample short texts correspond to different customer characteristics.
[0205] In one embodiment, the selection module 710 is further used to input each phrase included in the sample service record text and the artificial keywords corresponding to the customer feature into a word vector model for each customer feature among multiple customer features; and, through the word vector model, determine the target keywords matching the artificial keywords from each phrase; and, select the sentence containing the target keyword from the sample service record text as the seed sentence corresponding to the customer feature.
[0206] In one embodiment, in one embodiment, the above-mentioned model training device 700 may further include: a data processing module;
[0207] The data processing module is also used to perform data enhancement operations on the sample short text; the data enhancement operations include: at least one of synonym replacement, random insertion, random exchange, and random deletion.
[0208] In one embodiment, the data processing module is further used to perform data processing operations on the input service record text after obtaining the input service record text and before obtaining the seed sentence according to the service record, wherein the data processing operations at least include: performing sentence segmentation and text cleaning on the sample service record text to obtain multiple third short texts;
[0209] Correspondingly, the above-mentioned selection module 710 is also used to obtain seed sentences from multiple third short texts.
[0210] In one embodiment, the data processing module is further used to perform a cleaning operation on the third short text to remove text that cannot be used to describe customer characteristics.
[0211] It can be seen that the model training device for extracting customer features disclosed in the above-mentioned embodiment is implemented, by obtaining seed sentences and designing each expert rule for describing customer features, to obtain similar texts and dissimilar texts, and use the similar texts and dissimilar texts to train a bidirectional language model, in which at least the training of parameters related to contextual semantics is included, so that when the trained bidirectional language model is applied to customer features, contextual semantic recognition is performed on the input service record text, and the features describing the customer obtained are more accurate.
[0212] Figure 8 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Figure 8As shown, the electronic device 800 may include one or more of the following components: a processor 810, and a memory 1020 coupled to the processor 810. The memory 820 may store one or more applications, and the one or more applications may be configured to be executed by one or more processors 810, and the one or more programs are configured to execute the customer feature extraction method and model training method described in the above embodiments.
[0213] The processor 810 may include one or more processing cores. The processor 810 uses various interfaces and lines to connect various parts of the entire electronic device 800, and executes various functions and processes data of the electronic device 800 by running or executing instructions, programs, code sets or instruction sets stored in the memory 820, and calling data stored in the memory 820. Optionally, the processor 810 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 810 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 810, but may be implemented separately through a communication chip.
[0214] The memory 820 may include a random access memory (RAM) or a read-only memory (ROM). The memory 820 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 800 during use, etc.
[0215] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by the processor, the processor implements any one of the customer feature extraction methods disclosed in the embodiment of the present application.
[0216] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by the processor, the processor implements any one of the model training methods disclosed in the embodiment of the present application.
[0217] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.
[0218] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0219] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0220] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0221] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-accessible memory. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several requests for a computer device (which can be a personal computer, a server or a network device, etc., specifically a processor in a computer device) to perform some or all of the steps of the above-mentioned methods of various embodiments of the present application.
[0222] Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0223] The above is a detailed introduction to a customer feature extraction method and device, a model extraction method and device, an electronic device and a storage medium disclosed in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A customer feature extraction method, characterized in that: The method comprises: Perform semantic recognition on the target service record text by using the trained bidirectional language model to obtain a first semantic vector; The bidirectional language model is used to perform semantic recognition on seed sentences corresponding to each of the multiple customer features, thereby obtaining a second semantic vector corresponding to each seed sentence; the bidirectional language model is trained using sample short texts corresponding to the multiple customer features; the sample short text corresponding to each customer feature is selected from a sample service record text and satisfies an expert rule corresponding to the customer feature; the expert rule corresponding to each customer feature is formulated based on the seed sentence corresponding to each customer feature; Determining the similarity between the target service record text and each seed sentence according to the first semantic vector and the second semantic vector of each seed sentence; According to the similarity between the target service record text and the respective seed sentences, a target customer feature corresponding to the target service record text is determined from the plurality of customer features.
2. The method according to claim 1, characterized in that: Before the trained bidirectional language model performs semantic recognition on the target service record text to obtain the first semantic vector, the method further includes: Selecting a first short text from the target service record text to be input; And, the trained bidirectional language model performs semantic recognition on the target service record text to obtain a first semantic vector, including: Inputting the first short text into the trained bidirectional language model; The first short text is semantically recognized by using the bidirectional language model to obtain a first semantic vector.
3. The method according to claim 2, characterized in that: Selecting a first short text from the target service record text to be input includes: The target service record text to be input is matched with keywords corresponding to a plurality of customer characteristics respectively, and a first short text matching the keyword is screened out from the target service record text.
4. The method according to claim 3, characterized in that: The step of matching the target service record text to be input with keywords corresponding to the plurality of customer characteristics includes: Perform sentence segmentation and text cleaning on the input target service record text to obtain a plurality of second short texts; The multiple second short texts are matched with keywords corresponding to the multiple customer characteristics.
5. The method according to claim 1, characterized in that: The multiple customer features include: a first customer feature; and determining a target customer feature corresponding to the target service record text from the multiple customer features according to the similarity between the target service record text and each seed sentence, including: When the maximum value of the similarity between the target service record text and the seed sentence corresponding to the first customer feature is greater than a set first threshold, the first customer feature is determined as the target customer feature corresponding to the target service record text.
6. The method according to claim 1, characterized in that: The plurality of customer features include: a second customer feature; and determining, according to the similarity between the target service record text and each seed sentence, a target customer feature corresponding to the target service record text from the plurality of customer features, comprises: When, among the multiple seed sentences corresponding to the second customer feature, the number of seed sentences whose similarity with the target service record text is greater than a second threshold is greater than a third threshold, the second customer feature is determined as the target customer feature corresponding to the target service record text.
7. A model training method, characterized in that: The method comprises: Selecting seed sentences corresponding to each of the plurality of customer features from the sample service record text; According to expert rules corresponding to a plurality of customer characteristics, sample short texts satisfying the expert rules are screened from the sample service record texts to obtain sample short texts corresponding to the plurality of customer characteristics respectively; the expert rules corresponding to each customer characteristic are formulated based on the seed sentences corresponding to the customer characteristic; Inputting two sample short texts into the bidirectional language model to be trained each time, and performing semantic recognition on the two sample short texts input by the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively; Calculating the predicted similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts; The training loss is calculated according to the predicted similarity and the true similarity corresponding to the two sample short texts, and the parameters in the bidirectional language model to be trained are adjusted according to the training loss.
8. The method according to claim 7, characterized in that When the two sample short texts correspond to the same customer feature, the true similarity corresponding to the two sample short texts is higher than the true similarity corresponding to the two sample short texts when the two sample short texts correspond to different customer features.
9. The method according to claim 7, characterized in that: The step of selecting a seed sentence corresponding to each of the plurality of customer features from the sample service record text comprises: For each customer feature among the plurality of customer features, inputting each phrase included in the sample service record text and an artificial keyword corresponding to the customer feature into a word vector model; Determining target keywords matching the artificial keywords from each phrase through the word vector model; Sentences containing the target keywords are selected from the sample service record text as seed sentences corresponding to the customer characteristics.
10. The method according to claim 9, characterized in that After obtaining the sample short texts respectively corresponding to the plurality of customer features and before inputting the two sample short texts into the bidirectional language model to be trained, the method further includes: Performing a data augmentation operation on the sample short text; The data enhancement operation includes at least one of synonym replacement, random insertion, random exchange, and random deletion.
11. A customer feature extraction device, characterized in that: The device comprises: The recognition module is used to perform semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; and to perform semantic recognition on the seed sentences corresponding to each of the multiple customer features through the bidirectional language model to obtain a second semantic vector corresponding to each seed sentence; the bidirectional language model is trained using sample short texts corresponding to the multiple customer features; the sample short text corresponding to each customer feature is screened from the sample service record text and satisfies the expert rule corresponding to the customer feature; the expert rule corresponding to each customer feature is formulated based on the seed sentence corresponding to each customer feature; A first determination module, configured to determine the similarity between the target service record text and each seed sentence according to the first semantic vector and the second semantic vector of each seed sentence; The second determination module is used to determine the target customer feature corresponding to the target service record text from the multiple customer features according to the similarity between the target service record text and the respective seed sentences.
12. A model training device, characterized in that: The device comprises: A selection module, used to select seed sentences corresponding to each of the plurality of customer features from the sample service record text; A screening module, for screening sample short texts satisfying the expert rules from the sample service record texts according to the expert rules corresponding to the multiple customer features, so as to obtain sample short texts corresponding to the multiple customer features respectively; the expert rule corresponding to each customer feature is formulated based on the seed sentence corresponding to the customer feature; A prediction module, configured to input two sample short texts into the bidirectional language model to be trained each time, and perform semantic recognition on the two sample short texts input by the bidirectional language model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively; and calculate the predicted similarity of the two sample short texts according to the semantic vectors corresponding to the two sample short texts respectively; The adjustment module is used to calculate the training loss according to the predicted similarity and the real similarity corresponding to the two sample short texts, and adjust the parameters in the bidirectional language model to be trained according to the training loss.
13. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1-6 and 7-10.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 and 7 to 10 is implemented.
Citation Information
Patent Citations
Pushing method and device based on user intention, electronic equipment and storage medium
CN111814058A
User portrait construction method and device, equipment and storage medium
CN113392205A