Text evaluation method, device, electronic device and storage medium

By extracting keywords from text content, converting them into word vectors and transferring weights of topic dictionaries, calculating the similarity between text and topics, the problem of inaccurate evaluation of text content in the prior art is solved, and the text content and specificity are realized Assessment of accurate matches of topics.

CN112417845BInactive Publication Date: 2024-11-08WUHAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011299045.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-18
Publication Date
2024-11-08
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art lacks methods for quantitative evaluation of text or film and television content, especially in the evaluation of matching degree between different topics.

Method used

Use preset sorting algorithm and similarity measurement algorithm to extract keywords from the text to be evaluated, convert them into word vectors, obtain the target topic dictionary and perform weight transfer, calculate the similarity between the text and the topic, and pass the average value and cosine of the word vector. Similarity determines the degree of match.

Benefits of technology

Accurate quantitative evaluation of text content and specific topics is achieved, the problem of inaccurate matching evaluation between topics in different fields is solved, and the applicability in different fields is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112417845B_ABST
    Figure CN112417845B_ABST
Patent Text Reader

Abstract

The present application provides a text evaluation method, device, electronic device and storage medium, and relates to the field of evaluation technology. The method includes: extracting keywords from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm; converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus; obtaining a target subject dictionary, which is a subject dictionary obtained by weighting the weights of the word vectors in the first subject dictionary of the first subject to which the text corpus belongs, and performing weight migration on the weights of the word vectors in the second subject dictionary of the second subject; obtaining the first average value of each word vector in the text dictionary, and obtaining the second average value of each word vector in the target subject dictionary; determining the similarity between the text corpus and the second subject based on the first average value and the second average value. It is possible to evaluate the degree of match between the content of the text corpus and a specific subject.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the rapid development of the Internet, users can obtain more and more information through images, texts, movies and other media on the Internet. People usually have different opinions on the evaluation of different text content or film and television content. Because different people have different knowledge and values, and because of their different positions or perspectives, when facing a text or film and television content, the angles and levels of evaluation are often different. At present, there is no fixed standard for the evaluation of a text or film and television content, and there is a problem that the text or film and television content cannot be quantitatively evaluated on a specific topic. Therefore, there is currently no means to evaluate the degree of match between the content contained in a text or film to be evaluated and a specific topic we are concerned about. Summary of the invention

[0003] In order to solve the above technical problems, the purpose of the embodiments of the present application is to provide a text evaluation method, device, electronic device and storage medium.

[0004] In order to solve the above technical problems, in a first aspect, an embodiment of the present invention provides a text evaluation method, comprising:

[0005] Extract keywords from the text corpus to be evaluated based on the preset sorting algorithm and similarity measurement algorithm;

[0006] Convert the keywords into word vectors with weights to obtain a text dictionary of the text corpus;

[0007] Obtaining a target topic dictionary, wherein the target topic dictionary is a topic dictionary obtained by weighting the word vectors in a first topic dictionary of a first topic to which the text corpus belongs, and performing weight migration on the weights of the word vectors in a second topic dictionary of a second topic;

[0008] According to the weight of each word vector in the text dictionary, a first average value of each word vector in the text dictionary is obtained, and according to the weight of each word vector in the target subject dictionary, a second average value of each word vector in the target subject dictionary is obtained;

[0009] The similarity between the text language and the second topic is determined according to the first average value and the second average value.

[0010] In the above implementation process, when the input text corpus to be evaluated is detected, keywords are extracted from the text corpus to be evaluated based on a preset similarity measurement algorithm. After extracting the keywords, all keywords are converted into word vectors to generate a text dictionary of the text corpus to be analyzed. After that, a target subject dictionary is obtained, which is a subject dictionary obtained by weighting the weights of the word vectors in the first subject dictionary of the first subject to which the text corpus belongs, and migrating the weights of the word vectors in the second subject dictionary of the second subject. According to the weights of each word vector in the text dictionary, the first average value of each word vector in the text dictionary is obtained, and according to the weights of each word vector in the target subject dictionary, the second average value of each word vector in the target subject dictionary is obtained. According to the first average value and the second average value, the similarity between the text corpus and the second subject is determined. It can be seen from this that the degree of match between the content of the text corpus to be evaluated and a specific subject can be evaluated, thereby solving the problem of quantitative scoring of the text corpus on a specific subject.

[0011] Optionally, the sorting algorithm includes a TextRank algorithm, the similarity measurement algorithm includes a BM25 algorithm, and the extracting keywords from the text corpus to be evaluated based on the preset sorting algorithm and similarity measurement algorithm includes:

[0012] Using the TextRank algorithm to segment the text corpus into sentences according to separators in the text corpus, to obtain a plurality of original sentences;

[0013] Preprocessing each of the plurality of original sentences to obtain a plurality of preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words;

[0014] Determine the similarity between every two sentences in the preprocessed plurality of sentences by using the BM25 algorithm to generate a similarity matrix of the preprocessed plurality of sentences;

[0015] According to the similarity matrix, the preprocessed multiple sentences are sorted by using the TextRank algorithm to obtain a sentence sorting;

[0016] According to the sentence sorting, determining the plurality of key sentences;

[0017] Keywords are extracted from the plurality of key sentences.

[0018] In the above implementation process, the text corpus can be preprocessed in units of sentences, and after preprocessing, the similarity between sentences can be obtained based on the BM25 algorithm, and then the multiple sentences after preprocessing can be sorted using the TextRank, and key sentences can be extracted and determined based on the sentence sorting to extract keywords from the multiple key sentences. Key sentences and key words can be extracted from the text corpus, providing an accurate basis for the subsequent evaluation of the text.

[0019] Optionally, obtaining the target subject dictionary includes:

[0020] Obtain each word vector in the second topic dictionary and the weight of each word vector under the second topic;

[0021] From the first subject dictionary, obtain a synonym vector dictionary corresponding to each word vector in the first subject dictionary;

[0022] According to the weight of each word vector in the second topic dictionary under the second topic, and the weight adjustment parameter of each synonym vector in the synonym vector dictionary corresponding to each word vector, obtain the weight of each synonym vector corresponding to each word vector in the second topic dictionary under the first topic, wherein the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector in the second topic dictionary under the second topic;

[0023] The target topic dictionary is obtained according to each synonym vector corresponding to each word vector of the second topic dictionary and the weight of each synonym vector under the first topic.

[0024] In the above implementation process, by performing weight migration on the word vectors in the second topic, a target topic dictionary that can be used to evaluate the text corpus of the first topic is obtained. This can solve the problem that the text dictionary of the text corpus to be evaluated is not accurately evaluated directly using the second topic dictionary of the second topic because the first topic and the second topic described in the text corpus to be evaluated may belong to different fields. The target topic dictionary obtained after migration can be used to evaluate the content of the first topic. Therefore, new word recognition can be achieved in the case of an existing topic dictionary, which increases the applicability in different fields.

[0025] Optionally, converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus includes:

[0026] By using a pre-trained word2vec model, each of the keywords is converted into a word vector with a weight to obtain the text dictionary;

[0027] The word vectors in the target subject dictionary are word2vec vectors with weights, and obtaining a first average value of each word vector in the text dictionary according to the weights of each word vector in the text dictionary, and obtaining a second average value of each word vector in the target subject dictionary according to the weights of each word vector in the target subject dictionary include:

[0028] Performing a weighted average calculation according to the weight of each word vector in the text dictionary under the first topic to determine a first average value of each word vector in the text dictionary;

[0029] A weighted average calculation is performed according to the weight of each word vector in the target subject dictionary to determine a second average value of each word vector in the target subject dictionary.

[0030] In the above implementation process, the word vector is a word2vec vector, and a weighted average is performed according to the weight of each word vector in the text dictionary to obtain the first average value of each word vector in the text dictionary, and a weighted average is performed according to the weight of each word vector in the target topic dictionary to obtain the second average value of each word vector in the target topic dictionary. The weighted average value of the word vector provides a basis for the subsequent calculation of the similarity score of the text corpus under the target topic.

[0031] Optionally, determining the similarity between the text corpus and the second topic according to the first average value and the second average value includes:

[0032] The cosine similarity between the first average value and the second average value is calculated as the similarity between the text corpus and the second topic.

[0033] In the above implementation process, a method for quantitatively evaluating text content is provided, which can objectively and accurately evaluate the similarity between the text corpus and a specific topic, thereby determining the relevance of the text corpus to the specific topic.

[0034] In a second aspect, an embodiment of the present invention provides a text evaluation device, comprising:

[0035] An extraction module, used to extract keywords from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm;

[0036] A conversion module, used for converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus;

[0037] A migration module, used for obtaining a target topic dictionary, wherein the target topic dictionary is a topic dictionary obtained by weight migration of the weights of the word vectors in the second topic dictionary of the second topic based on the weights of the word vectors in the first topic dictionary of the first topic to which the text corpus belongs;

[0038] A calculation module, configured to obtain a first average value of each word vector in the text dictionary according to the weight of each word vector in the text dictionary, and to obtain a second average value of each word vector in the target subject dictionary according to the weight of each word vector in the target subject dictionary;

