A tag recommendation method and device

Through the tendency calculation model and matrix construction technology, tags are calculated and recommended, which solves the problems of insufficient tag recommendation accuracy and interpretability in the existing technology, and achieves efficient and iterative tag recommendation effects.

CN112905786BActive Publication Date: 2025-01-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911229058.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-04
Publication Date
2025-01-21
Estimated Expiration
2039-12-04

AI Technical Summary

Technical Problem

The recommendation of existing label recommendation schemes is not accurate and has limited results, and it is difficult to obtain better recommendation results, poor interpretability, and it is impossible to continuously iterate and improve the recommendation effect, resulting in poor continuity.

Method used

The tendency calculation model is used to calculate the tendency of each keyword of the document in the annotation sample set to each tag, and a tendency matrix is ​​constructed, from which the sub-matrix corresponding to the keyword of the document to be labeled is extracted, and the overall relationship of the document to be labeled to each tag is calculated. Tendency, recommended tags.

Benefits of technology

It improves the recommendation accuracy and effect, enhances the interpretability, can continuously iterate and improve based on the annotated data, and improves the recommendation effect, thus having strong sustainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112905786B_ABST
    Figure CN112905786B_ABST
Patent Text Reader

Abstract

The present invention discloses a tag recommendation method and device, and relates to the field of computer technology. A specific implementation of the method includes: calculating the inclination of each keyword of a document in a labeled sample set to each tag to construct a inclination matrix, extracting a submatrix corresponding to the keyword of the document to be labeled from the inclination matrix, using the submatrix to calculate the overall inclination of the document to be labeled to each tag of the document in the labeled sample set, and recommending tags to the document to be labeled based on the overall inclination of the document to be labeled to each tag of the document in the labeled sample set. This implementation can improve the recommendation accuracy, and the recommendation effect and interpretability are good, and an ideal recommendation result can be obtained, and it can continuously iterate according to the labeled data to continuously improve the recommendation effect, so as to have strong sustainability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a tag recommendation method and device. Background Art

[0002] With the rise of content marketing, a unified, standard, and high-quality content labeling system has become increasingly important. An effective content labeling system plays a vital role in content recommendation and distribution, and can also provide good support for business operations. However, how to label content appropriately under the existing labeling system while taking into account effectiveness and explainability is a question worth considering.

[0003] There are two types of existing tag recommendation schemes: one is to recommend tags by performing simple or fuzzy matching between documents and tag words. For example, if the document mentions "down jacket", the tag "winter" is recommended. The other is to convert tag words and documents into vectors through word2vec (a technology that converts words into vector representations) and doc2vec (a technology that converts sentences / documents into vector representations), and then recommend the most similar tags to documents by calculating cosine similarity.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] The existing solutions have low recommendation accuracy and limited recommendation effects, making it difficult to obtain relatively good recommendation results. They have poor interpretability and are unable to continuously iterate and improve recommendation effects, thus lacking sustainability. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a label recommendation method and device, which can improve the recommendation accuracy, have good recommendation effect and explainability, obtain ideal recommendation results, and can continuously iterate according to the labeled data to continuously improve the recommendation effect, thereby having strong sustainability.

[0007] To achieve the above objective, according to one aspect of an embodiment of the present invention, a tag recommendation method is provided.

[0008] A tag recommendation method comprises: using a tendency calculation model to calculate the tendency of each keyword of a document in a labeled sample set to each tag, and constructing a tendency matrix based on the tendency, wherein the tendency of a keyword to a tag reflects the co-occurrence of the keyword and the tag; extracting keywords from a document to be labeled, and extracting a submatrix corresponding to the keywords of the document to be labeled from the tendency matrix; using the submatrix to calculate the overall tendency of the document to be labeled to each tag of the document in the labeled sample set; and recommending tags to the document to be labeled according to the overall tendency of the document to be labeled to each tag of the document in the labeled sample set.

[0009] Optionally, for the first keyword and the first label of the document in the annotated sample set, the first keyword and the first label respectively represent any keyword and any label of the document in the annotated sample set, and the tendency calculation model is used to calculate the tendency of the first keyword to the first label according to the following steps: calculate the number of documents in the annotated sample set that include the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur; calculate the probability of the first keyword appearing in the document in the annotated sample set, the probability of the first label appearing in the document in the annotated sample set, and the probability of the first keyword and the first label co-occurring in the document in the annotated sample set according to the number of documents including the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur; input the above three probabilities into the tendency calculation model to calculate the tendency of the first keyword to the first label.

[0010] Optionally, the step of constructing a propensity matrix based on the propensity includes: standardizing the propensity of each keyword to each label, wherein, for any keyword and label in the document in the annotated sample set, the standardized keyword propensity to the label is equal to: the ratio of the keyword's propensity to the label to the sum of the keyword's propensity to all labels; performing information enhancement on the standardized propensity of each keyword to each label, and the information enhancement includes: enhancing the standardized keyword propensity to the label when the keyword and the label are the same according to preset rules; and constructing the propensity matrix based on the information enhanced propensities.

