Training Method and Device for Semantic Understanding Model

The semantic understanding model training method addresses the limitations of existing classification methods by using semantic word library samples to enhance precision and interpretability through positive and negative sample optimization.

CN116186529BActive Publication Date: 2025-07-15BEIJING YUANLI WEILAI SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111425718.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-26
Publication Date
2025-07-15
Estimated Expiration
2041-11-26

AI Technical Summary

Technical Problem

When handling word semantic disambiguation tasks in the prior art, the multi-classification processing method lacks globality, while the binary classification processing method lacks the use of samples, resulting in low accuracy.

Method used

By obtaining the sentence unit sample and its semantic positive samples, filtering the semantic negative samples, and constructing the characteristics of the semantic positive samples and negative samples, inputting the semantic understanding model for processing, calculating the loss value and adjusting the model parameters until the training stop condition is met.

Benefits of technology

It improves the accuracy of word semantic disambiguation, ensures the interpretability of the model, and realizes accurate analysis of word semantics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116186529B_ABST
    Figure CN116186529B_ABST
Patent Text Reader

Abstract

This specification provides a training method and apparatus for a semantic understanding model. The training method for the semantic understanding model includes: obtaining sentence unit samples and semantic positive samples corresponding to the sentence unit samples; screening semantic negative samples corresponding to the sentence unit samples in a preset semantic vocabulary, and constructing semantic features corresponding to the semantic positive samples and the semantic negative samples respectively; inputting the semantic features into the semantic understanding model for processing to obtain semantic scores corresponding to the semantic positive samples and the semantic negative samples respectively; calculating a loss value based on the semantic scores, and adjusting a target semantic understanding model that meets the training stop condition according to the loss value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This specification relates to the field of machine learning technology, and particularly to a method and apparatus for training a semantic understanding model. Background Art

[0002] With the development of Internet technology, the single-word semantic disambiguation technology has been applied in more and more fields. By performing semantic analysis on the word units involved in a sentence, it can assist users in understanding the sentence meaning and make it more convenient for users to learn the sentence content. In the prior art, when dealing with the single-word semantic disambiguation task, most adopt a multi-classification or binary-classification scheme. Although the correct semantic that conforms to the sentence meaning can be screened out from multiple possible semantics through classification processing, the multi-classification processing method lacks globality, while the binary-classification processing method utilizes too few samples, affecting the accuracy. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention

[0003] In view of this, an embodiment of this specification provides a method for training a semantic understanding model. This specification also relates to a semantic determination method, a semantic understanding model training apparatus, a semantic determination apparatus, a computing device, and a computer-readable storage medium to solve the technical defects existing in the prior art.

[0004] According to the first aspect of the embodiments of this specification, a method for training a semantic understanding model is provided, including:

[0005] Obtain sentence unit samples and semantic positive samples corresponding to the sentence unit samples;

[0006] Screen semantic negative samples corresponding to the sentence unit samples in a preset semantic vocabulary, and construct semantic features corresponding to the semantic positive samples and the semantic negative samples respectively;

[0007] Input the semantic features into a semantic understanding model for processing to obtain semantic scores corresponding to the semantic positive samples and the semantic negative samples respectively;

[0008] Calculate a loss value based on the semantic scores, and adjust a target semantic understanding model that meets the training stop condition according to the loss value.

[0009] Optionally, the obtaining of the sentence unit samples and the semantic positive samples corresponding to the sentence unit samples includes:

[0010] Obtain the sentence unit samples;

[0011] Parse the sentence unit samples to obtain semantic tags corresponding to each word unit in the sentence unit samples;

[0012] Screen out the target semantic tags from the semantic tags, and extract the semantic positive samples from the semantic thesaurus based on the target semantic tags.

[0013] Optionally, the obtaining the sentence unit samples and the corresponding semantic positive samples includes:

[0014] Obtain the sentence unit samples, and perform word segmentation on the sentence unit samples to obtain a plurality of word units;

[0015] Match each word unit with the semantic samples included in the semantic thesaurus, and screen out the first word units according to the matching results;

[0016] Determine a plurality of initial semantic samples corresponding to the first word unit in the semantic thesaurus, and select the semantic positive samples associated with the first word unit from the plurality of initial semantic samples.

[0017] Optionally, the screening of the semantic negative samples corresponding to the sentence unit samples in the preset semantic thesaurus includes:

[0018] Determine a second word unit corresponding to the semantic positive sample in the sentence unit sample;

[0019] Determine at least two initial semantic negative samples corresponding to the second word unit in the semantic thesaurus;

[0020] According to the preset screening rules, screen out a set number of initial semantic negative samples from the at least two initial semantic negative samples as the semantic negative samples corresponding to the sentence unit samples.

[0021] Optionally, the constructing the semantic features corresponding to the semantic positive samples and the semantic negative samples respectively includes:

[0022] Concatenate the sentence unit sample with the semantic positive sample, and construct the positive semantic feature corresponding to the semantic positive sample according to the concatenation result, and

[0023] Concatenate the sentence unit sample with the semantic negative sample, and construct the negative semantic feature corresponding to the semantic negative sample according to the concatenation result.

[0024] Optionally, the inputting the semantic features into a semantic understanding model for processing to obtain the semantic scores corresponding to the semantic positive samples and the semantic negative samples respectively includes:

[0025] Input the positive semantic feature and the negative semantic feature into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample;

[0026] Correspondingly, calculating a loss value based on the semantic score value, and adjusting a target semantic understanding model that meets the training stop condition according to the loss value, includes:

[0027] Calculating the loss value based on the positive semantic score value and the negative semantic score value, and adjusting the parameters of the semantic understanding model according to the loss value until the target semantic understanding model that meets the training stop condition is obtained.

[0028] According to the second aspect of the embodiments of the present specification, a semantic determination method is provided, including:

[0029] Obtaining a target sentence unit containing a to-be-processed word unit;

[0030] Screening at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary, and constructing semantic features corresponding to each semantic information;

[0031] Inputting the semantic features into the target semantic understanding model in the above method for processing, and obtaining target semantic score values corresponding to each semantic information;

[0032] According to the target semantic score values, screening out the target semantic information associated with the target sentence unit from the at least two semantic information.

[0033] Optionally, the screening at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary includes:

[0034] Determining a word unit label corresponding to the to-be-processed word unit;

[0035] Querying the semantic vocabulary based on the word unit label to obtain at least two initial semantic information associated with the word unit label;

[0036] Filtering the at least two initial semantic information according to a preset filtering rule, and determining the at least two semantic information corresponding to the to-be-processed word unit according to the filtering result.

[0037] According to the third aspect of the embodiments of the present specification, a training device for a semantic understanding model is provided, including:

