Method, device, storage medium and electronic device for obtaining keywords

By combining the target keyword detection model with character-granularity and domain-granularity attention vectors, the problem of low keyword acquisition efficiency and accuracy in the existing technology is solved, and efficient and accurate keyword extraction in e-commerce scenarios is achieved.

CN114818696BActive Publication Date: 2024-09-10BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210386539.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-11
Publication Date
2024-09-10
Estimated Expiration
2042-04-11

AI Technical Summary

Technical Problem

In the existing technology, the efficiency and accuracy of obtaining product keywords are low. Especially in e-commerce scenarios, manually setting keywords is inefficient and general text processing models cannot distinguish multi-dimensional information, resulting in inaccurate keyword extraction. high.

Method used

Use the target keyword detection model to detect multiple target text information of the target object, obtain the undetermined character vector and undetermined domain vector corresponding to each target character in the target text information, and combine the attention vectors of character granularity and domain granularity to determine Keywords for the target audience.

Benefits of technology

It improves the efficiency and accuracy of keyword acquisition, can distinguish multi-dimensional information, and improves the quality of keyword extraction in scenarios such as product search.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114818696B
    Figure CN114818696B
Patent Text Reader

Abstract

The present disclosure relates to a method, device, storage medium and electronic device for obtaining keywords. The method includes: obtaining multiple target text information corresponding to a target object; inputting multiple target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object; the target text information is used to characterize the text information of the target dimension of the target object; the target keyword detection model is used to obtain the undetermined character vector corresponding to each target character in the target text information, and the undetermined domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated based on the undetermined character vector and the undetermined domain vector; and according to the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters in the target text information; the above-mentioned undetermined domain vector can be used to characterize the feature information of the target dimension corresponding to the target text information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of Internet technology, and in particular, to a method, device, storage medium and electronic device for acquiring keywords. Background Art

[0002] With the development of Internet technology, e-commerce business has become a common service business for users. In the service e-commerce scenario, product keyword mining can be applied to scenarios such as product search, title compression, copywriting generation, and advertising targeted bidding. Taking product search as an example, after the user enters the query word, the result that best matches the user's needs is recalled from the massive data. In this query process, the "keywords" of the product play a very important role. The query word entered by the user can be matched with the product's keywords to determine the target product. Therefore, how to obtain the keywords of the product has become an important factor affecting the quality and experience of product search. In related technologies, the keywords of the product can be set manually, but the efficiency and accuracy of manual setting are low. Summary of the invention

[0003] The purpose of the present disclosure is to provide a method, device, storage medium and electronic device for acquiring keywords, so as to partially solve the above-mentioned problems existing in the related art.

[0004] In order to achieve the above object, the first aspect of the present disclosure provides a method for obtaining keywords, the method comprising:

[0005] Acquire multiple target text information corresponding to the target object; the target text information is used to represent the text information of the target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters;

[0006] Inputting the target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object;

[0007] Among them, the target keyword detection model is used to obtain the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated according to the pending character vector and the pending domain vector; and according to the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters of the target text information; the pending domain vector is used to characterize the feature information of the target dimension corresponding to the target text information.

[0008] Optionally, the target keyword detection model has a first encoder and a second encoder; the inputting the plurality of target text information into the target keyword detection model to obtain one or more target keywords corresponding to the target object comprises:

[0009] Determine the to-be-processed text corresponding to the target object according to the plurality of target text information;

[0010] Inputting the text to be processed into the first encoder to obtain a pending character vector corresponding to each target character in the text to be processed;

[0011] According to the undetermined character vector and the second encoder, obtaining the undetermined domain vector corresponding to each of the target text information in the unprocessed text;

[0012] Obtaining a target attention vector corresponding to each target character according to the pending character vector and the pending domain vector;

[0013] According to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters.

[0014] Optionally, determining the to-be-processed text corresponding to the target object according to the plurality of target text information includes:

[0015] Processing the plurality of target text information by using a plurality of preset spacing characters to obtain the to-be-processed text corresponding to the target object;

[0016] The step of obtaining the to-be-determined domain vector corresponding to each of the target text information in the to-be-processed text according to the to-be-determined character vector and the second encoder comprises:

[0017] The spacing character vector corresponding to the preset spacing character is input into the second encoder to obtain the undetermined domain vector corresponding to each target text information in the text to be processed.

[0018] Optionally, the target keyword detection model further includes a target decoder; and obtaining a target attention vector corresponding to each target character according to the to-be-determined character vector and the to-be-determined domain vector includes:

[0019] Inputting the pending character vector into the target decoder to obtain a first attention vector corresponding to each target character;

[0020] Inputting the undetermined domain vector into the target decoder to obtain a second attention vector corresponding to each target text information;

[0021] The target attention vector corresponding to each target character is calculated based on the first attention vector and the second attention vector.

[0022] Optionally, the target keyword detection model is trained in the following manner:

[0023] Get one or more sample objects;

[0024] Acquire a first object category and one or more target sample text information corresponding to the sample object;

[0025] Obtaining one or more pending keywords corresponding to the sample object and a second object category corresponding to each pending keyword;

[0026] Determine one or more sample keywords from the pending keywords according to the first object category corresponding to the sample object and the second object category corresponding to the pending keyword;

[0027] According to the target sample text information and the sample keywords corresponding to the sample object, the preset attention model is trained to obtain the target keyword detection model.

[0028] Optionally, obtaining one or more target sample text information corresponding to the sample object includes:

[0029] Acquire first sample text information of the sample object;

[0030] Replacing the first text word in the first sample text information according to a preset knowledge graph to obtain one or more second sample text information;

[0031] The first sample text information and the second sample text information are used as the target sample text information.

[0032] Optionally, obtaining one or more undetermined keywords corresponding to the sample object includes:

[0033] Input the target sample text information corresponding to the sample object into a preset text extraction model to obtain one or more undetermined keywords corresponding to the sample object; or

[0034] One or more undetermined keywords corresponding to the sample object are determined according to the user's query and browsing data on the sample object.

[0035] Optionally, according to the first object category corresponding to the sample object and the second object category corresponding to the to-be-determined keyword, determining one or more sample keywords from the to-be-determined keywords includes:

[0036] Obtaining target similarity between the second object category and the first object category;

[0037] According to the target similarity, one or more sample keywords are determined from the pending keywords.

[0038] In a second aspect, the present disclosure provides a device for acquiring keywords, the device comprising:

[0039] A text information acquisition module, used to acquire a plurality of target text information corresponding to a target object; the target text information is used to represent text information of a target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters;

[0040] A keyword acquisition module is used to input multiple target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object; wherein the target keyword detection model is used to obtain a pending character vector corresponding to each target character in the target text information, and a pending domain vector corresponding to each target text information; a target attention vector corresponding to each target character in the target text information is calculated based on the pending character vector and the pending domain vector; and based on the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters in the target text information; the pending domain vector is used to characterize feature information of a target dimension corresponding to the target text information.

[0041] Optionally, the target keyword detection model includes a first encoder and a second encoder; and the keyword acquisition module is used to:

[0042] Determine the to-be-processed text corresponding to the target object according to the plurality of target text information;

[0043] Inputting the text to be processed into the first encoder to obtain a pending character vector corresponding to each target character in the text to be processed;

[0044] According to the undetermined character vector and the second encoder, obtaining the undetermined domain vector corresponding to each of the target text information in the unprocessed text;

[0045] Obtaining a target attention vector corresponding to each target character according to the pending character vector and the pending domain vector;

[0046] According to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters.

[0047] Optionally, the keyword acquisition module is used to process multiple target text information through multiple preset spacing characters to obtain the text to be processed corresponding to the target object; input the spacing character vector corresponding to the preset spacing character into the second encoder to obtain the to-be-determined domain vector corresponding to each target text information in the text to be processed.

[0048] Optionally, the target keyword detection model further includes a target decoder; the keyword acquisition module is used to:

[0049] Inputting the pending character vector into the target decoder to obtain a first attention vector corresponding to each target character;

[0050] Inputting the undetermined domain vector into the target decoder to obtain a second attention vector corresponding to each target text information;

[0051] The target attention vector corresponding to each target character is calculated based on the first attention vector and the second attention vector.

[0052] Optionally, the device further comprises a model training module, wherein the model training module is used to:

[0053] Get one or more sample objects;

[0054] Acquire a first object category and one or more target sample text information corresponding to the sample object;

[0055] Obtaining one or more pending keywords corresponding to the sample object and a second object category corresponding to each pending keyword;

[0056] Determine one or more sample keywords from the pending keywords according to the first object category corresponding to the sample object and the second object category corresponding to the pending keyword;

[0057] According to the target sample text information and the sample keywords corresponding to the sample object, the preset attention model is trained to obtain the target keyword detection model.

[0058] Optionally, the model training module is used to: obtain first sample text information of the sample object; replace the first text word in the first sample text information according to a preset knowledge graph to obtain one or more second sample text information; and use the first sample text information and the second sample text information as the target sample text information.

[0059] Optionally, the model training module is used to: input the target sample text information corresponding to the sample object into a preset text extraction model to obtain one or more pending keywords corresponding to the sample object; or, determine one or more pending keywords corresponding to the sample object based on the user's query and browsing data on the sample object.

[0060] Optionally, the model training module is used to: obtain target similarity between the second object category and the first object category; and determine one or more sample keywords from the pending keywords based on the target similarity.

[0061] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described in the first aspect of the present disclosure.

[0062] In a fourth aspect, the present disclosure provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of the present disclosure.

[0063] Adopting the above technical scheme, multiple target text information corresponding to the target object is obtained; the multiple target text information is input into the target keyword detection model to obtain one or more target keywords corresponding to the target object. Among them, the target text information is used to characterize the text information of the target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters; the target keyword detection model is used to obtain the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated according to the pending character vector and the pending domain vector; and according to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters in the target text information; the above pending domain vector can be used to characterize the feature information of the target dimension corresponding to the target text information. In this way, through the above-mentioned pending character vector of character granularity and the pending domain vector of domain granularity, the target attention vector of each target character can be comprehensively obtained, and the target attention vector includes both the characteristics of the character granularity of the target character and the characteristics of the domain granularity of the target dimension where the target character is located, thereby improving the efficiency and accuracy of obtaining keywords.

[0064] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0066] Figure 1 It is a flowchart of a method for obtaining keywords provided by an embodiment of the present disclosure.

[0067] Figure 2 It is a schematic diagram of a target keyword detection model provided by an embodiment of the present disclosure.

[0068] Figure 3 is based on Figure 1 The illustrated embodiment shows a flow chart of step S102.

[0069] Figure 4 It is a schematic diagram of encoding and decoding a text to be processed through a target keyword detection model provided by an embodiment of the present disclosure.

[0070] Figure 5 It is a schematic diagram of obtaining multiple target keywords through a target keyword detection model based on a Beam Search space search method provided by an embodiment of the present disclosure.

[0071] Figure 6 It is a flowchart of a method for training a target keyword detection model provided by an embodiment of the present disclosure.

[0072] Figure 7 It is a structural diagram of a device for acquiring keywords provided by an embodiment of the present disclosure.

[0073] Figure 8 It is a structural schematic diagram of another device for acquiring keywords provided by an embodiment of the present disclosure.

[0074] Fig. 9 It is a block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0075] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.

[0076] It should be noted that all actions of acquiring signals, information or data in the present disclosure are carried out in compliance with the relevant data protection laws and policies of the country where the device is located and with the authorization given by the owner of the corresponding device.

[0077] In the present disclosure, words such as "first" and "second" are only used for the purpose of distinguishing descriptions and should not be understood as indicating or implying relative importance or order; terms such as "S101", "S102", "S201", "S202" and the like are used to distinguish steps and should not be understood as performing method steps in a specific order or sequential sequence; when the following description refers to drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements.

[0078] First, the application scenario of the present disclosure is explained. The present disclosure can be applied to keyword mining scenarios, and the keywords obtained by mining can be applied to scenarios such as product search, title compression, copywriting generation, and advertising targeted bidding. In the related technology, the keywords of the product can be set manually, or the relevant keywords can be extracted using a general text processing model. However, the manual setting is based on human experience, and there are problems of low efficiency and accuracy; and the general text processing model (such as the pointer network model) can mine all relevant texts of the product, but because the products in the e-commerce scenario can have multiple dimensions of information, and the general text processing model cannot distinguish the multi-dimensional information, resulting in the extracted keywords also having the problem of low accuracy.

[0079] In order to solve the above problems, the present disclosure provides a method, device, storage medium and electronic device for obtaining keywords, which detects multiple target text information of the target object through a target keyword detection model, obtains the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; obtains the target attention vector corresponding to each target character through the attention vectors at two levels of character granularity and domain granularity, and then one or more target keywords of the product can be determined according to the target attention vector. In this way, the target attention vector includes both the characteristics of the character granularity of the target character and the characteristics of the domain granularity of the target dimension where the target character is located, thereby improving the efficiency and accuracy of obtaining keywords.

[0080] The specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0081] Figure 1 is a flowchart of a method for obtaining keywords provided by an embodiment of the present disclosure, such as Figure 1 As shown, the method may include:

[0082] S101: Acquire multiple target text information corresponding to the target object.

[0083] The target text information is used to represent text information of a target dimension of a target object. Different target text information corresponds to different target dimensions. Each target text information may include one or more target characters.

[0084] Taking the target object as a commodity object in a service e-commerce scenario as an example, the commodity object may correspond to multiple target dimensions, such as commodity name, commodity category, commodity map (such as recipes, raw material maps, etc.), merchant name, merchant address, etc. The text information of each target dimension of the commodity object may be obtained, and the text information may be used as the target text information of the target dimension.

[0085] S102: Input multiple target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object.

[0086] Among them, the target keyword detection model is used to obtain the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated based on the pending character vector and the pending domain vector; and based on the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters in the target text information; the above-mentioned pending domain vector can be used to characterize the feature information of the target object dimension corresponding to the target text information.

[0087] Figure 2 is a schematic diagram of a target keyword detection model provided by an embodiment of the present disclosure, such as Figure 2 As shown, the target keyword detection model may include a first encoder 201, a second encoder 202 and a target decoder 203, so that the first encoder 201 can perform character-granularity encoding processing on each target character in the target text information to obtain a pending character vector corresponding to each target character; the second encoder 202 can perform domain-granularity encoding processing on each target text information to obtain a pending domain vector corresponding to each target text information; then, the target decoder 203 can calculate the above-mentioned pending character vector and the pending domain vector to obtain a target attention vector corresponding to each target character; finally, one or more target keywords corresponding to the target object can be determined from multiple target characters in the target text information according to the target attention vector.

[0088] The above method is adopted to obtain multiple target text information corresponding to the target object; the multiple target text information is input into the target keyword detection model to obtain one or more target keywords corresponding to the target object. The target text information is used to characterize the text information of the target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters; the target keyword detection model is used to obtain the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated according to the pending character vector and the pending domain vector; and according to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters in the target text information; the above pending domain vector can be used to characterize the feature information of the target dimension corresponding to the target text information. In this way, the target attention vector of each target character can be comprehensively obtained through the pending character vector of the character granularity and the pending domain vector of the domain granularity, and the target attention vector includes both the characteristics of the character granularity of the target character and the characteristics of the domain granularity of the target dimension where the target character is located, thereby improving the efficiency and accuracy of obtaining keywords.

[0089] Figure 3 is based on Figure 1 The embodiment shown is a flowchart of step S102, as shown in FIG. Figure 3 As shown, the above step S102 may include:

[0090] S1021. Determine the text to be processed corresponding to the target object according to multiple target text information.

[0091] Taking the target object as a commodity object in a service e-commerce scenario as an example, the commodity object may correspond to multiple target dimensions, such as commodity name, commodity category, commodity map (such as recipes, raw material maps, etc.), merchant name, merchant address, etc. Each target text information may include text information of a target dimension of the commodity object.

[0092] In this step, the above-mentioned multiple target text information can be concatenated to obtain the text to be processed; or the multiple target text information can be processed by preset spacing characters to obtain the text to be processed corresponding to the target object.

[0093] For example, the text to be processed can be obtained by splicing multiple target text information using a preset spacing character, and the preset spacing character can be any pre-set special character, such as [SEP]. For example, the preset spacing character (such as [SEP]) is added after the last target character of each target text information, and then the target text information with the preset spacing character added is spliced ​​to obtain the text to be processed.

[0094] In addition, for the last target text information of the splicing, its preset spacing character can be replaced with a preset end character, or a preset end character can be filled after its preset spacing character to indicate that the target text information for the target object has ended. The preset end character can be a pre-set special character different from the preset spacing character, such as [EOS].

[0095] S1022. Input the text to be processed into the first encoder to obtain a pending character vector corresponding to each target character in the text to be processed.

[0096] In this step, you can Figure 2 The first encoder 201 in the target keyword detection model performs encoding processing on the target characters to obtain a pending character vector corresponding to each target character.

[0097] The first encoder may include a bidirectional recurrent neural network (Bidirectional RNN, Bi-RNN) or a bidirectional long short-term memory network (Bidirectional Long Short-Term Memory networks, Bi-LSTM), and a character sequence composed of target characters in the text to be processed may be used as a first input sequence of the first encoder, and the first input sequence may be represented as x=[x1, x2,…, x n ], where x represents the first input sequence, n represents the number of target characters in the text to be processed, x1 represents the first target character in the text to be processed, x2 represents the second target character in the text to be processed, and x n Indicates the nth target character in the text to be processed.

[0098] Using the first encoder Bi-LSTM network, for the t-th target character x t The encoding is taken as an example to illustrate as follows:

[0099] First, the target character is forward encoded to obtain a first forward encoding vector corresponding to the target character.

[0100] For example, the target character x of the current encoding can be t and the character x before the target character t-1 The first forward encoding vector of Calculate the first forward encoding vector of the target character For example, the first forward encoding vector can be calculated by the following formula (11):

[0101]

[0102] Among them, x t Indicates the target character, Indicates the target character x t The corresponding first forward encoding vector (also called the first forward hidden state), The first forward encoding vector (also referred to as the first forward hidden state) representing the previous character of the target character.

[0103] Secondly, the target character is reversely encoded to obtain a first reverse encoding vector corresponding to the target character.

[0104] For example, the target character x of the current encoding can be t and the character x after the target character t+1 The first reverse encoding vector Calculate the first reverse encoding vector of the target character For example, the first reverse encoding vector can be calculated by the following formula (12):

[0105]

[0106] Among them, x t Indicates the target character, Indicates the target character x t The corresponding first reverse encoding vector (also called the first reverse hidden state), The first reverse encoding vector (also referred to as the first reverse hidden state) representing the next character of the target character.

[0107] Finally, the first forward encoding vector and the first reverse encoding vector corresponding to the target character may be used to calculate the pending character vector corresponding to the target character.

[0108] For example, the first forward encoding vector and the first reverse encoding vector may be concatenated to obtain the undetermined character vector by the following formula (13):

[0109]

[0110] in, Indicates the target character x t The corresponding undetermined character vector, Indicates the target character x t The corresponding first forward encoding vector, Indicates the target character x t The corresponding first reverse encoding vector.

[0111] In this way, the undetermined character vector corresponding to the target character can be obtained through the first encoder.

[0112] It should be noted that, in the above step S1021, when multiple target text information is processed by preset spacing characters (such as [SEP]) to obtain the to-be-processed text corresponding to the target object, in this step, the spacing character vector corresponding to the preset spacing character can be obtained by the above method. Similarly, if there is a preset end character in the to-be-processed text, the end character vector corresponding to the preset end character can also be obtained.

[0113] S1023. Obtain a to-be-determined domain vector corresponding to each target text information in the to-be-processed text according to the to-be-determined character vector and the second encoder.

[0114] In this step, you can Figure 2 The second encoder 202 in the target keyword detection model processes the pending character vector to obtain the pending character vector corresponding to each target character.

[0115] For example, the undetermined character vector of the last target character corresponding to each target text information may be input into the second encoding to obtain the undetermined domain vector corresponding to each target text information in the text to be processed.

[0116] For another example, in the above-mentioned step S1021, when multiple target text information are processed by preset spacing characters (for example, [SEP]) to obtain the text to be processed corresponding to the target object, the spacing character vector corresponding to the preset spacing character can be input into the second encoder to obtain the undetermined domain vector corresponding to each of the target text information in the text to be processed.

[0117] Similarly, the second encoder may also include a Bi-RNN or a Bi-LSTM. The above interval character vector may be used as the second input sequence of the second encoder. For example, the second input sequence may be represented as Wherein, h represents the second input sequence, m represents the number of target text information in the text to be processed, represents the spacing character vector of the preset spacing character corresponding to the first target text information in the to-be-processed text, k1 represents the sorting position of the preset spacing character corresponding to the first target text information in the first input sequence (that is, the sorting position in the to-be-processed text), represents the spacing character vector of the preset spacing character corresponding to the second target text information in the text to be processed, k2 represents the sorting position of the preset spacing character corresponding to the second target text information in the first input sequence, represents the interval character vector of the preset interval character corresponding to the mth (last) target text information in the text to be processed, k mIndicates the sorting position of the preset spacing character corresponding to the mth (last) target text information in the first input sequence.

[0118] Similarly, the second encoder Bi-LSTM network is used to encode the t-th target text information as an example, as follows:

[0119] First, the target text information is forward encoded to obtain a second forward encoding vector corresponding to the target text information.