[0011] Optionally, it also includes: before constructing the propensity matrix, filtering out the keyword and label word pairs that do not meet the preset conditions; or after constructing the propensity matrix, filtering out the propensities in the propensity matrix corresponding to the keyword and label word pairs that do not meet the preset conditions.

[0012] Optionally, the rows of the propensity matrix correspond to the keywords of the documents in the labeled sample set, and the columns of the propensity matrix correspond to the labels of the documents in the labeled sample set; the step of extracting a submatrix corresponding to the keywords of the documents to be labeled from the propensity matrix includes: extracting the rows corresponding to the target keywords from the propensity matrix to obtain the submatrix, wherein the target keyword is a keyword in the keyword set of the documents to be labeled that is the same as the keyword of the documents in the labeled sample set.

[0013] Optionally, it also includes: using the TF-IDF (term frequency-inverse document frequency) algorithm to calculate the weight of each keyword in the document in the labeled sample set, wherein the weight of a keyword is equal to the product of the term frequency and the inverse document frequency of the keyword; using the sub-matrix, the step of calculating the overall inclination of the document to be labeled to each label of the document in the labeled sample set includes: according to the weight of the target keyword, performing a weighted summation by column on the sub-matrix to obtain the overall inclination of the document to be labeled to each label of the document in the labeled sample set.

[0014] According to another aspect of an embodiment of the present invention, a tag recommendation device is provided.

[0015] A tag recommendation device comprises: a tendency matrix construction module, which is used to calculate the tendency of each keyword of a document in a labeled sample set to each tag by using a tendency calculation model, and construct a tendency matrix based on the tendency, wherein the tendency of a keyword to a tag reflects the co-occurrence of the keyword and the tag; a submatrix extraction module, which is used to extract keywords from a document to be labeled, and extract a submatrix corresponding to the keyword of the document to be labeled from the tendency matrix; an overall tendency calculation module, which is used to calculate the overall tendency of the document to be labeled to each tag of the document in the labeled sample set by using the submatrix; and a tag recommendation module, which is used to recommend tags to the document to be labeled according to the overall tendency of the document to be labeled to each tag of the document in the labeled sample set.

[0016] Optionally, the propensity matrix construction module includes a propensity calculation submodule, which is used to: for the first keyword and the first label of the document in the annotated sample set, the first keyword and the first label respectively represent any keyword and any label of the document in the annotated sample set, use the propensity calculation model, and calculate the propensity of the first keyword to the first label according to the following steps: calculate the number of documents in the annotated sample set that include the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur; calculate the probability of the first keyword appearing in the document in the annotated sample set, the probability of the first label appearing in the document in the annotated sample set, and the probability of the first keyword and the first label co-occurring in the document in the annotated sample set according to the number of documents including the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur; input the above three probabilities into the propensity calculation model to calculate the propensity of the first keyword to the first label.

[0017] Optionally, the propensity matrix construction module includes a propensity matrix construction sub-module, which is used to: standardize the propensity of each keyword to each label, wherein, for any keyword and label in the document in the annotated sample set, the standardized keyword propensity to the label is equal to: the ratio of the keyword's propensity to the label to the sum of the keyword's propensity to all labels; perform information enhancement on the standardized propensity of each keyword to each label, and the information enhancement includes: enhancing the standardized propensity of the keyword to the label when the keyword and the label are the same according to preset rules; and constructing the propensity matrix based on the information enhanced propensities.

[0018] Optionally, it also includes a filtering module for: filtering out the keyword and label word pairs that do not meet the preset conditions before constructing the propensity matrix; or, after constructing the propensity matrix, filtering out the propensities in the propensity matrix corresponding to the keyword and label word pairs that do not meet the preset conditions.

[0019] Optionally, the rows of the propensity matrix correspond to the keywords of the documents in the labeled sample set, and the columns of the propensity matrix correspond to the labels of the documents in the labeled sample set; the submatrix extraction module includes a submatrix extraction submodule, which is used to: extract the rows corresponding to the target keywords from the propensity matrix to obtain the submatrix, and the target keyword is a keyword in the keyword set of the document to be labeled that is the same as the keyword of the document in the labeled sample set.

[0020] Optionally, it also includes a weight calculation module, which is used to: use the TF-IDF algorithm to calculate the weight of each keyword in the document in the labeled sample set, wherein the weight of a keyword is equal to the product of the word frequency of the keyword and the inverse file frequency; the overall tendency calculation module is also used to: according to the weight of the target keyword, perform weighted summation on the submatrix by column to obtain the overall tendency of the document to be labeled for each label of the document in the labeled sample set.

