Text recommendation method, device, equipment and medium

By generating and processing text feature matrix and calculating similarity information between texts, the problem of large amount of content recommendation algorithms in the prior art is solved, and the rapid and accurate text recommendation effect is achieved.

CN114297501BActive Publication Date: 2025-03-21CHINA CONSTRUCTION BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111649278.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-29
Publication Date
2025-03-21
Estimated Expiration
2041-12-29

AI Technical Summary

Technical Problem

In the prior art, the content recommendation algorithm has a large calculation effort and it is difficult to accurately and quickly recommend similar text to users.

Method used

By obtaining the text features of multiple texts, determining the feature vector and generating a feature matrix, the sub-eigen matrix is ​​further determined to calculate the similarity information between texts, and finally recommending similar texts based on the similarity information.

Benefits of technology

It realizes that when the text data volume is large and the CPU resources are limited, the text similarity information calculation efficiency is improved, and similar text is recommended to users accurately and quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114297501B_ABST
    Figure CN114297501B_ABST
Patent Text Reader

Abstract

The present application provides a text recommendation method, device, equipment and medium, which relates to the field of natural language processing technology, by obtaining the text features of each text in multiple texts; determining the feature vector of each text according to the text features of each text, and generating the feature matrix of the multiple texts according to the feature vector of each text; determining the sub-feature matrix of the multiple texts according to the feature matrix of the multiple texts, and determining the similarity information between the multiple texts according to the sub-feature matrix of the multiple texts; wherein the number of the sub-feature matrices is at least two; determining the text to be recommended in the text in the preset text library according to the similarity information, and recommending the text to be recommended to the user. The technical solution can accurately and quickly recommend similar texts to users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a text recommendation method, device, equipment and medium. Background Art

[0002] At present, the data information on the Internet is relatively complicated, and users need to read a lot of useless data information when viewing the data information they need. Therefore, how to recommend information similar to the user's interest preferences to users is a problem that the public is more concerned about.

[0003] In the current methods for recommending similar content to users, the computational complexity of the content recommendation algorithm used is relatively large. Therefore, there is an urgent need for a text recommendation method that can accurately and quickly recommend similar texts to users. Summary of the invention

[0004] The present application provides a text recommendation method, apparatus, device and medium, which can accurately and quickly recommend similar texts to users.

[0005] In a first aspect, the present application provides a text recommendation method, the method comprising:

[0006] Obtaining text features of each of the multiple texts;

[0007] Determine a feature vector of each text according to the text feature of each text, and generate a feature matrix of the plurality of texts according to the feature vector of each text;

[0008] Determine sub-feature matrices of the multiple texts according to the feature matrices of the multiple texts, and determine similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two;

[0009] According to the similarity information, a text to be recommended in the texts in the preset text library is determined, and the text to be recommended is recommended to the user.

[0010] In one example, determining sub-feature matrices of the plurality of texts according to the feature matrices of the plurality of texts includes:

[0011] Determine a transposed matrix of the feature matrix according to the feature matrices of the plurality of texts;

[0012] Determining a sub-feature matrix of the feature matrix according to the feature matrices of the plurality of texts;

[0013] Determine a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of the plurality of texts;

[0014] The sub-feature matrix of the feature matrix and the sub-feature matrix of the transposed matrix of the feature matrix are used as the sub-feature matrices of the multiple texts.

[0015] In one example, determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts includes:

[0016] Determine first cosine similarity information between each sub-feature matrix of each text of the feature matrix and each sub-feature matrix of each text of the transposed matrix of the feature matrix;

[0017] Determine second cosine similarity information between the plurality of texts according to the first cosine similarity information;

[0018] The similarity information between the multiple texts is determined according to the second cosine similarity information.

[0019] In one example, the text feature includes text content and text label, and the text label represents a characteristic attribute of the text; if the text feature is text content, determining a feature vector of each text according to the text feature of each text includes:

[0020] Obtaining word information in the text content of each of the texts;

[0021] Determine a word vector of the word information according to the word information; wherein the word vector represents semantic information of the word information;

