A method and device for determining work category information, a computer device and a medium

By training the target model and clustering word vectors in the target vector space, the problems of low efficiency and insufficient accuracy in article classification in the existing technology are solved, and more efficient work category determination is achieved.

CN114741505BActive Publication Date: 2025-10-17DOUYIN VISION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210240358.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2025-10-17
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

In the existing technology, article classification efficiency is low and it is impossible to accurately classify articles in emerging fields. In particular, when relying on manual classification, the efficiency is low and it cannot cover niche fields.

Method used

Through the pre-trained target model, the word vectors of keywords belonging to the same work are used as positive samples, and the word vectors of keywords belonging to different works are used as negative samples for training to obtain a model for determining keyword word vectors, and the word vectors are clustered in the target vector space to determine the work category information.

Benefits of technology

It achieves more accurate classification of the categories of works to be classified, especially in niche areas, without relying on historically defined categories, thus improving classification efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741505B_ABST
    Figure CN114741505B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, computer equipment, and medium for determining work category information, wherein the method comprises: obtaining multiple keywords in a work to be classified; determining word vectors of the multiple keywords in a target vector space based on a pre-trained target model; wherein the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the any two word vectors; the target model is obtained by training the word vectors of any two preset keywords belonging to the same preset work as positive samples, and the word vectors of any two preset keywords belonging to different preset works as negative samples; clustering the word vectors of the multiple keywords to obtain at least one cluster; wherein the spatial distance between each word vector in each cluster is less than a first set threshold; and determining the work category information of the work to be classified based on the keywords corresponding to each word vector in at least one cluster.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of information processing, and in particular, to a method and device for determining work category information, a computer device and a medium. BACKGROUND

[0002] With the development of Internet technology, browsing articles on media platforms has become one of the main reading methods of people. Therefore, in order to meet the network reading needs of people, more and more authors publish articles on media platforms.

[0003] In order to realize the management of article resources and author resources, the articles are usually classified by manual method according to the historically defined article categories. However, this classification method has low classification efficiency and cannot guarantee accurate classification of articles in some emerging fields. SUMMARY

[0004] The present disclosure provides at least a method and device for determining work category information, a computer device and a medium.

[0005] In a first aspect, the present disclosure provides a method for determining work category information, comprising:

[0006] obtaining a plurality of keywords in a work to be classified;

[0007] determining word vectors of the plurality of keywords in a target vector space based on a pre-trained target model; wherein the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the two word vectors; the target model is obtained by training any two preset keywords belonging to the same preset work as positive samples and any two preset keywords belonging to different preset works as negative samples;

[0008] clustering the word vectors of the plurality of keywords to obtain at least one class cluster; wherein the spatial distance between each word vector in each class cluster is less than a first set threshold;

[0009] determining the work category information of the work to be classified based on the keywords corresponding to each word vector in the at least one class cluster.

[0010] In a feasible implementation, the target model is obtained by the following steps:

[0011] obtaining a plurality of preset keywords in a plurality of preset works;

[0012] inputting the plurality of preset keywords into a target model to be trained respectively to obtain word vectors of the plurality of preset keywords;

[0013] training the target model to be trained by taking the word vectors of any two preset keywords belonging to the same preset work as positive samples and taking the word vectors of any two preset keywords belonging to different preset works as negative samples, to obtain the trained target model.

[0014] In an implementation, the training the target model to be trained by taking the word vectors of any two preset keywords belonging to the same preset work as positive samples and taking the word vectors of any two preset keywords belonging to different preset works as negative samples, to obtain the trained target model, includes:

[0015] selecting any positive sample in the positive samples as a reference positive sample, and determining a first similarity of the reference positive sample based on the word vectors of the two preset keywords contained in the reference positive sample; and determining a second similarity of each negative sample based on the word vectors of the two preset keywords contained in each negative sample;

[0016] determining a sum of similarities between the reference positive sample and each negative sample based on the first similarity of the reference positive sample and the second similarity of each negative sample;

[0017] determining a training loss based on the first similarity of the reference positive sample and the sum of similarities;

[0018] training the target model to be trained based on the training loss, to obtain the trained target model.

[0019] In an implementation, the inputting the multiple preset keywords of the multiple preset works into the target model to be trained to obtain the word vectors of the multiple preset keywords includes:

[0020] inputting the multiple preset keywords of each preset work into a feature extraction layer of the target model to be trained to obtain an initial word vector of each preset keyword; the dimension of the initial word vector is higher than a preset dimension;

[0021] inputting the initial word vector into a dimension reduction encoder of the target model to obtain a word vector of a preset dimension corresponding to the preset keyword.

[0022] In an implementation, the obtaining the multiple preset keywords in the multiple preset works includes:

[0023] obtaining multiple candidate keywords in the multiple preset works;

[0024] determining, for each candidate keyword, a relevance between the candidate keyword and a preset work in which the candidate keyword is located.

[0025] select, from the plurality of candidate keywords, a plurality of preset keywords whose relevance degrees meet a second set threshold, based on a relevance degree of each of the candidate keywords and a preset work in which the candidate keyword is located.

[0026] In an implementation, the determining of the work category information of the work to be classified based on the keywords corresponding to the word vectors in the at least one cluster includes:

[0027] determining a target cluster in which the number of word vectors is the largest, based on the number of word vectors included in each of the clusters.

[0028] determining the work category information of the work to be classified based on the keywords corresponding to the word vectors in the target cluster.

[0029] In an implementation, the determining of the work category information of the work to be classified based on the keywords corresponding to the word vectors in the target cluster includes:

[0030] determining an average word vector of each of the word vectors in the target cluster.

[0031] determining a target word vector closest to the average word vector among the word vectors in the target cluster.