[0021] According to yet another aspect of the embodiments of the present invention, an electronic device is provided.

[0022] An electronic device includes: one or more processors; a memory for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the tag recommendation method provided by the present invention.

[0023] According to yet another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0024] A computer readable medium stores a computer program, which, when executed by a processor, implements the tag recommendation method provided by the present invention.

[0025] An embodiment of the above invention has the following advantages or beneficial effects: calculating the inclination of each keyword of the document in the labeled sample set to each label to construct a inclination matrix, extracting a submatrix corresponding to the keyword of the document to be labeled from the inclination matrix, using the submatrix to calculate the overall inclination of the document to be labeled to each label of the document in the labeled sample set, and recommending labels to the document to be labeled according to each overall inclination. It can improve the accuracy of recommendation, and the recommendation effect and interpretability are good, and an ideal recommendation result can be obtained. It can also continuously iterate according to the labeled data to continuously improve the recommendation effect, so as to have strong sustainability.

[0026] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0028] Figure 1 is a schematic diagram of main steps of a tag recommendation method according to an embodiment of the present invention;

[0029] Figure 2 is a schematic diagram of a tag recommendation process according to an embodiment of the present invention;

[0030] Figure 3 is a schematic diagram of main modules of a tag recommendation device according to an embodiment of the present invention;

[0031] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0032] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0034] Figure 1 4 is a schematic diagram of main steps of a tag recommendation method according to an embodiment of the present invention.

[0035] like Figure 1As shown, a tag recommendation method according to an embodiment of the present invention mainly includes the following steps S101 to S104.

[0036] Step S101: using a tendency calculation model, calculate the tendency of each keyword in the document in the labeled sample set to each label, and construct a tendency matrix based on the calculated tendency.

[0037] Among them, the inclination of a keyword to a tag reflects the co-occurrence of the keyword and the tag.

[0038] For the first keyword and the first label of the document in the annotated sample set, the first keyword and the first label respectively represent any keyword and any label of the document in the annotated sample set. Using the tendency calculation model, the tendency of the first keyword to the first label can be calculated according to the following steps (for the convenience of subsequent explanation, the keyword k represents the first keyword and the label t represents the first label):

[0039] Calculate the number of documents including keyword k, the number of documents with label t, and the number of documents in which keyword k and label t co-occur in the labeled sample set; calculate the probability of keyword k appearing in documents of the labeled sample set, the probability of label t appearing in documents of the labeled sample set, and the probability of keyword k and label t co-occurring in documents of the labeled sample set based on the number of documents including keyword k, the number of documents with label t, and the number of documents in which keyword k and label t co-occur; input the above three probabilities, i.e., the probability of keyword k appearing in documents of the labeled sample set, the probability of label t appearing in documents of the labeled sample set, and the probability of keyword k and label t co-occurring in documents of the labeled sample set, into the tendency calculation model to calculate the tendency of keyword k to label t.

[0040] The number of documents in which keyword k and tag t co-occur refers to the number of documents that include keyword k and are marked with tag t.

[0041] The probability of keyword k appearing in a document of the labeled sample set refers to the ratio of the number of documents in the labeled sample set that include keyword k to the total number of documents in the labeled sample set.

[0042] The probability of label t appearing in the documents of the labeled sample set refers to the ratio of the number of documents labeled with label t in the labeled sample set to the total number of documents in the labeled sample set.

[0043] The probability of co-occurrence of keyword k and label t in documents of the labeled sample set refers to the ratio of the number of documents in the labeled sample set that include keyword k and are labeled with label t to the total number of documents in the labeled sample set.

[0044] The tendency calculation model of the embodiment of the present invention can be modified based on the mutual information calculation formula, and the tendency calculation model is defined as follows:

[0045]

[0046] Among them, I co-occurency (k, t) represents the inclination of keyword k to label t, p(X k =1) represents the probability of keyword k appearing in the document of the labeled sample set, p(X t =1) represents the probability of label t appearing in the document of the labeled sample set, p(X k =1,X t =1) represents the probability of keyword k and tag t co-occurring in the documents of the annotated sample set. co-occurency (k, t) is used to measure the co-occurrence degree (or tendency degree) of keyword k and tag t. If the value is larger, it means that if keyword k appears in a document, the document is more likely to be labeled with tag t, and vice versa.

[0047] The step of constructing a propensity matrix based on the calculated propensity may specifically include:

[0048] The calculated inclinations of each keyword to each label are standardized, wherein, for any keyword and label in the document in the annotated sample set, the standardized inclination of the keyword to the label is equal to: the ratio of the inclination of the keyword to the label to the sum of the inclinations of the keyword to all labels; the standardized inclinations of each keyword to each label are information enhanced, and the information enhancement includes: enhancing the standardized inclinations of the keywords to the labels when the keywords and labels are the same according to preset rules; and constructing a inclination matrix based on the inclinations after information enhancement.

[0049] For any keyword k0 and label t0, the inclination I of keyword k0 to label t0 is co-occurency (k0, t0) is standardized according to the following formula to obtain the standardized tendency q(k0, t0) of keyword k0 to label t0:

[0050]

[0051] Where T represents the set of labels of the labeled sample set, where each label is represented by t, t∈T. The larger the value of q(k0,t0), the more likely the document containing keyword k0 is to be labeled with label t0. ∑ t∈T I co-occurency (k0,t) is used to measure the sum of the inclinations of keyword k0 to all tags. co-occurency (k0, t0) is standardized to q(k0, t0), which can convert the absolute tendency into the relative tendency, and then determine which label the document is more likely to be marked with if the keyword k0 appears in the document.

[0052] The information enhancement is performed on the normalized keyword k0's tendency q(k0,t0) to the label t0 according to the preset rules as follows:

[0053]

[0054] Among them, m ij It indicates the propensity of the i-th keyword to the j-th tag word after information enhancement, that is, the propensity of q(k0,t0) after information enhancement, i and j are the serial numbers of keyword k0 and tag t0 respectively. α indicates the strength of information enhancement, α=0 means no information enhancement, α=1 means maximum information enhancement, and only when the keyword and tag are the same, there is a fixed value of propensity, otherwise it is 0, that is, it returns to the simple matching situation. By enhancing the propensity of keywords to tags when the keywords and tags are the same, it is more in line with the actual situation of tag recommendation.

[0055] According to the m obtained under various values ​​of i and j ij , that is, the propensity of the keywords of the keyword set K of the labeled sample set to the labels of the label set T after the information is enhanced, and the propensity matrix M is constructed:

[0056] M=(m ij ) len(K)len(T)

[0057] The rows of the propensity matrix correspond to the keywords of the documents in the labeled sample set, and the columns of the propensity matrix correspond to the tags of the documents in the labeled sample set.

[0058] As an optional implementation, before constructing the propensity matrix, the keyword and label word pairs that do not meet the preset conditions can also be filtered out. The keyword and label word pairs that do not meet the preset conditions may include keyword-label word pairs with a small number of co-occurrences of keywords and labels (less than a preset threshold).

[0059] As another optional implementation, after constructing the propensity matrix as described above, the propensities corresponding to the keyword and label word pairs that do not meet the preset conditions in the propensity matrix may be filtered out, so that only valid keyword-label word propensity information is retained.

[0060] By filtering the keyword and tag word pairs or the corresponding tendencies, the interference caused by accidental co-occurrence between the keywords and tag words (i.e., tags) of the document can be avoided, the noise in the tendency matrix can be removed, and the information matrix storage space can be reduced.

[0061] Step S102: extract keywords from the document to be annotated, and extract a sub-matrix corresponding to the keywords of the document to be annotated from the tendency matrix.

[0062] The step of extracting a submatrix corresponding to the keywords of the document to be annotated from the propensity matrix may include: extracting each row corresponding to the target keyword from the propensity matrix to obtain a submatrix, where the target keyword is a keyword in the keyword set of the document to be annotated that is the same as the keyword of the document in the annotation sample set.

[0063] The number of documents in the annotation sample set is large, and the number of keywords included is also very large. Therefore, under normal circumstances, each keyword of the document to be annotated is a keyword in the keyword set of the annotation sample set. In special cases, if individual keywords of the document to be annotated are not in the keyword set of the annotation sample set, then the embodiment of the present invention will not consider this part of the keywords that are not in the keyword set of the annotation sample set, and use the keywords of the document to be annotated in the keyword set of the annotation sample set to extract the submatrix. For example, a document to be annotated has 200 keywords, of which 195 keywords are in the keyword set of the annotation sample set, and 5 are not in the keyword set of the annotation sample set. Then, according to the 195 keywords, the corresponding rows are extracted from the propensity matrix to obtain the submatrix.

[0064] The document set to be annotated is denoted as D', where each document is represented by d', d'∈D'. Extract keywords from document d' to get K d' , select keyword K from the propensity matrix M d' The corresponding rows form the submatrix M0:

[0065]

[0066] Step S103: using the submatrix corresponding to the keywords of the document to be annotated, calculate the overall inclination of the document to be annotated to each label of the document in the annotation sample set.

[0067] Each keyword in the document of the labeled sample set corresponds to a weight, which can be calculated using the TF-IDF algorithm. Specifically, the TF corresponding to the keyword is multiplied by the IDF to obtain the weight of the keyword. TF is the word frequency, which indicates the frequency of the keyword appearing in each document. For any keyword k0, its TF value is It is equal to the number of times keyword k0 appears in the annotated sample set divided by the number of all keywords in the annotated sample set. IDF is the inverse document frequency. The IDF value of keyword k0 is It is equal to the total number of documents in the labeled sample set divided by the number of documents that include the keyword k0, and then the logarithm of the quotient is taken, which is The weight of keyword k0 is equal to