[0022] According to the word vector, the central vector of each text is determined, and the central vector of each text is used as the feature vector of each text.

[0023] In one example, the text feature includes text content and text labels, and the text labels represent characteristic attributes of the text; if the text feature is a text label, determining a feature vector of each text according to the text feature of each text includes:

[0024] Obtaining frequency information and category information in the text label of each text;

[0025] A label vector of each text is determined according to the frequency information and the category information, and the label vector of each text is used as a feature vector of each text.

[0026] In one example, determining the text to be recommended in the texts in the preset text library according to the similarity information includes:

[0027] Filtering a preset number of texts from a preset text library according to the similarity information;

[0028] According to the relationship between the similarity information of a preset number of texts and the similarity information of the remaining number of texts, the texts to be recommended in the texts in the preset text library are determined.

[0029] In a second aspect, the present application provides a text recommendation device based on text similarity values, the device comprising:

[0030] An acquisition unit, used for acquiring text features of each of the multiple texts;

[0031] A generating unit, configured to determine a feature vector of each text according to a text feature of each text, and generate a feature matrix of the plurality of texts according to the feature vector of each text;

[0032] A determination unit, configured to determine sub-feature matrices of the plurality of texts according to the feature matrices of the plurality of texts, and determine similarity information between the plurality of texts according to the sub-feature matrices of the plurality of texts; wherein the number of the sub-feature matrices is at least two;

[0033] The recommendation unit is used to determine the text to be recommended in the texts in the preset text library according to the similarity information, and recommend the text to be recommended to the user.

[0034] In one example, the determining unit includes:

[0035] A first determining module, configured to determine a transposed matrix of the feature matrix according to the feature matrices of the plurality of texts;

[0036] A second determination module, configured to determine a sub-feature matrix of the feature matrix according to the feature matrices of the plurality of texts;

[0037] A third determining module is used to determine a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of the plurality of texts;

[0038] The fourth determining module is configured to use the sub-feature matrix of the feature matrix and the sub-feature matrix of the transposed matrix of the feature matrix as the sub-feature matrices of the multiple texts.

[0039] In one example, the determining unit includes:

[0040] The similarity information determination module is used to determine the first cosine similarity information between each sub-feature matrix of each text of the feature matrix and each sub-feature matrix of each text of the transposed matrix of the feature matrix; determine the second cosine similarity information between the multiple texts according to the first cosine similarity information; and determine the similarity information between the multiple texts according to the second cosine similarity information.

[0041] In one example, if the text feature is text content, the generating unit includes:

[0042] A first acquisition module, used to acquire word information in the text content of each text;

[0043] A first determination module is used to determine a word vector of the word information according to the word information; wherein the word vector represents the semantic information of the word information;

[0044] The second determination module is used to determine the central vector of each text according to the word vector, and use the central vector of each text as the feature vector of each text.

[0045] In one example, if the text feature is a text label, the generating unit includes:

[0046] A second acquisition module is used to acquire frequency information and category information in the text label of each text;

[0047] The third determination module is used to determine the label vector of each text according to the frequency information and the category information, and use the label vector of each text as the feature vector of each text.

[0048] In one example, the recommendation unit includes:

[0049] A screening module, used to screen out a preset number of texts in a preset text library according to the similarity information;

[0050] The determination module is used to determine the text to be recommended in the text in the preset text library according to the relationship between the similarity information of the preset number of texts and the similarity information of the remaining number of texts.

[0051] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0052] The memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method as described in the first aspect.

[0053] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0054] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the method described in the first aspect when executed by a processor.

[0055] The present application provides a text recommendation method, device, equipment and medium, which obtains the text features of each text in multiple texts; determines the feature vector of each text according to the text features of each text, and generates the feature matrix of the multiple texts according to the feature vector of each text; determines the sub-feature matrix of the multiple texts according to the feature matrix of the multiple texts, and determines the similarity information between the multiple texts according to the sub-feature matrix of the multiple texts; wherein the number of the sub-feature matrix is ​​at least two; determines the text to be recommended in the text in the preset text library according to the similarity information, and recommends the text to be recommended to the user. By adopting this technical solution, each text can be divided into blocks according to the text features of each text and the feature vector generated by the text features, so that similar texts can be accurately and quickly recommended to the user when the amount of text data is relatively large. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0057] Figure 1 It is a flowchart of a text recommendation method provided according to the first embodiment of the present application;

[0058] Figure 2 It is a flowchart of a text recommendation method provided according to the second embodiment of the present application;

[0059] Figure 3 is a schematic diagram of a text recommendation device based on text similarity values ​​provided according to Embodiment 3 of the present application;

[0060] Figure 4 is a schematic diagram of a text recommendation device based on text similarity values ​​provided according to Embodiment 4 of the present application;

[0061] Figure 5 The present invention is a block diagram of a terminal device according to an exemplary embodiment.

[0062] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0063] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0064] The present application provides a text recommendation method, device, equipment and medium, aiming to solve the above technical problems in the prior art.

[0065] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0066] Figure 1 This is a flowchart of a text recommendation method provided according to Example 1 of the present application. Example 1 includes the following steps:

[0067] S101: Obtain text features of each of a plurality of texts.

[0068] Exemplarily, text features include text content and text labels. The text content is composed of multiple words in the text. After the text content is obtained, the text content is segmented and removed. Among them, the removal of words includes the removal of stop words, adverbs, auxiliary words, punctuation marks, prepositions and some conjunctions. After the segmentation and removal of words, valid words are obtained, and the text features are composed of valid words. The text label is composed of multiple hierarchical labels. The labels of different levels are belonging relationships, and the labels are independent of each other. For example, the hierarchical labels can be divided into three layers; among them, the first layer of labels can be finance, stocks, Internet finance, trust, entertainment, movies, TV series and European and American stars; the second layer of labels are high-yield stocks, stable stocks and movies adapted from novels; the third layer is stock code 000000, stock code 000001 and "Jane Eyre".

[0069] S102 . Determine a feature vector of each text according to the text feature of each text, and generate feature matrices of multiple texts according to the feature vector of each text.

[0070] In this embodiment, the process in which the text feature is the text content and the process in which the text feature is the feature vector of each text determined by the text label are different.

[0071] Specifically, when the text feature is text content, the algorithm used to determine the feature vector of each text is Word2vec; when the text feature is a text tag, the algorithm used to determine the feature vector of each text is tag2vec.

[0072] After obtaining the feature vector of each text, the feature vectors of each text can be combined to obtain the feature matrix of multiple texts. For example, assuming that the number of multiple texts is N and the feature vector of each text is m i , where i ranges from 1 to N. Assume that the eigenvector is m i The vector dimension is d, then the feature matrix of N texts is M∈R N×d .

[0073] S103, determining sub-feature matrices of the multiple texts according to the feature matrices of the multiple texts, and determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two.

[0074] In this embodiment, based on the feature matrices of multiple texts, sub-feature matrices of multiple texts are determined according to a preset dimension. For example, the feature matrices of N texts are M∈R N×d , the sub-feature matrix can be Mi, where the range of i is 1-k1, then After the sub-feature matrix is ​​obtained, similarity information between multiple texts can be calculated based on the sub-feature matrix. Furthermore, the number of sub-feature matrices is the same as the number of preset dimensions.

[0075] S104: Determine the text to be recommended from the texts in the preset text library according to the similarity information, and recommend the text to be recommended to the user.

[0076] In this embodiment, based on the similarity information, a first preset number of texts are screened out from a preset text library;

[0077] According to the relationship between the similarity information of the second preset number of texts and the similarity information of the third preset number of texts, the texts to be recommended in the texts in the preset text library are determined; wherein the sum of the second preset number and the third preset number is equal to the first preset number.

[0078] Exemplarily, when recommending texts to be recommended to users, a first preset number of texts are screened out in a preset text library according to similarity information; wherein, if the number of texts in the preset text library is N, then the first preset number of texts screened out is n*k, and the second preset number of texts is k, then the algorithm used to calculate the similarity information of the second preset number of texts is the wmd algorithm. The algorithm used to calculate the similarity information of the third preset number of texts, i.e., the similarity information of n*kk texts, is the rwmd algorithm.

[0079] Furthermore, the wmd algorithm is a new method to measure text similarity. For two texts D1 and D2, the words in each text are mapped to the embedding space using the word2vec algorithm, and each word in D1 can find a corresponding word in D2, that is, find the distance between each pair of words in the embedding space, and the minimum sum of the distances of all word pairs is wmd.

[0080] The mathematical formula is:

[0081]

[0082]

[0083] in, is the weight of word i in text d, c i is the frequency of word i in text d, c(i,j) is the travel cost of word i, j, c(i,j) = ‖x i -x j ‖, x i , x j are word i and word vector after jembedding. The time complexity of wmd calculation is O(P 3 logP), where P is the number of non-repeated words in the text.

[0084] Specifically, the calculation process of the trimming wmd algorithm is as follows:

[0085] Since the time complexity of wmd calculation efficiency is O(P 3 logP), where P is the total number of words. In this embodiment, the pruned wmd algorithm is used to filter out the k most similar texts for each text from the full text. rwmd is based on the wmd objective function, removes one of the two constraints respectively, and then solves the minimum value, and uses the maximum of the two minimum values ​​as the approximate value of wmd. Therefore, wmd needs to be calculated twice.

[0086] For example, if we remove the second constraint, the problem becomes:

[0087]

[0088]

[0089] Obviously, the optimal solution to this problem becomes:

[0090] For a word in text D1, find the closest word in another text D2 and transfer all to this word, that is:

[0091]

[0092] Use l1(d,d ′ ), l2(d,d ′ ) represent the minimum values ​​calculated by removing different constraints, and the final minimum value of rwmd is l r (d,d ′ )=max(l1(d,d ′ ),l2(d,d ′ )), where the computational time complexity of rwmd is O(P 2 ). rwmd is closer to wmd than the cosine distance of the text center vector.

[0093] The specific process is:

[0094] According to the similarity information, n*k most similar texts are selected from the full text N, where n is a hyperparameter; for each text, the wmd of the text content and the wmd of the text label of the first k texts are calculated respectively, according to the formula The wmd similarity information of the text content and the wmd similarity information of the text tag are obtained, and the similarity information of the second preset number of texts is obtained according to the weighted average of the wmd similarity information of the text content and the text tag, and the second preset number of texts is used as the KNN list of each text.

[0095] For each text, calculate the rwmd of the remaining n*KK text contents and the rwmd of the text label, according to the formula The text content rwmd similarity and the text tag rwmd similarity are obtained, and similarity information of a third preset number of texts is obtained by weighted average based on the similarity information of the text content and the text tag.

[0096] According to the relationship between the similarity information of the second preset number of texts and the similarity information of the third preset number of texts, the texts to be recommended in the texts in the preset text library are determined.

[0097] In this embodiment, the similarity information of the second preset number of texts is compared with the similarity information of the third preset number of texts. If the similarity information of the third preset number of texts is less than the similarity information of the second preset number of texts in the KNN list, they are excluded. Otherwise, the wmd of their text contents and the wmd of their text labels are calculated respectively to obtain the text content wmd similarity information and the text label wmd similarity information. The final similarity information is obtained by weighted average based on the similarity information of the text contents and text labels. If the similarity information of the third preset number of texts is greater than the similarity information of the second preset number of texts in the KNN list, the KNN list is updated.

[0098] The present application provides a text recommendation method, which obtains the text features of each text in multiple texts; determines the feature vector of the text according to the text features of the text, and generates multiple feature matrices of the text according to the feature vector of the text; determines the similarity information between the multiple texts according to the feature matrix of each text in the multiple texts; determines the text to be recommended in the text in the preset text library according to the similarity information, and recommends the text to be recommended to the user. By adopting this technical solution, the calculation efficiency of the similarity information between multiple texts can be improved, the original time complexity can be reduced, and similar texts can be accurately and quickly recommended to users when the amount of text data is large and the CPU resources are limited.

[0099] Figure 2 This is a flowchart of a text recommendation method provided according to Embodiment 2 of the present application. Embodiment 2 includes the following steps:

[0100] S201: Obtain text features of each text in a plurality of texts.

[0101] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0102] S202 . Determine a feature vector of each text according to the text feature of each text, and generate feature matrices of multiple texts according to the feature vector of each text.

[0103] In this embodiment, optionally, the text features include text content and text labels, and the text labels represent characteristic attributes of the text; if the text feature is text content, a feature vector of each text is determined based on the text features of each text, including: obtaining word information in the text content of each text; determining a word vector of the word information based on the word information; wherein the word vector represents semantic information of the word information; determining a central vector of each text based on the word vector, and using the central vector of each text as the feature vector of each text.

[0104] In this embodiment, it is assumed that after the text d is segmented and de-worded, the remaining valid words are w1, w2…, w n , the word frequency corresponding to each word is c1,c2…,c n , the text d can be expressed as [d1,d2…,d n ],in is the weight of word i in a text, where c iIt represents the number of times word i appears in text d, and the denominator represents the total number of words in the text (after removing words). After word segmentation, word removal and normalized bag-of-words model, the weight of each word in text d can be obtained. The word2vec technology is used to build a language model, map words to mathematical space, and form word embedding. The formed word embedding has rich semantic information. The normalized bag-of-words model and word embedding are combined to vectorize the text. The specific combination method is shown in the following mathematical formula to form doc embedding:

[0105] Assume that the word vector of word i is x i , d i Get the normalized word frequency of word i in step 2, According to the cosine similarity distance, the pairwise cosine similarity of the full text is calculated, where the cosine similarity distance is:

[0106]

[0107] In this embodiment, optionally, the text feature includes text content and text label, and the text label represents a characteristic attribute of the text; if the text feature is a text label, a feature vector of each text is determined according to the text feature of each text, including:

[0108] Obtain frequency information and category information in the text label of each text;

[0109] According to the frequency information and category information, the label vector of each text is determined, and the label vector of each text is used as the feature vector of each text.

[0110] In this embodiment, the frequency of all tags in the text is counted and normalized. The specific method is similar to the text content word frequency normalization technology. Assume that all tags of text d are t1, t2..., t n , the frequency corresponding to each label is c1,c2...,c n , the text d can be expressed as [d1, d2…, d n ],in is the weight of label i in text d, where c iRepresents the frequency of tag i in text d (the frequency difference mainly reflects the entity layer, while the tag frequency at the topic layer and concept layer is 1), where the entity layer, topic layer and concept layer are the three levels of tags, and the hierarchical relationship between the three levels is topic layer>concept layer>entity layer. The denominator represents the total number of tags in the text. The embedding of all tags of the text is obtained from tag embedding, and the tag vector of the text is obtained by weighted average with the normalized tag frequency and tag weight. The specific calculation method is as follows: Assume that the vector of tag i is x i , d i To get the normalized frequency of label i, w i The weight of label i, the text label vector can be expressed as:

[0111]

[0112] Based on the cosine similarity distance, calculate the pairwise cosine similarity of all text labels. The cosine similarity distance is:

[0113]

[0114] S203, determining a transposed matrix of a feature matrix according to feature matrices of a plurality of texts; determining a sub-feature matrix of a feature matrix according to the feature matrices of a plurality of texts; determining a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of a plurality of texts; using the sub-feature matrix of the feature matrix and the sub-feature matrix of the transposed matrix of the feature matrix as the sub-feature matrix of the plurality of texts.

[0115] In this embodiment, it is assumed that there are N texts, each of which has a text vector m1, where the vector dimension is d. m1,…,m N Splice into a large matrix M∈R N×d If the CPU resources are large enough, the cosine similarity calculation of N texts can be directly performed by multiplying the N text matrix by the transpose of the N text matrix. The specific formula is:

[0116] simi=M*M t ;

[0117] where simi∈R N×N , where simi(k,q) represents the cosine similarity between text k and text q, and the time complexity is O(1).

[0118] Considering the large amount of text data and limited CPU resources, in order to improve the calculation efficiency, the M matrix is ​​evenly divided into k1 blocks in column order through block matrix multiplication, that is, a matrix composed of multiple sub-feature matrices is obtained:

