Keyword determination method, device, storage medium and computing device
By identifying entity words and entity types in the search text, calculating comprehensive intent scores in combination with the entity lexicon, and determining keywords, the problem of coarse-grained search intent in the existing technology is solved, and the accuracy of search results and user experience are improved.
Patent Information
- Application Number
- CN202110801839.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-15
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2041-07-15
AI Technical Summary
Existing intent recognition technology can only predict a coarse-grained single search intent, resulting in search results that do not meet user expectations and reducing user experience.
By identifying the entity words and entity types in the search text information, combined with the pre-established entity vocabulary to calculate the comprehensive intent score, fine-grained keywords are determined to identify the user's search intent.
It achieves fine-grained multi-search intent recognition, improves the accuracy of search results and user experience, and makes search results more in line with users' expected needs.
Smart Images

Figure CN113553851B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of computer technology, and more specifically, embodiments of the present invention relate to a method, apparatus, storage medium, and computing device for determining a keyword. Background Art
[0002] This section is intended to provide a background or context to embodiments of the invention that are recited in the claims. No description herein is admitted to be prior art by inclusion in this section.
[0003] In the technology related to resource search, the server providing the search service can match the corresponding resources according to the search text input by the user, and return the matched resources to the user.
[0004] Currently, resource matching usually requires the use of intent recognition technology, which predicts the user's search intent by analyzing the search text, and then matches resources based on the user's search intent, so that the matched resources are more in line with the user's actual needs. Summary of the invention
[0005] However, due to existing intent recognition technology, it can only predict coarse-grained single search intent, resulting in search results that do not meet user expectations and reduce user experience.
[0006] Therefore, an improved solution is needed to determine the keywords of the search intent from the search text information so as to identify the user's search intent in a fine-grained manner.
[0007] In a first aspect of the embodiments of the present invention, a method for determining a keyword is provided, comprising:
[0008] Identify entity words in the search text information and entity types corresponding to the entity words; wherein the entity words include words in the search text information that reflect the search intent;
[0009] Searching for the intent score of the entity word under each entity type from a pre-established entity word library, and calculating the comprehensive intent score of the entity word based on each intent score;
[0010] Based on the entity type and the comprehensive intent score corresponding to the entity word, keywords for search are determined from the entity word.
[0011] Optionally, the identifying entity words in the search text information and entity types corresponding to the entity words includes:
[0012] Input the received search text information into the named entity recognition model for calculation;
[0013] The entity words output after the named entity recognition model is calculated and the entity types corresponding to the entity words are obtained.
[0014] Optionally, the named entity recognition model consists of an embedding model and a bidirectional long short-term memory model;
[0015] The step of inputting the received search text information into a named entity recognition model for calculation includes:
[0016] For each word in the received search text information, do the following processing:
[0017] Input the current word into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions;
[0018] The embedding features calculated under the different dimensions are concatenated and used as the hidden layer input of the bidirectional long short-term memory model, and the search text information is used as the input layer input of the bidirectional long short-term memory model to obtain the entity words output by the output layer of the bidirectional long short-term memory model and the entity types corresponding to the entity words.
[0019] Optionally, the different dimensions include single words, entity types, entity length ratios, and intent scores;
[0020] The current word is input into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions, including:
[0021] Input the current word into the word embedding layer in the embedding model, and calculate the word embedding features of the current word;
[0022] Input the current word into the entity type embedding layer in the embedding model, and calculate the entity type embedding feature of the current word;
[0023] Input the current word into the entity length ratio embedding layer in the embedding model, and calculate the entity length ratio embedding feature of the current word;
[0024] The current word is input into the intention sub-embedding layer in the embedding model, and the intention sub-embedding feature of the current word is calculated.
[0025] Optionally, inputting the current word into an entity type embedding layer in an embedding model and calculating the entity type embedding feature of the current word includes:
[0026] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0027] Obtaining the entity type corresponding to the target word in the entity vocabulary, and obtaining a preset feature value corresponding to the entity type;
[0028] The feature value is input into the entity type embedding layer in the embedding model, and the feature value is mapped to the entity type embedding feature.
[0029] Optionally, inputting the current word into an entity length ratio embedding layer in an embedding model, and calculating an entity length ratio embedding feature of the current word, includes:
[0030] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0031] Calculating the ratio of the length of the target word to the length of the search text information, and obtaining the interval segment number of the ratio mapped in the preset first numerical interval;
[0032] The interval segment number is input into the entity length ratio embedding layer in the embedding model, and the interval segment number is mapped to the entity length ratio embedding feature.
[0033] Optionally, the step of inputting the current word into an intention sub-embedding layer in an embedding model and calculating the intention sub-embedding features of the current word includes:
[0034] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0035] Obtaining the intent score corresponding to the target word in the entity word library, calculating the logarithm of the intent score, and obtaining the interval segment number of the value of the logarithm mapped to the preset second numerical interval;
[0036] The interval segment sequence number is input into the intention sub-embedding layer in the embedding model, and the interval segment sequence number is mapped to the intention sub-embedding feature.
[0037] Optionally, performing prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word includes:
[0038] Searching the entity word library for entity words containing the current word;
[0039] The entity words found in the search are matched with the search text information, and the entity words in the search text information are determined as target words.
[0040] Optionally, the named entity recognition model also includes a conditional random field model constraining the bidirectional long short-term memory model;
[0041] The conditional random field model is used to label each word in the input sequence of the bidirectional long short-term memory model;
[0042] The label marking includes: B to indicate the beginning of an entity, I to indicate the middle part of an entity, E to indicate the end part of an entity, and O to indicate an unrestricted entity type.
[0043] Optionally, the entity word library is established in the following manner:
[0044] Get updated entity resources; each entity resource includes resource identifier, resource name, resource type, and intent score;
[0045] Convert the resource name into a standardized format to obtain a normalized entity word;
[0046] Associate the normalized entity words with the resource identifier, resource type, and intent score of the corresponding entity resources;
[0047] When a normalized entity word is associated with multiple intent scores, the sum of the multiple intent scores is used as the intent score of the entity word.
[0048] Optionally, the entity resource further includes a popularity score; and before converting the resource name into a standardized format to obtain a normalized entity name, the method further includes:
[0049] Filter out entity resources whose heat score is less than the preset heat.
[0050] Optionally, calculating the comprehensive intent score of the entity word based on the individual intent scores includes:
[0051] Calculate the sum of the intent scores of the entity word under each entity type to obtain the entity intent score;
[0052] Based on the intent score under each entity type and the entity intent score, a normalized intent score of each entity type is obtained;
[0053] The normalized intent score with the largest score is determined as the comprehensive intent score of the entity word.
[0054] Optionally, the method further includes:
[0055] Determine the word weight of the entity word based on a pre-established tf-idf feature library;
[0056] Based on the comprehensive intention scores and word weights of the entity words, the entity words that must be retained are screened out from the entity words;
[0057] The determining of keywords for search from the entity words based on the entity type and the comprehensive intent score corresponding to the entity words includes:
[0058] Based on the entity type, comprehensive intent score and word weight corresponding to the required entity words, keywords for search are determined from the required entity words.
[0059] Optionally, determining the word weight of the entity word based on a pre-established tf-idf feature library includes:
[0060] Based on a pre-established tf-idf feature library, obtaining the tf-idf features corresponding to the entity words;
[0061] Based on the tf-idf feature corresponding to the entity word, the word weight of the entity word is determined.
[0062] Optionally, determining the word weight of the entity word based on the tf-idf feature corresponding to the entity word includes:
[0063] Use the tf-idf feature as the initial word weight of the entity word;
[0064] For each entity word, based on the word type of the entity word, the intermediate word weight of the entity word is calculated on the basis of the initial word weight;
[0065] Calculate the sum of the intermediate word weights of each entity word;
[0066] Based on the intermediate word weight of each entity word and the sum of the intermediate word weights, a normalized word weight of each entity word is obtained.
[0067] Optionally, the word type based on the entity word, calculating the intermediate word weight of the entity word on the basis of the initial word weight, includes:
[0068] If the entity word is a non-single-word entity, the initial word weight is increased to obtain the word weight of the non-single-word entity;
[0069] If the entity word is a qualifier entity, the initial word weight is reduced to obtain the word weight of the qualifier entity;
[0070] If the entity word is a single-word entity, the initial word weight is determined as the word weight of the single-word entity.
[0071] Optionally, the step of selecting entity words that must be retained from the entity words based on the comprehensive intent score and word weight of the entity words includes:
[0072] When the entity word is a qualifier entity and the word weight is greater than the first threshold, the entity word is determined to be a must-retain word;
[0073] When the entity word is a non-single entity and a non-qualifier entity, and the comprehensive intention score is greater than the second threshold and the word weight is greater than the third threshold, the entity word is determined to be a must-retain word;
[0074] When the entity word is a single-entity non-restricted entity word, it is determined that the entity word must be retained.
[0075] Optionally, the tf-idf feature library is established in the following way:
[0076] Perform word segmentation on the historical search text information, and count the total number of word segments, the number of occurrences of each word segment, and the number of historical search text information containing the word segment;
[0077] Calculate the ratio of the number of occurrences of each participle to the total number of participles to obtain the word frequency of each participle;
[0078] Calculate the logarithm of the number of historical search text information containing the word segmentation based on the total number of historical search text information to obtain the inverse document frequency of each word segmentation;
[0079] Calculate the product of the word frequency of each word and the inverse document frequency to obtain the tf-idf feature of each word.
[0080] Optionally, determining keywords for search from the required entity words based on the entity type, comprehensive intent score, and word weight corresponding to the required entity words includes:
[0081] Classifying the entity words that must be retained based on the entity type;
[0082] Under the same entity type, the entity word with the largest word weight and a comprehensive intent score greater than a threshold is determined as the keyword for search.
[0083] Optionally, also include:
[0084] Search for resources based on the determined keywords and obtain the searched resources;
[0085] Sort the resources based on their relevance to keywords
[0086] In a second aspect of the embodiments of the present invention, a computer-readable storage medium is provided, comprising:
[0087] When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the keyword determination method as described in any of the preceding items.
[0088] In a third aspect of the embodiments of the present invention, a device for determining a keyword is provided, comprising:
[0089] An identification unit, which identifies entity words in the search text information and entity types corresponding to the entity words; wherein the entity words include words in the search text information that reflect the search intent;
[0090] A calculation unit, which searches for the intent score of the entity word under each entity type from a pre-established entity word library, and calculates the comprehensive intent score of the entity word based on each intent score;
[0091] A determination unit determines keywords for search from the entity words based on the entity type and the comprehensive intent score corresponding to the entity words.
[0092] In a fourth aspect of the embodiments of the present invention, there is provided a computing device, comprising:
[0093] processor;
[0094] a memory for storing instructions executable by the processor;
[0095] The processor is configured to execute the executable instructions to implement the keyword determination method as described in any of the preceding items.
[0096] According to the fine-grained multi-search intent recognition scheme provided by the embodiment of the present invention, by identifying the entity words and entity types in the search text information, each entity word is scored in combination with a pre-established entity word library to obtain a comprehensive intent score for each entity word; finally, based on the entity type and comprehensive intent score of each entity word, at least one keyword that meets the actual needs of the user is determined. Since the final keywords are determined based on the idea of fine-grained multi-search intent, each keyword can correspond to a fine-grained search intent, which can meet the search needs of users with different search intents. This makes the search results more accurate and more in line with user expectations. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] The above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, in which:
[0098] Figure 1 The schematic diagram of searching for music resources provided by the present invention is schematically shown;
[0099] Figure 2 The following is a schematic diagram of a method for determining keywords provided by the present invention;
[0100] Figure 3 The schematic diagram of searching for music resources provided by the present invention is schematically shown;
[0101] Figure 4 The schematic diagram of the medium provided by the present invention is schematically shown;
[0102] Figure 5 The following schematically shows a schematic diagram of a device for determining keywords provided by the present invention;
[0103] Figure 6 The schematic diagram of the computing device provided by the present invention is schematically shown.
[0104] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION
[0105] The principles and spirit of the present invention will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present invention, and are not intended to limit the scope of the present invention in any way. On the contrary, these embodiments are provided to make the present invention more thorough and complete, and to fully convey the scope of the present invention to those skilled in the art.
[0106] Those skilled in the art know that the embodiments of the present invention can be implemented as a system, device, apparatus, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0107] According to an embodiment of the present invention, a method for determining a keyword, a computer-readable storage medium, an apparatus, and a computing device are proposed.
[0108] It should be understood herein that any number of elements in the drawings is for illustration rather than limitation, and any naming is only for distinction rather than having any limiting meaning.
[0109] The principle and spirit of the present invention are explained in detail below with reference to several representative embodiments of the present invention. SUMMARY OF THE INVENTION
[0111] The inventors have discovered that due to existing intent recognition technology, it can only predict a coarse-grained single search intent, resulting in search results that do not meet user expectations and reducing user experience.
[0112] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
[0113] Application Scenario Overview
[0114] First reference Figure 1 A schematic diagram of a music resource search is shown in FIG. In the application search scenario, for the search text information entered by the user (i.e., the query "Deng XX's singing bubbles" in the figure); after searching, Figure 1 The user can click on any search result to play the corresponding song.
[0115] It should be noted that the above-mentioned music resource search scenario is only an example. In actual application, the present invention can also be applied to the search scenario of any other resource, such as the search of video resources, the search of article resources, the search of game resources, etc.
[0116] Exemplary Methods
[0117] Combine the following Figure 1 The application scenario shown is shown in Figure 2 To describe the method for determining keywords according to an exemplary embodiment of the present invention. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present invention, and the embodiments of the present invention are not limited in this respect. On the contrary, the embodiments of the present invention can be applied to any applicable scenario.
[0118] like Figure 2 As shown, the method for determining the keyword may include the following steps:
[0119] Step 210: identifying entity words in the search text information and entity types corresponding to the entity words; wherein the entity words include words in the search text information that reflect the search intent;
[0120] Step 220: searching for the intent score of the entity word under each entity type from a pre-established entity word library, and calculating the comprehensive intent score of the entity word based on each intent score;
[0121] Step 230: Based on the entity type and comprehensive intent score corresponding to the entity word, determine the keywords used for search from the entity word.
[0122] It should be noted that this embodiment can be applied to a server that provides a search service. The server can refer to a server, a server cluster, or a cloud platform constructed by a server cluster for searching.
[0123] In actual applications, the user can input search text information on the client corresponding to the server, and send the input search text information to the above server through the client, so that the server executes the embodiments provided in this specification based on the search text information.
[0124] Generally, various resources are stored locally on the server or in a storage device associated with the server. The server can perform matching among these resources based on the determined keywords to match at least one target resource related to the above keywords.
[0125] The entity word library stores the intention scores of different entity words under different entity types in advance. Specifically, the entity word library can be established in the following ways:
[0126] Step A1, obtaining updated entity resources; wherein each entity resource includes a resource identifier, a resource name, a resource type, and an intent score.
[0127] The following uses music resources as an example to illustrate that the server can periodically (for example, every day) update the music resources in the music library. Each music resource can include a resource identifier (such as an ID), a resource name, a resource type, a popularity score, and an intent score.
[0128] For example, the music resource information format of the single resource "Misplaced Time and Space" and the singer resource "Chen Moumou" in the music library resource library is shown in Table 1 below:
[0129]
[0130] Among them, for music resources, resource types may include four types: song, artist, album, and qualifier.
[0131] In an exemplary embodiment, the server may filter out entity resources whose heat score is less than a preset heat.
[0132] Since the music resources in the music library may contain some unpopular resources, these unpopular resources may have never been searched or the search volume is very small and can be ignored. Usually, for such unpopular resources, their heat score may be very small or even 0.
[0133] In practical applications, such unpopular resources are useless resources and can be filtered out. Specifically, entity resources with a heat score less than a preset heat can be considered unpopular resources, so entity resources with a heat score less than a preset heat can be filtered out.
[0134] Step A2: convert the resource name into a standardized format to obtain a normalized entity word.
[0135] Since the music resources in the music library resource library may come from different data sources, and different data sources correspond to different data standards, the data standards of the music resources in the music library resource library are not unified. For example, for the same resource name, there may be inconsistencies in uppercase and lowercase, special characters, and other differences.
[0136] Based on this, this step can normalize the resource names through standardized format conversion. For example, the singer "ABC" becomes "abc" after normalization; the single "Abc" also becomes "abc" after normalization, and the normalized entity words are unified as "abc".
[0137] Step A3, associating the normalized entity word with the resource identifier, resource type and intent score of the corresponding entity resource.
[0138] Since a normalized entity word may correspond to multiple entity resources, the normalized entity word can be associated with the corresponding entity resource information, such as resource identifier, resource type, and intent score.
[0139] Table 2 shows the entity resource related information of the entity vocabulary:
[0140]
[0141] There are two resources for the entity word "abc". One is resource id 569278, which corresponds to the singer (artist), that is, the singer group abc, and the intent is divided into 200. The other is resource 214250, which corresponds to the single (song), that is, the single name abc, and the intent is divided into 100.
[0142] Step A4: when a normalized entity word is associated with multiple intent scores, the sum of the multiple intent scores is used as the intent score of the entity word.
[0143] When an entity word is associated with multiple intent scores, a total intent score needs to be calculated.
[0144] Taking the entity word "abc" in Table 2 above as an example, it corresponds to two different music resources with intent scores of 200 and 100. The sum of these two intent scores is 300, which is used as the final intent score of the entity word "abc".
[0145] Through the above examples, an entity vocabulary can be constructed for use in subsequent embodiments.
[0146] After introducing the entity word library, each step in the above steps 210 to 230 will be described in detail below.
[0147] Step 210: Identify entity words in the search text information and entity types corresponding to the entity words; wherein the entity words include words in the search text information that reflect the search intent.
[0148] Since the search text information may include some meaningless content, the entity words that truly reflect the search intent are only a part of the search text information. Therefore, after receiving the search text information, the server needs to first identify the entity words that reflect the search intent from the search text information, as well as the entity type corresponding to each entity word.
[0149] In this embodiment, a phrase of an independent resource dimension is called an entity word, for example, "Deng Moumou" is a singer entity and "Pao Pao" is a single entity.
[0150] During implementation, the server may use techniques such as semantic recognition and named entity recognition for recognition.
[0151] The following uses Named Entity Recognition (NER) technology as an example to illustrate.
[0152] In an exemplary embodiment, the above step 210 may include:
[0153] Step B1: input the received search text information into the named entity recognition model for calculation;
[0154] Step B2: Obtain the entity words output after calculation by the named entity recognition model and the entity types corresponding to the entity words.
[0155] In this example, the named entity recognition model is used to identify entity words and entity types from input text information based on pre-defined entity types.
[0156] Among them, the named entity recognition NER model is a general term for a type of algorithm. The specific algorithms used in the named entity recognition model are further explained below.
[0157] In an exemplary embodiment, the named entity recognition model is composed of an embedding model and a bidirectional long short-term memory model;
[0158] Accordingly, the above step B1, inputting the received search text information into the named entity recognition model for calculation, may include:
[0159] For each single character in the received search text information, perform the following processing:
[0160] Step B11, input the current single character into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions.
[0161] Among them, the above different dimensions may include single characters, entity types, entity length ratios, and intention scores; that is, the above step B11 may include:
[0162] Step B111, input the current single character into the single-character embedding layer of the embedding model to calculate the single-character embedding feature of the current single character.
[0163] For example, assume that the search text information input by the user is "The Bubble sung by Deng XX". First, based on the single characters, it is split into 7 single characters: "Deng, XX, XX, sing, of, bubble, foam"; for each character, it is sequentially input into 4 embedding layers.
[0164] Taking the single character "Deng" as an example, input it into the single-character embedding layer (which can also be called the char embedding layer) to calculate the single-character embedding feature corresponding to the single character "Deng": ; among them, represents the single-character embedding feature, which has 128 dimensions, respectively to .
[0165] It should be noted that the dimension 128 of the single-character embedding feature here can be an empirical value. Generally, the more dimensions, the more accurate the final recognition result, but the more computing resources are occupied.
[0166] Step B112, input the current single character into the entity-type embedding layer of the embedding model to calculate the entity-type embedding feature of the current single character;
[0167] In implementation, prefix matching calculation can be performed on the current single character based on the entity thesaurus to determine the target word in the search text information that is in the entity thesaurus and contains the current single character;
[0168] Obtain the entity type corresponding to the target word in the entity thesaurus, and obtain the preset feature value corresponding to the entity type;
[0169] The feature value is input into the entity type embedding layer in the embedding model, and the feature value is mapped to the entity type embedding feature.
[0170] Still taking the single word "Deng" in "Foam sung by Deng Moumou" as an example, each entity type can be pre-set with a feature value. The feature value corresponding to the singer is 1, the feature value corresponding to the single is 2, the feature value corresponding to the album is 3, and the feature value corresponding to the qualifier is 4.
[0171] Among them, the above prefix matching calculation may include: searching the entity word library for entity words containing the current word; matching the searched entity words with the search text information, and determining the entity words located in the search text information as target words.
[0172] First, match entity words containing the single word "Deng" in the aforementioned entity word library. Assume that "Deng Mou" and "Deng Moumou" are matched. Further, it is necessary to see whether the matched entity words are located in the search text information. Since "Deng Mou" is not in the search text information, but "Deng Moumou" is in the search text, it can be determined that "Deng Moumou" is the target word in the end.
[0173] After determining the target word "Deng XX", since "Deng XX" belongs to the singer entity type, the feature value 1 corresponding to the singer can be input into the entity type embedding layer, which can map 1 to the entity type embedding feature: ;in, Represents the entity type embedding feature, which has 16 dimensions, namely to .
[0174] It should be noted that the dimension of 16 of the entity type embedding feature here can be an empirical value. Generally, the more dimensions there are, the more accurate the final recognition result will be, but the more computing resources will be occupied.
[0175] Step B113, input the current word into the entity length ratio embedding layer in the embedding model, and calculate the entity length ratio embedding feature of the current word.
[0176] During implementation, prefix matching calculation may be performed on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0177] Calculating the ratio of the length of the target word to the length of the search text information, and obtaining the interval segment number of the ratio mapped in the preset first numerical interval;
[0178] Input the serial number of the interval segment into the entity length ratio embedding layer of the embedding model, and map the serial number of the interval segment to the entity length ratio embedding feature.
[0179] Still taking the single character 'Deng' in 'The Bubble sung by Deng XX' as an example, the target word can be determined as 'Deng XX' through prefix matching calculation as shown before.
[0180] After determining the target word 'Deng XX', since 'Deng XX' has 3 characters, its entity length is 3, and the length of the search text information is 7 (the sentence 'The Bubble sung by Deng XX' has 7 characters). Therefore, the ratio of the entity length of the single character 'Deng' is 3 / 7 = 0.43.
[0181] Furthermore, since the ratio 0.43 is mapped to the 5th interval segment [0.4, 0.5] in the preset first numerical interval [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], the serial number 5 of the interval segment can be input into the entity length ratio embedding layer, and this entity length ratio embedding layer can map 5 to the entity length ratio embedding feature: ; where represents the entity length ratio embedding feature, which has 16 dimensions, respectively to .
[0182] It should be noted that the dimension 16 of the entity length ratio embedding feature here can be an empirical value. Generally, the more dimensions, the more accurate the final recognition result, but the more computing resources are occupied.
[0183] Step B114, input the current single character into the intention score embedding layer of the embedding model, and calculate the intention score embedding feature of the current single character.
[0184] In implementation, prefix matching calculation can be performed on the current single character based on the entity thesaurus to determine the target word in the search text information that is in the entity thesaurus and contains the current single character;
[0185] Obtain the intention score corresponding to the target word in the entity thesaurus, calculate the logarithm of the intention score, and obtain the serial number of the interval segment where the value of the logarithm is mapped in the preset second numerical interval;
[0186] Input the serial number of the interval segment into the embedding layer of the intent score, and map the serial number of the interval segment to the embedding feature of the intent score.
[0187] Still taking the single character "Deng" in "The Bubble sung by Deng XX" as an example, as shown before, the target word can be determined as "Deng XX" through prefix matching calculation.
[0188] After determining the target word "Deng XX", assume that querying the entity dictionary to obtain the intent score corresponding to "Deng XX" is 20000; taking the logarithm of this intent score gives .
[0189] Furthermore, since the value 4.3 after taking the logarithm is mapped to the 5th interval segment [4, 5] in the preset second numerical interval [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], the interval segment serial number 5 can be input into the embedding layer of the intent score, and this embedding layer of the intent score can map 5 to the embedding feature of the intent score: ; where represents the embedding feature of the intent score, and this feature has 16 dimensions, which are respectively to .
[0190] It should be noted that the dimension 16 of the embedding feature of the intent score here can be an empirical value. Generally, the more dimensions, the more accurate the final recognition result, but the more computing resources are occupied.
[0191] Step B12, after splicing the embedding features calculated under different dimensions, use them as the input to the hidden layer of the bidirectional long short-term memory model, and use the search text information as the input to the input layer of the bidirectional long short-term memory model, to obtain the entity word output by the output layer of the bidirectional long short-term memory model and the entity type corresponding to the entity word.
[0192] Continuing with the example in the aforementioned steps B111 - B114 taking the single character "Deng" in "The Bubble sung by Deng XX" as an example, the single character embedding feature: , the entity type embedding feature: , the entity length ratio embedding feature: , the intent score embedding feature: are spliced to obtain a 176-dimensional feature:
[0193]
[0194] After splicing The 176-dimensional features are used as the input of the hidden layer of a bidirectional long short-term memory (Bi-LSTM) model.
[0195] Using the bidirectional long short-term memory model in this embodiment can solve the problem of gradient disappearance during the model learning process to better handle the input data of long sequences (i.e., the search text information of long texts). In addition, the bidirectional long short-term memory model can relate more to the context when predicting the result. In the cell (the basic unit of the bidirectional long short-term memory model), not only the output of the forward LSTM but also the output of the backward LSTM are input, ultimately making the prediction result more accurate.
[0196] To make the model prediction result more in line with the definition of entity words, that is, phrases of independent resource dimensions, a CRF (Conditional Random Fields) can also be configured for the Bi-LSTM, making the NER model structure an embedding+Bi-LSTM+CRF structure.
[0197] Among them, the CRF is used to constrain the Bi-LSTM, and the entity words and entity types are calculated and output through Bi-LSTM+CRF.
[0198] When using the model for prediction, the conditional random field model is used to label each word in the input sequence of the bidirectional long short-term memory model; among them, the label annotation includes: using B to represent the start of an entity, I to represent the middle part of an entity, E to represent the end part of an entity, and O to represent non-defined entity types. Among them, the constraint conditions of the constraint include: entity words starting with label B and ending with label E. In addition, the viterbi algorithm can also be used to find the entity words and entity types with the highest probability from the labeled tags.
[0199] Taking "The Bubble sung by Deng Yi'er" as an example, if there is no CRF constraint, the NER result may be "Deng / I-Artist", "Yi / I-Artist", "Er / E-Artist", "sung / O", "of / E-Song", "Bubble / E-Song", " / E-Song"; in this way, there will be a singer entity "Deng Yi'er" starting with I-Artist, which does not meet the constraint condition of entity words starting with label B and ending with label E.
[0200] If CRF constraints are added, the NER results are "Deng / B-Artist", "Yi / I-Artist", "Er / E-Artist", "Chang / O", "De / O", "Pao / B-Song", "Mo / E-Song"; the predicted entities "Deng Yi Er" and "Pao Mo" both start with B- and end with E-, meeting the constraint conditions.
[0201] Step 220: Search for the intention scores of the entity word under each entity type in the pre-established entity word library, and calculate the comprehensive intention score of the entity word based on the intention scores of each entity type.
[0202] For the identified entity words and entity offline, the intention scores of each entity word under each entity type can be obtained by querying the entity word library. If the entity word does not exist under a certain entity type, the intention score under that entity type is 0.
[0203] Continuing with the example of music resources, the resource types of music resources can include 4 types: single song (song), singer (artist), album (album), and qualifier. Then, the intention scores of each entity word include: single song intention score 、singer intention score 、album intention score and qualifier .
[0204] In one embodiment, calculating the comprehensive intention score of the entity word based on the intention scores of each entity type may include:
[0205] Step C1: Calculate the sum of the intention scores of the entity word under each entity type to obtain the entity intention score;
[0206] The above entity intention score can be calculated based on the following formula:
[0207]
[0208] Step C2: Based on the intention score of each entity type and the entity intention score, obtain the normalized intention score of each entity type;
[0209] Dividing the intention score of each entity type by the entity intention score to obtain the normalized intention score of each entity type, and the calculation formula is as follows:
[0210] Normalized intention score of single song
[0211] Normalized intention score of singer
[0212] Normalized intention score of album
[0213] Normalized intent score for qualifiers
[0214] Where eps=0.0000001 is used to prevent the denominator from being 0.
[0215] Step C3: Determine the normalized intent score with the largest score as the comprehensive intent score of the entity word.
[0216] Still taking "Foam sung by Deng XX" as an example, the singer (artist) entity "Deng XX" and the single (song) entity "Foam" are identified. For "Deng XX", the intent score in Table 2 above is queried, and the corresponding artist intent score of "Deng XX" is 590, and the corresponding song intent score is 10. The normalized singer intent score is 590 / (590+10)=0.983, and the normalized single intent score is 10 / (590+10)=0.017; the normalized intent score with the largest score is selected as the entity intent score of the entity word, so the entity intent score of "Deng XX" is 0.983.
[0217] Step 230: Based on the entity type and comprehensive intent score corresponding to the entity word, determine the keywords used for search from the entity word.
[0218] In practical applications, generally, several entity words can be identified from the search text information of a long text, and non-essential retention judgment can be performed on the identified entity words to determine which entity words need to be retained and which entity words can be deleted. For this purpose, the patent also provides the following embodiments.
[0219] In an exemplary embodiment, before step 230, the following may be included:
[0220] Step D1, determining the word weight of the entity word based on a pre-established tf-idf feature library.
[0221] The word weight represents the importance of the entity word in the search text information. The value of the word weight is generally between [0, 1]. The larger the word weight, the more important the entity word is in the search text information and the more it needs to be retained.
[0222] The tf-idf feature library is constructed based on the tf (term frequency) and idf (inverse document frequency) of historical search text information. The tf-idf feature library is established in the following way:
[0223] Perform word segmentation on the historical search text information, and count the total number of word segments, the number of occurrences of each word segment, and the number of historical search text information containing the word segment;
[0224] Calculate the ratio of the number of occurrences of each participle to the total number of participles to obtain the word frequency of each participle;
[0225] Calculate the logarithm of the number of historical search text information containing the word segmentation based on the total number of historical search text information to obtain the inverse document frequency of each word segmentation;
[0226] Calculate the product of the word frequency of each word and the inverse document frequency to obtain the tf-idf feature of each word.
[0227] During implementation, the server can obtain historical search text information within a preset time period and count the total number of historical search text information N. Perform word segmentation on the historical search text information and count the number of each word ( ) And the number of historical search text information containing the word , total number of participles .
[0228] Then calculate the word frequency tf and the reverse document frequency df, and finally calculate the tf-idf feature based on tf and idf. The specific calculation formula is as follows:
[0229]
[0230]
[0231]
[0232] The eps=0.000001 is used to prevent the denominator from being 0.
[0233] In one embodiment, the above step D1 may include:
[0234] Step D11, based on the pre-established tf-idf feature library, obtain the tf-idf features corresponding to the entity word.
[0235] Step D12, determining the word weight of the entity word based on the tf-idf feature corresponding to the entity word.
[0236] After finding the tf-idf features corresponding to the entity words, you can do word weight scoring based on pattern rule matching, including
[0237] Step D121: First, determine whether the search text information is a single entity, that is, whether the recognized entity word is the search text information. If it is a single entity, it can be determined that the word weight of the entity word is 1.0. Otherwise, go to step D122.
[0238] For example, the search text information is "Deng Moumou", and the recognized entity word is also "Deng Moumou". Obviously, this search text information is a single entity, and the word weight is set to 1.
[0239] Another example, the search text information is "The Bubble sung by Deng Moumou", and the recognized entity word is "Deng Moumou". Obviously, it is not a single entity, so go to the next step.
[0240] Step D122: Query by combining the artist vocabulary. If the combined artist vocabulary is hit, the values obtained from the vocabulary for the combined name entity and the artist entity are given word weights. Otherwise, go to step D123.
[0241] The server can construct a combined artist vocabulary based on the artist and the group the artist belongs to. Fixed artist name weight values and combined name weight values are given in the vocabulary, as shown in Table 3 below:
[0242]
[0243] For the query search text information input by the user, the query can be directly matched with the combined text in the combined artist vocabulary. For example, if the user's input query "ABC Zhang San" is in the vocabulary, the word weight result of this query is "ABC / 0.3, Zhang San / 0.7". If the user's input query "The Bubble sung by Deng Moumou" is not in the vocabulary, go to step D123.
[0244] By querying through the combined artist vocabulary, when the user queries a certain artist in a group, the weight of this artist can be increased to avoid querying resources related to other members in the group.
[0245] Step D123: Combine entity word and qualifier for judgment. If the recognized entity words include an entity word that is a non-qualifier (such as single, singer, album type) and an entity word that is a qualifier, then increase the tf-idf feature value corresponding to the entity word of the non-qualifier ( ) by 2 times and decrease the tf-idf feature value corresponding to the entity word of the qualifier ( ) by 2 times, and then normalize the word weight. Otherwise, go to step D124.
[0246] Among them, the weight value of the entity word of the non-qualifier ; the weight value of the entity word of the qualifier ;
[0247] Normalized word weights corresponding to non-determiner entity words:
[0248]
[0249] Normalized word weights corresponding to determiner entity words:
[0250]
[0251] For example, assume the query is "Foam EDM version". The identified entity words are "Foam / song" and "EDM version / qualifier". Since the query contains a non-determiner "Foam" and a determiner "EDM version", it conforms to the entity word plus determiner combination.
[0252] Assume that the tf-idf value of "Foam" retrieved from the tf-idf feature library is 19.08, and the tf-idf value of "EDM version" is 9.46. Then, the weight of the non-determiner "Foam" is boosted by 2 times, 19.08×2 = 38.16, and the weight of the determiner "EDM version" is reduced by 2 times, 9.46÷2 = 4.73. Then, calculate the normalized weights. The word weight of "Foam" is 38.16÷(38.16 + 4.73 + eps)=0.89, and the word weight of "EDM version" is 4.73÷(38.16 + 4.73 + eps)=0.11. The result of the normalized word weights is: "Foam / 0.89", "EDM version / 0.11".
[0253] While assume the query is "The foam sung by Deng XX". The identified entity words are "Deng XX / artist", "sung / qualifier", " / qualifier", "foam / song", which contains two non-determiners and two determiners and does not conform to the entity word plus determiner combination, then proceed to step D124.
[0254] Step D124, two-entity combination judgment. If the identified entity words are two non-determiner entity words, then boost the tf-idf feature value corresponding to the entity word by 1.5 times, and then normalize the word weight. Otherwise, proceed to step D125.
[0255] For example, assume the query is "Deng Moumou Foam", and the recognized entity words are "Deng Moumou / artist" and "Foam / song", which contain only two entity words, both of which are non-determiners. By querying the tf-idf feature library, the tf-idf value of "Deng Moumou" is 18.21, and the tf-idf value of "Foam" is 19.08. After boosting it by 1.5 times, the boosted tf-idf value is 19.08×1.5 = 28.62. Then, the normalized word weight of "Deng Moumou" is 18.21÷(18.21 + 28.62 + eps)=0.39, and the normalized word weight of "Foam" is 28.62÷(18.21 + 28.62 + eps)=0.61. The final word weight result is "Deng Moumou / 0.39", "Foam / 0.61". Since the query "Foam sung by Deng Moumou" does not belong to the two-entity combination, it enters step D125.
[0256] Step D125, general word weight. When the entity words do not meet the above several situations, the general word weight calculation can be used.
[0257] Specifically, the tf-idf feature is used as the initial word weight of the entity word;
[0258] For each entity word, based on the word type of the entity word, the intermediate word weight of the entity word is calculated on the basis of the initial word weight;
[0259] Calculate the sum of the intermediate word weights of each entity word;
[0260] Based on the intermediate word weight of each entity word and the sum of the intermediate word weights, the normalized word weight of each entity word is obtained.
[0261] In this example, for the recognized entity words, there may be three situations: single-character entity (the entity word has only 1 character) , non-single-character entity , determiner .
[0262] First, calculate the intermediate word weight of the entity word:
[0263] If the entity word is a non-single-character entity, the initial word weight is increased to obtain the word weight of the non-single-character entity. For example, for a non-single-character entity Boost it by 1.5 times:
[0264] .
[0265] If the entity word is a determiner entity, the initial word weight is decreased to obtain the word weight of the determiner entity. For example, for a determiner Reduce the weight to 0.3 times:
[0266] .
[0267] If the entity word is a single-word entity, the initial word weight is determined as the word weight of the single-word entity. constant.
[0268] Then, calculate the sum of the intermediate word weights for each entity word:
[0269]
[0270] Finally, the normalized word weights of entity words are calculated:
[0271] For single-word entities, calculate the normalized word weights of single-word entities:
[0272]
[0273] For non-single-word entities, calculate the normalized word weights of non-single-word entities:
[0274]
[0275] For the qualifier entity, calculate the normalized word weight of the qualifier entity:
[0276]
[0277] For example, suppose the query is "Deng XX sings Bubble", and the recognized entity words are "Deng XX / artist", "sing / qualifier", "of / qualifier" and "foam / song". First, the tf-idf value of "Deng XX" is 18.21, the tf-idf value of "sing" is 5.31, the tf-idf value of "of" is 1.02, and the tf-idf value of "foam" is 19.08.
[0278] Since "Deng Moumou" is a non-single-character entity consisting of three characters, and "foam" is a non-single-character entity consisting of two characters, the tf-idf values of these two entity words are increased by 1.5 times respectively. The tf-idf value of "Deng Moumou" after boosting is 1.5×18.21 = 27.315, and the tf-idf value of "foam" after boosting is 1.5×19.08 = 28.62. Both "sing" and "de" are determiners and need to be down-weighted by 0.3 times. The tf-idf value of "sing" after down-weighting is 0.3×5.31 = 1.593, and the tf-idf value of "de" after down-weighting is 0.3×1.02 = 0.306. Finally, calculate the normalized weight values. The normalized weight of "Deng Moumou" is 27.315÷(27.315 + 28.62 + 1.593 + 0.306 + eps) = 0.472, the normalized weight of "sing" is 1.593÷(27.315 + 28.62 + 1.593 + 0.306 + eps) = 0.027, the normalized weight of "de" is 0.306÷(27.315 + 28.62 + 1.593 + 0.306 + eps) = 0.005, and the normalized weight of "foam" is 28.62÷(27.315 + 28.62 + 1.593 + 0.306 + eps) = 0.496. Then the final word weight result is: "Deng Moumou / 0.472", "sing / 0.027", "de / 0.005", "foam / 0.496".
[0279] Step D2, based on the comprehensive intention score and word weight of the entity words, screen out the entity words that must be retained from the entity words.
[0280] After calculating the comprehensive intention score and word weight of the entity words, it is possible to determine which words need to be retained (must be retained) and which words need to be discarded (not necessarily retained). For the search text information of long texts, by discarding the entity words that are not necessarily retained, both the subsequent search volume can be reduced and the resources that do not meet the true intention of the user can be excluded in advance.
[0281] Regarding the judgment of not necessarily retained, it can include:
[0282] Step D211, first determine whether the search text information is a single entity; when the entity word is a non-qualified entity word of a single entity, determine that the entity word must be retained. Otherwise, go to step D212.
[0283] For example, if the query is "Deng Moumou", the identified entity word is "Deng Moumou / artist"; since this entity word is of the singer type, is a non-qualified entity word, and is the same as the search text information and is a single entity, it is determined that "Deng Moumou / must be retained".
[0284] Step 212, query the combined artist vocabulary. If the combined artist vocabulary is hit, both the group name and the artist name entities are determined as words that must be retained; otherwise, proceed to step 123.
[0285] For example, for the query "ABC Zhang San", by querying the combined artist vocabulary shown in Table 2 above, it is found that the query hits the combined artist vocabulary in Table 2, then it is determined that "ABC / must be retained" and "Zhang San / must be retained".
[0286] Another example is the query "The Bubble sung by Deng XX". Since it is not included in Table 2, it is necessary to proceed to step 124.
[0287] Step 124, general non-essential retention judgment. When the entity word is a qualifier entity and the word weight is greater than the first threshold, determine that the entity word must be retained;
[0288] When the entity word is a non-single-entity non-qualifier entity and the comprehensive intention score is greater than the second threshold and the word weight is greater than the third threshold, determine that the entity word must be retained.
[0289] Among them, the first threshold is greater than the second threshold, and the second threshold is greater than the third threshold.
[0290] For example, assume the query is "The Wish by Wang XX", and the identified entity words are "Wang XX / artist", " / qualifier", " / qualifier", and " / song"; the comprehensive intention scores are "Wang XX / artist / 0.9", "version / qualifier / 1.0", "of / qualifier / 1.0", "Wish / song / 0.34"; the word weights are "Wang XX / 0.72", "version / 0.06", "of / 0.04", "Wish / 0.18".
[0291] Judging the non-essential retention situation of the non-qualifier type, "Wang XX" is a singer (artist) entity, the comprehensive intention score is 0.9 which is greater than the second threshold of 0.2, and the word weight is 0.72 which is greater than the third threshold of 0.1, so it is determined to be must be retained. "Wish" is a song (song) entity and is a single entity with only one character, the comprehensive intention score is 0.18 which is less than the second threshold of 0.2, and it does not meet the conditions and is determined to be non-essential retention. Then judge the non-essential retention situation of the qualifier type, the word weight of "version" is 0.06 which is less than the first threshold of 0.3, and it is determined to be non-essential retention. The word weight of "of" is 0.04 which is less than the first threshold of 0.3, and it is also determined to be non-essential retention. Then the non-essential retention judgment result of the query "The Wish by Wang XX" is "Wang XX / must be retained", "version / non-essential retention", "of / non-essential retention", "Wish / non-essential retention".
[0292] Correspondingly, the said step 230 includes:
[0293] Determine the keywords for searching from the mandatory entity words based on the entity types, comprehensive intention scores, and word weights corresponding to the mandatory entity words.
[0294] After the server determines the mandatory entity words, and through certain rule judgments, it can obtain the fine-grained keywords that represent the user's actual search intention.
[0295] In an exemplary embodiment, it may include:
[0296] Classify the mandatory entity words based on the entity types;
[0297] Under the same entity type, determine the entity words with the largest word weight and a comprehensive intention score greater than the threshold as the keywords for searching.
[0298] For example, assume that the non-mandatory determination results for the query "Chen XX Wang XX version Because of Love" are "Chen XX / mandatory", "Wang XX / mandatory", "version / non-mandatory", "Because of Love / mandatory"; retain the mandatory words "Chen XX", "Wang XX", and "Because of Love".
[0299] Classify the mandatory words according to the entity types. Classify "Chen XX" and "Wang XX" of the singer type into one category, and "Because of Love" of the single type into another category.
[0300] For "Chen XX" and "Wang XX" under the singer type, sort them in descending order of word weight. Assume the word weights are "Chen XX / 0.27", "Wang XX / 0.31", then the word weight sorting result under the singer type is: Wang XX (0.31) is greater than Chen XX (0.27); it can be determined that "Wang XX" is the entity word with the largest word weight under the singer type.
[0301] Furthermore, determine whether the comprehensive intention scores of "Wang XX" under the singer type and "Because of Love" under the song type are greater than the threshold of 0.3; assume that the comprehensive intention score of the singer entity "Wang XX" is 0.96 which is greater than 0.3, and "Wang XX" is the entity word with the largest word weight under the singer type; while although the comprehensive intention score of "Chen XX" is 0.94 which is also greater than 0.3, it is not the entity word with the largest word weight under the singer type.
[0302] For the single type, the comprehensive intention score of the single entity "Because of Love" is 0.88 which is greater than the threshold of 0.3, and there is only one single entity, so the single entity with the highest word weight is Because of Love (0.39). There is no album type entity, so no judgment is made.
[0303] Therefore, the final fine-grained intent information is: "Wang Mou / artist / intent score 0.96 / word weight 0.31", "because of love / song / intent score 0.88 / word weight 0.39". That is, the determined keywords are "Wang Mou" and "because of love".
[0304] Through the above embodiments, by identifying entity words and entity types in the search text information, each entity word is scored in combination with a pre-established entity word library to obtain a comprehensive intent score for each entity word; finally, based on the entity type and comprehensive intent score of each entity word, at least one keyword that meets the actual needs of the user is determined. Since the final keywords are determined based on the idea of fine-grained multi-search intent, each keyword can correspond to a fine-grained search intent, which can meet the search needs of users with different search intents. This makes the search results more accurate and more in line with user expectations.
[0305] Furthermore, since the keywords used for searching have been determined, the search can be performed using the keywords.
[0306] In an exemplary embodiment, in the above Figure 2 The foundation may also include:
[0307] Search for resources based on the determined keywords and obtain the searched resources;
[0308] The resources are ranked based on the relevance of the resources to the keywords.
[0309] In this example, after searching for resources, the resources are sorted so that resources with high relevance to the keywords are displayed first.
[0310] For example, for the query "Deng XX sings Bubble", the keywords "Deng XX" and "bubble" determined in the above embodiment are used to match resources, and after sorting the resources, the following results can be obtained: Figure 3 The search results shown. Figure 3 and Figure 1 In comparison, the search results prioritize the song “Bubble” which not only meets the user’s expectations, but also the singer “Deng Moumou”, the original singer of the song “Bubble”, which meets the user’s expectations. It can be seen that the search results are more in line with the user’s real needs.
[0311] Exemplary Media
[0312] After introducing the method of the exemplary embodiment of the present invention, next, refer to Figure 4 A medium according to an exemplary embodiment of the present invention is described.
[0313] In this exemplary embodiment, the above method can be implemented by a program product, such as a portable compact disk read-only memory (CD-ROM) and including program code, and can be run on a device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, apparatus, or device.
[0314] The program product may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0315] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0316] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RE, etc., or any suitable combination of the foregoing.
[0317] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0318] Exemplary Devices
[0319] After introducing the medium of the exemplary embodiment of the present invention, next, reference is made to Figure 5 A device according to an exemplary embodiment of the present invention is described.
[0320] Figure 5 A block diagram of a keyword determination device according to an embodiment of the present invention is schematically shown. The keyword determination device may include:
[0321] The identification unit 310 identifies entity words in the search text information and entity types corresponding to the entity words; wherein the entity words include words in the search text information that reflect the search intent;
[0322] A calculation unit 320 searches for the intent score of the entity word under each entity type from a pre-established entity word library, and calculates a comprehensive intent score of the entity word based on each intent score;
[0323] The determination unit 330 determines keywords for search from the entity words based on the entity type and the comprehensive intent score corresponding to the entity words.
[0324] Optionally, the identification unit 310 includes:
[0325] Input the received search text information into the named entity recognition model for calculation;
[0326] The entity words output after the named entity recognition model is calculated and the entity types corresponding to the entity words are obtained.
[0327] Optionally, the named entity recognition model consists of an embedding model and a bidirectional long short-term memory model;
[0328] The step of inputting the received search text information into a named entity recognition model for calculation includes:
[0329] For each word in the received search text information, do the following processing:
[0330] Input the current word into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions;
[0331] The embedding features calculated under the different dimensions are concatenated and used as the hidden layer input of the bidirectional long short-term memory model, and the search text information is used as the input layer input of the bidirectional long short-term memory model to obtain the entity words output by the output layer of the bidirectional long short-term memory model and the entity types corresponding to the entity words.
[0332] Optionally, the different dimensions include single words, entity types, entity length ratios, and intent scores;
[0333] The current word is input into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions, including:
[0334] The first calculation subunit 311 inputs the current word into the word embedding layer in the embedding model to calculate the word embedding feature of the current word;
[0335] The second calculation subunit 312 inputs the current word into the entity type embedding layer in the embedding model to calculate the entity type embedding feature of the current word;
[0336] The third calculation subunit 313 inputs the current word into the entity length ratio embedding layer in the embedding model to calculate the entity length ratio embedding feature of the current word;
[0337] The fourth calculation subunit 314 inputs the current word into the intention sub-embedding layer in the embedding model, and calculates the intention sub-embedding feature of the current word.
[0338] Optionally, the second calculation subunit 312 includes:
[0339] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0340] Obtaining the entity type corresponding to the target word in the entity vocabulary, and obtaining a preset feature value corresponding to the entity type;
[0341] The feature value is input into the entity type embedding layer in the embedding model, and the feature value is mapped to the entity type embedding feature.
[0342] Optionally, the third calculation subunit 313 includes:
[0343] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0344] Calculating the ratio of the length of the target word to the length of the search text information, and obtaining the interval segment number of the ratio mapped in the preset first numerical interval;
[0345] The interval segment number is input into the entity length ratio embedding layer in the embedding model, and the interval segment number is mapped to the entity length ratio embedding feature.
[0346] Optionally, the fourth calculation subunit 314 includes:
[0347] Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word;
[0348] Obtaining the intent score corresponding to the target word in the entity word library, calculating the logarithm of the intent score, and obtaining the interval segment number of the value of the logarithm mapped to the preset second numerical interval;
[0349] The interval segment sequence number is input into the intention sub-embedding layer in the embedding model, and the interval segment sequence number is mapped to the intention sub-embedding feature.
[0350] Optionally, performing prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word includes:
[0351] Searching the entity word library for entity words containing the current word;
[0352] The entity words found in the search are matched with the search text information, and the entity words in the search text information are determined as target words.
[0353] Optionally, the named entity recognition model also includes a conditional random field model constraining the bidirectional long short-term memory model;
[0354] The conditional random field model is used to label each word in the input sequence of the bidirectional long short-term memory model;
[0355] The label marking includes: B to indicate the beginning of an entity, I to indicate the middle part of an entity, E to indicate the end part of an entity, and O to indicate an unrestricted entity type.
[0356] Optionally, the entity word library is established in the following manner:
[0357] The entity word library establishment unit 302 is used to obtain updated entity resources; each entity resource includes a resource identifier, a resource name, a resource type, and an intent score; the resource name is converted into a standardized format to obtain a normalized entity word; the resource identifier, resource type and intent score of the corresponding entity resource are associated with the normalized entity word; when the normalized entity word is associated with multiple intent scores, the sum of the multiple intent scores is used as the intent score of the entity word.
[0358] Optionally, the entity resource further includes a popularity score; and before converting the resource name into a standardized format to obtain a normalized entity name, the method further includes:
[0359] Filter out entity resources whose heat score is less than the preset heat.
[0360] Optionally, calculating the comprehensive intent score of the entity word based on the individual intent scores includes:
[0361] Calculate the sum of the intent scores of the entity word under each entity type to obtain the entity intent score;
[0362] Based on the intent score under each entity type and the entity intent score, a normalized intent score of each entity type is obtained;
[0363] The normalized intent score with the largest score is determined as the comprehensive intent score of the entity word.
[0364] Optionally, the device further comprises:
[0365] A word weight unit 322 determines the word weight of the entity word based on a pre-established tf-idf feature library;
[0366] A screening unit 324, based on the comprehensive intention score and word weight of the entity words, screens out entity words that must be retained from the entity words;
[0367] The determining unit 330 includes:
[0368] Based on the entity type, comprehensive intent score and word weight corresponding to the required entity words, keywords for search are determined from the required entity words.
[0369] Optionally, the word weight unit 322 includes:
[0370] Based on a pre-established tf-idf feature library, obtaining the tf-idf features corresponding to the entity words;
[0371] Based on the tf-idf feature corresponding to the entity word, the word weight of the entity word is determined.
[0372] Optionally, determining the word weight of the entity word based on the tf-idf feature corresponding to the entity word includes:
[0373] Use the tf-idf feature as the initial word weight of the entity word;
[0374] For each entity word, based on the word type of the entity word, the intermediate word weight of the entity word is calculated on the basis of the initial word weight;
[0375] Calculate the sum of the intermediate word weights of each entity word;
[0376] Based on the intermediate word weight of each entity word and the sum of the intermediate word weights, a normalized word weight of each entity word is obtained.
[0377] Optionally, the word type based on the entity word, calculating the intermediate word weight of the entity word on the basis of the initial word weight, includes:
[0378] If the entity word is a non-single-word entity, the initial word weight is increased to obtain the word weight of the non-single-word entity;
[0379] If the entity word is a qualifier entity, the initial word weight is reduced to obtain the word weight of the qualifier entity;
[0380] If the entity word is a single-word entity, the initial word weight is determined as the word weight of the single-word entity.
[0381] Optionally, the screening unit 324 includes:
[0382] When the entity word is a qualifier entity and the word weight is greater than the first threshold, the entity word is determined to be a must-retain word;
[0383] When the entity word is a non-single entity and a non-qualifier entity, and the comprehensive intention score is greater than the second threshold and the word weight is greater than the third threshold, the entity word is determined to be a must-retain word;
[0384] When the entity word is a single-entity non-restricted entity word, it is determined that the entity word must be retained.
[0385] Optionally, the tf-idf feature library is established in the following way:
[0386] The feature library establishment unit 304 performs word segmentation processing on the historical search text information, counts the total number of word segments, the number of occurrences of each word segment and the number of historical search text information containing the word segment; calculates the ratio of the number of occurrences of each word segment to the total number of word segments to obtain the word frequency of each word segment; calculates the logarithm of the number of historical search text information containing the word segment with the total number of historical search text information as the base to obtain the reverse document frequency of each word segment; calculates the product of the word frequency of each word segment and the reverse document frequency to obtain the tf-idf feature of each word segment.
[0387] Optionally, determining keywords for search from the required entity words based on the entity type, comprehensive intent score, and word weight corresponding to the required entity words includes:
[0388] Classifying the entity words that must be retained based on the entity type;
[0389] Under the same entity type, the entity word with the largest word weight and a comprehensive intent score greater than a threshold is determined as the keyword for search.
[0390] Optionally, the device further comprises:
[0391] The search subunit 332 searches for resources based on the determined keywords and obtains the searched resources;
[0392] The sorting subunit 334 sorts the resources based on the relevance between the resources and the keywords.
[0393] Exemplary Computing Devices
[0394] After introducing the method, medium and apparatus of the exemplary embodiments of the present invention, next, reference is made to Figure 6 A computing device according to an exemplary embodiment of the present invention is described.
[0395] Figure 6 The computing device 1500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0396] like Figure 6 As shown, the computing device 1500 is in the form of a general computing device. The components of the computing device 1500 may include but are not limited to: at least one processing unit 1501, at least one storage unit 1502, and a bus 1503 connecting different system components (including the processing unit 1501 and the storage unit 1502).
[0397] The bus 1503 includes a data bus, a control bus, and an address bus.
[0398] The storage unit 1502 may include a readable medium in the form of a volatile memory, such as a random access memory (RAM) 15021 and / or a cache memory 15022 , and may further include a readable medium in the form of a non-volatile memory, such as a read-only memory (ROM) 15023 .
[0399] The storage unit 1502 may also include a program / utility 15025 having a set (at least one) of program modules 15024, such program modules 15024 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0400] Computing device 1500 may also communicate with one or more external devices 1504 (eg, keyboards, pointing devices, etc.).
[0401] Such communication may be performed via input / output (I / O) interface 1505. In addition, computing device 1500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via network adapter 1506. Figure 6 As shown, network adapter 1506 communicates with other modules of computing device 1500 via bus 1503. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with computing device 1500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0402] It should be noted that, although several units / modules or subunits / modules of the keyword determination device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0403] In addition, although the operations of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0404] Although the spirit and principle of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present invention is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.
Claims
1. A method for determining a keyword, comprising: Using the named entity recognition model composed of the embedding model and the bidirectional long short-term memory model, the following processing is performed on each word in the received search text information: Input the current word into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions; After concatenating the embedding features calculated under the different dimensions, the concatenated features are used as the hidden layer input of the bidirectional long short-term memory model, and the search text information is used as the input layer input of the bidirectional long short-term memory model to obtain the entity words output by the output layer of the bidirectional long short-term memory model and the entity types corresponding to the entity words; Obtaining entity words and entity types corresponding to the entity words output after calculation by the named entity recognition model; wherein the entity words include words in the search text information that reflect the search intent; Searching for the intent score of the entity word under each entity type from a pre-established entity word library, and calculating the comprehensive intent score of the entity word based on each intent score; Determine the word weight of the entity word based on a pre-established tf-idf feature library; When the entity word is a qualifier entity and the word weight is greater than the first threshold, the entity word is determined to be a must-retain word; When the entity word is a non-single entity and a non-qualifier entity, and the comprehensive intention score is greater than the second threshold and the word weight is greater than the third threshold, the entity word is determined to be a must-retain word; When the entity word is a single-entity non-restricted entity word, the entity word is determined to be required; Based on the entity type, comprehensive intent score and word weight corresponding to the required entity words, keywords for search are determined from the required entity words.
2. The method according to claim 1, wherein the different dimensions include single words, entity types, entity length ratios, and intent scores; The current word is input into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions, including: Input the current word into the word embedding layer in the embedding model, and calculate the word embedding features of the current word; Input the current word into the entity type embedding layer in the embedding model, and calculate the entity type embedding feature of the current word; Input the current word into the entity length ratio embedding layer in the embedding model, and calculate the entity length ratio embedding feature of the current word; The current word is input into the intention sub-embedding layer in the embedding model, and the intention sub-embedding feature of the current word is calculated.
3. The method according to claim 2, wherein the step of inputting the current word into an entity type embedding layer in an embedding model and calculating the entity type embedding feature of the current word comprises: Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word; Obtaining the entity type corresponding to the target word in the entity vocabulary, and obtaining a preset feature value corresponding to the entity type; The feature value is input into the entity type embedding layer in the embedding model, and the feature value is mapped to the entity type embedding feature.
4. The method according to claim 2, wherein the step of inputting the current word into an embedding layer of an entity length ratio in an embedding model and calculating an embedding feature of the entity length ratio of the current word comprises: Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word; Calculating the ratio of the length of the target word to the length of the search text information, and obtaining the interval segment number of the ratio mapped in the preset first numerical interval; The interval segment number is input into the entity length ratio embedding layer in the embedding model, and the interval segment number is mapped to the entity length ratio embedding feature.
5. The method according to claim 2, wherein the step of inputting the current word into an embedding layer of an embedding model and calculating the embedding features of the current word comprises: Perform prefix matching calculation on the current word based on the entity word library to determine a target word in the search text information that is located in the entity word library and contains the current word; Obtaining the intent score corresponding to the target word in the entity word library, calculating the logarithm of the intent score, and obtaining the interval segment number of the value of the logarithm mapped to the preset second numerical interval; The interval segment sequence number is input into the intention sub-embedding layer in the embedding model, and the interval segment sequence number is mapped to the intention sub-embedding feature.
6. According to the method of any one of claims 3 to 5, the performing prefix matching calculation on the current word based on the entity word library to determine the target word in the search text information that is located in the entity word library and contains the current word comprises: Searching the entity word library for entity words containing the current word; The entity words found in the search are matched with the search text information, and the entity words in the search text information are determined as target words.
7. According to the method of claim 1, the named entity recognition model also includes a conditional random field model constraining the bidirectional long short-term memory model; The conditional random field model is used to label each word in the input sequence of the bidirectional long short-term memory model; The label annotation includes: B indicates the beginning of an entity, I indicates the middle of an entity, E indicates the end of an entity, and O indicates an unqualified entity type.
8. According to the method of claim 1, the entity word library is established by: Get the updated entity resource; where, Each entity resource includes resource identifier, resource name, resource type, and intent score; Convert the resource name into a standardized format to obtain a normalized entity word; Associate the normalized entity words with the resource identifier, resource type, and intent score of the corresponding entity resources; When a normalized entity word is associated with multiple intent scores, the sum of the multiple intent scores is used as the intent score of the entity word.
9. The method according to claim 8, wherein the entity resource further comprises a popularity score; and before converting the resource name into a standardized format to obtain a normalized entity name, the method further comprises: Filter out entity resources whose heat score is less than the preset heat.
10. According to the method of claim 1, the step of calculating the comprehensive intent score of the entity word based on the individual intent scores comprises: Calculate the sum of the intent scores of the entity word under each entity type to obtain the entity intent score; Based on the intent score under each entity type and the entity intent score, a normalized intent score of each entity type is obtained; The normalized intent score with the largest score is determined as the comprehensive intent score of the entity word.
11. The method according to claim 1, wherein determining the word weight of the entity word based on a pre-established tf-idf feature library comprises: Based on a pre-established tf-idf feature library, obtaining the tf-idf features corresponding to the entity words; Based on the tf-idf feature corresponding to the entity word, the word weight of the entity word is determined.
12. The method according to claim 11, wherein determining the word weight of the entity word based on the tf-idf feature corresponding to the entity word comprises: Use the tf-idf feature as the initial word weight of the entity word; For each entity word, based on the word type of the entity word, the intermediate word weight of the entity word is calculated on the basis of the initial word weight; Calculate the sum of the intermediate word weights of each entity word; Based on the intermediate word weight of each entity word and the sum of the intermediate word weights, a normalized word weight of each entity word is obtained.
13. The method according to claim 12, wherein the intermediate word weight of the entity word is calculated based on the word type of the entity word on the basis of the initial word weight, comprising: If the entity word is a non-qualifier entity that is not a single-word entity, the initial word weight is increased to obtain the word weight of the non-single-word entity; If the entity word is a qualifier entity, the initial word weight is reduced to obtain the word weight of the qualifier entity; If the entity word is a non-qualifier entity of a single-word entity, the initial word weight is determined as the word weight of the single-word entity.
14. According to the method of claim 11, the tf-idf feature library is established by: Perform word segmentation on the historical search text information, and count the total number of word segments, the number of occurrences of each word segment, and the number of historical search text information containing the word segment; Calculate the ratio of the number of occurrences of each participle to the total number of participles to obtain the word frequency of each participle; Calculate the logarithm of the number of historical search text information containing the word segmentation based on the total number of historical search text information to obtain the inverse document frequency of each word segmentation; Calculate the product of the word frequency of each word and the inverse document frequency to obtain the tf-idf feature of each word.
15. The method according to claim 1, wherein determining keywords for search from the entity words that must be retained based on the entity type, comprehensive intent score and word weight corresponding to the entity words that must be retained comprises: Classifying the entity words that must be retained based on the entity type; Under the same entity type, the entity word with the largest word weight and a comprehensive intent score greater than a threshold is determined as the keyword for search.
16. The method according to claim 1, further comprising: Search for resources based on the determined keywords and obtain the searched resources; The resources are ranked based on the relevance of the resources to the keywords.
17. A device for determining a keyword, comprising: The recognition unit uses a named entity recognition model composed of an embedding model and a bidirectional long short-term memory model to perform the following processing on each word in the received search text information: input the current word into the embedding layers of different dimensions in the embedding model to obtain the embedding features calculated under different dimensions; concatenate the embedding features calculated under different dimensions and use them as the hidden layer input of the bidirectional long short-term memory model, and use the search text information as the input layer input of the bidirectional long short-term memory model to obtain the entity words output by the output layer of the bidirectional long short-term memory model and the entity types corresponding to the entity words; obtain the entity words output by the named entity recognition model after calculation and the entity types corresponding to the entity words; wherein the entity words include words reflecting the search intent in the search text information; A calculation unit, which searches for the intent score of the entity word under each entity type from a pre-established entity word library, and calculates the comprehensive intent score of the entity word based on each intent score; A determination unit determines the word weight of the entity word based on a pre-established tf-idf feature library; when the entity word is a qualifier entity and the word weight is greater than a first threshold, the entity word is determined to be a must-retain; when the entity word is a non-qualifier entity that is not a single entity and the comprehensive intent score is greater than a second threshold and the word weight is greater than a third threshold, the entity word is determined to be a must-retain; when the entity word is a non-qualifier entity word that is a single entity, the entity word is determined to be a must-retain; based on the entity type, comprehensive intent score and word weight corresponding to the entity word that must be retained, determine the keywords used for search from the entity words that must be retained.
18. A computer-readable storage medium, comprising: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the keyword determination method according to any one of claims 1 to 16.
19. A computing device comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the executable instructions to implement the keyword determination method according to any one of claims 1-16.
Citation Information
Patent Citations
Search method and device
CN107133259A
Business keyword extraction method, device and equipment, and storage medium
CN112632292A
Searching method, searching device, storage medium and electronic equipment
CN112883266A
