Method and apparatus for training keyword recognition model
By introducing multi-domain information about dishes to train the keyword recognition model, and employing a feature embedding layer, an attention mechanism layer, and a decoding layer, the problem of insufficient accuracy and diversity in existing keyword mining methods is solved, achieving more efficient keyword recognition and more precise ad placement in advertising systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-10
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies in advertising systems suffer from insufficient accuracy and diversity in keyword mining methods, making it difficult to improve the precision of ad targeting while ensuring relevance and diversity.
By introducing multi-domain information about dishes to train a keyword recognition model, a feature embedding layer, an attention mechanism layer, and a decoding layer are used. The model combines dish names, multi-domain information, and initial keywords to calculate prediction probabilities and adjust model parameters. Iterative training is then conducted to obtain a target keyword recognition model.
While ensuring accuracy, the diversity and noise reduction capabilities of the keyword recognition model have been improved, thereby enhancing the precision and accuracy of ad placement.
Smart Images

Figure CN115329053B_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the field of model training technology, and in particular to a method and apparatus for training a keyword recognition model. Background Technology
[0002] Search advertising is essentially an information retrieval system. After a user enters a query, the system searches through massive amounts of advertising data for results that best match the user's needs. To improve the precision of ad targeting, advertisers bid on ads using keywords. The advertising system then retrieves relevant ads by associating query terms with keywords.
[0003] To reduce advertisers' costs, the system can automatically mine relevant keywords based on the text or materials provided by advertisers. How to discover as many highly relevant keywords as possible for advertisers has become one of the key research directions for search advertising systems.
[0004] Currently, iterative keyword mining algorithms are typically used to calculate word importance based on word-word co-occurrence relationships within text information, selecting words with high importance as keywords. Alternatively, text information such as ad titles and descriptions can be used as input, and core words can be extracted as keywords using sequence labeling models. Another approach is to use text information such as ad titles and descriptions as input and generate keywords using a Seq2Seq generative network model.
[0005] However, in the above schemes, the keywords generated by data mining rely on manual rules to ensure relevance, resulting in poor generality and hindering subsequent iterative optimization; while the keywords obtained by information extraction can only be substrings of advertising text information, which generally have high accuracy, but lack diversity because they cannot mine keywords that are unrelated to the text but semantically related; and the text generation method can mine keywords that are unrelated to the original text but semantically related, resulting in good diversity, but it often suffers from overgeneralization, which reduces accuracy. Summary of the Invention
[0006] The embodiments of this disclosure provide a training method and apparatus for a keyword recognition model, which can maintain diversity while ensuring accuracy, improve the model's denoising ability, and improve the model's accuracy.
[0007] According to a first aspect of the embodiments of this disclosure, a method for training a keyword recognition model is provided, comprising:
[0008] Obtain training samples; the training samples include: the dish name of the initial dish, multi-domain information of the dish, and multiple initial keywords associated with the initial dish;
[0009] The dish name, the dish multi-domain information, and the multiple initial keywords are input into the keyword recognition model to be trained;
[0010] The keyword recognition model to be trained is invoked to process the dish name, the dish multi-domain information, and the multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained.
[0011] Based on the predicted probability, the loss function corresponding to the keyword recognition model to be trained is calculated;
[0012] The model parameters of the keyword recognition model to be trained are adjusted according to the loss function.
[0013] The process of iteratively executing the steps of obtaining training samples and adjusting the model parameters of the keyword recognition model to be trained according to the loss function is repeated until the target keyword recognition model is obtained.
[0014] Optionally, the keyword recognition model to be trained includes: a feature embedding layer, an attention mechanism layer, and a decoding layer.
[0015] The step of calling the keyword recognition model to be trained to process the dish name, the dish's multi-domain information, and the multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained includes:
[0016] The feature embedding layer is invoked to process the dish name and the dish multi-domain information to obtain the dish word position information corresponding to the dish name, the important indicator information and word granularity information corresponding to the dish multi-domain information;
[0017] The attention mechanism layer is invoked to process the dish word location information, the important indicator information, and the word granularity information to obtain the attention information corresponding to the multi-domain information of the dish;
[0018] The decoding layer is invoked to decode the attention information to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish.
[0019] Optionally, the feature embedding layer includes: a location information identification unit, an important indicator acquisition unit, and a character-level information acquisition unit.
[0020] The process of calling the feature embedding layer to process the dish name and the dish multi-domain information yields the dish word position information corresponding to the dish name, the important indicator information corresponding to the dish multi-domain information, and the word granularity information, including:
[0021] The location information identification unit is invoked to identify the dish name, so as to identify the location information of each dish word in the dish name;
[0022] The important indicator acquisition unit is invoked to process the multi-domain information of the dish and the dish name to obtain the important indicator information of the multi-domain information of the dish name;
[0023] The granularity information acquisition unit is invoked to process the multi-domain information of the dish to obtain the granularity information corresponding to the multi-domain information of the dish.
[0024] Optionally, after obtaining the target keyword recognition model, the method further includes:
[0025] Obtain the user's input search keywords;
[0026] The query keyword is input into the target keyword recognition model to obtain the query tag sequence corresponding to the query keyword output by the target keyword recognition model, and the tag probability corresponding to the query tag sequence;
[0027] Based on the label probabilities, N target query label sequences are selected from the query label sequences, where N is a positive integer greater than or equal to 1;
[0028] The target query tag sequence is transformed to generate target keywords corresponding to the target query tag sequence;
[0029] Based on the target keywords, the target dishes can be retrieved.
[0030] Optionally, the step of selecting N target queries from the query tag sequence based on the tag probabilities includes:
[0031] The query tag sequence is sorted in descending order of tag probability to obtain the sorting result;
[0032] Based on the sorting result, the query tag sequence ranked in the top N positions is selected from the query tag sequence as the target query tag sequence.
[0033] According to a second aspect of the embodiments of this disclosure, a training apparatus for a keyword recognition model is provided, comprising:
[0034] The training sample acquisition module is used to acquire training samples; the training samples include: the dish name of the initial dish, the multi-domain information of the dish, and multiple initial keywords associated with the initial dish;
[0035] The training sample input module is used to input the dish name, the dish multi-domain information, and the multiple initial keywords into the keyword recognition model to be trained.
[0036] The prediction probability acquisition module is used to call the keyword recognition model to be trained to process the dish name, the dish multi-domain information and the multiple initial keywords, so as to obtain the prediction probability of the multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained;
[0037] The loss function calculation module is used to calculate the loss function corresponding to the keyword recognition model to be trained based on the predicted probability.
[0038] The model parameter adjustment module is used to adjust the model parameters of the keyword recognition model to be trained according to the loss function;
[0039] The target recognition model acquisition module is used to iteratively execute the training sample acquisition module, the training sample input module, the prediction probability acquisition module, the loss function calculation module, and the model parameter adjustment module until the target keyword recognition model is obtained.
[0040] Optionally, the keyword recognition model to be trained includes: a feature embedding layer, an attention mechanism layer, and a decoding layer.
[0041] The prediction probability acquisition module includes:
[0042] The location indicator information acquisition submodule is used to call the feature embedding layer to process the dish name and the dish multi-domain information to obtain the dish word location information corresponding to the dish name, the important indicator information and word granularity information corresponding to the dish multi-domain information;
[0043] The attention acquisition submodule is used to call the attention mechanism layer to process the dish word location information, the important indicator information and the word granularity information to obtain the attention information corresponding to the multi-domain information of the dish;
[0044] The prediction probability acquisition submodule is used to call the decoding layer to decode the attention information and obtain the predicted probability of the multiple initial keywords relative to the initial dish.
[0045] Optionally, the feature embedding layer includes: a location information identification unit, an important indicator acquisition unit, and a character-level information acquisition unit.
[0046] The location indicator information acquisition submodule includes:
[0047] The dish word location identifier submodule is used to call the location information identifier unit to identify the dish name, so as to identify the dish word location information of each dish word in the dish name;
[0048] The indicator information acquisition submodule is used to call the important indicator acquisition unit to process the multi-domain information of the dish and the dish name, so as to obtain the important indicator information of the multi-domain information of the dish on the dish name;
[0049] The character granularity acquisition submodule is used to call the character granularity information acquisition unit to process the multi-domain information of the dish in order to obtain the character granularity information corresponding to the multi-domain information of the dish.
[0050] Optionally, the device further includes:
[0051] The keyword retrieval module is used to retrieve the query keywords input by the user.
[0052] The tag probability acquisition module is used to input the query keyword into the target keyword recognition model to obtain the query tag sequence corresponding to the query keyword output by the target keyword recognition model, and the tag probability corresponding to the query tag sequence;
[0053] The target tag filtering module is used to filter out N target query tag sequences from the query tag sequence based on the tag probability, where N is a positive integer greater than or equal to 1;
[0054] The target keyword generation module is used to transform the target query tag sequence and generate target keywords corresponding to the target query tag sequence;
[0055] The target dish query module is used to retrieve target dishes based on the target keywords.
[0056] Optionally, the target label filtering module includes:
[0057] The sorting result acquisition submodule is used to sort the query tag sequence according to the tag probability from largest to smallest to obtain the sorting result;
[0058] The target tag acquisition submodule is used to select the top N query tag sequences from the query tag sequences based on the sorting result as the target query tag sequence.
[0059] According to a third aspect of the embodiments of this disclosure, an electronic device is provided, comprising:
[0060] A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the training method for the keyword recognition model described in any of the preceding claims.
[0061] According to a fourth aspect of the embodiments of the present disclosure, a readable storage medium is provided, wherein when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the training method of the keyword recognition model described in any of the preceding claims.
[0062] This disclosure provides a method and apparatus for training a keyword recognition model. Training samples are acquired, including the name of an initial dish, multi-domain information about the dish, and multiple initial keywords associated with the initial dish. These are then input into a keyword recognition model to be trained. The model processes the dish name, multi-domain information, and initial keywords to obtain predicted probabilities of the initial keywords relative to the initial dish. Based on these predicted probabilities, a loss function is calculated for the keyword recognition model. The model parameters are adjusted according to the loss function. This process is iteratively repeated from acquiring training samples to adjusting the model parameters based on the loss function until a target keyword recognition model is obtained. This disclosure introduces multi-domain information about the dish to train the keyword recognition model, thus maintaining both accuracy and diversity. The introduction of an indicator allows the model to learn the core components of multi-dimensional dish information, improving its noise reduction capabilities. By distinguishing the importance of different dish domains, the model's accuracy is further enhanced. Attached Figure Description
[0063] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments of this disclosure will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0064] Figure 1 A flowchart illustrating the steps of a keyword recognition model training method provided for embodiments of this disclosure;
[0065] Figure 2 A flowchart illustrating the steps of another keyword recognition model training method provided for embodiments of this disclosure;
[0066] Figure 3 A schematic diagram illustrating the construction of training data as provided in an embodiment of this disclosure;
[0067] Figure 4 A schematic diagram of a tag sequence provided for an embodiment of this disclosure;
[0068] Figure 5 A schematic diagram of a model processing procedure provided for an embodiment of this disclosure;
[0069] Figure 6 A schematic diagram of the structure of a training device for a keyword recognition model provided in an embodiment of this disclosure;
[0070] Figure 7 A schematic diagram of the structure of a training device for another keyword recognition model provided in an embodiment of this disclosure. Detailed Implementation
[0071] The technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without creative effort are within the protection scope of the embodiments of this disclosure.
[0072] Example 1
[0073] Reference Figure 1 The diagram illustrates a flowchart of the steps involved in training a keyword recognition model according to an embodiment of this disclosure. Figure 1 As shown, the training method for this keyword recognition model can specifically include the following steps:
[0074] Step 101: Obtain training samples; the training samples include: the dish name of the initial dish, multi-domain information of the dish, and multiple initial keywords associated with the initial dish.
[0075] The embodiments disclosed herein can be applied to scenarios where keyword recognition models are trained by combining multi-domain information of dishes.
[0076] Training samples refer to the samples used to train the keyword recognition model. In this example, the number of training samples can be 800, 1000, etc., depending on the business needs. This embodiment does not impose any restrictions on this.
[0077] Training samples can include: the name of the initial dish, multi-domain information about the dish, and multiple initial keywords associated with the initial dish. The initial dish refers to the dish extracted from the query terms entered by the user during their historical search for dishes. For example, when a user searches for "rice bowl with toppings, stir-fry, delicious tomato and egg stir-fry," the initial dish included is "tomato and egg stir-fry." Multi-domain information about the dish refers to information from different dimensions associated with the initial dish, which may include the dish's category, merchant tags, data source, etc. Initial keywords are the keywords associated with the initial dish. For example, if the initial dish is "tomato and egg stir-fry," a user might enter "tomato and egg stir-fry," "stir-fry," or "tomato and egg" in their search; all of these can be used as initial keywords for the initial dish.
[0078] It is understood that the above examples are merely examples listed to better understand the technical solutions of the embodiments of this disclosure, and are not intended to be the only limitation of this embodiment.
[0079] After obtaining the training samples, proceed to step 102.
[0080] Step 102: Input the dish name, the dish multi-domain information, and the multiple initial keywords into the keyword recognition model to be trained.
[0081] The keyword recognition model to be trained refers to a model that has not yet been trained and is used to recognize keywords in the query statement entered by the user.
[0082] After obtaining the training samples, the dish names, multi-domain information of the dishes, and multiple initial keywords contained in the training samples can be input into the keyword recognition model to be trained.
[0083] After inputting the dish name, multi-domain information of the dish, and multiple initial keywords into the keyword recognition model to be trained, step 103 is executed.
[0084] Step 103: Call the keyword recognition model to be trained to process the dish name, the dish multi-domain information and the multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords output by the keyword recognition model to be trained relative to the initial dish.
[0085] Prediction probability refers to the predicted probability of multiple initial keywords relative to the initial dishes output by the keyword recognition model to be trained. In other words, when searching for related dishes, which initial keyword has the highest probability of finding the corresponding dish? The higher the prediction probability, the easier it is to find the corresponding dish, and vice versa.
[0086] After inputting the dish name, multi-domain information of the dish, and multiple initial keywords into the keyword recognition model to be trained, the keyword recognition model to be trained can be called to process the dish name, multi-domain information of the dish, and multiple initial keywords to obtain the predicted probabilities of multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained. The processing of the dish name, multi-domain information of the dish, and multiple initial keywords by the keyword recognition model to be trained will be described in detail in the following embodiment two, and will not be repeated here.
[0087] After obtaining the predicted probabilities of multiple initial keywords relative to the initial dishes output by the keyword recognition model to be trained, step 104 is executed.
[0088] Step 104: Calculate the loss function corresponding to the keyword recognition model to be trained based on the predicted probability.
[0089] After obtaining the predicted probabilities, the loss function corresponding to the keyword recognition model to be trained can be calculated based on the predicted probabilities. This loss function can reflect the training degree of the keyword recognition model to be trained.
[0090] After calculating the loss function corresponding to the keyword recognition model to be trained based on the predicted probability, step 105 is executed.
[0091] Step 105: Adjust the model parameters of the keyword recognition model to be trained according to the loss function.
[0092] After calculating the loss function through the above steps, the model parameters of the keyword recognition model to be trained can be adjusted according to the loss function. After adjusting the model parameters, the next step of model training can be carried out.
[0093] Step 106: Iteratively execute the steps of obtaining training samples and adjusting the model parameters of the keyword recognition model to be trained according to the loss function until the target keyword recognition model is obtained.
[0094] After adjusting the model parameters of the keyword recognition model to be trained, steps 101 to 105 above can be executed iteratively until the model converges, thereby obtaining the final target keyword recognition model. This target keyword recognition model can then be applied to the subsequent keyword recognition of user-input queries and to the search for dishes based on the recognized keywords.
[0095] The embodiments of this disclosure train the keyword recognition model by introducing multi-domain information of dishes, thereby ensuring both accuracy and diversity. At the same time, the introduction of an indicator allows the model to learn the core components in multi-dimensional dish information, thereby improving the model's noise reduction capability.
[0096] The keyword recognition model training method provided in this disclosure involves acquiring training samples, including the dish name, multi-domain information of the dish, and multiple initial keywords associated with the initial dish. The dish name, multi-domain information, and multiple initial keywords are input into the keyword recognition model to be trained. The model is then called to process the dish name, multi-domain information, and multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish. Based on the predicted probabilities, a loss function corresponding to the keyword recognition model is calculated. The model parameters of the keyword recognition model are adjusted according to the loss function. This process is iteratively repeated from acquiring training samples to adjusting the model parameters according to the loss function until the target keyword recognition model is obtained. This disclosure introduces multi-domain information of the dish to train the keyword recognition model, thereby maintaining both accuracy and diversity. The introduction of an indicator allows the model to learn the core components of multi-dimensional dish information, improving the model's denoising ability. By distinguishing the importance of different dish domains, the model's accuracy is improved.
[0097] Example 2
[0098] Reference Figure 2 The flowchart illustrates the steps of another keyword recognition model training method provided by an embodiment of this disclosure, as shown below. Figure 2 As shown, the training method for this keyword recognition model can specifically include the following steps:
[0099] Step 201: Obtain training samples; the training samples include: the dish name of the initial dish, multi-domain information of the dish, and multiple initial keywords associated with the initial dish.
[0100] The embodiments disclosed herein can be applied to scenarios where keyword recognition models are trained by combining multi-domain information of dishes.
[0101] Training samples refer to the samples used to train the keyword recognition model. In this example, the number of training samples can be 800, 1000, etc., depending on the business needs. This embodiment does not impose any restrictions on this.
[0102] Training samples can include: the name of the initial dish, multi-domain information about the dish, and multiple initial keywords associated with the initial dish. The initial dish refers to the dish extracted from the query terms entered by the user during their historical search for dishes. For example, when a user searches for "rice bowl with toppings, stir-fry, delicious tomato and egg stir-fry," the initial dish included is "tomato and egg stir-fry." Multi-domain information about the dish refers to information from different dimensions associated with the initial dish, which may include the dish's category, merchant tags, data source, etc. Initial keywords are the keywords associated with the initial dish. For example, if the initial dish is "tomato and egg stir-fry," a user might enter "tomato and egg stir-fry," "stir-fry," or "tomato and egg" in their search; all of these can be used as initial keywords for the initial dish.
[0103] It is understood that the above examples are merely examples listed to better understand the technical solutions of the embodiments of this disclosure, and are not intended to be the only limitation of this embodiment.
[0104] In this embodiment, the keyword recognition model generates an output text sequence based on the input text sequence. This embodiment integrates a sequence labeling model and a text generation model based on a Seq2Seq structure, transforming the text generation task into a sequence labeling task. The output text sequence needs to be converted into a label sequence; the model in this embodiment uses four types of output labels, represented as: K, D, P, ... K P D .
[0105] Where K represents retaining the input at the current time as the output at the current time.
[0106] D indicates that no output is made at the current time step (i.e., the current input is not retained as the current output).
[0107] P K This means retaining the input at the current time as the output at the current time, and adding the word P before the current time in the output sequence.
[0108] P D This means that the input at the current time step is not retained as the output at the current time step, but the word P is added before the current time step in the output sequence.
[0109] The word P comes from the Phrase vocabulary, and the selection rules for the Phrase vocabulary are as follows:
[0110] 1. Obtain the longest common subsequence (LCS) between the input and output sequences of the training data;
[0111] 2. All phrases in the output sequence that do not belong to LCS are selected as candidate phrases;
[0112] 3. Select the top N Phrases with the highest frequency of occurrence from the candidate Phrase set to form the final Phrase table.
[0113] In the takeaway scenario, the Queries searched by users are relatively concentrated. By using a smaller number of Phrases, the vast majority of training samples can be covered. Compared with the text generation model based on the Seq2Seq structure, the scale of the output vocabulary of the generation model is greatly reduced, and the controllability, interpretability, and accuracy of the generated keywords are improved; compared with the sequence labeling model, by introducing the Phrase vocabulary, keywords that are not included in the source text can be generated, improving the coverage rate and diversity.
[0114] For the construction process of the training data, it can be combined with Figure 3 and Figure 4 to be described in detail as follows.
[0115] In this embodiment, the text generation task is converted into a sequence labeling task, and the text output sequence in the training data needs to be converted into a label sequence. The specific conversion method is as follows (described in combination with Figure 3 ):
[0116] [[ID=OG=19]]Let the current positions to be matched in the input and output sequences be i and o. At the beginning, both i and o are set to 0.
[0117] a) Fix the position i of the input sequence, and the output sequence traverses to the right from the position o until the position o'.
[0118] i. If the characters to be matched in the input and output sequences are the same, and the traversed output sequence P1 falls into the Phrase table, the output label corresponding to the position i of the input sequence is P1 K , and the position to be matched in the output sequence is adjusted to o = o' + 1 (indicating the next position to be matched)
[0119] When the label type is P K , it needs to be adjusted. As shown in the following figure, the original label corresponding to the character "饭" in the input sequence is 米 K . Traverse the label sequence to the left from this character, and find the first label of type K or P K (the K label corresponding to the character "骨"), and modify the D label on its right to 米 D . The label 米 K corresponding to the character "饭" in the input sequence is adjusted to K; if not found, the P [[ID=OG=41]] K label remains unchanged. As Figure 4 can be intuitively seen from the adjusted label sequence, the original label sequence and the input sequence.
[0120] ii. If no match is found that satisfies condition a) after traversing the entire sequence, the output label corresponding to position i in the input sequence is D, and the position o to be matched in the output sequence remains unchanged.
[0121] iii. The position to be matched in the input sequence is adjusted to i = i + 1.
[0122] b) Repeat step a) above until the entire input sequence has been traversed.
[0123] After obtaining the training samples, proceed to step 202.
[0124] Step 202: Input the dish name, the dish multi-domain information, and the multiple initial keywords into the keyword recognition model to be trained.
[0125] The keyword recognition model to be trained refers to a model that has not yet been trained and is used to recognize keywords in the query statement entered by the user.
[0126] After obtaining the training samples, the dish names, multi-domain information of the dishes, and multiple initial keywords contained in the training samples can be input into the keyword recognition model to be trained. For example... Figure 5 As shown, the input of the model can include two parts: the main term of the dish and multi-dimensional dish domain information. The main term of the dish is "tomato and egg", and the multi-dimensional dish domain information includes "merchant category", "dish tag" and "dish name", etc.
[0127] After inputting the dish name, multi-domain information of the dish, and multiple initial keywords into the keyword recognition model to be trained, step 203 is executed.
[0128] Step 203: Call the feature embedding layer to process the dish name and the dish multi-domain information to obtain the dish word position information corresponding to the dish name, the important indicator information and word granularity information corresponding to the dish multi-domain information.
[0129] In this embodiment, the keyword recognition model to be trained may include: a feature embedding layer, an attention mechanism layer, and a decoding layer. For example... Figure 5 As shown, the feature embedding layer is the Embedding Layer, the attention mechanism layer is the Bert Encoder Block, and the decoding layer is the Transformer Decoder Layer.
[0130] After inputting the dish name, multi-domain information of the dish, and multiple initial keywords into the keyword recognition model to be trained, the feature embedding layer can be called first to process the dish name and multi-domain information of the dish to obtain the dish word position information corresponding to the dish name, the important indicator information and word granularity information corresponding to the multi-domain information of the dish. Specifically, the following detailed implementation method can be described in detail.
[0131] In one specific implementation of this disclosure, the feature embedding layer includes a location information identification unit, an important indicator acquisition unit, and a character-level information acquisition unit. Step 103 may include:
[0132] Sub-step S1: Call the location information identification unit to identify the dish name, so as to identify the location information of each dish word in the dish name.
[0133] In this embodiment, the feature embedding layer may include a location information identification unit, an important indicator acquisition unit, and a character-level information acquisition unit. For example... Figure 5 As shown, the location information identification unit is Position Embedding, the important indicator acquisition unit is Field Embedding, and the word-level information acquisition unit is Token Embedding.
[0134] The location information identification unit can be used to identify the position of each dish word in the dish name text.
[0135] After inputting the dish name, multi-domain information of the dish, and multiple initial keywords into the keyword recognition model to be trained, the first step is to call the position information identification unit in the feature embedding layer to identify the dish name, thereby identifying the position of each dish word in the dish name text. This yields the position information of each dish word, such as... Figure 5 As shown, after inputting the main terms of the dishes and multi-dimensional dish domain information into the model, Position Embedding can be called to identify the input dish terms in order to obtain the position information of the dish terms.
[0136] In this embodiment, the position information identification unit (i.e., Position Embedding) can be used to identify the position information of tokens (including characters and words) in the input sequence, so as to retain the position information of the input sequence in the self-attention mechanism. The Position Embedding is calculated as follows:
[0137]
[0138] Where pos is the position of the current token in the input sequence, i is the dimension, and d is the position of the token.model For output dimensions.
[0139] After the location information identification unit is invoked to identify the location information of each dish word in the dish name, sub-step S2 is executed.
[0140] Sub-step S2: Call the important indicator acquisition unit to process the multi-domain information of the dish and the dish name to obtain the important indicator information of the multi-domain information of the dish name.
[0141] After the location information identification unit is invoked to identify the location information of each dish word in the dish name, the important indicator acquisition unit can be invoked to process the multi-domain information of the dish and the dish name to obtain the important indicator information of the multi-domain information on the dish name. Specifically, it is obvious that different domain information has different degrees of importance in describing the dish. It is necessary to introduce a Field Embedding (important indicator acquisition unit) for each domain to learn the importance of the current domain, which has been verified in our experiments. Different fields are assigned different embedding vectors, and each field has its own ID number field_type_id∈[d number -1]. Specifically, it is represented as follows:
[0142]
[0143] Among them, E f This is a trainable field embedding lookup table. During the calculation process, the embedding can be obtained by looking up the table based on the id. Let i be the number of the i-th field.
[0144] like Figure 5 As shown, after inputting the multi-domain information and dish name into the model, FieldEmbedding can be called to process the multi-domain information and dish name to obtain the important indicator information of the multi-domain information on the dish name.
[0145] After calling the important indicator acquisition unit to process the multi-domain information of the dish and the dish name to obtain the important indicator information of the dish name based on the multi-domain information of the dish, sub-step S3 is executed.
[0146] Sub-step S3: Call the character granularity information acquisition unit to process the multi-domain information of the dish to obtain the character granularity information corresponding to the multi-domain information of the dish.
[0147] In this embodiment, the multi-dimensional dish domain data of the granular information acquisition unit (i.e., Token Embedding) adopts granular embedding. Considering that the main words of the dishes are relatively short and few in number, to avoid learning the literal similarity of the text rather than the semantics of the entire entity word due to the use of granular embedding, an id-type embedding is adopted. This part of the calculation is divided into two parts: token embedding and indicator embedding. Figure 5 As shown, TokenEmbedding can be called to process the multi-domain information of the dish to obtain the granular information corresponding to the multi-domain information of the dish.
[0148] After calling the feature embedding layer to process the dish name and dish multi-domain information to obtain the dish word position information corresponding to the dish name, the important indicator information and word granularity information corresponding to the dish multi-domain information, step 204 is executed.
[0149] Step 204: Call the attention mechanism layer to process the dish word location information, the important indicator information, and the word granularity information to obtain the attention information corresponding to the multi-domain information of the dish.
[0150] Attention information can indicate the level of attention given to a dish's name across multiple domains of information.
[0151] In this example, the attention mechanism layer can learn the features of the text sequence using the Bert-base model, initialized with pre-trained weights, and then fine-tuned during training.
[0152] After processing the dish name and multi-domain information using the feature embedding layer to obtain the dish word position information corresponding to the dish name, the important indicator information corresponding to the multi-domain information, and the word granularity information, the attention mechanism layer can be called. Figure 5 The Bert Encoder Block (as shown) processes the location information, key indicator information, and character-level information of dish words to obtain the attention information corresponding to the multi-domain information of the dish. In this embodiment, the main entity words of the dish are introduced into the model as indicators to guide the attention of the input multi-domain information. The attention and multi-domain information together use the Self-Attention mechanism to determine the information input for subsequent sequence labeling tasks. The attention is calculated as follows:
[0153]
[0154] in, W k,E All of these are learnable parameters.
[0155] After processing the dish word location information, important indicator information, and word granularity information in the attention mechanism layer to obtain the attention information corresponding to the multi-domain information of the dish, step 205 is executed.
[0156] Step 205: Call the decoding layer to decode the attention information to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish.
[0157] Prediction probability refers to the probability that the initial keyword can be used as the initial search keyword for the dish.
[0158] After processing the dish word location information, important indicator information, and character granularity information at the attention mechanism layer to obtain the attention information corresponding to the multi-domain information of the dish, the decoding layer can be called to decode the attention information to obtain the predicted probabilities of multiple initial keywords relative to the initial dish. Specifically, a Transformer Decoder (such as...) is used. Figure 5 As shown, except that the indicator does not participate in sequence labeling prediction, each token in the multi-domain input information is predicted as one of the initial keywords. This prediction result, through decoding, allows the input sequence to become the model's predicted output sequence. Furthermore, during the decoding process of each input, beam search is used to generate keywords, which effectively solves the problem of output diversity and can also generate "crossing" issues not supported by sequence labeling.
[0159] After calling the decoding layer to decode the attention information and obtain the predicted probabilities of multiple initial keywords relative to the initial dishes, step 206 is executed.
[0160] Step 206: Calculate the loss function corresponding to the keyword recognition model to be trained based on the predicted probability.
[0161] After obtaining the predicted probabilities, the loss function corresponding to the keyword recognition model to be trained can be calculated based on the predicted probabilities. This loss function can reflect the training degree of the keyword recognition model to be trained.
[0162] After calculating the loss function corresponding to the keyword recognition model to be trained based on the predicted probability, step 207 is executed.
[0163] Step 207: Adjust the model parameters of the keyword recognition model to be trained according to the loss function.
[0164] After calculating the loss function through the above steps, the model parameters of the keyword recognition model to be trained can be adjusted according to the loss function. After adjusting the model parameters, the next step of model training can be carried out.
[0165] Step 208: Iteratively execute the steps of obtaining training samples and adjusting the model parameters of the keyword recognition model to be trained according to the loss function until the target keyword recognition model is obtained.
[0166] After adjusting the model parameters of the keyword recognition model to be trained, the above steps can be executed iteratively until the model converges, thereby obtaining the final target keyword recognition model. This target keyword recognition model can then be applied to the subsequent keyword recognition of user-input queries and to the search for dishes based on the recognized keywords.
[0167] Step 209: Obtain the query keywords entered by the user.
[0168] Search keywords refer to the keywords that users enter to search for dishes.
[0169] When users need to search for dishes through a food delivery platform, they can enter search keywords.
[0170] After obtaining the user's input query keywords, proceed to step 210.
[0171] Step 210: Input the query keyword into the target keyword recognition model to obtain the query tag sequence corresponding to the query keyword output by the target keyword recognition model, and the tag probability corresponding to the query tag sequence.
[0172] After obtaining the query keywords input by the user, the query keywords can be input into the target keyword recognition model. The target keyword recognition model processes the query keywords to obtain the query tag sequence corresponding to the query keywords. This query tag sequence is a sequence formed by multiple matching keywords, and the tag probability corresponding to the query tag sequence output by the target keyword recognition model can be obtained.
[0173] After obtaining the query label sequence and the label probability corresponding to the query label sequence, proceed to step 211.
[0174] Step 211: Based on the label probabilities, select N target query label sequences from the query label sequences, where N is a positive integer greater than or equal to 1.
[0175] After obtaining the query label sequence and label probability, N (N is a positive integer greater than or equal to 1) query label sequences can be selected from the query label sequence.
[0176] Specifically, the query tag sequence can be sorted in descending order of tag probability to obtain a sorting result, and the query tag sequence ranked in the top N positions can be selected as the target query tag sequence based on the sorting result.
[0177] After selecting N target query tag sequences from the query tag sequences based on the tag probabilities, proceed to step 212.
[0178] Step 212: Transform the target query tag sequence to generate the target keywords corresponding to the target query tag sequence.
[0179] After obtaining the target query tag sequence, it can be transformed to generate the target keywords corresponding to the target query tag sequence. Specifically, consistent with the text generation model based on the Seq2Seq structure, this example can use beam search to select the predicted N tag sequences, and then, based on the meaning of each tag, convert the top K tag sequences into the corresponding N keywords.
[0180] After converting the target query tag sequence to generate the target keywords corresponding to the target query tag sequence, step 213 is executed.
[0181] Step 213: Based on the target keywords, retrieve the target dishes.
[0182] After obtaining the target keywords, a search can be performed based on the target keywords to find the target dishes, and the retrieved target dishes will be displayed on the user's terminal.
[0183] The keyword recognition model training method provided in this disclosure involves acquiring training samples, including the dish name, multi-domain information of the dish, and multiple initial keywords associated with the initial dish. The dish name, multi-domain information, and multiple initial keywords are input into the keyword recognition model to be trained. The model is then called to process the dish name, multi-domain information, and multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords relative to the initial dish. Based on the predicted probabilities, a loss function corresponding to the keyword recognition model is calculated. The model parameters of the keyword recognition model are adjusted according to the loss function. This process is iteratively repeated from acquiring training samples to adjusting the model parameters according to the loss function until the target keyword recognition model is obtained. This disclosure introduces multi-domain information of the dish to train the keyword recognition model, thereby maintaining both accuracy and diversity. The introduction of an indicator allows the model to learn the core components of multi-dimensional dish information, improving the model's denoising ability. By distinguishing the importance of different dish domains, the model's accuracy is improved.
[0184] Example 3
[0185] Reference Figure 6 The diagram shows a schematic representation of the structure of a training device for a keyword recognition model provided in an embodiment of this disclosure. Figure 6 As shown, the training device 300 for the keyword recognition model may specifically include the following modules:
[0186] The training sample acquisition module 310 is used to acquire training samples; the training samples include: the dish name of the initial dish, the multi-domain information of the dish, and multiple initial keywords associated with the initial dish;
[0187] The training sample input module 320 is used to input the dish name, the dish multi-domain information and the multiple initial keywords into the keyword recognition model to be trained.
[0188] The prediction probability acquisition module 330 is used to call the keyword recognition model to be trained to process the dish name, the dish multi-domain information and the multiple initial keywords, so as to obtain the prediction probability of the multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained;
[0189] The loss function calculation module 340 is used to calculate the loss function corresponding to the keyword recognition model to be trained based on the predicted probability.
[0190] The model parameter adjustment module 350 is used to adjust the model parameters of the keyword recognition model to be trained according to the loss function.
[0191] The target recognition model acquisition module 360 is used to iteratively execute the training sample acquisition module, the training sample input module, the prediction probability acquisition module, the loss function calculation module, and the model parameter adjustment module until the target keyword recognition model is obtained.
[0192] The keyword recognition model training device provided in the embodiments of this disclosure acquires training samples, including the dish name, multi-domain information of the dish, and multiple initial keywords associated with the initial dish. The dish name, multi-domain information, and multiple initial keywords are input into the keyword recognition model to be trained. The keyword recognition model is then called to process the dish name, multi-domain information, and multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords output by the keyword recognition model relative to the initial dish. Based on the predicted probabilities, a loss function corresponding to the keyword recognition model to be trained is calculated. The model parameters of the keyword recognition model to be trained are adjusted according to the loss function. The steps of acquiring training samples and adjusting the model parameters of the keyword recognition model to be trained according to the loss function are iteratively executed until the target keyword recognition model is obtained. The embodiments of this disclosure introduce multi-domain information of the dish to train the keyword recognition model, thereby maintaining both accuracy and diversity. Simultaneously, the introduction of an indicator allows the model to learn the core components in multi-dimensional dish information, improving the model's denoising ability. By distinguishing the importance of different dish domains, the model's accuracy is improved.
[0193] Example 4
[0194] Reference Figure 7 The diagram illustrates a structural schematic of a training apparatus for another keyword recognition model provided in an embodiment of this disclosure, as shown below. Figure 7 As shown, the training device 400 for the keyword recognition model may specifically include the following modules:
[0195] The training sample acquisition module 410 is used to acquire training samples; the training samples include: the dish name of the initial dish, multi-domain information of the dish, and multiple initial keywords associated with the initial dish;
[0196] The training sample input module 420 is used to input the dish name, the dish multi-domain information and the multiple initial keywords into the keyword recognition model to be trained.
[0197] The prediction probability acquisition module 430 is used to call the keyword recognition model to be trained to process the dish name, the dish multi-domain information and the multiple initial keywords, so as to obtain the prediction probability of the multiple initial keywords relative to the initial dish output by the keyword recognition model to be trained;
[0198] The loss function calculation module 440 is used to calculate the loss function corresponding to the keyword recognition model to be trained based on the predicted probability.
[0199] The model parameter adjustment module 450 is used to adjust the model parameters of the keyword recognition model to be trained according to the loss function.
[0200] The target recognition model acquisition module 460 is used to iteratively execute the training sample acquisition module, the training sample input module, the prediction probability acquisition module, the loss function calculation module, and the model parameter adjustment module until the target keyword recognition model is obtained.
[0201] The keyword acquisition module 470 is used to acquire the query keywords input by the user.
[0202] The tag probability acquisition module 480 is used to input the query keyword into the target keyword recognition model to obtain the query tag sequence corresponding to the query keyword output by the target keyword recognition model, and the tag probability corresponding to the query tag sequence;
[0203] The target tag filtering module 490 is used to filter N target query tag sequences from the query tag sequence according to the tag probability, where N is a positive integer greater than or equal to 1;
[0204] The target keyword generation module 4100 is used to transform the target query tag sequence and generate target keywords corresponding to the target query tag sequence;
[0205] The target dish query module 4110 is used to query and obtain target dishes based on the target keywords.
[0206] Optionally, the keyword recognition model to be trained includes: a feature embedding layer, an attention mechanism layer, and a decoding layer.
[0207] The prediction probability acquisition module 430 includes:
[0208] The location indicator information acquisition submodule 431 is used to call the feature embedding layer to process the dish name and the dish multi-domain information to obtain the dish word location information corresponding to the dish name, the important indicator information and word granularity information corresponding to the dish multi-domain information;
[0209] The attention acquisition submodule 432 is used to call the attention mechanism layer to process the dish word position information, the important indicator information and the word granularity information to obtain the attention information corresponding to the multi-domain information of the dish;
[0210] The prediction probability acquisition submodule 433 is used to call the decoding layer to decode the attention information and obtain the predicted probability of the multiple initial keywords relative to the initial dish.
[0211] Optionally, the feature embedding layer includes: a location information identification unit, an important indicator acquisition unit, and a character-level information acquisition unit.
[0212] The location indicator information acquisition submodule 431 includes:
[0213] The dish word location identifier submodule is used to call the location information identifier unit to identify the dish name, so as to identify the dish word location information of each dish word in the dish name;
[0214] The indicator information acquisition submodule is used to call the important indicator acquisition unit to process the multi-domain information of the dish and the dish name, so as to obtain the important indicator information of the multi-domain information of the dish on the dish name;
[0215] The character granularity acquisition submodule is used to call the character granularity information acquisition unit to process the multi-domain information of the dish in order to obtain the character granularity information corresponding to the multi-domain information of the dish.
[0216] Optionally, the target label filtering module 490 includes:
[0217] The sorting result acquisition submodule is used to sort the query tag sequence according to the tag probability from largest to smallest to obtain the sorting result;
[0218] The target tag acquisition submodule is used to select the top N query tag sequences from the query tag sequences based on the sorting result as the target query tag sequence.
[0219] The keyword recognition model training device provided in the embodiments of this disclosure acquires training samples, including the dish name, multi-domain information of the dish, and multiple initial keywords associated with the initial dish. The dish name, multi-domain information, and multiple initial keywords are input into the keyword recognition model to be trained. The keyword recognition model is then called to process the dish name, multi-domain information, and multiple initial keywords to obtain the predicted probabilities of the multiple initial keywords output by the keyword recognition model relative to the initial dish. Based on the predicted probabilities, a loss function corresponding to the keyword recognition model to be trained is calculated. The model parameters of the keyword recognition model to be trained are adjusted according to the loss function. The steps of acquiring training samples and adjusting the model parameters of the keyword recognition model to be trained according to the loss function are iteratively executed until the target keyword recognition model is obtained. The embodiments of this disclosure introduce multi-domain information of the dish to train the keyword recognition model, thereby maintaining both accuracy and diversity. Simultaneously, the introduction of an indicator allows the model to learn the core components in multi-dimensional dish information, improving the model's denoising ability. By distinguishing the importance of different dish domains, the model's accuracy is improved.
[0220] Embodiments of this disclosure also provide an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the training method of the keyword recognition model of the foregoing embodiments.
[0221] Embodiments of this disclosure also provide a readable storage medium that, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute the keyword recognition model training method of the foregoing embodiments.
[0222] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0223] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used in conjunction with the teachings herein. The required structure for constructing such systems is apparent from the above description. Furthermore, the embodiments of this disclosure are not directed to any particular programming language. It should be understood that the embodiments of this disclosure described herein can be implemented using various programming languages, and the above description of specific languages is for the purpose of disclosing the best mode of implementation of the embodiments of this disclosure.
[0224] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this disclosure may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0225] Similarly, it should be understood that, in order to simplify this disclosure and aid in understanding one or more of the various inventive aspects, in the foregoing description of exemplary embodiments of this disclosure, various features of embodiments of this disclosure are sometimes grouped together in a single embodiment, figure, or description thereof. However, this approach to disclosure should not be construed as reflecting an intention that the claimed embodiments of this disclosure require more features than expressly recited in each claim. Rather, as reflected in the following claims, inventive aspects lie in fewer than all features of a single foregoing disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of the present disclosure.
[0226] Those skilled in the art will understand that modules in the device of the embodiments can be adaptively changed and placed in one or more devices different from that embodiment. Modules, units, or components in the embodiments can be combined into a single module, unit, or component, and further, they can be divided into multiple sub-modules, sub-units, or sub-components. Except where at least some of such features and / or processes or units are mutually exclusive, any combination can be used to combine all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or units of any method or device so disclosed. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature serving the same, equivalent, or similar purpose.
[0227] The various component embodiments of this disclosure can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some or all of the components in the motion picture generation device according to the embodiments of this disclosure. Embodiments of this disclosure can also be implemented as device or apparatus programs for performing some or all of the methods described herein. Such programs implementing embodiments of this disclosure can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0228] It should be noted that the above embodiments are illustrative of embodiments of this disclosure and not restrictive of embodiments of this disclosure, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. Embodiments of this disclosure can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0229] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0230] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the embodiments of the present disclosure. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the embodiments of the present disclosure should be included within the protection scope of the embodiments of the present disclosure.
[0231] The above description is merely a specific implementation of the embodiments of this disclosure, but the protection scope of the embodiments of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the embodiments of this disclosure should be included within the protection scope of the embodiments of this disclosure. Therefore, the protection scope of the embodiments of this disclosure should be determined by the protection scope of the claims.
Claims
1. A method for training a keyword recognition model, the method comprising: The method comprises the following steps: obtaining a training sample; the training sample comprises: a dish name of an initial dish, dish multi-domain information, and a plurality of initial keywords associated with the initial dish; inputting the dish name, the dish multi-domain information, and the plurality of initial keywords into a to-be-trained keyword recognition model; calling the to-be-trained keyword recognition model to process the dish name, the dish multi-domain information, and the plurality of initial keywords to obtain a prediction probability of the plurality of initial keywords output by the to-be-trained keyword recognition model with respect to the initial dish; calculating a loss function corresponding to the to-be-trained keyword recognition model according to the prediction probability; adjusting model parameters of the to-be-trained keyword recognition model according to the loss function; iteratively performing the steps of obtaining a training sample until the step of adjusting the model parameters of the to-be-trained keyword recognition model according to the loss function, so as to obtain a target keyword recognition model; the to-be-trained keyword recognition model comprises: a feature embedding layer, an attention mechanism layer, and a decoding layer, the step of calling the to-be-trained keyword recognition model to process the dish name, the dish multi-domain information, and the plurality of initial keywords to obtain a prediction probability of the plurality of initial keywords output by the to-be-trained keyword recognition model with respect to the initial dish comprises: calling the feature embedding layer to process the dish name and the dish multi-domain information to obtain dish word position information corresponding to the dish name, important indicator information corresponding to the dish multi-domain information, and word granularity information; calling the attention mechanism layer to process the dish word position information, the important indicator information, and the word granularity information to obtain attention degree information corresponding to the dish multi-domain information; calling the decoding layer to decode the attention degree information to obtain the prediction probability of the plurality of initial keywords with respect to the initial dish.
2. The method of claim 1, wherein, the feature embedding layer comprises: a position information identification unit, an important indicator acquisition unit, and a word granularity information acquisition unit, the step of calling the feature embedding layer to process the dish name and the dish multi-domain information to obtain dish word position information corresponding to the dish name, important indicator information corresponding to the dish multi-domain information, and word granularity information comprises: calling the position information identification unit to identify the dish name to identify dish word position information of each dish word in the dish name; calling the important indicator acquisition unit to process the dish multi-domain information and the dish name to obtain important indicator information of the dish multi-domain information with respect to the dish name; calling the word granularity information acquisition unit to process the dish multi-domain information to obtain word granularity information corresponding to the dish multi-domain information.
3. The method of claim 1, wherein, After obtaining the target keyword recognition model, the method further comprises the following steps: obtaining a query keyword input by a user; inputting the query keyword into the target keyword recognition model to obtain a query label sequence corresponding to the query keyword output by the target keyword recognition model and a label probability corresponding to the query label sequence. Filtering N target query label sequences from the query label sequences according to the label probabilities, N being a positive integer greater than or equal to 1; Converting the target query label sequences to generate target keywords corresponding to the target query label sequences; Querying target dishes according to the target keywords.
4. The method of claim 3, wherein, The filtering N target queries from the query label sequences according to the label probabilities comprises: Sorting the query label sequences according to the label probabilities from large to small to obtain a sorting result; Filtering query label sequences ranked in the top N positions from the query label sequences according to the sorting result as the target query label sequences. 5.A device for training a keyword recognition model, comprising: Comprise: A training sample acquisition module configured to acquire a training sample; The training sample comprises a dish name of an initial dish, dish multi-domain information, and a plurality of initial keywords associated with the initial dish; A training sample input module configured to input the dish name, the dish multi-domain information, and the plurality of initial keywords to a to-be-trained keyword recognition model; A prediction probability acquisition module configured to call the to-be-trained keyword recognition model to process the dish name, the dish multi-domain information, and the plurality of initial keywords to obtain a prediction probability of the plurality of initial keywords relative to the initial dish output by the to-be-trained keyword recognition model; A loss function calculation module configured to calculate a loss function corresponding to the to-be-trained keyword recognition model according to the prediction probability; A model parameter adjustment module configured to adjust model parameters of the to-be-trained keyword recognition model according to the loss function; A target recognition model acquisition module configured to iteratively execute the training sample acquisition module, the training sample input module, the prediction probability acquisition module, the loss function calculation module, and the model parameter adjustment module until a target keyword recognition model is obtained; The to-be-trained keyword recognition model comprises a feature embedding layer, an attention mechanism layer, and a decoding layer, The prediction probability acquisition module comprises: A position indicator information acquisition submodule configured to call the feature embedding layer to process the dish name and the dish multi-domain information to obtain dish word position information corresponding to the dish name, important indicator information corresponding to the dish multi-domain information, and word granularity information; An attention degree acquisition submodule configured to call the attention mechanism layer to process the dish word position information, the important indicator information, and the word granularity information to obtain attention degree information corresponding to the dish multi-domain information; A prediction probability acquisition submodule configured to call the decoding layer to decode the attention degree information to obtain the prediction probability of the plurality of initial keywords relative to the initial dish.
6. The apparatus of claim 5, wherein, The feature embedding layer comprises a position information identification unit, an important indicator acquisition unit, and a word granularity information acquisition unit, The position indicator information acquisition submodule comprises: A dish word position identification submodule configured to call the position information identification unit to identify process the dish name to identify dish word position information of each dish word in the dish name; The index information obtaining sub-module is configured to call the important index obtaining unit to process the dish multi-domain information and the dish name, so as to obtain important index information of the dish multi-domain information on the dish name. The word granularity obtaining sub-module is configured to call the word granularity information obtaining unit to process the dish multi-domain information, so as to obtain word granularity information corresponding to the dish multi-domain information.
7. The apparatus of claim 5, wherein, The device further comprises: The query keyword obtaining module is configured to obtain a query keyword input by a user. The label probability obtaining module is configured to input the query keyword into the target keyword recognition model, so as to obtain a query label sequence corresponding to the query keyword and output by the target keyword recognition model, and a label probability corresponding to the query label sequence. The target label screening module is configured to screen N target query label sequences from the query label sequence according to the label probability, where N is a positive integer greater than or equal to 1. The target keyword generating module is configured to convert and process the target query label sequence, so as to generate a target keyword corresponding to the target query label sequence. The target dish query module is configured to query a target dish according to the target keyword.
8. The apparatus of claim 7, wherein, The target label screening module comprises: The sorting result obtaining sub-module is configured to sort the query label sequence according to the order from large to small of the label probability, so as to obtain a sorting result. The target label obtaining sub-module is configured to screen query label sequences in the first N positions according to the sorting result, as the target query label sequences.
9. An electronic device, comprising: The device further comprises: The processor, the memory, and the computer program stored in the memory and executable on the processor, wherein the processor implements the training method of the keyword recognition model according to any one of claims 1 to 4 when executing the program.
10. A readable storage medium, characterized by, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the training method of the keyword recognition model according to any one of claims 1 to 4.
Citation Information
Patent Citations
Keyword extraction method based on Seq2seq framework
CN110119765A
Probability prediction model training method, probability prediction method and device
CN111782676A