Video recommendation method, device, electronic device and storage medium

By encoding the text associated with short videos, identifying valid characters and calculating sentence similarity, the problem of meaningless content affecting recommendation accuracy is solved, thereby improving recommendation accuracy and user experience.

CN113065027BActive Publication Date: 2025-09-16TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110420279.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-19
Publication Date
2025-09-16
Estimated Expiration
2041-04-19

AI Technical Summary

Technical Problem

In short video recommendations, the accuracy of recommendations is reduced due to the high similarity of meaningless content contained in video texts.

Method used

By encoding the video-associated text, a probability value sequence is generated to identify valid characters, and the sentence similarity is calculated using the text expression vector. Recommendations are made when the similarity exceeds a threshold.

Benefits of technology

Improves the accuracy of video recommendations and user experience, and reduces the impact of invalid characters on recommendation results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113065027B_ABST
    Figure CN113065027B_ABST
Patent Text Reader

Abstract

The present application provides a method, device, electronic device and storage medium for video recommendation. The video recommendation method includes: obtaining a first associated text of a video to be recommended, wherein the first associated text includes K characters; encoding the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, and the probability value is used to represent the probability that the corresponding character is a valid character; generating a first text expression vector based on the first encoding sequence and the first associated text; determining sentence similarity based on the first text expression vector and the second text expression vector; if the sentence similarity is greater than a recommendation threshold, recommending the video to be recommended to the user. This method avoids the recommendation result being too far away from the content of the target video used for recommendation due to invalid characters, thereby improving the accuracy of the recommendation and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device, and storage medium for video recommendation. Background Art

[0002] Short videos are currently one of the applications that consume the most user time. The short video application ecosystem typically includes platforms, content producers, and consumers. Short video recommendations typically involve several stages: recall, coarse sorting, fine sorting, and mixed sorting. Using various recall strategies and various permutations and combinations, the model sorts the content and presents it to users.

[0003] Currently, short video recommendations are usually based on a learning recommendation method based on video content. The video is vectorized according to its content, and videos with similar content are searched based on the vectorized representations of videos that the user has browsed to make video recommendations.

[0004] However, since the meaningless content contained in the text of short videos often has a high similarity, during the learning and operation of the recommendation model, the presence of meaningless content will lead to an increase in the similarity between videos, thereby reducing the accuracy of video recommendations. Summary of the Invention

[0005] Based on the above technical problems, this application provides a video recommendation method to improve the accuracy of video recommendation and user experience.

[0006] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by practice of the present application.

[0007] According to one aspect of an embodiment of the present application, a method for recommending videos is provided, including:

[0008] Obtaining a first associated text of the video to be recommended, wherein the first associated text includes K characters, where K is an integer greater than or equal to 1;

[0009] Encoding the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponds to a character, and the probability value is used to represent the probability that the corresponding character is a valid character;

[0010] generating a first text expression vector according to the first coding sequence and the first associated text;

[0011] determining sentence similarity based on the first text expression vector and the second text expression vector, wherein the second text expression vector is generated based on a second associated text of a historical video, where the historical video is a video viewed by the user;

[0012] If the sentence similarity is greater than the recommendation threshold, the video to be recommended is recommended to the user.

[0013] According to one aspect of an embodiment of the present application, a video recommendation device is provided, including:

[0014] A first text acquisition module, configured to acquire a first associated text of the video to be recommended, wherein the first associated text includes K characters, where K is an integer greater than or equal to 1;

[0015] a first encoding processing module, configured to encode the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponding to a character, and the probability value is used to represent a probability that the character corresponding to the element is a valid character;

[0016] A first expression generation module, configured to generate a first text expression vector according to the first coding sequence and the first associated text;

[0017] a similarity module, configured to determine sentence similarity based on the first text expression vector and the second text expression vector, wherein the second text expression vector is generated based on a second associated text of a historical video, the historical video being a video viewed by the user;

[0018] The recommendation module is configured to recommend the video to be recommended to the user if the sentence similarity is greater than a recommendation threshold.

[0019] In some embodiments of the present application, based on the above technical solution, the first encoding processing module includes:

[0020] A second input unit is used to input the first associated text into a first encoding model to obtain a first encoding sequence output by the first encoding model, wherein the K probability values ​​are composed of M first probability values ​​and N second probability values, the first probability value is used to indicate that the corresponding character is a valid character, and the second probability value is used to indicate that the corresponding character is an invalid character, and both M and N are integers greater than or equal to 0.

[0021] In some embodiments of the present application, based on the above technical solution, the first encoding processing module includes:

[0022] A first input unit is used to input the first associated text into a second encoding model to obtain a first encoding sequence output by the second encoding model, wherein the value of each probability value in the K probability values ​​is within a preset range, and the probability value greater than or equal to the probability threshold is used to indicate that the corresponding character is a valid character, and the probability value less than the probability threshold is used to indicate that the corresponding character is an invalid character.

[0023] In some embodiments of the present application, based on the above technical solution, the first text expression vector is generated by a first sub-model of a similarity matching model; and the video recommendation device further includes:

[0024] A second text acquisition module, configured to acquire a second associated text of the historical video, wherein the second associated text includes at least one character;

[0025] A second encoding processing module is configured to perform encoding processing on the second associated text to obtain a second encoding sequence, wherein the second encoding sequence includes at least one probability value, each probability value corresponding to a character;

[0026] The second expression generation module is used to input the second encoding sequence and the second associated text into the second sub-model of the similarity matching model to generate the second text expression vector.

[0027] In some embodiments of the present application, based on the above technical solution, the similarity module includes:

[0028] a similarity calculation unit, configured to calculate the cosine similarity between the first text expression vector and the second text expression vector;

[0029] The similarity determination unit is configured to determine the sentence similarity based on the cosine similarity and a similarity threshold.

[0030] In some embodiments of the present application, based on the above technical solution, the video recommendation device further includes:

[0031] A training data acquisition module, configured to obtain first training data and second training data, wherein the first training data includes a first training text and a first training sequence, and the second training data includes a second training text and a second training sequence;

[0032] A first expression result module is configured to input the first training data into a first expression vector model included in a matching model to be trained, and obtain a first expression result output by the first expression vector model;

