CN110413788B - Method, system, device and storage medium for predicting scene category of conversation text - Google Patents
Method, system, device and storage medium for predicting scene category of conversation text Download PDFInfo
- Publication number
- CN110413788B CN110413788B CN201910695856.8A CN201910695856A CN110413788B CN 110413788 B CN110413788 B CN 110413788B CN 201910695856 A CN201910695856 A CN 201910695856A CN 110413788 B CN110413788 B CN 110413788B
- Authority
- CN
- China
- Prior art keywords
- vector
- sentence
- text
- word
- target
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/35—Clustering; Classification
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Machine Translation (AREA)
Abstract
The invention discloses a method, a system, equipment and a storage medium for predicting scene categories of session texts, wherein the prediction method comprises the following steps: acquiring a keyword; acquiring candidate sentences and historical conversation texts in a database according to each keyword; selecting a target sentence from the historical conversation text; performing word segmentation processing on the target sentences and acquiring word vectors of each segmented word in each target sentence; sequentially coding each word vector in the target sentence to obtain a sentence vector; coding each sentence vector in the historical conversation text in sequence to obtain a conversation vector; establishing a probability model for predicting that the conversation text belongs to each scene category; obtaining a probability value of the target session text belonging to each scene category according to the probability model; and selecting the scene category corresponding to the maximum probability value as the target scene category corresponding to the target session text. The method and the device improve the scene recognition accuracy and recall rate of the existing session text, and simultaneously reduce the labor cost.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, a system, a device, and a storage medium for predicting a scene type of a session text.
Background
For service-type enterprises, consultation or feedback of users is of great importance to the enterprises, and many service-type enterprises store different session text data of the users and customer service personnel by setting a customer service system, so as to analyze scene categories to which different session texts belong, and facilitate subsequent data processing processes.
At present, keywords are mainly set and manual judgment is combined, but the method is easily interfered by noise, so that the accuracy rate is low, and meanwhile, the cost of manual review is too high for massive interactive data; in addition, the dialogue type texts can be classified through deep learning methods of a CNN (convolutional neural network) algorithm and an RNN (recurrent neural network) algorithm; however, for the CNN algorithm, the problem of simple text classification is not solved when identifying the scene to which the dialog text belongs, and context association is needed to accurately distinguish the dialog, so that the model is constructed by considering the time sequence relationship of the long text dialog; for RNN algorithms, mostly a single network or a simple variant of a network is used at present, and is not suitable for conversational scene recognition using complex network structures.
Disclosure of Invention
The invention aims to overcome the defects of low accuracy and the like in the determination of the scene type of the session text in the prior art, and provides a method, a system, equipment and a storage medium for predicting the scene type of the session text.
The invention solves the technical problems through the following technical scheme:
the invention provides a prediction method of scene categories of conversation texts, which comprises the following steps:
acquiring different keywords;
wherein different keywords are used for representing different scene categories;
acquiring candidate sentences containing the keywords in a database according to each keyword;
acquiring different historical conversation texts in which the candidate sentences are located;
selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
performing word segmentation processing on the target sentence to obtain a word segmentation result;
obtaining a word vector corresponding to each word in each target sentence according to the word segmentation result;
sequentially coding each word vector in the target sentence to obtain a sentence vector corresponding to the target sentence;
when coding is carried out according to the forward sequence, semantic relations are established between each word vector in the sentence vectors and all word vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relation between each word vector in the sentence vector and all backward word vectors;
coding each sentence vector in the historical conversation text in sequence to obtain a conversation vector corresponding to the historical conversation text;
when coding is carried out according to a forward sequence, semantic relations are established between each sentence vector in the conversation vectors and all sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relation between each sentence vector in the conversation vectors and all backward sentence vectors;
taking the session vector corresponding to the historical session text as input, taking the scene category corresponding to the historical session text as output, and establishing a probability model for predicting that the session text belongs to each scene category;
acquiring a target session text;
inputting the target session text into the probability model, and acquiring the probability value of the target session text belonging to each scene category;
and selecting the scene category corresponding to the maximum probability value as the target scene category corresponding to the target session text.
Preferably, the step of performing word segmentation processing on the target sentence and obtaining a word segmentation result includes:
performing word segmentation processing on the target sentence by adopting a HanLP word segmentation tool (a word segmentation tool) to obtain a word segmentation result;
the step of obtaining the word vector corresponding to each word in each target sentence according to the word segmentation result comprises the following steps:
and acquiring a Word Vector corresponding to each participle in each target sentence according to the Word segmentation result by adopting a Word2Vector model or a GloVe model (both the Word2Vector model and the GloVe model are a Word Vector conversion model).
Preferably, the step of sequentially encoding each word vector in the target sentence and obtaining a sentence vector corresponding to the target sentence comprises:
sequentially coding each word vector in the target sentence by adopting an LSTM algorithm (long-short time memory network algorithm) to obtain a first intermediate vector corresponding to each word vector;
the first intermediate vector corresponding to the word vector ordered at the head in the encoding direction is a vector obtained by processing the word vector by using an implicit layer of an LSTM algorithm, and the first intermediate vectors corresponding to each word vector at other positions comprise the word vector at the current position and the first intermediate vector corresponding to the previous word vector;
taking the first intermediate vector corresponding to the word vector at the last position in the encoding direction as the sentence vector corresponding to the target sentence;
the step of sequentially encoding each sentence vector in the historical conversation text to obtain the conversation vector corresponding to the historical conversation text comprises:
sequentially coding each sentence vector in the historical conversation text by adopting an LSTM algorithm to obtain a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by using an LSTM algorithm hidden layer, and the second intermediate vectors corresponding to each of the sentence vectors at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
and taking the second intermediate vector corresponding to the sentence vector at the last position in the encoding direction as the session vector corresponding to the historical session text.
Preferably, the step of sequentially encoding each word vector in the target sentence and obtaining a sentence vector corresponding to the target sentence comprises:
sequentially coding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first sentence vectors;
fusing the two first sentence vectors to obtain the sentence vectors;
the step of sequentially encoding each sentence vector in the historical conversation text to obtain the conversation vector corresponding to the historical conversation text comprises:
sequentially coding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first session vectors;
and fusing the two first session vectors to obtain the session vector.
Preferably, the step of sequentially encoding each word vector in the target sentence to obtain a sentence vector corresponding to the target sentence further includes:
acquiring a first weight corresponding to each word vector in the target sentence by using a Softmax algorithm (a regression algorithm);
weighting each word vector in the target sentence according to the first weight to obtain a sentence vector after weighting;
the step of sequentially encoding each sentence vector in the historical conversation text and obtaining the conversation vector corresponding to the historical conversation text further comprises:
acquiring a second weight corresponding to each sentence vector in the historical conversation text by adopting a Softmax algorithm;
and weighting each sentence vector in the historical conversation text according to the second weight to obtain the conversation vector after weighting.
Preferably, the step of establishing a probability model for predicting that the session text belongs to each scene category, with the session vector corresponding to the historical session text as an input and the scene category corresponding to the historical session text as an output, includes:
adopting a Softmax algorithm to take the session vector corresponding to the historical session text as input, take the scene category corresponding to the historical session text as output, and establish a probability model for predicting that the session text belongs to each scene category; and/or the presence of a gas in the atmosphere,
after the step of selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences, the step of performing word segmentation on the target sentences further comprises the following steps of:
preprocessing the target sentence; and/or the presence of a gas in the atmosphere,
the step of selecting a set number of sentences from the historical conversational text as target sentences according to the candidate sentences comprises:
selecting the candidate sentences and N sentences in the context of the candidate sentences from the historical conversation text as the target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
The invention also provides a prediction system of the scene category of the conversation text, which comprises a keyword acquisition module, a candidate sentence acquisition module, a history text acquisition module, a target sentence acquisition module, a word segmentation processing module, a word vector acquisition module, a sentence vector acquisition module, a conversation vector acquisition module, a model establishing module, a target text acquisition module, a probability value acquisition module and a scene category determination module;
the keyword acquisition module is used for acquiring different keywords;
wherein different keywords are used for representing different scene categories;
the candidate sentence acquisition module is used for acquiring candidate sentences containing the keywords in a database according to each keyword;
the historical text acquisition module is used for acquiring different historical conversation texts in which the candidate sentences are positioned;
the target sentence acquisition module is used for selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
the word segmentation processing module is used for carrying out word segmentation processing on the target sentence to obtain a word segmentation result;
the word vector acquisition module is used for acquiring a word vector corresponding to each word segmentation in each target sentence according to the word segmentation result;
the sentence vector acquisition module is used for sequentially encoding each word vector in the target sentence to acquire a sentence vector corresponding to the target sentence;
when coding is carried out according to a forward sequence, establishing semantic relation between each word vector in the sentence vectors and all forward word vectors;
when coding is carried out according to a backward sequence, establishing semantic relation between each word vector in the sentence vectors and all backward word vectors;
the session vector acquisition module is used for sequentially encoding each sentence vector in the historical session text to acquire a session vector corresponding to the historical session text;
when coding is carried out according to a forward sequence, semantic relations are established between each sentence vector in the conversation vectors and all sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relations between each sentence vector in the conversation vectors and all backward sentence vectors;
the model establishing module is used for taking the session vector corresponding to the historical session text as input, taking the scene category corresponding to the historical session text as output, and establishing a probability model for predicting that the session text belongs to each scene category;
the target text acquisition module is used for acquiring a target session text;
the probability value acquisition module is used for inputting the target session text into the probability model and acquiring the probability value of the target session text belonging to each scene category;
the scene category determining module is used for selecting a scene category corresponding to the maximum probability value as a target scene category corresponding to the target session text.
Preferably, the word segmentation processing module is configured to perform word segmentation processing on the target sentence by using a HanLP word segmentation tool to obtain a word segmentation result;
the Word Vector obtaining module is used for obtaining a Word Vector corresponding to each participle in each target sentence according to the Word segmentation result by adopting a Word2Vector model or a GloVe model.
Preferably, the sentence vector obtaining module includes a first intermediate vector obtaining unit and a sentence vector obtaining unit;
the first intermediate vector obtaining unit is used for sequentially coding each word vector in the target sentence by adopting an LSTM algorithm to obtain a first intermediate vector corresponding to each word vector;
the first intermediate vector corresponding to the word vector ordered at the head in the encoding direction is a vector obtained by processing the word vector by using an implicit layer of an LSTM algorithm, and the first intermediate vectors corresponding to each word vector at other positions comprise the word vector at the current position and the first intermediate vector corresponding to the previous word vector;
the sentence vector obtaining unit is configured to use the first intermediate vector corresponding to the word vector at the last position in the encoding direction as the sentence vector corresponding to the target sentence;
the session vector acquisition module comprises a second intermediate vector acquisition unit and a session vector acquisition unit;
the second intermediate vector obtaining unit is used for sequentially coding each sentence vector in the historical conversation text by adopting an LSTM algorithm to obtain a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by using an LSTM algorithm hidden layer, and the second intermediate vectors corresponding to each of the sentence vectors at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
the conversation vector obtaining unit is configured to use the second intermediate vector corresponding to the sentence vector at the last position in the encoding direction as the conversation vector corresponding to the historical conversation text.
Preferably, the sentence vector obtaining module is configured to sequentially encode each word vector in the target sentence according to a forward order and a backward order by using an LSTM algorithm, obtain two first sentence vectors, and perform fusion processing on the two first sentence vectors to obtain the sentence vectors;
the conversation vector acquisition module is used for sequentially and respectively encoding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to acquire two first conversation vectors and fusing the two first conversation vectors to acquire the conversation vector.
Preferably, the prediction system further comprises a weight obtaining module and a weighting processing module;
the weight obtaining module is used for obtaining a first weight corresponding to each word vector in the target sentence by adopting a Softmax algorithm;
the weighting processing module is used for weighting each word vector in the target sentence according to the first weight to obtain the sentence vector after weighting processing;
the weight obtaining module is further configured to obtain a second weight corresponding to each sentence vector in the historical conversation text by using a Softmax algorithm;
the weighting processing module is further configured to perform weighting processing on each sentence vector in the historical conversation text according to the second weight, so as to obtain the conversation vector after weighting processing.
Preferably, the model establishing module is configured to adopt a Softmax algorithm to take the session vector corresponding to the historical session text as an input, take the scene category corresponding to the historical session text as an output, and establish a probability model for predicting that the session text belongs to each scene category; and/or the presence of a gas in the atmosphere,
the prediction system further comprises a pre-processing module;
the preprocessing module is used for preprocessing the target sentence; and/or the presence of a gas in the gas,
the target sentence acquisition module is used for selecting the candidate sentences and N sentences in the context of the candidate sentences from the historical conversation text as the target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
The invention further provides an electronic device, which includes a memory, a processor and a computer program stored in the memory and executable on the processor, and the processor implements the method for predicting the scene type of the conversation text when executing the computer program.
The present invention further provides a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method for predicting a scene type of a conversational text as described above.
The positive progress effects of the invention are as follows:
in the invention, candidate sentences in a database are obtained through keywords to further obtain corresponding session texts and context sentences, then the sentences selected from the session texts are subjected to word segmentation and converted into corresponding word vectors, and then the LSTM algorithm is utilized to obtain sentence vectors containing semantic relations among all words and session vectors containing semantic relations among all sentences, so that a probability model for predicting that the session texts belong to each scene category is established to determine the target scene category corresponding to any session text, thereby improving the accuracy and recall rate of scene recognition of the existing session texts and simultaneously reducing the labor cost.
Drawings
Fig. 1 is a flowchart of a method for predicting a scene type of a conversation text according to embodiment 1 of the present invention.
Fig. 2 is a schematic flowchart of processing a conversation text in the method for predicting a scene category of a conversation text according to embodiment 1 of the present invention.
Fig. 3 is a flowchart of a method for predicting a scene type of a conversation text according to embodiment 2 of the present invention.
Fig. 4 is a schematic block diagram of a system for predicting scene categories of conversation texts according to embodiment 3 of the present invention.
Fig. 5 is a schematic block diagram of a system for predicting scene categories of a conversation text according to embodiment 4 of the present invention.
Fig. 6 is a schematic structural diagram of an electronic device implementing a method for predicting a scene category of a conversation text in embodiment 5 of the present invention.
Detailed Description
The invention is further illustrated by the following examples, which are not intended to limit the scope of the invention.
Example 1
As shown in fig. 1, the method for predicting a scene category of a conversation text in the present embodiment includes:
s101, acquiring different keywords;
different keywords are used for representing different scene categories, for example, the keywords include hotel noise, bed sheets, and the like.
S102, obtaining candidate sentences containing the keywords in the database according to each keyword;
all session records between the customer service personnel and the user are stored in a database of the customer service system.
S103, acquiring different historical conversation texts in which the candidate sentences are located;
s104, selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
specifically, candidate sentences and N sentences in the context of the candidate sentences are selected from historical conversation texts as target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
S105, performing word segmentation processing on the target sentence to obtain a word segmentation result;
s106, obtaining a word vector corresponding to each participle in each target sentence according to the word segmentation result;
s107, sequentially coding each word vector in the target sentence to obtain a sentence vector corresponding to the target sentence;
when coding is carried out according to the forward sequence, establishing semantic relation between each word vector in the sentence vector and all word vectors in the forward direction;
when coding is carried out according to a backward sequence, semantic relations are established between each word vector in the sentence vector and all backward word vectors;
s108, coding each sentence vector in the historical conversation text in sequence to obtain a conversation vector corresponding to the historical conversation text;
when coding is carried out according to the forward sequence, establishing semantic relation between each sentence vector in the conversation vector and all the sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relation between each sentence vector in the conversation vector and all backward sentence vectors;
as shown in fig. 2, taking an example that the selected conversation text includes two target sentences, a word vector of each participle in the target sentences and a sentence vector corresponding to each target sentence are sequentially obtained, and then a conversation vector corresponding to the conversation text is obtained.
S109, taking a session vector corresponding to the historical session text as input, taking a scene category corresponding to the historical session text as output, and establishing a probability model for predicting that the session text belongs to each scene category;
s1010, acquiring a target session text;
s1011, inputting the target session text into the probability model, and acquiring the probability value of the target session text belonging to each scene category;
and S1012, selecting the scene category corresponding to the maximum probability value as the target scene category corresponding to the target session text.
In the embodiment, candidate sentences in the database are obtained through keywords, so that corresponding conversation texts and context sentences are obtained, then the sentences selected from the conversation texts are subjected to word segmentation and converted into corresponding word vectors, sentence vectors containing semantic relations among all words and conversation vectors containing semantic relations among all sentences are obtained by using an LSTM algorithm, and then a probability model for predicting that the conversation texts belong to each scene category is established to determine the target scene category corresponding to any conversation text, so that the accuracy and recall rate of scene recognition of the existing conversation texts are improved, and meanwhile, the labor cost is reduced.
Example 2
As shown in fig. 3, the method for predicting the scene category of the conversation text in the present embodiment is a further improvement of embodiment 1, and specifically:
after step S104 and before step S105, the method further includes:
and preprocessing the target sentence.
Specifically, the preprocessing process mainly filters some contents with invalid classification in the target sentence, such as the sentences with filtering identities generated by staff and a system; filtering common system statements by regular expressions: such as "user left", "user back", etc.; replacing the special characters: such as "[ expression ]"; filtering pure numbers; filtering sentences which do not contain Chinese characters; filtering and summarizing part of chatty sentences, and filtering by calculating similarity through editing distance, such as 'hello'; in addition, the method also comprises standardization processing of the target sentence, such as conversion of full angles into half angles, conversion of traditional Chinese characters into simplified Chinese characters, interconversion between upper and lower cases and the like.
Step S105 includes:
s1051, carrying out word segmentation processing on the target sentence by adopting a HanLP word segmentation tool to obtain a word segmentation result.
In addition, in the word segmentation processing process, some professional vocabularies corresponding to scenes can be added to improve the word segmentation accuracy. For example: under the hotel scene of OTA (on-line travel) industry, the professional vocabularies corresponding to the scene, such as pre-authorization, credit hold, withholding, cash returning ticket, large bed room, account arrival, two-in-one hold, three-in-one hold, four-in-one hold, five-in-one hold, six-in-one hold, seven-in-one hold, eight-in-one hold, nine-in-one hold, ten-in-one hold, two-in-one hold, three-in-one hold, four-in-one hold, five-in-one hold, six-in-one hold, seven-in-one hold, eight-in-one hold, nine-in-one hold, ten-in-one hold, no room arrival, no room price rise, land-based price, apartment room, receiving and sending machine, are added during word segmentation processing.
Step S106 includes:
s1061, obtaining a Word Vector corresponding to each participle in each target sentence according to the participle result by adopting a Word2Vector model or a GloVe model; in addition, other models capable of corresponding word vectors to each segmented word in each target sentence can also be adopted.
Step S107 includes:
sequentially coding each word vector in the target sentence by adopting an LSTM algorithm to obtain a first intermediate vector corresponding to each word vector;
the first intermediate vectors corresponding to the word vectors ordered in the first position in the encoding direction are vectors obtained by processing the word vectors by using a hidden layer of an LSTM algorithm, and the first intermediate vectors corresponding to each word vector at other positions comprise the word vector at the current position and the first intermediate vector corresponding to the previous word vector;
and the first intermediate vector corresponding to the word vector at the last position in the encoding direction is used as the sentence vector corresponding to the target sentence, so that the sentence vector corresponding to each target sentence can represent the semantic relation between the word vectors, and the correct meaning of the target sentence can be more accurately identified.
Step S108 includes:
sequentially coding each sentence vector in the historical conversation text by adopting an LSTM algorithm to obtain a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by adopting an LSTM algorithm hidden layer, and the second intermediate vectors corresponding to each sentence vector at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
and taking a second intermediate vector corresponding to the sentence vector at the last position in the encoding direction as a session vector corresponding to the historical session text.
In addition, step S107 further includes:
sequentially and respectively coding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first sentence vectors;
fusing the two first sentence vectors to obtain a sentence vector;
the correctness of the sentence vector representation target sentence is further improved by fusing two vectors obtained by respectively coding the forward sequence and the backward sequence.
Step S108 further includes:
sequentially coding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first session vectors;
and fusing the two first session vectors to obtain a session vector.
The correctness of the historical conversation text represented by the conversation vector is further improved by fusing two vectors obtained by respectively coding the forward sequence and the backward sequence.
For example, if a target sentence included in the history conversation text is "how like the weather of today", the target sentence is subjected to word segmentation processing to obtain "today", "weather" and "how like", and then corresponding word vectors are obtained from the three word segments to obtain a vector sequence corresponding to the target sentence.
And sequentially coding the three word vectors according to a forward sequence by adopting an LSTM algorithm: processing the word vector corresponding to the current word vector by adopting an implicit layer of an LSTM algorithm to obtain a corresponding first intermediate vector, further obtaining a first intermediate vector corresponding to the weather, wherein the first intermediate vector corresponding to the weather comprises a first intermediate vector corresponding to the current word vector and a word vector corresponding to the weather, and the first intermediate vector corresponding to the what type comprises a first intermediate vector corresponding to the weather and a word vector corresponding to the what type.
And sequentially coding the three word vectors according to a backward sequence by adopting an LSTM algorithm: processing the word vector corresponding to the 'how' by adopting an implicit layer of an LSTM algorithm to obtain a corresponding first intermediate vector, further obtaining a first intermediate vector corresponding to weather, wherein the first intermediate vector corresponding to weather comprises the first intermediate vector corresponding to the 'how' and the word vector corresponding to weather, the first intermediate vector corresponding to today comprises the first intermediate vector corresponding to weather and the word vector corresponding to the 'today', and at the moment, taking the first intermediate vector corresponding to the 'today' as a first sentence vector corresponding to the target sentence.
And then fusing the two first sentence vectors, so that a sentence vector which can represent the target sentence and has higher accuracy can be obtained. Specifically, the process of fusing two vectors includes: if one vector is [101] and the other vector is [001], the fused result can be [101001], so that the sentence vector corresponding to the target sentence can be more accurately represented through the acquired rich information; or comparing the word vectors at the same position, and taking the intersection of the two vectors as the final fusion result.
The process for obtaining the conversation vectors corresponding to the target sentences in the same historical conversation text is similar to the above process, and therefore, the process is not repeated here.
After step S107 and before step S108, the method further includes:
acquiring a first weight corresponding to each word vector in a target sentence by adopting a Softmax algorithm;
and carrying out weighting processing on each word vector in the target sentence according to the first weight to obtain a sentence vector after weighting processing, thereby further improving the accuracy of the sentence vector for representing the target sentence.
After step S108 and before step S109, the method further includes:
acquiring a second weight corresponding to each sentence vector in the historical conversation text by adopting a Softmax algorithm;
and weighting each sentence vector in the historical conversation text according to the second weight to obtain a weighted conversation vector, so that the accuracy of representing the historical conversation text by the conversation vector is further improved.
Step S109 includes:
and adopting a Softmax algorithm to take the session vector corresponding to the historical session text as input, take the scene category corresponding to the historical session text as output, and establish a probability model for predicting that the session text belongs to each scene category.
In the embodiment, candidate sentences in the database are obtained through keywords, so that corresponding conversation texts and context sentences are obtained, then the sentences selected from the conversation texts are subjected to word segmentation and converted into corresponding word vectors, sentence vectors containing semantic relations among all words and conversation vectors containing semantic relations among all sentences are obtained by using an LSTM algorithm, and then a probability model for predicting that the conversation texts belong to each scene category is established to determine the target scene category corresponding to any conversation text, so that the accuracy and recall rate of scene recognition of the existing conversation texts are improved, and meanwhile, the labor cost is reduced.
Example 3
As shown in fig. 4, the prediction system for scene category of a conversation text in this embodiment includes a keyword obtaining module 1, a candidate sentence obtaining module 2, a history text obtaining module 3, a target sentence obtaining module 4, a word segmentation processing module 5, a word vector obtaining module 6, a sentence vector obtaining module 7, a conversation vector obtaining module 8, a model establishing module 9, a target text obtaining module 10, a probability value obtaining module 11, and a scene category determining module 12.
The keyword acquisition module 1 is used for acquiring different keywords;
different keywords are used for representing different scene categories, for example, the keywords include hotel noise, bed sheets, and the like. (ii) a
The candidate sentence acquisition module 2 is used for acquiring candidate sentences containing keywords in the database according to each keyword;
all session records between the customer service personnel and the user are stored in a database of the customer service system.
The historical text acquisition module 3 is used for acquiring different historical conversation texts in which the candidate sentences are located;
the target sentence acquisition module 4 is used for selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
specifically, candidate sentences and N sentences in the context of the candidate sentences are selected from historical conversation texts as target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
The word segmentation processing module 5 is used for carrying out word segmentation processing on the target sentence to obtain a word segmentation result;
the word vector acquisition module 6 is used for acquiring a word vector corresponding to each participle in each target sentence according to the word segmentation result;
the sentence vector acquisition module 7 is configured to sequentially encode each word vector in the target sentence, and acquire a sentence vector corresponding to the target sentence;
when coding is carried out according to the forward sequence, establishing semantic relation between each word vector in the sentence vector and all word vectors in the forward direction;
when coding is carried out according to a backward sequence, semantic relations are established between each word vector in the sentence vector and all backward word vectors;
the conversation vector acquisition module 8 is used for sequentially encoding each sentence vector in the historical conversation text to acquire a conversation vector corresponding to the historical conversation text;
when coding is carried out according to the forward sequence, semantic relations are established between each sentence vector in the conversation vectors and all sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relation between each sentence vector in the conversation vector and all backward sentence vectors;
as shown in fig. 3, taking the example that the selected conversation text includes two target sentences, word vectors of each participle in the target sentences and sentence vectors corresponding to each target sentence are sequentially obtained, and then conversation vectors corresponding to the conversation text are obtained.
The model establishing module 9 is configured to take a session vector corresponding to the historical session text as an input, take a scene category corresponding to the historical session text as an output, and establish a probability model for predicting that the session text belongs to each scene category;
the target text obtaining module 10 is configured to obtain a target session text;
the probability value obtaining module 11 is configured to input the target session text into the probability model, and obtain a probability value that the target session text belongs to each scene category;
the scene category determining module 12 is configured to select a scene category corresponding to the maximum probability value as the target session.
In the embodiment, candidate sentences in the database are obtained through keywords, so that corresponding session texts and context sentences are obtained, then the sentences selected from the session texts are subjected to word segmentation and converted into corresponding word vectors, then the LSTM algorithm is utilized to obtain sentence vectors containing semantic relations among all words and session vectors containing semantic relations among all sentences, and further a probability model for predicting that the session texts belong to each scene category is established to determine the target scene category corresponding to any session text, so that the accuracy and recall rate of scene recognition of the existing session texts are improved, and the labor cost is reduced.
Example 4
As shown in fig. 5, the method for predicting the scene category of the conversation text in the present embodiment is a further improvement of embodiment 3, and specifically:
the prediction system further comprises a pre-processing module 13;
the preprocessing module 13 is configured to preprocess the target sentence.
Specifically, the preprocessing process mainly filters some contents with invalid classification in the target sentence, such as the sentences with filtering identities generated by staff and a system; filtering common system statements by regular expressions: such as "user left", "user back", etc.; replacing the special characters: such as "[ expression ]"; filtering the pure numbers; filtering sentences which do not contain Chinese characters; filtering and summarizing part of chatty sentences, and filtering by calculating similarity through editing distance, such as 'hello'; in addition, the method also comprises standardization processing of the target sentence, such as conversion of full angles into half angles, conversion of traditional Chinese characters into simplified Chinese characters, interconversion between upper and lower cases and the like.
The word segmentation processing module 5 is configured to perform word segmentation processing on the target sentence by using a HanLP word segmentation tool, and obtain a word segmentation result.
In addition, in the process of word segmentation, some professional vocabularies corresponding to scenes can be added to improve the word segmentation accuracy. For example: in the hotel scene of OTA industry, professional vocabularies such as pre-authorization, credit, withholding, cash-back ticket, big bed room, account arrival, two-in-one, three-in-one, four-in-one, five-in-one, six-in-one, seven-in-one, eight-in-one, nine-in-one, ten-in-one, shop-in-no, room-expansion-free, land-occupied price, apartment, receiving and sending machine and the like corresponding to the scene are added during word segmentation processing.
The Word Vector acquisition module 6 is used for acquiring a Word Vector corresponding to each participle in each target sentence according to the participle result by adopting a Word2Vector model or a GloVe model; in addition, other models capable of corresponding word vectors to each segmented word in each target sentence can also be adopted.
Specifically, the sentence vector obtaining module 7 includes a first intermediate vector obtaining unit and a sentence vector obtaining unit;
the first intermediate vector acquisition unit is used for sequentially encoding each word vector in the target sentence by adopting an LSTM algorithm to acquire a first intermediate vector corresponding to each word vector;
the first intermediate vectors corresponding to the word vectors ordered at the first position in the encoding direction are vectors obtained by processing the word vectors by using an LSTM algorithm hidden layer, and the first intermediate vectors corresponding to each word vector at other positions comprise the word vector at the current position and the first intermediate vector corresponding to the previous word vector;
the sentence vector acquisition unit is used for taking the first intermediate vector corresponding to the last word vector in the encoding direction as the sentence vector corresponding to the target sentence, so that the sentence vector corresponding to each target sentence can represent the semantic relation among the word vectors, and the correct meaning of the target sentence can be more accurately identified.
The session vector acquisition module 8 comprises a second intermediate vector acquisition unit and a session vector acquisition unit;
the second intermediate vector acquisition unit is used for sequentially encoding each sentence vector in the historical conversation text by adopting an LSTM algorithm to acquire a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by adopting an LSTM algorithm hidden layer, and the second intermediate vectors corresponding to each sentence vector at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
the conversation vector acquisition unit is used for taking a second intermediate vector corresponding to the last sentence vector in the encoding direction as a conversation vector corresponding to the historical conversation text.
In addition, the sentence vector obtaining module 7 is configured to sequentially encode each word vector in the target sentence according to a forward sequence and a backward sequence by using an LSTM algorithm, obtain two first sentence vectors, and perform fusion processing on the two first sentence vectors to obtain a sentence vector.
The correctness of the sentence vector representing the target sentence is further improved by fusing two vectors obtained by respectively coding the forward sequence and the backward sequence.
The conversation vector obtaining module 8 is configured to sequentially encode each word vector in the target sentence according to a forward sequence and a backward sequence by using an LSTM algorithm, obtain two first conversation vectors, and perform fusion processing on the two first conversation vectors to obtain a conversation vector.
The correctness of the historical conversation text represented by the conversation vector is further improved by fusing two vectors obtained by respectively coding the forward sequence and the backward sequence.
For example, if the target sentence included in the historical conversation text is "how to look like the weather today", the target sentence is subjected to word segmentation processing to obtain "today", "weather" and "how look", and then the corresponding word vectors are obtained from the three word segments to obtain the vector sequence corresponding to the target sentence.
And sequentially coding the three word vectors according to a forward sequence by adopting an LSTM algorithm: processing the word vectors corresponding to the 'today' by adopting an LSTM algorithm hidden layer to obtain corresponding first intermediate vectors, further obtaining that the first intermediate vectors corresponding to the 'weather' comprise the first intermediate vectors corresponding to the 'today' and the word vectors corresponding to the 'weather', and the first intermediate vectors corresponding to the 'what' comprise the first intermediate vectors corresponding to the 'weather' and the word vectors corresponding to the 'what' at the moment, taking the first intermediate vectors corresponding to the 'what' as a first sentence vector corresponding to the target sentence, wherein the first intermediate vectors are used for establishing the semantics from the first word vector to the current word vector.
And sequentially coding the three word vectors according to a backward sequence by adopting an LSTM algorithm: processing the word vector corresponding to the 'how' by adopting an implicit layer of an LSTM algorithm to obtain a corresponding first intermediate vector, further obtaining a first intermediate vector corresponding to weather, wherein the first intermediate vector corresponding to weather comprises the first intermediate vector corresponding to the 'how' and the word vector corresponding to weather, the first intermediate vector corresponding to today comprises the first intermediate vector corresponding to weather and the word vector corresponding to the 'today', and at the moment, taking the first intermediate vector corresponding to the 'today' as a first sentence vector corresponding to the target sentence.
And then the two first sentence vectors are fused, so that a sentence vector with higher accuracy capable of representing the target sentence can be obtained. Specifically, the process of fusing two vectors includes: if one vector is [101] and the other vector is [001], the fused result can be [101001], and the sentence vector corresponding to the target sentence is more accurately characterized through the acquired rich information; or comparing the word vectors at the same position, and taking the intersection of the two vectors as the final fusion result.
The process for obtaining the conversation vectors corresponding to the target sentences in the same historical conversation text is similar to the above process, and therefore, the process is not repeated here.
The prediction system also comprises a weight acquisition module and a weighting processing module;
the weight acquisition module is used for acquiring a first weight corresponding to each word vector in the target sentence by adopting a Softmax algorithm;
the weighting processing module is used for weighting each word vector in the target sentence according to the first weight to obtain a sentence vector after weighting processing, so that the accuracy of representing the target sentence by the sentence vector is further improved.
The weight obtaining module is further used for obtaining a second weight corresponding to each sentence vector in the historical conversation text by adopting a Softmax algorithm;
the weighting processing module is also used for weighting each sentence vector in the historical conversation text according to the second weight to obtain a weighted conversation vector, so that the accuracy of the conversation vector representing the historical conversation text is further improved.
The model establishing module 9 is configured to use a Softmax algorithm to take a session vector corresponding to the historical session text as an input, take a scene category corresponding to the historical session text as an output, and establish a probability model for predicting that the session text belongs to each scene category.
In the embodiment, candidate sentences in the database are obtained through keywords, so that corresponding conversation texts and context sentences are obtained, then the sentences selected from the conversation texts are subjected to word segmentation and converted into corresponding word vectors, sentence vectors containing semantic relations among all words and conversation vectors containing semantic relations among all sentences are obtained by using an LSTM algorithm, and then a probability model for predicting that the conversation texts belong to each scene category is established to determine the target scene category corresponding to any conversation text, so that the accuracy and recall rate of scene recognition of the existing conversation texts are improved, and meanwhile, the labor cost is reduced.
Example 5
Fig. 6 is a schematic structural diagram of an electronic device according to embodiment 5 of the present invention. The electronic device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to implement the method for predicting the scene type of the conversation text in any one of the embodiments 1 or 2. The electronic device 30 shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 6, the electronic device 30 may be embodied in the form of a general purpose computing device, which may be, for example, a server device. The components of the electronic device 30 may include, but are not limited to: the at least one processor 31, the at least one memory 32, and a bus 33 connecting the various system components (including the memory 32 and the processor 31).
The bus 33 includes a data bus, an address bus, and a control bus.
The memory 32 may include volatile memory, such as Random Access Memory (RAM) 321 and/or cache memory 322, and may further include Read Only Memory (ROM) 323.
The processor 31 executes various functional applications and data processing, such as a prediction method of a scene category of a conversation text in any one of the embodiments 1 or 2 of the present invention, by running a computer program stored in the memory 32.
The electronic device 30 may also communicate with one or more external devices 34 (e.g., a keyboard, a pointing device, etc.). Such communication may be through an input/output (I/O) interface 35. Also, model-generating device 30 may also communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via network adapter 36. As shown in FIG. 6, network adapter 36 communicates with the other modules of model-generating device 30 via bus 33. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the model-generating device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, to name a few.
It should be noted that although in the above detailed description several units/modules or sub-units/modules of the electronic device are mentioned, such a division is merely exemplary and not mandatory. Indeed, the features and functionality of two or more of the units/modules described above may be embodied in one unit/module according to embodiments of the invention. Conversely, the features and functions of one unit/module described above may be further divided into embodiments by a plurality of units/modules.
Example 12
The present embodiment provides a computer-readable storage medium on which a computer program is stored, which when executed by a processor, implements the steps in the prediction method of the scene category of the conversation text in any one of embodiments 1 or 2.
More specific examples, among others, that the readable storage medium may employ may include, but are not limited to: a portable disk, a hard disk, random access memory, read only memory, erasable programmable read only memory, optical storage device, magnetic storage device, or any suitable combination of the foregoing.
In a possible implementation, the present invention can also be implemented in the form of a program product, which includes program code for causing a terminal device to perform the steps of the prediction method for scene classification of conversation text in any one of embodiments 1 or 2 when the program product is run on the terminal device.
Where program code for carrying out the invention is written in any combination of one or more programming languages, the program code may execute entirely on the user device, partly on the user device, as a stand-alone software package, partly on the user device and partly on a remote device or entirely on the remote device.
While specific embodiments of the invention have been described above, it will be understood by those skilled in the art that this is by way of example only, and that the scope of the invention is defined by the appended claims. Various changes and modifications to these embodiments may be made by those skilled in the art without departing from the spirit and scope of the invention, and these changes and modifications are within the scope of the invention.
Claims (14)
1. A prediction method for a scene category of a conversation text, the prediction method comprising:
acquiring different keywords;
wherein different keywords are used for representing different scene categories;
acquiring candidate sentences containing the keywords in a database according to each keyword;
acquiring different historical conversation texts in which the candidate sentences are located;
selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
performing word segmentation processing on the target sentence to obtain a word segmentation result;
obtaining a word vector corresponding to each word in each target sentence according to the word segmentation result;
sequentially coding each word vector in the target sentence to obtain a sentence vector corresponding to the target sentence;
when coding is carried out according to a forward sequence, establishing semantic relation between each word vector in the sentence vectors and all forward word vectors;
when coding is carried out according to a backward sequence, establishing semantic relation between each word vector in the sentence vector and all backward word vectors;
coding each sentence vector in the historical conversation text in sequence to obtain a conversation vector corresponding to the historical conversation text;
when coding is carried out according to a forward sequence, semantic relations are established between each sentence vector in the conversation vectors and all sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relations between each sentence vector in the conversation vectors and all backward sentence vectors;
taking the session vector corresponding to the historical session text as input, taking the scene category corresponding to the historical session text as output, and establishing a probability model for predicting that the session text belongs to each scene category;
acquiring a target session text;
inputting the target session text into the probability model, and acquiring the probability value of the target session text belonging to each scene category;
and selecting the scene category corresponding to the maximum probability value as the target scene category corresponding to the target session text.
2. The method for predicting the scene category of the conversational text according to claim 1, wherein the step of performing the word segmentation on the target sentence and obtaining the word segmentation result comprises:
performing word segmentation processing on the target sentence by adopting a HanLP word segmentation tool to obtain a word segmentation result;
the step of obtaining a word vector corresponding to each word segmentation in each target sentence according to the word segmentation result comprises the following steps:
and acquiring a Word Vector corresponding to each participle in each target sentence according to the Word segmentation result by adopting a Word2Vector model or a GloVe model.
3. The method for predicting the scene category of the conversational text as recited in claim 1, wherein the step of sequentially encoding each word vector in the target sentence to obtain the sentence vector corresponding to the target sentence comprises:
sequentially coding each word vector in the target sentence by adopting an LSTM algorithm to obtain a first intermediate vector corresponding to each word vector;
the first intermediate vectors corresponding to the word vectors ordered at the head in the encoding direction are vectors obtained by processing the word vectors by using a hidden layer of an LSTM algorithm, and the first intermediate vectors corresponding to each of the word vectors at other positions comprise the word vector at the current position and a first intermediate vector corresponding to a previous word vector;
taking the first intermediate vector corresponding to the word vector at the last position in the encoding direction as the sentence vector corresponding to the target sentence;
the step of sequentially encoding each sentence vector in the historical conversation text to obtain the conversation vector corresponding to the historical conversation text comprises the following steps:
sequentially coding each sentence vector in the historical conversation text by adopting an LSTM algorithm to obtain a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by using an implicit layer of an LSTM algorithm, and the second intermediate vectors corresponding to each sentence vector at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
and taking the second intermediate vector corresponding to the sentence vector at the last bit in the encoding direction as the session vector corresponding to the historical session text.
4. The method for predicting the scene category of the conversational text as recited in claim 1, wherein the step of sequentially encoding each word vector in the target sentence to obtain the sentence vector corresponding to the target sentence comprises:
sequentially coding each word vector in the target sentence according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first sentence vectors;
fusing the two first sentence vectors to obtain the sentence vector;
the step of sequentially encoding each sentence vector in the historical conversation text to obtain the conversation vector corresponding to the historical conversation text comprises:
sequentially coding each sentence vector in the historical conversation text according to a forward sequence and a backward sequence by adopting an LSTM algorithm to obtain two first conversation vectors;
and fusing the two first session vectors to obtain the session vector.
5. The method for predicting the scene category of the conversational text as recited in claim 1, wherein the step of sequentially encoding each word vector in the target sentence and obtaining the sentence vector corresponding to the target sentence further comprises:
acquiring a first weight corresponding to each word vector in the target sentence by adopting a Softmax algorithm;
weighting each word vector in the target sentence according to the first weight to obtain a weighted sentence vector;
the step of sequentially encoding each sentence vector in the historical conversation text to obtain the conversation vector corresponding to the historical conversation text further comprises:
acquiring a second weight corresponding to each sentence vector in the historical conversation text by adopting a Softmax algorithm;
and weighting each sentence vector in the historical conversation text according to the second weight to obtain the weighted conversation vector.
6. The method for predicting the scene category of the conversational text according to claim 1, wherein the step of establishing a probability model for predicting the conversational text belonging to each scene category includes, with the conversational vector corresponding to the historical conversational text as an input and the scene category corresponding to the historical conversational text as an output:
adopting a Softmax algorithm to take the session vector corresponding to the historical session text as input, take the scene category corresponding to the historical session text as output, and establish a probability model for predicting that the session text belongs to each scene category; and/or the presence of a gas in the gas,
after the step of selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences, the step of performing word segmentation on the target sentences further comprises the following steps of:
preprocessing the target sentence; and/or the presence of a gas in the gas,
the step of selecting a set number of sentences from the historical conversational text as target sentences according to the candidate sentences comprises:
selecting the candidate sentences and N sentences in the context of the candidate sentences from the historical conversation text as the target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
7. The prediction system for the scene category of the conversation text is characterized by comprising a keyword acquisition module, a candidate sentence acquisition module, a history text acquisition module, a target sentence acquisition module, a word segmentation processing module, a word vector acquisition module, a sentence vector acquisition module, a conversation vector acquisition module, a model establishment module, a target text acquisition module, a probability value acquisition module and a scene category determination module;
the keyword acquisition module is used for acquiring different keywords;
wherein different keywords are used for representing different scene categories;
the candidate sentence acquisition module is used for acquiring candidate sentences containing the keywords in a database according to each keyword;
the historical text acquisition module is used for acquiring different historical conversation texts where the candidate sentences are located;
the target sentence acquisition module is used for selecting a set number of sentences from the historical conversation text as target sentences according to the candidate sentences;
the word segmentation processing module is used for carrying out word segmentation processing on the target sentence to obtain a word segmentation result;
the word vector acquisition module is used for acquiring a word vector corresponding to each word segmentation in each target sentence according to the word segmentation result;
the sentence vector acquisition module is used for sequentially encoding each word vector in the target sentence to acquire a sentence vector corresponding to the target sentence;
when coding is carried out according to a forward sequence, establishing semantic relation between each word vector in the sentence vectors and all forward word vectors;
when coding is carried out according to a backward sequence, establishing semantic relation between each word vector in the sentence vector and all backward word vectors;
the session vector acquisition module is used for sequentially encoding each sentence vector in the historical session text to acquire a session vector corresponding to the historical session text;
when coding is carried out according to a forward sequence, semantic relations are established between each sentence vector in the conversation vectors and all sentence vectors in the forward direction;
when coding is carried out according to a backward sequence, establishing semantic relations between each sentence vector in the conversation vectors and all backward sentence vectors;
the model establishing module is used for taking the session vector corresponding to the historical session text as input, taking the scene category corresponding to the historical session text as output, and establishing a probability model for predicting that the session text belongs to each scene category;
the target text acquisition module is used for acquiring a target session text;
the probability value acquisition module is used for inputting the target session text into the probability model and acquiring the probability value of the target session text belonging to each scene category;
the scene category determining module is used for selecting a scene category corresponding to the maximum probability value as a target scene category corresponding to the target session text.
8. The system for predicting scene categories of conversational texts of claim 7, wherein the word segmentation processing module is configured to perform word segmentation processing on the target sentence by using a HanLP word segmentation tool to obtain a word segmentation result;
the Word Vector obtaining module is used for obtaining a Word Vector corresponding to each participle in each target sentence according to the Word segmentation result by adopting a Word2Vector model or a GloVe model.
9. The system for predicting scene categories of conversation text according to claim 7, wherein said sentence vector acquisition module includes a first intermediate vector acquisition unit and a sentence vector acquisition unit;
the first intermediate vector acquisition unit is used for sequentially encoding each word vector in the target sentence by adopting an LSTM algorithm to acquire a first intermediate vector corresponding to each word vector;
the first intermediate vector corresponding to the word vector ordered at the head in the encoding direction is a vector obtained by processing the word vector by using an implicit layer of an LSTM algorithm, and the first intermediate vectors corresponding to each word vector at other positions comprise the word vector at the current position and the first intermediate vector corresponding to the previous word vector;
the sentence vector acquisition unit is used for taking the first intermediate vector corresponding to the word vector at the end in the encoding direction as the sentence vector corresponding to the target sentence;
the session vector acquisition module comprises a second intermediate vector acquisition unit and a session vector acquisition unit;
the second intermediate vector obtaining unit is used for sequentially coding each sentence vector in the historical conversation text by adopting an LSTM algorithm to obtain a second intermediate vector corresponding to each sentence vector;
the second intermediate vectors corresponding to the sentence vectors ordered at the first position in the encoding direction are vectors obtained by processing the sentence vectors by using an implicit layer of an LSTM algorithm, and the second intermediate vectors corresponding to each sentence vector at other positions comprise the sentence vector at the current position and the second intermediate vector corresponding to the previous sentence vector;
the conversation vector obtaining unit is configured to use the second intermediate vector corresponding to the sentence vector at the last position in the encoding direction as the conversation vector corresponding to the historical conversation text.
10. The system for predicting scene types of conversational text as recited in claim 7, wherein the sentence vector obtaining module is configured to sequentially encode each of the word vectors in the target sentence according to a forward order and a backward order by using an LSTM algorithm to obtain two first sentence vectors, and perform a fusion process on the two first sentence vectors to obtain the sentence vectors;
the session vector acquisition module is used for sequentially coding each sentence vector in the historical session text according to a forward sequence and a backward sequence by adopting an LSTM algorithm to acquire two first session vectors and fusing the two first session vectors to acquire the session vectors.
11. The system for predicting scene categories of conversational text as claimed in claim 7, wherein the prediction system further comprises a weight obtaining module and a weighting processing module;
the weight obtaining module is used for obtaining a first weight corresponding to each word vector in the target sentence by adopting a Softmax algorithm;
the weighting processing module is used for weighting each word vector in the target sentence according to the first weight to obtain the sentence vector after weighting processing;
the weight obtaining module is further configured to obtain a second weight corresponding to each sentence vector in the historical conversation text by using a Softmax algorithm;
the weighting processing module is further configured to perform weighting processing on each sentence vector in the historical conversation text according to the second weight, so as to obtain the conversation vector after weighting processing.
12. The system for predicting scene categories of conversational text as claimed in claim 7, wherein the model building module is configured to use a Softmax algorithm to build a probability model for predicting that the conversational text belongs to each scene category, taking the conversational vector corresponding to the historical conversational text as an input, and taking the scene category corresponding to the historical conversational text as an output; and/or the presence of a gas in the gas,
the prediction system further comprises a pre-processing module;
the preprocessing module is used for preprocessing the target sentence; and/or the presence of a gas in the gas,
the target sentence acquisition module is used for selecting the candidate sentences and N sentences in the context of the candidate sentences from the historical conversation text as the target sentences; wherein N is more than or equal to 1, and the value of N is an integer.
13. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for predicting the scene type of the dialog text according to any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of a prediction method for a scene category of a dialog text according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695856.8A CN110413788B (en) | 2019-07-30 | 2019-07-30 | Method, system, device and storage medium for predicting scene category of conversation text |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910695856.8A CN110413788B (en) | 2019-07-30 | 2019-07-30 | Method, system, device and storage medium for predicting scene category of conversation text |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110413788A CN110413788A (en) | 2019-11-05 |
CN110413788B true CN110413788B (en) | 2023-01-31 |
Family
ID=68364347
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910695856.8A Active CN110413788B (en) | 2019-07-30 | 2019-07-30 | Method, system, device and storage medium for predicting scene category of conversation text |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110413788B (en) |
Families Citing this family (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111061815B (en) * | 2019-12-13 | 2023-04-25 | 携程计算机技术(上海)有限公司 | Session data classification method |
CN111241817A (en) * | 2020-01-20 | 2020-06-05 | 首都医科大学 | Text-based depression identification method |
CN111445545B (en) * | 2020-02-27 | 2023-08-18 | 北京大米未来科技有限公司 | Text transfer mapping method and device, storage medium and electronic equipment |
CN111651571B (en) * | 2020-05-19 | 2023-10-17 | 腾讯科技(深圳)有限公司 | Conversation realization method, device, equipment and storage medium based on man-machine cooperation |
CN111708884A (en) * | 2020-06-02 | 2020-09-25 | 上海硬通网络科技有限公司 | Text classification method and device and electronic equipment |
CN111666400B (en) * | 2020-07-10 | 2023-10-13 | 腾讯科技(深圳)有限公司 | Message acquisition method, device, computer equipment and storage medium |
CN111798870A (en) * | 2020-09-08 | 2020-10-20 | 共道网络科技有限公司 | Session link determining method, device and equipment and storage medium |
CN112101042B (en) * | 2020-09-14 | 2024-09-17 | 平安科技(深圳)有限公司 | Text emotion recognition method, device, terminal equipment and storage medium |
CN112598139B (en) * | 2020-12-22 | 2023-08-18 | 百度在线网络技术(北京)有限公司 | Category encoding method, category encoding device, category encoding apparatus, category encoding device, category encoding storage medium, and category encoding program product |
CN112989040B (en) * | 2021-03-10 | 2024-02-27 | 河南中原消费金融股份有限公司 | Dialogue text labeling method and device, electronic equipment and storage medium |
CN112989822B (en) * | 2021-04-16 | 2021-08-27 | 北京世纪好未来教育科技有限公司 | Method, device, electronic equipment and storage medium for recognizing sentence categories in conversation |
CN113326373B (en) * | 2021-05-19 | 2022-08-05 | 武汉大学 | WeChat group chat record identification method and system fusing session scene information |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2967976A1 (en) * | 2014-12-04 | 2016-06-09 | Microsoft Technology Licensing, Llc | Emotion type classification for interactive dialog system |
CN106649404A (en) * | 2015-11-04 | 2017-05-10 | 陈包容 | Session scene database creation method and apparatus |
CN107273487A (en) * | 2017-06-13 | 2017-10-20 | 北京百度网讯科技有限公司 | Generation method, device and the computer equipment of chat data based on artificial intelligence |
CN108075962A (en) * | 2016-11-16 | 2018-05-25 | 阿里巴巴集团控股有限公司 | The scene recognition method of instant messaging dialogue, apparatus and system |
CN108897723A (en) * | 2018-06-29 | 2018-11-27 | 北京百度网讯科技有限公司 | The recognition methods of scene dialog text, device and terminal |
CN108959482A (en) * | 2018-06-21 | 2018-12-07 | 北京慧闻科技发展有限公司 | Single-wheel dialogue data classification method, device and electronic equipment based on deep learning |
CN109101537A (en) * | 2018-06-27 | 2018-12-28 | 北京慧闻科技发展有限公司 | More wheel dialogue data classification methods, device and electronic equipment based on deep learning |
WO2019028261A1 (en) * | 2017-08-02 | 2019-02-07 | [24]7.ai, Inc. | Method and apparatus for training of conversational agents |
CN109543030A (en) * | 2018-10-12 | 2019-03-29 | 平安科技(深圳)有限公司 | Customer service machine conference file classification method and device, equipment, storage medium |
CN109783623A (en) * | 2018-12-25 | 2019-05-21 | 华东师范大学 | The data analysing method of user and customer service dialogue under a kind of real scene |
CN109857848A (en) * | 2019-01-18 | 2019-06-07 | 深圳壹账通智能科技有限公司 | Interaction content generation method, device, computer equipment and storage medium |
CN109918673A (en) * | 2019-03-14 | 2019-06-21 | 湖北亿咖通科技有限公司 | Semantic referee method, device, electronic equipment and computer readable storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180329884A1 (en) * | 2017-05-12 | 2018-11-15 | Rsvp Technologies Inc. | Neural contextual conversation learning |
-
2019
- 2019-07-30 CN CN201910695856.8A patent/CN110413788B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2967976A1 (en) * | 2014-12-04 | 2016-06-09 | Microsoft Technology Licensing, Llc | Emotion type classification for interactive dialog system |
CN106649404A (en) * | 2015-11-04 | 2017-05-10 | 陈包容 | Session scene database creation method and apparatus |
CN108075962A (en) * | 2016-11-16 | 2018-05-25 | 阿里巴巴集团控股有限公司 | The scene recognition method of instant messaging dialogue, apparatus and system |
CN107273487A (en) * | 2017-06-13 | 2017-10-20 | 北京百度网讯科技有限公司 | Generation method, device and the computer equipment of chat data based on artificial intelligence |
WO2019028261A1 (en) * | 2017-08-02 | 2019-02-07 | [24]7.ai, Inc. | Method and apparatus for training of conversational agents |
CN108959482A (en) * | 2018-06-21 | 2018-12-07 | 北京慧闻科技发展有限公司 | Single-wheel dialogue data classification method, device and electronic equipment based on deep learning |
CN109101537A (en) * | 2018-06-27 | 2018-12-28 | 北京慧闻科技发展有限公司 | More wheel dialogue data classification methods, device and electronic equipment based on deep learning |
CN108897723A (en) * | 2018-06-29 | 2018-11-27 | 北京百度网讯科技有限公司 | The recognition methods of scene dialog text, device and terminal |
CN109543030A (en) * | 2018-10-12 | 2019-03-29 | 平安科技(深圳)有限公司 | Customer service machine conference file classification method and device, equipment, storage medium |
CN109783623A (en) * | 2018-12-25 | 2019-05-21 | 华东师范大学 | The data analysing method of user and customer service dialogue under a kind of real scene |
CN109857848A (en) * | 2019-01-18 | 2019-06-07 | 深圳壹账通智能科技有限公司 | Interaction content generation method, device, computer equipment and storage medium |
CN109918673A (en) * | 2019-03-14 | 2019-06-21 | 湖北亿咖通科技有限公司 | Semantic referee method, device, electronic equipment and computer readable storage medium |
Non-Patent Citations (2)
Title |
---|
Beyond bag of latent topics: spatial pyramid matching for scene category recognition;Fu-xiang Lu 等;《Frontiers of Information Technology & Electronic Engineering》;20151015;第16卷(第10期);817-828 * |
文本中场景识别的研究与分析;董润芝;《中国优秀硕士学位论文全文数据库 (信息科技辑)》;20110715;I138-763 * |
Also Published As
Publication number | Publication date |
---|---|
CN110413788A (en) | 2019-11-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110413788B (en) | Method, system, device and storage medium for predicting scene category of conversation text | |
CN109145294B (en) | Text entity identification method and device, electronic equipment and storage medium | |
US20210342658A1 (en) | Polysemant meaning learning and search result display | |
CN109614625B (en) | Method, device and equipment for determining title text relevancy and storage medium | |
CN106991085B (en) | Entity abbreviation generation method and device | |
CN111125317A (en) | Model training, classification, system, device and medium for conversational text classification | |
CN112270379A (en) | Training method of classification model, sample classification method, device and equipment | |
EP4064277B1 (en) | Method and apparatus for training speech recognition model, device and storage medium | |
CN110633366B (en) | Short text classification method, device and storage medium | |
CN110765277B (en) | Knowledge-graph-based mobile terminal online equipment fault diagnosis method | |
CN111177186B (en) | Single sentence intention recognition method, device and system based on question retrieval | |
CN110377744B (en) | Public opinion classification method and device, storage medium and electronic equipment | |
CN110599200B (en) | Detection method, system, medium and device for false address of OTA hotel | |
CN112541600A (en) | Knowledge graph-based auxiliary maintenance decision method | |
CN111191000A (en) | Dialog management method, device and system of intelligent voice robot | |
CN111144118B (en) | Method, system, equipment and medium for identifying named entities in spoken text | |
CN113553412A (en) | Question and answer processing method and device, electronic equipment and storage medium | |
CN110032645A (en) | Text emotion recognition methods, system, equipment and medium | |
CN113408287A (en) | Entity identification method and device, electronic equipment and storage medium | |
CN111241153A (en) | Enterprise natural person entity comprehensive judgment alignment method and system | |
CN117807482A (en) | Method, device, equipment and storage medium for classifying customs clearance notes | |
CN110851605A (en) | Detection method and system for image-text information matching of OTA hotel and electronic equipment | |
CN112749530B (en) | Text encoding method, apparatus, device and computer readable storage medium | |
CN117668199A (en) | Intelligent customer service question-answer prediction and recommendation dialogue generation method and device | |
CN112100360A (en) | Dialog response method, device and system based on vector retrieval |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |