Method, device and electronic device for generating bullet comment reply

By acquiring and preprocessing the above barrage information and using neural network to generate the following barrage information, the problem of insufficient quality of reply information in the prior art is solved, the interactiveness and semantic logic are improved, and the higher quality barrage reply is achieved. generate.

CN113591462BActive Publication Date: 2024-12-13MIGU DIGITAL MEDIA CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110855573.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-28
Publication Date
2024-12-13
Estimated Expiration
2041-07-28

AI Technical Summary

Technical Problem

The barrage reply information generated in the prior art is of poor quality, the extracted method is insufficiently interactive, and there are shortcomings in understanding the generative method in terms of semantic logic.

Method used

By obtaining the above text of the barrage information, preprocessing is performed to convert it into an initial text vector, determining the topic semantic relationship distribution and syntactic dependency vector, calculating the input vector, inputting the target neural network to generate the following text of the barrage information, using the attention mechanism and feedforward network and subject word prediction models improve generation quality.

Benefits of technology

The logical structure accuracy and theme characteristics of the following barrage information are improved, the generation quality is improved, and the problem of insufficient quality of reply information in the prior art is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113591462B_ABST
    Figure CN113591462B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention relate to the field of artificial intelligence technology, and disclose a method, device and electronic device for generating barrage replies. The method includes: obtaining the context of barrage information; preprocessing the context of barrage information and converting it into an initial text vector; determining the subject semantic relationship distribution of the initial text vector; determining the syntactic dependency vector and position relationship vector between the words in the context of barrage information according to the initial text vector; performing weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain the input vector of each word; inputting the input vector and the subject semantic relationship distribution into the target neural network model for prediction, so as to generate the context of barrage information for replying to the context of barrage information. In the above manner, the embodiments of the present invention improve the quality of barrage replies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of artificial intelligence technology, and specifically to a method, device and electronic device for generating barrage replies. Background Art

[0002] Bullet comments are text clips that are displayed synchronously with the video and are used for interaction between users and the video or between users. Users can participate in the video communication and interaction by posting bullet comments related to the video context.

[0003] Generating barrage reply information based on the barrage information posted by users can effectively enhance the user's sense of participation and immersion. In the related art, the generation of barrage reply information is mainly based on the extraction method and the understanding generation method. However, in the process of implementing the embodiments of the present invention, the inventors found that the quality of the barrage reply information generated in the related art is poor. For example, the barrage reply information generated by the extraction method has poor interactivity, and the barrage reply information generated by the understanding generation method has defects in semantic logic. Summary of the invention

[0004] In view of the above problems, an embodiment of the present invention provides a method, device and electronic device for generating a barrage reply, which are used to solve the problem of poor quality of barrage reply information existing in the prior art.

[0005] According to one aspect of an embodiment of the present invention, a method for generating a bullet comment reply is provided, the method comprising:

[0006] Get the above barrage information;

[0007] Preprocess the above text of the bullet message information and convert it into an initial text vector;

[0008] Determining the topic semantic relationship distribution of the initial text vector;

[0009] Determine, according to the initial text vector, a syntactic dependency vector and a position relationship vector between the words in the above text of the bullet message;

[0010] Performing weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain an input vector of each word;

[0011] The input vector and the topic semantic relationship distribution are input into the target neural network for prediction to generate the following barrage information for replying to the previous barrage information.

[0012] In an optional manner, determining the syntactic dependency vector and the position relationship vector between the words in the above text of the barrage information according to the initial text vector includes:

[0013] Determine the location of a current word, where the current word is any word vector in the initial text vector;

[0014] Traverse the dependent word positions corresponding to the current word, and end the traversal when the traversal reaches the core word position, and the dependent word is the dependent word of the current word;

[0015] Calculate the absolute value of the difference between the position of the current word and the position of the dependent word;

[0016] The absolute values ​​of the differences are accumulated to calculate the core weight of the current word to obtain the syntactic dependency vector.

[0017] In an optional manner, the target neural network includes an attention mechanism, a feedforward network, and a topic word prediction model; the input vector and the topic semantic relationship distribution are input into the target neural network for prediction to generate a barrage message for replying to the above barrage message, which includes:

[0018] Determine the topic of the initial text vector and the word distribution corresponding to the topic according to the topic semantic relationship distribution;

[0019] According to the topic and the word distribution corresponding to the topic, the input vector is subjected to attention mechanism calculation to obtain a word relationship vector;

[0020] After residual connection and normalization of the inter-word relationship vector, the vector is input into the feedforward network to obtain the topic semantic vector of each word in the input vector;

[0021] Performing residual connection on the topic semantic vector and the inter-word relationship vector to obtain a bullet comment information sequence vector;

[0022] The barrage information sequence vector is input into the keyword prediction model to generate a barrage information context for replying to the barrage information context.

[0023] In an optional manner, the barrage information sequence vector includes the topic of the barrage information context, the word distribution under the topic, the topic probability and the semantic information; the step of inputting the barrage information sequence vector into the topic word prediction model to generate the barrage information context for replying to the barrage information context includes:

[0024] Determine a previous prediction result, wherein the previous prediction result is a prediction word predicted before the current prediction word;

[0025] Taking the last prediction result and the bullet message sequence vector as input, and obtaining the current prediction word probability according to the preset vocabulary model and the topic semantic relationship distribution;

