Search result processing method and device
By filtering the similarities between vectors of the context of the search word and the context of the search result in the search engine, the problem of inaccurate search results in the existing technology, especially when the search word is ambiguous, , Achieve more accurate search results.
Patent Information
- Application Number
- CN202011345102.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-26
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2040-11-26
AI Technical Summary
In the prior art, when a user initiates a search by pressing a word for a long time, the context information of the search term in the current reading scene is not effectively utilized, resulting in inaccurate search results, especially when there is ambiguity in the search term.
By obtaining a search word based on text input, determine whether it is ambiguous. If so, determine its above -or -context information according to the context information of the search word, and to handle the same processing results. The similarity of the search results, which then filter out the search results with a degree of similarity less than the threshold.
Through the disadvantage and filtering of context information, the accuracy of the search results is improved, making it more in line with the user's search needs in specific reading scenarios.
Smart Images

Figure CN112347339B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a search result processing method and device. Background Art
[0002] With the development of Internet search engines, search needs are everywhere. For example, in a common reading scenario, when a user sees a word of interest that needs to be searched, he can long press the word on the screen, and then the system can determine the corresponding search word according to the position of the finger long press, and prompt the user to initiate a "search" operation. After clicking, the search result of the search word can be obtained. However, in the related technology, the selected word is directly used as the search word, and the returned search result is the same as the result of the user actively entering the search word in the search box without any processing. The search result cannot perceive the specific meaning information of the search word in the current reading scenario, which leads to inaccurate search results. Summary of the invention
[0003] The embodiments of the present application provide a search result processing method and device to improve the accuracy of search results.
[0004] The specific technical solutions provided by the embodiments of this application are as follows:
[0005] In one embodiment of the present application, a search result processing method is provided, including:
[0006] Acquire a search term based on text input, and when determining that the search term is an ambiguous term, determine a context representation vector of the search term according to context information corresponding to the search term in the text;
[0007] Obtaining search results corresponding to the search term, and determining context representation vectors for the search results;
[0008] Determining the similarity between the search term and each of the search results respectively according to the context representation vector of the search term and the context representation vector of each of the search results;
[0009] The search results are filtered according to the determined similarities to obtain filtered search results.
[0010] In another embodiment of the present application, a search result processing device is provided, comprising:
[0011] An acquisition module, used to acquire search terms based on text input;
[0012] A first determination module, configured to determine, when determining that the search term is an ambiguous term, a context representation vector of the search term based on context information corresponding to the search term in the text;
[0013] A second determination module is used to obtain each search result corresponding to the search term and determine a context representation vector of each search result;
[0014] A third determination module, configured to determine the similarity between the search term and each of the search results according to the context representation vector of the search term and the context representation vector of each of the search results;
[0015] The filtering module is used to filter the search results according to the determined similarities to obtain filtered search results.
[0016] In another embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of any of the above-mentioned search result processing methods when executing the program.
[0017] In another embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned search result processing methods are implemented.
[0018] Another embodiment of the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes any one of the search result processing methods provided in the above various optional implementations.
[0019] In an embodiment of the present application, a search term based on text input is obtained, and when it is determined that the search term is an ambiguous term, a context representation vector of the search term is determined based on context information corresponding to the search term in the text, and search results corresponding to the search term are obtained, and context representation vectors of each search result are determined respectively, and then similarities between the search term and each search result are determined respectively based on the context representation vector of the search term and the context representation vector of each search result, and the search results are filtered based on the determined similarities to obtain filtered search results. In this way, for each obtained search result, each search result can be screened and filtered based on the context information of the search term and the context information of each search result, so that the filtered search results are more consistent with the context information of the search term, thereby improving the accuracy of the search results. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 This is a schematic diagram of the application architecture of the search result processing method in the embodiment of the present application;
[0021] Figure 2 This is a flow chart of the search result processing method in the embodiment of the present application;
[0022] Figure 3 A schematic diagram of crawling words with polysemous identifiers from a search engine in an embodiment of the present application;
[0023] Figure 4 This is a schematic diagram of the principle of the word vector model in the embodiment of the present application;
[0024] Figure 5 This is a schematic diagram of an interface for initiating a search process in an embodiment of the present application;
[0025] Figure 6 A schematic diagram of returning search results in the related art;
[0026] Figure 7 A schematic diagram of returning search results in an embodiment of the present application;
[0027] Figure 8 This is a schematic diagram of the structure of a search result processing device in an embodiment of the present application;
[0028] Fig. 9 Schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0030] To facilitate understanding of the embodiments of the present application, several concepts are briefly introduced below:
[0031] Fingertip search terms: In the embodiments of the present application, fingertip search terms refer to search terms evoked by fingers, rather than search terms actively entered by the user in the search box. It is usually a scenario in which words are selected and searched in a text by fingers. For example, in a reading scenario, the user can long press a certain word position, and the corresponding search term can be determined according to the position of the user's long press finger, and click the search operation to obtain the search results of the search term. The search terms mentioned in the embodiments of the present application mainly refer to fingertip search terms. Of course, the embodiments of the present application are not limited to fingertip search terms, but can also be any search terms in the scenario of initiating a search in a text.
[0032] Ambiguous words: In the embodiments of the present application, ambiguous words represent words with at least two different semantics, which can also be called polysemous words. For example, "BD" may have multiple interpretations, for example, it can be interpreted as business development (BD) and can also be interpreted as Blu-ray Disc (BD), that is, "BD" is an ambiguous word.
[0033] Keywords: Keywords are usually words that can represent the subject of an article, search results, etc. and have substantive meaning. There are currently a variety of methods for extracting keywords, and the embodiments of the present application do not limit the method for extracting keywords.
[0034] Context representation vector: The context representation vector in the embodiment of the present application is mainly used to reflect context information and can be determined based on the extracted keywords.
[0035] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0036] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0037] Natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language used by people in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes technologies such as text processing, semantic understanding, machine translation, robot question and answer, knowledge graph, etc. For example, the embodiments of the present application mainly involve natural language processing technology, which can segment the text where the search word is located or the search result, and perform operations such as keyword extraction. For another example, contextual semantic analysis can also be performed on the search word and the keywords extracted from the search result, and then the context representation vector of the search word and the search result can be determined.
[0038] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, etc. With the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0039] The solution provided in the embodiments of the present application mainly relates to the natural language processing technology of artificial intelligence, which is specifically described by the following embodiments:
[0040] With the development of Internet search engines, search needs are everywhere. In addition to users actively typing search terms in the search box, users can also initiate a search process by selecting words in the text content. For example, in the reading scenario on a smart terminal, when a user sees a word of interest that needs to be searched, the user can long press the word on the screen, and then the system can determine the corresponding search term based on the position of the finger long press, and prompt the user to initiate a "search" operation. After clicking, the search result of the search term can be obtained. However, in the related art, the selected word is directly used as the search term, and is directly input into the search system without any processing. The returned search result is the same as the result of the user actively entering the search term in the search box. The search result cannot perceive the specific meaning information of the search term in the current reading scenario. Especially when the search term is ambiguous, the returned search result will be inaccurate and cannot meet user needs.
[0041] Therefore, in response to the above problems, a search result processing method is provided in an embodiment of the present application. When it is determined that a search term is an ambiguous term, a context representation vector of the search term is determined based on the context information corresponding to the search term in the text, and the context representation vectors of each search result corresponding to the search term are determined respectively. Based on the context representation vector of the search term and the context representation vector of each search result, the similarity between the search term and each search result is determined respectively, and then each search result is filtered according to the determined similarities. In this way, when it is determined that the search term is an ambiguous term, each search result can be disambiguated and filtered according to the context information of the search term, so that the returned search results are closer to the context or scene theme semantics of the search term, thereby improving the accuracy of the search results.
[0042] See also Figure 1 , which is a schematic diagram of the application architecture of the search result processing method in an embodiment of the present application, includes a terminal 100 and a server 200.
[0043] The terminal 100 may be any smart device such as a smart phone, a tablet computer, a portable personal computer, a desktop computer, a smart TV, a smart robot, an in-vehicle electronic device, etc. Various applications (Application, APP) may be installed on the terminal 100. For example, when a user is reading through an APP, such as reading a novel, reading a public account article, etc., and is interested in a certain word, the user may long press the word to invoke the search function, and then click the search button to send a search request based on the word to the server 200. Furthermore, in the embodiment of the present application, the terminal 100 may also send the context information of the word to the server 200. After receiving the search word, the server 200 determines the search results of the search word and determines that the search word is an ambiguous word. Then, the search results may be filtered according to the context information of the search word and the determined context information of each search result, and the filtered search results may be returned to the terminal 100. The terminal 100 displays the search results returned by the server 200. In this way, the returned search results are closer to the context information of the text where the search word is located, which improves the accuracy of the search results, and the returned search results are more in line with the user's search needs.
[0044] The server 200 can provide various network services for the terminal 100. For different applications, the server 200 can be considered as the corresponding background server, wherein the server 200 can be a single server, a server cluster consisting of several servers, or a cloud computing center.
[0045] The terminal 100 and the server 200 can be connected via the Internet to achieve mutual communication. Optionally, the above-mentioned Internet uses standard communication technology and / or protocol. The Internet is usually the Internet, but it can also be any network, including but not limited to any combination of a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a dedicated network or a virtual private network. In some embodiments, the data exchanged through the network is represented by technologies and / or formats including Hyper Text Mark-up Language (HTML), Extensible Markup Language (XML), etc. In addition, conventional encryption technologies such as Secure Socket Layer (SSL), Transport Layer Security (TLS), Virtual Private Network (VPN), Internet Protocol Security (IPsec) can also be used to encrypt all or some links. In other embodiments, customized and / or dedicated data communication technologies can also be used to replace or supplement the above-mentioned data communication technologies.
[0046] It is worth noting that the search result processing method in each embodiment of the present application can be executed by the server 200 side, and of course can also be executed by the terminal 100. This is not limited in the embodiments of the present application. Taking the execution by the server 200 as an example, the server 200 obtains the search term and the context information of the search term from the terminal 100, and then based on the search result processing method in the embodiment of the present application, filters each search result and only returns the filtered search result. For another example, taking the execution by the terminal 100 as an example, the terminal 100 sends a search request containing the search term to the server 200, and the server 200 returns each search result based on the search term, and then the terminal 100 performs filtering based on the search result processing method in the embodiment of the present application, that is, the terminal 100 filters each search result based on the context information of the search term and the context information of each search result, and displays the filtered search result to the user.
[0047] It should be noted that the application architecture diagram in the embodiment of the present application is to more clearly illustrate the technical solution in the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. It can be applied to scenarios such as reading on the terminal, and scenarios in which a search process is initiated by long pressing a finger. It can also be applied to other scenarios in which a search process is initiated for a certain word in context information, and is not limited. However, for other application architectures and business applications, the technical solution provided in the embodiment of the present application is also applicable to similar problems.
[0048] In each embodiment of the present application, the search result processing method is applied to Figure 1 The application architecture shown is used as an example for schematic description.
[0049] Based on the above embodiments, see Figure 2 As shown, it is a flow chart of the search result processing method in the embodiment of the present application, which is described by taking application to a server as an example. Specifically, the method includes:
[0050] Step 200: Obtain a search term based on text input, and when it is determined that the search term is an ambiguous term, determine a context representation vector of the search term based on context information corresponding to the search term in the text.
[0051] In the embodiments of the present application, the main focus is on scenarios where search terms with contextual information are based on text input, rather than entering the search terms in a search box. For example, when reading an article, a long press is performed to determine the search term and initiate the search process, thereby determining the contextual information of the search term in the article.
[0052] When executing step 200, it specifically includes:
[0053] S1. Obtain search terms based on text input.
[0054] S2. Determine whether the search term is an ambiguous term.
[0055] Specifically, according to the preset ambiguous word database, if it is determined that the search word is in the preset ambiguous word database, then the search word is determined to be an ambiguous word; if it is determined that the search word is not in the preset ambiguous word database, then the search word is determined to be not an ambiguous word.
[0056] Among them, ambiguous words represent words with at least two different semantics. For example, "The Legend of the Condor Heroes" is an ambiguous word, which can be expressed as a novel, a filmed movie, a filmed TV series, etc. The content of the movie or TV series is the script of the movie or TV series, not a novel, so the word is an ambiguous word.
[0057] The preset ambiguous word database is constructed based on at least words with polysemous word identifiers crawled from each preset search engine. The method of constructing the ambiguous word database in the embodiment of the present application is not limited, and other methods can also be used to collect ambiguous words, such as determining ambiguous words based on a dictionary database, or crawling from a search engine, etc.
[0058] For example, see Figure 3 As shown in FIG. 1 , a schematic diagram of crawling words with polysemous word identifiers from a search engine in an embodiment of the present application can be used to crawl information from a search engine offline, and words with polysemous word identifier fields can be identified based on a HyperText Markup Language (html) parsing tool, such as Figure 3 As shown, taking the word "BD" as an example, the description of BD in the search engine is that it is a polysemous word, and then by identifying the field, it can be determined that "BD" is a polysemous word, that is, "BD" can be added to the ambiguous word database.
[0059] Of course, other methods can also be used to determine whether a search term is an ambiguous term. Specifically, several other possible implementation methods are provided in the embodiments of the present application:
[0060] The first implementation method is to determine whether the search term contains polyphones. If it is determined that the search term contains polyphones, the search term is determined to be an ambiguous term.
[0061] The second implementation method is to determine whether the search term contains polysemous characters. If it is determined that the search term contains polysemous characters, the search term is determined to be an ambiguous word.
[0062] A third implementation method: a machine learning algorithm is used to pre-train an ambiguous word recognition model, and then the search word can be recognized based on the ambiguous word recognition model to determine whether the search word is an ambiguous word.
[0063] It should be noted that different implementation methods for determining ambiguous words may have different accuracy, and only a few reference embodiments are provided here. Different implementation methods for determining ambiguous words may be adopted according to actual conditions and requirements.
[0064] S3. When it is determined that the search term is an ambiguous term, a context representation vector of the search term is determined according to context information corresponding to the search term in the text.
[0065] In an embodiment of the present application, when it is determined that a search term is an ambiguous term, the search results can be filtered and screened through the context information of the search term. This is because if the search term is not an ambiguous term, that is, it has a unique specific meaning, then no matter what the context information of the search term is, the interpretation and search results of the search term are usually the same. Even if filtering is performed through the context information, it is not very meaningful and may increase the amount of calculation. Therefore, in an embodiment of the present application, ambiguous terms are mainly targeted and further filtered through context information.
[0066] Of course, in the embodiments of the present application, it is also possible not to determine whether it is an ambiguous word, and the context information is used to filter and screen the search results, and this is not limited in the embodiments of the present application.
[0067] The process of determining the context representation vector of the search term based on the context information corresponding to the search term in the text includes:
[0068] S3.1. Extract keywords from the context information corresponding to the search term in the text.
[0069] Furthermore, before extracting keywords, the context information is first segmented. Generally, Chinese word segmentation methods can be divided into three categories: dictionary-based word segmentation methods, statistics-based word segmentation methods, and semantics-based word segmentation methods.
[0070] Among them, 1) the word segmentation method based on the dictionary, which can also be called string matching, requires a Chinese dictionary to match the text to be segmented with the entries in the dictionary. If an entry is found, it means that the match is successful and a word is identified. For example, the word segmentation algorithm based on the dictionary can be divided into the following types: forward maximum matching method, reverse maximum matching method and two-way matching word segmentation method, etc. The word segmentation method based on the dictionary is faster and simpler to implement.
[0071] 2) Statistical word segmentation methods mainly count the frequencies of adjacent co-occurring word combinations in the corpus, and take the word segmentation result with the highest probability as the final result. For example, common statistical word segmentation methods include Hidden Markov Model (HMM) and Conditional Random Field (CRF) models. These methods can handle ambiguity and unregistered word problems well, but they require a large amount of manually labeled data and have a slow word segmentation speed.
[0072] 3) Semantic-based word segmentation methods usually include three parts: word segmentation (used to obtain related words), syntactic semantics (using syntactic and semantic information to judge word segmentation ambiguity), and overall control.
[0073] Specifically, different word segmentation methods can be adopted according to the characteristics of different word segmentation methods and actual requirements to segment the context information. In addition, when performing word segmentation, a word segmentation tool can be used. For example, the Jieba word segmentation tool can be used to segment the context information corresponding to the search term in the text. Jieba word segmentation is mainly based on a prefix dictionary to generate a directed acyclic graph (DAG) composed of all possible words in the sentence. Dynamic programming is used to find the maximum probability path and find the maximum segmentation combination based on word frequency. For out-of-vocabulary words, the HMM model and the Viterbi algorithm can be used for processing. In addition, based on a stop word dictionary, stop words in the word segmentation results can be removed. For example, stop words are some meaningless words such as "de" and "le". The nouns in the word segmentation results after removing stop words are extracted, that is, the final noun set is obtained. Furthermore, for the finally obtained noun set, the keywords that can best represent the theme of the text where the search term is located are extracted from it.
[0074] Furthermore, after word segmentation, keywords are extracted from it. Among them, the method for extracting keywords is not limited in the embodiments of the present application. For example, the Term Frequency-Inverse Document Frequency (TF-IDF) keyword extraction method, the Topic-model keyword extraction method, the Rapid Automatic Keyword Extraction (RAKE) method, etc.
[0075] Taking the TF-IDF keyword extraction method as an example for illustration, TF-IDF is a statistical method used to evaluate the importance of a word for a document set or a single document in a corpus. The importance of a word increases in direct proportion to the number of times it appears in a document, but at the same time decreases in inverse proportion to the frequency of its appearance in the corpus. The main idea of TF-IDF is that if a certain word has a high frequency TF in a document and rarely appears in other documents in the corpus, then it is considered that the word has good category discrimination ability and is suitable for classification.
[0076] Generally, the importance of a TF-IDF evaluation word can be calculated in the following way: TF-IDF = TF * IDF, where TF = (the number of times the word appears in the document) / (the total number of words in the document), and IDF = log (the total number of documents in the corpus / (the number of documents containing the word)).
[0077] In other words, TF reflects the frequency of a word appearing in a document, and IDF reflects the prevalence of a keyword. That is, the more common a word is (that is, a large number of documents contain this word), the lower its IDF value is, and vice versa. The TF-IDF obtained by TF and IDF can reflect the importance of a word in a document. The larger the TF-IDF value is, the more important the word is to the document, and the greater the probability of it becoming a keyword is.
[0078] Furthermore, in order to improve computing efficiency, in an embodiment of the present application, only the first N keywords can be selected for subsequent context representation vector calculation, that is, before determining the word vector of each extracted keyword respectively, the first preset number of keywords sorted based on importance are screened out, where the preset number can be set according to actual conditions and needs, and is not limited in the embodiment of the present application.
[0079] S3.2. Determine the word vector of each extracted keyword respectively.
[0080] The importance of word vectors lies in converting natural language into vectors that computers can understand, and word vectors can capture the context and semantics of words, measure the similarity between words, and play an important role in many natural language processing fields such as text classification and sentiment analysis. In the embodiments of the present application, the word vector of each keyword is determined based on a trained word vector model, for example, a word2vec model, a bidirectional encoder representation from transformers (BERT) model, etc., and this is not limited.
[0081] Let's take the word2vec model as an example. Word2vec is a related model used to generate word vectors. These models are shallow, two-layer neural networks that are trained to reconstruct linguistic word text. The network is represented by words and needs to guess the input words in adjacent positions. Under the bag-of-words model assumption in word2vec, the order of words is not important. After training, the word2vec model can be used to map each word to a vector that can be used to represent the relationship between words. The vector is the hidden layer of the neural network. For example, see Figure 4As shown, it is a schematic diagram of the principle of the word vector model in the embodiment of the present application. The word2vec model can be understood as a three-layer neural network. The input is the text that has been segmented, and the output is the dense vector of the word. Specifically, as shown in Figure 4, the input is a One-Hot vector, and the hidden layer (Hidden Layer) has no activation function, that is, a linear unit. The dimension of the output layer is the same as that of the input layer. The Softmax regression function can be used. When the entire model training is completed, the parameters learned by training this model, such as the weight matrix of the hidden layer, can be applied to the word vector model to obtain the word vector of the word.
[0082] Taking the BERT model as an example, the goal of the BERT model is to use large-scale unlabeled corpus training to obtain a vector representation of the text containing rich semantic information, that is, the semantic representation of the text, and then fine-tune the semantic representation of the text in a specific NLP task, and finally apply it to the NLP task. Specifically, the BERT model converts each word in the text into a one-dimensional vector by querying the word vector table as the model input, and the BERT model output is the vector representation of each word after integrating the semantic information of the whole text. In addition, in addition to the word vector, the input of the BERT model usually includes a text vector and a position vector. The value of the text vector is automatically learned during the model training process, which is used to characterize the global semantic information of the text and is integrated with the semantic information of a single word / word. Since the semantic information carried by words / words appearing at different positions in the text is different, the BERT model attaches a different vector to the words / words at different positions to distinguish them. In this way, the BERT model can use the sum of the word vector, text vector and position vector as the model input.
[0083] S3.3. According to the word vector of each keyword, obtain the context representation vector of the search word.
[0084] Specifically, several possible implementations are provided in the examples of the present application:
[0085] 1) Take the average of the word vectors of each keyword to obtain the context representation vector of the search word.
[0086] For example, the word2vec model can be used to represent a keyword as a k-dimensional word vector. The word vectors of all keywords in the context information corresponding to the search word in the text are averaged according to the corresponding positions of the vectors to obtain a k-dimensional vector that can represent the entire context, that is, the context representation vector of the search word. For example, there are three keywords, and their corresponding word vectors are a=(x1, x2, ..., xk), b=(y1, y2, ..., yk), and c=(z1, z2, ..., zk). The context representation vector obtained by taking the average is: ((x1+y1+z1) / 3, (x2+y2+z2) / 3, ..., (xk+yk+zk) / 3).
[0087] 2) Determine the number of occurrences of each keyword, and determine the weight of each keyword based on the number of occurrences of each keyword, and perform weighted averaging of the word vectors of each keyword based on the weight of each keyword to obtain the context representation vector of the search term.
[0088] In addition, after determining the word vector of each keyword, other methods besides averaging can be used to obtain the context representation vector of each search result. This is not limited in the embodiments of the present application. For example, one possible implementation method can also be combined with the position information of the keyword appearing in the search results, or the position relationship between the keyword and the search term, and the word vector of each keyword in each search result is weighted averaged to obtain the context representation vector of each search result.
[0089] Step 210: Obtain search results corresponding to the search term, and determine a context representation vector for each search result.
[0090] When executing step 210, it specifically includes:
[0091] 1) Obtain search results corresponding to the search terms.
[0092] In the embodiment of the present application, the method for obtaining the search results corresponding to the search terms can be adopted by the search result matching method in the general search scenario of actively inputting the search terms in the search box in the related art, that is, only the search matching method of the search terms is considered, and then the search results corresponding to the search terms can be obtained. Since the search results obtained at this time are not accurate and may not match the content that the user actually wants to search, after obtaining the search results in the embodiment of the present application, the search results can also be disambiguated and filtered.
[0093] 2) Determine the context representation vector of each search result respectively.
[0094] Specifically, keywords of each search result are extracted respectively; word vectors of each keyword extracted from each search result are determined respectively; and context representation vectors of each search result are obtained according to the word vectors of each keyword extracted from each search result.
[0095] Among them, according to the word vector of each keyword extracted from each search result, the context representation vector of each search result is obtained. Several possible implementation methods are provided in the embodiment of the present application:
[0096] The first method is to average the word vectors of each keyword extracted from each search result to obtain the context representation vector of each search result.
[0097] The second method is to determine the number of occurrences of each keyword extracted from each search result, and determine the weight of each keyword according to the number of occurrences of each keyword, and perform weighted averaging of the word vectors of each keyword extracted from each search result according to the weight of each keyword extracted from each search result to obtain the context representation vector of each search result.
[0098] Furthermore, before determining the word vectors of the keywords extracted from the search results, a preset number of keywords ranked based on importance may be screened out to improve computational efficiency.
[0099] Among them, the method of extracting keywords of search results, determining word vectors and calculating context representation vectors is the same as the method of determining the context representation vector of the search word in the above step 200, and will not be repeated here.
[0100] Step 220: Determine the similarity between the search term and each search result based on the context representation vector of the search term and the context representation vector of each search result.
[0101] Among them, the method for determining the similarity between the search term and each search result may adopt a cosine distance calculation method, a Euclidean distance calculation method, etc., which is not limited in the embodiments of the present application.
[0102] For example, there are n search results, and the word vector set of keywords extracted from each search result is D_k, that is, the keyword set corresponding to search result D1 is D_K1, the keyword set corresponding to search result D2 is D_K2,…, and the keyword set corresponding to search result Dn is D_kn. According to the word vector of each keyword in each keyword set, the context representation vector of each search result is calculated respectively, and the cosine distance between the context representation vector of the search term and the context representation vector of each search result is calculated respectively, that is, the similarity between the search term and each search result is obtained.
[0103] Step 230: Filter the search results according to the determined similarities to obtain filtered search results.
[0104] Specifically, search results with similarity less than a threshold are filtered out.
[0105] When the terminal displays the filtered search results to the user, the terminal may display the filtered search results in order from high to low according to the similarities corresponding to the filtered search results.
[0106] That is to say, in the embodiment of the present application, through the similarity calculation based on context information, if it is determined that the similarity is less than a threshold, it can be considered that the search result is ambiguous with the subject context of the text where the search term is located, and can be filtered without being displayed to the user, wherein the threshold can be set according to actual needs and circumstances, and is not limited in the embodiment of the present application.
[0107] In an embodiment of the present application, a search term based on text input is obtained, and when it is determined that the search term is an ambiguous term, a context representation vector of the search term is determined based on context information corresponding to the search term in the text, and each search result corresponding to the search term is obtained, and a context representation vector of each search result is determined respectively, and then the similarity between the search term and each search result is determined respectively, and each search result is filtered based on the determined similarities to obtain filtered search results. In this way, when it is determined that the search term is an ambiguous term, the search results can be filtered based on the context information of the search term and the context information of the search results, and search results whose context information is ambiguous with the context information of the search term can be filtered out, so that the final filtered search results can be made more consistent with the context information of the search term and closer to the theme of the text where the search term is located, thereby improving the accuracy of the final search results and better satisfying the user's search experience.
[0108] Based on the above embodiment, the search result processing method in the embodiment of the present application is described below from the product side. Taking the application in the reading scenario as an example, the user reads an article in the terminal. During the reading process, if a word is of interest, the user can initiate the search process by long pressing. For example, refer to Figure 5 As shown, this is a schematic diagram of the interface for initiating a search process in an embodiment of the present application. The user can long press the position of the word "BD". The system determines the corresponding search term based on the position where the user's finger long presses, and prompts the user to initiate a "search" operation. Then, the user clicks "search" to send a search request to the server, and can obtain the search results returned by the server.
[0109] For example, see Figure 6As shown, it is a schematic diagram of the search results returned in the related technology. It can be seen that the user initiates the search term "BD" in the reading scenario, and the context information of the article is about optical discs. It can be considered that the user actually wants to know the relevant search results of the meaning of "Blu-ray Disc", while the search results returned in the related technology are relevant results of the meaning of "business". The search results are inaccurate. The search results in the related technology cannot perceive the correct meaning information of the search term in the article, and the search results are not disambiguated and filtered, which leads to semantic drift in the returned search results, which does not meet the actual search needs of the user.
[0110] In the embodiment of the present application, when it is determined that the search term is an ambiguous term, the context representation vector of the search term and the context representation vector of each search result are determined according to the context information of the search term and the context information of each search result, and then the similarity between the search term and each search result is determined according to the context representation vector, and the search results are filtered according to the determined similarities, and then the filtered search results are returned and displayed to the user, for example, see Figure 7 As shown, it is a schematic diagram of returning search results in an embodiment of the present application, such as Figure 7 It can be seen that the search results returned in the embodiment of the present application are more consistent with the context information corresponding to the search terms, thereby improving the accuracy of the search results.
[0111] Based on the same inventive concept, the present application also provides a search result processing device in an embodiment, which can be a hardware structure, a software module, or a hardware structure plus a software module. Figure 8 As shown, the search result processing device in the embodiment of the present application specifically includes:
[0112] An acquisition module 80, for acquiring a search term based on text input;
[0113] A first determination module 81 is used to determine a context representation vector of the search word according to context information corresponding to the search word in the text when determining that the search word is an ambiguous word;
[0114] A second determination module 82 is used to obtain search results corresponding to the search term and determine a context representation vector of each search result;
[0115] A third determination module 83, configured to determine the similarity between the search term and each search result according to the context representation vector of the search term and the context representation vector of each search result;
[0116] The filtering module 84 is used to filter the search results according to the determined similarities to obtain filtered search results.
[0117] Optionally, to determine that the search term is an ambiguous term, the first determining module 81 is specifically configured to:
[0118] According to the preset ambiguous word database, if it is determined that the search term is in the preset ambiguous word database, the search term is determined to be an ambiguous word, wherein an ambiguous word represents a word with at least two different semantics, and the preset ambiguous word database is constructed based on at least words with polysemous word identifiers crawled from each preset search engine.
[0119] Optionally, when determining the context representation vector of the search term according to the context information corresponding to the search term in the text, the first determination module 81 is specifically used to:
[0120] Extract keywords from the context information corresponding to the search terms in the text;
[0121] Determine the word vector of each extracted keyword respectively;
[0122] According to the word vectors of the keywords, a context representation vector of the search word is obtained.
[0123] Optionally, when obtaining the context representation vector of the search term based on the word vectors of the keywords, the first determination module 81 is specifically used to: average the word vectors of the keywords to obtain the context representation vector of the search term.
[0124] Optionally, the first determining module 81 is specifically configured to:
[0125] Determine the number of occurrences of each keyword respectively, and determine the weight of each keyword according to the number of occurrences of each keyword respectively, and perform weighted averaging on the word vectors of each keyword according to the weight of each keyword respectively to obtain the context representation vector of the search term.
[0126] Optionally, when determining the context representation vector of each search result respectively, the second determination module 82 is specifically used to:
[0127] Extract keywords from each search result respectively;
[0128] Determine the word vector of each keyword extracted from each search result;
[0129] According to the word vectors of the keywords extracted from the search results, a context representation vector of each search result is obtained.
[0130] Optionally, when obtaining the context representation vector of each search result based on the word vector of each keyword extracted from the search results, the second determination module 82 is specifically used to: take the average of the word vectors of each keyword extracted from the search results to obtain the context representation vector of each search result.
[0131] Optionally, the second determination module 82 is specifically used to: respectively determine the number of occurrences of each keyword extracted from the search results, and respectively determine the weight of each keyword based on the number of occurrences of each keyword, and respectively perform weighted averaging of the word vectors of each keyword extracted from the search results based on the weights of each keyword extracted from the search results to obtain the context representation vector of each search result.
[0132] Optionally, it further includes that the screening module 85 is used to screen out a preset number of keywords sorted based on importance.
[0133] Based on the above embodiments, see Fig. 9 Shown is a schematic diagram of the structure of an electronic device in an embodiment of the present application.
[0134] An embodiment of the present application provides an electronic device, which may be a terminal or a server. The embodiment of the present application is described by taking the electronic device as a server as an example. The electronic device may include a processor 910 (Center Processing Unit, CPU), a memory 920, an input device 930, an output device 940, and the like.
[0135] The memory 920 may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor 910 with program instructions and data stored in the memory 920. In the embodiment of the present application, the memory 920 may be used to store the program of any search result processing method in the embodiment of the present application.
[0136] The processor 910 calls the program instructions stored in the memory 920, and the processor 910 is used to execute any search result processing method in the embodiments of the present application according to the obtained program instructions.
[0137] Based on the above embodiments, in an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the search result processing method in any of the above method embodiments is implemented.
[0138] Based on the above embodiments, in the embodiments of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the search result processing method in any of the above method embodiments.
[0139] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0140] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
Claims
1. A search result processing method, characterized in that: include: Acquire a search term based on text input, and when determining that the search term is an ambiguous term, determine a context representation vector of the search term according to context information corresponding to the search term in the text; Obtaining search results corresponding to the search term, and determining context representation vectors for the search results; Determining the similarity between the search term and each of the search results respectively according to the context representation vector of the search term and the context representation vector of each of the search results; Filtering the search results according to the determined similarities to obtain filtered search results; The determining of the context representation vector of the search term according to the context information corresponding to the search term in the text specifically includes: Segmenting the context information corresponding to the search word in the text to obtain a plurality of words, and extracting keywords representing the subject of the text from the plurality of words according to word frequency-inverse file frequency as keywords in the context information corresponding to the search word in the text; Determine the word vector of each extracted keyword respectively; According to the word vectors of the keywords, a context representation vector of the search word is obtained.
2. The method according to claim 1, characterized in that Determining that the search term is an ambiguous term specifically includes: According to a preset ambiguous word database, if it is determined that the search term is in the preset ambiguous word database, the search term is determined to be an ambiguous word, wherein the ambiguous word represents a word with at least two different semantics, and the preset ambiguous word database is constructed based on at least words with polysemous word identifiers crawled from each preset search engine.
3. The method according to claim 1, characterized in that According to the word vectors of the keywords, the context representation vector of the search word is obtained, which specifically includes: Averaging the word vectors of the keywords to obtain the context representation vector of the search word; or, Determine the number of occurrences of each keyword respectively, and determine the weight of each keyword according to the number of occurrences of each keyword respectively, and perform weighted averaging on the word vectors of each keyword according to the weight of each keyword respectively to obtain the context representation vector of the search term.
4. The method according to claim 1, characterized in that Determining the context representation vector of each search result respectively includes: Extracting keywords from each search result respectively; Determine the word vector of each keyword extracted from each search result respectively; According to the word vector of each keyword extracted from the search results, a context representation vector of each search result is obtained.
5. The method according to claim 4, characterized in that Obtaining a context representation vector of each search result according to the word vector of each keyword extracted from each search result includes: Averaging the word vectors of each keyword extracted from each search result to obtain a context representation vector of each search result; or, Determine the number of occurrences of each keyword extracted from each search result, and determine the weight of each keyword based on the number of occurrences of each keyword, and perform weighted averaging on the word vectors of each keyword extracted from each search result based on the weight of each keyword extracted from each search result to obtain a context representation vector of each search result.
6. The method according to any one of claims 1 to 5, characterized in that Further including: Filter out the first preset number of keywords sorted by importance.
7. A search result processing device, characterized in that: include: An acquisition module, used to acquire search terms based on text input; A first determination module, configured to determine, when determining that the search term is an ambiguous term, a context representation vector of the search term based on context information corresponding to the search term in the text; A second determination module is used to obtain each search result corresponding to the search term and determine a context representation vector of each search result; A third determination module, configured to determine the similarity between the search term and each of the search results according to the context representation vector of the search term and the context representation vector of each of the search results; A filtering module, used to filter the search results according to the determined similarities to obtain filtered search results; Wherein, when determining the context representation vector of the search term according to the context information corresponding to the search term in the text, the first determination module is specifically used to: Segmenting the context information corresponding to the search word in the text to obtain a plurality of words, and extracting keywords representing the subject of the text from the plurality of words according to word frequency-inverse file frequency as keywords in the context information corresponding to the search word in the text; Determine the word vector of each extracted keyword respectively; According to the word vectors of the keywords, a context representation vector of the search word is obtained.
8. The device according to claim 7, characterized in that When determining the context representation vectors of the search results respectively, the second determination module is specifically used for: Extracting keywords from each search result respectively; Determine the word vector of each keyword extracted from each search result respectively; According to the word vector of each keyword extracted from the search results, a context representation vector of each search result is obtained.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Context-sensitive search using a deep learning model
CN106415535A