[0119]

[0120] M t The matrix is ​​evenly divided into k2 blocks in column order, that is, the sub-feature matrix of the transposed matrix of the feature matrix is ​​obtained.

[0121] S204, determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts, including: determining first cosine similarity information between each sub-feature matrix of each text of the feature matrix and each sub-feature matrix of each text of the transposed matrix of the feature matrix; determining second cosine similarity information between the multiple texts according to the first cosine similarity information; and determining similarity information between the multiple texts according to the second cosine similarity information.

[0122] In this embodiment, the cosine similarity of the full text is calculated, which is converted into the M matrix. t The time complexity of multiplying all block matrices is O(k1*k2), where k1<<N, k2<<N. For the specific calculation method, please refer to the pseudo code below. The first layer loops k1 times, and the second layer loops k2 times. The result of each calculation is the cosine similarity result of the (i, j) block:

[0123]

[0124] in The text represented by simi(i,j)(k,q) Cosine similarity, where k1 and k2 are hyperparameters and can be adjusted. simi(i,j) is the first cosine similarity information.

[0125] S205 : Determine the text to be recommended from the texts in the preset text library according to the relationship between the similarity information of the preset number of texts and the similarity information of the remaining number of texts.

[0126] Exemplarily, this step may refer to the above-mentioned step S104 and will not be described in detail.

[0127] The present application provides a text recommendation method, which uses a modified WMD algorithm to calculate text tag WMD similarity information and text content WMD similarity information, and makes full use of text content semantic distance and text tag semantic distance to measure text similarity, thereby improving the accuracy of content-related text recommendation.

[0128] Figure 3 It is a schematic diagram of a text recommendation device based on text similarity value provided according to the third embodiment of the present application.

[0129] The device 30 in the third embodiment includes:

[0130] The acquisition unit 301 is used to acquire the text feature of each text in a plurality of texts.

[0131] The generating unit 302 is used to determine a feature vector of each text according to the text feature of each text, and generate feature matrices of multiple texts according to the feature vector of each text.

[0132] The determination unit 303 is used to determine sub-feature matrices of the multiple texts according to the feature matrices of the multiple texts, and determine similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two.

[0133] The recommendation unit 304 is used to determine the text to be recommended from the texts in the preset text library according to the similarity information, and recommend the text to be recommended to the user.

[0134] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0135] Figure 4 It is a schematic diagram of a text recommendation device based on text similarity value provided according to the fourth embodiment of the present application.

[0136] The device 40 in the fourth embodiment includes:

[0137] The acquisition unit 401 is used to acquire the text feature of each text in a plurality of texts.

[0138] The generating unit 402 is used to determine a feature vector of each text according to the text feature of each text, and generate feature matrices of multiple texts according to the feature vector of each text.

[0139] The determination unit 403 is used to determine sub-feature matrices of the multiple texts according to the feature matrices of the multiple texts, and determine similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two.

[0140] The recommendation unit 404 is used to determine the text to be recommended from the texts in the preset text library according to the similarity information, and recommend the text to be recommended to the user.

[0141] In one example, the determining unit 403 includes:

[0142] The first determination module 4031 is used to determine the transposed matrix of the feature matrix according to the feature matrices of multiple texts.

[0143] The second determining module 4032 is used to determine a sub-feature matrix of the feature matrix according to the feature matrices of the plurality of texts.

[0144] The third determining module 4033 is used to determine a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of the plurality of texts.

[0145] The fourth determining module 4034 is configured to use the sub-feature matrix of the feature matrix and the sub-feature matrix of the transposed matrix of the feature matrix as the sub-feature matrices of the plurality of texts.

[0146] In one example, the determining unit 403 includes:

[0147] The similarity information determination module 4035 is used to determine the first cosine similarity information between each sub-feature matrix of each text of the feature matrix and each sub-feature matrix of each text of the transposed matrix of the feature matrix; determine the second cosine similarity information between multiple texts based on the first cosine similarity information; and determine the similarity information between multiple texts based on the second cosine similarity information.

[0148] In one example, if the text feature is text content, the generating unit 402 includes:

[0149] The first acquisition module 4021 is used to acquire word information in the text content of each text;

[0150] A first determination module 4022 is used to determine a word vector of the word information according to the word information; wherein the word vector represents the semantic information of the word information;

[0151] The second determination module 4023 is used to determine the central vector of each text according to the word vector, and use the central vector of each text as the feature vector of each text.

[0152] In one example, if the text feature is a text label, the generating unit 402 includes:

[0153] The second acquisition module 4024 is used to acquire frequency information and category information in the text label of each text;

[0154] The third determination module 4025 is used to determine the label vector of each text according to the frequency information and the category information, and use the label vector of each text as the feature vector of each text.

[0155] In one example, the recommendation unit 404 includes:

[0156] A screening module 4041 is used to screen out a preset number of texts in a preset text library according to similarity information;

[0157] The determination module 4042 is used to determine the text to be recommended in the texts in the preset text library according to the relationship between the similarity information of the preset number of texts and the similarity information of the remaining number of texts.

[0158] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0159] Figure 5 It is a block diagram of a terminal device according to an exemplary embodiment. The device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0160] Device 500 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .

[0161] The processing component 502 generally controls the overall operation of the device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.

[0162] The memory 504 is configured to store various types of data to support operations on the device 500. Examples of such data include instructions for any application or method operating on the device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0163] The power supply component 506 provides power to the various components of the device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 500.

[0164] The multimedia component 508 includes a screen that provides an output interface between the device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0165] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the device 500 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.

[0166] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0167] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the device 500. For example, the sensor assembly 514 can detect the open / closed state of the device 500, the relative positioning of components, such as the display and keypad of the device 500, the sensor assembly 514 can also detect the position change of the device 500 or a component of the device 500, the presence or absence of user contact with the device 500, the orientation or acceleration / deceleration of the device 500, and the temperature change of the device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0168] The communication component 516 is configured to facilitate wired or wireless communication between the device 500 and other devices. The device 500 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0169] In an exemplary embodiment, the apparatus 500 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above methods.

[0170] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including instructions, and the instructions can be executed by the processor 520 of the device 500 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0171] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of a terminal device, enables the terminal device to execute the text recommendation method based on text similarity values ​​of the terminal device.

[0172] The present application also discloses a computer program product, including a computer program, which implements the method described in this embodiment when executed by a processor.

[0173] Various embodiments of the systems and techniques described above in the present application can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs, which can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor, which can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0174] The program code for implementing the method of the present application can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or electronic device.

[0175] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or 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 foregoing.

[0176] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0177] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data electronic device), or a computing system that includes middleware components (e.g., an application electronic device), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0178] The computer system may include a client and an electronic device. The client and the electronic device are generally far away from each other and usually interact through a communication network. The relationship between the client and the electronic device is generated by computer programs running on corresponding computers and having a client-electronic device relationship with each other. The electronic device may be a cloud electronic device, also known as a cloud computing electronic device or a cloud host, which is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The electronic device may also be an electronic device of a distributed system, or an electronic device combined with a blockchain. It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0179] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0180] It should be understood that the present application is not limited to the precise structures that have been 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 text recommendation method, characterized in that: The method comprises: Acquire text features of each of the multiple texts; the text features include text labels, the text labels represent characteristic attributes of the text, and the text labels are composed of multiple hierarchical labels, and labels at different levels are in a belonging relationship and are independent of each other; Determine a feature vector of each text according to the text feature of each text, and generate a feature matrix of the plurality of texts according to the feature vector of each text; Determine a transposed matrix of the feature matrix according to the feature matrices of the plurality of texts; Determining a sub-feature matrix of the feature matrix according to the feature matrices of the plurality of texts; Determine a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of the plurality of texts; Using a sub-feature matrix of the feature matrix and a sub-feature matrix of the transposed matrix of the feature matrix as sub-feature matrices of the multiple texts, and determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two; According to the similarity information, a first preset number of texts is screened out from a preset text library, where the first preset number is n*k, and n is a hyperparameter; For each text, respectively calculate the text content wmd similarity information and text label wmd similarity information between the text and the first k texts in n*k, perform weighted average of the text content wmd similarity information and the text label wmd similarity information to obtain similarity information of a second preset number of texts, and use the second preset number of texts as the KNN list of each text; and For each text, respectively calculate the text content rwmd similarity information and the text label rwmd similarity information between the text and n*kk texts, and perform weighted average of the text content rwmd similarity information and the text label rwmd similarity information to obtain similarity information of a third preset number of texts; Determine the text to be recommended from the texts in the preset text library according to the relationship between the similarity information of the second preset number of texts and the similarity information of the third preset number of texts, and recommend the text to be recommended to the user; wherein the sum of the second preset number and the third preset number is equal to the first preset number; Determining a feature vector of each text according to the text feature of each text includes: Obtaining frequency information and category information corresponding to the text label of each text; Determining the weight of the text label in the corresponding text according to the frequency information of the text label; According to the weight and the category information, a label vector of each text is determined, and the label vector of each text is used as a feature vector of each text.