[0032] determining the work category information of the work to be classified based on the keyword corresponding to the target word vector.

[0033] In an implementation, after the work category information of the work to be classified is determined, the method further includes:

[0034] determining author category information of an author to which the work to be classified belongs, based on the work category information of the work to be classified.

[0035] In an implementation, the determining of the author category information of the author to which the work to be classified belongs based on the work category information of the work to be classified includes:

[0036] determining a number of works of a same author in a plurality of work categories based on the work category information of each of the works to be classified.

[0037] taking a work category in which the number of works of the author is the largest as the author category of the author.

[0038] In a second aspect, the present disclosure provides a device for determining work category information, including:

[0039] The first obtaining module is configured to obtain a plurality of keywords in a work to be classified;

[0040] The first determining module is configured to determine word vectors of the plurality of keywords in a target vector space based on a pre-trained target model, wherein a spatial distance between any two word vectors in the target vector space is negatively correlated with a semantic similarity between the any two word vectors, and the target model is obtained by training any two word vectors of preset keywords belonging to a same preset work as positive samples and any two word vectors of preset keywords belonging to different preset works as negative samples.

[0041] The clustering module is configured to cluster the word vectors of the plurality of keywords to obtain at least one cluster, wherein a spatial distance between each word vector in each cluster is less than a first threshold.

[0042] The second determining module is configured to determine work category information of the work to be classified based on keywords corresponding to each word vector in the at least one cluster.

[0043] In a third aspect, the embodiments of the present disclosure further provide a computer device, comprising a processor, a memory and a bus, the memory stores machine readable instructions executable by the processor, when the computer device is running, the processor and the memory communicate through the bus, and the machine readable instructions are executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.

[0044] In a fourth aspect, the embodiments of the present disclosure further provide a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to perform the steps of the first aspect or any possible implementation manner of the first aspect.

[0045] The method for determining work category information provided by the embodiments of the present disclosure can determine the word vector of a keyword in a work to be classified based on a pre-trained target model, where the target model is obtained by pre-training using a word vector of any two preset keywords belonging to the same preset work as a positive sample and a word vector of any two preset keywords belonging to different preset works as a negative sample; after the word vector of the keyword is determined, the word vectors with a spatial distance less than a first set threshold in the target vector space are clustered into one category, and the keywords corresponding to each word vector in the obtained at least one category cluster are more similar in semantics, so that when the work category information of the work to be classified is determined according to the keywords corresponding to each word vector in the same category cluster, the work category of the work to be classified can be more accurately determined; and the above method can classify works without relying on historically defined work categories, such as accurately classifying works in some niche fields, and does not rely on manual classification, and has higher classification efficiency.

[0046] In order to make the above objectives, characteristics and advantages of the present disclosure more obvious and easy to understand, the following preferred embodiments are specifically described below, and the accompanying drawings are described in detail as follows. BRIEF DESCRIPTION OF DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the drawings needed to be used in the embodiments, the drawings herein are incorporated into the description and form a part of the description, which show the embodiments consistent with the present disclosure, and are used to illustrate the technical solutions of the present disclosure together with the description. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be considered as a limitation to the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor.

[0048] Figure 1 A flowchart of a method for determining work category information provided by the embodiments of the present disclosure is shown;

[0049] Figure 2 A flowchart of a method for training a target model provided by the embodiments of the present disclosure is shown;

[0050] Figure 3 A workflow diagram of a text encoder provided by the embodiments of the present disclosure is shown;

[0051] Figure 4 A schematic diagram of a device for determining work category information provided by the embodiments of the present disclosure is shown;

[0052] Figure 5 A schematic diagram of a computer device provided by the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0053] So that the purposes, technical solutions and advantages of the embodiments of the present disclosure are more apparent, the technical solutions in the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the claimed present disclosure, but only represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present disclosure.

[0054] For the classification method of the article, the article is usually classified by manual classification according to the historically defined article categories. On the one hand, the manual classification method is relatively low in efficiency; on the other hand, for some articles in emerging fields, such as e-commerce, the historically defined article categories may not cover the article categories in the field, so it is impossible to accurately classify some articles in emerging fields.

[0055] Based on this, the present disclosure provides a method for determining work category information, and a target model for determining the word vector of a keyword is trained by using the word vector of any two preset keywords belonging to the same preset work as a positive sample and the word vector of any two preset keywords belonging to different preset works as a negative sample; when classifying a work to be classified, the word vector of a keyword in the work to be classified can be determined based on the trained target model, and then the word vectors with a spatial distance less than a first set threshold in the target vector space are clustered into a category, so that the keywords corresponding to each word vector in the obtained at least one category cluster are more similar in semantics, so that when the work category information of the work to be classified is determined according to the keywords corresponding to each word vector in the same category cluster, the work category of the work to be classified can be more accurately determined; and the above method can classify works without relying on historically defined work categories, such as accurately classifying works in some niche fields, and without relying on manual classification, the classification efficiency is higher.

[0056] The defects of the above-mentioned solutions and the proposed solutions are the results obtained by the inventors after practice and careful study, therefore, the discovery process of the above-mentioned problems and the solutions proposed by the present disclosure to solve the above-mentioned problems should be the contribution of the inventors to the present disclosure in the process of the present disclosure.

[0057] It should be noted that: similar reference numerals and letters represent similar items in the following drawings, therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.

[0058] To facilitate the understanding of the present embodiment, first, a method for determining work category information disclosed by the present embodiment is introduced in detail. The execution subject of the method for determining work category information provided by the present embodiment is generally a computer device with certain computing power.

[0059] Next, the method for determining work category information provided by the present embodiment is described taking the execution subject as a server as an example.

[0060] Referring to FIG. 1, Figure 1 the flowchart of the method for determining work category information provided by the present embodiment is shown. The method includes S101-S104, wherein:

[0061] S101: Obtain a plurality of keywords in a work to be classified.

[0062] In the present embodiment, the work to be classified can refer to each work to be classified published by an author on a media platform. The work in the present embodiment includes but is not limited to articles, videos, pictures, audio, and any form of work, that is, any published content that needs to be created by an author belongs to a work.

[0063] In a specific implementation, for each work to be classified, a plurality of keywords contained therein can be extracted. Here, the plurality of keywords of each work to be classified obtained can be all keywords extracted from each work to be classified, or can be a plurality of keywords selected from all keywords in each work to be classified, which have a relevance to the work to be classified meeting a preset condition (for example, a threshold value). Specifically, the relevance of each keyword to the preset work can be determined according to the frequency of occurrence of the keyword in the work to be classified. The higher the frequency of occurrence of the keyword, the greater the relevance to the work to be classified. In one way, after all keywords of each work to be classified are extracted, the relevance of each keyword to the work to be classified can be determined using the BM25 algorithm, and then the keywords can be sorted in descending or ascending order according to the relevance, and finally a plurality of keywords having a relevance to the work to be classified meeting the set threshold value can be selected.

[0064] S102: Determine word vectors of the plurality of keywords in a target vector space based on a pre-trained target model; wherein the spatial distance of any two word vectors in the target vector space is negatively correlated with the semantic similarity between the two word vectors; and the target model is trained by taking the word vectors of any two preset keywords belonging to the same preset work as positive samples and taking the word vectors of any two preset keywords belonging to different preset works as negative samples.

[0065] The target vector space can refer to the Embedding Space mapping space. The word vector of each keyword in the target vector space can be the word vector under the Embedding Space mapping space.

[0066] Here, for each keyword, the corresponding word vector of each keyword can be found from the pre-generated keyword semantic matrix. The keyword semantic matrix can be a semantic matrix under the Embedding Space mapping space. The keyword semantic matrix can include the correspondence between each preset keyword and the word vector. Therefore, here the corresponding word vector of each keyword can be found from the keyword semantic matrix according to the correspondence between each preset keyword and the word vector.

[0067] The keyword semantic matrix can be pre-generated according to the word vector of the preset keyword in the target vector space. Each row vector in the keyword semantic matrix can represent the word vector of a preset keyword. The word vector of each preset keyword can represent the semantic information of the preset keyword. The word vector of each preset keyword in the keyword semantic matrix can be a vector of a preset dimension, for example, the word vector here can be a 300-dimensional vector.

[0068] The preset keywords can be extracted from a plurality of preset works in advance. In one way, in order to ensure that the word vector corresponding to each keyword can be found, the number of preset keywords can be sufficient.

[0069] In some cases, in the process of determining the word vectors of the plurality of keywords in the target vector space, when the keyword semantic matrix does not contain the word vector corresponding to a keyword, the keyword can be discarded. That is, in the subsequent steps, the word vector of the keyword can not be used for clustering.

[0070] The determined word vectors of the plurality of keywords can be word vectors with the following characteristics: the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between any two word vectors. That is, for any two word vectors, the smaller the spatial distance between the two word vectors in the target vector space, the greater the semantic similarity between the two word vectors. By determining the word vectors with the above characteristics, the word vectors with semantic similarity meeting the preset condition can be clustered into a class, so as to determine the work category information of the work to be classified according to the clustering result. The process will be described in detail below.

[0071] Here, the pre-trained target model can be used to determine the word vectors of the plurality of keywords in the target vector space. Specifically, the plurality of keywords can be respectively input into the pre-trained target model, and the feature extraction layer in the pre-trained target model can obtain the word vectors corresponding to the plurality of keywords based on the keyword semantic matrix.

[0072] The target model is trained by taking the word vectors of any two keywords belonging to the same preset work as positive samples and taking the word vectors of any two keywords belonging to different preset works as negative samples. That is, the pre-trained target model can find the word vectors in the keyword semantic matrix, and the spatial distance of the word vectors in the target vector space is closer for keywords with similar semantics, and the spatial distance of the word vectors in the target vector space is more distant for keywords with dissimilar semantics.

[0073] The word vectors of the plurality of keywords in the target vector space determined above can be initial word vectors. The dimension of the initial word vectors can be the same as the dimension of each row vector in the keyword semantic matrix. The word vectors of the plurality of keywords in the target vector space determined above can also be low-dimensional word vectors obtained by performing dimension reduction processing on the initial word vectors (here, the low-dimensional word vectors are relative to the initial word vectors, that is, the dimension of the low-dimensional word vectors is lower than the dimension of the initial word vectors). In an embodiment, the pre-trained target model can further include a pre-trained dimension reduction encoder for performing dimension reduction processing on the initial word vectors to obtain word vectors with a preset dimension, when the word vectors of the plurality of keywords in the target vector space determined above are low-dimensional word vectors obtained by performing dimension reduction processing on the initial word vectors. The dimension of the initial word vectors is higher than the preset dimension. The dimension reduction encoder can include at least one layer of encoder. For example, in an embodiment, the dimension reduction encoder can include two layers of encoders, the first layer of encoders can reduce the initial word vectors to word vectors with an intermediate dimension (the intermediate dimension is lower than the dimension of the initial word vectors and higher than the preset dimension), and the second layer of encoders can reduce the word vectors with the intermediate dimension to word vectors with the preset dimension. For example, the dimension of the initial word vectors can be 300 dimensions, the first layer of encoders can reduce the initial word vectors with 300 dimensions to word vectors with 64 dimensions, and the second layer of encoders can reduce the word vectors with 64 dimensions to word vectors with 32 dimensions. By performing dimension reduction processing on the initial word vectors, the data calculation amount during subsequent clustering can be reduced, and thus the operation efficiency can be improved. The capability of the pre-trained target model is learned through training, and the training process of the target model will be described in detail below.