[0039] A determination module is used to determine the similarity between the text language and the second topic according to the first average value and the second average value.

[0040] In the above implementation process, when the input text corpus to be evaluated is detected, keywords are extracted from the text corpus to be evaluated based on a preset similarity measurement algorithm. After extracting the keywords, all keywords are converted into word vectors to generate a text dictionary of the text corpus to be analyzed. After that, a target subject dictionary is obtained, which is a subject dictionary obtained by weighting the weights of the word vectors in the first subject dictionary of the first subject to which the text corpus belongs, and migrating the weights of the word vectors in the second subject dictionary of the second subject. According to the weights of each word vector in the text dictionary, the first average value of each word vector in the text dictionary is obtained, and according to the weights of each word vector in the target subject dictionary, the second average value of each word vector in the target subject dictionary is obtained. According to the first average value and the second average value, the similarity between the text corpus and the second subject is determined. It can be seen from this that the degree of match between the content of the text corpus to be evaluated and a specific subject can be evaluated, thereby solving the problem of quantitative scoring of the text corpus on a specific subject.

[0041] Optionally, the sorting algorithm includes a TextRank algorithm, the similarity measurement algorithm includes a BM25 algorithm, and the extraction module includes:

[0042] A segmentation submodule, for segmenting the text corpus into sentences according to the separators in the text corpus using the TextRank algorithm to obtain a plurality of original sentences;

[0043] A preprocessing module, used for preprocessing each of the plurality of original sentences to obtain a plurality of preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words;

[0044] A similarity calculation submodule, used for determining the similarity between every two sentences in the plurality of preprocessed sentences by using the BM25 algorithm, so as to generate a similarity matrix of the plurality of preprocessed sentences;

[0045] A sorting submodule, used to sort the preprocessed multiple sentences using the TextRank algorithm according to the similarity matrix to obtain a sentence sorting;

[0046] A determination submodule, configured to determine the plurality of key sentences according to the sentence sorting, each of the key sentences containing at least one keyword;

[0047] The keyword extraction submodule is used to extract keywords from the multiple key sentences.

[0048] In the above implementation process, the text corpus can be preprocessed in units of sentences, and after preprocessing, the similarity between sentences can be obtained based on the BM25 algorithm, and then the multiple sentences after preprocessing can be sorted using the TextRank, and key sentences can be extracted and determined based on the sentence sorting to extract keywords from the multiple key sentences. Key sentences and key words can be extracted from the text corpus, providing an accurate basis for the subsequent evaluation of the text.

[0049] Optionally, the migration module includes:

[0050] A first acquisition submodule, used to acquire each word vector in the second topic dictionary and the weight of each word vector under the second topic;

[0051] A second acquisition submodule is used to acquire, from the first subject dictionary, a synonym vector dictionary corresponding to each word vector in the first subject dictionary;

[0052] A weight calculation submodule, configured to obtain the weight of each synonym vector corresponding to each word vector in the second subject dictionary under the first subject according to the weight of each word vector in the second subject dictionary under the second subject and the weight adjustment parameter of each synonym vector in the synonym vector dictionary corresponding to each word vector, wherein the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector in the second subject dictionary under the second subject;

[0053] The dictionary acquisition submodule obtains the target topic dictionary according to each synonym vector corresponding to each word vector of the second topic dictionary and the weight of each synonym vector under the first topic.

[0054] In the above implementation process, by performing weight migration on the word vectors in the second topic, a target topic dictionary that can be used to evaluate the text corpus of the first topic is obtained. This can solve the problem that the text dictionary of the text corpus to be evaluated is not accurately evaluated directly using the second topic dictionary of the second topic because the first topic and the second topic described in the text corpus to be evaluated may belong to different fields. The target topic dictionary obtained after migration can be used to evaluate the content of the first topic. Therefore, new word recognition can be achieved in the case of an existing topic dictionary, which increases the applicability in different fields.

[0055] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps of any one of the methods described in the first aspect are executed.

[0056] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising: computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the steps of any one of the methods described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0058] Figure 1 A flowchart of a text evaluation method provided in an embodiment of the present application;

[0059] Figure 2 A flowchart of another text evaluation method provided in an embodiment of the present application;

[0060] Figure 3 A flowchart of a keyword extraction method provided in an embodiment of the present application;

[0061] Figure 4 A flowchart of a weight migration method provided in an embodiment of the present application;

[0062] Figure 5 It is a structural diagram of a text evaluation device according to an embodiment of the present application. DETAILED DESCRIPTION