[0068] According to the weight of the keyword of the document in the labeled sample set, the weight of the target keyword is obtained. The step of calculating the overall inclination of the document to be labeled to each label of the document in the labeled sample set by using the submatrix specifically includes: according to the weight of the target keyword, the submatrix is ​​weighted and summed by column to obtain the overall inclination of the document to be labeled to each label of the document in the labeled sample set.

[0069] The submatrix M0 is used to calculate the overall inclination of document d' in the document set D' to be annotated to each label of the document in the annotated sample set. Specifically, according to the weight W of the target keyword d' , perform weighted summation of M0 by column, that is: Get the overall inclination of document d' to each label.

[0070] Step S104: recommending tags to the document to be annotated according to the overall inclination of the tag to the tag in the tag sample set.

[0071] Specifically, the overall tendencies can be sorted by numerical value, and the labels corresponding to the preset number of overall tendencies with the largest numerical values ​​are used as recommended labels for the document to be annotated. For example, to calculate the overall tendencies of document d' in the document set D' to be annotated for 1000 labels, the preset number can be set to 6, and then the 1000 overall tendencies can be sorted by numerical value, either from small to large or from large to small. The labels corresponding to the 6 overall tendencies with the largest numerical values ​​are used as recommended labels for document d'.

[0072] In one embodiment, while outputting the recommended tags of document d', the weight W of the target keyword can also be output. d' For reference by relevant personnel.

[0073] The embodiment of the present invention first obtains key information of the document through keyword extraction technology, calculates the inclination of each key information to each tag, calculates the inclination of the document as a whole to each tag based on the inclination of the keyword to the tag, and recommends tags for the document based on this. The embodiment of the present invention can effectively utilize the annotated data, continuously iterate, and take into account the interpretability of the recommended tags.

[0074] Figure 2 4 is a schematic diagram of a tag recommendation process according to an embodiment of the present invention.

[0075] The tag recommendation process of one embodiment of the present invention includes the following steps S201 to S205.

[0076] Step S201: extract keywords from documents in the annotated sample set and calculate the weight of each keyword.

[0077] The document set in the labeled sample set is denoted as D, and the number of samples (i.e. the total number of documents) is denoted as N, where each document is represented by d, d∈D. The label set of the labeled sample set is denoted as T, where each label is represented by t, t∈T. The label set corresponding to document d is T d , ∪ d∈D T d =T.

[0078] Extract the keyword set from document d, denoted as K d , calculate K d The weight of each keyword in the formula is used to obtain the weight set W d , K d and W d The number of elements of is the same and corresponds one to one. K=∪ d∈D K d is the set of keywords for all documents.

[0079] Among them, the TF-IDF algorithm is used to calculate the weight of the keyword. For any keyword k0, its weight is equal to is the frequency of the keyword, is the reverse document frequency of the keyword, and The specific calculation method of has been introduced above and will not be repeated here.

[0080] Step S202: construct a propensity matrix.

[0081] Mutual information is a useful information measure in information theory. It can be regarded as the amount of information contained in a random variable about another random variable, or the uncertainty of a random variable reduced by knowing another random variable. The embodiment of the present invention is modified on the basis of the mutual information calculation formula, and defines the following tendency calculation method to measure the tendency of keywords to label words (i.e., labels). The larger the value, the more likely it is that the document will be labeled with the label if the keyword appears in the document, assuming other conditions remain unchanged.

[0082] First, calculate the forward correlation part in the mutual information calculation formula as follows:

[0083]

[0084] in, Indicates the probability of keyword k appearing in the documents of the labeled sample set;

[0085] Represents the probability of label t appearing in the document of the labeled sample set;

[0086] Indicates the probability of keyword k and label t co-occurring in the documents of the annotated sample set;

[0087] c(X k =1) represents the number of documents containing keyword k in N annotated documents, c(X t =1) represents the number of documents annotated with label t in N annotated documents, c(X k =1,X t =1) indicates the number of documents that have N annotated documents including keyword k and whose annotated tags include tag t.

[0088] By I co-occurency The inclination of the keyword to the label reflected by (k, t) is the absolute inclination degree, which can be standardized according to I co-occurency (k, t) is standardized to convert it into a relative tendency. The conversion formula is as follows:

[0089]

[0090] After information enhancement of q(k0,t0), the tendency m after information enhancement is obtained ij :

[0091]

[0092] For the q(k0,t0) and m ij The calculation formula of has been explained above, so it will not be described in detail here. According to the above formula, the inclination m between the elements of the keyword set K and the elements of the tag set T is calculated. ij , to construct the propensity matrix M.

[0093] Step S203: extract keywords from the document to be annotated, and extract a sub-matrix corresponding to the keywords of the document to be annotated from the propensity matrix.