[0038] An acquisition sample module, configured to acquire a sentence unit sample and a semantic positive sample corresponding to the sentence unit sample;

[0039] A construction feature module, configured to screen a semantic negative sample corresponding to the sentence unit sample in a preset semantic vocabulary, and construct semantic features corresponding to the semantic positive sample and the semantic negative sample respectively;

[0040] A model processing module, configured to input the semantic features into a semantic understanding model for processing, and obtain semantic scores corresponding to the semantic positive samples and the semantic negative samples respectively;

[0041] A model training module, configured to calculate a loss value based on the semantic scores, and adjust a target semantic understanding model that meets the training stop condition according to the loss value.

[0042] According to the fourth aspect of the embodiments of this specification, a semantic determination device is provided, including:

[0043] An acquisition module, configured to acquire a target sentence unit including a to-be-processed word unit;

[0044] A construction module, configured to screen at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary, and construct semantic features corresponding to each semantic information;

[0045] A processing module, configured to input the semantic features into the target semantic understanding model in the above method for processing, and obtain target semantic scores corresponding to each semantic information;

[0046] A screening module, configured to screen out target semantic information associated with the target sentence unit from the at least two semantic information according to the target semantic scores.

[0047] According to the fifth aspect of the embodiments of this specification, a computing device is provided, including:

[0048] A memory and a processor;

[0049] The memory is used to store computer-executable instructions, and the processor is used to implement the steps of the semantic understanding model training method or the semantic determination method when executing the computer-executable instructions.

[0050] According to the sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the semantic understanding model training method or the semantic determination method are implemented.

[0051] The training method of the semantic understanding model provided in this specification, after obtaining the sentence unit samples and the corresponding semantic positive samples of the sentence unit samples, in order to be able to train a model that can accurately analyze the semantic meaning of each word in a sentence, semantic negative sample features corresponding to the sentence unit samples can be screened in a preset semantic vocabulary, and then semantic features corresponding to the semantic positive samples and semantic negative samples are constructed respectively. Input them into the semantic understanding model for processing to obtain the semantic scores corresponding to the semantic positive sample features and the semantic negative sample features respectively. Finally, calculate the loss value based on the semantic scores and optimize the model until a target semantic understanding model that meets the training stop condition is obtained. This realizes that during the model training process, the positive and negative samples can be fully used to train the model, which can not only improve the accuracy of word semantic disambiguation, but also ensure the interpretability of the model, so that the semantic determination can be accurately completed in the application stage. Brief Description of the Drawings

[0052] Figure 1 is a flowchart of a training method for a semantic understanding model provided by an embodiment of this specification;

[0053] Figure 2 is a flowchart of a semantic determination method provided by an embodiment of this specification;

[0054] Figure 3 is a processing flowchart of a semantic determination method applied to a teaching scenario provided by an embodiment of this specification;

[0055] Figure 4 is a schematic structural diagram of a training device for a semantic understanding model provided by an embodiment of this specification;

[0056] Figure 5 is a schematic structural diagram of a semantic determination device provided by an embodiment of this specification;

[0057] Figure 6 is a structural block diagram of a computing device provided by an embodiment of this specification. Detailed Description of the Embodiments

[0058] Many specific details are set forth in the following description in order to provide a thorough understanding of this specification. However, this specification can be implemented in many other ways different from those described herein, and those skilled in the art can make similar generalizations without departing from the connotation of this specification. Therefore, this specification is not limited by the specific embodiments disclosed below.

[0059] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0060] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0061] First, the noun terms related to one or more embodiments of this specification are explained.

[0062] BERT: Encodes text bidirectionally using a pre-training approach. BERT will pre-train a neural network stacked with Transformers using a large amount of unsupervised data and then apply it to downstream tasks. Transformers can encode bidirectional information of words and can better complete text understanding.

[0063] Negative sampling: A method used to improve the model training speed. Different from the original method of updating all weights for each training sample, negative sampling allows a training sample to update only a small part of the weights each time, thus reducing the computational amount in the gradient descent process.

[0064] Word sense disambiguation: Distinguish the semantic information of words in a sentence. A word itself has multiple semantics, but has a unique semantics in a sentence. Use a model to identify the semantic information of words in a sentence.

[0065] WordNet: An English dictionary based on cognitive linguistics jointly designed by linguists and computer engineers. Words are arranged in alphabetical order and form a network of words according to the meaning of the words.

[0066] In this specification, a method for training a semantic understanding model is provided. This specification also relates to a method for determining semantics, an apparatus for training a semantic understanding model, an apparatus for determining semantics, a computing device, and a computer-readable storage medium, which will be described in detail one by one in the following embodiments.

[0067] Figure 1 The flowchart of a method for training a semantic understanding model according to an embodiment of this specification is shown, specifically including the following steps:

[0068] Step S102, obtain sentence unit samples and semantic positive samples corresponding to the sentence unit samples.

[0069] Specifically, a sentence unit sample specifically refers to a sentence sample for training a semantic understanding model, and the sentence unit sample contains at least one word unit with two or more semantics, so as to train a semantic understanding model that can learn and analyze the correct semantics corresponding to the word unit. Correspondingly, a semantic positive sample specifically refers to the correct semantics corresponding to the word unit with two or more semantics in the sentence unit sample.

[0070] It should be noted that for different word units in different sentence unit samples, their corresponding correct semantics may be different. The determination of the correct semantics needs to be combined with the representation of the word unit in the sentence unit. Therefore, different sentence unit samples correspond to different semantic positive samples.

[0071] In this embodiment, the method for training a semantic understanding model is described by taking the sentence unit sample as an English sample. Correspondingly, the trained semantic understanding model is applied to semantic analysis in an English scenario; the semantic analysis processing of other languages can refer to the same or corresponding description content of this embodiment, and will not be elaborated here.

[0072] Furthermore, when obtaining sentence unit samples and their corresponding semantic positive samples, in order to improve the processing efficiency of the data preparation stage and thus reduce the training time of the semantic understanding model, on the one hand, the semantic positive samples can be determined by means of semantic label screening, and on the other hand, the semantic positive samples can be determined by means of semantic thesaurus matching. In this embodiment, the specific implementation method is as follows:

[0073] (1) Obtain the sentence unit sample; parse the sentence unit sample to obtain the semantic label corresponding to each word unit in the sentence unit sample; screen out the target semantic label from the semantic labels, and extract the semantic positive sample from the semantic thesaurus based on the target semantic label.

[0074] Specifically, a word unit specifically refers to each word unit obtained after performing word segmentation on the sentence unit sample. A semantic label specifically refers to a label representing the semantic meaning corresponding to each word unit, and each label can reflect the number of semantics corresponding to each word unit. Correspondingly, a target semantic label specifically refers to the label corresponding to a word unit with multiple semantics; correspondingly, a semantic thesaurus specifically refers to a database integrating the semantics of a large number of word units. Specifically, when implemented, the semantic thesaurus can use the WordNet English dictionary.