[0063] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0064] Figure 1 For a flowchart of a text evaluation method provided in an embodiment of the present application, please refer to Figure 1 , the text evaluation method may include the following steps:

[0065] In step S101, keywords are extracted from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm.

[0066] The text corpus to be evaluated may be a text corpus extracted from articles, pictures, videos, audios and other carriers. The similarity measurement algorithm, for example, may be the BM25 algorithm, which is used to obtain the similarity between sentences after dividing the content of the text corpus into sentences, and obtain a similarity matrix. The preset sorting algorithm may be, for example, the TextRank algorithm. After obtaining the above similarity matrix, the sentences are sorted based on the TextRank algorithm according to the similarity matrix, so that the key sentences with higher importance can be determined, and keywords can be extracted from the key sentences.

[0067] In step S102, the keywords are converted into word vectors with weights to obtain a text dictionary of the text corpus.

[0068] Exemplarily, a word vector model for a certain topic can be pre-established to convert keywords in a text corpus into word vectors with weights. The word vector model can be a Word2Vec model, and then a large number of words extracted from a large number of text corpora under the topic can be used to train the established word vector model to obtain a trained word vector model for the topic, and the trained word vector model can be used to convert keywords into Word2Vec word vectors with weights.

[0069] For example, if the text corpus to be evaluated is a text corpus extracted from a script of a film or TV series, a Word2Vec model for the film or TV series theme can be pre-established, and then a large number of words extracted from a large number of text corpora of film or TV series themes can be used to train the established Word2Vec model to obtain a trained Word2Vec model of the film or TV series theme. Thus, after obtaining the keywords extracted from the text corpus to be evaluated, each keyword is mapped to a weighted Word2Vec word vector through the Word2Vec model, and multiple Word2Vec word vectors are obtained as the text dictionary of the text corpus to be evaluated.

[0070] In step S103, a target topic dictionary is obtained, wherein the target topic dictionary is a topic dictionary obtained by performing weight migration on the weights of word vectors in a first topic dictionary of a first topic to which the text corpus belongs, based on the weights of word vectors in a first topic dictionary of a first topic.

[0071] The first topic can be understood as the topic to which the text corpus to be evaluated belongs. For example, when the text corpus is a text corpus of the content of a film or TV series, the first topic is the film or TV series topic. The second topic is used to evaluate a specific topic of the text corpus. The word vectors in the first topic dictionary of the first topic and the second topic dictionary of the second topic can both be weighted Word2Vec word vectors, and the first topic dictionary and the second topic dictionary are both pre-trained.

[0072] The training process of the first theme dictionary and the second theme dictionary is similar to the training process of the word vector model described in step S102. The word vector model corresponding to the theme, i.e., the Word2Vec model, can be established first, and then a large number of words extracted from a large number of text corpora under the theme can be used to train the established word vector model. The word vector model for the theme and the weighted word vectors corresponding to the large number of words can be trained to form a theme dictionary for the theme.

[0073] Through the above process, the word vector weight migration of the second topic dictionary is realized, and the target topic dictionary that can be used to evaluate the text corpus of the first topic is obtained. The above process is performed because the first topic and the second topic described in the text corpus to be evaluated may belong to different fields. Therefore, directly using the second topic dictionary of the second topic to evaluate the text dictionary of the text corpus may not be accurate enough. Therefore, it is necessary to migrate the weights of each word vector in the second topic based on the first topic, so that the target topic dictionary obtained after the migration can be used to evaluate the content of the first topic.

[0074] In step S104, a first average value of each word vector in the text dictionary is obtained according to the weight of each word vector in the text dictionary, and a second average value of each word vector in the target subject dictionary is obtained according to the weight of each word vector in the target subject dictionary.

[0075] In step S105, the similarity between the text language and the second topic is determined according to the first average value and the second average value.

[0076] Among them, taking the word vector as the Word2Vec word vector as an example, according to each Word2Vec word vector in the above text dictionary and its weight, the weighted average of each Word2Vec word vector can be calculated as the first average, and similarly, the weighted average of each Word2Vec word vector in the target topic dictionary can be calculated as the second average. Then, the cosine similarity of the first average and the second average can be used as the similarity score between the text corpus and the second topic. The score can characterize the degree of matching between the text corpus and the second topic.

[0077] It can be seen that through the above method, the matching degree between the content of the text corpus and the specific topic can be evaluated, and the problem of quantitative scoring of the text corpus on the specific topic can be solved.

[0078] Figure 2 For a flowchart of another text evaluation method provided in an embodiment of the present application, see Figure 2, the text evaluation method may include the following steps:

[0079] Step S201, obtaining a first subject dictionary of a first subject and a second subject dictionary of a second subject.

[0080] Among them, the first topic can be the topic to which the text corpus to be evaluated belongs, and the second topic is the topic to which we will evaluate the text corpus to confirm the degree of match between the text corpus and the second topic. For example, when the text corpus is the text corpus of the content of a film or TV series, the first topic is the film and TV theme, and the second topic is a specific value theme, which is used to evaluate the degree of match (or relevance) between the content of the text corpus and the specific value theme. The training process of the first theme dictionary and the second theme dictionary is the same as the method described in step 103 and will not be repeated here.

[0081] Step S202: obtaining the text corpus to be evaluated.

[0082] The text corpus to be evaluated may be a text corpus obtained by extracting content from a picture, an article, an audio or a video.

[0083] Step S203: extracting keywords from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm.

[0084] For example, the similarity measurement algorithm includes the BM25 algorithm, and the keyword extraction algorithm includes the TextRank algorithm. The TextRank algorithm is a graph-based sorting algorithm for text. Its basic idea comes from Google's PageRank algorithm. It divides the text into several components (words, sentences) and establishes a graph model, and uses a voting mechanism to sort the important components in the text. BM25 is an algorithm used to evaluate the relevance between search terms and documents. It is an algorithm proposed based on a probabilistic retrieval model.

[0085] Figure 3 For a flowchart of a keyword extraction method provided in an embodiment of the present application, please refer to Figure 3 , the above step S203 may include the following steps:

[0086] Step S2031, using the TextRank algorithm to segment the text corpus into sentences according to the separators in the text corpus, to obtain a plurality of original sentences.

[0087] For example, the separator can be: ".", "!", "?" and other symbols.

[0088] Step S2032, preprocessing each of the multiple original sentences to obtain multiple preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words.

[0089] Step S2033, using the BM25 algorithm to determine the similarity between every two sentences in the preprocessed multiple sentences, and generating a similarity matrix of the preprocessed multiple sentences based on the similarity between every two sentences.

[0090] After the above processing of segmenting each original sentence and removing stop words, each pre-processed sentence contains multiple words.

[0091] Based on each word in multiple preprocessed sentences, the similarity between sentences can be calculated by the following formula:

[0092]

[0093] Among them, S(A,B) represents the similarity score of sentence A to sentence B, and R(a i ,A) word a in sentence A i The importance of sentence A is expressed as R(a i ,B) word a i The importance of sentence B;

[0094]

[0095] Among them, N represents the number of all sentences in the text corpus, n(a i ) means containing word a i The number of sentences.

[0096]

[0097]

[0098] Among them, k1, k2, z are adjustment parameters, Bf i for a i The frequency of occurrence in sentence B, Af i For word a i is the frequency of words in sentence A, Bl is the length of sentence B (referring to the number of words), and avgl is the average length of sentences in the text corpus.

[0099] Then, a similarity matrix V of the preprocessed plurality of sentences is generated based on the similarity between every two sentences.

[0100] Step S2034: sort the preprocessed multiple sentences using the TextRank algorithm according to the similarity matrix to obtain a sentence ranking.

[0101] The general model of TextRank can be represented as a directed weighted graph G = (V, E), which consists of a point set V and an edge set E, where the set E is a subset of V × V. i , V j The weight of the edge between them is W j,i , for a given point V i ,In(V i ) represents the set of points pointing to the point Vi, Out(V i ) represents the set of points pointed to by point Vi.

[0102] Sorting the preprocessed sentences using the TextRank algorithm may include the following steps:

[0103] Step 1: For sentence i, initialize the importance score WS(V i );

[0104] Step 2: Calculate the importance score WS (V i ) new :

[0105]

[0106] Among them, update WS (V i )=WS(V i ) new ; V j Indicates that all points to V i Point, V k Indicates that all points to V j Point, W j,k Indicates V k With V j The weight value of the edge between two points is the similarity between sentences; the importance score of each sentence is calculated through iterative updating.

[0107] Step 3: Execute step 2 again until the WS(V i ) new -WS(V i ) is less than the preset threshold, and the current WS (V i );

[0108] Step 4: According to the current WS (V i ) to sort the sentences.

[0109] Step S2035: Determine the multiple key sentences according to the sentence sorting.

[0110] For example, according to the sentence ranking obtained above, the top M sentences with the highest ranking can be selected as key sentences.

[0111] Step S2036: extract keywords from the multiple key sentences.

[0112] Step S204, converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus. For example, each keyword can be converted into a word vector with weights through a pre-trained word2vec model to obtain the text dictionary. This method is the same as the method shown in step S102 and will not be repeated here.