[0074] After the above step, the method for determining work category information provided by the embodiments of the present disclosure further includes the following steps:

[0075] S103: clustering the word vectors of the plurality of keywords to obtain at least one cluster; wherein a spatial distance between each of the word vectors in each of the clusters is less than a first set threshold.

[0076] Here, a spatial distance threshold between word vectors, i.e., the first set threshold, can be set. The spatial distance between each of the word vectors in each of the clusters obtained by clustering is less than the first set threshold, that is, the semantic similarity between each of the word vectors in each of the clusters is greater than a similarity threshold. Therefore, by clustering, the word vectors with a semantic similarity greater than the similarity threshold can be grouped together. In a specific implementation, any feasible clustering algorithm can be used to cluster the word vectors, such as a k-means clustering algorithm, etc. Next, the keywords of each of the word vectors in the at least one cluster obtained can be used to determine the work category information of the work to be classified.

[0077] Following the above steps, the method for determining work category information provided by the embodiments of the present disclosure further comprises the following steps:

[0078] S104: determining the work category information of the work to be classified based on the keywords corresponding to each of the word vectors in the at least one cluster.

[0079] Here, in an implementation, a target cluster can be randomly selected from the at least one cluster, and then the work category information of the work to be classified can be determined based on the keywords corresponding to each of the word vectors in the randomly selected target cluster.

[0080] In an implementation, a target cluster with the most word vectors can also be determined based on the number of word vectors contained in each of the clusters, and then the work category information of the work to be classified can be determined based on the keywords corresponding to each of the word vectors in the target cluster.

[0081] The target cluster with the most word vectors has keywords corresponding to the word vectors that have the largest proportion in the work and can better represent the work category of the work to be classified, so the work category information determined based on the keywords corresponding to each of the word vectors in the target cluster can be more accurate.

[0082] Since the semantics of the keywords corresponding to the word vectors contained in each of the clusters are similar, a word vector can be randomly selected from the randomly selected target cluster or from the target cluster with the most word vectors, and then the keyword corresponding to the randomly selected word vector can be used as the work category information of the work to be classified.

[0083] To more accurately determine the work category information, in an embodiment, an average word vector of each word vector in the target category cluster can be determined based on the word vectors; then a target word vector closest to the average word vector among the word vectors in the target category cluster is determined; and then the work category information of the work to be classified is determined based on the keyword corresponding to the target word vector.

[0084] In the above embodiment, the average word vector of each word vector can be the geometric center of the high-dimensional graph formed by the word vectors. By calculating the distance between each word vector and the average word vector, the target word vector closest to the average word vector can be found. Generally, the target word vector closest to the average word vector can be one or more. Therefore, in the case where the target word vector is only one, the keyword corresponding to the target word vector can be used as the work category information of the work to be classified. In the case where the target word vector is more than one, the keywords corresponding to the target word vectors can be used as the work category information of the work to be classified, or the keyword corresponding to any one of the target word vectors can be used as the work category information of the work to be classified, or the keywords corresponding to the target word vectors can be summarized by artificial means to obtain the work category information of the work to be classified, which is not limited here. For example, the keywords corresponding to the word vectors in the category cluster are growth, fishing, wild, plant, water, wild fishing, popular science, respectively, and the work category information of the work to be classified can be obtained as fishing or fishing. For another example, the keywords corresponding to the word vectors in the category cluster are writing, textbook, learning, idiom, enlightenment, reading, learning, blackboard, reading, painting, school, understanding, writing, book cover, writing, composition, respectively, and the work category information of the work to be classified can be obtained as primary education.

[0085] After the work category information of the work to be classified is determined in the embodiments of the present disclosure, in an embodiment, the author category information of the author to which the work to be classified belongs can also be determined based on the work category information of the work to be classified. When the work category information of the work to be classified only contains one work category, the work category can be used as the author category information of the author to which the work to be classified belongs. For example, if the work category of the work to be classified is beauty, then the author category of the author to which the work to be classified belongs is beauty.

[0086] In some cases, the same author can publish works of different categories, for example, the author S can publish works of beauty, life, travel, etc. In this case, in an embodiment, the number of works of the same author in the determined multiple work categories can be determined based on the work category information of each work to be classified; and then the work category with the largest number of works of the author in the multiple work categories is used as the author category of the author.

[0087] Specifically, for example, if the author S publishes 60 pieces of works to be classified in the makeup category, 30 pieces of works to be classified in the life category, and 10 pieces of works to be classified in the travel category, the author category of the author S is the makeup category.

[0088] In an embodiment, the proportion of the number of works of the same author in each of the determined work categories can also be determined based on the work category information of each work to be classified; and then the author category of the author can be determined based on the proportion of the number of works in each of the work categories.

[0089] Specifically, for example, in the above example, the proportion of the number of works to be classified in the makeup category published by the author S is 60%, the proportion of the number of works to be classified in the life category is 30%, and the proportion of the number of works to be classified in the travel category is 10%. Therefore, the author category of the author S is 60% makeup, 30% life, and 10% travel.

[0090] The training process of the target model is also described in detail in the embodiments of the present disclosure.

[0091] Specifically, first, a plurality of preset keywords in a plurality of preset works can be obtained; then, the plurality of preset keywords are respectively input into the target model to be trained to obtain the word vectors of the plurality of preset keywords; finally, the word vectors of any two preset keywords belonging to the same preset work are taken as positive samples, and the word vectors of any two preset keywords belonging to different preset works are taken as negative samples, and the target model to be trained is trained to obtain the trained target model.