[0094] For example, the propensity matrix M is:

[0095]

[0096] The rows of M correspond to keywords and the columns correspond to labels. Assuming that the document d' in the document set D' to be annotated has two keywords, corresponding to the first and second rows of M, then the submatrix M0 is:

[0097]

[0098] The weights of the keywords corresponding to the first and second rows of M are w1 and w2 respectively.

[0099] It should be noted that the above only takes the propensity matrix M with three rows and three columns as an example to facilitate the explanation of the sub-matrix extraction method. According to the embodiment of the present invention, the number of rows and columns of the propensity matrix M obtained in the actual scenario is very large. Technical personnel in this field can extract the sub-matrix M0 according to the actually obtained propensity matrix M according to the above method.

[0100] Step S204: according to the weight of the keyword corresponding to each row of the submatrix, weighted sum is performed on the columns of the submatrix to obtain the overall inclination of the document to be annotated to each label of the document in the annotation sample set.

[0101] Combined with the above three-row and three-column propensity matrix M, the extracted submatrix M0 is weighted and summed by column, and the overall propensity J1, J2, and J3 of document d' for the three tags are obtained:

[0102] J1=m 11 ×w1+m 21 ×w2

[0103] J2=m 12 ×w1+m 22 ×w2

[0104] J3=m 13 ×w1+m 23 ×w2

[0105] According to this embodiment, in an actual scenario, those skilled in the art can calculate the overall inclinations J1, J2, J3, ..., Jn (n is the number of tags) of document d' for each tag according to the above method for calculating the overall inclination.

[0106] Step S205: Arrange the overall tendencies from large to small, and output the labels corresponding to the overall tendencies of a preset number of the top ones.

[0107] The output label is the recommended label for the document to be annotated.

[0108] The embodiment of the present invention is applicable to many scenarios of content tag recommendation. It is simple and easy to implement. It extracts the tendency information between keywords and tag words based on the annotated data, and can continuously iterate according to the annotated data. It is more objective and fair than the simple matching method and the cosine similarity method, and has a significant improvement in recommendation accuracy. In addition, the embodiment of the present invention first calculates the tendency of the document keywords to each tag separately, and then obtains the overall tendency of each tag by weighted summation. This idea is similar to the idea of ​​manual labeling (labeling), that is, first recognize the key information in the document, and then use the relationship between the key information and the selected tags for comprehensive judgment and labeling, so that the embodiment of the present invention is better interpretable. Moreover, at the level of interpretation of the recommendation results, it can also be understood through the keywords extracted from the document and the tendency size of the keywords and tags.

[0109] Figure 3 4 is a schematic diagram of main modules of a tag recommendation device according to an embodiment of the present invention.

[0110] like Figure 3 As shown, a tag recommendation device 300 according to an embodiment of the present invention mainly includes: a tendency matrix construction module 301 , a submatrix extraction module 302 , an overall tendency calculation module 303 , and a tag recommendation module 304 .

[0111] The propensity matrix construction module 301 is used to calculate the propensity of each keyword of the document in the labeled sample set to each label using the propensity calculation model, and construct a propensity matrix based on the propensity, wherein the propensity of the keyword to the label reflects the co-occurrence of the keyword and the label.

[0112] The tendency matrix construction module 301 may include a tendency calculation submodule, which is used to: for any keyword (represented by keyword k, i.e., the first keyword) and any label (represented by label t, i.e., the first label) in the document in the labeled sample set, use the tendency calculation model to calculate the tendency of keyword k to label t according to the following steps: calculate the number of documents in the labeled sample set that include keyword k, the number of documents with label t, and the number of documents in which keyword k and label t co-occur; calculate the probability of keyword k appearing in the document in the labeled sample set, the probability of label t appearing in the document in the labeled sample set, and the probability of keyword k and label t co-occurring in the document in the labeled sample set based on the number of documents including keyword k, the number of documents with label t, and the number of documents in which keyword k and label t co-occur; input the above three probabilities into the tendency calculation model to calculate the tendency of keyword k to label t.

[0113] The propensity matrix construction module 301 may also include a propensity matrix construction submodule, which is used to: standardize the propensity of each keyword to each label, wherein, for any keyword and label in the document in the annotated sample set, the standardized keyword's propensity to the label is equal to: the ratio of the keyword's propensity to the label to the sum of the keyword's propensities to all labels; perform information enhancement on the standardized propensity of each keyword to each label, and the information enhancement includes: enhancing the standardized propensity of the keyword to the label when the keyword and the label are the same according to preset rules; and construct a propensity matrix based on the information enhanced propensities.

[0114] The rows of the propensity matrix correspond to the keywords of the documents in the labeled sample set, and the columns of the propensity matrix correspond to the labels of the documents in the labeled sample set.