[0075] Based on this, after obtaining the sentence unit samples, word segmentation can be performed on them first to obtain each word unit; then, each word unit can be analyzed, and semantic tags corresponding to each word unit can be created based on the possible number of semantics it corresponds to. Then, by screening the semantic tags corresponding to the word units with multiple semantics as the target semantic tags, and finally, combined with the target semantic tags, the correct semantics corresponding to the word unit can be screened in the semantic dictionary as the semantic positive sample for subsequent model training.

[0076] In practical applications, considering that the target semantic tag represents that a word unit corresponds to multiple semantics, when selecting the semantic positive sample in the semantic dictionary, multiple semantics corresponding to the word unit may be queried. Since the semantic positive sample is the correct semantics corresponding to the word unit, the correct semantics can be determined from multiple semantics by combining the way of human participation as the semantic positive sample. That is, multiple candidate semantic samples are screened out from the semantic dictionary according to the target semantic tag, and then they are fed back to the reviewer, and the correct candidate semantic sample can be determined from the multiple candidate semantic samples as the semantic positive sample corresponding to the sentence unit sample in response to the operation instruction of the reviewer.

[0077] For example, the sentence unit sample "our cat is too lazy to mouse" is obtained, and then it is analyzed and parsed. It is determined that the semantic tag corresponding to "mouse" represents that this word corresponds to multiple semantics. At this time, the semantic tag Label_1 corresponding to the word "mouse" can be determined as the target semantic tag. Then, based on the target semantic tag, a query is made in the preset semantic dictionary WordNet. According to the query result, it is determined that the word "mouse" corresponds to four semantics, namely semantic S1 {any of numerous small…hairless tails}; semantic S2 {a swollen bruise caused by a blow to the eye}; semantic S3 {person who is quiet or timid}, and semantic S4 {a hand-operated electronic…room than a trackball}. At this time, according to the preset screening rules, among the four semantics, the more appropriate semantic S1 corresponding to the meaning of the sentence unit sample can be selected as the semantic positive sample corresponding to the sentence unit sample to facilitate subsequent model training.

[0078] It should be noted that the description content corresponding to each semantics in the above embodiments is only for illustrative purposes, and only a part is used as a representation for convenience of description.

[0079] In summary, by using the method of semantic tag screening to determine the semantic positive samples corresponding to the sentence unit samples, not only can the screening efficiency of the semantic positive samples be improved, but also the accuracy can be guaranteed, thereby effectively improving the model training efficiency.

[0080] (2) Obtain the sentence unit samples, and perform word segmentation on the sentence unit samples to obtain a plurality of word units; match each word unit with the semantic samples included in the semantic thesaurus, and screen out the first word unit according to the matching results; determine a plurality of initial semantic samples corresponding to the first word unit in the semantic thesaurus, and select the semantic positive sample associated with the first word unit from the plurality of initial semantic samples.

[0081] Specifically, the first word unit specifically refers to a word unit with two or more semantics among the plurality of word units; correspondingly, the initial semantic sample specifically refers to a plurality of semantics corresponding to the first word unit in the semantic thesaurus.

[0082] Based on this, after obtaining the sentence unit samples, word segmentation processing can be performed on them first to obtain each word unit; then directly match each word unit with the semantic samples included in the preset thesaurus, so as to select the first word unit containing multiple semantics according to the matching results, and then select a plurality of initial semantic samples corresponding to the first word unit from the semantic thesaurus, and finally screen out the correct semantic sample associated with the first word unit from the plurality of initial semantic samples as the semantic positive sample for subsequent model training.

[0083] Continuing with the above example, obtain the sentence unit sample "our cat is too lazy to mouse", and then perform word segmentation on it to obtain the word units {our, cat, is, too, lazy, to, mouse}; then match each word unit with the semantic thesaurus WordNet, and according to the matching results, determine that "mouse" corresponds to multiple semantics, and then select the correct semantics S1 corresponding to "mouse" in the semantic thesaurus WordNet as the semantic positive sample corresponding to the sentence unit sample for subsequent model training.

[0084] In summary, after word segmentation processing, by using the method of matching with the semantic thesaurus to screen out the first word unit with multiple semantics, not only can the process of analyzing the semantics of each word unit one by one be saved, but also the semantic positive samples can be accurately screened out from the semantic thesaurus, so as to ensure that sufficient and accurate samples can be prepared in the data preparation stage, which is convenient for subsequent model training to improve the model training efficiency and accuracy.

[0085] Step S104, screen out the semantic negative samples corresponding to the sentence unit samples in the preset semantic thesaurus, and construct the semantic features corresponding to the semantic positive samples and the semantic negative samples respectively.

[0086] Specifically, after obtaining the sentence unit samples and their corresponding semantic positive samples as described above, further, in order to improve the prediction accuracy of the model and avoid the problem of overfitting affecting the model's prediction ability, after obtaining the semantic positive samples, semantic negative samples corresponding to the sentence unit samples can be screened from the semantic thesaurus; then, semantic features corresponding to the semantic positive samples and semantic negative samples are constructed respectively, so as to be able to train and tune the model with the positive and negative samples subsequently to improve the prediction accuracy of the model.

[0087] Among them, the semantic negative sample specifically refers to the word unit in the sentence unit sample that corresponds to multiple semantics, and its associated incorrect semantics, and the semantic negative sample only represents the incorrectness of the word unit in the sentence unit sample. Correspondingly, the semantic feature specifically refers to the vector expression constructed by combining the semantic positive sample and the semantic negative sample with the sentence unit sample respectively, and this expression form meets the input requirements of the semantic understanding model.

[0088] Further, when screening the semantic negative samples corresponding to the sentence unit samples from the preset semantic thesaurus, it is actually to select the incorrect semantics of the word units in the sentence unit sample that correspond to multiple semantics. Considering that there are a large number of semantics stored for the corresponding word units in the semantic thesaurus, if all semantics are selected as semantic negative samples for model training, it may affect the prediction ability of the model. Therefore, the screening of semantic negative samples can be completed according to the preset screening rules. In this embodiment, the specific implementation method is as follows:

[0089] Determine the second word unit corresponding to the semantic positive sample in the sentence unit sample; determine at least two initial semantic negative samples corresponding to the second word unit in the semantic thesaurus; according to the preset screening rules, screen out a set number of initial semantic negative samples from the at least two initial semantic negative samples as the semantic negative samples corresponding to the sentence unit sample.