[0120] For example, the second forward encoding vector corresponding to the target text information can be calculated by the following formula (21):

[0121]

[0122] in, The spacer character vector representing the preset spacer character corresponding to the target text information currently encoded, represents the second forward encoding vector (also called the second forward hidden state) corresponding to the target text information, A second forward encoding vector (also referred to as a second forward hidden state) representing the previous target text information of the target text information.

[0123] Secondly, the target text information is reversely encoded to obtain a reverse encoding vector corresponding to the target text information.

[0124] For example, the forward encoding vector can be calculated by the following formula (22):

[0125]

[0126] in, The spacer character vector representing the preset spacer character corresponding to the target text information currently encoded, represents the second backward encoding vector (also called the second backward hidden state) corresponding to the target text information, A second backward encoding vector (also referred to as a second backward hidden state) representing the next target text information after the target text information.

[0127] Finally, the second forward encoding vector and the second reverse encoding vector corresponding to the target text information may be calculated to obtain the undetermined domain vector corresponding to the target text information.

[0128] For example, the second forward encoding vector and the second reverse encoding vector may be concatenated to obtain the undetermined domain vector by the following formula (23):

[0129]

[0130] in, Represents the undetermined domain vector corresponding to the target text information, Represents the second forward encoding vector corresponding to the target text information, Indicates the second reverse encoding vector corresponding to the target text information.

[0131] In this way, the undetermined domain vector corresponding to the target text information can be obtained through the second encoder.

[0132] S1024. Obtain a target attention vector corresponding to each target character according to the pending character vector and the pending domain vector.

[0133] In this step, you can Figure 2 The target decoder 203 in the target keyword detection model shown processes the pending character vector and the pending domain vector to obtain a target attention vector corresponding to each target character.

[0134] For example, the character vector to be determined can be input into the target decoder to obtain the first attention vector corresponding to each target character; the domain vector to be determined can be input into the target decoder to obtain the second attention vector corresponding to each target text information; finally, based on the first attention vector and the second attention vector, the target attention vector corresponding to each target character is calculated.

[0135] The target decoder may be a unidirectional LSTM, and the preset decoding vectors (also referred to as preset hidden states) of the target decoder are [d1, d2, …, d t ,…], and the preset decoding vector is crossed with the above-mentioned undetermined character vector and undetermined domain vector to obtain the first attention vector and the second attention vector respectively. Among them:

[0136] The first attention vector can be calculated by the following formula (31) and formula (32):

[0137]

[0138]

[0139] in, Represents the i-th target character x in the text to be processed i The corresponding undetermined character vector, n represents the number of target characters in the text to be processed, i is less than or equal to n, d t represents the preset decoding vector corresponding to the t-th target character, v w , represents a first preset activation parameter group, which can be obtained after training according to a preset sample, Indicates that According to the hyperbolic tangent function, (v w ) T Indicates that v w Transpose the vector rows and columns, represents the first intermediate vector, represents the first attention vector of the i-th target character, represents the Euler number e as the base Power.

[0140] The second attention vector can be calculated by the following formula (33) and formula (34):

[0141]

[0142]

[0143] Among them, among them, represents the undetermined domain vector corresponding to the i-th target text information in the text to be processed, m represents the number of target text information in the text to be processed, d t represents the preset decoding vector corresponding to the t-th target character, v f , represents a second preset activation parameter group, which can also be obtained after training according to a preset sample. Indicates that According to the hyperbolic tangent function, (v f ) T Indicates that v f Transpose the vector rows and columns, represents the second intermediate vector, The second attention vector representing the target text information, represents the Euler number e as the base Power.

[0144] Finally, the target attention vector corresponding to the i-th target character can be calculated by the following formulas (35) and (36):

[0145] Finally, based on the first attention vector and the second attention vector, the target attention vector corresponding to each target character is calculated.

[0146]

[0147] d t =LSTM([d t-1 ; d′ i-1 ],y t-1 ) (36)

[0148] Among them, f i represents the sorting position of the target text information to which the i-th target character belongs in the text to be processed, n represents the number of target characters in the text to be processed, i is less than or equal to n, Represents the first attention vector of the target character, The second attention vector representing the target text information to which the target character belongs, Indicates the undetermined character vector corresponding to the i-th target character, d′ t represents the intermediate attention vector, y t-1 represents the target attention vector of the previous character of the target character, d t Represents the target attention vector.

[0149] In this way, through the above method, both the information of character granularity and the information of domain granularity are taken into account; since the multi-dimensional information of the target object (such as goods) will contain noise, by combining the attention of character granularity and domain granularity, the target keyword detection model can learn to distinguish whether the domain information contains noise, and mine keywords from the domain information to combine them into keywords to achieve the purpose of denoising, thereby improving the accuracy of keyword acquisition.

[0150] S1025. Determine one or more target keywords corresponding to the target object from multiple target characters according to the target attention vector.

[0151] For example, the target decoder can perform relevant operations according to the time step of LSTM, and can select the target character with the largest target attention vector value at each time step, and then determine the target keyword based on multiple target characters selected at multiple time steps.

[0152] Furthermore, in order to mine cross-linked keywords, the Beam Search space search method can also be used. At each time step, the target decoder can obtain the top K candidate output sequences with the highest current prediction probability based on the target attention vector, obtain the pending keywords based on the top K candidate output sequences at the last time step, and then use the pending keywords with a prediction probability greater than or equal to a preset probability threshold as the target keywords. In this way, cross-mining can be used to obtain one or more keywords corresponding to the target object.