[0033] A second expression result module is configured to input the second training data into a second expression vector model included in the matching model to be trained, and obtain a second expression result output by the second expression vector model, wherein the first expression vector model and the second expression vector model share a network weight;

[0034] a similarity prediction module, configured to input the first expression result and the second expression result into a similarity matching model of the matching model to be trained to obtain a predicted matching result;

[0035] The model training module is used to train the matching model to be trained based on the predicted matching result and the actual matching result to obtain the similar matching model.

[0036] In some embodiments of the present application, based on the above technical solution, the training data acquisition module includes:

[0037] an invalid segment acquisition unit, configured to acquire an invalid text segment set, wherein the invalid text segment set includes at least a first invalid text segment and a second invalid text segment;

[0038] A video text acquisition unit, configured to acquire video text data, wherein the video text data includes a first video text, a second video text, and a similarity identifier;

[0039] a first text generating unit configured to generate a first training text based on the first video text and the first invalid text segment, and generate a second training text based on the second video text and the second invalid text segment, if the similarity identifier indicates that the first video text and the second video text are not similar;

[0040] A second text generation unit is configured to generate the first training text based on the first video text and the first invalid text segment, and generate the second training text based on the second video text and the first invalid text segment, if the similarity identifier indicates that the first video text is similar to the second video text.

[0041] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the video recommendation method in the above technical solution by executing the executable instructions.

[0042] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the video recommendation method in the above technical solution is implemented.

[0043] According to one aspect of an embodiment of the present application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method for providing video recommendations in the various optional implementations described above.

[0044] In an embodiment of the present application, the video-associated text is encoded into a sequence of probability values, each probability value representing the probability that the corresponding character is a valid character, and a text expression vector is generated based on the encoded sequence and the associated text. Similar videos are then found and recommended to the user based on the generated text expression vector. Through the above-mentioned method, when making video recommendations, the influence of valid characters in the video-associated text on the recommendation results can be amplified, while the influence of invalid characters on the recommendation results can be reduced, thereby avoiding the recommendation results being too far away from the content of the target video used for recommendation due to invalid characters, thereby improving the accuracy of the recommendation and the user experience.

[0045] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can derive other drawings based on these drawings without inventive effort.

[0047] In the attached figure:

[0048] Figure 1 The following schematically shows an exemplary system architecture diagram of the technical solution of the present application in an application scenario;

[0049] Figure 2 A schematic diagram showing a flow chart of a video recommendation method in an embodiment of the present application is shown;

[0050] Figure 3 This is a schematic diagram of the first coding model in an embodiment of the present application;

[0051] Figure 4 This is another schematic diagram of the first coding model in an embodiment of the present application;

[0052] Figure 5 Schematic diagram of the expression vector model in the embodiment of this application;

[0053] Figure 6 It is the training structure of the similarity matching model in the embodiment of this application;

[0054] Figure 7 The following schematically shows a block diagram of the video recommendation device in an embodiment of the present application;

[0055] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0056] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art.

[0057] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps etc. can be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the application.

[0058] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0059] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, while others may be combined or partially combined. Therefore, the actual execution order may vary depending on the actual situation.

[0060] It should be understood that the solution provided in this application can be applied to video content distribution platforms such as short video platforms, online television, and online video platforms. On such platforms, relevant content is often recommended to users based on their usage habits to enhance their user experience. Specifically, on short video platforms, videos with similar content can be recommended based on the videos they have viewed. For example, if a user has viewed a large number of food videos, more food-themed videos can be recommended based on the titles of the videos they have viewed. On online video platforms, more related videos can be recommended based on the descriptions of the videos they have viewed. Video creators often add promotional text in video titles or descriptions that is unrelated to the video content. Such promotional text can interfere with video recommendations. For example, if two videos have descriptions of "Big Apple! Please like and bookmark!" and "Fly to the distance! Please like and bookmark!", the same slogans may cause these two videos to be mistakenly identified as related videos, thus affecting recommendation results. The method provided in this application can identify invalid information in video titles or descriptions and reduce or directly ignore this invalid information during the recommendation process, thereby making video recommendations more accurate.

[0061] The solution of this application can be applied to personal computers, handheld devices, vehicle-mounted devices, servers, or server systems composed of multiple servers, and can be implemented specifically using artificial intelligence. With the research and advancement of artificial intelligence technology, artificial intelligence technology has been researched and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, autonomous driving, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0062] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.

[0063] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.

[0064] The solutions provided in the embodiments of this application involve technologies such as natural language processing and machine learning of artificial intelligence.

[0065] Natural language processing (NLP) is a key area of ​​research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.

[0066] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.

[0067] For ease of understanding, the application of the solution of this application to a short video application is used as an example for illustration. Figure 1 , Figure 1 The following schematically shows an exemplary system architecture diagram of the technical solution of the present application in an application scenario.

[0068] Depend on Figure 1As can be seen, this scenario includes a server and terminal devices such as mobile phones, laptops, and in-vehicle devices. The short video application client runs on terminal devices such as mobile phones, in-vehicle devices, and laptops, and communicates with the server. Based on the terminal device's video playback request, the server sends a multimedia stream to the terminal device, which then decodes and plays the multimedia stream. Simultaneously, when the user is browsing, the server will also search for videos with similar titles or descriptions based on the title or description of the video the user has selected to browse, forming a video recommendation sequence, and then send this video recommendation sequence to the client. The client can then use the video recommendation sequence to recommend videos to the user for browsing.

[0069] Figure 1 The server in the application can be a single server, a server cluster, a cloud server, or other forms. The server is used to support the client's video service functions, such as video playback, video upload, user login, information management, and other types of services. In this application, the server also searches for videos with similar titles or descriptions based on the videos in the user's browsing history to generate a recommendation sequence and send it to the client. When the user browses, the client displays recommended videos to the user based on the recommendation sequence, thereby providing the user with content of interest and improving user stickiness.

[0070] The communication method between the client and the server can be any wired or wireless communication method, and this application does not impose any restrictions on this.

[0071] It is understandable that Figure 1 The scenarios shown in the figure are only examples of scenarios in which the solution of this application is applied. The actual application scenarios may adopt other suitable network structures, such as adding proxy servers and multi-level networks, etc. This application does not impose any restrictions on this.