[0090] Specifically, the second word unit specifically refers to the word unit in the sentence unit sample that may correspond to multiple semantics; correspondingly, the initial semantic negative sample specifically refers to other semantic samples stored in the semantic thesaurus that are associated with the second word unit, and all represent the semantics corresponding to the second word unit in different sentences. Correspondingly, the screening rule specifically refers to the rule for screening the semantic negative samples that can be used for model training from at least two initial semantic negative samples, and the number of screened semantic negative samples is less than or equal to the data of the initial semantic negative samples associated with the second word unit.

[0091] In specific implementation, the screening rule can use negative sampling to screen out the semantic negative samples corresponding to the sentence unit sample from multiple initial semantic negative samples, or it can be random selection. In practical applications, it can be selected according to the actual application scenario. This embodiment does not make any limitation here.

[0092] Based on this, after determining the semantic positive sample corresponding to the sentence unit sample, in order to train a semantic understanding model with high prediction accuracy and strong interpretability, first, the second word unit corresponding to the semantic positive sample can be determined in the sentence unit sample. Secondly, at least two initial semantic negative samples associated with the second word unit and excluding the semantic positive sample are extracted from the semantic thesaurus. Finally, a set number of initial semantic samples are screened from at least two initial semantic negative samples according to a preset screening rule to be used as the semantic negative samples corresponding to the second word unit to support the subsequent training of the model.

[0093] Continuing with the above example, the polysemous word "mouse" in the sentence unit sample "our cat is too lazy to mouse" is determined, and the semantic positive sample is determined in combination with "mouse". Further, in order to train a semantic understanding model that meets the usage requirements, semantic S2, S3, and S4 corresponding to "mouse" can be selected from the semantic thesaurus WordNet as the initial semantic negative samples. Then, 2 (S2 and S3) are screened from the three initial semantic negative samples by negative sampling as the semantic negative samples corresponding to the sentence unit sample to facilitate the subsequent training of the semantic understanding model in combination with the semantic positive sample S1.

[0094] In summary, by combining the semantic thesaurus and the screening rule to determine the semantic negative samples corresponding to the second word unit, not only can the sample volume be reduced, but also the characteristics of the semantic negative samples can be fully utilized to complete the subsequent model training, thereby ensuring that the trained model has stronger interpretability and meets the usage requirements.

[0095] Furthermore, after obtaining the semantic positive sample and semantic negative sample corresponding to the sentence unit sample, considering that the subsequent trained semantic understanding model is a model that scores each semantics, semantic features can be constructed by combining the sentence unit sample and the semantic positive / negative samples respectively. In this embodiment, the specific implementation method is as follows:

[0096] The sentence unit sample is concatenated with the semantic positive sample, and the positive semantic feature corresponding to the semantic positive sample is constructed according to the concatenation result, and the sentence unit sample is concatenated with the semantic negative sample, and the negative semantic feature corresponding to the semantic negative sample is constructed according to the concatenation result.

[0097] Specifically, the positive semantic feature specifically refers to the vector expression obtained by converting the sentence unit sample and the semantic positive sample into vectors and then concatenating them; correspondingly, the negative semantic feature specifically refers to the vector expression obtained by converting the sentence unit sample and the semantic negative sample into vectors and then concatenating them.

[0098] Following the above example, the sentence unit sample is determined to be "our cat is too lazy to mouse", and its corresponding positive semantic sample is S1 {any of numerous small…hairless tails}; the negative semantic samples are S2 {a swollen bruise caused by a blow to the eye} and S3 {person who is quiet or timid}. Further, by converting the sentence unit sample, its corresponding vector representation is determined to be M, the vector representation of the positive semantic sample S1 is M1, the vector representation of the negative semantic sample S2 is M2, and the vector representation of the negative semantic sample S3 is M3. Then, the vector representation M of the sentence unit sample is respectively concatenated with the vector representations of the positive / negative semantic samples, and according to the concatenation results, the positive semantic feature corresponding to the positive semantic sample S1 is N1, the negative semantic feature corresponding to the negative semantic sample S2 is N2, and the negative semantic feature corresponding to the negative semantic sample S3 is N3, which is convenient for subsequent model training.

[0099] In summary, by combining the sentence unit sample and the positive / negative semantic samples to construct semantic features, it can be ensured that each semantic belongs to a separate part, so that when performing model training, the model can be tuned and optimized by negative sampling, thereby reducing the computational amount in the gradient descent process.

[0100] Step S106, input the semantic features into a semantic understanding model for processing to obtain the semantic scores corresponding to the positive semantic sample and the negative semantic sample respectively.

[0101] Specifically, after obtaining the sentence unit sample and its corresponding positive semantic sample and negative semantic sample as above, the data preparation stage is completed. At this time, the semantic features constructed based on the sentence unit sample and the positive / negative semantic samples can be input into the semantic understanding model to predict the semantic scores corresponding to each semantic through the semantic understanding model, which is convenient for subsequent tuning and optimization of the model in combination with the true semantic scores corresponding to the sentence unit sample.

[0102] Among them, the semantic understanding model specifically refers to a model that can score each semantics of a word unit, and integrates an encoding unit and a scoring unit. In specific implementation, the semantic understanding model can use BERT as the modeling model as the encoding unit; correspondingly, use the softmax function as the scoring unit to complete the scoring process of each semantics corresponding to the word unit through BERT combined with softmax. Correspondingly, the semantic score specifically refers to the scores corresponding to each semantics of the word unit in the sentence unit sample; the higher the semantic score, the more correct the semantics of the word unit, that is, the semantics of the word unit is more in line with the sentence meaning of the sentence unit sample; on the contrary, the lower the semantic score, the more incorrect the semantics of the word unit, that is, the semantics of the word unit deviates from the sentence meaning of the sentence unit sample.

[0103] Furthermore, since both semantic positive samples and semantic negative samples need to be input into the semantic understanding model for scoring during the training phase, the semantic scores corresponding to each semantic sample will be obtained respectively, and the model can only be optimized by combining the loss function. Therefore, when inputting data into the model, it is also necessary to input separately according to different samples and score separately. In this embodiment, the specific implementation method is as follows:

[0104] Input the positive semantic feature and the negative semantic feature into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample.

[0105] Specifically, the positive semantic score specifically refers to the semantic score corresponding to the semantic positive sample; the negative semantic score specifically refers to the semantic score corresponding to the semantic negative sample. Based on this, after the positive semantic feature corresponding to the semantic positive sample and the negative semantic feature corresponding to the semantic negative sample are constructed as above, the positive / negative semantic features can be input into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample according to the processing results. That is to say, through the encoding process of BERT in the semantic understanding model, the positive semantic encoding vector corresponding to the positive semantic feature and the negative semantic encoding vector corresponding to the negative semantic feature are obtained; then, the softmax function is used to score each encoding vector, and the positive semantic score and the negative semantic score can be obtained, which is convenient for subsequent optimization of the model by combining the scores.

