A method and device for recommending input corpus
By matching phrases in the local thesaurus and calculating weight scores, the problem of long response time of search engines is solved, realizing immediacy and reliability corpus recommendations are achieved, and user experience is improved.
Patent Information
- Application Number
- CN202110576949.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-26
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-05-26
AI Technical Summary
In the prior art, the input association function based on search engines has a long response time, and cannot meet the immediate requirements such as online customer service or online consultation, and has poor user experience.
Before receiving user input, match the phrases in the local vocabulary first. If there is, obtain the corpus from the local corpus. Otherwise, obtain the corpus through search engines and calculate the weight score based on business parameters for recommendation.
It improves the efficiency of corpus acquisition, reduces response time, ensures the immediacy and reliability of recommended corpus, and improves user experience.
Smart Images

Figure CN113325959B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for recommending input expectations. Background Art
[0002] Text communication is widely used in customer service consultation, social platforms, information retrieval and other fields. In order to improve user experience, simplify user input methods or reduce user input time, input association is often used to assist user input. That is, based on text rules or intelligent algorithms, the user's possible input is predicted and recommended to the user.
[0003] At present, the commonly used input association method is based on search engines. Through the full-text retrieval function provided by unstructured databases such as ES (ElasticSearch), the existing corpus is searched for user input to provide predicted corpus corresponding to the user input.
[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art: the response time corresponding to the input association function implemented based on the search engine is relatively long, which cannot meet the scenarios with high immediacy requirements such as online customer service or online consultation, and the user experience is poor. Summary of the Invention
[0005] In view of this, an embodiment of the present invention provides a method and device for recommending input corpus, which can preferentially obtain corpus corresponding to the user input locally before using a search engine to recommend corpus, thereby improving the efficiency of corpus acquisition, reducing response time, ensuring the immediacy of recommended corpus, and improving user experience.
[0006] To achieve the above-mentioned object, according to one aspect of an embodiment of the present invention, a method for recommending input corpus is provided, comprising:
[0007] Receive user input;
[0008] Generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary:
[0009] If so, obtaining one or more pieces of text from the local corpus according to the phrase to recommend to the user;
[0010] If not, the user input is sent to a search engine to obtain one or more corpora from the search engine to recommend to the user.
[0011] Optionally, obtaining one or more pieces of corpus from a local corpus based on the phrase to recommend to the user includes:
[0012] Acquire one or more pieces of corpus corresponding to the phrase, and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus;
[0013] Obtaining one or more service parameters corresponding to the user input;
[0014] In the case where the business parameter belongs to the preset weight parameter corresponding to the corpus, calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter;
[0015] One or more corpora are selected in descending order according to the weight scores corresponding to the corpora to be recommended to the user.
[0016] Optionally, it also includes:
[0017] Before determining whether there is a phrase matching the user input in the local vocabulary, one or more of the following contents are deleted from the user input: stop words, punctuation marks, special characters, and emoticons.
[0018] Optionally, it also includes:
[0019] Before determining whether there is a phrase matching the user input in the local vocabulary, determine whether the version corresponding to the local vocabulary is the latest version, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
[0020] Optionally, it also includes:
[0021] Before determining whether there is a phrase matching the user input in the local vocabulary, determine whether the local vocabulary is available: if available, continue to determine whether there is a phrase matching the user input in the local vocabulary; if not available, send the user input to the search engine.
[0022] Optionally, the local vocabulary is set to unavailable when any of the following situations occurs: the user is a blacklisted user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than a threshold response time, and the number of user inputs received is greater than a threshold user input number.
[0023] Optionally, the user input is collected through embedding technology, one or more corpora corresponding to the user input are recommended to the user, and the corpora clicked by the user are collected to update the local vocabulary and the local corpus.
[0024] Optionally, the local vocabulary is set to unavailable based on one or more pluggable components; the user input is collected based on the pluggable business tracking component, and one or more corpora corresponding to the user input and the corpora clicked by the user are recommended to the user.
[0025] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, there is provided an input corpus recommendation device, comprising: a user input receiving module, a corpus acquisition module; wherein,
[0026] The user input receiving module is used to receive user input;
[0027] The corpus acquisition module is used to generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary:
[0028] If so, obtaining one or more pieces of text from the local corpus according to the phrase to recommend to the user;
[0029] If not, the user input is sent to a search engine to obtain one or more corpora from the search engine to recommend to the user.
[0030] Optionally, obtaining one or more pieces of corpus from a local corpus based on the phrase to recommend to the user includes:
[0031] Acquire one or more pieces of corpus corresponding to the phrase, and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus;
[0032] Obtaining one or more service parameters corresponding to the user input;
[0033] In the case where the business parameter belongs to the preset weight parameter corresponding to the corpus, calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter;
[0034] One or more corpora are selected in descending order according to the weight scores corresponding to the corpora to be recommended to the user.
[0035] Optionally, it further includes: a user input processing module; wherein,
[0036] The user input processing module is configured to delete one or more of the following contents from the user input before determining whether there is a phrase matching the user input in the local vocabulary: stop words, punctuation marks, special characters, and emoticons.
[0037] Optionally, it further includes: a vocabulary preprocessing module; wherein,
[0038] The vocabulary preprocessing module is used to determine whether the version corresponding to the local vocabulary is the latest version before determining whether there is a phrase matching the user input in the local vocabulary, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
[0039] Optionally, the vocabulary preprocessing module is further used to:
[0040] Before determining whether there is a phrase matching the user input in the local vocabulary, determine whether the local vocabulary is available: if available, continue to determine whether there is a phrase matching the user input in the local vocabulary; if not available, send the user input to the search engine.
[0041] Optionally, the vocabulary preprocessing module is also used to set the local vocabulary to be unavailable when any of the following situations occurs: the user is a blacklisted user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than a threshold response time, and the number of user inputs received is greater than a threshold user input number.
[0042] Optionally, the vocabulary preprocessing module further includes one or more of the following pluggable components: a switch component, a fuse current limiting component, and a flow distribution component; wherein,
[0043] The switch component is used to determine whether the user is a blacklisted user or whether the current time period is an unavailable time period;
[0044] The circuit breaker and current limiting component is used to determine whether the response time corresponding to the local vocabulary is greater than a threshold response time;
[0045] The traffic distribution component is used to determine whether the number of received user inputs is greater than a threshold number of user inputs.
[0046] Optionally, the vocabulary preprocessing module further includes: a business tracking component; wherein,
[0047] The business tracking component is used to collect the user input through tracking technology, recommend to the user one or more corpora corresponding to the user input, and the corpora clicked by the user, so as to update the local vocabulary and the local corpus.
[0048] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, an electronic device for recommending input corpus is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described above in the method for recommending input expectations.
[0049] To achieve the above object, according to one aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, any of the methods described above in the method for recommending input expectations is implemented.
[0050] One embodiment of the above invention has the following advantages or beneficial effects: by matching the phrase corresponding to the user input in the local lexicon before using the search engine to recommend corpus, and then obtaining one or more corpora from the local corpus based on the phrase to recommend to the user, the efficiency of corpus acquisition is improved, the response time is reduced, the immediacy of the recommended corpus is guaranteed, and the user experience is improved; at the same time, when the corresponding phrase cannot be matched in the local lexicon, the reliability and universality of the corpus recommendation are guaranteed by continuing to use the search engine to obtain one or more corpora to recommend to the user.
[0051] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0053] Figure 1 is a schematic diagram of the main process of the input corpus recommendation method according to an embodiment of the present invention;
[0054] Figure 2 is a schematic diagram of the main process of the phrase matching method according to an embodiment of the present invention;
[0055] Figure 3 A schematic diagram of a mapping relationship of a local vocabulary according to an embodiment of the present invention;
[0056] Figure 4 is a schematic diagram of the main process of a method for acquiring corpus from a local corpus according to an embodiment of the present invention;
[0057] Figure 5 is a schematic diagram of a mapping relationship of a local corpus according to an embodiment of the present invention;
[0058] Figure 6 is a schematic diagram of the main process of another input corpus recommendation method according to an embodiment of the present invention;
[0059] Figure 7a is a schematic diagram of main modules of an input corpus recommendation apparatus according to an embodiment of the present invention;
[0060] Figure 7b 2 is a schematic diagram of the main structure of a vocabulary preprocessing module according to an embodiment of the present invention;
[0061] Figure 8 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0062] Figure 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0064] Figure 1 FIG. 1 is a schematic diagram of the main flow of the method for recommending input corpus according to an embodiment of the present invention. Figure 1 As shown, the input corpus recommendation method may specifically include the following steps:
[0065] Step S101: receiving user input.
[0066] User input refers to any text information entered by a user during text communication, such as "hello" and "where are you" which are often entered when communicating with online customer service.
[0067] Step S102: Generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary. If so, proceed to step S103; if not, proceed to step S104.
[0068] The local vocabulary is composed of one or more phrases extracted from one or more high-frequency corpora frequently input by users. For example, taking the frequently input corpora "Hello, are you there?" and "Hello, how are you?" as examples, the corresponding phrase is "Hello"; while the corpora "Is this product on sale?" and "Is this dress on sale?" correspond to "Discount." It is understandable that users may enter tens of thousands of corpora, and the corresponding phrases may also be tens of thousands of corpora. In order to further improve the efficiency of obtaining corpora corresponding to user input from the local database, only some frequently input high-frequency corpora or popular corpora can be stored in the local corpus. Accordingly, only one or more popular phrases corresponding to the high-frequency corpora are stored in the local vocabulary, such as "Hello," "Coupon," "Discount," "Return," and "Exchange." More specifically, the local vocabulary and local corpora can be directly stored in the local cache to facilitate rapid retrieval of the corresponding corpora upon receiving user input. It is worth noting that the local cache only stores high-frequency corpus and high-frequency phrases, while the storage space such as Redis used by the search engine stores the full amount of user input corpus and corresponding phrases.
[0069] Specifically, the generating of a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary includes: querying the local vocabulary to determine whether there is a phrase corresponding to the phrase identifier; if so, there is a phrase matching the user input in the local vocabulary; if not, there is no phrase matching the user input in the local vocabulary.
[0070] The index number is used to logically isolate multiple local lexicons to improve local lexicon search efficiency. Each lexicon has a unique index number, which can be composed of any one or more of numbers, characters, and special symbols. Specifically, a hash operation can be performed on the index number corresponding to the currently available local lexicon and the user input to generate a fixed-length phrase identifier, i.e., a token value. The token value is then used to determine whether a phrase corresponding to the token value exists in the local lexicon. If so, it indicates that a phrase matching the user input exists in the local lexicon. If not, it indicates that a word matching the user input does not exist in the local lexicon.
[0071] It is understandable that if a phrase corresponding to the user input can be matched in the local vocabulary, it indicates that the content input by the user is very likely to be frequently used high-frequency corpus, and therefore one can consider obtaining one or more corresponding corpora in the local corpus without having to remotely call the search engine to obtain the corpus, thereby improving the efficiency of obtaining recommended corpora; if a phrase corresponding to the user input cannot be matched in the local vocabulary, it indicates that the content input by the user is very likely not to be frequently used high-frequency corpus, and the recommended corpus cannot be obtained from the local corpus, but at the same time, in order to assist the user in input, the user input is sent directly to the search engine to obtain recommended corpora from the search engine, to ensure that the user input can always be assisted to improve the user experience.
[0072] In an optional embodiment, the method further includes removing one or more of the following from the user input before determining whether a phrase matching the user input exists in the local vocabulary: stop words, punctuation marks, special characters, and emoticons. This removes meaningless characters from the user input, allowing for a more accurate match to the corresponding phrase from the local vocabulary.
[0073] In an optional embodiment, the method further includes: before determining whether there is a phrase matching the user input in the local vocabulary, determining whether the version corresponding to the local vocabulary is the latest version, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
[0074] Among them, the latest version of the vocabulary can be either the latest updated vocabulary based on newly generated hot words or high-frequency words, or a specific vocabulary applicable to the current business time period. For example, in the retail business field, the high-frequency corpus input by users in different time periods is different. For example, during the Double Eleven promotion, due to the large order volume and relatively slow delivery speed, users often inquire about logistics, delivery time and other information. Therefore, the latest version of the vocabulary can be generated based on the high-frequency corpus used by users during the Double Eleven promotion, so that the corresponding vocabulary can be used during the Double Eleven promotion to improve the local matching efficiency of the corpus.
[0075] In an optional embodiment, before determining whether a phrase matching the user input exists in the local vocabulary, the method further includes determining whether the local vocabulary is available. If so, the method further determines whether a phrase matching the user input exists in the local vocabulary. If not, the method sends the user input to the search engine. In other words, the local vocabulary can be selectively enabled for associative input assistance, thereby improving the versatility of the input prediction recommendation method provided by this embodiment.
[0076] Furthermore, the local vocabulary is set to unavailable when any of the following situations occurs: the user is a blacklisted user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than the threshold response time, and the number of user inputs received is greater than the threshold user input number.
[0077] Blacklisted users refer to one or more users who can only use search engines and cannot retrieve the corresponding corpus through local matching. Therefore, by setting a blacklist of users or a percentage of blacklisted users, the number of user inputs retrieved from the local lexicon can be reasonably limited to alleviate processing pressure. Unavailable time periods are time periods set based on business adjustment requirements or the changing pattern of user input volume. These can be expressed in years, months, days, hours, minutes, seconds, etc. For example, between 1:00 AM and 5:00 AM each day, fewer users consult and the corresponding number of user inputs is relatively small. To conserve resources, the local lexicon can be disabled, and all corpus can be retrieved from the search engine. For example, if the response time for retrieval of the corpus corresponding to user input from the local database exceeds 500ms, retrieval of the corresponding corpus from the local database is not significantly more efficient than from the search engine. Therefore, to improve efficiency, retrieval of the corpus from the search engine is considered. The threshold number of user inputs is designed to reasonably limit the number of user inputs that need to be processed locally to alleviate processing pressure and ensure the efficiency of retrieval of the corpus from the local database.
[0078] More specifically, the local vocabulary is set to unavailable based on one or more pluggable components, such as using a switch component to determine whether the user is a blacklisted user or whether the current time period is an unavailable time period; based on a fuse and current limiting component, determining whether the response time corresponding to the local vocabulary is greater than a threshold response time; based on a traffic distribution component, determining whether the number of user inputs received is greater than a threshold number of user inputs.
[0079] Step S103: obtaining one or more pieces of corpus from a local corpus according to the phrase to recommend to the user.
[0080] In an optional embodiment, obtaining one or more pieces of corpus from the local corpus based on the phrase to recommend to the user includes: obtaining one or more pieces of corpus corresponding to the phrase and one or more preset weight parameters corresponding to the corpus from the local corpus; obtaining one or more business parameters corresponding to the user input; calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter when the business parameter belongs to the preset weight parameter corresponding to the corpus; and selecting one or more corpora to recommend to the user according to the weight scores corresponding to the corpus in descending order.
[0081] Business parameters include, but are not limited to, the user's entry point for text communication, channel, terminal type, item information, merchant information, order information, logistics information, and business domain. The text communication entry point refers to the interface a user clicks to enter text communication, such as the item details page, item homepage, or order homepage; the text communication channel refers to HTML5 pages, mini-programs, and apps; the user terminal type refers to devices such as iOS and Android; item information refers to the item identification, color, size, price, model, and three-level classification information corresponding to the item the user is inquiring about; merchant information refers to merchant identification and merchant rating; and the business domain refers to logistics, retail, blockchain, and other business types, as categorized by business type. Preset weight parameters refer to information such as item identification, merchant identification, and item type, set based on actual needs. This means that the business parameters corresponding to user input may or may not be the preset weight parameters corresponding to the corpus. Each preset weight parameter is associated with a weight, and the weights corresponding to different preset weight parameters can be the same or different.
[0082] Specifically, the business parameters include product identification, merchant identification, and product classification as SKUA, merchant a, and mobile phone, and the preset weight parameters corresponding to the corpus obtained from the local corpus are shown in Table 1 below as an example: For corpus 1, it can be determined that SKUA and mobile phone in the business parameters are the preset weight parameters corresponding to corpus 1, and then the corresponding weight score of corpus 1 can be calculated as 4 by adding the corresponding weights; for corpus 2, it can be determined that SKUA, merchant a, and mobile phone in the business parameters are all the preset weight parameters corresponding to corpus 2, and then the corresponding weight score of corpus 2 can be calculated as 6 by adding the corresponding weights; for corpus 3, it can be determined that merchant a in the business parameters is the preset weight parameter corresponding to corpus 3, and then the corresponding weight score of corpus 3 can be determined as 2 by adding the weights; for corpus 4, since none of the business parameters are the corresponding preset weight parameters, the corresponding weight score defaults to 0. Based on this, the weight scores corresponding to Corpus 1, Corpus 2, Corpus 3, and Corpus 4 can be determined to be 4, 6, 2, and 0, respectively. Furthermore, the corpora can be sorted in descending order of weight scores as Corpus 2, Corpus 1, Corpus 3, and Corpus 4, so that one or more corpora can be recommended to the user in that order. For example, when recommending one corpus to the user, Corpus 2 is recommended, while when recommending two corpora to the user, Corpus 2 and Corpus 1 are recommended. In this way, the corpora obtained from the local corpus are filtered by business parameters, further improving the accuracy of corpus recommendations to users.
[0083] Table 1 Preset weight parameters and weight examples corresponding to the corpus
[0084]
[0085] Step S104: sending the user input to a search engine to obtain one or more corpora from the search engine to recommend to the user.
[0086] Specifically, with the diversification of business fields, such as retail, logistics, and finance, the user input corpus, high-frequency corpus, and local vocabulary corresponding to each business field are unique and different. Therefore, to improve the assistance effect of user input in different business fields, different search engines can be used for different business fields. When receiving user input, the user input can be diverted according to the business field corresponding to the user input. Correspondingly, when receiving user input, the local vocabulary of the business field corresponding to the user input can be used for phrase matching.
[0087] It is understandable that with the development of business areas, the update of items, etc., the high-frequency corpus and hot words corresponding to user input at different stages are constantly changing. In order to meet the ever-changing needs of text communication, it is necessary to continuously update the local vocabulary, local corpus, and the full amount of corpus and phrases stored in the search engine. Based on this, in an optional implementation, the user input, one or more corpora corresponding to the user input recommended to the user, and the corpus clicked by the user are collected through the embedding technology to update the local vocabulary and the local corpus.
[0088] More specifically, a pluggable business tracking component collects user input, recommends one or more corpora corresponding to the user input, and the corpora clicked by the user. In other words, the vocabulary and corpora corresponding to the user input are continuously updated based on the user's clicks on the recommended corpora, thereby improving the reliability of input association assistance.
[0089] Based on the above embodiment, before using the search engine to recommend corpus, the phrase corresponding to the user input is first matched in the local lexicon, and then one or more corpora are obtained from the local corpus based on the phrase to recommend to the user. This improves the efficiency of corpus acquisition, reduces the response time, ensures the immediacy of the recommended corpus, and improves the user experience. At the same time, when the corresponding phrase cannot be matched in the local lexicon, the reliability and universality of the corpus recommendation are ensured by continuing to use the search engine to obtain one or more corpora to recommend to the user.
[0090] See also Figure 2 Based on the above embodiment, the present invention provides a phrase matching method to explain the above step S102 in detail. The phrase matching method specifically includes the following steps:
[0091] Step S1021: Generate a phrase identifier according to the user input and the index number corresponding to the local vocabulary.
[0092] Specifically, a hash operation can be performed on the index number corresponding to the currently available local vocabulary and the user input to generate a fixed-length phrase identifier, namely a token value, so as to determine whether a phrase corresponding to the token value exists in the local vocabulary based on the token value.
[0093] Step S1022, query the local vocabulary to determine whether there is a phrase corresponding to the phrase identifier; if so, proceed to the following step S1023; if not, proceed to the following step S1024.
[0094] Specifically, see Figure 3 As shown in the local vocabulary mapping relationship diagram, after performing a hash operation on the index number corresponding to the local vocabulary and the user input to generate a phrase identifier of a fixed length (such as 994754697 as shown in the figure), the phrase identifier can be used to query in the local vocabulary to determine whether the phrase identifier has a corresponding phrase (such as hello, etc.) in the local vocabulary.
[0095] Step S1023: There is a phrase matching the user input in the local vocabulary.
[0096] Still taking the phrase identifier 994754697 as an example, since the phrase "hello" corresponding to the phrase identifier exists in the local vocabulary, one or more corpora corresponding to the phrase "hello" can be further obtained for recommendation.
[0097] Step S1024: There is no phrase matching the user input in the local vocabulary.
[0098] Specifically, according to the business field corresponding to the user input, the user input is directly sent to the corresponding search engine to obtain one or more corpora for recommendation.
[0099] See also Figure 4 Based on the above embodiment, the present invention provides a method for obtaining corpus from a local corpus to explain the above step S103 in detail. The method specifically includes the following steps:
[0100] Step S1031 : obtaining one or more pieces of corpus corresponding to the phrase and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus.
[0101] Specifically, see Figure 5The mapping relationship of the local corpus shown is still explained by taking the phrase "hello" determined from the local vocabulary as an example. Then, all the corpora under "hello" can be obtained from the local corpus, namely "how are you?", "how are you?", etc. It is understandable that in different businesses or different scenarios, when the phrases matched by the user input are all "hello", the completed corpora that the user wants to enter are also very likely to be different. Therefore, in order to improve the accuracy of the input corpora recommended to the user, the corpora can be sorted and filtered based on the business parameters corresponding to the user input. Furthermore, each corpus corresponds to one or more preset weight parameters, namely VenderID (supplier identification), ThirdCat (three-level product classification), etc.
[0102] Step S1032: Obtain one or more service parameters corresponding to the user input.
[0103] Step S1033 , when the business parameter belongs to the preset weight parameter corresponding to the corpus, a weight score corresponding to the corpus is calculated according to the weight corresponding to the business parameter.
[0104] Specifically, see Figure 5 , taking "Hello, are you there?" and "Hello, how are you?" as examples, the preset weight parameters corresponding to "Hello, are you there?" are VenderID and ThirdCat, and the corresponding weights are 1 and 5 respectively, while the preset weight corresponding to "Hello, how are you?" is color (item color), and the corresponding weight is 3; if the business parameters corresponding to the user input "Hello" contain VenderID, ThirdCat and color, then the weight scores corresponding to the corpus "Hello, are you there?" and "Hello, are you there?" can be calculated as 6 and 3 respectively; on this basis, if only one corpus is promoted to the user, the corpus with the highest weight score "Hello, are you there?" is selected and recommended to the user.
[0105] Step S1034: selecting one or more corpora to recommend to the user according to the weight scores corresponding to the corpora from high to low.
[0106] See also Figure 6 Based on the above embodiment, the present invention provides another method for recommending input corpus, which may include the following steps:
[0107] Step S601: receiving user input.
[0108] Step S602: Determine whether the local vocabulary is available. If it is available, proceed to step S603; if not, proceed to step S608.
[0109] Step S603: Determine whether the version of the local vocabulary is the latest version. If it is the latest version, proceed to step S605; if not, proceed to step S604.
[0110] Step S604: Obtain the latest version of the vocabulary from the search engine.
[0111] Specifically, by remote full synchronization, the latest version of the vocabulary is loaded from the search engine to be stored in the local cache. It is understandable that when the latest version of the vocabulary is loaded from the search engine, the local corpus corresponding to the latest version of the vocabulary is loaded.
[0112] Step S605: Delete one or more of the following contents from the user input: stop words, punctuation marks, special characters, and emoticons.
[0113] Step S606: Determine whether there is a phrase matching the user input in the local word library. If so, proceed to step S607; if not, proceed to step S608.
[0114] Step S607: Obtain one or more pieces of corpus from the local corpus according to the phrase to recommend to the user.
[0115] Specifically, a hash operation can be performed on the index number corresponding to the currently available local vocabulary and the user input to generate a phrase identifier of a fixed length, that is, a token value, so as to determine whether there is a phrase corresponding to the token value in the local vocabulary based on the token value. If so, it means that there is a phrase in the local vocabulary that matches the user input. If not, it means that there is no word in the local vocabulary that matches the user input.
[0116] Step S608: Send the user input to a search engine to obtain one or more corpora from the search engine to recommend to the user.
[0117] Specifically, one or more pieces of corpus corresponding to the phrase and one or more preset weight parameters corresponding to the corpus are obtained from the local corpus; one or more business parameters corresponding to the user input are obtained; when the business parameters belong to the preset weight parameters corresponding to the corpus, the weight score corresponding to the corpus is calculated according to the weight corresponding to the business parameters; one or more corpora are selected in descending order according to the weight scores corresponding to the corpus to recommend to the user.
[0118] See also Figure 7a Based on the above embodiment, the present invention provides an input corpus recommendation device 700, comprising: a user input receiving module 701, a corpus acquisition module 704; wherein,
[0119] The user input receiving module 701 is used to receive user input;
[0120] The corpus acquisition module 704 is configured to generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary, so as to determine whether there is a phrase matching the user input in the local vocabulary.
[0121] If so, obtaining one or more pieces of text from the local corpus according to the phrase to recommend to the user;
[0122] If not, the user input is sent to a search engine to obtain one or more corpora from the search engine to recommend to the user.
[0123] In an optional embodiment, obtaining one or more pieces of text from a local corpus based on the phrase to recommend to the user includes:
[0124] Acquire one or more pieces of corpus corresponding to the phrase, and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus;
[0125] Obtaining one or more service parameters corresponding to the user input;
[0126] In the case where the business parameter belongs to the preset weight parameter corresponding to the corpus, calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter;
[0127] One or more corpora are selected in descending order according to the weight scores corresponding to the corpora to be recommended to the user.
[0128] In an optional embodiment, it further includes: a user input processing module 703; wherein,
[0129] The user input processing module 703 is configured to delete one or more of the following from the user input before determining whether there is a phrase matching the user input in the local vocabulary: stop words, punctuation marks, special characters, and emoticons.
[0130] In an optional embodiment, it further includes: a vocabulary pre-processing module 702; wherein,
[0131] The vocabulary preprocessing module is used to determine whether the version corresponding to the local vocabulary is the latest version before determining whether there is a phrase matching the user input in the local vocabulary, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
[0132] In an optional embodiment, the vocabulary preprocessing module 702 is further configured to:
[0133] Before determining whether there is a phrase matching the user input in the local vocabulary, determine whether the local vocabulary is available: if available, continue to determine whether there is a phrase matching the user input in the local vocabulary; if not available, send the user input to the search engine.
[0134] In an optional embodiment, the vocabulary preprocessing module 702 is also used to set the local vocabulary to be unavailable when any of the following situations occurs: the user is a blacklisted user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than the threshold response time, and the number of user inputs received is greater than the threshold user input number.
[0135] Specifically, see Figure 7b The vocabulary pre-processing module 703 further includes one or more of the following pluggable components: a switch component 7031, a fuse current limiting component 7032, and a flow distribution component 7033; wherein,
[0136] The switch component 7031 is used to determine whether the user is a blacklisted user or whether the current time period is an unavailable time period;
[0137] The circuit breaker and current limiting component 7032 is used to determine whether the response time corresponding to the local vocabulary is greater than a threshold response time;
[0138] The traffic distribution component 7033 is used to determine whether the number of received user inputs is greater than a threshold number of user inputs.
[0139] Further, see Figure 7b The word library pre-processing module 703 further includes: a pluggable business tracking component 7034; wherein,
[0140] The business tracking component 7034 is used to collect the user input through tracking technology, recommend to the user one or more corpora corresponding to the user input, and the corpora clicked by the user to update the local vocabulary and the local corpus.
[0141] It is worth noting that one or more pluggable components provided in this embodiment can be combined and integrated into the input corpus recommendation device by means of assembly and disassembly, so as to achieve the versatility of the input corpus recommendation device.
[0142] Figure 8 An exemplary system architecture 800 is shown to which the input corpus recommendation method or input prediction recommendation apparatus according to the embodiments of the present invention may be applied.
[0143] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0144] Users can use terminal devices 801, 802, and 803 to interact with server 805 via network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0145] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0146] Server 805 may be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 801, 802, and 803. The backend management server may analyze and process received user input, and feed back processing results, such as one or more pieces of corpus corresponding to the user input, to the terminal device.
[0147] It should be noted that the input corpus recommendation method provided in the embodiment of the present invention is generally executed by the server 805 , and accordingly, the input corpus recommendation device is generally provided in the server 805 .
[0148] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0149] Reference below Figure 9 , which shows a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Figure 9 The terminal device 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.
[0150] like Figure 9As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage unit 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the system 900 are also stored in the RAM 903. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0151] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output section 907 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card or a modem. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 910 as needed, so that computer programs read therefrom can be installed into the storage section 908 as needed.
[0152] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from a removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are performed.
[0153] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0155] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided in a processor. For example, they may be described as comprising a user input receiving module and a corpus acquisition module. The names of these modules do not, in some cases, limit the modules themselves. For example, a user input receiving module may also be described as a "module for receiving user input."
[0156] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be incorporated into the device. The computer-readable medium carries one or more programs. When executed by a device, the device is configured to: receive user input; generate a phrase identifier based on the user input and an index number corresponding to a local vocabulary to determine whether a phrase matching the user input exists in the local vocabulary; if so, obtain one or more pieces of text from the local corpus based on the phrase to recommend to the user; if not, send the user input to a search engine to obtain one or more pieces of text from the search engine to recommend to the user.
[0157] According to the technical solution of the embodiment of the present invention, before using the search engine to recommend corpus, the phrase corresponding to the user input is first matched in the local lexicon, and then one or more corpora are obtained from the local corpus based on the phrases to recommend to the user. This improves the efficiency of corpus acquisition, reduces the response time, ensures the immediacy of the recommended corpora, and improves the user experience. At the same time, when the corresponding phrase cannot be matched in the local lexicon, the reliability and universality of the corpus recommendation are ensured by continuing to use the search engine to obtain one or more corpora for recommendation to the user.
[0158] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A method for recommending input corpus, characterized in that: include: Receive user input; Generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary: If so, obtaining one or more pieces of text from the local corpus according to the phrase to recommend to the user; If not, sending the user input to a search engine to obtain one or more corpora from the search engine to recommend to the user; Collect the user input, recommend one or more corpora corresponding to the user input, and corpora clicked by the user through a tracking technology to update the local vocabulary and the local corpus; Among them, the local vocabulary is composed of one or more phrases extracted from one or more high-frequency corpora frequently input by users; each vocabulary has a unique corresponding index number, which is used to achieve logical isolation of multiple different local vocabulary libraries. A hash operation is performed on the index number corresponding to the currently available local vocabulary library and the user input to generate a phrase identifier of fixed length.
2. The input corpus recommendation method according to claim 1, characterized in that: The acquiring one or more pieces of corpus from the local corpus according to the phrase to recommend to the user includes: Acquire one or more pieces of corpus corresponding to the phrase, and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus; Obtaining one or more service parameters corresponding to the user input; In the case where the business parameter belongs to the preset weight parameter corresponding to the corpus, calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter; One or more corpora are selected in descending order according to the weight scores corresponding to the corpora to be recommended to the user.
3. The input corpus recommendation method according to claim 1, characterized in that: Also includes: Before determining whether there is a phrase matching the user input in the local vocabulary, one or more of the following contents are deleted from the user input: stop words, punctuation marks, special characters, and emoticons.
4. The input corpus recommendation method according to claim 1, characterized in that: Also includes: Before determining whether there is a phrase matching the user input in the local vocabulary, determine whether the version corresponding to the local vocabulary is the latest version, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
5. The input corpus recommendation method according to claim 1, characterized in that: Also includes: Before determining whether there is a phrase matching the user input in the local vocabulary, determining whether the local vocabulary is available: if available, continuing to determine whether there is a phrase matching the user input in the local vocabulary; If not available, the user input is sent to the search engine.
6. The input corpus recommendation method according to claim 5, characterized in that: The local vocabulary is set to unavailable when any of the following situations occurs: the user is a blacklist user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than the threshold response time, and the number of user inputs received is greater than the threshold user input number.
7. The input corpus recommendation method according to claim 1, characterized in that: Setting the local vocabulary to be unavailable based on one or more pluggable components; The pluggable business tracking component collects the user input, recommends to the user one or more corpora corresponding to the user input, and the corpora clicked by the user.
8. A device for recommending input corpus, characterized in that: include: User input receiving module, corpus acquisition module, business tracking component; among them, The user input receiving module is used to receive user input; The corpus acquisition module is used to generate a phrase identifier based on the user input and the index number corresponding to the local vocabulary to determine whether there is a phrase matching the user input in the local vocabulary: If so, obtaining one or more pieces of text from the local corpus according to the phrase to recommend to the user; If not, sending the user input to a search engine to obtain one or more corpora from the search engine to recommend to the user; The business tracking component is used to collect the user input, recommend one or more corpora corresponding to the user input, and corpora clicked by the user through tracking technology to update the local vocabulary and the local corpus; Among them, the local vocabulary is composed of one or more phrases extracted from one or more high-frequency corpora frequently input by users; each vocabulary has a unique corresponding index number, which is used to achieve logical isolation of multiple different local vocabulary libraries. A hash operation is performed on the index number corresponding to the currently available local vocabulary library and the user input to generate a phrase identifier of fixed length.
9. The input corpus recommendation device according to claim 8, characterized in that: The acquiring one or more pieces of corpus from the local corpus according to the phrase to recommend to the user includes: Acquire one or more pieces of corpus corresponding to the phrase, and one or more preset weight parameters corresponding to the pieces of corpus from the local corpus; Obtaining one or more service parameters corresponding to the user input; In the case where the business parameter belongs to the preset weight parameter corresponding to the corpus, calculating the weight score corresponding to the corpus according to the weight corresponding to the business parameter; One or more corpora are selected in descending order according to the weight scores corresponding to the corpora to be recommended to the user.
10. The input corpus recommendation device according to claim 8, characterized in that: Also includes: User input processing module; wherein, The user input processing module is configured to delete one or more of the following contents from the user input before determining whether there is a phrase matching the user input in the local vocabulary: stop words, punctuation marks, special characters, and emoticons.
11. The input corpus recommendation device according to claim 8, characterized in that: Also includes: Thesaurus preprocessing module; among them, The vocabulary preprocessing module is used to determine whether the version corresponding to the local vocabulary is the latest version before determining whether there is a phrase matching the user input in the local vocabulary, so as to obtain the latest version of the vocabulary from the search engine if the version corresponding to the local vocabulary is not the latest version.
12. The input corpus recommendation device according to claim 8, characterized in that: The vocabulary preprocessing module is also used to: Before determining whether there is a phrase matching the user input in the local vocabulary, determining whether the local vocabulary is available: if available, continuing to determine whether there is a phrase matching the user input in the local vocabulary; If not available, the user input is sent to the search engine.
13. The input corpus recommendation device according to claim 8, characterized in that: The vocabulary preprocessing module is also used to: The local vocabulary is set to unavailable when any of the following situations occurs: the user is a blacklist user, the current time period is a preset unavailable time period, the response time corresponding to the local vocabulary is greater than the threshold response time, and the number of user inputs received is greater than the threshold user input number.
14. The input corpus recommendation device according to claim 13, characterized in that: The vocabulary preprocessing module also includes one or more of the following pluggable components: a switch component, a fuse current limiting component, and a flow distribution component; wherein, The switch component is used to determine whether the user is a blacklisted user or whether the current time period is an unavailable time period; The circuit breaker and current limiting component is used to determine whether the response time corresponding to the local vocabulary is greater than a threshold response time; The traffic distribution component is used to determine whether the number of received user inputs is greater than a threshold number of user inputs.
15. An electronic device for recommending input corpus, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
16. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method, equipment, server and system for inputting characters by user
CN102063194A
Search method and search devices
CN107609098A