[0072] The short video platform and other information publishing platforms used in the method of this application can adopt a blockchain system architecture. Blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0073] The underlying blockchain platform can include processing modules such as user management, basic services, smart contracts, and operation monitoring. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining public and private key generation (account management), key management, and maintaining the corresponding relationship between the user's real identity and the blockchain address (authority management), etc., and under authorization, it supervises and audits the transactions of certain real identities and provides risk control rule configuration (risk control audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and records the valid requests to the storage after consensus is reached. For a new business request, the basic service first adapts the interface to parse and authenticate the request (interface adaptation), and then encrypts the business information through the consensus algorithm (consensus management). The smart contract module is responsible for the registration, issuance, triggering and execution of contracts. Developers can define the contract logic in a programming language and publish it to the blockchain (contract registration). According to the logic of the contract terms, the contract logic is triggered by calling keys or other events to trigger execution. The contract logic is completed, and the contract upgrade and cancellation functions are also provided. The operation monitoring module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation and real-time status visualization output of the product during the product release process, such as alarms, network status monitoring, and node device health monitoring.

[0074] The platform's product service layer provides the basic capabilities and implementation framework for typical applications. Developers can build on these basic capabilities, overlay business features, and complete the blockchain implementation of business logic. The application service layer provides application services based on blockchain solutions for business participants to use.

[0075] The technical solution provided in this application is described in detail below in conjunction with specific implementation methods.

[0076] See also Figure 2 , Figure 2 The flowchart of a video recommendation method in an embodiment of the present application is shown. The method of this embodiment can be applied to the server described above and executed by a background program on the server. The method of this embodiment may include the following steps S201 to S205:

[0077] Step S201: Obtain a first associated text of a video to be recommended, wherein the first associated text includes K characters, and K is an integer greater than or equal to 1.

[0078] In this embodiment, the video recommendation apparatus obtains first associated text of the video to be recommended, where the first associated text includes at least one character. Specifically, the video recommendation apparatus may obtain the first associated text from relevant information of the video to be recommended, or may directly identify the first associated text from the video to be recommended.

[0079] The video to be recommended can be any video that can be obtained by the video recommendation device, for example, from all videos stored in the server. The video to be recommended can also be obtained from a predetermined range, for example, from a list of popular videos, or from videos uploaded by accounts followed by the user, or from the same account that the user has browsed. The first associated text is usually a sentence or a paragraph, specifically the text in the title or introduction of the video. In one embodiment, the video frame of the video can be processed and analyzed to obtain text information from the video frame as the first associated text. Depending on the language of the text, characters usually refer to basic units of basic sentences such as words or phrases. For example, in Chinese, K characters mean that the first associated text includes K characters, and in English, K characters mean that the first associated text includes K words, and so on.

[0080] It is understandable that the video recommendation device can execute the method of this embodiment at any time. For example, it can be automatically triggered by a server at a fixed time or executed in response to a user's operation instruction. This application does not limit this.

[0081] Step S202: Encode the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponds to a character, and the probability value is used to represent the probability that the corresponding character is a valid character.

[0082] In the present application, a video recommendation device encodes the acquired first associated text to obtain a first encoding sequence. The first encoding sequence includes probability values ​​corresponding to characters in the first associated text, each probability value corresponding to a character. During the encoding process, the video recommendation device analyzes the characters in the first associated text to determine the probability that each character is a valid character. As described above, valid characters refer to characters in the first associated text that are related to the video content. Corresponding to valid characters are invalid characters, which refer to characters in the first associated text that are not related to the video content. Specifically, the encoding process can be identified using a machine learning model or by methods such as keyword recognition. In one embodiment, a preset invalid character list is stored in the server. The video recommendation device identifies invalid characters in the first associated text based on the invalid character list and sets the probability of characters within the same clause to a lower value, while setting the probability of characters in other clauses to a higher value.

[0083] Step S203: Generate a first text expression vector according to the first coding sequence and the first associated text.

[0084] Specifically, the video recommendation device first converts the first associated text into a digital vector. The device then performs a weighted operation on the digital vector based on the probability corresponding to each character in the first coding sequence, such as by bitwise multiplication. The weighted result is then processed by an encoder, and the first text expression vector is calculated using a conversion algorithm or machine learning model. Various methods can be used to convert digital vectors, such as one-hot encoding, information retrieval technology, distributed representation, and the Word2vec algorithm.

[0085] Step S204 : determining sentence similarity based on the first text expression vector and the second text expression vector, wherein the second text expression vector is generated based on the second associated text of the historical video, and the historical video is a video that the user has browsed.

[0086] In this embodiment, the video recommendation device calculates the sentence similarity between the texts associated with two videos based on the first and second text expression vectors, thereby assessing the degree of similarity between the two videos. The first text expression vector corresponds to the video to be recommended, while the second text expression vector is the video used as the basis for the video recommendation. This can be a video that the user has watched or favorited, representing the user's preferred content. The second text expression vector is calculated in the same manner as the first text expression vector, using the same algorithm and parameters to prevent external factors from influencing the similarity prediction.

[0087] The calculation of the second text expression vector can be performed simultaneously with the calculation process of the first text expression vector, or can be pre-calculated by the server and stored in a database, and then retrieved from the database for comparison when a recommendation is required.

[0088] Step S205: If the sentence similarity is greater than the recommendation threshold, recommend the video to be recommended to the user.

[0089] In this embodiment, the video recommendation device compares the sentence similarity with the recommendation threshold. If the sentence similarity is greater than the recommendation threshold, it means that the video to be recommended is highly similar to the video that the user has browsed, and therefore, the video to be recommended is recommended to the user.

[0090] It is understandable that the method of the present application can execute the calculation process in a loop multiple times to generate a recommended video sequence, which includes multiple videos recommended according to user preferences, and then recommends multiple videos to be recommended to the user at one time.

[0091] In an embodiment of the present application, the video-associated text is encoded into a sequence of probability values, each probability value representing the probability that the corresponding character is a valid character, and a text expression vector is generated based on the encoded sequence and the associated text. Similar videos are then found and recommended to the user based on the generated text expression vector. Through the above-mentioned method, when making video recommendations, the influence of valid characters in the video-associated text on the recommendation results can be amplified, while the influence of invalid characters on the recommendation results can be reduced. As a result, the recommendation results may be too far away from the content of the target video used for recommendation due to invalid characters, thereby improving the accuracy of the recommendation and the user experience.