[0115] In one embodiment, the label recommendation device 300 may also include a filtering module for filtering out keyword and label word pairs that do not meet preset conditions before constructing the propensity matrix; or, after constructing the propensity matrix, filtering out the propensities corresponding to the keyword and label word pairs that do not meet the preset conditions in the propensity matrix.

[0116] The sub-matrix extraction module 302 is used to extract keywords from the document to be annotated, and extract sub-matrices corresponding to the keywords of the document to be annotated from the propensity matrix.

[0117] The submatrix extraction module 302 may include a submatrix extraction submodule, which is used to extract rows corresponding to target keywords from the propensity matrix to obtain a submatrix, where the target keyword is a keyword in the keyword set of the document to be annotated that is the same as the keyword of the document in the annotation sample set.

[0118] The overall tendency calculation module 303 is used to calculate the overall tendency of the document to be annotated to each label of the document in the annotation sample set by using the submatrix corresponding to the keywords of the document to be annotated.

[0119] The tag recommendation device 300 may further include a weight calculation module, which is used to: calculate the weight of each keyword of the document in the annotation sample set using the TF-IDF algorithm, wherein the weight of a keyword is equal to the product of the keyword's word frequency and the inverse document frequency;

[0120] The overall tendency calculation module 303 can be specifically used to: perform weighted summation on the columns of the sub-matrices according to the weight of the target keyword to obtain the overall tendency of the document to be annotated to each label of the document in the annotation sample set.

[0121] The tag recommendation module 304 is used to recommend tags to the document to be annotated according to the overall inclination of the tag to be annotated document to the tags of the document in the annotated sample set.

[0122] In addition, the specific implementation content of the tag recommendation device in the embodiment of the present invention has been described in detail in the tag recommendation method described above, so the repeated content will not be described again here.

[0123] Figure 4 An exemplary system architecture 400 is shown to which the tag recommendation method or the tag recommendation apparatus according to the embodiment of the present invention can be applied.

[0124] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0125] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0126] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.

[0127] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0128] It should be noted that the tag recommendation method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the tag recommendation device is generally disposed in the server 405 .

[0129] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0130] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device or server suitable for implementing an embodiment of the present application. Figure 5 The terminal device or server shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0131] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0132] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0133] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present application are executed.

[0134] It should be noted that the computer-readable medium shown in the present invention 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 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 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 a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0135] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a 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 a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0136] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be arranged in a processor. For example, they may be described as follows: a processor includes a propensity matrix construction module, a submatrix extraction module, an overall propensity calculation module, and a label recommendation module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the propensity matrix construction module may also be described as "a module for calculating the propensity of each keyword in the document in the labeled sample set to each label using a propensity calculation model, and constructing a propensity matrix based on the propensity".

[0137] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes: using a tendency calculation model to calculate the tendency of each keyword of the document in the labeled sample set to each label, and constructing a tendency matrix based on the tendency, wherein the tendency of the keyword to the label reflects the co-occurrence of the keyword and the label; extracting keywords from the document to be labeled, and extracting a submatrix corresponding to the keyword of the document to be labeled from the tendency matrix; using the submatrix, calculating the overall tendency of the document to be labeled to each label of the document in the labeled sample set; and recommending labels to the document to be labeled based on the overall tendency of the document to be labeled to each label of the document in the labeled sample set.

[0138] According to the technical solution of the embodiment of the present invention, the inclination of each keyword of the document in the labeled sample set to each label is calculated to construct a inclination matrix, and a submatrix corresponding to the keyword of the document to be labeled is extracted from the inclination matrix. The submatrix is ​​used to calculate the overall inclination of the document to be labeled to each label of the document in the labeled sample set, and the label corresponding to the overall inclination of the preset number of the largest value is used as the recommended label of the document to be labeled. It can improve the accuracy of recommendation, the recommendation effect and interpretability are good, and an ideal recommendation result can be obtained. It can also continuously iterate according to the labeled data to continuously improve the recommendation effect, so as to have strong sustainability.

[0139] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A tag recommendation method, characterized in that: include: Using the tendency calculation model, the tendency of each keyword of the document in the labeled sample set to each label is calculated, and a tendency matrix is ​​constructed based on the tendency, wherein the tendency of the keyword to the label reflects the co-occurrence of the keyword and the label; Extracting keywords from the document to be annotated, and extracting a submatrix corresponding to the keywords of the document to be annotated from the propensity matrix; Using the submatrix, calculating the overall inclination of the document to be annotated to each label of the document in the annotated sample set; Recommending a label for the document to be labeled according to the overall inclination of the document to be labeled to each label of the document in the labeled sample set; The method further includes: using the TF-IDF algorithm to calculate the weight of each keyword in the document in the labeled sample set, wherein the weight of a keyword is equal to the product of the word frequency of the keyword and the inverse document frequency; using the submatrix, calculating the overall inclination of the document to be labeled to each label of the document in the labeled sample set, including: according to the weight of the target keyword, performing a weighted summation on the submatrix by column to obtain the overall inclination of the document to be labeled to each label of the document in the labeled sample set, wherein the target keyword is a keyword in the keyword set of the document to be labeled that is the same as the keyword of the document in the labeled sample set.

