Sentence evaluation methods, devices, electronic equipment, and computer-readable storage media
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-04
- Publication Date
- 2026-08-11
AI Technical Summary
[0008]本公开所提供的实施例,对于待测句子和句子集合中的已有句子,计算待测句子与每个已有句子在每个预设评测维度的评测值,对不同评测维度的评测值进行融合,得到待测句子的评测融合值,并根据待测句子的评测融合值和句子集合的评测值,计算待测句子加入句子集合后得到的新的句子集合的评测值,通过该句子评测方法,综合使用每个评测维度对待测句子进行多评测维度的检测,在句子集合包含的已有句子的基础上,计算加入待测句子后得到的新的句子集合的评测值,有利于提高新的句子集合的评测结果的准确性。
Smart Images

Figure CN116151217B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a sentence evaluation method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] Natural language understanding and natural language processing are among the core issues of artificial intelligence, and also the core issues of current intelligent voice interaction and human-computer dialogue. Dialogue systems are a research direction in natural language processing, with research objectives including continuing dialogue based on the user's conversation history with the chatbot. Integrating a knowledge base into the dialogue process can inject new ideas into the dialogue system, generating richer and more diverse dialogue sentences. The higher the evaluation scores of sentences in the knowledge base across different evaluation dimensions, the more comprehensive and richer the generated sentences. Therefore, to improve the quality of the knowledge base, it is necessary to evaluate the sentence set in the knowledge base across multiple evaluation dimensions. Summary of the Invention
[0003] This disclosure provides a sentence evaluation method, apparatus, electronic device, and computer-readable storage medium. According to the method, a comprehensive evaluation of a collection of sentences can be performed across different evaluation dimensions.
[0004] In a first aspect, this disclosure provides a sentence evaluation method, which includes calculating the difference between the sentence to be tested and existing sentences in a sentence set at each preset evaluation dimension, and using this difference as the evaluation value of the sentence to be tested at each preset evaluation dimension; fusing the evaluation values of the sentence to be tested at each preset evaluation dimension to obtain a fused evaluation value of the sentence to be tested; using the evaluation value of the sentence set as a first evaluation value, adding the sentence set containing the sentence to be tested as a new sentence set, and calculating the evaluation value of the new sentence set based on the fused evaluation value of the sentence to be tested and the first evaluation value, as the evaluation result of the new sentence set.
[0005] Secondly, this disclosure provides a sentence evaluation device, which includes: a calculation module for calculating the difference value between the sentence to be tested and existing sentences in a sentence set in each preset evaluation dimension, and using the difference value as the evaluation value of the sentence to be tested in each preset evaluation dimension; a fusion module for fusing the evaluation values of the sentence to be tested in each preset evaluation dimension to obtain a fusion evaluation value of the sentence to be tested; and a determination module for using the evaluation value of the sentence set as a first evaluation value, using the sentence set with the sentence to be tested added as a new sentence set, and calculating the evaluation value of the new sentence set based on the fusion evaluation value of the sentence to be tested and the first evaluation value, and using the result of the new sentence set as the evaluation result of the new sentence set.
[0006] Thirdly, this disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the above-described sentence evaluation method.
[0007] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-described sentence evaluation method when executed by a processor / processing core.
[0008] The embodiments provided in this disclosure calculate the evaluation value of the sentence to be tested and each existing sentence in the sentence set in each preset evaluation dimension. The evaluation values of different evaluation dimensions are fused to obtain the evaluation fusion value of the sentence to be tested. Based on the evaluation fusion value of the sentence to be tested and the evaluation value of the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to the sentence set is calculated. Through this sentence evaluation method, each evaluation dimension is used to perform multi-evaluation dimension detection on the sentence to be tested. Based on the existing sentences contained in the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to be tested is calculated, which helps to improve the accuracy of the evaluation results of the new sentence set.
[0009] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0010] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:
[0011] Figure 1 A flowchart of a sentence evaluation method provided in this embodiment of the disclosure;
[0012] Figure 2 This diagram illustrates a sentence evaluation framework provided in an embodiment of the present disclosure.
[0013] Figure 3 A block diagram of a sentence evaluation device provided in an embodiment of this disclosure;
[0014] Figure 4 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0015] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0016] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0017] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0018] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, they specify the presence of features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0019] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0020] The sentence evaluation method according to embodiments of this disclosure can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The method can be implemented by a processor calling computer-readable program instructions stored in memory. Servers can include independent physical servers, server clusters consisting of multiple servers, or cloud servers capable of cloud computing.
[0021] In this embodiment of the disclosure, sentence evaluation refers to the detection of both the formal and semantic dimensions of the sentences to be added to the sentence set. According to the sentence evaluation method provided in this embodiment, each evaluation dimension is used comprehensively to perform multi-dimensional detection on the sentences to be tested. This allows for the calculation of the evaluation value of the new sentence set obtained after adding the sentences to be tested, based on the existing sentences in the sentence set. This helps improve the accuracy of the evaluation results for the new sentence set.
[0022] Figure 1 A flowchart illustrating a sentence evaluation method provided in an embodiment of this disclosure. (Refer to...) Figure 1 The sentence evaluation method may include the following steps.
[0023] S110, calculate the difference between the sentence to be tested and the existing sentences in the sentence set in each preset evaluation dimension, and use it as the evaluation value of the sentence to be tested in each preset evaluation dimension.
[0024] In some embodiments, the sentence to be tested can be understood as a sentence that needs to be added to the sentence set. The sentence to be tested can be a query or answer statement in a question-and-answer knowledge base, or a summary statement in a summary set of an event information base, etc. This disclosure does not impose specific limitations.
[0025] In this embodiment of the disclosure, the preset evaluation dimensions may include at least one of two dimensions: a formal detection dimension and a semantic detection dimension. For example, the sentence evaluation method of this embodiment of the disclosure can perform multi-dimensional evaluation on the sentence to be tested from both formal and semantic perspectives.
[0026] S120: The evaluation values of the sentence to be tested in each preset evaluation dimension are fused to obtain the evaluation fusion value of the sentence to be tested.
[0027] In this step, the evaluation fusion value obtained by fusing the evaluation values of each preset evaluation dimension of the sentence to be tested can be used as the evaluation value of the sentence to be tested.
[0028] S130, take the evaluation value of the sentence set as the first evaluation value, take the sentence set with the sentence to be tested as the new sentence set, calculate the evaluation value of the new sentence set based on the evaluation fusion value of the sentence to be tested and the first evaluation value, and take it as the evaluation result of the new sentence set.
[0029] In this step, the sentence set is updated with each new sentence added, and the evaluation value of the new sentence set is also updated accordingly. For example, when the sentence set contains only one sentence, denoted as sentence set {sentence 1}, the evaluation value of sentence set {sentence 1} is the evaluation fusion value of sentence 1. The evaluation fusion value of sentence 1 is the evaluation fusion value calculated according to steps S110-S120 above when sentence 1 is used as the sentence to be tested. When sentence 2 needs to be added to sentence set {sentence 1}, sentence 2 is used as the sentence to be tested, and the evaluation fusion value of sentence 2 is calculated through steps S110-S120 above. The evaluation value of sentence set {sentence 1} is used as the first evaluation value, and the sentence set {sentence 1} with added sentence 2 is updated accordingly. Sentence 1, Sentence 2} are used as a new sentence set. Based on the evaluation fusion value and the first evaluation value of sentence 2, the evaluation value of the new sentence set {sentence 1, sentence 2} is calculated and used as the evaluation result of the new sentence set {sentence 1, sentence 2}; ...; and so on. When sentence i needs to be added to the sentence set {sentence 1, sentence 2, ..., sentence i-1}, sentence i is used as the sentence to be tested. The evaluation fusion value of sentence i is calculated through the above steps S110-S120. The evaluation value of the sentence set {sentence 1, sentence 2, ..., sentence i-1} is used as the first evaluation value, and the sentence set with added sentence i is...
[0030] The set {sentence 1, sentence 2, ..., sentence i-1, sentence i} is used as a new sentence set. Based on the evaluation fusion value 5 and the first evaluation value of sentence i, the evaluation value of the new sentence set {sentence 1, sentence 2, ..., sentence i-1, sentence i} is calculated, and then...
[0031] The evaluation results are for the new set of sentences {sentence 1, sentence 2, ..., sentence i-1, sentence i}.
[0032] In this step, the evaluation value of the sentence group (new sentence set) obtained after the sentence to be tested is added to the sentence set is calculated, and the calculated evaluation value is used as the evaluation value of the new sentence set.
[0033] According to the sentence evaluation method of this disclosure, for the sentence to be tested and the existing sentences in the sentence set, the evaluation value of the sentence to be tested and each existing sentence in each preset evaluation dimension is calculated, and the evaluation values of different evaluation dimensions are fused.
[0034] The evaluation fusion value of the sentence to be tested is obtained. Based on the evaluation fusion value of the sentence to be tested and the evaluation value of the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to the sentence set is calculated. Through this sentence evaluation method, the sentence to be tested is detected from multiple evaluation dimensions by comprehensively using each evaluation dimension. Based on the existing sentences included in the sentence set, the evaluation fusion value is calculated.
[0035] Calculating the evaluation value of the new sentence set obtained after adding the sentences to be tested helps to improve the accuracy of the evaluation results of the new sentence set.
[0036] Figure 2 A schematic diagram of the sentence evaluation framework provided in an embodiment of this disclosure is shown below. (The following is in conjunction with...) Figure 2 The specific steps for calculating the difference value of the sentence to be tested and the existing sentences in the sentence set in each preset evaluation dimension in step S110 of the embodiments of this disclosure will be explained in detail.
[0037] like Figure 2 As shown, in some embodiments, the sentence evaluation method includes: S201, inputting the sentence to be tested and a set of sentences. The sentence set includes an existing sentence sequence; for example, the sentence to be tested is "What conditions are required for a loan?", and the existing sentence sequence...
[0038] The sentence sequence can be represented as sents_list = [sent1, sent2, ..., sentn], where sents_list represents the existing sentence sequence, that is, the sentence set includes n existing sentences, denoted as sent1, sent2, ..., sentn; n is an integer greater than or equal to 1; S202, calculate the difference values between the sentence to be tested and the existing sentences in the sentence set in the formal detection dimension and the semantic detection dimension, and obtain the evaluation value of each preset evaluation dimension of the sentence to be tested.
[0039] 5. In some embodiments, the preset evaluation dimensions include at least one of a formal detection dimension and a semantic detection dimension.
[0040] The evaluation value of the sentence under test can be calculated from either the formal detection dimension or the semantic detection dimension alone; alternatively, it can be calculated from both the formal detection dimension and the semantic detection dimension, thus achieving multi-dimensional detection of the sentence under test.
[0041] In some embodiments, the formal detection dimension may further include at least one of the following detection dimensions: a first type
[0042] Form detection and second-class form detection; the first-class form detection dimension is used to detect the classification method of the sentence; the second-class form detection dimension is used to detect the feature distribution of the sentence; the first-class form detection dimension includes: sentence structure detection...
[0043] The first category includes at least one of the following detection dimensions: sentence pattern detection dimension and sentence type detection dimension; the second category includes at least one of the following form detection dimensions: language distribution detection dimension, vocabulary level distribution detection dimension, word length distribution detection dimension and sentence length detection dimension; among them, the semantic detection dimension includes at least one of the following detection dimensions: word emotional color distribution detection dimension, constructional emotional color distribution detection dimension and register type detection dimension.
[0044] 5. In this embodiment, at least one of the sentence structure detection dimension, sentence pattern detection dimension, and sentence category detection dimension is used as the first...
[0045] One type of formal detection dimension includes language distribution detection dimension, vocabulary level distribution detection dimension, word length distribution detection dimension, and sentence length detection dimension as the second type of formal detection dimension.
[0046] In the first type of formal detection, sentence structure, sentence type, and sentence category can be understood as different ways of classifying sentences. According to sentence structure, sentences can be divided into sentences with "ba" in the form of "ba", sentences with "bei" in the form of "bei", sentences with "pivotal" in the form of "pivotal", sentences with "double object", sentences with "double object", sentences with "existential" in the form of "bi" in the form of "ba", sentences with "bei" in the form of "bei", sentences with "pivotal" in the form of "pivotal", and sentences with "bivotal" in the form of ... Among them, pivotal sentences are sentences in which the pivotal phrase functions as the predicate or stands alone as a sentence. Sentences where the pivotal phrase is at the core of the sentence are called pivotal sentences. They mainly include causative sentences (where the verb before the pivotal phrase carries the meaning of "cause," and the components after the pivotal phrase indicate purpose and consequence respectively), love-hate sentences (where the pivotal phrase is preceded by a verb with emotional connotations of "love" or "hate," and the components after the pivotal phrase indicate the reason), selective sentences, and "have" sentences (where the pivotal phrase is preceded by "have" or "don't have," and the components after the pivotal phrase describe the situation of the matter). Double-object sentences include sentences with two layers of objects, referring to both people and things; existential sentences are a specific sentence structure used to describe scenery or places, indicating where something or someone exists, appears, or disappears; variant sentences include elliptical sentences and inverted sentences. Inverted sentences include, for example, subject-postpositional sentences, attributive-postpositional sentences, and adverbial-postpositional sentences.
[0047] In some embodiments, sentences can be classified into subject-predicate sentences and non-subject-predicate sentences according to their sentence structure, and the determination of whether a sentence is a subject-predicate sentence or a non-subject-predicate sentence can be made. Among them, subject-predicate sentences can be further divided into verbal predicate sentences, adjectival predicate sentences, and nominal predicate sentences. Verbal predicate sentences, also known as "verbal sentences," are sentences in which a verb or verbal phrase serves as the main component of the predicate. Adjectival predicate sentences are sentences in which an adjective or adjectival phrase serves as the predicate. Nominal predicate sentences are sentences in which a noun or nominal phrase serves as the main component of the predicate.
[0048] In some embodiments, sentences can be classified into declarative sentences, interrogative sentences (e.g., yes / no questions, specific questions, alternative questions, rhetorical questions, etc.), imperative sentences, and exclamatory sentences according to sentence type.
[0049] In the second type of formal detection, the language distribution detection dimension, vocabulary level distribution detection dimension, word length distribution detection dimension, and sentence length detection dimension are used to detect the distribution information of sentence features. For example, the language distribution detection dimension is used to detect the distribution of the language type and number of words in a sentence; the vocabulary level distribution detection dimension is used to detect the vocabulary level distribution of words in a sentence; the word length distribution detection dimension is used to detect the length of words; and the sentence length detection dimension is used to detect the length of a sentence, that is, the number of words in the sentence.
[0050] The following describes the calculation process of the evaluation value of the sentence under test in each preset evaluation dimension, using a specific embodiment as an example, with the sentence to be tested as the query statement Query and the sentence set as sents_list = [sent1, sent2, ..., sentn].
[0051] like Figure 2 As shown, in some embodiments, the preset evaluation dimension is the first type of form detection dimension; the specific implementation methods for calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the first type of form detection dimension as the evaluation value of the sentence to be tested in the first type of form detection dimension are as follows:
[0052] S11 uses a pre-trained first-class form detection model to score the classification methods of the sentence to be tested and each existing sentence, obtaining the first classification method score of the sentence to be tested and the second classification method score of each existing sentence.
[0053] S12, calculate the difference between the score of the first classification method and the score of each second classification method to obtain the difference values of the scores of multiple classification methods.
[0054] S13: Using the pre-set difference weight values corresponding to the first type of form detection dimension for each existing sentence, the difference values of the scores of multiple classification methods are weighted and summed, and the weighted sum is used as the evaluation value of the sentence to be tested in the first type of form detection dimension.
[0055] Through steps S11-S13, the evaluation value of the sentence to be tested in the first type of form detection dimension can be calculated.
[0056] like Figure 2 As shown, in some embodiments, when the first type of form detection dimension is the sentence pattern detection dimension, the first type of form detection model is the sentence pattern detection model, and the evaluation value of the sentence to be tested in the first type of form detection dimension is the evaluation value of the sentence to be tested in the sentence pattern detection dimension.
[0057] In step S11 above, a pre-trained sentence pattern detection model can be used to score the sentence to be tested and each existing sentence in the sentence set in terms of sentence pattern detection dimension, so as to obtain the first sentence pattern score of the sentence to be tested and the second sentence pattern score of each existing sentence. The sentence pattern score can also be obtained by looking up a preset sentence pattern score table. The sentence pattern score table can be pre-constructed according to application requirements, such as the score 1 for the "ba" sentence, the score 2 for the "bei" sentence, the score 3 for the "jian" sentence, the score 4 for the "doubun" sentence, the score 5 for the "cun" sentence, the score 6 for the "variant" sentence, etc. The embodiments of this disclosure do not specifically limit the setting of specific sentence pattern scores.
[0058] In step S12 above, the difference between the score of the first sentence pattern and the score of each second sentence pattern is calculated to obtain multiple sentence pattern score difference values. For example, the sentence pattern score difference value is calculated between the sentence pattern score of the query and the sentence pattern score of each sentence in the sents_list to obtain multiple sentence pattern score difference values.
[0059] In step S13 above, the difference values of multiple sentence structure scores are weighted and summed using the difference weight values corresponding to the sentence structure detection dimension that are set in advance for each existing sentence. The weighted sum of the sentence structure scores is then used as the evaluation value of the sentence to be tested in the sentence structure detection dimension.
[0060] For example, a set of difference weight values corresponding to the sentence pattern detection dimension can be used. Each sentence pattern difference value is multiplied by the corresponding weight value to obtain multiple weighted sentence pattern difference values. The sum of the multiple weighted sentence pattern difference values is then used as the evaluation value of the query in the sentence pattern detection dimension.
[0061] like Figure 2 As shown, in some embodiments, when the first type of form detection dimension is the sentence pattern detection dimension, the first type of form detection model is the sentence pattern detection model, and the evaluation value of the sentence to be tested in the first type of form detection dimension is the evaluation value of the sentence to be tested in the sentence pattern detection dimension.
[0062] In step S11 above, a pre-trained sentence pattern detection model can be used to score the sentence to be tested and each existing sentence in the sentence set in terms of sentence pattern detection dimension, so as to obtain the first sentence pattern score of the sentence to be tested and the second sentence pattern score of each existing sentence. The sentence pattern score can also be obtained by looking up a preset sentence pattern score table. The sentence pattern score table can be pre-constructed according to the application requirements, such as subject-predicate sentence score 1, non-subject-predicate sentence score 2, etc. The specific sentence pattern score setting is not specifically limited in this embodiment.
[0063] In step S12 above, the difference between the first sentence pattern score and the score of each second sentence pattern is calculated to obtain multiple sentence pattern score difference values. For example, the sentence pattern difference value is calculated between the sentence pattern score of the query and the sentence pattern score of each sentence in the sents_list to obtain multiple sentence pattern score difference values.
[0064] In step S13 above, the difference values of multiple sentence pattern scores are weighted and summed using the difference weight values corresponding to the sentence pattern detection dimension that are set in advance for each existing sentence, and the weighted sum of sentence pattern scores is obtained as the evaluation value of the sentence to be tested in the sentence pattern detection dimension.
[0065] For example, a set of difference weight values corresponding to the sentence pattern detection dimension can be used. Each sentence pattern difference value is multiplied by the corresponding weight value to obtain multiple weighted sentence pattern difference values. The sum of the multiple weighted sentence pattern difference values is then used as the evaluation value of the query in the sentence pattern detection dimension.
[0066] like Figure 2 As shown, in some embodiments, when the first type of form detection dimension is the sentence type detection dimension, the first type of form detection model is the sentence type detection model, and the evaluation value of the sentence to be tested in the first type of form detection dimension is the evaluation value of the sentence to be tested in the sentence type detection dimension.
[0067] In step S11 above, a pre-trained sentence class detection model can be used to score the sentence to be tested and each existing sentence in the sentence set according to the sentence class detection dimension, so as to obtain the first sentence class score of the sentence to be tested and the second sentence class score of each existing sentence. The sentence class score can also be obtained by looking up a preset sentence class score table. The sentence class score table can be pre-constructed according to the application requirements, such as declarative sentence score 1, interrogative sentence score 2, imperative sentence score 3, exclamatory sentence score 4, etc. The specific sentence class score setting is not specifically limited in this embodiment.
[0068] In step S12 above, the difference between the first sentence category score and each second sentence category score is calculated to obtain multiple sentence category score difference values. For example, the sentence category difference value is calculated for the sentence category score of the query and the sentence category score of each sentence in the sents_list to obtain multiple sentence category score difference values.
[0069] In step S13 above, the difference values of multiple sentence class scores are weighted and summed using the difference weight values corresponding to the sentence class detection dimension that are set in advance for each existing sentence, and the weighted sum of the sentence class scores is used as the evaluation value of the sentence to be tested in the sentence class detection dimension.
[0070] For example, a set of difference weight values corresponding to the sentence class detection dimension can be used. Each sentence class difference value is multiplied by the corresponding weight value to obtain multiple weighted sentence class difference values. The sum of the multiple weighted sentence class difference values is then used as the evaluation value of the query in the sentence class detection dimension.
[0071] Based on the description of the above embodiments, the evaluation values of the sentence to be tested in the sentence structure detection dimension, sentence pattern detection dimension, and sentence category detection dimension can be obtained.
[0072] like Figure 2 As shown, in some embodiments, the preset evaluation dimension is the second type of form detection dimension; the specific implementation methods for calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the second type of form detection dimension as the evaluation value of the sentence to be tested in the second type of form detection dimension are as follows:
[0073] S21. Using a pre-trained second-type form detection model, the sentence features of the sentence to be tested and each existing sentence are scored to obtain the first sentence feature score of the sentence to be tested and the second sentence feature score of each existing sentence.
[0074] S22, calculate the difference between the feature score of the first sentence and the feature score of each second sentence to obtain the difference values of the feature scores of multiple sentences.
[0075] S23 sums the difference values of feature scores for multiple sentences, and uses the ratio of the summation result to the number of sentences in the sentence set as the evaluation value of the sentence to be tested in the second type of form detection dimension.
[0076] Through the above steps S21-S23, the evaluation value of the sentence to be tested in the second type of form detection dimension can be calculated.
[0077] like Figure 2 As shown, in some embodiments, when the second type of form detection dimension is the language distribution detection dimension, the second type of form detection model is the language distribution detection model, the sentence feature is the language distribution, and the language distribution detection model is used to: take the ratio of the number of languages in the sentence to the sentence length as the language distribution score of the sentence.
[0078] In this embodiment of the disclosure, sentence length refers to the number of words contained in a sentence.
[0079] As an example, in step S21, the query and sents_list are input into the language distribution detection model and scored for language distribution, so as to obtain the language distribution score of the query and the language distribution score of each sentence in sents_list.
[0080] In steps S22 and S23, the difference between the query language distribution score and the language distribution score of each sentence in the sents_list is calculated, and the calculated differences are summed. The ratio of the summed difference to the number of sentences in the sents_list is used as the evaluation value of the query in the language distribution detection dimension.
[0081] like Figure 2 As shown, in some embodiments, when the second type of form detection dimension is the lexical level distribution detection dimension, the second type of form detection model is the lexical level distribution detection model, the sentence feature is the lexical level distribution, and the lexical level distribution detection model is used to: use preset lexical level weights to perform weighted summation of the number of words at each lexical level in the sentence, and use the ratio of the total number of words obtained by weighted summation to the sentence length as the lexical level distribution score of the sentence.
[0082] As an example, in step S21, query and sents_list are respectively input into the lexical level distribution detection model to perform lexical level distribution scoring, so as to obtain the lexical level distribution score of query and the lexical level distribution score of each sentence in sents_list.
[0083] Specifically, a weight can be pre-set for each vocabulary level. Vocabulary levels include multiple levels such as Level 1, Level 2, Level 3, and Level 4. For example, the weight for Level 1 is 0.1; for Level 2, it is 0.2; for Level 3, it is 0.3; and so on. A corresponding weight is set for each vocabulary level. The specific weight value can be customized according to actual needs, and this embodiment does not impose specific limitations. The vocabulary level can be determined based on the vocabulary list of each level. After determining the vocabulary level of each word in the sentence, the vocabulary level score of the sentence is equal to the ratio of the weighted sum of the number of words at each vocabulary level in the sentence to the sentence length.
[0084] In steps S22 and S23, the difference between the lexical level distribution score of the query and the lexical level distribution score of each sentence in the sents_list is calculated, and the calculated differences are summed. The ratio of the summed difference to the number of sentences in the sents_list is used as the evaluation value of the query in the lexical level distribution detection dimension.
[0085] like Figure 2As shown, in some embodiments, when the second type of form detection dimension is the word length distribution detection dimension, the second type of form detection model is the word length distribution detection model, the sentence feature is the word length distribution, and the word length distribution detection model is used to: use preset word length weights to perform weighted summation on the number of words with different word lengths in the sentence, and use the ratio of the total number of words obtained by weighted summation to the sentence length as the word length distribution score of the sentence.
[0086] As an example, in step S21, the word length distribution of the input word length distribution detection model is scored for query and sents_list respectively, so as to obtain the word length distribution score of query and the word length distribution score of each sentence in sents_list.
[0087] Specifically, a weight can be pre-set for each word length in the sentence; when the word length is 1, the corresponding weight is 0.1; when the word length is 2, the corresponding weight is 0.2; and so on, a corresponding weight is set for each word length. The specific weight value can be customized according to actual needs, and this embodiment does not make specific limitations. After determining the word length of each word in the sentence, the word length distribution score of the sentence is equal to: the weighted sum of the number of words of each word length in the sentence divided by the sentence length, where the sentence length is the number of words in the sentence.
[0088] In steps S22 and S23, the difference between the query word length distribution score and the word length distribution score of each sentence in sents_list is calculated, and the calculated differences are summed. The ratio of the summed difference to the number of sentences in sents_list is used as the evaluation value of the query in the word length distribution detection dimension.
[0089] like Figure 2 As shown, in some embodiments, when the second type of form detection dimension is the sentence length detection dimension, the second type of form detection model is a sentence length detection model, the sentence feature is the sentence length, and the sentence length detection model is used to determine the sentence length.
[0090] As an example, in step S21, the query and sents_list are input into the sentence length detection model to score the sentence length, and the sentence length score of the query and each sentence in sents_list are obtained.
[0091] Specifically, the sentence length (the number of words in the sentence) can be directly used as the sentence length score.
[0092] In steps S22 and S23, the difference between the query sentence length score and the sentence length score of each sentence in the sents_list is calculated, and the calculated sentence length differences are summed. The ratio of the summed difference to the number of sentences in the sents_list is used as the evaluation value of the query in the sentence length distribution detection dimension.
[0093] Based on the description of the above embodiments, the evaluation values of the sentence to be tested in the language distribution detection dimension, vocabulary level distribution detection dimension, word length distribution detection dimension, and sentence length detection dimension can be obtained.
[0094] like Figure 2 As shown, in some embodiments, the preset evaluation dimension is the sentiment feature distribution detection dimension; the specific implementation methods for calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the sentiment feature distribution detection dimension as the evaluation value of the sentence to be tested in the sentiment feature distribution detection dimension are as follows:
[0095] S31. Using a pre-trained sentiment feature distribution detection model, sentiment color detection is performed on the sentence to be tested and each existing sentence to obtain the first sentiment color distribution score of the sentence to be tested and the second sentiment color distribution score of each existing sentence.
[0096] S32, calculate the difference between the first emotional color distribution score and each second emotional color distribution score to obtain multiple emotional color distribution score difference values.
[0097] S33: Summing the differences in multiple emotional color distribution scores, and using the ratio of the sum of the emotional color distribution score differences to the number of sentences in the sentence set as the evaluation value of the sentence to be tested in the emotional feature distribution detection dimension.
[0098] Through the above steps S31-S33, the evaluation value of the sentence to be tested in the emotion feature distribution detection dimension can be calculated.
[0099] like Figure 2 As shown, in some embodiments, when the emotion feature distribution detection dimension is the word emotion color distribution detection dimension, the emotion feature distribution detection model is used to detect the emotion color of words in a sentence. It uses a preset weight value for each emotion color to perform a weighted summation of the number of words with different emotion colors in the sentence, and uses the ratio of the total number of words obtained by the weighted summation to the sentence length as the emotion color distribution score of the sentence.
[0100] like Figure 2 As shown, in some embodiments, when the emotion feature distribution detection dimension is the construction emotion color distribution detection dimension, the emotion feature distribution detection model is used to detect the emotion color of each construction in the sentence. The number of constructions with each emotion color in the sentence is weighted and summed using the preset weight value of each emotion color. The ratio of the total number of constructions obtained by weighted summation to the sentence length is used as the construction emotion color distribution score of the sentence.
[0101] In this disclosed embodiment, the term "construction" refers to an emotional construction, which embodies rich emotional culture. Different emotional constructions can be used to express specific emotions. A construction can be understood as a combination of "form and meaning" or a combination of "grammatical form and meaning." Emotional constructions are divided into two categories: ontological constructions and fixed constructions. Ontological constructions are further divided into ontological constructions of emotional nouns, emotional verbs, and emotional adjectives, where the meaning of the emotional vocabulary pertains to the emotion expressed in the construction. Fixed constructions do not contain emotional vocabulary; rather, the overall construction expresses a specific emotion.
[0102] In the above embodiments, a weight value can be preset for each emotional color. For example, the weight value for positive emotional color is 0.5, the weight value for neutral emotional color is 0, and the weight value for negative emotional color is -0.5. The weight value of the emotional color can be set according to actual needs, and this disclosure does not impose specific limitations.
[0103] Through the above steps S31-S33, the evaluation values of the sentence to be tested in the word sentiment distribution detection dimension and the construction sentiment distribution detection dimension can be calculated.
[0104] like Figure 2 As shown, in some embodiments, the preset evaluation dimension is the style type detection dimension; the specific implementation methods for calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the style type detection dimension as the evaluation value of the sentence to be tested in the style type detection dimension are as follows:
[0105] S41, using a pre-trained register detection model, scores the register type of the sentence to be tested and the register type of each existing sentence, obtaining the first register type score of the sentence to be tested and the second register type score of each existing sentence.
[0106] For example, the query and sents_list are input into the register detection model respectively to score the register type, and the register type score of the query and the register type score of each sentence in sents_list are obtained.
[0107] Among them, register refers to the commonly used vocabulary and linguistic expressions with different characteristics formed when using language to communicate in various social fields for different groups of people and in different environments, so as to achieve effective communication according to different linguistic environments. In some embodiments, register types can be divided into business register, scientific and technological register, political register, and literary register, etc.; in other embodiments, register types can also be divided into spoken register and written register.
[0108] For example, the style score = number of style types / sentence length, where sentence length is the number of words in the sentence.
[0109] S42, calculate the difference between the score of the first style type and the score of each second style type to obtain the difference values of multiple style type scores.
[0110] In this step, the difference between the style score of the query and the style score of each sentence in the sents_list is calculated to obtain the difference between multiple style scores;
[0111] S43, sum the differences in scores for multiple style types, and use the ratio of the sum of style type scores to the number of sentences in the sentence set as the evaluation value of the sentence to be tested in the style type detection dimension.
[0112] In this step, the sum of multiple stylistic type difference values is calculated to obtain the total score of stylistic type score difference; the total score of stylistic type score difference is divided by the number of sentences in the sentence set, and the resulting value is used as the evaluation value of the query in the stylistic type detection dimension.
[0113] Through the above steps S41-S43, the evaluation value of the query in the stylistic type detection dimension can be calculated.
[0114] In some embodiments, step S120 may specifically include: weighting and summing the evaluation values of each preset evaluation dimension according to the preset weight values of the preset evaluation dimensions, and using the weighted sum as the evaluation fusion value of the sentence to be tested.
[0115] For example, the query's evaluation fusion value = w1 * evaluation value of language distribution detection dimension + w2 * evaluation value of vocabulary level distribution detection dimension + w3 * evaluation value of word length distribution detection dimension + w4 * evaluation value of sentence length detection dimension + w5 * evaluation value of sentence pattern detection dimension + w6 * evaluation value of sentence structure detection dimension + w7 * evaluation value of sentence type detection dimension + w8 * evaluation value of word emotional color distribution detection dimension + w9 * evaluation value of structure emotional color distribution detection dimension + w10 * evaluation value of register type detection dimension. The values of w1 to w10 can be customized according to actual needs.
[0116] In this embodiment of the disclosure, the values of the weights (w1 to w10) involved in each of the above evaluation dimensions can be preset empirical values or obtained based on pre-training. This embodiment of the disclosure does not impose any specific limitations.
[0117] It should be understood that the evaluation dimensions of the embodiments of this disclosure are not limited to the detection dimensions of the various aspects shown above. In practical application scenarios, the evaluation dimensions may include more or fewer detection dimensions.
[0118] In the embodiments of this disclosure, all types of pre-trained detection models used are language models. For example, the language model may be a bidirectional encoder (Bert) based on a transformer or other language models, and this disclosure does not specifically limit the types of models used.
[0119] In some embodiments, step S130 may specifically include: S51, summing the evaluation value of the sentence to be tested and the first evaluation value to obtain the sum of evaluation values; S52, using the ratio of the sum of evaluation values to the number of sentences in the new sentence set as the evaluation result of the new sentence set.
[0120] For example, suppose the evaluation value of the sentence set is d1, the number of sentences in the sentence set is m, and the evaluation value of the sentence to be added to the sentence set is d2. Then, the evaluation value of the new sentence set obtained by adding the sentence to be added to the sentence set is (d1+d2) / (m+1). The evaluation value of the new sentence set is used as the evaluation result of the new sentence set.
[0121] In some embodiments, if the evaluation value of the new sentence set is greater than or equal to the preset evaluation threshold, it means that the new sentence set meets the requirements for sentence evaluation results; if the evaluation value of the new sentence set is less than the preset evaluation threshold, it means that the new sentence set does not meet the requirements for sentence evaluation results. In this case, the sentence to be tested can be deleted from the new sentence set, thereby rejecting the addition of the sentence to be tested.
[0122] In some embodiments, if the sentence set already contains m sentences, and the evaluation value of the sentence set (containing each sentence) is known to be d1; the sentence to be tested is added to the sentence set to obtain a new sentence set, and the evaluation value of the new sentence set is d2. Then the evaluation value of the sentence to be tested can be expressed as: d2*(m+1)-d1*m.
[0123] In some embodiments, the sentence evaluation method of this disclosure can be used to perform sentence similarity evaluation. Specifically, the similarity between sentences in a sentence set is inversely proportional to the evaluation value of the sentence set. The higher the evaluation value of the sentence set, the lower the similarity between sentences in the sentence set; conversely, the lower the evaluation value of the sentence set, the higher the similarity between sentences in the sentence set.
[0124] According to the sentence evaluation method of this disclosure, the evaluation values of the sentence to be tested and each existing sentence in each preset evaluation dimension are calculated, and the evaluation values of different evaluation dimensions are fused to obtain the evaluation fusion value of the sentence to be tested. Based on the evaluation fusion value of the sentence to be tested and the evaluation value of the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to the sentence set is calculated. Through this sentence evaluation method, each evaluation dimension is used to perform multi-evaluation dimension detection on the sentence to be tested. Based on the existing sentences contained in the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to be tested is calculated, which is beneficial to improving the accuracy of the evaluation results of the new sentence set.
[0125] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0126] In addition, this disclosure also provides a sentence evaluation device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any of the sentence evaluation methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the corresponding section of the method and will not be repeated here.
[0127] Figure 3 This is a block diagram of a sentence evaluation device provided in an embodiment of the present disclosure. (Refer to...) Figure 3 This disclosure provides a sentence evaluation device, which may include the following modules.
[0128] The calculation module 310 is used to calculate the difference between the sentence to be tested and the existing sentences in the sentence set in each preset evaluation dimension, and use it as the evaluation value of the sentence to be tested in each preset evaluation dimension.
[0129] The fusion module 320 is used to fuse the evaluation values of the sentence under test in each preset evaluation dimension to obtain the evaluation fusion value of the sentence under test.
[0130] The determination module 330 is used to take the evaluation value of the sentence set as the first evaluation value, take the sentence set with the sentence to be tested as the new sentence set, calculate the evaluation value of the new sentence set based on the evaluation fusion value of the sentence to be tested and the first evaluation value, and take it as the evaluation result of the new sentence set.
[0131] In some embodiments, the preset evaluation dimension is the first type of form detection. When the calculation module 310 calculates the difference value between the sentence to be tested and the existing sentences in the sentence set in the first type of form detection dimension as the evaluation value of the sentence to be tested in the first type of form detection dimension, the specific implementation method is as follows: the classification method of the sentence to be tested and each existing sentence is scored by a pre-trained first type of form detection model to obtain the first classification method score of the sentence to be tested and the second classification method score of each existing sentence; the difference value between the first classification method score and each second classification method score is calculated to obtain multiple classification method score difference values; the difference values of multiple classification method scores are weighted and summed using the difference weight value corresponding to the first type of form detection dimension set for each existing sentence in advance, and the weighted sum is used as the evaluation value of the sentence to be tested in the first type of form detection dimension.
[0132] In some embodiments, the preset evaluation dimension is the second type of form detection; when the calculation module 310 calculates the difference value between the sentence to be tested and the existing sentences in the sentence set in the first type of form detection dimension as the evaluation value of the sentence to be tested in the second type of form detection dimension, the specific implementation method is as follows: through a pre-trained second type of form detection model, the sentence features of the sentence to be tested and each existing sentence are scored to obtain the first sentence feature score of the sentence to be tested and the second sentence feature score of each existing sentence; the difference value between the first sentence feature score and each second sentence feature score is calculated to obtain multiple sentence feature score difference values; the multiple sentence feature score difference values are summed, and the ratio of the summation result to the number of sentences in the sentence set is used as the evaluation value of the sentence to be tested in the second type of form detection dimension.
[0133] In some embodiments, when the second type of form detection dimension is a language distribution detection dimension, the second type of form detection model is a language distribution detection model, the sentence feature is language distribution, and the language distribution detection model is used to: take the ratio of the number of languages in the sentence to the sentence length as the language distribution score of the sentence; when the second type of form detection dimension is a vocabulary level distribution detection dimension, the second type of form detection model is a vocabulary level distribution detection model, the sentence feature is vocabulary level distribution, and the vocabulary level distribution detection model is used to: use preset vocabulary level weights to perform a weighted summation of the number of words at each vocabulary level in the sentence, and obtain the weighted summation result. The ratio of the total number of words to the sentence length is used as the lexical level distribution score of the sentence. When the second type of form detection dimension is the word length distribution detection dimension, the second type of form detection model is the word length distribution detection model, the sentence feature is the word length distribution, and the word length distribution detection model is used to: use preset word length weights to perform weighted summation of the number of words of different word lengths in the sentence, and use the ratio of the total number of words obtained by weighted summation to the sentence length as the word length distribution score of the sentence. When the second type of form detection dimension is the sentence length detection dimension, the second type of form detection model is the sentence length detection model, the sentence feature is the sentence length, and the sentence length detection model is used to determine the sentence length.
[0134] In some embodiments, the preset evaluation dimension is the sentiment feature distribution detection dimension. When the calculation module 310 calculates the difference between the sentence to be tested and the existing sentences in the sentence set in the sentiment feature distribution detection dimension, and uses this difference as the evaluation value of the sentence to be tested in the sentiment feature distribution detection dimension, the specific implementation method is as follows: Using a pre-trained sentiment feature distribution detection model, sentiment color detection is performed on the sentence to be tested and each existing sentence to obtain a first sentiment color distribution score for the sentence to be tested and a second sentiment color distribution score for each existing sentence; the difference between the first sentiment color distribution score and each second sentiment color distribution score is calculated to obtain multiple sentiment color distribution score difference values; the multiple sentiment color distribution score difference values are summed, and the ratio of the summation result to the number of sentences in the sentence set is used as the evaluation value of the sentence to be tested in the sentiment feature distribution detection dimension.
[0135] In some embodiments, when the sentiment feature distribution detection dimension is the word sentiment color distribution detection dimension, the sentiment feature distribution detection model is used to detect the sentiment color of words in a sentence. It uses a preset weight value for each sentiment color to perform a weighted summation of the number of words with different sentiment colors in the sentence, and the ratio of the total number of words obtained by the weighted summation to the sentence length is used as the sentiment color distribution score of the sentence. When the sentiment feature distribution detection dimension is the construction sentiment color distribution detection dimension, the sentiment feature distribution detection model is used to detect the sentiment color of each construction in the sentence. It uses a preset weight value for each sentiment color to perform a weighted summation of the number of constructions with each sentiment color in the sentence, and the ratio of the total number of constructions obtained by the weighted summation to the sentence length is used as the construction sentiment color distribution score of the sentence.
[0136] In some embodiments, the preset evaluation dimension is the style type detection dimension; when the calculation module 310 calculates the difference value between the sentence to be tested and the existing sentences in the sentence set in the style type detection dimension as the evaluation value of the sentence to be tested in the style type detection dimension, the specific implementation method is as follows: through the pre-trained style type detection model, the style type of the sentence to be tested and the style type of each existing sentence are scored to obtain the first style type score of the sentence to be tested and the second style type score of each existing sentence; the difference between the first style type score and each second style type score is calculated to obtain multiple style type score difference values; the multiple style type score difference values are summed, and the ratio of the summation result of the style type scores to the number of sentences in the sentence set is used as the evaluation value of the sentence to be tested in the style type detection dimension.
[0137] According to the sentence evaluation apparatus of this disclosure, for the sentence to be tested and the existing sentences in the sentence set, the evaluation value of the sentence to be tested and each existing sentence in each preset evaluation dimension is calculated. The evaluation values of different evaluation dimensions are fused to obtain the evaluation fusion value of the sentence to be tested. Based on the evaluation fusion value of the sentence to be tested and the evaluation value of the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to the sentence set is calculated. Through this sentence evaluation method, each evaluation dimension is used to perform multi-evaluation dimension detection on the sentence to be tested. Based on the existing sentences contained in the sentence set, the evaluation value of the new sentence set obtained after adding the sentence to be tested is calculated, which is beneficial to improving the accuracy of the evaluation results of the new sentence set.
[0138] It should be clarified that the present invention is not limited to the specific configurations and processes described in the above embodiments and shown in the figures. For the sake of convenience and brevity, detailed descriptions of known methods are omitted here, and the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0139] Figure 4This is a block diagram of an electronic device provided in an embodiment of the present disclosure.
[0140] Reference Figure 4 This disclosure provides an electronic device, which includes: at least one processor 401; at least one memory 402; and one or more I / O interfaces 403 connected between the processor 401 and the memory 402; wherein the memory 402 stores one or more computer programs that can be executed by the at least one processor 401, and the one or more computer programs are executed by the at least one processor 401 to enable the at least one processor 401 to perform the above-described sentence evaluation method.
[0141] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the above-described sentence evaluation method. The computer-readable storage medium may be volatile or non-volatile.
[0142] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in the processor of an electronic device, the processor in the electronic device executes the above-described sentence evaluation method.
[0143] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0144] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0145] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0146] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0147] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0148] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0149] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0150] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0151] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0152] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A sentence evaluation method, characterized in that, The method includes: The difference between the sentence to be tested and the existing sentences in the sentence set is calculated in each preset evaluation dimension, and used as the evaluation value of the sentence to be tested in each preset evaluation dimension; The evaluation values of the sentence to be tested in each preset evaluation dimension are fused to obtain the evaluation fusion value of the sentence to be tested; The evaluation value of the sentence set is used as the first evaluation value. The sentence set with the sentence to be tested is used as the new sentence set. The evaluation value of the new sentence set is calculated based on the evaluation fusion value of the sentence to be tested and the first evaluation value, and is used as the evaluation result of the new sentence set.
2. The method according to claim 1, characterized in that, The preset evaluation dimension is the first type of form detection dimension; the specific implementation of calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the first type of form detection dimension as the evaluation value of the sentence to be tested in the first type of form detection dimension is as follows: The first type of form detection model is pre-trained to score the classification method of the sentence to be tested and each existing sentence, so as to obtain the first classification method score of the sentence to be tested and the second classification method score of each existing sentence. Calculate the difference between the score of the first classification method and the score of each second classification method to obtain the difference values of multiple classification method scores; Using the pre-set difference weight values corresponding to the first type of form detection dimension for each existing sentence, the difference values of the scores of the multiple classification methods are weighted and summed, and the weighted sum is used as the evaluation value of the sentence to be tested in the first type of form detection dimension.
3. The method according to claim 1, characterized in that, The preset evaluation dimension is the second type of form detection dimension; the specific implementation of calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the second type of form detection dimension as the evaluation value of the sentence to be tested in the second type of form detection dimension is as follows: The pre-trained second-type form detection model is used to score the sentence features of the sentence to be tested and each existing sentence, so as to obtain the first sentence feature score of the sentence to be tested and the second sentence feature score of each existing sentence. Calculate the difference between the feature score of the first sentence and the feature score of each second sentence to obtain multiple sentence feature score difference values; The summation of the feature score differences of the multiple sentences, and the ratio of the summation result to the number of sentences in the sentence set, are used as the evaluation value of the sentence to be tested in the second type of form detection dimension.
4. The method according to claim 3, characterized in that, When the second type of form detection dimension is the language distribution detection dimension, the second type of form detection model is the language distribution detection model, the sentence feature is the language distribution, and the language distribution detection model is used to: take the ratio of the number of languages in the sentence to the sentence length as the language distribution score of the sentence; When the second type of form detection dimension is the lexical level distribution detection dimension, the second type of form detection model is the lexical level distribution detection model, the sentence feature is the lexical level distribution, and the lexical level distribution detection model is used to: use preset lexical level weights to perform weighted summation on the number of words at each lexical level in the sentence, and use the ratio of the total number of words obtained by weighted summation to the sentence length as the lexical level distribution score of the sentence; When the second type of form detection dimension is the word length distribution detection dimension, the second type of form detection model is the word length distribution detection model, the sentence feature is the word length distribution, and the word length distribution detection model is used to: use preset word length weights to perform weighted summation on the number of words with different word lengths in the sentence, and use the ratio of the total number of words obtained by weighted summation to the sentence length as the word length distribution score of the sentence; When the second type of form detection dimension is the sentence length detection dimension, the second type of form detection model is the sentence length detection model, the sentence feature is the sentence length, and the sentence length detection model is used to determine the sentence length.
5. The method according to claim 1, characterized in that, The preset evaluation dimension is the sentiment feature distribution detection dimension; the specific implementation of calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the sentiment feature distribution detection dimension as the evaluation value of the sentence to be tested in the sentiment feature distribution detection dimension is as follows: The pre-trained sentiment feature distribution detection model is used to detect the sentiment color of the sentence to be tested and each existing sentence, so as to obtain the first sentiment color distribution score of the sentence to be tested and the second sentiment color distribution score of each existing sentence. Calculate the difference between the first emotional color distribution score and each second emotional color distribution score to obtain multiple emotional color distribution score difference values; The summation of the differences in the multiple emotional color distribution scores is used as the ratio of the summation to the number of sentences in the sentence set, which is then used as the evaluation value of the sentence to be tested in the emotional feature distribution detection dimension.
6. The method according to claim 5, characterized in that, When the emotional feature distribution detection dimension is the word emotional color distribution detection dimension, the emotional feature distribution detection model is used to detect the emotional color of words in a sentence. It uses a preset weight value for each emotional color to perform a weighted summation of the number of words with different emotional colors in the sentence, and uses the ratio of the total number of words obtained by the weighted summation to the sentence length as the emotional color distribution score of the sentence. When the emotion feature distribution detection dimension is the construction emotion color distribution detection dimension, the emotion feature distribution detection model is used to detect the emotion color of each construction in the sentence. The number of constructions with each emotion color in the sentence is weighted and summed using the preset weight value of each emotion color. The ratio of the total number of constructions obtained by weighted summation to the sentence length is used as the construction emotion color distribution score of the sentence.
7. The method according to claim 1, characterized in that, The preset evaluation dimension is the style type detection dimension; the specific implementation of calculating the difference value between the sentence to be tested and the existing sentences in the sentence set in the style type detection dimension as the evaluation value of the sentence to be tested in the style type detection dimension includes: The pre-trained stylistic detection model scores the stylistic type of the sentence to be tested and the stylistic type of each existing sentence, thus obtaining the first stylistic type score of the sentence to be tested and the second stylistic type score of each existing sentence. Calculate the difference between the score of the first style type and the score of each second style type to obtain the score difference values of multiple style types; The summation of the differences in scores for the multiple register types is used as the ratio of the summation of the register type scores to the number of sentences in the sentence set, which is then used as the evaluation value of the sentence to be tested in the register type detection dimension.
8. A sentence evaluation device, characterized in that, include: The calculation module is used to calculate the difference between the sentence to be tested and the existing sentences in the sentence set in each preset evaluation dimension, and use it as the evaluation value of the sentence to be tested in each preset evaluation dimension; The fusion module is used to fuse the evaluation values of the sentence to be tested in each preset evaluation dimension to obtain the evaluation fusion value of the sentence to be tested. The determination module is used to take the evaluation value of the sentence set as the first evaluation value, take the sentence set with the sentence to be tested as the new sentence set, calculate the evaluation value of the new sentence set based on the evaluation fusion value of the sentence to be tested and the first evaluation value, and take the evaluation result of the new sentence set as the evaluation result of the new sentence set.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the sentence evaluation method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the sentence evaluation method as described in any one of claims 1-7.
Citation Information
Patent Citations
Replay feedback method, reply feedback device and intelligent equipment
CN113127612A