[0092] In one embodiment of the present application, to obtain a first coding sequence, step S202, encoding the first associated text to obtain the first coding sequence, may include the following steps, which are described in detail below:

[0093] The first associated text is input into a first coding model to obtain a first coding sequence output by the first coding model, wherein the K probability values ​​are composed of M first probability values ​​and N second probability values, the first probability value is used to indicate that the corresponding character is a valid character, and the second probability value is used to indicate that the corresponding character is an invalid character, and both M and N are integers greater than or equal to 0.

[0094] Specifically, the video recommendation device inputs the first associated text into a first encoding model, obtaining a first encoding sequence output by the first encoding model. The first encoding model is a trained machine learning model, specifically a representational text matching model. The video recommendation device first adds "[CLS]" and "[SEP]" to the beginning and end of the first associated text, respectively. For example, if the first associated text is "Take a look at the new version changes! Please click the blue button to follow me," the actual content input into the first encoding model is "[CLS]Take a look at the new version changes! Please click the blue button to follow me [SEP]." The first encoding model is a multi-layer structure, specifically including an embedding layer, an encoder, and a pooling layer. The embedding layer is used to convert the input first associated text into a continuous distributed representation, namely a word embedding or word vector. The encoder is used to perform nonlinear labeling on the embedded representation converted by the embedding layer, while the pooling layer extracts the representation of the "[CLS]" tag as the representation of the entire first associated text. The encoder typically has multiple layers, and the output representation of the last layer and the overall representation of the sequence output by the pooling layer are both the encoder output.

[0095] The embedding layer consists of three components: embedding transformation, layer normalization, and random dropout. The embedding transformation layer converts discrete tokens into low-dimensional dense vectors through linear transformation. Assume that the encoding vector of the first context T is s(L), where L is the length of the first context, meaning there are L tokens in T. If the word embedding length is H, then after the embedding transformation, the hidden state of T is h(L×H).

[0096] Layer normalization is used to normalize along the word embedding dimensions. Specifically, the normalization method is to take the quotient of the difference between the feature value and the mean and the variance, and then add the model parameters to the calculation. The mean and variance are calculated separately for each position of the word embedding for each sample, while the model parameters are shared.

[0097] Dropout is primarily used to mitigate overfitting. Specifically, a hyperparameter is set between 0 and 1, indicating that the output value is randomly set to 0 with probability P. In the case of a miss, the value of this feature in the word embedding is divided by 1-P to maintain the expected value.

[0098] The encoder typically consists of multiple hidden layers connected in series, each with the same structure but sharing no parameters. These hidden layers include linear transformations, activation functions, multi-head self-attention, skip connections, and the layer normalization and random dropout described above. The linear transformations are also fully connected layers, which will not be discussed here. In the first encoding model, the activation function is typically one of the tanh, softmax, and GELU functions; the specifics of these three functions are not discussed here.

[0099] Multi-head self-attention utilizes different self-attention modules to obtain enhanced semantic vectors for each word in the first associated text in different semantic spaces. The multiple enhanced semantic vectors for each word are linearly combined to obtain a final enhanced semantic vector with the same length as the original word vector. The self-attention module is a modified version of the conventional attention module, capable of representing the dependency relationship between the input and itself. The attention module primarily involves query targets, keywords, and values. The target word and its context words each have their own original values. The attention mechanism uses the target word as the query target and each of its context words as keywords. The similarity between the query target and each keyword is used as a weight, integrating the values ​​of each context word into the original value of the target word to output an enhanced semantic vector representation of the target word. The self-attention module uses each word as a query target and weightedly fuses the semantic information of all words in the text to obtain an enhanced semantic vector for each word. The vector representations of the query target, keywords, and values ​​all come from the same input text, thus forming a self-attention module.

[0100] Skip connections, also known as residual connections, skip the output of a layer and directly feed it into a deeper layer, skipping several intermediate layers. In multi-layer models, due to the information loss caused by multiple stacking of nonlinear changes, the information received by the deep network is significantly less than the initial input. Skip connections can propagate the original input information to deeper hidden layers, thereby preventing gradient vanishing or exploding in the neural network.

[0101] The pooling layer takes the representation corresponding to the [CLS] tag, performs some transformations, and returns it as the representation of the entire sequence, as well as returning all the tag representations intact. It is usually a concatenation of a linear transformation and an activation function, and the activation function usually uses the tanh function.

[0102] In the first encoding model, multiple editors are stacked, typically 12 or 24 layers. The output of the previous editor serves as the input to the next editor, and the hidden layer of the final editor is used as the output. The resulting vector contains a probability value for each character in the first associated text. Finally, the output vector is subjected to binary classification using a softmax function, converting it into a sequence of 0s and 1s. 0 represents the first probability value, while 1 represents the second probability value. Characters corresponding to 0 are invalid, while characters corresponding to 1 are valid.

[0103] For illustration purposes, see Figure 3 , Figure 3 Schematic diagram of the first coding model in the embodiment of the present application. Figure 3 As shown, the first encoding model receives "[CLS] Let you know the new version changes! Please click the blue button to follow me [SEP]" (partially omitted) as input, and outputs a sequence of 0 and 1. It can be seen that "Let you know the new version changes" corresponding to 1 is a valid character, and "Please click the blue button to follow me" corresponding to 0 is an invalid character. It can be understood that although the valid characters and invalid characters in the figure appear continuously, in actual situations, valid characters and invalid characters can appear interspersed, for example, when a space or connecting line is added between each word. Therefore, Figure 3 The characters shown are merely an example of valid and invalid characters and are not limiting.

[0104] The training process for the first encoding model is supervised. Specifically, a batch of relevant text is collected from the associated text of existing videos and manually standardized as training data. The first encoding model is trained using this training data, and the cross-entropy function is used as the model's loss function to adjust the model parameters until the loss function converges or meets a preset training criterion, such as the number of iterations. This results in the trained first encoding model.