[0153] The following combination Figure 4 and Figure 5 The method of obtaining the target keyword by the target keyword detection model is described as follows:

[0154] Figure 4 is a schematic diagram of encoding and decoding a text to be processed by using a target keyword detection model provided by an embodiment of the present disclosure, such as Figure 4As shown, the target keyword detection model may include a first encoder 201, a second encoder 202 and a target decoder 203. The text to be processed includes "[SEP] Noodle soup / noodles [SEP] Beef pork intestines noodle soup [SEP]", wherein [SEP] represents a preset spacing character, "noodle soup / noodles" is a target text information, and "beef pork intestines noodle soup" is another target text information. By encoding each character of the text to be processed by the first encoder 201, a pending character vector corresponding to each character can be obtained. By using the second encoder 202 and the pending character vector, a pending domain vector corresponding to each target text information can be obtained. Then, according to the pending character vector and the pending domain vector, a target attention vector can be obtained through the target decoder 203. The target character with the largest target attention vector value is selected through each step of the target decoder, and then the target keyword is determined according to the multiple target characters selected at multiple time steps.

[0155] Figure 5 FIG. 1 is a schematic diagram of obtaining multiple target keywords through a target keyword detection model based on a Beam Search space search method according to an embodiment of the present disclosure, such as Figure 5 As shown, for the input character to be processed "beef and pork intestine soup noodle", through the target decoder of the target keyword detection model, at time step 1, the top K candidate output sequences with the highest current prediction probability are obtained according to the target attention vector, including "cow" and "fat", at time step 2, the top K candidate output sequences with the highest current prediction probability are obtained according to the target attention vector, including "beef" and "pork intestine", and at time step 3, the top K candidate output sequences with the highest current prediction probability are obtained according to the target attention vector, including "beef noodles" and "pork intestine noodles". In this way, these two candidate output sequences can be used as pending keywords. When the prediction probabilities of these two pending keywords are greater than or equal to the preset probability threshold, the two target keywords "beef noodles" and "pork intestine noodles" can be obtained.

[0156] Figure 6 FIG. 1 is a flow chart of a method for training a target keyword detection model provided by an embodiment of the present disclosure. Figure 6 As shown, the method may include:

[0157] S601: Obtain one or more sample objects.

[0158] The sample object may include sample commodities, for example, one or more sample commodities are obtained from a commodity database.

[0159] S602: Obtain a first object category corresponding to the sample object and one or more target sample text information.

[0160] The first object category may be a pre-set category. For example, when the sample object is a sample commodity, the first object category may be the commodity category of the sample commodity. For example, the first object category corresponding to "beef pork intestines noodle soup" may be the pre-set "noodle" or "noodle soup".

[0161] Each sample object may have preset sample text information of multiple target dimensions, and the preset sample text information corresponding to the sample object may be used as the target sample text information. For example, for each sample product, text information of multiple target dimensions of the sample product may be obtained, and the preset text information of each target dimension may be used as a target sample text information. The target dimensions may include dimensions such as product name, product category, product map (such as recipes, raw material map, etc.), merchant name, merchant address, etc.

[0162] It should also be noted that the first object category corresponding to the sample object can also be used as a target sample text information, that is, the above-mentioned target dimension includes the first object category dimension. For example, the multiple target dimensions of the sample product include product categories.

[0163] In this step, the target sample text information can also be obtained in the following ways:

[0164] First, the first sample text information of the sample object is obtained.

[0165] The first sample text information may include the above-mentioned preset sample text information.

[0166] Secondly, the first text word in the first sample text information is replaced according to the preset knowledge graph to obtain one or more second sample text information;

[0167] For example, the preset knowledge graph may include the corresponding relationship between synonyms and near-synonyms of multiple text words. According to the preset knowledge graph, the first text word can be replaced with a second text word with a synonym or near-synonym, and then the replaced first sample text information is used as the second sample text information.

[0168] It should be noted that the preset knowledge graph may be a text knowledge graph pre-generated based on a dictionary, common expressions, etc.

[0169] Finally, the first sample text information and the second sample text information are used as target sample text information.

[0170] In this way, the preset first sample text information can be expanded to obtain more diverse target sample text information, so as to train a more accurate target keyword detection model based on the target sample text information.

[0171] S603: Obtain one or more pending keywords corresponding to the sample object and a second object category corresponding to each pending keyword.

[0172] In this step, the pending keyword can be obtained by one or more of the following methods 1 and 2:

[0173] Method 1: Input the target sample text information corresponding to the sample object into a preset text extraction model to obtain one or more pending keywords corresponding to the sample object.

[0174] It should be noted that the preset text extraction model may be a general text keyword extraction model, and the present disclosure does not impose any limitation on this.

[0175] Method 2: Determine one or more pending keywords corresponding to the sample object based on the user's query and browsing data on the sample object.

[0176] In this method, the pending query words in the user's query behavior on the sample object can be obtained. When the user clicks or browses the sample object according to the query result of the pending query word, the pending query word can be used as the pending keyword. In this way, one or more pending keywords corresponding to the sample object can be inferred from the user's query and browsing behavior on the sample object.

[0177] After the above-mentioned pending keyword is obtained by any one or more of the above-mentioned methods, the second object category corresponding to the pending keyword can be determined according to the user's query and browsing data on the pending keyword.

[0178] For example, one or more query target objects clicked or browsed by the user after searching based on the pending keyword can be obtained, each query target object corresponds to one or more preset object categories, and the preset object categories corresponding to the one or more query target objects are used as the second object category.