[0026] The topic probability and the current predicted word probability are weighted and calculated to obtain the corresponding predicted words under each topic;

[0027] According to the corresponding predicted words under each of the topics, a barrage message context is generated to reply to the barrage message context.

[0028] In an optional manner, the method further includes:

[0029] Calculate the quality value of the context of the barrage information according to a preset quality value formula, where the quality value is used to characterize the logical matching quality, content diversity quality, and theme quality of the context of the barrage information;

[0030] If the quality value of the context of the bullet screen information is greater than a preset quality value threshold, the context of the bullet screen information is output.

[0031] In an optional manner, calculating the quality value of the content of the bullet comment information according to a preset quality value formula includes:

[0032] Respectively determine the logical matching quality value, content diversity quality value and theme quality value of the context of the barrage information;

[0033] The product of the logical collocation quality value and the content diversity quality value is calculated, and the sum of the product and the topic quality value is determined as the quality value.

[0034] In an optional manner, the method further includes:

[0035] Inputting training samples into the target neural network for training to obtain output results; the training samples are labeled bullet screen dialogue contexts; the labels include the subject of the bullet screen dialogue contexts and the corresponding bullet screen dialogue contexts;

[0036] Calculate the loss value of the target neural network according to the output result, the context of the bullet screen dialogue and a preset loss function;

[0037] The parameters of the target neural network are adjusted according to the loss value, and the step of inputting the training sample into the target neural network for training is re-executed to obtain an output result, the loss value of the target neural network is calculated according to the output result, the context of the barrage dialogue and a preset loss function, and the parameters of the target neural network are adjusted according to the loss value, until the preset loss function converges or is less than a preset threshold;

[0038] The preset loss function is composed of the cosine similarity distance between the word prediction likelihood function and the context semantic vector.

[0039] According to another aspect of an embodiment of the present invention, a device for generating a bullet comment reply is provided, the device comprising:

[0040] The acquisition module is used to obtain the content of the bullet message;

[0041] A conversion module, used to pre-process the above text of the bullet message information and convert it into an initial text vector;

[0042] A first determination module, used to determine the topic semantic relationship distribution of the initial text vector;

[0043] A second determination module is used to determine the syntactic dependency vector and the position relationship vector between the words in the above text of the barrage information according to the initial text vector;

[0044] A calculation module, used for performing weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain an input vector of each word;

[0045] The prediction module is used to input the input vector and the topic semantic relationship distribution into the target neural network for prediction, so as to generate the following of the barrage information for replying to the previous text of the barrage information.

[0046] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0047] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the operation of the above-mentioned barrage reply generation method.

[0048] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, wherein at least one executable instruction is stored in the storage medium. When the executable instruction is executed on an electronic device, the electronic device executes the operation of the above-mentioned barrage reply generation method.

[0049] In an embodiment of the present invention, after converting the context of the barrage information into an initial text vector, the topic semantic relationship distribution of the initial text vector, the syntactic dependency vectors and the position relationship vectors between the words in the context of the barrage information can be determined; the input vector of each word can be determined based on the syntactic dependency vector and the position relationship vector, and the input vector and the topic semantic relationship distribution are input into the target neural network for prediction, so that the context of the barrage information used to reply to the context of the barrage information can be generated. It can be seen that the embodiment of the present invention determines the input vector of each word through the syntactic dependency vector and the position relationship vector, which can more accurately mine the semantic role assumed by the predicted word, thereby making the logical structure of the context of the barrage information more accurate; by determining the topic semantic relationship distribution of the initial text vector, the topic features of the context of the barrage information can be dynamically captured, so that the topic features of the context of the barrage information are consistent with the topic features of the context of the barrage information, further improving the generation quality of the context of the barrage information.

[0050] The above description is only an overview of the technical solution of the embodiment of the present invention. In order to more clearly understand the technical means of the embodiment of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present invention. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:

[0052] Figure 1 A schematic diagram showing the structure of a content generation network provided by an embodiment of the present invention is shown;

[0053] Figure 2 A schematic diagram showing a flow chart of a method for generating a bullet comment reply provided by an embodiment of the present invention is shown;

[0054] Figure 3 A schematic diagram showing the structure of a bullet comment reply generating device provided by an embodiment of the present invention is shown;

[0055] Figure 4 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0056] Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be limited to the embodiments set forth herein.

[0057] Figure 1 FIG. 1 shows a schematic diagram of the structure of a content generation network provided by an embodiment of the present invention. Figure 1As shown in the figure, the content generation network is a barrage topic generation network built based on the Transformer deep learning model, including a semantic learning module, a topic learning module and a barrage prediction module.

[0058] Among them, in the semantic learning module, by adding syntactic relationship learning encoding to the barrage data, the main semantic logical relationship of the barrage can be learned based on attention, reducing noise logical interference; in the topic learning module, by adding topic relationship recognition information to the barrage data, the topic semantic relationship distribution of sentences and words is obtained through context information; in the barrage prediction module, the words under the topic similar to the previous text of the barrage are obtained through the context for dialogue generation, making the generated dialogue flexible and diverse.

[0059] Furthermore, an embodiment of the present invention proposes an evaluation feedback method for the quality of automatically generated barrage content, namely, the STGE (Semantic Text Generate) method. The logical matching quality, content diversity quality, and topic quality of the generated barrage sentences are evaluated to provide a reference for the deficiencies of existing automatic evaluation methods and provide feedback for the generation of high-quality dialogues. The implementation process of the content generation network is described in detail below in conjunction with specific embodiments.