[0105] In an embodiment of the present application, the valid characters and invalid characters in the associated text of the video are directly identified through the first encoding model, so that the invalid characters can be completely excluded in the subsequent similarity calculation process, thereby minimizing the impact of meaningless fragments on similarity matching, thereby improving the accuracy of video recommendations.

[0106] In one embodiment of the present application, to obtain a first coding sequence, step S202, encoding the first associated text to obtain the first coding sequence, may include the following steps, which are described in detail below:

[0107] The first associated text is input into the second coding model to obtain a first coding sequence output by the second coding model, wherein the value of each probability value in the K probability values ​​is within a preset range, and the probability value greater than or equal to the probability threshold is used to indicate that the corresponding character is a valid character, and the probability value less than the probability threshold is used to indicate that the corresponding character is an invalid character.

[0108] Specifically, the video recommendation device inputs the first associated text into the second encoding model to obtain the first encoding sequence output by the first encoding model. The second encoding model is similar to the first encoding model and is also a trained machine learning model, specifically a characterization text matching model. The second encoding model has the same input as the first encoding model and will not be described here. The output of the second encoding model is a vector, and each word in the vector corresponding to the first associated text includes a probability value. The probability value is usually normalized to a decimal between 0 and 1. By comparing the probability value corresponding to each character with a preset valid probability threshold, it can be determined whether the corresponding character is a valid character. Specifically, if the probability threshold is 0.5, then characters with a probability greater than 0.5 are valid characters, while characters with a probability less than 0.5 are invalid characters.

[0109] For illustration purposes, see Figure 4 , Figure 4 This is another schematic diagram of the first coding model in the embodiment of the present application. Figure 4As shown, the first coding model receives "[CLS] Let you know the new version changes! Please click the blue button to follow me [SEP]" (partially omitted) as input, and outputs a sequence consisting of internal probability values ​​ranging from 0 to 1. If the probability threshold is set to 0.5, it can be seen that the characters "Let you know the new version changes" with a corresponding probability value greater than 0.5 are valid characters, and the characters "Please click the blue button to follow me" with a corresponding probability value less than 0.5 are invalid characters. It can be understood that although the valid characters and invalid characters in the figure appear continuously, in actual situations, valid characters and invalid characters can appear interspersed, for example, when a space or connecting line is added between each word. Therefore, Figure 4 The characters shown are merely an example of valid and invalid characters and are not limiting.

[0110] In this embodiment, the training process of the first coding model is the same as that described above. Figure 3 What is shown is that the training process in the embodiment is the same and will not be repeated here.

[0111] In an embodiment of the present application, the probabilities of valid characters and invalid characters in the associated text of a video are identified through a first encoding model, so that the similarity of valid characters can be fully considered in the subsequent similarity calculation process. While reducing the influence of invalid characters, all characters in the associated text are fully considered, thereby improving the rationality of video recommendations.

[0112] In one embodiment of the present application, the first text expression vector is generated by a first sub-model of a similarity matching model; in order to obtain the second encoding sequence, before determining sentence similarity based on the first text expression vector and the second text expression vector in step S204, the method further includes the following steps:

[0113] Acquire a second associated text of the historical video, wherein the second associated text includes at least one character;

[0114] performing encoding processing on the second associated text to obtain a second encoding sequence, wherein the second encoding sequence includes at least one probability value, each probability value corresponding to a character;

[0115] The second encoding sequence and the second associated text are input into the second sub-model of the similarity matching model to generate the second text expression vector.

[0116] Specifically, the video recommendation device retrieves second associated text from videos stored on the server. Similar to the first associated text, the second associated text can be a title or description of a historical video. Typically, the second associated text and the first associated text are the same data type, for example, both being video titles or both being video descriptions. Historical videos refer to videos stored on the server other than the video to be recommended.

[0117] After obtaining the second associated text, the video recommendation device encodes the second associated text to obtain a second code sequence. Specifically, the encoding method for the second associated text is the same as the encoding method for the first associated text. When a machine learning model is used to encode the first associated text, the same machine learning model is used to encode the second associated text. Therefore, the second code sequence has the same format as the first code sequence, namely, both are code sequences composed of 0s and 1s, or both are code sequences including probability values.

[0118] After obtaining the second coding sequence, the video recommendation device inputs the second coding sequence and the second associated text into the second sub-model of the similarity matching model to generate a second text expression vector. Specifically, the second sub-model is a trained expression vector model, and the video recommendation device inputs the second coding sequence and the second associated text into the trained expression vector model to calculate the second text expression vector. It should be noted that the method of generating the first text expression vector and the method of generating the second text expression vector are the same, that is, the first sub-model and the second sub-model of the similarity matching model are the same model, and the two sub-models will share weights, that is, the similarity matching model is a twin network with two sub-models.

[0119] For ease of introduction, see Figure 5 , Figure 5 Schematic diagram of the expression vector model in the embodiment of this application. Figure 5 As shown, the expression vector model is trained based on the first encoding model. The trained first encoding model receives "[CLS] Let you know the new version changes! Please click the blue button to follow me [SEP]" (partially omitted) and the corresponding encoding sequence as input. The encoding sequence includes the probability value corresponding to each character. It can be seen that the characters "Let you know the new version changes" with a corresponding probability value greater than 0.5 are valid characters, while the characters "Please click the blue button to follow me" with a corresponding probability value less than 0.5 are invalid characters. The first encoding model outputs a final expression vector as the text expression vector of the input sentence. It can be understood that although only one expression vector model is shown in the figure, there is actually another identical expression vector model used to generate a text expression vector for another sentence.

[0120] Although the figure shows that the first coding model receives probability values ​​as input, the first coding model can also receive a coding sequence composed of identifiers of 0 and 1 as input. Its structure and output are the same as the above-mentioned model that takes probability values ​​as input, and will not be repeated here.

[0121] In an embodiment of the present application, before determining the sentence similarity, the first text expression vector and the second text expression vector are calculated, and the calculation process can be carried out synchronously, thereby ensuring the real-time nature of the second text expression vector. Compared with the method of pre-calculation and storage, it can avoid recommendation errors caused by changes in associated texts that cause mismatches between the expression vector and the actual text, thereby improving the stability of video recommendations.

[0122] In one embodiment of the present application, to determine sentence similarity, step S204. Determining sentence similarity based on the first text expression vector and the second text expression vector may include the following steps:

[0123] Calculating the cosine similarity between the first text expression vector and the second text expression vector;

[0124] The sentence similarity is determined according to the cosine similarity and a similarity threshold.

[0125] In this embodiment, a method for outputting sentence similarity based on a fully connected layer is introduced. After obtaining a first text expression vector and a second text expression vector based on an expression vector model, the cosine similarity of the first text expression vector and the second text expression vector can be calculated. For ease of understanding, the first text expression vector is introduced as having 5 dimensions and the second text expression vector is also having 5 dimensions. It should be noted that in actual applications, the first feature vector and the second feature vector can be of any dimension. This is only an illustration and should not be understood as a limitation of this application.

[0126] Specifically, assuming the first text expression vector is (3, 1, 1, 2, 2, 1, 0) and the second text expression vector is (3, 1, 1, 2, 2, 0, 1), the inner product of the two text expression vectors is 19, and the module length product is 20, then the cosine similarity is 19 / 20 = 0.95. If the similarity threshold is 0.5, the sentence similarity is determined to be 1.

[0127] It is understandable that if the cosine similarity is closer to 1, it means that the first associated text and the second associated text are more similar. Conversely, if the similarity score is closer to 0, it means that the first associated text and the second associated text are more different.

[0128] In an embodiment of the present application, a method for determining sentence similarity based on cosine similarity is provided. Through the above method, the difference between two related texts is reflected using the cosine theorem, which is conducive to outputting more accurate judgment results.

[0129] In one embodiment of the present application, to determine sentence similarity, step S204. Determining sentence similarity based on the first text expression vector and the second text expression vector may include the following steps:

[0130] Obtaining first training data and second training data, wherein the first training data includes a first training text and a first training sequence, and the second training data includes a second training text and a second training sequence;

[0131] Inputting the first training data into a first expression vector model included in the matching model to be trained, to obtain a first expression result output by the first expression vector model;

[0132] Inputting the second training data into a second expression vector model included in the matching model to be trained, to obtain a second expression result output by the second expression vector model, wherein the first expression vector model and the second expression vector model share a network weight;

[0133] Inputting the first expression result and the second expression result into the similarity matching model of the matching model to be trained to obtain a predicted matching result;

[0134] The matching model to be trained is trained according to the predicted matching result and the actual matching result to obtain the similar matching model.

[0135] In an embodiment of the present application, a method for training a similarity matching model is described. Specifically, the first training text and the second training text can be real data randomly collected from a database. The first training sequence and the second training sequence can be obtained through manual annotation or encoded using a trained first encoding model or a trained second encoding model.

[0136] The matching model to be trained is a twin structure, which includes a first expression vector model and a second expression vector model, and the first expression vector model and the second expression vector model share network weights. The expression vector model can specifically adopt the first encoding model mentioned above.

[0137] The first training data is input into the first expression vector model included in the matching model to be trained to obtain the first expression result output by the first expression vector model, and the second training data is input into the second expression vector model included in the matching model to be trained to obtain the second expression result output by the second expression vector model. The cosine similarity is calculated based on the first expression result and the second expression result to determine the similarity of the two training texts as the predicted matching result. Finally, based on the predicted similarity and the manually annotated similarity, the parameters of the matching model to be trained are adjusted by the square loss function to obtain a similar matching model. Specifically, the basic form of the square loss function is as follows:

[0138]

[0139] Among them, w(θ) is the weight of the similarity of manual annotation, y is the similarity of manual annotation, is the predicted similarity. It can be seen that the minimum value of the squared loss function is 0. The smaller the difference between the predicted similarity and the manually annotated similarity, the closer the squared loss function result is to 0. Therefore, the parameters of the first expression vector model and the second expression model in the training matching model are tuned to minimize the squared loss function. At this time, the result obtained by the training matching model is the optimal result, and the training matching model in this state is used as the similarity matching model.

[0140] It is understood that the loss function used in this embodiment is only an example and not a limitation. In a specific implementation, other suitable loss functions may also be used, such as contrast loss function, cross entropy loss or absolute loss function, and this application does not limit this.

[0141] For ease of introduction, see Figure 6 , Figure 6 This is the training structure of the similarity matching model in the embodiment of this application. Figure 6 As shown in the figure, in the similarity matching model, the two submodules output the expression vectors of the two sentences respectively, then calculate the cosine similarity, and finally train according to the square loss function.

[0142] In one embodiment, other layers may be included in the similarity matching model. For example, an output layer such as a fully connected layer or a softmax layer may be added depending on the method of similarity calculation.

[0143] In the embodiments of this application, a similarity matching model training method is introduced. Through the above method, the computational efficiency of similarity comparison can be effectively improved through the structure of the twin network, and the feasibility of the solution can be improved.

[0144] In one embodiment of the present application, in order to obtain training data, the above steps of obtaining the first training data and the second training data may further include the following steps:

[0145] Acquire an invalid text segment set, wherein the invalid text segment set includes at least a first invalid text segment and a second invalid text segment;

[0146] Acquire video text data, wherein the video text data includes a first video text, a second video text, and a similarity identifier;

[0147] If the similarity indicator indicates that the first video text is not similar to the second video text, generating the first training text based on the first video text and the first invalid text segment, and generating the second training text based on the second video text and the second invalid text segment;

[0148] If the similarity indicator indicates that the first video text is similar to the second video text, the first training text is generated based on the first video text and the first invalid text segment, and the second training text is generated based on the second video text and the first invalid text segment.

[0149] Specifically, the invalid text segment set can encode the title or introduction of the video stored in the database through a trained encoding model, and then use the text corresponding to the identified invalid characters as the invalid text segment, the invalid text segment set.

[0150] Then, video text data is obtained, which includes a first video text, a second video text, and a similarity indicator. The first video text and the second video text can be related text directly obtained from existing videos. The similarity indicator can be manually identified and can be 1 or 0. 1 indicates that the first video text and the second video text are similar, and 0 indicates that they are not similar.