[0179] S604: Determine one or more sample keywords from the keywords to be determined according to the first object category and the second object category.

[0180] In this step, the target similarity between the second object category and the first object category may be first obtained; then, based on the target similarity, one or more sample keywords may be determined from the keywords to be determined.

[0181] For example, the second object category and the first object category may be input into a pre-trained text similarity recognition model to obtain the target similarity between the two.

[0182] Then, according to the target similarity, there are many ways to determine the sample keywords from the pending keywords, such as:

[0183] The undetermined keywords corresponding to the second object category whose target similarity is greater than or equal to a preset similarity threshold may be used as sample keywords;

[0184] Alternatively, the undetermined keywords corresponding to the second object category whose target similarity ranking is greater than or equal to the preset ranking are used as sample keywords;

[0185] Alternatively, the undetermined keywords corresponding to the second object category whose target similarity ranking is greater than or equal to the preset ranking and whose target similarity is greater than or equal to the preset similarity threshold are taken as sample keywords.

[0186] S605. Train a preset attention model according to the target sample text information and sample keywords corresponding to the sample object to obtain a target keyword detection model.

[0187] Among them, the preset attention model can be the same as the above Figure 2 A model with the same structure as the target keyword detection model shown may also include a Bi-LSTM or a Bi-RNN, the parameters of which may be trained according to the target sample text information and sample keywords corresponding to the sample object. The specific model training method may refer to the training of the neural network model in the related art, and the present disclosure will not elaborate on this.

[0188] In this way, through the above method, the target sample text information and sample keywords corresponding to the sample objects used for training can be expanded, and the accuracy of the sample keywords can be verified in combination with user query behavior, which can improve the accuracy of keyword recognition of the trained target keyword detection model.

[0189] Figure 7 is a schematic diagram of a structure of a device for obtaining keywords provided by an embodiment of the present disclosure, such as Figure 7 As shown, the device comprises:

[0190] The text information acquisition module 701 is used to acquire a plurality of target text information corresponding to the target object; the target text information is used to represent the text information of the target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters;

[0191] The keyword acquisition module 702 is used to input multiple target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object; wherein the target keyword detection model is used to obtain a pending character vector corresponding to each target character in the target text information, and a pending domain vector corresponding to each target text information; a target attention vector corresponding to each target character in the target text information is calculated based on the pending character vector and the pending domain vector; and based on the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters in the target text information; the pending domain vector is used to characterize feature information of the target dimension corresponding to the target text information.

[0192] Optionally, the target keyword detection model includes a first encoder and a second encoder; the keyword acquisition module 702 is used to:

[0193] Determine the to-be-processed text corresponding to the target object according to the plurality of target text information;

[0194] Inputting the text to be processed into the first encoder to obtain a pending character vector corresponding to each target character in the text to be processed;

[0195] According to the undetermined character vector and the second encoder, obtaining the undetermined domain vector corresponding to each target text information in the unprocessed text;

[0196] According to the pending character vector and the pending domain vector, a target attention vector corresponding to each target character is obtained;

[0197] According to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters.

[0198] Optionally, the keyword acquisition module 702 is used to process multiple target text information through multiple preset spacing characters to obtain the text to be processed corresponding to the target object; the spacing character vector corresponding to the preset spacing character is input into the second encoder to obtain the to-be-determined domain vector corresponding to each target text information in the text to be processed.

[0199] Optionally, the target keyword detection model further includes a target decoder; the keyword acquisition module 702 is used to:

[0200] Input the pending character vector into the target decoder to obtain a first attention vector corresponding to each target character;

[0201] Input the undetermined domain vector into the target decoder to obtain a second attention vector corresponding to each target text information;

[0202] According to the first attention vector and the second attention vector, the target attention vector corresponding to each target character is calculated.

[0203] Figure 8 is a schematic diagram of the structure of another device for acquiring keywords provided by an embodiment of the present disclosure, such as Figure 8 As shown, the device also includes a model training module 703, and the model training module 703 is used to:

[0204] Get one or more sample objects;

[0205] Acquire a first object category and one or more target sample text information corresponding to the sample object;

[0206] Obtain one or more pending keywords corresponding to the sample object and a second object category corresponding to each pending keyword;

[0207] Determine one or more sample keywords from the pending keywords according to the first object category corresponding to the sample object and the second object category corresponding to the pending keyword;

[0208] According to the target sample text information and the sample keyword corresponding to the sample object, the preset attention model is trained to obtain the target keyword detection model.

[0209] Optionally, the model training module 703 is used to: obtain first sample text information of the sample object; replace the first text word in the first sample text information according to a preset knowledge graph to obtain one or more second sample text information; and use the first sample text information and the second sample text information as the target sample text information.

[0210] Optionally, the model training module 703 is used to: input the target sample text information corresponding to the sample object into a preset text extraction model to obtain one or more pending keywords corresponding to the sample object; or, determine one or more pending keywords corresponding to the sample object based on the user's query and browsing data on the sample object.

[0211] Optionally, the model training module 703 is used to: obtain a target similarity between the second object category and the first object category; and determine one or more sample keywords from the pending keywords according to the target similarity.

[0212] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0213] Fig. 9is a block diagram of an electronic device 900 according to an exemplary embodiment. For example, the electronic device 900 may be provided as a computer device or a server. Fig. 9 The electronic device 900 may include a processor 922, which may be one or more, and a memory 932 for storing a computer program executable by the processor 922. The computer program stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 922 may be configured to execute the computer program to perform the above-mentioned method for obtaining keywords.