[0113] Step S205, obtaining a target topic dictionary, which is a topic dictionary obtained by weighting the word vectors in a second topic dictionary of a second topic based on the weights of the word vectors in a first topic dictionary of a first topic to which the text corpus belongs, and performing weight migration on the word vectors in a second topic dictionary of a second topic.

[0114] This is because the first topic and the second topic described in the text corpus to be evaluated may belong to different fields, so directly using the second topic dictionary of the second topic to evaluate the text dictionary of the text corpus may not be accurate enough. Therefore, it is necessary to transfer the weights of each word vector in the second topic based on the first topic, so that the target topic dictionary obtained after the transfer can be used to evaluate the content of the first topic.

[0115] For example, Figure 4 For a flowchart of a weight migration method provided in an embodiment of the present application, please refer to Figure 4 , the S205 may specifically include the following steps:

[0116] Step S2051, obtaining each word vector in the second topic dictionary and the weight of each word vector under the second topic.

[0117] Step S2052: Obtain, from the first subject dictionary, a synonym vector dictionary corresponding to each word vector in the first subject dictionary.

[0118] Step S2053, according to the weight of each word vector in the second topic dictionary under the second topic, and the weight adjustment parameter of each synonym vector in the synonym vector dictionary corresponding to each word vector, obtain the weight of each synonym vector corresponding to each word vector in the second topic dictionary under the first topic, and the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector of the second topic dictionary under the second topic.

[0119] For example, the weight after migration can be calculated by the following formula:

[0120] score ij =weight i ×α i,j

[0121] Among them, weight i represents the weight of the word vector i in the second topic dictionary under the second topic, α i,j represents the weight adjustment parameter, that is, the weight of the synonym vector j of the word vector i in the first topic dictionary under the first topic, score ij Represents the weight of the word vector i after migration.

[0122] It should be noted that if there are multiple word vectors i from different positions in the second topic dictionary, and the multiple word vectors i have different weights, the highest weight is taken as the weight of the word vector i under the second topic. The above different positions can be understood as the same word appears in different text corpora when training the second topic dictionary.

[0123] Step S2054, obtaining the target topic dictionary according to each synonym vector corresponding to each word vector of the second topic dictionary and the weight of each synonym vector under the first topic.

[0124] Step S206, performing a weighted average calculation based on the weight of each word vector in the text dictionary under the first topic to determine a first average value of each word vector in the text dictionary, and performing a weighted average calculation based on the weight of each word vector in the target topic dictionary to determine a second average value of each word vector in the target topic dictionary.

[0125] Taking the word vector as a Word2Vec word vector as an example, according to each Word2Vec word vector and its weight in the above text dictionary, the weighted average of each Word2Vec word vector can be calculated as the first average. Similarly, the weighted average of each Word2Vec word vector in the target subject dictionary can be calculated as the second average.

[0126] Step S207: determining the similarity between the text language and the second topic according to the first average value and the second average value.

[0127] For example, the cosine similarity between the first average value and the second average value can be calculated as the similarity between the text corpus and the second topic. It can be understood that the cosine similarity between the first average value and the second average value is used as the similarity score between the text corpus and the second topic, and the score can be used to characterize the matching degree between the text corpus and the second topic, thereby achieving a quantitative evaluation of the matching degree between the text corpus content and a specific topic.

[0128] Based on the same inventive concept, the present application also provides a text evaluation device in the embodiment. Figure 5 , Figure 5 This is a structural diagram of a text evaluation device according to an embodiment of the present application. Figure 5 , the text evaluation device 500 may include:

[0129] An extraction module 501 is used to extract keywords from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm;

[0130] A conversion module 502, configured to convert the keywords into word vectors with weights to obtain a text dictionary of the text corpus;

[0131] A migration module 503 is used to obtain a target topic dictionary, wherein the target topic dictionary is a topic dictionary obtained by weight migration of the weights of the word vectors in the first topic dictionary of the first topic to which the text corpus belongs, based on the weights of the word vectors in the first topic dictionary of the first topic;

[0132] A calculation module 504 is used to obtain a first average value of each word vector in the text dictionary according to the weight of each word vector in the text dictionary, and to obtain a second average value of each word vector in the target subject dictionary according to the weight of each word vector in the target subject dictionary;

[0133] The determination module 505 is used to determine the similarity between the text language and the second topic according to the first average value and the second average value.

[0134] Optionally, the sorting algorithm includes a TextRank algorithm, the similarity measurement algorithm includes a BM25 algorithm, and the extraction module 501 may include:

[0135] A segmentation submodule, for segmenting the text corpus into sentences according to the separators in the text corpus using the TextRank algorithm to obtain a plurality of original sentences;

[0136] A preprocessing module, used for preprocessing each of the plurality of original sentences to obtain a plurality of preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words;

[0137] A similarity calculation submodule, used for determining the similarity between every two sentences in the plurality of preprocessed sentences by using the BM25 algorithm, so as to generate a similarity matrix of the plurality of preprocessed sentences;

[0138] A sorting submodule, used to sort the preprocessed multiple sentences using the TextRank algorithm according to the similarity matrix to obtain a sentence sorting;

[0139] A determination submodule, configured to determine the plurality of key sentences according to the sentence sorting, each of the key sentences containing at least one keyword;

[0140] The keyword extraction submodule is used to extract keywords from the multiple key sentences.

[0141] Optionally, the conversion module 502 is specifically configured to:

[0142] Each of the keywords is converted into a word vector with a weight through a pre-trained word2vec model to obtain the text dictionary.

[0143] Optionally, the migration module 503 may include:

[0144] A first acquisition submodule, used to acquire each word vector in the second topic dictionary and the weight of each word vector under the second topic;

[0145] A second acquisition submodule is used to acquire, from the first subject dictionary, a synonym vector dictionary corresponding to each word vector in the first subject dictionary;

[0146] A weight calculation submodule, configured to obtain the weight of each synonym vector corresponding to each word vector in the second subject dictionary under the first subject according to the weight of each word vector in the second subject dictionary under the second subject and the weight adjustment parameter of each synonym vector in the synonym vector dictionary corresponding to each word vector, wherein the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector in the second subject dictionary under the second subject;

[0147] The dictionary acquisition submodule obtains the target topic dictionary according to each synonym vector corresponding to each word vector of the second topic dictionary and the weight of each synonym vector under the first topic, wherein the word vector in the target topic dictionary is a weighted word2vec vector.

[0148] The calculation module 504 is specifically used for:

[0149] Performing a weighted average calculation according to the weight of each word vector in the text dictionary under the first topic to determine a first average value of each word vector in the text dictionary;

[0150] A weighted average calculation is performed according to the weight of each word vector in the target subject dictionary to determine a second average value of each word vector in the target subject dictionary.

[0151] Optionally, the determining module 505 is specifically configured to:

[0152] The cosine similarity between the first average value and the second average value is calculated as the similarity between the text corpus and the second topic.

[0153] It can be seen that, through the implementation method executed by the above device, the matching degree between the content of the text corpus and the specific topic can be evaluated, and the problem of quantitatively scoring the text corpus with respect to the specific topic can be solved.

[0154] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps of the text evaluation method described in any of the above embodiments are executed.

[0155] An embodiment of the present application further provides a computer-readable storage medium, including: computer program instructions are stored thereon, and when the computer program instructions are executed by a processor, the steps of the text evaluation method described in any of the above embodiments are implemented.

[0156] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0157] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0158] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0159] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0160] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0161] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A text evaluation method, characterized in that: include: Extract keywords from the text corpus to be evaluated based on the preset sorting algorithm and similarity measurement algorithm; Convert the keywords into word vectors with weights to obtain a text dictionary of the text corpus; Obtain a target topic dictionary, wherein the target topic dictionary is a topic dictionary obtained by weighting the word vectors in a first topic dictionary of a first topic to which the text corpus belongs, and performing weight migration on the weights of the word vectors in a second topic dictionary of a second topic; According to the weight of each word vector in the text dictionary, a first average value of each word vector in the text dictionary is obtained, and according to the weight of each word vector in the target subject dictionary, a second average value of each word vector in the target subject dictionary is obtained; Determining the similarity between the text corpus and the second topic according to the first average value and the second average value; Among them, the obtaining of the target topic dictionary includes: obtaining each word vector in the second topic dictionary, and the weight of each word vector under the second topic; obtaining, from the first topic dictionary, a dictionary of synonym vectors corresponding to each word vector in the first topic dictionary; obtaining the weight of each synonym vector corresponding to each word vector in the second topic dictionary under the first topic according to the weight of each word vector in the second topic dictionary under the second topic, and the weight adjustment parameter of each synonym vector in the dictionary of synonym vectors corresponding to each word vector, wherein the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector of the second topic dictionary under the second topic; obtaining the target topic dictionary according to each synonym vector corresponding to each word vector in the second topic dictionary, and the weight of each synonym vector under the first topic.