[0060] Figure 2 The flowchart of the method for generating a bullet screen reply according to an embodiment of the present invention is shown, and the method is executed by an electronic device. The memory of the electronic device is used to store at least one executable instruction, and the executable instruction enables the processor of the electronic device to execute the operation of the above-mentioned method for generating a bullet screen reply. Figure 1 and Figure 2 As shown, the method comprises the following steps:

[0061] Step 110: Get the content of the bullet screen information.

[0062] Among them, the text of the barrage information is generally edited and published by the user. For example, the text of the barrage information can be "Happy Teacher's Day!", "My mobile phone and I are inseparable", etc. The text of the barrage information is generally related to the current video. For example, when the theme of the current video is "Teacher's Day", the text of the barrage information can be "Happy Teacher's Day!", and when the theme of the current video is "Mobile Phone", the text of the barrage information can be "My mobile phone and I are inseparable". Since the theme changes dynamically during the video playback, the barrage information posted by the user is generally real-time, that is, related to the current video theme.

[0063] Step 120: pre-process the above barrage information and convert it into an initial text vector.

[0064] When the context of the bullet message is preprocessed, the context of the bullet message can be first segmented, and then the word vector of each word is calculated, and the initial text vector corresponding to the context of the bullet message is obtained according to the word vector of each word. For example, if the context of the bullet message is "Don't say too much nonsense, three consecutive words as respect", after word segmentation, it can be obtained as "Don't say too much nonsense, three consecutive words as respect".

[0065] Step 130: Determine the topic semantic relationship distribution of the initial text vector.

[0066] The topic semantic relationship distribution of the pre-trained bullet screen dialogue sequence can be learned through n-layer encoding. The topic semantic relationship distribution of the pre-trained bullet screen dialogue sequence includes the topic semantic relationship distribution corresponding to each word in the bullet screen dialogue sequence, wherein one word may correspond to multiple topics, and each topic corresponds to a topic probability.

[0067] The pre-trained topic vector Z can be expressed as {z1,z2,z3....zm}, and the word vector w corresponding to the initial text vector can be expressed as {d1,d2,d3....dn}. The topic semantic relationship distribution of the initial text vector can be determined by the topic semantic relationship distribution corresponding to the word vector w in the initial text vector. Furthermore, the topic semantic relationship distribution corresponding to the word vector w can be determined by constructing a relationship matrix between the word vector and the topic vector Z. In the initial text vector, the topic probability of the word corresponding to the word vector w can be determined by the following formula.

[0068]

[0069] Among them, p(z k |w) represents the topic probability of the word vector w corresponding to the word, z k represents the topic to which the word vector w belongs, m represents the total dimension of the topic vector Z, and n represents the total dimension of the word vector w. Through the above calculation formula, p(z k |w) is represented as the semantic distance between the word vector and the corresponding topic vector.

[0070] Therefore, the topic similarity detection is performed between each word vector in the initial text vector and the topic semantic relationship distribution of the pre-trained barrage dialogue sequence, so as to obtain the topic semantic relationship distribution corresponding to the initial text vector, which includes the topic corresponding to each word and the topic probability.

[0071] Step 140: Determine the syntactic dependency vector and position relationship vector between the words in the context of the barrage information based on the initial text vector.

[0072] Among them, the syntactic dependency vector is used to represent the semantic logical relationship between each word in the context of the barrage information, and the position relationship vector is used to represent the position relationship between each word in the context of the barrage information. The context of the barrage information can be analyzed for part of speech, and the semantic relationship of each word segment can be analyzed. For example, "Let's not talk nonsense, three consecutive words are respectful" is analyzed for part of speech:

[0073] (ROOT(IP(NP(NP(NR nonsense))(NP(NN not much)))(VP(VV said)(PU,)(IP(IP(VP(QP(CD three consecutive))))(VP(VC is)(NP(NN respect)))))))

[0074] Among them, ROOT represents the sentence to be processed, IP represents a simple clause, NP represents a noun phrase, NR represents a proper noun, NN represents a common noun, VP represents a verb phrase, VV represents a verb, PU represents a period, question mark, exclamation mark and other sentence breakers, QP represents a quantifier phrase, and CD represents a cardinality word. The results of analyzing the semantic relationship of each participle are as follows:

[0075] nmod: assmod (not much -2, nonsense -1), nsubj (say -3, not much -2), root (ROOT-0, say -3), punct (say -3,, -4), conj (respect -7, triple -5), cop (respect -7, for -6), ccomp (say -3, respect -7).

[0076] Among them, nmod (noun compound modifier) ​​represents compound noun modification, assmod (associative modifier) ​​represents associative modification, nsubj (nominal subject) represents noun subject, root represents root node, punctuation represents punctuation, conj (conjunct) represents conjunction, cop (copula) represents copula, and ccomp represents clause complement.

[0077] The syntactic dependency vector may be calculated using the following formula, for example.

[0078]