[0106] Based on this, after the positive semantic feature corresponding to the semantic positive sample and the negative semantic feature corresponding to the semantic negative sample are constructed as above, the positive / negative semantic features can be input into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample according to the processing results. That is to say, through the encoding process of BERT in the semantic understanding model, the positive semantic encoding vector corresponding to the positive semantic feature and the negative semantic encoding vector corresponding to the negative semantic feature are obtained; then, the softmax function is used to score each encoding vector, and the positive semantic score and the negative semantic score can be obtained, which is convenient for subsequent optimization of the model by combining the scores.

[0107] Step S108, calculate the loss value based on the semantic scores, and adjust the target semantic understanding model that meets the training stop condition according to the loss value.

[0108] Specifically, after obtaining the semantic scores corresponding to the semantic positive / negative samples respectively, further, since the model needs to be continuously trained and parameter-tuned to learn more accurate prediction capabilities, after obtaining the semantic scores, the loss value can be calculated in combination with the loss function based on this, and then the semantic understanding model can be parameter-tuned based on the loss value to obtain the target semantic understanding model that meets the training stop condition.

[0109] In practical applications, if the parameter-tuned semantic understanding model does not meet the training stop condition, new samples can be selected from the sample set to continue training the model until the training stop condition is met. The training stop condition can be the number of iterations or the comparison of loss values; that is, when the number of training iterations of the semantic understanding model reaches the set value, the training stops; or when the loss value after a certain training is less than the preset threshold, the training stops. Specifically, the training stop condition can be set according to the actual application scenario, and this embodiment does not make any limitations here.

[0110] Further, when calculating the loss value and optimizing the model by combining the semantic scores corresponding to the semantic positive samples and semantic negative samples respectively, the cross-entropy loss function can be used to calculate the loss value (loss) of the semantic understanding model, and then the model can be parameter-tuned by combining the sample semantic scores corresponding to the semantic positive samples and semantic negative samples respectively, so that the model can learn that the semantic positive samples are the correct semantics and improve the prediction ability of the model.

[0111] That is to say, the loss value can be calculated based on the positive semantic score and the negative semantic score, and the parameters of the semantic understanding model can be adjusted according to the loss value until the target semantic understanding model that meets the training stop condition is obtained.

[0112] Continuing with the above example, by inputting the positive semantic feature N1 corresponding to the semantic positive sample S1, the negative semantic feature N2 corresponding to the semantic negative sample S2, and the negative semantic feature N3 corresponding to the semantic negative sample S3 into the semantic understanding model respectively, encoding through BERT to obtain the vector expressions corresponding to each feature, and then scoring through softmax, according to the scoring results, the semantic score P1 corresponding to the semantic positive sample S1 output by the semantic understanding model, the semantic score P2 corresponding to the semantic negative sample S2, and the semantic score P3 corresponding to the semantic negative sample S3 are determined. Then, the cross-entropy loss function is used to calculate the loss of the semantic understanding model, and the semantic understanding model is parameter-tuned according to the loss. In the case that the parameter-tuned model does not meet the training stop condition, new sentence unit samples are continuously selected from the sample set to train it until the training stop condition is met, and it is used as the target semantic understanding model for use in the actual application scenario.

[0113] The training method of the semantic understanding model provided in this specification, after obtaining the sentence unit sample and the semantic positive sample corresponding to the sentence unit sample, in order to train a model that can accurately analyze the semantic meaning of each word in a sentence, it is possible to screen the semantic negative sample features corresponding to the sentence unit sample in a preset semantic vocabulary, and then construct the semantic features corresponding to the semantic positive sample and the semantic negative sample respectively. Input them into the semantic understanding model for processing to obtain the semantic scores corresponding to the semantic positive sample features and the semantic negative sample features respectively. Finally, calculate the loss value based on the semantic scores and optimize the model until a target semantic understanding model that meets the training stop condition is obtained, which realizes that during the model training process, the positive and negative samples can be fully used to train the model, not only improving the accuracy of word semantic disambiguation, but also ensuring the interpretability of the model, so that the semantic determination can be accurately completed in the application stage.

[0114] The following is a semantic determination method provided in this embodiment, which is applied to the target semantic understanding model trained by the above method to complete the determination of the target semantic information, specifically as follows:

[0115] Figure 2 The flowchart of a semantic determination method provided in an embodiment of this specification is shown, specifically including the following steps:

[0116] Step S202, obtain a target sentence unit containing the word unit to be processed.

[0117] The semantic determination method provided in this embodiment corresponds to the training method of the above semantic understanding model. Some of the descriptions about features can refer to the same or corresponding description content in the above embodiments, and this embodiment will not elaborate here.

[0118] Specifically, the word unit to be processed specifically refers to a word unit corresponding to multiple semantic information. Correspondingly, the target sentence unit specifically refers to a sentence containing the word unit to be processed and requiring the determination of the semantic information of the word unit to be processed, which can be a sentence uploaded by the user for semantic analysis.

[0119] Step S204, screen at least two semantic information corresponding to the word unit to be processed in a preset semantic vocabulary, and construct semantic features corresponding to each semantic information.

[0120] Specifically, after obtaining the target sentence unit containing the word unit to be processed as described above, further, in order to ensure that the target semantic information corresponding to the word unit to be processed can be accurately determined subsequently, at least two semantic information corresponding to the word unit to be processed can be screened in a preset semantic vocabulary first, and based on this, combined with the target sentence unit, construct semantic features corresponding to each semantic information to facilitate the subsequent input into the target semantic understanding model to complete the score prediction of each semantic information.

[0121] Further, considering that there is a large amount of semantic information in the preset semantic vocabulary, in order to improve the processing efficiency, the semantic information query can be completed in combination with the word unit label corresponding to the word unit to be processed. In this embodiment, the specific implementation method is as follows:

[0122] Determine the word unit label corresponding to the word unit to be processed; query the semantic vocabulary based on the word unit label to obtain at least two initial semantic information associated with the word unit label; filter the at least two initial semantic information according to a preset filtering rule, and determine the at least two semantic information corresponding to the word unit to be processed according to the filtering result.

[0123] Specifically, the word unit label specifically refers to that the word unit to be processed has a unique label; correspondingly, the word unit label is recorded in the metadata of the semantic vocabulary and is used to record the association relationship between semantic information and word units; correspondingly, the initial semantic information specifically refers to all the semantic information included in the semantic vocabulary that is associated with the word unit to be processed. Correspondingly, the filtering rule specifically refers to a rule for removing the initial semantic information with a low matching degree with the target sentence unit, which is used to reduce the number of semantic information for subsequent semantic score calculation.