[0092] Here, the plurality of preset keywords can be extracted for each preset work. In a specific implementation, the number of preset works can be represented as N (N is a positive integer greater than or equal to 1), and the preset keywords can be represented as wherein, represents the mth preset keyword of the tth work (t is greater than or equal to 1 and less than or equal to N). Generally, the preset keywords in the plurality of preset works can be different.

[0093] In an embodiment, a plurality of candidate keywords in a plurality of preset works can be obtained, and then the plurality of candidate keywords are taken as preset keywords and input into the target model to be trained. In an embodiment, a plurality of candidate keywords in a plurality of preset works can also be obtained; then, for each candidate keyword, the relevance of the candidate keyword to the preset work in which the candidate keyword is located is determined; finally, based on the relevance of each candidate keyword to the preset work in which the candidate keyword is located, a plurality of preset keywords with a relevance meeting a second set threshold are selected from the plurality of candidate keywords.

[0094] In specific implementations, the relevance of the candidate keyword to the preset work in which the candidate keyword is located can be determined according to the frequency of occurrence of the candidate keyword in the preset work. The higher the frequency of occurrence of the candidate keyword, the greater the relevance of the candidate keyword to the preset work. In one approach, the BM25 algorithm can be used to select multiple keywords that have a relevance to the preset work that meets a second set threshold. The process of selecting keywords using the BM25 algorithm can refer to the steps of S101 described above, and the repeated parts will not be described again.

[0095] Finally, the multiple preset keywords that are filtered out and have a relevance to the preset work that meets the preset condition are respectively input into the target model to be trained for training. It should be noted that the filtered preset keywords should cover each preset work. Specifically, for each preset work, multiple preset keywords that have a relevance to the preset work that meets the preset condition can be filtered out from the preset work.

[0096] Using the target model to be trained, a word vector corresponding to each preset keyword in a target vector space can be obtained. Here, the word vector corresponding to each preset keyword can be represented as Here, the target vector space can refer to the Embedding Space mapping space. The word vector of each preset keyword in the target vector space can be a word vector in the Embedding Space mapping space.

[0097] In specific implementations, the target model to be trained can find the word vector corresponding to each preset keyword from the pre-generated keyword semantic matrix for each preset keyword. The keyword semantic matrix can be a semantic matrix in the Embedding Space mapping space.

[0098] After determining the word vectors of the preset keywords, the word vectors of any two preset keywords belonging to the same preset work can be used as positive samples, and the word vectors of any two preset keywords belonging to different preset works can be used as negative samples, to train the target model to be trained, to obtain a trained target model. In the embodiments of the present disclosure, no additional labels are required, and the self-supervised training of the target model can be achieved using positive samples and negative samples.

[0099] According to the word vectors corresponding to the multiple preset keywords of the same preset work, multiple positive samples can be obtained, which can be denoted as (z,z + ), where z represents a word vector corresponding to a preset keyword, and z +a word vector corresponding to a preset keyword that forms a positive sample with another preset keyword; according to the word vectors corresponding to the plurality of preset keywords of different preset works, a plurality of negative samples can be obtained, which can be denoted as (z, z - ), wherein z - represents a word vector corresponding to a preset keyword that forms a negative sample with another preset keyword. In an implementation, any positive sample can be selected as a reference positive sample from the positive samples, and a first similarity of the reference positive sample is determined based on the word vectors of the two preset keywords contained in the reference positive sample; and a second similarity of each negative sample is respectively determined based on the word vectors of the two preset keywords contained in each negative sample.

[0100] Here, the first similarity can refer to the semantic similarity between the word vectors of the two preset keywords contained in the reference positive sample, which can be denoted as sim(z, z + ); and the second similarity can refer to the semantic similarity between the word vectors of the two preset keywords contained in each negative sample, which can be denoted as sim(z, z - ).

[0101] Then, a sum of the similarities between the reference positive sample and each negative sample is determined based on the first similarity of the reference positive sample and the second similarities of the negative samples, which can be denoted as ∑ z'∈{z-,z+} sim(z, z'). A training loss is determined based on the first similarity corresponding to the reference positive sample and the sum of the similarities; and the target model to be trained is trained based on the training loss to obtain a trained target model.

[0102] In an implementation, the first similarity corresponding to the reference positive sample can be taken as a numerator, and the sum of the similarities can be taken as a denominator, and then the ratio of the numerator to the denominator is taken as a logarithm and then taken as a negative number, so that the training loss L can be obtained, that is,

[0103] In an ideal case, when the semantics between the word vectors of the two preset keywords are completely the same, it can be considered that the semantic similarity of the word vectors of the two preset keywords is 1; when the semantics between the word vectors of the two preset keywords are completely different, it can be considered that the semantic similarity of the word vectors of the two preset keywords is 0. Therefore, in general cases, the first similarity corresponding to the positive sample and the second similarity corresponding to the negative sample are between 0 and 1. When the numerator in the above training loss L is larger, the ratio of the numerator to the denominator is larger, and then the value of the training loss L is smaller.

[0104] Specifically, in the first round of training, after inputting the plurality of preset keywords into the target model to be trained to obtain the word vectors of the plurality of preset keywords, the training loss L1 is determined based on the first similarity corresponding to the reference positive sample and the sum of the similarities, and then the target model to be trained is trained by using the training loss L1. Specifically, the relevant parameters in the target model can be modified according to the training loss L1, so that the target model after modification of the parameters can determine the word vectors that are closer in spatial distance for the preset keywords that are semantically similar.