[0079] In the above formula, p represents the position of the current word, p kdis the position of the dependent word, r is the position of the core word, i (the value range is 0-d) represents the dimension of the current word, and d represents the total dimension. SE(p,i) represents the syntactic dependency vector of the word at the pth position in the word sequence {w1,w2,....wn}. Furthermore, when determining the syntactic dependency vectors between the words in the above text of the barrage information based on the initial text vector, the position of the current word can be determined first. The current word can be any word vector in the initial text vector; traverse the dependent word position corresponding to the current word, and end the traversal when traversing to the core word position. The dependent word is the dependent word of the current word; calculate the absolute value of the difference between the position of the current word and the position of the dependent word; accumulate the absolute value of the difference to calculate the core weight of the current word, and obtain the syntactic dependency vector corresponding to the current word. For example, in "Don't say too much nonsense, three consecutive words are respectful", the core word is "say", and the main body of the whole sentence surrounding the core word is "don't say too much, respect", and for "not much", its pk position is 2, p kd The position is 3. By encoding the syntactic relationship through the above formula, we can focus on the core relationship words such as subject, predicate and object, thereby reducing the impact of other meaningless noise, focusing on the main feature attention learning, and improving the accurate recognition of the logical relationship between words.

[0080] Furthermore, the position relationship vector may be calculated using the following formula, for example.

[0081]

[0082] Among them, pos represents the position of the current word, dmodel represents the total dimension, and i represents the dimension of the position relationship vector.

[0083] Step 150: Perform weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain an input vector for each word.

[0084] Among them, the syntactic dependency vector and the position relationship vector are weighted to obtain the input vector of each word, so that the semantic relationship characteristics and position relationship characteristics of each word can be represented by the input vector of each word. In an embodiment of the present invention, the syntactic dependency vector and the position relationship vector corresponding to each word can be directly added or set different weights respectively and then added to obtain the input vector. The embodiment of the present invention does not specifically limit the specific form of how to weight, and those skilled in the art can make corresponding settings according to the specific scenario.

[0085] Step 160: Input the input vector and the topic semantic relationship distribution into the target neural network for prediction to generate a barrage message context for replying to the barrage message context.

[0086] The target neural network is a neural network generated after training. The target neural network can be based on a Transformer model, for example, which is a natural language processing model developed by Google.

[0087] In an optional manner, the target neural network includes an attention mechanism, a feedforward network, and a topic word prediction model. When the input vector and the topic semantic relationship distribution are input into the target neural network for prediction, the topic of the initial text vector and the corresponding word distribution under the topic can be determined first according to the topic semantic relationship distribution, and then the input vector is calculated by the attention mechanism according to the topic and the corresponding word distribution under the topic to obtain the inter-word relationship vector, and the inter-word relationship vector is residually connected and normalized, and then input into the feedforward network to obtain the topic semantic vector of each word in the input vector; the topic semantic vector and the inter-word relationship vector are residually connected to obtain the barrage information sequence vector; the barrage information sequence vector is input into the topic word prediction model to generate the barrage information context for replying to the barrage information context.

[0088] The forward propagation can be performed through a feedforward neural network, and the forward propagation process can use a GELU (Gaussian Error Linear Units) activation function, for example. The GELU activation function can be calculated using the following formula, for example.

[0089]

[0090] In an optional manner, the barrage information sequence vector includes the topic of the barrage information context, the word distribution under the topic, the topic probability and semantic information. When the barrage information sequence vector is input into the topic word prediction model, the last prediction result can be determined first, and the last prediction result is the predicted word predicted before the current predicted word; the last prediction result and the barrage information sequence vector are used as input, and the current predicted word probability is obtained according to the preset vocabulary model and the topic semantic relationship distribution. The preset vocabulary model can be manually pre-set to encode words, thereby establishing a unique correspondence between words and corresponding codes. Further, the topic probability and the current predicted word probability are weighted and calculated to obtain the corresponding predicted words under each topic; according to the corresponding predicted words under each topic, multiple predicted barrage reply information and corresponding probabilities are obtained, and the predicted barrage reply information with the highest probability is determined as the barrage information context.

[0091] Furthermore, a word prediction function may be used to generate corresponding predicted words under each topic. The word prediction function may be calculated using the following formula, for example.

[0092]

[0093] Among them, V represents the preset vocabulary model, K represents the distribution of topic semantic relations, v and k are subsets of V and K respectively, s represents the topic vector of the bullet message above, and y i-1 represents the last prediction result, w and b are the network parameters used to represent the coefficient and bias term respectively, p(y i ) is the word prediction function, w T represents the transpose of w, W SV 、Ws k , Wy v , Wy k and Wx K They are used to represent the components of w, x represents the word vector of the above barrage information, b v and b k Represent the components of b respectively.

[0094] It should be noted that after generating the context of the barrage information for replying to the context of the barrage information according to the above embodiment, the context of the barrage information can be further detected to determine the quality value of the context of the barrage information, and the quality value of the context of the barrage information can be compared with the preset quality value threshold.