[0151] For the case where the similarity is identified as 1, the first video text and the second video text are respectively combined with different invalid text segments to form the first training text and the second training text. For the case where the similarity is identified as 0, the first video text and the second video text are respectively combined with the same invalid text segment to form the first training text and the second training text. Specifically, for example, for the first video text p and the second video text q, if p is similar to q, then two different invalid text segments m and m are extracted from the invalid text segment set D, then the first training text is p+m, and the second training text is q+n. Correspondingly, if p is not similar to q, then an invalid text segment u is extracted from the invalid text segment set D, then the first training text is p+u, and the second training text is q+u.

[0152] The mode of generating training text according to video text and invalid text segment can directly adopt the mode of string splicing, and the order of splicing can be selected arbitrarily.In one embodiment, invalid text segment can also be inserted in the video text to generate training text.

[0153] In an embodiment of the present application, a method for enhancing training text is provided. By the above method, the proportion of invalid text segments in the training text can be increased, thereby improving the fault tolerance of the similarity matching model, thereby improving the anti-interference ability of the method and enhancing stability.

[0154] It should be noted that although the steps of the method of the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all steps must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0155] The following describes an implementation of the device of the present application, which can be used to execute the video recommendation method in the above-mentioned embodiment of the present application. Figure 7 The block diagram of the video recommendation device in the embodiment of the present application is schematically shown. Figure 7 As shown, the video recommendation device 300 may mainly include:

[0156] According to one aspect of an embodiment of the present application, a video recommendation device is provided, including:

[0157] A first text acquisition module 310 is configured to acquire a first associated text of the video to be recommended, wherein the first associated text includes K characters, where K is an integer greater than or equal to 1;

[0158] A first encoding processing module 320 is configured to encode the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponding to a character, and the probability value is used to represent the probability that the character corresponding to the element is a valid character;

[0159] A first expression generating module 330 is configured to generate a first text expression vector according to the first coding sequence and the first associated text;

[0160] a similarity module 340 for determining sentence similarity based on the first text expression vector and the second text expression vector, wherein the second text expression vector is generated based on a second associated text of a historical video, the historical video being a video viewed by the user;

[0161] The recommendation module 350 is configured to recommend the video to be recommended to the user if the sentence similarity is greater than a recommendation threshold.

[0162] In some embodiments of the present application, based on the above technical solution, the first encoding processing module 320 includes:

[0163] A second input unit is used to input the first associated text into a first encoding model to obtain a first encoding sequence output by the first encoding model, wherein the K probability values ​​are composed of M first probability values ​​and N second probability values, the first probability value is used to indicate that the corresponding character is a valid character, and the second probability value is used to indicate that the corresponding character is an invalid character, and both M and N are integers greater than or equal to 0.

[0164] In some embodiments of the present application, based on the above technical solution, the first encoding processing module 320 includes:

[0165] A first input unit is used to input the first associated text into a second encoding model to obtain a first encoding sequence output by the second encoding model, wherein the value of each probability value in the K probability values ​​is within a preset range, and the probability value greater than or equal to the probability threshold is used to indicate that the corresponding character is a valid character, and the probability value less than the probability threshold is used to indicate that the corresponding character is an invalid character.

[0166] In some embodiments of the present application, based on the above technical solution, the first text expression vector is generated by a first sub-model of a similarity matching model; the video recommendation device 300 further includes:

[0167] A second text acquisition module, configured to acquire a second associated text of the historical video, wherein the second associated text includes at least one character;

[0168] A second encoding processing module is configured to perform encoding processing on the second associated text to obtain a second encoding sequence, wherein the second encoding sequence includes at least one probability value, each probability value corresponding to a character;

[0169] The second expression generation module is used to input the second encoding sequence and the second associated text into the second sub-model of the similarity matching model to generate the second text expression vector.

[0170] In some embodiments of the present application, based on the above technical solution, the similarity module 340 includes:

[0171] a similarity calculation unit, configured to calculate the cosine similarity between the first text expression vector and the second text expression vector;

[0172] The similarity determination unit is configured to determine the sentence similarity based on the cosine similarity and a similarity threshold.

[0173] In some embodiments of the present application, based on the above technical solution, the video recommendation device 300 further includes:

[0174] A training data acquisition module, configured to obtain first training data and second training data, wherein the first training data includes a first training text and a first training sequence, and the second training data includes a second training text and a second training sequence;

[0175] A first expression result module is configured to input the first training data into a first expression vector model included in a matching model to be trained, and obtain a first expression result output by the first expression vector model;

[0176] A second expression result module is configured to input the second training data into a second expression vector model included in the matching model to be trained, and obtain a second expression result output by the second expression vector model, wherein the first expression vector model and the second expression vector model share a network weight;

[0177] a similarity prediction module, configured to input the first expression result and the second expression result into a similarity matching model of the matching model to be trained to obtain a predicted matching result;

[0178] The model training module is used to train the matching model to be trained based on the predicted matching result and the actual matching result to obtain the similar matching model.

[0179] In some embodiments of the present application, based on the above technical solution, the training data acquisition module includes:

[0180] an invalid segment acquisition unit, configured to acquire an invalid text segment set, wherein the invalid text segment set includes at least a first invalid text segment and a second invalid text segment;

[0181] A video text acquisition unit, configured to acquire video text data, wherein the video text data includes a first video text, a second video text, and a similarity identifier;

[0182] a first text generating unit configured to generate a first training text based on the first video text and the first invalid text segment, and generate a second training text based on the second video text and the second invalid text segment, if the similarity identifier indicates that the first video text and the second video text are not similar;

[0183] A second text generation unit is configured to generate the first training text based on the first video text and the first invalid text segment, and generate the second training text based on the second video text and the first invalid text segment, if the similarity identifier indicates that the first video text is similar to the second video text.

[0184] It should be noted that the apparatus provided in the above embodiment and the method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module performs the operation has been described in detail in the method embodiment and will not be repeated here.

[0185] Figure 8 A schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application is shown.

[0186] It should be noted that Figure 8 The computer system 400 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0187] like Figure 8 As shown, computer system 400 includes a central processing unit (CPU) 401, which can perform various appropriate actions and processes according to programs stored in read-only memory (ROM) 402 or programs loaded from storage unit 408 into random access memory (RAM) 403. Various programs and data required for system operation are also stored in RAM 403. CPU 401, ROM 402, and RAM 403 are connected to each other via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.