2. The method according to claim 1, characterized in that Determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts includes: Determine first cosine similarity information between each sub-feature matrix of each text of the feature matrix and each sub-feature matrix of each text of the transposed matrix of the feature matrix; Determine second cosine similarity information between the plurality of texts according to the first cosine similarity information; The similarity information between the multiple texts is determined according to the second cosine similarity information.

3. The method according to claim 1, characterized in that The text feature also includes text content, and determining the feature vector of each text according to the text feature of each text also includes: Obtaining word information in the text content of each of the texts; Determine a word vector of the word information according to the word information; wherein the word vector represents semantic information of the word information; According to the word vector, the central vector of each text is determined, and the central vector of each text is used as the feature vector of each text.

4. A text recommendation device, characterized in that: The device comprises: An acquisition unit is used to acquire text features of each of the multiple texts; the text features include text labels, the text labels represent characteristic attributes of the text, and the text labels are composed of multiple hierarchical labels, and labels at different levels are in a belonging relationship and are independent of each other; A generating unit, configured to determine a feature vector of each text according to a text feature of each text, and generate a feature matrix of the plurality of texts according to the feature vector of each text; A determination unit, configured to determine a transposed matrix of the feature matrix according to the feature matrices of the plurality of texts; Determining a sub-feature matrix of the feature matrix according to the feature matrices of the plurality of texts; Determine a sub-feature matrix of the transposed matrix of the feature matrix according to the transposed matrix of the feature matrix of the plurality of texts; Using a sub-feature matrix of the feature matrix and a sub-feature matrix of the transposed matrix of the feature matrix as sub-feature matrices of the multiple texts, and determining similarity information between the multiple texts according to the sub-feature matrices of the multiple texts; wherein the number of the sub-feature matrices is at least two; A recommendation unit, configured to select a first preset number of texts from a preset text library according to the similarity information, wherein the first preset number is n*k, and n is a hyperparameter; For each text, respectively calculate the text content wmd similarity information and text label wmd similarity information between the text and the first k texts in n*k, perform weighted average of the text content wmd similarity information and the text label wmd similarity information to obtain similarity information of a second preset number of texts, and use the second preset number of texts as the KNN list of each text; and For each text, respectively calculate the text content rwmd similarity information and the text label rwmd similarity information between the text and n*kk texts, and perform weighted average of the text content rwmd similarity information and the text label rwmd similarity information to obtain similarity information of a third preset number of texts; Determine the text to be recommended from the texts in the preset text library according to the relationship between the similarity information of the second preset number of texts and the similarity information of the third preset number of texts, and recommend the text to be recommended to the user; wherein the sum of the second preset number and the third preset number is equal to the first preset number; The generating unit is specifically used to obtain the frequency information and category information corresponding to the text label of each text; Determining the weight of the text label in the corresponding text according to the frequency information of the text label; According to the weight and the category information, a label vector of each text is determined, and the label vector of each text is used as a feature vector of each text.

5. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 3 when executed by a processor.

7. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 3 when being executed by a processor.

Citation Information

Patent Citations

  • Video pushing method based on video theme similarity

    CN105069121A