[0095] In an optional manner, when determining the quality value of the context of the barrage information, the context of the barrage information is first divided into a plurality of logic detection units. For example, punctuation can be added to the context of the barrage information according to a preset step length, and the logic detection units can be divided according to the punctuation. A jump mechanism is used to perform logic matching detection on different logic detection units, and the logic matching quality value of the context of the barrage information is determined according to the result of the logic matching detection. Furthermore, the topic vector of each word in the context of the barrage information can be weighted to determine the topic vector of the context of the barrage information, and the cosine similarity between the topic vector of the context of the barrage information and the topic vector of the context of the barrage information is calculated, and the cosine similarity is determined as the topic quality value of the context of the barrage information. Furthermore, the word sequence in the context of the barrage information can be jump-combined with different sliding windows, such as the word combination (w1, 1, w2) represents the word combination w1w2 with a distance of 1, and the logical dependency of the word combination is calculated, such as (w1, nsubj, 1, w2) represents the logical dependency of the word combination w1w2, and the logical relationship between words in the training word set C and the word collocation combination are combined to statistically analyze the logic and specificity of word combinations at different distances in the context of the barrage information, thereby calculating the logical collocation quality value and content diversity quality value of the context of the barrage information.

[0096] In an optional manner, the quality value of the content of the barrage information can be calculated according to a preset quality value formula. The quality value is used to characterize the logical matching quality, content diversity quality and theme quality of the content of the barrage information. If the quality value of the content of the barrage information is greater than the preset quality value threshold, the content of the barrage information is output.

[0097] In an optional manner, when calculating the quality value of the content of the barrage information according to a preset quality value formula, the logical matching quality value, content diversity quality value and theme quality value of the content of the barrage information can be determined respectively, and the product of the logical matching quality value and the content diversity quality value can be calculated, and the sum of the product and the theme quality value can be determined as the quality value of the content of the barrage information.

[0098] The preset quality value formula may be, for example, the following formula:

[0099]

[0100] in, Indicates the topic quality value of the following barrage information. Represents the topic vector of the following barrage information, The topic vector representing the context of the bullet message, that is, the topic quality value is represented by the cosine similarity between the topic vector of the context of the bullet message and the topic vector of the context of the bullet message; Indicates the logical matching quality value of the barrage information context. represents the content diversity quality value of the barrage information, r represents the reply word set, C represents the training word set, (w m ,i,w n ) represents the w with interval i m w n phrase, count is used to count the undeduplicated w m w n The number of phrases. Uniq is used to count the number of duplicate words. m w n The number of phrases. m and n are custom parameters.

[0101] It should be noted that before inputting the input vector and the distribution of topic semantic relations into the target neural network for prediction, the target neural network needs to be trained in advance.

[0102] In an optional method, a training sample is input into the target neural network for training to obtain an output result, where the training sample is a labeled context of the barrage dialogue, and the label includes the topic of the context of the barrage dialogue and the corresponding context of the barrage dialogue; the loss value of the target neural network is calculated according to the output result of the target neural network, the context of the barrage dialogue and a preset loss function, the parameters of the target neural network are adjusted according to the loss value of the target neural network, and the target neural network is re-trained according to the training sample, and the parameters of the target neural network are adjusted according to the loss value of the target neural network until the preset loss function converges or is less than a preset threshold.

[0103] In an optional manner, the preset loss function may be composed of the cosine similarity distance between the word prediction likelihood function and the context semantic vector. For example, the preset loss function may be:

[0104]

[0105] Where logP(x i |x i-k ,.....x i-1 :θ) is the word prediction likelihood function, is the cosine similarity distance of the context semantic vector, represents the topic vector of the bullet screen, Represents the topic vector of the bullet comment. α and β are adjustable parameters, θ is the parameter to be estimated, and k and m are custom parameters.

[0106] In an embodiment of the present invention, after converting the context of the barrage information into an initial text vector, the topic semantic relationship distribution of the initial text vector, the syntactic dependency vectors and the position relationship vectors between the words in the context of the barrage information can be determined; the input vector of each word can be determined based on the syntactic dependency vector and the position relationship vector, and the input vector and the topic semantic relationship distribution are input into the target neural network for prediction, so that the context of the barrage information used to reply to the context of the barrage information can be generated. It can be seen that the embodiment of the present invention determines the input vector of each word through the syntactic dependency vector and the position relationship vector, which can more accurately mine the semantic role assumed by the predicted word, thereby making the logical structure of the context of the barrage information more accurate; by determining the topic semantic relationship distribution of the initial text vector, the topic features of the context of the barrage information can be dynamically captured, so that the topic features of the context of the barrage information are consistent with the topic features of the context of the barrage information, further improving the generation quality of the context of the barrage information.

[0107] Figure 3 FIG. 2 shows a schematic diagram of the structure of a bullet screen generating device according to an embodiment of the present invention. Figure 3 As shown, the device 300 includes: an acquisition module 310 , a conversion module 320 , a first determination module 330 , a second determination module 340 , a calculation module 350 and a prediction module 360 ​​.

[0108] The acquisition module 310 is used to obtain the context of the bullet message information;

[0109] A conversion module 320, configured to pre-process the above text of the bullet message information and convert it into an initial text vector;

[0110] A first determination module 330, configured to determine a topic semantic relationship distribution of the initial text vector;

[0111] A second determination module 340 is used to determine the syntactic dependency vector and the position relationship vector between the words in the above text of the barrage information according to the initial text vector;

[0112] A calculation module 350, configured to perform weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain an input vector of each word;

[0113] The prediction module 360 ​​is used to input the input vector and the topic semantic relationship distribution into the target neural network for prediction, so as to generate the following of the barrage information for replying to the previous text of the barrage information.

[0114] In an optional manner, the second determining module 340 is used to:

[0115] Determine the location of a current word, where the current word is any word vector in the initial text vector;