[0188] The following components are connected to the I / O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the I / O interface 405 as needed. Removable media 411, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 410 as needed, so that computer programs read therefrom can be installed into the storage section 408 as needed.

[0189] In particular, according to an embodiment of the present application, the processes described in the various method flow charts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the methods shown in the flow charts. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 409, and / or installed from a removable medium 411. When the computer program is executed by the central processing unit (CPU) 401, the various functions defined in the system of the present application are executed.

[0190] It should be noted that the computer-readable medium shown in the embodiments of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0191] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of the boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0192] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0193] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present application.

[0194] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.

[0195] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A video recommendation method, characterized in that: include: Obtaining first training data and second training data, wherein the first training data and the second training data are obtained based on a set of invalid text segments and video text data; Inputting the first training data into a first expression vector model included in the matching model to be trained, to obtain a first expression result output by the first expression vector model; Inputting the second training data into a second expression vector model included in the matching model to be trained, to obtain a second expression result output by the second expression vector model, wherein the first expression vector model and the second expression vector model share a network weight; Inputting the first expression result and the second expression result into the similarity matching model of the matching model to be trained to obtain a predicted matching result; Training the matching model to be trained based on the predicted matching result and the actual matching result to obtain a similar matching model; Obtaining a first associated text of the video to be recommended, wherein the first associated text includes K characters, where K is an integer greater than or equal to 1; Encoding the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponds to a character, and the probability value is used to represent the probability that the corresponding character is a valid character; generating a first text expression vector according to the first coding sequence and the first associated text, wherein the first text expression vector is generated by the similarity matching model; determining text similarity based on the first text expression vector and the second text expression vector, wherein the second text expression vector is generated by the similarity matching model based on a second associated text of a historical video, where the historical video is a video viewed by the user; If the text similarity is greater than the recommendation threshold, the video to be recommended is recommended to the user.

2. The method according to claim 1, characterized in that The encoding process of the first associated text to obtain a first encoding sequence includes: The first associated text is input into a first coding model to obtain a first coding sequence output by the first coding model, wherein the K probability values ​​are composed of M first probability values ​​and N second probability values, the first probability value is used to indicate that the corresponding character is a valid character, and the second probability value is used to indicate that the corresponding character is an invalid character, and both M and N are integers greater than or equal to 0.

3. The method according to claim 1, characterized in that The encoding process of the first associated text to obtain a first encoding sequence includes: The first associated text is input into the second coding model to obtain a first coding sequence output by the second coding model, wherein the value of each probability value in the K probability values ​​is within a preset range, and the probability value greater than or equal to the probability threshold is used to indicate that the corresponding character is a valid character, and the probability value less than the probability threshold is used to indicate that the corresponding character is an invalid character.

4. The method according to claim 1, wherein Before determining the text similarity based on the first text expression vector and the second text expression vector, the method further includes: Acquire a second associated text of the historical video, wherein the second associated text includes at least one character; performing encoding processing on the second associated text to obtain a second encoding sequence, wherein the second encoding sequence includes at least one probability value, each probability value corresponding to a character; The second encoding sequence and the second associated text are input into the second sub-model of the similarity matching model to generate the second text expression vector.

5. The method according to any one of claims 1 to 4, characterized in that The determining of text similarity based on the first text expression vector and the second text expression vector includes: Calculating the cosine similarity between the first text expression vector and the second text expression vector; The text similarity is determined according to the cosine similarity and a similarity threshold.

6. The method according to claim 1, wherein The method further comprises: The first training data includes a first training text and a first training sequence, and the second training data includes a second training text and a second training sequence.

7. The method according to claim 6, characterized in that The obtaining of the first training data and the second training data includes: Acquire an invalid text segment set, wherein the invalid text segment set includes at least a first invalid text segment and a second invalid text segment; Acquiring video text data, wherein the video text data includes a first video text, a second video text, and a similarity identifier; If the similarity indicator indicates that the first video text is not similar to the second video text, generating the first training text based on the first video text and the first invalid text segment, and generating the second training text based on the second video text and the second invalid text segment; If the similarity indicator indicates that the first video text is similar to the second video text, the first training text is generated based on the first video text and the first invalid text segment, and the second training text is generated based on the second video text and the first invalid text segment.

8. A video recommendation device, characterized in that: include: A training data acquisition module, configured to obtain first training data and second training data, wherein the first training data and the second training data are obtained based on a set of invalid text segments and video text data; A first expression result module is configured to input the first training data into a first expression vector model included in a matching model to be trained, and obtain a first expression result output by the first expression vector model; A second expression result module is configured to input the second training data into a second expression vector model included in the matching model to be trained, and obtain a second expression result output by the second expression vector model, wherein the first expression vector model and the second expression vector model share a network weight; a similarity prediction module, configured to input the first expression result and the second expression result into a similarity matching model of the matching model to be trained to obtain a predicted matching result; A model training module is used to train the matching model to be trained based on the predicted matching results and the actual matching results to obtain a similar matching model; A first text acquisition module, configured to acquire a first associated text of the video to be recommended, wherein the first associated text includes K characters, where K is an integer greater than or equal to 1; a first encoding processing module, configured to encode the first associated text to obtain a first encoding sequence, wherein the first encoding sequence includes K probability values, each probability value corresponding to a character, and the probability value is used to represent a probability that the character corresponding to the element is a valid character; a first expression generation module, configured to generate a first text expression vector according to the first coding sequence and the first associated text, wherein the first text expression vector is generated by the similarity matching model; a similarity module, configured to determine text similarity based on the first text expression vector and a second text expression vector, wherein the second text expression vector is generated by the similarity matching model based on a second associated text of a historical video, the historical video being a video viewed by the user; A recommendation module is configured to recommend the video to be recommended to the user if the text similarity is greater than a recommendation threshold.

9. An electronic device, characterized in that: include: processor; a memory for storing executable instructions of the processor; The processor is configured to execute the video recommendation method according to any one of claims 1 to 7 by executing the executable instructions.

10. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the video recommendation method according to any one of claims 1 to 7 is implemented.

11. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the video recommendation method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Video recommendation method and device, information processing equipment and storage medium

    CN109800328A

  • Information processing method and device, electronic equipment and storage medium

    CN112434510A