[0105] In the second round of training, the plurality of preset keywords are re-input into the target model to be trained to re-obtain the word vectors of the plurality of preset keywords, and a positive sample is re-selected as a reference positive sample (the re-selected reference positive sample can be different from the historically selected reference positive sample), and a plurality of negative samples are re-constituted, and then the training loss L2 is determined based on the first similarity corresponding to the re-selected reference positive sample and the sum of the similarities, and then the target model to be trained is trained by using the training loss L2. According to the training loss L2, the relevant parameters in the target model are continuously modified.

[0106] Next, the above steps are repeatedly performed until a training cutoff condition is reached to obtain a trained target model. The training cutoff condition can include that the number of times that the difference between the training losses of adjacent two rounds is less than a set threshold reaches a first preset number; or the number of iterations of training the target model to be trained reaches a second preset number. When the number of times that the difference between the training losses of adjacent two rounds is less than a set threshold reaches a first preset number, it means that the training losses of adjacent two rounds are close to each other, and at this time the training can be stopped.

[0107] In an implementation, when the target model includes a dimension reduction encoder, the plurality of preset keywords of each preset work can also be input into the feature extraction layer in the target model to be trained to obtain the initial word vectors of each preset keyword; and then the initial word vectors are input into the dimension reduction encoder of the target model to obtain the word vectors of the preset dimension corresponding to the preset keywords. This process can refer to the steps of S101 described above, and the repeated parts will not be described again.

[0108] After obtaining the word vectors of the preset dimension corresponding to the plurality of preset keywords, the word vectors of the preset dimension corresponding to any two preset keywords belonging to the same preset work are taken as positive samples, and the word vectors of the preset dimension corresponding to any two preset keywords belonging to different preset works are taken as negative samples, and the target model to be trained is trained to obtain a trained target model. The specific process can refer to the foregoing training process, which will not be described again.

[0109] As Figure 2In the flowchart of training the target model, a plurality of keywords can be extracted from each of the N preset articles, i.e., article 1-keyword 1, article 1-keyword 2, article 1-keyword 3, …; article 2-keyword 1, article 2-keyword 2, article 2-keyword 3, …; …; article N-keyword 1, article N-keyword 2, article N-keyword 3, ….

[0110] In the first round of training, the keywords are input into the feature extraction layer of the target model. The feature extraction layer obtains the initial word vectors of the keywords in the Embedding Space mapping space according to the keyword semantic matrix in the Embedding Space mapping space.

[0111] Then, the initial word vectors are input into the Text Encoder text encoder of the target model, and the corresponding reduced dimension word vectors of the initial word vectors are obtained. The Text Encoder text encoder can include two layers of encoders, such as Figure 3 As shown, the first layer of encoder can reduce the initial word vectors to 64-dimensional word vectors, and the second layer of encoder can reduce the 64-dimensional word vectors to 32-dimensional word vectors.

[0112] Next, the word vectors of any two keywords in article 1 (herein, the reduced dimension word vectors, the same below) are recorded as positive samples (herein, a positive sample can be understood as the reference positive sample described above), and the word vectors of any keyword in article 1 are recorded as negative samples with the word vectors of any keyword in other articles.

[0113] Next, the first similarity of the word vectors of the two keywords in the positive sample, the second similarity of the word vectors of the two keywords in each negative sample, and the sum of the first similarity of the positive sample and the second similarity of each negative sample are calculated.

[0114] The first similarity of the positive sample is taken as the numerator, and the sum of the similarities is taken as the denominator. Then, the ratio of the numerator to the denominator is taken as the logarithm, and then the negative number is taken, to obtain the training loss L1. Then, the target model is trained by using the training loss L1. By adjusting the related parameters of the target model, the optimization of the target model is realized.

[0115] In the subsequent multiple rounds of training, the above steps are repeated until the training is completed.

[0116] In the application process, the feature extraction layer in the trained target model can be used to extract word vectors with closer spatial distance in the target vector space for keywords with similar semantics, and extract word vectors with more distant spatial distance in the target vector space for keywords with dissimilar semantics. The feature extraction layer and the dimension reduction encoder in the trained target model can also be used to extract dimension-reduced word vectors with closer spatial distance in the target vector space for keywords with similar semantics, and extract dimension-reduced word vectors with more distant spatial distance in the target vector space for keywords with dissimilar semantics. Thus, in the class cluster obtained by clustering the word vectors of the multiple keywords in the work to be classified in the application stage, the keywords corresponding to the word vectors contained in the class cluster have more similar semantics, so that the work category information of the work to be classified can be more accurately determined.

[0117] Those skilled in the art can understand that, in the above method of the specific implementation, the writing order of each step does not mean a strict execution order and does not constitute any limitation on the implementation process, and the specific execution order of each step should be determined according to its function and possible internal logic.

[0118] Based on the same inventive concept, the disclosure embodiments also provide a device for determining work category information corresponding to the method for determining work category information. Since the principle of solving problems by the device in the disclosure embodiments is similar to the above-mentioned method for determining work category information, the implementation of the device can be referred to the implementation of the method, and the repeated parts will not be described here.

[0119] Reference Figure 4 As shown in FIG. 4, an architecture schematic diagram of a device for determining work category information provided by the disclosure embodiments is shown, and the device comprises a first acquisition module 401, a first determination module 402, a clustering module 403, and a second determination module 404.

[0120] The first acquisition module 401 is configured to acquire multiple keywords in a work to be classified.

[0121] The first determination module 402 is configured to determine word vectors of the multiple keywords in a target vector space based on a pre-trained target model. The spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the two word vectors. The target model is obtained by training any two preset keywords belonging to the same preset work as positive samples and any two preset keywords belonging to different preset works as negative samples.

[0122] The clustering module 403 is configured to cluster the word vectors of the multiple keywords to obtain at least one class cluster. The spatial distance between each word vector in each class cluster is less than a first set threshold.

[0123] The second determining module 404 is configured to determine the work category information of the work to be classified based on the keywords corresponding to each of the word vectors in the at least one cluster.