[0116] Traverse the dependent word positions corresponding to the current word, and end the traversal when the traversal reaches the core word position, and the dependent word is the dependent word of the current word;

[0117] Calculate the absolute value of the difference between the position of the current word and the position of the dependent word;

[0118] The absolute values ​​of the differences are accumulated to calculate the core weight of the current word to obtain the syntactic dependency vector.

[0119] In an optional manner, the target neural network includes an attention mechanism, a feedforward network, and a topic word prediction model; the prediction module 360 ​​is used to:

[0120] Determine the topic of the initial text vector and the word distribution corresponding to the topic according to the topic semantic relationship distribution;

[0121] According to the topic and the word distribution corresponding to the topic, the input vector is subjected to attention mechanism calculation to obtain a word relationship vector;

[0122] After residual connection and normalization of the inter-word relationship vector, the vector is input into the feedforward network to obtain the topic semantic vector of each word in the input vector;

[0123] Performing residual connection on the topic semantic vector and the inter-word relationship vector to obtain a bullet comment information sequence vector;

[0124] The barrage information sequence vector is input into the keyword prediction model to generate a barrage information context for replying to the barrage information context.

[0125] In an optional manner, the barrage information sequence vector includes the topic of the barrage information, the word distribution under the topic, the topic probability and the semantic information; the prediction module 360 ​​is used to:

[0126] Determine a previous prediction result, wherein the previous prediction result is a prediction word predicted before the current prediction word;

[0127] Taking the last prediction result and the bullet message sequence vector as input, and obtaining the current prediction word probability according to the preset vocabulary model and the topic semantic relationship distribution;

[0128] The topic probability and the current predicted word probability are weighted and calculated to obtain the corresponding predicted words under each topic;

[0129] According to the corresponding predicted words under each of the topics, a barrage message context is generated to reply to the barrage message context.

[0130] In an optional manner, the device 300 further includes an output module, which is used to:

[0131] Calculate the quality value of the context of the barrage information according to a preset quality value formula, where the quality value is used to characterize the logical matching quality, content diversity quality, and theme quality of the context of the barrage information;

[0132] If the quality value of the context of the barrage information is greater than a preset quality value threshold, the context of the barrage information is output.

[0133] In an optional manner, the output module is used to:

[0134] Respectively determine the logical matching quality value, content diversity quality value and theme quality value of the context of the barrage information;

[0135] The product of the logical collocation quality value and the content diversity quality value is calculated, and the sum of the product and the topic quality value is determined as the quality value.

[0136] In an optional manner, the apparatus 300 further includes a training module, which is used to:

[0137] Inputting a training sample into the target neural network for training to obtain an output result, wherein the training sample is a labeled barrage dialogue context, wherein the label includes a topic of the barrage dialogue context and a corresponding barrage dialogue context;

[0138] Calculate the loss value of the target neural network according to the output result, the context of the bullet screen dialogue and a preset loss function;

[0139] The parameters of the target neural network are adjusted according to the loss value, and the step of inputting the training sample into the target neural network for training is re-executed to obtain an output result, the loss value of the target neural network is calculated according to the output result, the context of the barrage dialogue and a preset loss function, and the parameters of the target neural network are adjusted according to the loss value, until the preset loss function converges or is less than a preset threshold;

[0140] The preset loss function is composed of the cosine similarity distance between the word prediction likelihood function and the context semantic vector.

[0141] In an embodiment of the present invention, after converting the context of the barrage information into an initial text vector, the topic semantic relationship distribution of the initial text vector, the syntactic dependency vectors and the position relationship vectors between the words in the context of the barrage information can be determined; the input vector of each word can be determined based on the syntactic dependency vector and the position relationship vector, and the input vector and the topic semantic relationship distribution are input into the target neural network for prediction, so that the context of the barrage information used to reply to the context of the barrage information can be generated. It can be seen that the embodiment of the present invention determines the input vector of each word through the syntactic dependency vector and the position relationship vector, which can more accurately mine the semantic role assumed by the predicted word, thereby making the logical structure of the context of the barrage information more accurate; by determining the topic semantic relationship distribution of the initial text vector, the topic features of the context of the barrage information can be dynamically captured, so that the topic features of the context of the barrage information are consistent with the topic features of the context of the barrage information, further improving the generation quality of the context of the barrage information.

[0142] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.

[0143] like Figure 4 As shown, the electronic device may include: a processor (processor) 402 , a communication interface (Communications Interface) 404 , a memory (memory) 406 , and a communication bus 408 .

[0144] The processor 402, the communication interface 404, and the memory 406 communicate with each other via the communication bus 408. The communication interface 404 is used to communicate with other devices such as a client or other server network elements. The processor 402 is used to execute the program 410, which can specifically execute the relevant steps in the above-mentioned embodiment of the method for generating bullet screens.

[0145] Specifically, the program 410 may include program code including computer executable instructions.

[0146] The processor 402 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0147] The memory 406 is used to store the program 410. The memory 406 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0148] Program 410 can be specifically called by processor 402 to enable the electronic device to perform the following operations:

[0149] Get the above barrage information;

[0150] Preprocess the above text of the bullet message information and convert it into an initial text vector;

[0151] Determining the topic semantic relationship distribution of the initial text vector;

[0152] Determine, according to the initial text vector, a syntactic dependency vector and a position relationship vector between the words in the above text of the bullet message;