[0124] Based on this, after obtaining the target sentence unit corresponding to the word unit to be recognized, first, the word unit label corresponding to the word unit to be processed can be determined, and then the semantic vocabulary can be queried based on the word unit label to obtain at least two initial semantic information associated with the word unit to be processed according to the query result. Secondly, filter the at least two initial semantic information according to the preset filtering rule, and finally, the at least two semantic information corresponding to the word unit to be processed can be determined according to the filtering result.

[0125] In summary, by filtering the at least two initial semantic information by using the filtering rule and screening out the semantic information with a quantity less than that of the initial semantic information, the quantity of semantic information is effectively reduced to improve the efficiency of subsequent determination of target semantic information.

[0126] Step S206, input the semantic feature into the target semantic understanding model in the above method for processing to obtain the target semantic score corresponding to each semantic information.

[0127] Step S208, screen out the target semantic information associated with the target sentence unit from the at least two semantic information according to the target semantic score.

[0128] Specifically, the target semantic score specifically refers to the semantic scores of each semantic information. Through the semantic scores, the association relationship between each semantic information and the target sentence unit can be determined, so that by comparing the target semantic scores, the correct semantic information corresponding to the word unit to be processed, that is, the target semantic information, can be screened out.

[0129] For example, a student uploads a grammar learning sentence, which contains the word "mouse" with multiple semantics. To assist the student in understanding the expression of the grammar learning sentence, the word unit label Labe_1 corresponding to the word "mouse" can be determined first, and then the semantic dictionary WordNet can be queried based on the word unit label Labe_1 to determine n initial semantic information corresponding to the word "mouse". Then, the multiple initial semantic information is filtered according to the preset filtering rules to eliminate unreasonable semantics, and m (m < n) semantic information corresponding to the word "mouse" is obtained. Then, each semantic information is concatenated with the grammar learning sentence respectively to construct the semantic features corresponding to each semantic information.

[0130] Furthermore, the semantic features corresponding to each semantic information are input into the target semantic understanding model, encoded by BERT, and scored by the softmax function to determine the target semantic scores corresponding to each semantic information. Finally, the semantic information with the highest target semantic score is selected as the target semantic information of the word "mouse" and fed back to the student to achieve the purpose of assisting the student in learning.

[0131] In addition, after obtaining the target semantic information associated with the target sentence unit, the target semantic information can be directly fed back to the user who uploaded the target sentence unit to achieve the purpose of assisting the user in understanding the meaning of the target sentence unit.

[0132] The semantic determination method provided in this embodiment, after obtaining the target sentence unit containing the word unit to be processed, can first screen at least two semantic information corresponding to the word unit to be processed in the preset semantic dictionary, construct semantic features in combination with the target sentence unit, and then input the semantic features into the target semantic understanding model trained by the above method for processing to obtain the target semantic scores corresponding to each semantic information. Finally, the target semantic information corresponding to the target sentence unit is determined by comparing the target semantic scores; realizing the determination of the target semantic information through the semantic dictionary combined with the target semantic understanding model can ensure the accuracy of the semantic information determination, and at the same time has stronger interpretability, which is convenient for downstream services to use to achieve the purpose of assisting in understanding the target sentence unit.

[0133] The following combines the attached Figure 3 , taking the application of the semantic determination method provided in this specification in the teaching scenario as an example, to further illustrate the semantic determination method. Among them,Figure 3 The figure shows a processing flowchart of a semantic determination method provided by an embodiment of this specification for an instructional scenario, specifically including the following steps:

[0134] Step S302: Obtain sentence unit samples and perform word segmentation on the sentence unit samples to obtain multiple word units.

[0135] Step S304: Match each word unit with semantic samples included in the semantic vocabulary, and filter out target word units according to the matching results.

[0136] Step S306: Determine multiple initial semantic samples corresponding to the target word unit in the semantic vocabulary, and select the semantic positive sample associated with the target word unit from the multiple initial semantic samples.

[0137] Step S308: Determine at least two initial semantic negative samples corresponding to the target word unit in the semantic vocabulary.

[0138] Step S310: According to a preset filtering rule, filter out a set number of initial semantic negative samples from the at least two initial semantic negative samples as the semantic negative samples corresponding to the sentence unit samples.

[0139] Step S312: Concatenate the sentence unit samples with the semantic positive samples, and construct positive semantic features corresponding to the semantic positive samples according to the concatenation results.

[0140] Step S314: Concatenate the sentence unit samples with the semantic negative samples, and construct negative semantic features corresponding to the semantic negative samples according to the concatenation results.

[0141] Step S316: Input the positive semantic features and negative semantic features into a semantic understanding model for processing to obtain the positive semantic scores corresponding to the semantic positive samples and the negative semantic scores corresponding to the semantic negative samples.

[0142] Step S318: Calculate a loss value based on the positive semantic scores and negative semantic scores, and adjust the parameters of the semantic understanding model according to the loss value until a target semantic understanding model that meets the training stop condition is obtained.

[0143] Step S320: Obtain a target sentence unit containing a word unit to be processed.

[0144] Step S322: Filter at least two semantic information corresponding to the word unit to be processed in a preset semantic vocabulary, and construct semantic features corresponding to each semantic information.

[0145] Step S324: Input the semantic features into the target semantic understanding model for processing to obtain the target semantic scores corresponding to each semantic information.

[0146] Step S326: Screen out the target semantic information associated with the target sentence unit from at least two semantic information according to the target semantic score.

[0147] In summary, after obtaining the target sentence unit containing the to-be-processed word unit, at least two semantic information corresponding to the to-be-processed word unit can be screened out in the preset semantic word library first, and semantic features can be constructed in combination with the target sentence unit. Then, the semantic features are input into the target semantic understanding model trained by the above method for processing to obtain the target semantic scores corresponding to each semantic information. Finally, the target semantic information corresponding to the target sentence unit is determined by comparing the target semantic scores; realizing the determination of the target semantic information through the semantic word library combined with the target semantic understanding model can ensure the accuracy of the determination of the semantic information, and at the same time has stronger interpretability, which is convenient for the downstream service to use and achieve the purpose of assisting in understanding the target sentence unit.

[0148] Corresponding to the above method embodiment, this specification also provides an embodiment of a training device for a semantic understanding model. Figure 4 FIG. shows a schematic structural diagram of a training device for a semantic understanding model provided by an embodiment of this specification. As Figure 4 shown, the device includes:

[0149] A sample acquisition module 402, configured to acquire a sentence unit sample and a semantic positive sample corresponding to the sentence unit sample;

[0150] A feature construction module 404, configured to screen out semantic negative samples corresponding to the sentence unit sample in the preset semantic word library, and construct semantic features corresponding to the semantic positive sample and the semantic negative sample respectively;