2. The method according to claim 1, characterized in that: For the first keyword and the first label of the document in the annotated sample set, the first keyword and the first label respectively represent any keyword and any label of the document in the annotated sample set, and the tendency calculation model is used to calculate the tendency of the first keyword to the first label according to the following steps: Calculate the number of documents in the annotated sample set that include the first keyword, the number of documents that have the first tag, and the number of documents in which the first keyword and the first tag co-occur; According to the number of documents including the first keyword, the number of documents having the first tag, and the number of documents in which the first keyword and the first tag co-occur, calculate the probability that the first keyword appears in the documents of the labeled sample set, the probability that the first tag appears in the documents of the labeled sample set, and the probability that the first keyword and the first tag co-occur in the documents of the labeled sample set; The above three probabilities are input into the tendency calculation model to calculate the tendency of the first keyword to the first tag.

3. The method according to claim 1, characterized in that The step of constructing a propensity matrix based on the propensity comprises: The inclination of each keyword to each tag is standardized, wherein, for any keyword and tag in the document in the annotated sample set, the inclination of the keyword to the tag after standardization is equal to: the ratio of the inclination of the keyword to the tag to the sum of the inclinations of the keyword to all tags; Performing information enhancement on the inclination of each of the standardized keywords to each tag, the information enhancement comprising: enhancing the inclination of the standardized keywords to the tags when the keywords and tags are the same according to a preset rule; The propensity matrix is ​​constructed based on the propensities after the information enhancement.

4. The method according to claim 1, characterized in that Also includes: Before constructing the propensity matrix, filter out keyword and label word pairs that do not meet the preset conditions; Alternatively, after constructing the propensity matrix, the propensities corresponding to the keyword and label word pairs that do not meet the preset conditions in the propensity matrix are filtered out.

5. The method according to claim 1, characterized in that: The rows of the propensity matrix correspond to the keywords of the documents in the labeled sample set, and the columns of the propensity matrix correspond to the tags of the documents in the labeled sample set; The step of extracting a submatrix corresponding to the keywords of the document to be annotated from the propensity matrix includes: The rows corresponding to the target keywords are extracted from the propensity matrix to obtain the submatrix.

6. A tag recommendation device, characterized in that: include: A propensity matrix construction module is used to calculate the propensity of each keyword of the document in the labeled sample set to each label using a propensity calculation model, and to construct a propensity matrix based on the propensity, wherein the propensity of a keyword to a label reflects the co-occurrence of the keyword and the label; A submatrix extraction module, used to extract keywords from the document to be annotated, and extract a submatrix corresponding to the keywords of the document to be annotated from the propensity matrix; An overall tendency calculation module, used to calculate the overall tendency of the to-be-annotated document to each label of the document in the annotated sample set by using the submatrix; A tag recommendation module, used to recommend tags to the document to be labeled according to the overall inclination of the document to be labeled to each tag of the document in the labeled sample set; The device also includes a weight calculation module, which is used to: calculate the weight of each keyword in the document in the labeled sample set by using the TF-IDF algorithm, wherein the weight of a keyword is equal to the product of the word frequency of the keyword and the inverse file frequency; the overall tendency calculation module is also used to: according to the weight of the target keyword, perform weighted summation on the submatrix by column to obtain the overall tendency of the document to be labeled to each label of the document in the labeled sample set, wherein the target keyword is a keyword in the keyword set of the document to be labeled that is the same as the keyword of the document in the labeled sample set.

7. The device according to claim 6, characterized in that The propensity matrix construction module includes a propensity calculation submodule, which is used to: For the first keyword and the first label of the document in the annotated sample set, the first keyword and the first label respectively represent any keyword and any label of the document in the annotated sample set, and the inclination of the first keyword to the first label is calculated according to the following steps using the inclination calculation model: the number of documents in the annotated sample set including the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur; according to the number of documents including the first keyword, the number of documents with the first label, and the number of documents in which the first keyword and the first label co-occur, the probability of the first keyword appearing in the document in the annotated sample set, the probability of the first label appearing in the document in the annotated sample set, and the probability of the first keyword and the first label co-occurring in the document in the annotated sample set are calculated; the above three probabilities are input into the inclination calculation model to calculate the inclination of the first keyword to the first label.

8. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are enabled to implement the method according to any one of claims 1 to 5.

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

Citation Information

Patent Citations

  • Personalized user tag modeling and recommendation method based on unified probability model

    CN102004774A

  • Automatic extraction method for text labels in combination with theme model and semantic analyses

    CN106055538A