[0124] In a feasible implementation manner, the first determining module 402 is specifically configured to:

[0125] Input the multiple keywords into a pre-trained target model to obtain word vectors corresponding to the multiple keywords;

[0126] The device further comprises:

[0127] The second acquisition module is used to acquire multiple preset keywords from multiple preset works;

[0128] An input module, configured to input the plurality of preset keywords into the target model to be trained respectively, to obtain word vectors of the plurality of preset keywords;

[0129] The training module is used to use the word vectors of any two preset keywords belonging to the same preset work as positive samples, and the word vectors of any two preset keywords belonging to different preset works as negative samples, to train the target model to be trained, and obtain the trained target model.

[0130] In a feasible implementation manner, the training module is specifically used to:

[0131] Selecting any positive sample from the positive samples as a reference positive sample, and determining a first similarity of the reference positive sample based on word vectors of two preset keywords included in the reference positive sample; and determining a second similarity of each negative sample based on the word vectors of the two preset keywords included in each negative sample;

[0132] Determining a sum of similarities between the reference positive sample and each of the negative samples based on the first similarity of the reference positive sample and the second similarity of each of the negative samples;

[0133] Determining a training loss based on the first similarity of the reference positive sample and the sum of the similarities;

[0134] Based on the training loss, the target model to be trained is trained to obtain the trained target model.

[0135] In a feasible implementation manner, the input module is specifically configured to:

[0136] The plurality of preset keywords of each preset work is input into a feature extraction layer in a target model to be trained to obtain an initial word vector of each preset keyword, wherein a dimension of the initial word vector is higher than a preset dimension;

[0137] The initial word vector is input into a dimension reduction encoder of the target model to obtain a preset dimension word vector corresponding to the preset keyword.

[0138] In an implementation, the second acquisition module is specifically configured to:

[0139] acquire a plurality of candidate keywords in a plurality of preset works;

[0140] For each candidate keyword, determine a relevance of the candidate keyword to a preset work in which the candidate keyword is located;

[0141] Based on the relevance of each candidate keyword to the preset work in which the candidate keyword is located, select a plurality of preset keywords with a relevance meeting a second set threshold from the plurality of candidate keywords.

[0142] In an implementation, the second determination module 404 is specifically configured to:

[0143] Based on a number of the word vectors included in each of the class clusters, determine a target class cluster in which the number of the word vectors is the largest;

[0144] Based on a keyword corresponding to each of the word vectors in the target class cluster, determine work category information of the work to be classified.

[0145] In an implementation, the second determination module 404 is specifically configured to:

[0146] Based on each of the word vectors in the target class cluster, determine an average word vector of each of the word vectors;

[0147] Determine a target word vector closest to the average word vector among the word vectors of the target class cluster;

[0148] Based on a keyword corresponding to the target word vector, determine work category information of the work to be classified.

[0149] In an implementation, the apparatus further includes:

[0150] The third determination module is configured to determine author category information of an author to which the work to be classified belongs based on the work category information of the work to be classified.

[0151] In an implementation, the third determination module is specifically configured to:

[0152] determine the number of works of the same author in the determined multiple work categories based on the work category information of each of the works to be classified;

[0153] classify the works to be classified in the work category in which the number of works of the author is the largest among the multiple work categories as the author category of the author.

[0154] The description of the processing flow of each module in the device and the interaction flow between the modules can refer to the related description in the above method embodiments, and will not be described in detail here.

[0155] Based on the same technical concept, the embodiments of the present disclosure also provide a computer device. Referring to Figure 5 As shown in FIG. 5, the computer device 500 provided by the embodiments of the present disclosure includes a processor 501, a memory 502, and a bus 503. The memory 502 is used to store execution instructions, including an internal memory 5021 and an external memory 5022. The internal memory 5021 is also called an internal memory, which is used to temporarily store operation data in the processor 501 and exchange data with the external memory 5022 such as a hard disk. The processor 501 exchanges data with the external memory 5022 through the internal memory 5021. When the computer device 500 is running, the processor 501 and the memory 502 communicate through the bus 503, so that the processor 501 executes the following instructions:

[0156] obtain multiple keywords in the works to be classified;

[0157] determine word vectors of the multiple keywords in a target vector space based on a pre-trained target model; wherein the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the two word vectors; the target model is obtained by training any two preset keywords belonging to the same preset work as positive samples and any two preset keywords belonging to different preset works as negative samples;

[0158] cluster the word vectors of the multiple keywords to obtain at least one cluster; wherein the spatial distance between each of the word vectors in each of the clusters is less than a first set threshold;

[0159] determine the work category information of the works to be classified based on the keywords corresponding to each of the word vectors in the at least one cluster.

[0160] The embodiment of the present disclosure further provides a computer readable storage medium, and the computer readable storage medium stores a computer program. When the computer program is run by a processor, steps of the method for determining work category information are executed. The storage medium can be a volatile or non-volatile computer readable storage medium.

[0161] The embodiment of the present disclosure further provides a computer program product, and the computer program product carries a program code. The program code includes instructions for executing steps of the method for determining work category information. Details can be referred to the method embodiment, and details are not described herein.

[0162] The computer program product can be implemented by hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium. In another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) or the like.

[0163] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the apparatus described above can refer to the corresponding process in the foregoing method embodiments, and details are not described herein. In several embodiments provided by the present disclosure, it should be understood that the disclosed apparatus and method can be implemented by other means. The apparatus embodiments described above are only schematic. For example, the division of the units is only a logical function division, and actual implementation can have another division manner. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some communication interface, and can be electrical, mechanical or other forms.

[0164] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment.

[0165] In addition, each functional unit in each embodiment of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.