[0153] Performing weighted calculation on the syntactic dependency relationship vector and the position relationship vector to obtain an input vector of each word;

[0154] The input vector and the topic semantic relationship distribution are input into the target neural network for prediction to generate the following barrage information for replying to the previous barrage information.

[0155] In an optional manner, the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0156] Determine the location of a current word, where the current word is any word vector in the initial text vector;

[0157] Traverse the dependent word positions corresponding to the current word, and end the traversal when the traversal reaches the core word position, and the dependent word is the dependent word of the current word;

[0158] Calculate the absolute value of the difference between the position of the current word and the position of the dependent word;

[0159] The absolute values ​​of the differences are accumulated to calculate the core weight of the current word to obtain the syntactic dependency vector.

[0160] In an optional manner, the target neural network includes an attention mechanism, a feedforward network, and a topic word prediction model; the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0161] Determine the topic of the initial text vector and the word distribution corresponding to the topic according to the topic semantic relationship distribution;

[0162] According to the topic and the word distribution corresponding to the topic, the input vector is subjected to attention mechanism calculation to obtain a word relationship vector;

[0163] After residual connection and normalization of the inter-word relationship vector, the vector is input into the feedforward network to obtain the topic semantic vector of each word in the input vector;

[0164] Performing residual connection on the topic semantic vector and the inter-word relationship vector to obtain a bullet comment information sequence vector;

[0165] The barrage information sequence vector is input into the keyword prediction model to generate a barrage information context for replying to the barrage information context.

[0166] In an optional manner, the barrage information sequence vector includes the topic of the barrage information, the word distribution under the topic, the topic probability and the semantic information; the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0167] Determine a previous prediction result, wherein the previous prediction result is a prediction word predicted before the current prediction word;

[0168] Taking the last prediction result and the bullet message sequence vector as input, and obtaining the current prediction word probability according to the preset vocabulary model and the topic semantic relationship distribution;

[0169] The topic probability and the current predicted word probability are weighted and calculated to obtain the corresponding predicted words under each topic;

[0170] According to the corresponding predicted words under each of the topics, a barrage message context is generated to reply to the barrage message context.

[0171] In an optional manner, the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0172] Calculate the quality value of the context of the barrage information according to a preset quality value formula, where the quality value is used to characterize the logical matching quality, content diversity quality, and theme quality of the context of the barrage information;

[0173] If the quality value of the context of the barrage information is greater than a preset quality value threshold, the context of the barrage information is output.

[0174] In an optional manner, the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0175] Respectively determine the logical matching quality value, content diversity quality value and theme quality value of the context of the barrage information;

[0176] The product of the logical collocation quality value and the content diversity quality value is calculated, and the sum of the product and the topic quality value is determined as the quality value.

[0177] In an optional manner, the program 410 is called by the processor 402 to enable the electronic device to perform the following operations:

[0178] Inputting training samples into the target neural network for training to obtain output results; the training samples are labeled bullet screen dialogue contexts; the labels include the subject of the bullet screen dialogue contexts and the corresponding bullet screen dialogue contexts;

[0179] Calculate the loss value of the target neural network according to the output result, the context of the bullet screen dialogue and a preset loss function;

[0180] The parameters of the target neural network are adjusted according to the loss value, and the step of inputting the training sample into the target neural network for training is re-executed to obtain an output result, the loss value of the target neural network is calculated according to the output result, the context of the barrage dialogue and a preset loss function, and the parameters of the target neural network are adjusted according to the loss value, until the preset loss function converges or is less than a preset threshold;

[0181] The preset loss function is composed of the cosine similarity distance between the word prediction likelihood function and the context semantic vector.

[0182] In an embodiment of the present invention, after converting the context of the barrage information into an initial text vector, the topic semantic relationship distribution of the initial text vector, the syntactic dependency vectors and the position relationship vectors between the words in the context of the barrage information can be determined; the input vector of each word can be determined based on the syntactic dependency vector and the position relationship vector, and the input vector and the topic semantic relationship distribution are input into the target neural network for prediction, so that the context of the barrage information used to reply to the context of the barrage information can be generated. It can be seen that the embodiment of the present invention determines the input vector of each word through the syntactic dependency vector and the position relationship vector, which can more accurately mine the semantic role assumed by the predicted word, thereby making the logical structure of the context of the barrage information more accurate; by determining the topic semantic relationship distribution of the initial text vector, the topic features of the context of the barrage information can be dynamically captured, so that the topic features of the context of the barrage information are consistent with the topic features of the context of the barrage information, further improving the generation quality of the context of the barrage information.

[0183] An embodiment of the present invention provides a computer-readable storage medium, which stores at least one executable instruction. When the executable instruction is executed on an electronic device, the electronic device executes the barrage reply generation method in any of the above method embodiments.

[0184] An embodiment of the present invention provides a barrage generation device, which is used to execute the above-mentioned barrage reply generation method.

[0185] An embodiment of the present invention provides a computer program, which can be called by a processor to enable an electronic device to execute the barrage reply generation method in any of the above method embodiments.

[0186] An embodiment of the present invention provides a computer program product, which includes a computer program stored on a computer-readable storage medium, and the computer program includes program instructions. When the program instructions are run on a computer, the computer executes the barrage reply generation method in any of the above method embodiments.