2. The method according to claim 1, characterized in that The sorting algorithm includes the TextRank algorithm, the similarity measurement algorithm includes the BM25 algorithm, and the keywords are extracted from the text corpus to be evaluated based on the preset sorting algorithm and similarity measurement algorithm, including: Using the TextRank algorithm to segment the text corpus into sentences according to separators in the text corpus, to obtain a plurality of original sentences; Preprocessing each of the plurality of original sentences to obtain a plurality of preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words; Determine the similarity between every two sentences in the preprocessed plurality of sentences by using the BM25 algorithm to generate a similarity matrix of the preprocessed plurality of sentences; According to the similarity matrix, the preprocessed multiple sentences are sorted by using the TextRank algorithm to obtain a sentence sorting; According to the sentence sorting, a plurality of key sentences are determined; Keywords are extracted from the plurality of key sentences.

3. The method according to claim 1, characterized in that The step of converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus includes: By using a pre-trained word2vec model, each of the keywords is converted into a word vector with a weight to obtain the text dictionary; The word vectors in the target subject dictionary are word2vec vectors with weights, and obtaining a first average value of each word vector in the text dictionary according to the weights of each word vector in the text dictionary, and obtaining a second average value of each word vector in the target subject dictionary according to the weights of each word vector in the target subject dictionary include: Performing a weighted average calculation according to the weight of each word vector in the text dictionary under the first topic to determine a first average value of each word vector in the text dictionary; A weighted average calculation is performed according to the weight of each word vector in the target subject dictionary to determine a second average value of each word vector in the target subject dictionary.

4. The method according to claim 3, characterized in that Determining the similarity between the text corpus and the second topic according to the first average value and the second average value includes: The cosine similarity between the first average value and the second average value is calculated as the similarity between the text corpus and the second topic.

5. A text evaluation device, characterized in that: include: An extraction module, used to extract keywords from the text corpus to be evaluated based on a preset sorting algorithm and a similarity measurement algorithm; A conversion module, used for converting the keywords into word vectors with weights to obtain a text dictionary of the text corpus; A migration module, used for obtaining a target topic dictionary, wherein the target topic dictionary is a topic dictionary obtained by weight migration of the weights of the word vectors in the second topic dictionary of the second topic based on the weights of the word vectors in the first topic dictionary of the first topic to which the text corpus belongs; A calculation module, configured to obtain a first average value of each word vector in the text dictionary according to the weight of each word vector in the text dictionary, and to obtain a second average value of each word vector in the target subject dictionary according to the weight of each word vector in the target subject dictionary; A determination module, configured to determine the similarity between the text corpus and the second topic according to the first average value and the second average value; The migration module includes: a first acquisition submodule, used to acquire each word vector in the second topic dictionary, and the weight of each word vector under the second topic; a second acquisition submodule, used to acquire, from the first topic dictionary, a dictionary of synonym vectors corresponding to each word vector in the first topic dictionary; a weight calculation submodule, used to acquire the weight of each synonym vector corresponding to each word vector in the second topic dictionary under the first topic according to the weight of each word vector in the second topic dictionary under the second topic and the weight adjustment parameter of each synonym vector in the dictionary of synonym vectors corresponding to each word vector, wherein the weight adjustment parameter is used to represent the weight of the synonym vector of the word vector of the second topic dictionary under the second topic; a dictionary acquisition submodule, which obtains the target topic dictionary according to each synonym vector corresponding to each word vector in the second topic dictionary and the weight of each synonym vector under the first topic.

6. The device according to claim 5, characterized in that The sorting algorithm includes the TextRank algorithm, the similarity measurement algorithm includes the BM25 algorithm, and the extraction module includes: A segmentation submodule, for segmenting the text corpus into sentences according to the separators in the text corpus using the TextRank algorithm to obtain a plurality of original sentences; A preprocessing module, used for preprocessing each of the plurality of original sentences to obtain a plurality of preprocessed sentences, wherein the preprocessing includes: word segmentation processing and removal of stop words; A similarity calculation submodule, used for determining the similarity between every two sentences in the plurality of preprocessed sentences by using the BM25 algorithm, so as to generate a similarity matrix of the plurality of preprocessed sentences; A sorting submodule, used to sort the preprocessed multiple sentences using the TextRank algorithm according to the similarity matrix to obtain a sentence sorting; A determination submodule, configured to determine a plurality of key sentences according to the sentence sorting, each of the key sentences containing at least one keyword; The keyword extraction submodule is used to extract keywords from the multiple key sentences.

7. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps in the method according to any one of claims 1 to 4 are executed.

8. A computer-readable storage medium, characterized in that: include: Computer program instructions are stored thereon, and when the computer program instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.