[0166] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a nonvolatile computer readable storage medium executable by a processor. Based on this understanding, the technical solutions of the present disclosure essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0167] Finally, it should be noted that: the above-described embodiments are only specific embodiments of the present disclosure, used to illustrate the technical solutions of the present disclosure, and not to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art who is familiar with the technology in the art can still make modifications or easily think of changes to the technical solutions described in the foregoing embodiments, or make equivalent replacements to some of the technical features; and these modifications, changes or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A method for determining work category information, characterized in that: include: Obtain multiple keywords from the works to be classified; Determining, based on a pre-trained target model, word vectors for the multiple keywords in a target vector space; wherein the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the any two word vectors; the target model is trained using the word vectors of any two preset keywords belonging to the same preset work as positive samples, and using the word vectors of any two preset keywords belonging to different preset works as negative samples; Clustering the word vectors of the multiple keywords to obtain at least one cluster; wherein the spatial distance between the word vectors in each cluster is less than a first set threshold; Determining the work category information of the work to be classified based on the keywords corresponding to each of the word vectors in the at least one cluster; The target model is trained by the following steps: Get multiple preset keywords from multiple preset works; Inputting the plurality of preset keywords into the target model to be trained respectively to obtain word vectors of the plurality of preset keywords; Selecting any positive sample from the positive samples as a reference positive sample, and determining a first similarity of the reference positive sample based on word vectors of two preset keywords included in the reference positive sample; and determining a second similarity of each negative sample based on the word vectors of the two preset keywords included in each negative sample; Determining a sum of similarities between the reference positive sample and each of the negative samples based on the first similarity of the reference positive sample and the second similarity of each of the negative samples; Determining a training loss based on the first similarity of the reference positive sample and the sum of the similarities; Based on the training loss, the target model to be trained is trained to obtain a trained target model.

2. The method according to claim 1, characterized in that The step of inputting the plurality of preset keywords into the target model to be trained to obtain word vectors of the plurality of preset keywords includes: Inputting multiple preset keywords of each of the preset works into a feature extraction layer of a target model to be trained to obtain an initial word vector for each of the preset keywords; the dimension of the initial word vector is higher than the preset dimension; The initial word vector is input into the dimensionality reduction encoder of the target model to obtain a word vector of a preset dimension corresponding to the preset keyword.

3. The method according to claim 1, characterized in that The step of obtaining a plurality of preset keywords from a plurality of preset works includes: Obtain multiple candidate keywords from multiple preset works; For each candidate keyword, determining the relevance between the candidate keyword and the preset work in which the candidate keyword is located; Based on the relevance between each candidate keyword and the preset work where the candidate keyword is located, a plurality of preset keywords whose relevance meets a second set threshold are selected from the plurality of candidate keywords.

4. The method according to claim 1, wherein The determining, based on the keywords corresponding to the word vectors in the at least one cluster, the category information of the work to be classified includes: Based on the number of word vectors included in each of the clusters, determining a target cluster having the largest number of word vectors in each of the clusters; Based on the keywords corresponding to the word vectors in the target cluster, the work category information of the work to be classified is determined.

5. The method according to claim 4, characterized in that The determining of the work category information of the work to be classified based on the keywords corresponding to each of the word vectors in the target cluster includes: Determining an average word vector of each word vector based on each word vector in the target cluster; Determine a target word vector closest to the average word vector among the word vectors of the target cluster; Based on the keywords corresponding to the target word vector, work category information of the work to be classified is determined.

6. The method according to claim 1, characterized in that After determining the work category information of the work to be classified, the method further includes: Based on the work category information of the work to be classified, the author category information of the author of the work to be classified is determined.

7. The method according to claim 6, characterized in that The determining, based on the work category information of the work to be classified, the author category information of the author of the work to be classified includes: Determining the number of works by the same author in the determined multiple work categories based on the work category information of each of the works to be classified; The category of the to-be-classified works in which the author has the largest number of works among the multiple categories of works is used as the author category of the author.

8. A device for determining work category information, characterized in that: include: A first acquisition module is used to acquire multiple keywords from the work to be classified; A first determination module is configured to determine, based on a pre-trained target model, word vectors for the plurality of keywords in a target vector space; wherein the spatial distance between any two word vectors in the target vector space is negatively correlated with the semantic similarity between the any two word vectors; and the target model is trained using the word vectors of any two preset keywords belonging to the same preset work as positive samples and the word vectors of any two preset keywords belonging to different preset works as negative samples; a clustering module, configured to cluster the word vectors of the plurality of keywords to obtain at least one cluster; wherein the spatial distance between the word vectors within each cluster is less than a first set threshold; A second determining module is configured to determine the work category information of the work to be classified based on the keywords corresponding to each of the word vectors in the at least one cluster; The target model is trained by the following steps: Get multiple preset keywords from multiple preset works; Inputting the plurality of preset keywords into the target model to be trained respectively to obtain word vectors of the plurality of preset keywords; Selecting any positive sample from the positive samples as a reference positive sample, and determining a first similarity of the reference positive sample based on word vectors of two preset keywords included in the reference positive sample; and determining a second similarity of each negative sample based on the word vectors of the two preset keywords included in each negative sample; Determining a sum of similarities between the reference positive sample and each of the negative samples based on the first similarity of the reference positive sample and the second similarity of each of the negative samples; Determining a training loss based on the first similarity of the reference positive sample and the sum of the similarities; Based on the training loss, the target model to be trained is trained to obtain a trained target model.

9. A computer device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the computer device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for determining work category information as described in any one of claims 1 to 7 are performed.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the method for determining work category information according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Text clustering method and device

    CN112632229A

  • Text similarity matching method and device based on circle loss, computer equipment and storage medium

    CN113221530A