[0214] In addition, the electronic device 900 may further include a power supply component 926 and a communication component 950, wherein the power supply component 926 may be configured to perform power management of the electronic device 900, and the communication component 950 may be configured to implement communication of the electronic device 900, for example, wired or wireless communication. In addition, the electronic device 900 may further include an input / output (I / O) interface 958. The electronic device 900 may operate based on an operating system stored in the memory 932, such as Windows Server, Mac OS, Unix, Linux, Android, etc.

[0215] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned method for obtaining keywords are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 932 including program instructions, and the above-mentioned program instructions can be executed by the processor 922 of the electronic device 900 to complete the above-mentioned method for obtaining keywords.

[0216] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device. The computer program has a code portion for executing the above-mentioned method for obtaining keywords when executed by the programmable device.

[0217] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0218] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.

[0219] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A method for obtaining keywords, characterized in that: The method comprises: Acquire multiple target text information corresponding to the target object; the target text information is used to represent the text information of the target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters; Inputting the target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object; Among them, the target keyword detection model is used to obtain the pending character vector corresponding to each target character in the target text information, and the pending domain vector corresponding to each target text information; the target attention vector corresponding to each target character in the target text information is calculated according to the pending character vector and the pending domain vector; and according to the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters of the target text information; the pending domain vector is used to characterize the feature information of the target dimension corresponding to the target text information.

2. The method according to claim 1, characterized in that The target keyword detection model has a first encoder and a second encoder; the inputting a plurality of the target text information into the target keyword detection model to obtain one or more target keywords corresponding to the target object comprises: Determine the to-be-processed text corresponding to the target object according to the plurality of target text information; Inputting the text to be processed into the first encoder to obtain a pending character vector corresponding to each target character in the text to be processed; According to the undetermined character vector and the second encoder, obtaining the undetermined domain vector corresponding to each of the target text information in the unprocessed text; According to the to-be-determined character vector and the to-be-determined domain vector, obtaining a target attention vector corresponding to each of the target characters; According to the target attention vector, one or more target keywords corresponding to the target object are determined from the multiple target characters.

3. The method according to claim 2, characterized in that Determining the to-be-processed text corresponding to the target object according to the plurality of target text information comprises: Processing the plurality of target text information by using a plurality of preset spacing characters to obtain the to-be-processed text corresponding to the target object; The step of obtaining the to-be-determined domain vector corresponding to each of the target text information in the to-be-processed text according to the to-be-determined character vector and the second encoder comprises: The spacing character vector corresponding to the preset spacing character is input into the second encoder to obtain the undetermined domain vector corresponding to each target text information in the text to be processed.

4. The method according to claim 2, characterized in that: The target keyword detection model also includes a target decoder; and obtaining a target attention vector corresponding to each target character according to the pending character vector and the pending domain vector includes: Inputting the pending character vector into the target decoder to obtain a first attention vector corresponding to each target character; Inputting the undetermined domain vector into the target decoder to obtain a second attention vector corresponding to each target text information; The target attention vector corresponding to each target character is calculated based on the first attention vector and the second attention vector.

5. The method according to any one of claims 1 to 4, characterized in that The target keyword detection model is trained in the following way: Get one or more sample objects; Acquire a first object category and one or more target sample text information corresponding to the sample object; Obtaining one or more pending keywords corresponding to the sample object and a second object category corresponding to each pending keyword; Determine one or more sample keywords from the pending keywords according to the first object category corresponding to the sample object and the second object category corresponding to the pending keyword; According to the target sample text information and the sample keywords corresponding to the sample object, the preset attention model is trained to obtain the target keyword detection model.

6. The method according to claim 5, characterized in that Acquiring one or more target sample text information corresponding to the sample object includes: Acquire first sample text information of the sample object; Replacing the first text word in the first sample text information according to a preset knowledge graph to obtain one or more second sample text information; The first sample text information and the second sample text information are used as the target sample text information.

7. The method according to claim 5, characterized in that Acquiring one or more pending keywords corresponding to the sample object includes: Input the target sample text information corresponding to the sample object into a preset text extraction model to obtain one or more undetermined keywords corresponding to the sample object; or One or more undetermined keywords corresponding to the sample object are determined according to the user's query and browsing data on the sample object.

8. The method according to claim 5, characterized in that Determining one or more sample keywords from the to-be-determined keywords according to the first object category corresponding to the sample object and the second object category corresponding to the to-be-determined keywords includes: Obtaining target similarity between the second object category and the first object category; According to the target similarity, one or more sample keywords are determined from the pending keywords.

9. A device for obtaining keywords, characterized in that: The device comprises: A text information acquisition module, used to acquire a plurality of target text information corresponding to a target object; the target text information is used to represent text information of a target dimension of the target object, different target text information corresponds to different target dimensions, and each target text information includes one or more target characters; A keyword acquisition module is used to input multiple target text information into a target keyword detection model to obtain one or more target keywords corresponding to the target object; wherein the target keyword detection model is used to obtain a pending character vector corresponding to each target character in the target text information, and a pending domain vector corresponding to each target text information; a target attention vector corresponding to each target character in the target text information is calculated based on the pending character vector and the pending domain vector; and based on the target attention vector, one or more target keywords corresponding to the target object are determined from multiple target characters in the target text information; the pending domain vector is used to characterize feature information of a target dimension corresponding to the target text information.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

11. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 8.