[0151] A model processing module 406, configured to input the semantic features into a semantic understanding model for processing to obtain semantic scores corresponding to the semantic positive sample and the semantic negative sample respectively;

[0152] A model training module 408, configured to calculate a loss value based on the semantic scores, and adjust a target semantic understanding model that meets the training stop condition according to the loss value.

[0153] In an optional embodiment, the sample acquisition module 402 is further configured to:

[0154] Acquire the sentence unit sample; parse the sentence unit sample to obtain semantic labels corresponding to each word unit in the sentence unit sample; screen out target semantic labels from the semantic labels, and extract the semantic positive sample from the semantic word library based on the target semantic labels.

[0155] In an optional embodiment, the sample acquisition module 402 is further configured to:

[0156] Obtain the sentence unit sample, and perform word segmentation on the sentence unit sample to obtain a plurality of word units; match each word unit with the semantic samples included in the semantic thesaurus, and filter out the first word unit according to the matching result; determine a plurality of initial semantic samples corresponding to the first word unit in the semantic thesaurus, and select the semantic positive sample associated with the first word unit from the plurality of initial semantic samples.

[0157] In an alternative embodiment, the construction feature module 404 is further configured to:

[0158] Determine a second word unit corresponding to the semantic positive sample in the sentence unit sample; determine at least two initial semantic negative samples corresponding to the second word unit in the semantic thesaurus; according to a preset screening rule, screen out a set number of initial semantic negative samples from the at least two initial semantic negative samples as the semantic negative sample corresponding to the sentence unit sample.

[0159] In an alternative embodiment, the construction feature module 404 is further configured to:

[0160] Concatenate the sentence unit sample with the semantic positive sample, and construct the positive semantic feature corresponding to the semantic positive sample according to the concatenation result, and concatenate the sentence unit sample with the semantic negative sample, and construct the negative semantic feature corresponding to the semantic negative sample according to the concatenation result.

[0161] In an alternative embodiment, the model processing module 406 is further configured to:

[0162] Input the positive semantic feature and the negative semantic feature into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample;

[0163] Correspondingly, the model training module 408 is further configured to:

[0164] Calculate the loss value based on the positive semantic score and the negative semantic score, and adjust the parameters of the semantic understanding model according to the loss value until the target semantic understanding model that meets the training stop condition is obtained.

[0165] The training device for the semantic understanding model provided in this specification, after obtaining the sentence unit sample and the corresponding semantic positive sample of the sentence unit sample, in order to be able to train a model that can accurately analyze the semantic meaning of each word in a sentence, it can screen the semantic negative sample features corresponding to the sentence unit sample in a preset semantic word library, and then construct the semantic features corresponding to the semantic positive sample and the semantic negative sample respectively. Input them into the semantic understanding model for processing to obtain the semantic scores corresponding to the semantic positive sample features and the semantic negative sample features respectively. Finally, calculate the loss value based on the semantic scores and optimize the model until a target semantic understanding model that meets the training stop condition is obtained, which realizes that during the model training process, the positive and negative samples can be fully used to train the model, not only improving the accuracy of word semantic disambiguation, but also ensuring the interpretability of the model, so that the semantic determination can be accurately completed in the application stage.

[0166] The above is a schematic solution of a training device for a semantic understanding model in this embodiment. It should be noted that the technical solution of the training device for the semantic understanding model belongs to the same concept as the technical solution of the above-mentioned semantic understanding model training method. For the details not described in the technical solution of the training device for the semantic understanding model, reference can be made to the description of the technical solution of the above-mentioned semantic understanding model training method.

[0167] Corresponding to the above method embodiment, this specification also provides an embodiment of a semantic determination device. Figure 5 Fig. shows a schematic structural diagram of a semantic determination device provided in an embodiment of this specification. As Figure 5 shown, the device includes:

[0168] An acquisition module 502, configured to acquire a target sentence unit containing a to-be-processed word unit;

[0169] A construction module 504, configured to screen at least two semantic information corresponding to the to-be-processed word unit in a preset semantic word library and construct semantic features corresponding to each semantic information;

[0170] A processing module 506, configured to input the semantic features into the target semantic understanding model in the above method for processing to obtain the target semantic scores corresponding to each semantic information;

[0171] A screening module 508, configured to screen out the target semantic information associated with the target sentence unit from the at least two semantic information according to the target semantic scores.

[0172] In an optional embodiment, the construction module 504 is further configured to:

[0173] Determine the word unit label corresponding to the to-be-processed word unit; query the semantic vocabulary based on the word unit label to obtain at least two initial semantic information associated with the word unit label; filter the at least two initial semantic information according to a preset filtering rule, and determine the at least two semantic information corresponding to the to-be-processed word unit according to the filtering result.

[0174] After obtaining the target sentence unit containing the to-be-processed word unit, the semantic determination device provided in this embodiment can first screen at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary, and construct semantic features in combination with the target sentence unit. Then, the semantic features are input into the target semantic understanding model trained by the above method for processing to obtain the target semantic scores corresponding to each semantic information. Finally, the target semantic information corresponding to the target sentence unit is determined by comparing the target semantic scores; it realizes the determination of the target semantic information by combining the semantic vocabulary with the target semantic understanding model, which can ensure the accuracy of the semantic information determination, and at the same time has stronger interpretability, facilitating the downstream business to use and achieving the purpose of assisting in understanding the target sentence unit.

[0175] The above is a schematic solution of a semantic determination device in this embodiment. It should be noted that the technical solution of this semantic determination device and the technical solution of the above semantic determination method belong to the same concept. For the details not described in detail in the technical solution of the semantic determination device, reference can be made to the description of the technical solution of the above semantic determination method.

[0176] Figure 6 FIG. shows a block diagram of a computing device 600 according to an embodiment of the present specification. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to store data.