[0187] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language yet. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description made to specific languages ​​above is for disclosing the best mode of the present invention.

[0188] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0189] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than those expressly recited in each claim.

[0190] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0191] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A method for generating a barrage reply, characterized in that: The method comprises: Get the above barrage information; Preprocess the above text of the bullet message information and convert it into an initial text vector; Determine the topic semantic relationship distribution of the initial text vector; the topic semantic relationship distribution includes the topic corresponding to each word and the topic probability; Determine, according to the initial text vector, a syntactic dependency vector and a position relationship vector between the words in the above text of the bullet message; Performing weighted calculation on the syntactic dependency vector and the position relationship vector to obtain an input vector of each word; The input vector and the topic semantic relationship distribution are input into the target neural network for prediction to generate the following barrage information for replying to the previous barrage information.

2. The method according to claim 1, characterized in that Determining the syntactic dependency vector and the position relationship vector between the words in the above text of the bullet message according to the initial text vector includes: Determine the location of a current word, where the current word is any word vector in the initial text vector; Traverse the dependent word positions corresponding to the current word, and end the traversal when the traversal reaches the core word position, and the dependent word is the dependent word of the current word; Calculate the absolute value of the difference between the position of the current word and the position of the dependent word; The absolute values ​​of the differences are accumulated to calculate the core weight of the current word to obtain the syntactic dependency vector.

3. The method according to claim 1, characterized in that: The target neural network includes an attention mechanism, a feedforward network, and a topic word prediction model; the input vector and the topic semantic relationship distribution are input into the target neural network for prediction to generate a barrage message for replying to the above barrage message, which includes: Determine the topic of the initial text vector and the word distribution corresponding to the topic according to the topic semantic relationship distribution; According to the topic and the word distribution corresponding to the topic, the input vector is subjected to attention mechanism calculation to obtain a word relationship vector; After residual connection and normalization of the inter-word relationship vector, the vector is input into the feedforward network to obtain the topic semantic vector of each word in the input vector; Performing residual connection on the topic semantic vector and the inter-word relationship vector to obtain a bullet comment information sequence vector; The barrage information sequence vector is input into the keyword prediction model to generate a barrage information context for replying to the barrage information context.

4. The method according to claim 3, characterized in that The barrage information sequence vector includes the topic of the barrage information context, word distribution under the topic, topic probability and semantic information; the inputting the barrage information sequence vector into the topic word prediction model to generate the barrage information context for replying to the barrage information context includes: Determine a previous prediction result, wherein the previous prediction result is a prediction word predicted before the current prediction word; Taking the last prediction result and the bullet message sequence vector as input, and obtaining the current prediction word probability according to the preset vocabulary model and the topic semantic relationship distribution; The topic probability and the current predicted word probability are weighted and calculated to obtain the corresponding predicted words under each of the topics; According to the corresponding predicted words under each of the topics, a barrage message context is generated to reply to the barrage message context.

5. The method according to claim 1, characterized in that The method further comprises: Calculate the quality value of the context of the barrage information according to a preset quality value formula, where the quality value is used to characterize the logical matching quality, content diversity quality, and theme quality of the context of the barrage information; If the quality value of the context of the barrage information is greater than a preset quality value threshold, the context of the barrage information is output.

6. The method according to claim 5, characterized in that Calculating the quality value of the following content of the bullet message information according to the preset quality value formula includes: Respectively determine the logical matching quality value, content diversity quality value and theme quality value of the context of the barrage information; The product of the logic matching quality value and the content diversity quality value is calculated, and the sum of the product and the topic quality value is determined as the quality value of the context of the barrage information.

7. The method according to claim 1, characterized in that The method further comprises: Inputting training samples into the target neural network for training to obtain output results; the training samples are labeled bullet screen dialogue contexts; the labels include the subject of the bullet screen dialogue contexts and the corresponding bullet screen dialogue contexts; Calculate the loss value of the target neural network according to the output result, the context of the bullet screen dialogue and a preset loss function; Adjust the parameters of the target neural network according to the loss value, and re-enter the training sample into the target neural network for training to obtain an output result, calculate the loss value of the target neural network according to the output result, the context of the barrage dialogue and a preset loss function, and adjust the parameters of the target neural network according to the loss value until the preset loss function converges or is less than a preset threshold; The preset loss function is composed of the cosine similarity distance between the word prediction likelihood function and the context semantic vector.

8. A barrage reply generating device, characterized in that: The device comprises: The acquisition module is used to obtain the content of the bullet message; A conversion module, used to pre-process the above text of the bullet message information and convert it into an initial text vector; A first determination module is used to determine the topic semantic relationship distribution of the initial text vector; the topic semantic relationship distribution includes the topic corresponding to each word and the topic probability; A second determination module is used to determine the syntactic dependency vector and the position relationship vector between the words in the above text of the barrage information according to the initial text vector; A calculation module, used for performing weighted calculation on the syntactic dependency vector and the position relationship vector to obtain an input vector of each word; The prediction module is used to input the input vector and the topic semantic relationship distribution into the target neural network for prediction, so as to generate the following of the barrage information for replying to the previous text of the barrage information.

9. An electronic device, characterized in that: include: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute the operation of the barrage reply generation method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one executable instruction. When the executable instruction is executed on the electronic device, the electronic device executes the operation of the bullet screen reply generation method as described in any one of claims 1 to 7.