CN114118062A - Customer feature extraction method and device, electronic equipment and storage medium - Google Patents

Customer feature extraction method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114118062A
CN114118062A CN202111538219.3A CN202111538219A CN114118062A CN 114118062 A CN114118062 A CN 114118062A CN 202111538219 A CN202111538219 A CN 202111538219A CN 114118062 A CN114118062 A CN 114118062A
Authority
CN
China
Prior art keywords
customer
text
service record
sample
texts
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111538219.3A
Other languages
Chinese (zh)
Inventor
梁成扬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN202111538219.3A priority Critical patent/CN114118062A/en
Publication of CN114118062A publication Critical patent/CN114118062A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application discloses a client feature extraction method, a client feature extraction device, electronic equipment and a storage medium, wherein the client feature extraction method comprises the following steps: performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences; 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; and determining a target customer characteristic corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence. The method utilizes the bidirectional language model, so that the output characteristics describing the client are more accurate.

Description

Customer feature extraction method and device, electronic equipment and storage medium
Technical Field
The application relates to the technical field of natural language processing, in particular to a client feature extraction method and device, electronic equipment and a storage medium.
Background
Natural Language Processing (NLP) is a leading-edge technology that combines linguistics, computer science, and machine learning. The information with specific characteristics is extracted by utilizing the NLP technology, particularly in the field of sales, the characteristic information of different customers can be extracted, and sales personnel can provide services for the customers more quickly and accurately according to the characteristic information of the customers. However, in practice, the existing client feature extraction method still has the problem of low accuracy.
Disclosure of Invention
The embodiment of the application discloses a client feature extraction method and device, electronic equipment and a storage medium, and the accuracy of extracting client features is greatly improved.
The embodiment of the application discloses a client feature extraction method, which is characterized by comprising the following steps: performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences; 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; and determining a target customer characteristic corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence.
In one embodiment, prior to the entering the target service record text into the trained bi-directional language model, the method further comprises: selecting a first short text from target service record texts 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, wherein the semantic recognition comprises the following steps: inputting the first short text into a trained bidirectional language model; and performing semantic recognition on the first short text through the bidirectional language model to obtain a first semantic vector.
In one embodiment, the selecting the first short text from the target service record texts to be input comprises: matching a target service record text to be input with keywords corresponding to a plurality of client features respectively, and screening out a first short text matched with the keywords from the target service record text.
In one embodiment, the matching the target service record text to be input with the keywords corresponding to the plurality of client features respectively includes: performing clause processing and text cleaning processing on a target service record text to be input to obtain a plurality of second short texts; and matching the plurality of second short texts with keywords respectively corresponding to the plurality of client characteristics.
In one embodiment, the determining, according to the similarity between the target service record text and each seed sentence, a target client feature corresponding to the target service record text includes: and when the maximum value of the similarity of the target service record text and the seed sentence corresponding to the first customer characteristic is larger than a set first threshold value, determining the first customer characteristic as the target customer characteristic corresponding to the target service record text.
In one embodiment, the determining, according to the similarity between the target service record text and each seed sentence, a target client feature corresponding to the target service record text includes: and when the number of seed sentences with the similarity to the target service record text larger than a second threshold value in a plurality of seed sentences corresponding to the second customer characteristic is larger than a third threshold value, determining the second customer characteristic as the target customer characteristic corresponding to the target service record text.
In one embodiment, the bidirectional language mode is obtained by training sample short texts respectively corresponding to a plurality of client features; the sample short text corresponding to each customer characteristic is screened from the sample record text and meets the expert rule corresponding to the customer characteristic; the expert rules corresponding to each customer characteristic are formulated based on the seed sentences corresponding to each customer characteristic.
The embodiment of the application discloses a model training method, which comprises the following steps: selecting seed sentences corresponding to each customer characteristic from the plurality of customer characteristics from the sample service record texts; according to expert rules corresponding to a plurality of client features, sample short texts meeting the expert rules are screened from the sample service record texts to obtain sample short texts corresponding to the client features respectively; expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer features; inputting two sample short texts to a bidirectional language model to be trained each time, and performing 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; calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts; and calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training loss.
In one embodiment, 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 respectively correspond to different customer features.
In one embodiment, the selecting a seed sentence corresponding to each of the plurality of client features from the sample record text includes: aiming at each customer feature in a plurality of customer features, inputting each phrase included in the sample service record text and the artificial keywords corresponding to the customer features into a word vector model; determining target keywords matched with the artificial keywords from each phrase through the word vector model; and selecting the sentences containing the target keywords from the sample service record texts as seed sentences corresponding to the client features.
In one embodiment, after obtaining sample short texts corresponding to the plurality of client features respectively and before inputting two sample short texts to the bidirectional language model to be trained, the method further includes: performing a data enhancement operation on the sample short text; the data enhancement operation includes: synonym replacement, random insertion, random exchange, and random deletion.
The embodiment of the application discloses customer feature extraction element, the device includes: the recognition module is used for performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences; a first determining module, configured to determine, according to the first semantic vector and the second semantic vector of each seed sentence, a similarity between the target service record text and each seed sentence; and the second determining module is used for determining the target customer characteristics corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence.
The embodiment of the application discloses model training device, the device includes: the selecting module is used for selecting seed sentences corresponding to each customer characteristic from the plurality of customer characteristics from the sample record texts; the screening module is used for screening sample short texts meeting expert rules from the sample service record texts according to the expert rules corresponding to the client characteristics so as to obtain sample short texts corresponding to the client characteristics respectively; expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer features; the prediction module is used for inputting two sample short texts to the bidirectional language model to be trained each time, and performing 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; calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts; and the adjusting module is used for calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training loss.
The embodiment of the application discloses an electronic device, which comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is enabled to realize any one of the client feature extraction method and the model training method disclosed by the embodiment of the application.
The embodiment of the application discloses a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement any one of the client feature extraction method and the model training method disclosed in the embodiment of the application.
Compared with the related art, the embodiment of the application has the following beneficial effects:
and inputting the seed sentences corresponding to the target service record texts and each customer feature into the trained bidirectional language model, and acquiring semantic vectors corresponding to the target service record texts and the seed sentences, so that the similarity between the target service record texts and the seed sentences is calculated according to the corresponding semantic vectors, and the target customer features corresponding to the target service record texts are determined from the customer features. Because the context semantic recognition can be carried out on the input service record text in the trained bidirectional language model, the extracted client features are more accurate.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram illustrating a method for extracting client features according to an exemplary embodiment;
FIG. 2 is a flow chart illustrating a method of another method for extracting client features according to one embodiment;
FIG. 3 is a schematic illustration of a method flow diagram of a model training method according to an embodiment;
FIG. 4 is a method flow diagram of another model training method disclosed in one embodiment;
FIG. 5a is an exemplary diagram of training a BERT model according to one embodiment disclosed herein;
FIG. 5b is an exemplary diagram of customer feature extraction based on a BERT model according to one embodiment of the disclosure;
FIG. 6 is a schematic diagram of a client feature extraction apparatus according to an embodiment;
FIG. 7 is a schematic diagram of a model training apparatus according to an embodiment of the disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It is to be noted that the terms "comprises" and "comprising" and any variations thereof in the examples and figures of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
In the related art, the information extraction method for text generally includes the following steps:
1. regularization matching method based on expert rules
Such methods typically require a skilled person to have a good knowledge of the text content, with a huge amount of manual effort; meanwhile, the expert rules limit the freedom of information extraction, and if the expert rules cannot cover all text record conditions of the information to be extracted, the coverage rate is low, and the client feature extraction of different scenes cannot be comprehensively dealt with. Meanwhile, the accuracy of the method is limited by expert rules, and if the rule is not accurately formulated, information can be extracted by mistake.
2. A conventional numerical statistical method using a Term Frequency-Inverse file Frequency (TF-IDF) as an example.
Taking the TF-IDF algorithm as an example, the TF-IDF algorithm can extract the feature information of the client by using the indexes such as the occurrence probability of words and the like and taking the phrase with the highest TF-IDF as the keyword of the text. Therefore, although the numerical statistical method can reduce the labor cost, the method ignores the upper-written meaning of the phrase, namely ignores the front-back sequence of the phrase and ignores the semantic information of the text, so that the extracted features are inaccurate.
The embodiment of the application discloses a client feature extraction method and device, electronic equipment and a storage medium, and the accuracy of extracting the features of a client is greatly improved. The following are detailed below.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating a method for extracting a client feature according to an embodiment of the disclosure. The method can be applied to various intelligent terminals, such as personal computers, electronic equipment such as background servers of service platforms and the like, and is not limited specifically. The use scene of the method can be various sale scenes, such as automobile sale, house intermediary sale and the like; the method can also be applied to various service industries, and can extract the characteristics of the client, so that relevant personnel can better provide service for the client after knowing the characteristics of the client.
It should be further noted that the characteristics of the client in the embodiment of the present invention may be understood as a text for describing the client, so that the service staff can have a more comprehensive understanding of the client through the characteristics of the client, and better customize a more optimal service for the client.
As shown in fig. 1, the method comprises the steps of:
110. and performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector.
120. And performing semantic recognition on the seed sentences corresponding to each customer characteristic in the plurality of customer characteristics through the bidirectional language model to obtain second semantic vectors of the seed sentences.
The target service record text in step 110 may be a record text generated in various service processes, and for different service fields, the target service record text has characteristics of corresponding fields, for example, for an automobile sales scene, the obtained target service record text includes: remarks are kept in the process of sales, feedback information in the process of driving test of a user, comments of the user on the automobile and other texts.
The seed sentence in step 120 may be a certain number of sentences that can be used to describe the characteristics of the client and that are manually selected by the technician according to the characteristics of different service fields. Each client characteristic may correspond to one or more seed sentences, respectively, and the seed sentences corresponding to different client characteristics may be different.
In some embodiments, a technical solution for obtaining a seed sentence corresponding to each client feature is correspondingly provided, which is a solution for obtaining a seed sentence without human labor, and the details of which can be seen in the following text.
Seed sentences corresponding to the respective client features may be stored in a respective memory for use in performing the method as shown in fig. 1 as step 110.
The bi-directional Language model in the above steps 110 and 120 may be any one of a self-coding Language model, i.e. a BERT (bidirectional Encoder expressions from transforms) model, an elmo (embedded from Language models) model, or a RoBERTa (enhanced version on the BERT basis) model. Wherein, RoBERTA is an improved version of BERT model, not only possesses the specificity of the BERT model, but also has stronger data processing capability; EIMo uses a Bi-LSTM (Bidirectional Long short-Term Memory) framework that is capable of recognizing context semantics.
The bidirectional language model is obtained by training a large number of sample service record texts, and can perform semantic recognition on the target service record texts and the seed sentences based on semantic information of the texts so as to convert the target service record texts and the seed sentences into corresponding semantic vectors.
130. And 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.
The electronic device may calculate the similarity between the target service record text and each seed sentence by calculating the euclidean distance and the cosine similarity between the first semantic vector and the second semantic vector, which is not limited specifically. The similarity between the target service record text and each seed sentence can be used for representing the semantic similarity between the target service record text and the seed sentences. The higher the similarity of the target service record text to the seed sentence, the more semantically similar.
140. And determining the target customer characteristics corresponding to the target service record text according to the similarity between the target service record text and each seed sentence.
The electronic device may obtain a preset similarity rule, where the similarity rule is to filter a target customer feature matching the target service record text from the plurality of customer features.
An example similarity rule may include: and when the maximum value of the similarity of the service record text and the seed sentence corresponding to the first customer characteristic is larger than a set first threshold value, determining the first customer characteristic as a target customer characteristic corresponding to the target service record text. The first threshold may be set with reference to an actual service requirement, and is not limited specifically. The exemplary similarity rule may filter out a seed sentence that is most similar to the target service record text, thereby determining the target customer characteristic corresponding to the target service record text as the first customer characteristic corresponding to the most similar seed sentence.
Another example similarity rule may include: and when the number of the seed sentences with the similarity degree with the target service record text larger than a second threshold value in the plurality of seed sentences corresponding to the second customer characteristic is larger than a third threshold value, determining the second customer characteristic as the target customer characteristic corresponding to the target service record text. In practical application scenarios, such as automobile sales follow-up, there may be many different expressions for the text describing the same customer feature, and the difference between different texts is large. For example, "the customer is a safe bank" and "mr. liu is a bank in china" both of which are coming from friends "both express that the industry of the user is a financial industry, but the similarity of the two sentences is low. According to the exemplary similarity rule, the second client feature can be extracted from the target service record text only by the fact that enough seed sentences corresponding to the second client feature are similar to the target service record text, and the influence of the reduction of the similarity among the sentences caused by different expressions on the extraction of the client feature can be reduced.
The description is for convenience of understanding and is not intended to limit the embodiments of the invention.
According to the description of the customer feature extraction method provided by the embodiment of the invention, the target service record text is input into the trained bidirectional language model, and the similarity between the target service record text and the seed sentence corresponding to each customer feature is obtained based on the semantic vector output by the bidirectional language model, so that the customer feature can be accurately extracted from the target service record text. In addition, because the context semantic recognition can be carried out on the input service record text in the trained bidirectional language model, the output characteristics for describing the client are more accurate.
Furthermore, in the field of automobile sales, the service record text is generally a sales record, a short text in the sales record can contain a meaning, and the processing effect on the short text is more accurate when extracting features according to the similarity in the BERT model. Such as: "i have bought a car" and "i have bought a car and please do not call me", both sentences mean "buy other car" in the analysis scene, but because the second sentence is more "please do not call", the similarity of the two sentences is reduced, and further it is difficult to extract the information of "buy other car" in the second sentence. Thus, before executing the service record text as in step 110, the method may further comprise:
and selecting a first short text from the target service record texts to be input.
Accordingly, in the foregoing step 110, the electronic device may input the first short text into the bidirectional language model, and perform semantic recognition on the first short text through the bidirectional language model to obtain the first semantic vector.
By performing the above operations, the extracted features for describing the client are made accurate.
In some embodiments, the electronic device may perform sentence splitting on the target service record text to be input to divide the target service record text into a plurality of short sentence texts. The electronic device may select the first short text from the short sentence texts obtained after the sentence segmentation processing. The sentence dividing process may be a process of dividing the target service record text into a plurality of short sentence texts based on punctuation marks.
An example of selecting a first short text from a short sentence text may include:
and performing text cleaning processing on the plurality of short sentence texts, and determining the short sentence texts remained after the text cleaning processing as first short texts. The text washing process may include a synonym conversion, washing of invalid sentences, and the like.
Synonym translation may refer to translating different words that express the same semantics into the same words to reduce the problem of reduced similarity due to different expressions.
The cleansing of the invalid sentence may refer to a process of removing the invalid text from the plurality of short sentence texts, that is, a process of clarifying the short sentence text which is apparently incapable of describing the characteristics of the client. For example, the text cleansing process may clear discourse words, time stamps, transitional join statements, and the like. The definition of the invalid text can be determined according to the actual service requirement, and is not particularly limited.
The first short text obtained after the text cleaning operation can describe the client characteristics more accurately, so that the text input into the bidirectional language model is more beneficial to model analysis data, and more accurate target client characteristics are output.
Another example of selecting the first short text from the short sentence text may include:
matching the target service record text to be input with the keywords corresponding to the plurality of client features respectively, and screening out a first short text matched with the keywords from the target service record text. The keywords corresponding to each customer characteristic may be manually selected, which is most relevant to describe the customer characteristic. For example, in a new energy automobile sales scenario, the description of "cruising anxiety" generally centers around "cruising", "mileage", and the like. In an embodiment, a technical solution for mining a keyword corresponding to each client feature from a sample service record text is also provided, which is a solution for acquiring the keyword without human intervention, and will be described in detail later. The electronic device may screen out a sentence from the target service record text that includes any keyword as the first short text.
In some embodiments, the electronic device may combine the above sentence segmentation processing, text cleaning processing, and keyword matching processing, and select the first short text from the target service record text, which may specifically include:
performing clause processing and text cleaning processing on a target service record text to be input to obtain a plurality of second short texts; and matching the plurality of second short texts with the keywords respectively corresponding to the plurality of client characteristics, and screening out the first short texts matched with the keywords from the plurality of second short texts.
By screening the target service record text, on one hand, the data volume input to the bidirectional language model can be reduced, the calculated amount required by the bidirectional language model for calculating the semantic vector is reduced, the calculation cost of the client feature extraction method disclosed by the embodiment of the application is reduced, and the client feature extraction efficiency is improved; on the other hand, the problem of information loss caused by reduction of data volume can be reduced through matching of the keywords, and accuracy of customer feature extraction is improved.
In order to more clearly describe the client feature extraction method disclosed in the embodiment of the present application. Referring to fig. 2, fig. 2 is another customer feature extraction method disclosed in an embodiment, specifically for an application scenario of automobile sales, a target service record text in the application scenario may be an automobile sales follow-up record text, and the extracted customer features may include: the method comprises the following steps of purchasing vehicle concerns, purchasing resistance or purchasing reasons and the like, wherein any one or any combination of the factors comprises the following steps:
210. and carrying out sentence dividing processing and text cleaning processing on the input automobile sales follow-up recorded text to obtain a plurality of second short texts.
The car sales follow-up record text is shown in table 1, and after performing the operation as step 210, a plurality of second short texts are obtained.
Figure BDA0003412185310000081
Figure BDA0003412185310000091
TABLE 1 comparison of data for a car sales follow-up record text with a second short text
220. And matching the plurality of second short texts with the keywords respectively corresponding to the plurality of client characteristics.
The stored characteristic keywords can be manually designed by technicians before the method is executed; alternatively, the keywords may be mined from the sample service transcript based on a non-manual method.
Through the operation of step 220, invalid sentences or sentences which cannot describe the client features are further removed, so that the calculation amount of semantic vectors can be greatly reduced, the calculation amount is reduced, and the efficiency of extracting the client features is improved.
230. And inputting the seed sentences corresponding to the first short text and each of the plurality of client features into a BERT model, and performing semantic recognition on the first short text and each seed sentence through the BERT model to obtain a first semantic vector and a second semantic vector of each seed sentence.
In an application scenario of automobile sales, the bidirectional language model may employ a BERT model. Because the BERT Model adopts an occlusion Language Model (MLM), the Model is trained by utilizing the semantics of words on the left side and the right side, so that the BERT Model can output the characteristics of a client according to the front and back semantics of an input text.
For example, the customer characteristics may include "purchased other cars," and the seed sentence corresponding to "purchased other cars" may include: "purchased", "purchased other vehicle not having to find me".
240. And determining the similarity between the automobile sales follow-up recorded text and each seed sentence according to the first semantic vector and the second semantic vector of each seed sentence.
In step 220, the trained BERT model is used, and the first short text and the seed sentence are specifically used as input, so that BERT semantic vectors of all texts can be obtained respectively. And (3) calculating the cosine similarity of the semantic vector according to the formula (1), and measuring the similarity of the automobile sales follow-up recorded text and the seed sentence according to the cosine similarity.
Figure BDA0003412185310000092
Wherein U represents a first semantic vector of a first short text U, ViIth seed sentence v representing client characteristic viSecond semantic vector of (2), defining
Figure BDA0003412185310000101
The first short text u is represented as a similarity set of the first short text u and the feature v, and n represents the kind of the feature vNumber of sub-sentences.
For example, taking sample 1 as an example, the first short text is "order a car," there are three seed sentences regarding the customer feature of "purchased another car," purchased, "purchased another car," and "purchased another car does not find me," and the similarity set obtained by calculating the cosine similarity through formula (1) is specifically shown in formula (2):
Sim={0.84,0.52,0.41} (2)
the specific deployment can be as shown in table 2:
Figure BDA0003412185310000102
TABLE 2 similarity calculation of first short text to seed sentences
250. And determining the target customer characteristics corresponding to the automobile sales follow-up record text according to the similarity between the automobile sales follow-up record text and each seed sentence calculated in the step 230.
Wherein an example similarity rule comprises: and when the maximum value of the similarity of the service record text and the seed sentence corresponding to the first customer characteristic is larger than a set first threshold value, determining the first customer characteristic as a target customer characteristic corresponding to the target service record text. Namely: when the maximum similarity between the first short text u and the seed sentence of the client feature v is greater than a first threshold value θ, as shown in equation (3):
max(Simu,v)>θ (3)
when the first short text and the customer characteristic v meet the similarity rule shown in the formula (3), the first short text u can be considered to describe the customer characteristic v, and therefore the target customer characteristic corresponding to the automobile sales follow-up record text is determined as the customer characteristic v; the similarity rule can acquire characteristics accurately describing the client.
Another example similarity rule includes: and when the number of the seed sentences with the similarity degree with the target service record text larger than a second threshold value in the plurality of seed sentences corresponding to the second customer characteristic is larger than a third threshold value, determining the second customer characteristic as the target customer characteristic 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 client feature v satisfies the following condition
Figure BDA0003412185310000103
Wherein I (-) is an illustrative function when
Figure BDA0003412185310000111
If so, the value is 1, otherwise, the value is 0, wherein alpha represents a second threshold value;
Figure BDA0003412185310000112
can show that when the first short text u and the ith seed sentence v of the client characteristic viIs greater than a second threshold value, the first short text u and the seed sentence v are considerediThe similarity exists; m refers to the lowest number of first short texts u with similarity greater than a certain threshold value to the seed sentence; δ means at least the percentage of similarity of the first short text u to the seed sentence that is greater than a certain threshold, i.e.: alpha is more than 0 and less than theta, m is more than 0, and delta is more than 0 and less than or equal to 1.
It is understood that when the car sales follow-up record is of a longer length, it may include a plurality of first short texts matching keywords of different customer characteristics. For each first short text, the cosine similarity of the seed sentences corresponding to the first short text and different client features can be calculated.
When the first short text and the customer characteristic v satisfy the similarity rule shown in the formula (4), the first short text u can be considered to describe the customer characteristic v, and therefore, the target customer characteristic corresponding to the automobile sales follow-up record text is determined as the customer characteristic v. In the formula (4), the first short text can be considered to describe the client feature only if the number of the first short text with sufficiently large similarity to the seed sentence of the client feature is larger than a certain number, so that the influence of similarity reduction caused by different expressions can be reduced.
The above formulas (3) and (4) are two exemplary matching rules, which are examples for facilitating understanding of the embodiment of the present invention and should not be construed as limiting the embodiment of the present invention.
Illustratively, the foregoing example of table 2 satisfies equation (3), and thus the target customer characteristic matched to the customer having the sample ID of 1 may be determined as "whether to buy another vehicle: is ". For other, unaffiliated users, the target feature may be "whether to buy another vehicle: unknown ".
By performing the operations of the steps 210 to 250, the method realizes the extraction of the characteristics of the customer by using the trained BERT model, and the characteristics of the customer extracted by the salesperson after using the BERT model are more accurate due to the fact that the training of context semantics is included in the training of the BERT model.
It should be understood that the "first client characteristic" and the "second client characteristic" in the embodiment of the present application may be the same characteristic or different characteristics, and similarly, the "first threshold", the "second threshold", and the "third threshold" are only three thresholds for convenience of description, and values of the three thresholds are set by a technician.
Table 3 below illustrates the results of extracting target customer features using the BERT model in actual car sales, the target customer features including: any one or any combination of the industries of the customers, the drivers, whether the vehicles are available, the concerns of the customers, whether the vehicles pay attention to Tesla vehicles, whether the vehicles pay attention to Toyota vehicles, or the time of expected vehicle purchasing. By acquiring the target customer characteristics, the salesperson can provide different sales strategies for specific customers, so that the customers can be better served.
Figure BDA0003412185310000121
Figure BDA0003412185310000131
Table 3 target customer feature extraction results example
In the method for extracting features of a client disclosed in the foregoing embodiment, the trained bidirectional language model, the seed sentences corresponding to the plurality of client features, and the keywords corresponding to the plurality of client features are all favorable for improving the accuracy of extracting the client features. It should be noted that the training of the bi-directional language model, the obtaining of the seed sentences and the keywords may be performed before the client feature extraction method disclosed in the foregoing embodiment.
The following introduces a two-way language model training method, a non-artificial seed sentence acquisition method, and a non-artificial keyword acquisition method.
Referring to fig. 3, an embodiment discloses a model training method, which is performed to train a bi-directional language model for implementing the method shown in fig. 1 and fig. 2. The trained bi-directional language model may be any one of a self-coding 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 and the like, and is not limited specifically. It should be noted that the electronic device to which the client feature extraction method disclosed in the foregoing embodiment is applied may be the same electronic device as the electronic device to which the model training method disclosed in the embodiment of the present application is applied, or may be a different electronic device, and is not particularly limited.
As shown in fig. 3, the method may include:
310. seed sentences corresponding to each of the plurality of customer characteristics are selected from the sample service record text.
It should be understood that the sample service record text input in step 310 is used for training the bi-directional language model, and the target service record text input in step 110 is specific to a specific customer, and the corresponding feature text is output for the customer through the bi-directional language model by recording the text of the relevant information of the customer during the service process for the customer. The sample service record text belongs to training data, and the number of the sample service record texts is large.
Based on the accuracy of the seed sentence obtained in step 310, the accuracy of the trained bi-directional language model and the accuracy of the client features in extracting the client features play an important role, and therefore, the example of selecting the seed sentence corresponding to each client feature in the plurality of client features from the sample service record text may include:
inputting phrases included in the sample service record text and artificial keywords corresponding to the characteristics of each client into a word vector model, and determining target keywords matched with the artificial keywords from each phrase through the word vector model; and selecting sentences containing the target keywords from the sample service record texts as seed sentences corresponding to the client features.
The word vector model may be a word2vec model or a doc2vec model, but is not limited thereto. The artificial keywords corresponding to each client feature can be designed by referring to specific characteristics of different application scenes. The word vector model can respectively convert the phrases and the artificial keywords in the sample service record text into corresponding word vectors, so that the similarity between the phrases and the artificial keywords can be calculated according to the word vectors respectively corresponding to the phrases and the artificial keywords in the sample service record text. The aforementioned target keyword matched with the artificial keyword may be a keyword having a similarity higher than a fourth threshold with the artificial keyword.
The method comprises the steps of taking a sample service recording text and designed artificial keywords as input, calculating similarity between word groups through a word vector model, screening out target keywords similar to the artificial keywords in semantics, further determining sentences including the target keywords as seed sentences, enabling the seed sentences acquired based on a non-artificial mode to accurately describe corresponding customer characteristics, and facilitating subsequent training of a bidirectional language model. Furthermore, the accurate seed sentences are obtained, and the accuracy of outputting the client characteristics can be improved in the application stage of the subsequent bidirectional language model.
320. And screening out sample short texts meeting the expert rules from the sample service record texts according to the expert rules corresponding to the plurality of client characteristics.
The expert rules in step 320 may be formulated based on seed sentences corresponding to the client features, and are core elements for describing the client features extracted from the seed sentences. Expert rules may be manually refined by a technician and may be represented by regular expressions.
The embodiment of the present invention exemplarily provides an expert rule, which may be a re-regularized expression of Python, where re is a standard library matched with a rule of Python, a rule character string is composed of a plurality of specific characters defined in advance and a combination of the specific characters through the re-regularized expression, and a filtering logic for the character string is expressed through the rule characters.
330. And inputting two sample short texts to the bidirectional language model to be trained each time, and performing 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.
340. And calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts.
350. And calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training loss.
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 client feature, or sample short texts corresponding to different client features.
In some embodiments, the true similarity for two sample short texts may be manually labeled. However, the workload of manual labeling is huge, and in other embodiments, the true similarity corresponding to the two sample short texts can be determined according to the client features corresponding to the two sample short texts respectively. When two input sample short texts correspond to the same client feature, the real similarity corresponding to the two sample short texts is higher than the real similarity corresponding to different client features. For example, if two input sample short texts correspond to the same client feature, the true similarity of the two sample short texts may be 1; if two input sample short texts correspond to different client features, the true similarity of the two sample short texts may be-1.
In the foregoing model training method, the similarity calculation tasks shown in steps 340 and 350 may be used to train the bidirectional language model, so as to improve the introspection of the bidirectional language model for semantic vector extraction.
Through the above description of the method shown in fig. 3, in the method, sample short texts respectively corresponding to each client feature are obtained through the obtained seed sentences and the artificially designed expert rules, and the two-way language model is trained by using the sample short texts corresponding to the same client feature or different client features. The two-way language model at least comprises training of relevant parameters of context semantics, so that when the trained two-way language model is applied to client features, context semantics recognition is carried out on input sample service record texts, and the obtained features for describing clients are more accurate.
Optionally, before performing step 310, a preprocessing operation may be performed on the sample service record text, where the preprocessing operation at least includes: and carrying out sentence division processing on the input sample service record texts to obtain a plurality of third short texts. Accordingly, the selecting a sentence containing the target keyword from the sample service record text as a seed sentence corresponding to the client feature in step 310 may include: and selecting the third short text containing the target key words from the plurality of third short texts as seed sentences corresponding to the client characteristics.
Optionally, the preprocessing operation may further include: and performing text cleaning processing on the third short text for removing the third short text which cannot be used for describing the characteristics of the client.
By adding the preprocessing operation on the input sample service recording text, on one hand, the sample service recording text is divided into a third short text, so that the parameters in the trained bidirectional language model are more accurate, and more accurate and excellent customer characteristics can be output when a subsequent model is applied; on the other hand, the third short text which cannot be used for describing the characteristics of the client is eliminated due to the text cleaning processing of the third short text; the workload of training the model can be reduced, and the degree of the criterion of the model is not reduced.
Optionally, before performing semantic recognition on two input sample short texts through a to-be-trained bidirectional language model; the method further comprises the following steps: performing data enhancement operations on the sample short text, the data enhancement operations comprising: synonym replacement, random insertion, random exchange, and random deletion.
By adding data enhancement operation in the method, the problem of precision reduction caused by polysemous words can be reduced, and therefore the processing precision of the trained bidirectional language model on the sample service record text is improved.
As shown in fig. 4, a model trained by the method according to an embodiment of the present invention may be used in various sales scenarios, but is not limited to the sales scenarios, and in an application, the model trained by the method may extract features describing customers required by a salesperson according to a salesperson input service recording text, and the salesperson may develop a targeted activity, such as; for marketing, or health management, etc. The method comprises the following steps:
410. and carrying out sentence segmentation processing and text cleaning processing on the input sample automobile sales texts to obtain a plurality of third short texts.
The operation in step 410 is different from the operation in step 310 in that: the third short text output in step 410 is used for training a subsequent model, such as a BERT model or a word2vec model, and a trained model, and is used for extracting client features; the second short text output in step 310 is used to extract the client features, and the trained model is used in the client feature extraction.
420. And selecting seed sentences respectively corresponding to each client characteristic from the plurality of third short texts.
Wherein the accuracy of obtaining the seed sentence, the accuracy of the trained model, and the accuracy of extracting the features of the customer play an important role in extracting the features of the customer, and thus, the specific operation of obtaining the seed sentence in step 420 can be selected according to the design requirements.
An exemplary method for obtaining a seed sentence specifically includes:
and selecting the text meeting the design requirement from the third short texts as a seed sentence. The design requirement may be a human-made policy, which may be the aforementioned expert rules.
Or, preferably, another exemplary method for obtaining a seed sentence specifically includes:
and step 421, taking a plurality of third short texts as input, and training the word2vec model.
The purpose of training the word2vec model is to enable the word2vec model to generate an accurate word vector according to semantics.
And 422, inputting the artificial keywords corresponding to the characteristics of the client and the phrases in each third short text into the trained word2vec model to obtain word vectors which are output by the word2vec model and respectively correspond to the artificial keywords and the phrases in the third short text.
Wherein each third short text can be segmented into a plurality of phrases. The input in step 422 may be a plurality of phrases divided from a plurality of third short texts. Also, each customer characteristic may correspond to a plurality of artificial keywords. After each artificial keyword and each phrase segmented from the third short text are input into the trained word2vec model, a corresponding word vector can be obtained.
And 423, calculating the similarity between the artificial keywords and each phrase according to the corresponding word vectors.
For each phrase, similarity can be calculated with a plurality of artificial keywords corresponding to the same customer characteristics respectively based on the word vectors.
And 424, determining a target keyword matched with the artificial keyword according to the similarity of the artificial keyword and each phrase.
If the similarity between a certain artificial keyword and a certain phrase is greater than a fourth threshold, the phrase can be determined as a target keyword matched with the artificial keyword.
Step 425, selecting sentences including the target keywords from the plurality of third short texts as seed sentences corresponding to the client features.
In steps 422 to 423, the similarity is calculated by using the trained word2vec model, and because the word2vec model can consider semantic context and has the characteristic of high calculation speed, the seed sentences are obtained by using the word2vec model, so that the later BERT model trained based on screening is more accurate.
For example, in an automobile sales scenario, for a customer feature of "purchased other cars," a third short text that may express the customer feature may include: the phrases "purchased", "bought", and the like. By utilizing the artificial keywords designed by designers in advance and through the trained word2vec model, texts similar to the artificial keywords can be screened from massive sample automobile sales texts and are used as a keyword set for storage.
Optionally, in step 425, the plurality of third short texts may include a plurality of target keyword-included sentences; the number of seed sentences should not be too large. Thus, the seed sentences may be further filtered from sentences that include the target keywords. The rules for the screening may include: random selection, manual selection by a technician, and the like, without limitation.
As shown in table 4, an example of a seed sentence corresponding to a customer feature of "purchased other car" screened in a car sales scenario.
Figure BDA0003412185310000181
TABLE 4 "purchased other cars" seed sentence sample
430. And screening out sample short texts which meet expert rules respectively corresponding to the client features from the third short texts, wherein the expert rules are formulated according to the seed sentences obtained in the step 420.
For ease of understanding, taking a car sales scenario as an example, for a customer characteristic of "buy another car", as shown in equation (5), an exemplary expert rule for this purpose includes:
p [ < u > is not yet present ] [ business order addition replacement ] formula (5)
The expression [. cndot. ] represents that only one word in [ ], the expression [. cndot. ] represents that the word in [ ] cannot be contained, and the expert rule shown in the expression (5) is a re regularization expression of Python.
It should be noted that, in step 430, the sample short text is selected to satisfy the expert rule corresponding to one client feature. When the number of the third short texts is large, the screened sample short texts can cover different client features.
Illustratively, according to the expert rule of equation (5), expert rule matching is performed to obtain a sample short text example satisfying the expert rule, as shown in table 5 below:
Figure BDA0003412185310000182
table 5 depicts sample short text for "other vehicle purchased
The sample short text selected in step 430 will be used as training data to train the BERT model.
Optionally, the training process of the BERT model provided in the embodiment of the present invention may further include: performing data enhancement operations on the sample short text, comprising: at least one operation of synonym replacement, random insertion, random exchange, random deletion and the like; the problem of precision reduction caused by polysemous words can be reduced, the sample size of training data is enlarged, and therefore the processing precision of the trained bidirectional language model on the text is improved.
And 440, inputting two sample short texts each time, and performing semantic recognition on the two input sample short texts through a BERT model to be trained to obtain semantic vectors corresponding to the two sample short texts respectively.
450. And calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts.
460. And calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the BERT model to be trained according to the training loss.
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 text is higher than the true similarity corresponding to dissimilar text. The BERT model was trained with the similarity calculation as a downstream task.
Step 460 determines a loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, adjusts parameters of the BERT model to be trained according to the loss, and trains the BERT similarity model. The calculated loss may be, but is not limited to, an L1 loss, an L2 loss, a cross entropy loss, and the like.
Referring to fig. 5a, fig. 5a is a diagram illustrating training of a BERT model according to an embodiment of the disclosure. The training process shown in fig. 5a may correspond to steps 440-450, described above.
As shown in fig. 5a, a pair of sample short texts, respectively short text 1 and short text 2, may be input to the BERT model. And performing Pooling (Pooling) operation on the output of the BERT model to obtain a semantic vector U1 corresponding to the short text 1 and a semantic vector U2 corresponding to the short text 2.
The Softmax Classifier (Softmax Classifier) is a common structure in a neural network-based classification model, and outputs the probability of a class. In the embodiment of the application, the calculation problem of the similarity can be converted into a classification problem, that is, the similarity of a pair of sample short texts can be divided into two categories, namely, similar category and dissimilar category. The Softmax Classifier may output a probability that the short texts of the two samples are similar and a probability that the short texts of the two samples are dissimilar, respectively.
It is assumed that sample short texts describing the same customer features are similar, while sample short texts describing different customer features are dissimilar. Based on the assumption, when two input sample short texts describe the same client feature, the similarity label is 1; if the same client feature is not described, the similarity label is-1.
Generally, the number of short texts of the sample obtained in step 430 is large enough, and a sufficient number of sentence pairs can be constructed as training samples for training the BERT similarity model.
As shown in table 6, for an automobile sales scenario, an example provided in the embodiment of the present invention uses a sample short text with the same customer feature as described in table 5 as a similar text, where the similarity is 1, which indicates that two words are similar; the sample short text which does not describe the same client feature is taken as dissimilar text, the similarity of the sample short text is-1, and the two sentences are dissimilar. According to the rule, determining loss through predicting the similarity and the real similarity corresponding to the two sample short texts, and adjusting the parameters of the BERT model to be trained according to the loss.
Figure BDA0003412185310000191
Figure BDA0003412185310000201
TABLE 6 BERT sample examples of model training procedures
In addition, the differences between the BERT model training process and the application process are accurately illustrated. Please refer to fig. 5 b. FIG. 5b is an exemplary diagram of customer feature extraction based on a BERT model according to one embodiment of the disclosure. The BERT model shown in fig. 5b may be obtained by training through a model training process as shown in fig. 5a, and the client feature extraction process shown in fig. 5b may correspond to steps 230-240 in the foregoing embodiments.
As shown in fig. 5b, the first short text extracted from the target service record text and the seed sentence corresponding to a certain client feature are output to the trained BERT model. Performing pooling operation on the output of the first short text by the BERT model to obtain a first semantic vector; and performing pooling operation on the output of the seed sentence by the BERT model to obtain a second semantic vector. And calculating the cosine similarity of the first semantic vector and the second semantic vector to obtain the similarity of the first semantic vector and the seed sentence.
In summary, in the embodiment of the present application, seed sentences corresponding to different client features may be obtained through a large amount of sample service record texts, so that expert rules corresponding to the client features are specified based on the seed sentences, sample short texts satisfying the expert rules are screened from the sample service record texts and used as training data, and a bidirectional language model is trained. The generation of the training data does not depend on the production environment and the business requirements of the sample service record text, and the sample service record text does not need to be filled in according to a specified format and is attached to an actual business scene. Moreover, a large number of seed sentences which accurately describe the characteristics of the clients can be mined from the sample service record text only by designing a small number of artificial keywords in the early stage. And only need set for a small amount of expert's rule based on the seed sentence, can follow the matching and go out a large amount of sample short texts that can be used for carrying out the model training, greatly reduced the cost of labor to can effectively cover most user information.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a client feature extraction apparatus according to an embodiment. The device can be applied to electronic equipment such as a personal computer or a server, and is not limited specifically. As shown in fig. 6, the client feature extraction apparatus 600 may include: an identification module 610, a first determination module 620, and a second determination module 630.
The recognition module 610 is configured to perform semantic recognition on the target service record text through the trained bi-directional language model to obtain a first semantic vector; performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences;
a first determining module 620, configured to determine, according to the first semantic vector and the second semantic vector of each seed sentence, a similarity between the target service record text and each seed sentence;
a second determining module 630, configured to determine, 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 multiple customer features.
In one embodiment, the client feature extraction device further comprises a preprocessing module for selecting the first short text from the target service record texts to be input.
The recognition module 610 is further configured to input the first short text into the trained bi-directional language model; and performing semantic recognition on the first short text through the bidirectional language model to obtain a first semantic vector.
In an embodiment, the preprocessing module is further configured to match a target service record text to be input with keywords corresponding to a plurality of client features, respectively, and screen out a first short text matching the keywords from the target service record text.
The bidirectional language model specifically includes:
any one of a BERT model, an ELMo model, and a RoBERTA model.
In one embodiment, the preprocessing module is further configured to perform clause processing and text cleaning processing on a target service record text to be input, so as to obtain a plurality of second short texts; and matching the plurality of second short texts with keywords respectively corresponding to the plurality of client characteristics.
In one embodiment, the second determining module 630 is further configured to determine the first customer feature as the target customer feature corresponding to the target service record text when a maximum value of similarity between the target service record text and the seed sentence corresponding to the first customer feature is greater than a set first threshold.
In one embodiment, the second determining module 630 is further configured to determine the second customer characteristic as the target customer characteristic corresponding to the target service record text when 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 among the plurality of seed sentences corresponding to the second customer characteristic.
Therefore, by implementing the client feature extraction device disclosed in the foregoing embodiment, the service record text is input into the trained bidirectional language model, and the similarity between the service record text and each seed sentence corresponding to the feature for describing the client is obtained, so that the feature of the client can be accurately described.
Please refer to fig. 7, which is a schematic structural diagram of a model training apparatus according to an embodiment. The device can be applied to electronic equipment such as a personal computer or a server, and is not limited specifically. As shown in fig. 7, the model training apparatus 700 may include: a selection module 710, a screening module 720, a prediction module 730 and an adjustment module 740;
a selecting module 710, configured to select a seed sentence corresponding to each of the plurality of client features from the sample record text;
a screening module 720, configured to screen, according to expert rules corresponding to multiple client features, sample short texts meeting the expert rules from the sample service record texts to obtain sample short texts corresponding to the multiple client features respectively; expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer features;
the prediction module 730 is configured to 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; calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts;
and an adjusting module 740, configured to calculate a training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjust parameters in the bidirectional language model to be trained according to the training loss.
Optionally, the real similarity corresponding to the two sample short texts is determined according to the client features corresponding to the two sample short texts respectively; when the two sample short texts correspond to the same customer feature, the real similarity corresponding to the two sample short texts is higher than the real similarity corresponding to the two sample short texts when the two sample short texts respectively correspond to different customer features.
In an embodiment, the selecting module 710 is further configured to, for each customer feature of a plurality of customer features, input 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 matched with the artificial keywords 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 client feature.
In an embodiment, the model training apparatus 700 may further include: a data processing module;
the data processing module is also used for executing data enhancement operation on the sample short text; the data enhancement operation includes: synonym replacement, random insertion, random exchange, and random deletion.
In an embodiment, the data processing module is further configured to, after obtaining the input service record text and before obtaining the seed sentence according to the service record, perform a data processing operation on the input service record text, where the data processing operation at least includes: sentence dividing processing and text cleaning processing are carried out on the sample service record text to obtain a plurality of third short texts;
accordingly, the selecting module 710 is further configured to obtain a seed sentence from the third short texts.
In one embodiment, the processing module 720 is further configured to perform a cleansing operation on the third short text to remove text that cannot be used for describing the characteristics of the client.
Therefore, by implementing the model training device for extracting the characteristics of the client disclosed by the embodiment, the similar text and the dissimilar text are obtained through the obtained seed sentences and the designed expert rules for describing the characteristics of the client, the bidirectional language model is trained by using the similar text and the dissimilar text, and the bidirectional language model at least comprises the training of relevant parameters of context semantics, so that when the trained bidirectional language model is applied to the characteristics of the client, the context semantics recognition is carried out on the input service record text, and the obtained characteristics for describing the client are more accurate.
FIG. 8 is a block diagram of an electronic device in one embodiment. As shown in fig. 8, 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 that may be configured to be executed by the one or more processors 810, the one or more programs configured to perform the customer feature extraction method and the model training method as described in the embodiments above, among others.
Processor 810 may include one or more processing cores. The processor 810 interfaces with various interfaces and circuitry throughout the electronic device 800 to perform various functions and process data of the electronic device 800 by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 820 and invoking data stored in the memory 820. Alternatively, the processor 810 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 810 may integrate one or more of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 810, but may be implemented by a communication chip.
The Memory 820 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 820 may be used to store instructions, programs, code sets, or instruction sets. The memory 820 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like. The stored data area may also store data created during use by the electronic device 800, and the like.
The embodiment of the application discloses a computer-readable storage medium, which stores a computer program, wherein when the computer program is executed by a processor, the processor is enabled to realize any one of the client feature extraction methods disclosed in the embodiment of the application.
The embodiment of the application discloses a computer readable storage medium, which stores a computer program, wherein when the computer program is executed by the processor, the processor is enabled to realize any one of the model training methods disclosed in the embodiment of the application.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present application. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Those skilled in the art should also appreciate that the embodiments described in this specification are all alternative embodiments and that the acts and modules involved are not necessarily required for this application.
In various embodiments of the present application, it should be understood that the size of the serial number of each process described above does not mean that the execution sequence is necessarily sequential, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated units, if implemented as software functional units and sold or used as a stand-alone product, may be stored in a computer accessible memory. Based on such understanding, the technical solution of the present application, which is a part of or contributes to the prior art in essence, or all or part of the technical solution, may be embodied in the form of a software product, stored in a memory, including several requests for causing a computer device (which may be a personal computer, a server, a network device, or the like, and may specifically be a processor in the computer device) to execute part or all of the steps of the above-described method of the embodiments of the present application.
It will be understood by those skilled in the art that all or part of the steps in the methods of the embodiments described above may be implemented by hardware instructions of a program, and the program may be stored in a computer-readable storage medium, where the storage medium includes Read-Only Memory (ROM), Random Access Memory (RAM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), One-time Programmable Read-Only Memory (OTPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Compact Disc Read-Only Memory (CD-ROM), or other Memory, such as a magnetic disk, or a combination thereof, A tape memory, or any other medium readable by a computer that can be used to carry or store data.
The above detailed description is provided for a client feature extraction method and apparatus, a model extraction method and apparatus, an electronic device, and a storage medium, which are disclosed in the embodiments of the present application, and specific examples are applied in the description to explain the principles and embodiments of the present application. Meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (15)

1. A method for extracting features of a client, the method comprising:
performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector;
performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences;
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;
and determining a target customer characteristic corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence.
2. The method of claim 1, wherein before the semantic recognition of the target service record text by the trained bi-directional language model to obtain the first semantic vector, the method further comprises:
selecting a first short text from target service record texts 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, wherein the semantic recognition comprises the following steps:
inputting the first short text into a trained bidirectional language model;
and performing semantic recognition on the first short text through the bidirectional language model to obtain a first semantic vector.
3. The method of claim 2, wherein selecting the first short text from the target service record texts to be input comprises:
matching a target service record text to be input with keywords corresponding to a plurality of client features respectively, and screening out a first short text matched with the keywords from the target service record text.
4. The method of claim 3, wherein matching the target service record text to be input with the keywords corresponding to the plurality of client features respectively comprises:
performing clause processing and text cleaning processing on a target service record text to be input to obtain a plurality of second short texts;
and matching the plurality of second short texts with keywords respectively corresponding to the plurality of client characteristics.
5. The method of claim 1, wherein the plurality of client features comprises: a first customer characteristic; and determining a target customer characteristic corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence, including:
and when the maximum value of the similarity of the target service record text and the seed sentence corresponding to the first customer characteristic is larger than a set first threshold value, determining the first customer characteristic as the target customer characteristic corresponding to the target service record text.
6. The method of claim 1, wherein the plurality of client features comprises: a second customer characteristic; and determining a target customer characteristic corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence, including:
and when the number of seed sentences with the similarity to the target service record text larger than a second threshold value in the plurality of seed sentences corresponding to the second customer characteristic is larger than a third threshold value, determining the second customer characteristic as the target customer characteristic corresponding to the target service record text.
7. The method according to any one of claims 1 to 6, wherein the bi-directional language model is trained using sample short texts corresponding to the plurality of client features, respectively; the sample short text corresponding to each customer characteristic is screened from the sample record text and meets the expert rule corresponding to the customer characteristic; the expert rules corresponding to each customer characteristic are formulated based on the seed sentences corresponding to each customer characteristic.
8. A method of model training, the method comprising:
selecting seed sentences corresponding to each customer characteristic from the plurality of customer characteristics from the sample service record texts;
according to expert rules corresponding to a plurality of client features, sample short texts meeting the expert rules are screened from the sample service record texts to obtain sample short texts corresponding to the client features respectively; expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer features;
inputting two sample short texts to a bidirectional language model to be trained each time, and performing 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;
calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts;
and calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training loss.
9. The method of claim 8, wherein when the two sample short texts correspond to the same client feature, the true similarity between the two sample short texts is higher than the true similarity between the two sample short texts corresponding to different client features.
10. The method of claim 8, wherein selecting a seed sentence from the sample record text corresponding to each of the plurality of client features comprises:
aiming at each customer feature in a plurality of customer features, inputting each phrase included in the sample service record text and the artificial keywords corresponding to the customer features into a word vector model;
determining target keywords matched with the artificial keywords from each phrase through the word vector model;
and selecting the sentences containing the target keywords from the sample service record texts as seed sentences corresponding to the client features.
11. The method of claim 10, wherein after obtaining sample short texts corresponding to the plurality of client features, respectively, and before inputting two sample short texts into the bi-directional language model to be trained, the method further comprises:
performing a data enhancement operation on the sample short text;
the data enhancement operation includes: synonym replacement, random insertion, random exchange, and random deletion.
12. A client feature extraction apparatus, characterized in that the apparatus comprises:
the recognition module is used for performing semantic recognition on the target service record text through the trained bidirectional language model to obtain a first semantic vector; performing semantic recognition on seed sentences corresponding to each customer feature in the customer features through the bidirectional language model to obtain second semantic vectors of the seed sentences;
a first determining module, configured to determine, according to the first semantic vector and the second semantic vector of each seed sentence, a similarity between the target service record text and each seed sentence;
and the second determining module is used for determining the target customer characteristics corresponding to the target service record text from the plurality of customer characteristics according to the similarity between the target service record text and each seed sentence.
13. A model training apparatus, the apparatus comprising:
the selecting module is used for selecting seed sentences corresponding to each customer characteristic from the plurality of customer characteristics from the sample record texts;
the screening module is used for screening sample short texts meeting expert rules from the sample service record texts according to the expert rules corresponding to the client characteristics so as to obtain sample short texts corresponding to the client characteristics respectively; expert rules corresponding to each customer feature are formulated based on the seed sentences corresponding to the customer features;
the prediction module is used for inputting two sample short texts to the bidirectional language model to be trained each time, and performing 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; calculating the prediction similarity of the two sample short texts according to the semantic vectors respectively corresponding to the two sample short texts;
and the adjusting module is used for calculating training loss according to the prediction similarity and the real similarity corresponding to the two sample short texts, and adjusting parameters in the bidirectional language model to be trained according to the training loss.
14. An electronic device, comprising a memory and a processor, wherein the memory has stored thereon a computer program which, when executed by the processor, causes the processor to carry out the method according to any one of claims 1-7, 8-11.
15. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7, 8-11.
CN202111538219.3A 2021-12-15 2021-12-15 Customer feature extraction method and device, electronic equipment and storage medium Pending CN114118062A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111538219.3A CN114118062A (en) 2021-12-15 2021-12-15 Customer feature extraction method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111538219.3A CN114118062A (en) 2021-12-15 2021-12-15 Customer feature extraction method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114118062A true CN114118062A (en) 2022-03-01

Family

ID=80365695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111538219.3A Pending CN114118062A (en) 2021-12-15 2021-12-15 Customer feature extraction method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114118062A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116049411A (en) * 2023-03-31 2023-05-02 北京中关村科金技术有限公司 Information matching method, device, equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116049411A (en) * 2023-03-31 2023-05-02 北京中关村科金技术有限公司 Information matching method, device, equipment and readable storage medium

Similar Documents

Publication Publication Date Title
WO2020125445A1 (en) Classification model training method, classification method, device and medium
CN110909165B (en) Data processing method, device, medium and electronic equipment
CN108363790A (en) For the method, apparatus, equipment and storage medium to being assessed
CN109271493A (en) A kind of language text processing method, device and storage medium
CN109086265B (en) Semantic training method and multi-semantic word disambiguation method in short text
US10915756B2 (en) Method and apparatus for determining (raw) video materials for news
CN108108468A (en) A kind of short text sentiment analysis method and apparatus based on concept and text emotion
CN111144120A (en) Training sentence acquisition method and device, storage medium and electronic equipment
CN111209363B (en) Corpus data processing method, corpus data processing device, server and storage medium
CN111783450B (en) Phrase extraction method and device in corpus text, storage medium and electronic equipment
CN113392209A (en) Text clustering method based on artificial intelligence, related equipment and storage medium
CN112163081A (en) Label determination method, device, medium and electronic equipment
CN112860896A (en) Corpus generalization method and man-machine conversation emotion analysis method for industrial field
CN111861596A (en) Text classification method and device
CN116402166B (en) Training method and device of prediction model, electronic equipment and storage medium
CN114118062A (en) Customer feature extraction method and device, electronic equipment and storage medium
CN113220999A (en) User feature generation method and device, electronic equipment and storage medium
WO2022039803A1 (en) Identifying noise in verbal feedback using artificial text from non-textual parameters and transfer learning
CN108268602A (en) Analyze method, apparatus, equipment and the computer storage media of text topic point
CN116090450A (en) Text processing method and computing device
CN115577109A (en) Text classification method and device, electronic equipment and storage medium
CN113505293B (en) Information pushing method and device, electronic equipment and storage medium
CN115269846A (en) Text processing method and device, electronic equipment and storage medium
CN114676699A (en) Entity emotion analysis method and device, computer equipment and storage medium
CN114722832A (en) Abstract extraction method, device, equipment and storage medium

Legal Events

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