[0177] The computing device 600 further includes an access device 640, and the access device 640 enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0178] In an embodiment of the present specification, the above components of the computing device 600 andFigure 6 Other components not shown may also be connected to each other, for example, via a bus. It should be understood that Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not a limitation on the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0179] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smart phones), wearable computing devices (e.g., smart watches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 600 can also be a mobile or stationary server.

[0180] Wherein, the processor 620 is configured to execute computer-executable instructions for the training method of the semantic understanding model or the semantic determination method.

[0181] The above is a schematic solution of a computing device according to this embodiment. It should be noted that the technical solution of the computing device and the technical solutions of the above-mentioned training method of the semantic understanding model or the semantic determination method belong to the same concept. For the details not described in detail in the technical solution of the computing device, reference can be made to the descriptions of the technical solutions of the above-mentioned training method of the semantic understanding model or the semantic determination method.

[0182] An embodiment of this specification also provides a computer-readable storage medium, which stores computer instructions that are executed by a processor for the training method of the semantic understanding model or the semantic determination method.

[0183] The above is a schematic solution of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of the storage medium and the technical solutions of the above-mentioned training method of the semantic understanding model or the semantic determination method belong to the same concept. For the details not described in detail in the technical solution of the storage medium, reference can be made to the descriptions of the technical solutions of the above-mentioned training method of the semantic understanding model or the semantic determination method.

[0184] The specific embodiments of this specification have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain implementations, multitasking and parallel processing are also possible or may be advantageous.

[0185] The computer instructions include computer program code, which may be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, external hard drives, magnetic disks, optical discs, computer memories, read-only memories (ROM), random access memories (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice within the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0186] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that this specification is not limited by the described action sequence, because according to this specification, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.

[0187] In the above embodiments, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0188] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments to better explain the principle and practical application of this specification, so that those skilled in the art can understand and utilize this specification well. This specification is only limited by the claims and their full scope and equivalents.

Claims

1. A training method for a semantic understanding model, characterized in that Including: Obtain sentence unit samples; Parse the sentence unit samples to obtain semantic tags corresponding to each word unit in the sentence unit samples. Screen out target semantic tags from the semantic tags, and screen out multiple candidate semantic samples from a preset semantic word library according to the target semantic tags. In response to the operation instruction of the reviewer, determine the semantic positive sample corresponding to the sentence unit sample from the multiple candidate semantic samples; Screen out semantic negative samples corresponding to the sentence unit sample from the preset semantic word library, and construct semantic features corresponding to the semantic positive sample and the semantic negative sample respectively; Input the semantic features into a semantic understanding model for processing to obtain semantic scores corresponding to the semantic positive sample and the semantic negative sample respectively; Calculate a loss value based on the semantic scores, and adjust a target semantic understanding model that meets the training stop condition according to the loss value.

2. The method according to claim 1, wherein After obtaining the sentence unit samples, it further includes: Obtain the sentence unit samples and perform word segmentation on the sentence unit samples to obtain multiple word units; Match each word unit with the semantic samples included in the semantic word library, and screen out the first word unit according to the matching result; Determine multiple initial semantic samples corresponding to the first word unit in the semantic word library, and select the semantic positive sample associated with the first word unit from the multiple initial semantic samples.

3. The method according to claim 1, characterized in that, The screening of the semantic negative samples corresponding to the sentence unit sample from the preset semantic word library includes: Determine a second word unit corresponding to the semantic positive sample in the sentence unit sample; Determine at least two initial semantic negative samples corresponding to the second word unit in the semantic word library; According to a preset screening rule, screen out a set number of initial semantic negative samples from the at least two initial semantic negative samples as the semantic negative samples corresponding to the sentence unit sample.

4. The method according to any one of claims 1 to 3, characterized in that, The construction of the semantic features corresponding to the semantic positive sample and the semantic negative sample respectively includes: Concatenate the sentence unit sample with the semantic positive sample, and construct the positive semantic feature corresponding to the semantic positive sample according to the concatenation result, and Concatenate the sentence unit sample with the semantic negative sample, and construct the negative semantic feature corresponding to the semantic negative sample according to the concatenation result.

5. The method according to claim 4, characterized in that, The input of the semantic features into a semantic understanding model for processing to obtain semantic scores corresponding to the semantic positive sample and the semantic negative sample respectively includes: Input the positive semantic feature and the negative semantic feature into the semantic understanding model for processing respectively to obtain the positive semantic score corresponding to the semantic positive sample and the negative semantic score corresponding to the semantic negative sample; Correspondingly, the calculation of the loss value based on the semantic scores and the adjustment of a target semantic understanding model that meets the training stop condition according to the loss value includes: Calculate the loss value based on the positive semantic score and the negative semantic score, and adjust the parameters of the semantic understanding model according to the loss value until the target semantic understanding model that meets the training stop condition is obtained.

6. A semantic determination method, characterized in that, Including: Obtain a target sentence unit containing a word unit to be processed; Screen at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary, and construct semantic features corresponding to each semantic information; Input the semantic features into the target semantic understanding model in the method according to any one of claims 1-5 for processing, and obtain the target semantic scores corresponding to each semantic information; According to the target semantic scores, screen out the target semantic information associated with the target sentence unit from the at least two semantic information.

7. The method according to claim 6, wherein The screening of at least two semantic information corresponding to the to-be-processed word unit in the preset semantic vocabulary includes: Determine the word unit label corresponding to the to-be-processed word unit; Query the semantic vocabulary based on the word unit label to obtain at least two initial semantic information associated with the word unit label; Filter the at least two initial semantic information according to a preset filtering rule, and determine the at least two semantic information corresponding to the to-be-processed word unit according to the filtering result.

8. A training device for a semantic understanding model, characterized in that Include: An acquisition module, configured to acquire a sentence unit sample, parse the sentence unit sample, obtain semantic labels corresponding to each word unit in the sentence unit sample, screen out target semantic labels from the semantic labels, and screen out multiple candidate semantic samples from a preset semantic vocabulary according to the target semantic labels. In response to an operation instruction of an auditor, determine a semantic positive sample corresponding to the sentence unit sample among the multiple candidate semantic samples; A feature construction module, configured to screen semantic negative samples corresponding to the sentence unit sample in the preset semantic vocabulary, and construct semantic features corresponding to the semantic positive sample and the semantic negative sample respectively; A model processing module, configured to input the semantic features into a semantic understanding model for processing, and obtain semantic scores corresponding to the semantic positive sample and the semantic negative sample respectively; A model training module, configured to calculate a loss value based on the semantic scores, and adjust a target semantic understanding model that meets the training stop condition according to the loss value.

9. A semantic determination device, characterized in that, Include: An acquisition module, configured to acquire a target sentence unit including a to-be-processed word unit; A construction module, configured to screen at least two semantic information corresponding to the to-be-processed word unit in a preset semantic vocabulary, and construct semantic features corresponding to each semantic information; A processing module, configured to input the semantic features into the target semantic understanding model in the method according to any one of claims 1-5 for processing, and obtain the target semantic scores corresponding to each semantic information; A screening module, configured to screen out the target semantic information associated with the target sentence unit from the at least two semantic information according to the target semantic scores.

10. A computing device, characterized in that, It includes a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 5 or 6 to 7.

11. A computer-readable storage medium storing computer instructions, characterized in that, When the instruction is executed by the processor, it implements the steps of the method according to any one of claims 1 to 5 or 6 to 7.

Citation Information

Patent Citations

  • Semantic representation model training method and device, equipment and storage medium

    CN113408299A

  • Training method and device of reading comprehension model and reading comprehension method and device

    CN113536801A