A data search method and device

The calculation of the base field weights and correcting the matching rate through hierarchical lexical method is solved, and the low accuracy problem caused by relying on text keyword frequency in ElasticSearch is improved, and the accuracy and flexibility of search results are improved.

CN112925872BActive Publication Date: 2025-03-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911233899.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-05
Publication Date
2025-03-18
Estimated Expiration
2039-12-05

AI Technical Summary

Technical Problem

In the prior art, ElasticSearch uses the frequency of text keywords as the only basis for searching, resulting in low accuracy of search results.

Method used

The weight corresponding to the benchmark field is calculated using the hierarchical lexical method, and the matching rate is corrected by the weight to determine the search results based on the modified matching rate.

Benefits of technology

The accuracy of search results is improved, and the judgment comparison matrix is ​​constructed through the hierarchical analysis method and normalized to obtain the weight of each benchmark field, which enhances the accuracy and flexibility of search results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112925872B_ABST
    Figure CN112925872B_ABST
Patent Text Reader

Abstract

The present invention discloses a data search method and device, and relates to the field of computer technology. A specific implementation of the method includes: extracting at least one target keyword from a search text, respectively calculating the matching rate between the at least one target keyword and a plurality of set reference fields; comparing the matching rate with a set first threshold, and in the case where the matching rate is less than the first threshold, calculating the weights corresponding to the plurality of reference fields using a hierarchical analysis method; correcting the matching rate according to the weight, and sorting the plurality of reference fields according to the corrected matching rate to obtain search results. The method uses a hierarchical word segmentation method to calculate the weights corresponding to the reference fields, and uses the weights to correct the matching rate, so as to determine the search results based on the corrected matching rate, thereby improving the accuracy of the search results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a data search method and device. Background Art

[0002] Data search is a core function in the information field. Through search, users can quickly locate the information they need. In the prior art, the search and sorting algorithm of system applications is generally implemented using the enterprise-level search engine ElasticSearch. ElasticSearch is a distributed, highly scalable, and highly real-time search and data analysis engine developed in Java, which can easily enable large amounts of data to be searched, analyzed, and explored.

[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0004] ElasticSearch uses the frequency of text keywords as the only basis for search, and the accuracy of search results is low. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a data search method and device, which uses hierarchical word segmentation to calculate the weight corresponding to the reference field, uses the weight to correct the matching rate, and determines the search results based on the corrected matching rate, thereby improving the accuracy of the search results.

[0006] To achieve the above objective, according to one aspect of an embodiment of the present invention, a data search method is provided.

[0007] A data search method according to an embodiment of the present invention includes: extracting at least one target keyword from a search text, and calculating the matching rate between the at least one target keyword and a plurality of set reference fields respectively; comparing the matching rate with a set first threshold, and when the matching rate is less than the first threshold, calculating the weights corresponding to the plurality of reference fields using a hierarchical analysis method; and correcting the matching rate according to the weight, so as to sort the plurality of reference fields according to the corrected matching rate to obtain search results.

[0008] Optionally, the weights corresponding to the multiple benchmark fields are calculated using the hierarchical analysis method, including: establishing a hierarchical model, wherein the hierarchical model includes a target layer, a criterion layer and a scheme layer, the overall target of the target layer is the proportion, the criterion layer is the multiple benchmark fields, and the scheme layer is the weight; comparing the importance of elements in the same layer with respect to a single criterion in the previous layer in pairs to construct a judgment comparison matrix; normalizing the judgment comparison matrix to obtain a eigenvector to calculate the weights of the multiple benchmark fields based on the eigenvector.

[0009] Optionally, the method further includes: verifying the consistency of the judgment comparison matrix to adjust the judgment comparison matrix according to the consistency verification result; and normalizing the judgment comparison matrix, including: normalizing the adjusted judgment comparison matrix.

[0010] Optionally, checking the consistency of the judgment comparison matrix includes: calculating the maximum eigenvalue and consistency index of the judgment comparison matrix based on the judgment comparison matrix and the eigenvector; comparing the consistency index with a set second threshold to determine the consistency of the judgment comparison matrix based on the comparison result.

[0011] Optionally, correcting the matching rate according to the weight includes: multiplying the weights of the multiple reference fields by the corresponding matching rates to obtain the corrected matching rate.

[0012] Optionally, calculating the matching rate between the at least one target keyword and a set benchmark field includes: calculating the frequency of each target keyword appearing in the benchmark field and the reverse file frequency in the multiple benchmark fields respectively; multiplying the frequency of each target keyword appearing in the benchmark field and the corresponding reverse file frequency and summing them up to obtain the matching rate between the at least one target keyword and the benchmark field.

[0013] Optionally, extracting at least one target keyword from the search text includes: preprocessing the search text to obtain multiple candidate keywords; constructing a candidate keyword graph to iteratively calculate the weights of the multiple candidate keywords; wherein the candidate keyword graph includes a node set consisting of the multiple candidate keywords, and an edge set between nodes constructed using co-occurrence relationships; and selecting at least one target keyword from the multiple candidate keywords based on the weights of the multiple candidate keywords.

[0014] To achieve the above objective, according to another aspect of an embodiment of the present invention, a data search device is provided.

[0015] A data search device according to an embodiment of the present invention includes: a matching rate calculation module, which is used to extract at least one target keyword from a search text and respectively calculate the matching rate between the at least one target keyword and a plurality of set reference fields; a weight calculation module, which is used to compare the matching rate with a set first threshold value, and when the matching rate is less than the first threshold value, calculate the weights corresponding to the plurality of reference fields using a hierarchical analysis method; and a correction sorting module, which is used to correct the matching rate according to the weight, so as to sort the plurality of reference fields according to the corrected matching rate to obtain search results.

[0016] Optionally, the weight calculation module is also used to: establish a hierarchical model, wherein the hierarchical model includes a target layer, a criterion layer and a scheme layer, the overall target of the target layer is the proportion, the criterion layer is the multiple benchmark fields, and the scheme layer is the weight; compare the importance of elements in the same layer with respect to a single criterion in the previous layer in pairs to construct a judgment comparison matrix; normalize the judgment comparison matrix to obtain a feature vector, and calculate the weights of the multiple benchmark fields based on the feature vector.

[0017] Optionally, the device further includes: a verification and adjustment module, used to verify the consistency of the judgment and comparison matrix, so as to adjust the judgment and comparison matrix according to the consistency verification result; the weight calculation module is also used to: normalize the adjusted judgment and comparison matrix.

[0018] Optionally, the weight calculation module is also used to: calculate the maximum eigenvalue and consistency index of the judgment comparison matrix based on the judgment comparison matrix and the eigenvector; compare the consistency index with a set second threshold to determine the consistency of the judgment comparison matrix based on the comparison result.

[0019] Optionally, the modified sorting module is further used to: multiply the weights of the multiple reference fields by the corresponding matching rates to obtain the modified matching rates.

[0020] Optionally, the matching rate calculation module is further used to: respectively calculate the frequency of each target keyword appearing in the benchmark field and the reverse file frequency in the multiple benchmark fields; multiply the frequency of each target keyword appearing in the benchmark field and the corresponding reverse file frequency and then sum them to obtain the matching rate between the at least one target keyword and the benchmark field.

[0021] Optionally, the matching rate calculation module is further used to: pre-process the search text to obtain multiple candidate keywords; construct a candidate keyword graph to iteratively calculate the weights of the multiple candidate keywords; wherein the candidate keyword graph includes a node set consisting of the multiple candidate keywords, and an edge set between the nodes constructed using co-occurrence relationships; and select at least one target keyword from the multiple candidate keywords based on the weights of the multiple candidate keywords.

[0022] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0023] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a data search method according to an embodiment of the present invention.

[0024] To achieve the above objective, according to another aspect of the embodiments of the present invention, a computer readable medium is provided.

[0025] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, a data search method according to an embodiment of the present invention is implemented.

[0026] An embodiment of the above invention has the following advantages or beneficial effects: using hierarchical word segmentation to calculate the weight corresponding to the benchmark field, using the weight to correct the matching rate, and determining the search results based on the corrected matching rate, thereby improving the accuracy of the search results; constructing a judgment comparison matrix for the importance of each benchmark field through the hierarchical analysis method, and performing normalization processing to obtain the weight corresponding to each benchmark field, and associating the hierarchical analysis method with the search scenario to improve the accuracy and flexibility of the search results; adjusting the judgment comparison matrix that fails the consistency check to further ensure the accuracy of the search results.

[0027] An embodiment of the above invention has the following advantages or beneficial effects: using the maximum eigenvalue and consistency index to measure the consistency of the comparison matrix, which is simple to implement and has good reliability; taking the multiplication result of the weight of the benchmark field and the corresponding matching rate as the corrected matching rate, correcting the search results, and increasing the scene coverage; using word frequency and reverse file frequency to calculate the matching rate between the target keyword and the benchmark field, which effectively reflects the importance of the benchmark field to the search text and the distribution of the target keyword in the benchmark field; after semantic segmentation and weighting of the search text to obtain independent target keywords, the matching rate is calculated, thereby achieving accurate search when the search text is a complete sentence.

[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0030] Figure 1 is a schematic diagram of main steps of a data search method according to an embodiment of the present invention;

[0031] Figure 2 is a schematic diagram of the implementation principle of the data search method according to an embodiment of the present invention;

[0032] Figure 3 is a schematic diagram of the main flow of a data search method according to an embodiment of the present invention;

[0033] Figure 4 is a schematic diagram of a hierarchical structure model of a data search method according to an embodiment of the present invention;

[0034] Figure 5 is a schematic diagram of a main process of calculating weights corresponding to multiple reference fields in a data search method according to an embodiment of the present invention;

[0035] Figure 6 is a schematic diagram of main modules of a data search device according to an embodiment of the present invention;

[0036] Figure 7 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0037] Figure 8 It is a schematic diagram of the structure of a computer device suitable for implementing an electronic device of an embodiment of the present invention. DETAILED DESCRIPTION

[0038] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill 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 clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0039] ElasticSearch is a commonly used data search engine, which searches quickly and is easy to implement. However, this search engine only uses the frequency of text keywords as the only basis for search. Words with a small frequency of text keywords are considered to be more important, and words with a large frequency of text keywords are considered to be less important, resulting in poor accuracy of search results. At the same time, ElasticSearch searches based on the original search text, and cannot reflect the importance of the search results to the search text and the distribution of search terms. Based on the above-mentioned problems of the prior art, the present invention provides a data search method, which readjusts the weights of the search results based on the weights of each benchmark field, which can improve the accuracy of the search results and meet the user's search needs in different scenarios. A detailed description is given below.

[0040] Figure 1 FIG. 1 is a schematic diagram of the main steps of the data search method according to an embodiment of the present invention. Figure 1 As shown, the data search method of the embodiment of the present invention mainly includes the following steps:

[0041] Step S101: extract at least one target keyword from the search text, and calculate the matching rate between the at least one target keyword and the set multiple benchmark fields respectively. The search text is the text entered by the user in the search box. The implementation process of extracting at least one target keyword from the search text is: first pre-process the search text to obtain multiple candidate keywords; then construct a candidate keyword graph, iteratively calculate the weights of multiple candidate keywords; finally, select at least one target keyword from the multiple candidate keywords according to the weight size.

[0042] The reference field includes a field name and a field value. The implementation process of calculating the matching rate between at least one target keyword and a set reference field is as follows: respectively calculating the frequency of each target keyword in the field value of the reference field and the reverse file frequency of all reference fields; multiplying the frequency of each target keyword in the field value of the reference field and the corresponding reverse file frequency and summing them up, the matching rate between at least one target keyword and the reference field can be obtained. According to the above method, the matching rate between the target keyword and each reference field can be calculated.

[0043] Step S102: Compare the matching rate with the set first threshold value. If the matching rate is less than the first threshold value, use the hierarchical analysis method to calculate the weights corresponding to the multiple reference fields. Compare each matching rate with the first threshold value. If the matching rate is less than the first threshold value, it is considered that there is no content with a high degree of fit with the user's search text. It is necessary to use the hierarchical analysis method to determine the importance of the field name of each reference field, construct a judgment comparison matrix, and then obtain the weights corresponding to the field names of multiple reference fields. When all matching rates are greater than the first threshold value, the field values ​​of multiple reference fields can be sorted in descending order of matching rates to obtain search results.

[0044] Step S103: The matching rate is corrected according to the weight, and the multiple reference fields are sorted according to the corrected matching rate to obtain search results. The weights of the field names of the multiple reference fields are multiplied by the corresponding matching rates to obtain the corrected matching rates. The field values ​​of the multiple reference fields are sorted in descending order according to the corrected matching rates to obtain search results. The search results can be output and displayed to the user later.

[0045] Figure 2 FIG. 1 is a schematic diagram showing the implementation principle of the data search method according to an embodiment of the present invention. Figure 2As shown in the figure, the data search method according to an embodiment of the present invention first extracts target keywords from the search text, and then calculates the matching rate between the target keywords and the field values of each reference field. Then, it is determined whether each matching rate is greater than a set first threshold. If all the matching rates are greater than the first threshold, the field values of each reference field are used as search results and output in descending order of the matching rates. If there is a matching rate less than or equal to the first threshold, the weights of the field names of each reference field are calculated, the matching rates are adjusted based on the weights, and then the field values of each reference field are output in descending order of the adjusted matching rates.

[0046] Figure 3 is a schematic diagram of the main process of the data search method according to an embodiment of the present invention. As Figure 3 shown, the data search method according to an embodiment of the present invention mainly includes the following steps:

[0047] Step S301: Preprocess the search text to obtain multiple candidate keywords. The user enters any search content in the search box, and this search content constitutes the search text. The preprocessing here includes operations such as semantic segmentation, word segmentation, and filtering stop words. The specific implementation is as follows: The entire search text is segmented according to punctuation marks (such as periods, semicolons, question marks, exclamation marks) to obtain independent sentences; then each sentence is subjected to word segmentation and part-of-speech tagging processing, stop words are filtered, and words with specified parts of speech are retained, such as nouns, verbs, and adjectives, to obtain the candidate keywords. It should be noted that if the search text itself is a single sentence, it is not segmented.

[0048] Stop words are words that are of no help to the search results during the search process. Stop words can be divided into two categories: one category is words that are everywhere on the Internet. For example, the word "Web" appears on almost every website, and such words are of no help to the search results; the other category is modal particles, adverbs, prepositions, conjunctions, etc., which usually have no clear meaning by themselves and only have a certain role when placed in a complete sentence, such as words like "de" (的) and "zai" (在).

[0049] Step S302: Construct a candidate keyword graph to iteratively calculate the weights of multiple candidate keywords. The candidate keyword graph includes a node set composed of multiple candidate keywords and an edge set constructed by co-occurrence relationships between the nodes. The candidate keyword graph can be represented by G=(V, E), where V is the node set and G is the edge set. An edge between any two nodes constructed by co-occurrence relationships. There is an edge between two nodes only when the words corresponding to them co-occur in a window of length K, where K represents the window size, that is, at most K words co-occur.

[0050] Iteratively propagate to calculate the weights of multiple candidate keywords until convergence. The score of a node is defined as follows:

[0051]

[0052] Where d is the damping coefficient, ranging from 0 to 1, representing the probability of pointing from a specific point in the graph to any other point, and is generally taken as 0.85; N represents the total number of pages; w ji For any two nodes V i , V j The weight of the edge between them; for a given node V i ,In(V i ) points to the node V i The node set, Out(V i ) is the node V i The node set pointed to. In actual applications, most users will not search for more than one page of content, so N = 1.

[0053] Step S303: Select a target keyword from multiple candidate keywords according to the weight. Sort the node weights in reverse order to obtain the most important T candidate keywords. These T candidate keywords can be used as target keywords. The T candidate keywords can also be marked in the search text. If two candidate keywords form adjacent phrases, they are combined into a multi-word keyword, and the combined result is used as the target keyword.

[0054] Step S301-step S303 extracts the target keywords from the search text according to the TextRank algorithm. In a preferred embodiment, the target keywords can also be extracted from the search text using Linear Discriminant Analysis (LDA). The TextRank algorithm is a text retrieval algorithm used for keyword extraction.

[0055] Step S304: Count the frequency and inverse document frequency of the target keyword in the field value of each benchmark field to calculate the match rate between the target keyword and each benchmark field. Through the TD-IDF algorithm, the target keyword is weighted matched with the benchmark field stored in the system to obtain the match rate. The benchmark field is customized according to the business attributes, including the field name and field value. Among them, TF is Term Frequency, and IDF is Inverse Document Frequency. TF-IDF is essentially the product of TF and IDF. The calculation formula for the match rate between the target keyword and the current benchmark field is as follows:

[0056]

[0057] In the formula, q represents all the selected target keywords; d represents the current benchmark field; wi Represents the i-th target keyword selected.

[0058]

[0059] Where n i Represents the number of occurrences of the selected i-th target keyword in the current benchmark field, It is the sum of the occurrences of all words in the current base field.

[0060]

[0061] Where |D| represents the total number of all benchmark fields; |{j:w i ∈d j}| represents the word w i If a term is not in the base field, it will result in a denominator of zero, so 1 is added to the denominator.

[0062] Step S305: Determine whether each matching rate is greater than the first threshold. If the matching rates are greater than the first threshold, execute step S306; if there is a matching rate less than or equal to the first threshold, execute step S307. The first threshold can be customized, such as 50%, 60%, etc.

[0063] Step S306: Output the field value of the reference field according to the matching rate, and end this process. If the matching rates α1, α2, α3, ..., αn are all greater than the first threshold, the field value of the reference field can be directly displayed to the user in order according to the matching rate.

[0064] Step S307: Calculate the weights corresponding to the field names of multiple reference fields using the analytic hierarchy process. If there is a match rate less than or equal to the first threshold, it is considered that there is no content with a high degree of fit with the user's search content, and the importance of each reference field needs to be analyzed through the analytic hierarchy process (AHP), and a judgment comparison matrix is ​​constructed and normalized to obtain the weights λ1, λ2, λ3, ..., λn corresponding to the field name of each reference field.

[0065] Step S308: Correct the matching rate according to the weight, sort the field values ​​of multiple reference fields according to the corrected matching rate, obtain search results, and output the search results. Multiply the weight corresponding to the field name of each reference field by the matching rate, correct its matching rate, and optimize the TD-IDF algorithm. The calculation formula is as follows:

[0066] β i =α i ×λ i Formula 5 In the formula, β i represents the corrected matching rate, α i represents the matching rate between the target keyword and the i-th benchmark field; i The weight of the field name representing the i-th base field.

[0067] According to β i The size of the field value of the benchmark field is displayed to the user in a sorted manner. After semantic analysis and segmentation of the search text, this application uses the AHP hierarchical analysis method on the basis of the original TD-IDF algorithm, combined with the actual user search scenarios and the particularity of different system functions, to flexibly associate the system's associated fields with the user's search scenarios, thereby improving the accuracy of user search results and recommended sorting content. The data search method of the embodiment of the present invention can be widely and flexibly applied in various search scenarios, and search for highly relevant results for users. Especially in the case of store searches and weak system personalized recommendation capabilities, there will be a wider range of applications.

[0068] Figure 4 Schematic diagram of a hierarchical structure model of a data search method according to an embodiment of the present invention. Figure 4 As shown, the hierarchical model includes a target layer, a criterion layer and a solution layer. The overall target layer refers to the purpose of decision-making and the problem to be solved, which is the degree of weight in this embodiment; the criterion layer is the criterion of the influencing factors that need to be considered, which is a plurality of reference fields in this embodiment (for example: store name, brand name, store address, product name, business district name, etc. in store search); the solution layer is for specific decisions, and the solution in this embodiment is the weight.

[0069] Figure 5 FIG. 1 is a schematic diagram of the main flow of calculating the weights corresponding to multiple reference fields in the data search method according to an embodiment of the present invention. Figure 5 As shown, the implementation process of calculating the weights corresponding to multiple reference fields in the embodiment of the present invention mainly includes the following steps:

[0070] Step S501: Establishing a hierarchical structure model, wherein the hierarchical structure model includes a target layer, a criterion layer and a solution layer, wherein the overall target of the target layer is the proportion, the criterion layer is a plurality of reference fields, and the solution layer is the weight.

[0071] Step S502: Compare the importance of the elements in the same layer with respect to the single criteria in the previous layer in pairs to construct a judgment comparison matrix. ij The comparison result of the importance of factor i and factor j is given in the table below. The judgment comparison matrix A is constructed based on the comparison results of each pair.

[0072] Table 1 shows the nine importance levels and their values

[0073] Factor i is better than factor j Quantization value Equally important 1 Slightly important 3 Strong and important 5 Strongly important 7 Extremely important 9 The middle value of two adjacent judgments 2,4,6,8

[0074] Step S503: Normalize the judgment comparison matrix to obtain a feature vector, and calculate the weights of multiple reference fields according to the feature vector. Each column of the judgment comparison matrix A is normalized, and then summed by row, and the summed result is normalized to obtain the feature vector ω.

[0075] λ1λ2λ3…λ n =ω(ω1ω2ω3…ω n ) Formula 6

[0076] Step S504: Calculate the maximum eigenvalue and consistency index of the judgment comparison matrix based on the judgment comparison matrix and the eigenvector. max ω, calculate the maximum eigenvalue λ max , and λ max Substitute the value into the following formula to calculate the consistency index CI.

[0077]

[0078] Wherein, n represents the order of the judgment comparison matrix. If it is a 4-order matrix, n=4.

[0079] Step S505: Determine whether the consistency index is less than or equal to the set second threshold. If the consistency index is less than or equal to the second threshold, end this process; if the consistency index is greater than the second threshold, execute step S506. The second threshold can be customized, such as 0.1. If CI≤0.1, it proves that the judgment comparison matrix is ​​consistent and the judgment result is valid.

[0080] Step S506: Adjust the judgment comparison matrix and execute step S503. If CI>0.1, it proves that the judgment comparison matrix is ​​inconsistent and needs to be readjusted, and the processing from step S503 to step S506 is performed again.

[0081] The following is an explanation based on specific application scenarios. Suppose a user searches for "What are the hot pot restaurants near Beijing Wangjing? I want Sichuan hot pot that's a little spicy."

[0082] According to the data search method of this embodiment, the sentence is first divided into two sentences: What are the hot pot restaurants near Beijing Wangjing + Sichuan hot pot that is a little spicier; and then the target keywords (Beijing Wangjing, hot pot restaurant, spicy, Sichuan hot pot) are extracted according to the TextRank algorithm. The above process corresponds to the processing of step S301 to step S303.

[0083] The four target keywords (Beijing Wangjing, hot pot restaurant, spicy, Sichuan hot pot) are matched with the locally stored reference fields as a whole, and the four keyword matching results are added together, and the one with the highest matching rate is ranked first, and the order is from large to small. The above process corresponds to the processing of step S304 to step S306.

[0084] According to the user's own search channel, the four target keywords (Beijing Wangjing, hot pot restaurant, spicy, Sichuan hot pot) are attributed to the corresponding benchmark fields (city address, food type, restaurant type, and personality label). According to the corresponding importance of the four dimensions in the system, the calculation weight parameters of the four dimensional fields are multiplied by the original four matching rates respectively to obtain the final corrected weight ratio value (i.e., matching rate), and the search results are arranged from large to small for the user. The above process corresponds to the processing of step S307-step S308.

[0085] It can be seen from the data search method of the embodiment of the present invention that the hierarchical word segmentation method is used to calculate the weights corresponding to the reference fields, and the weights are used to correct the matching rates, so that the search results are determined based on the corrected matching rates, thereby improving the accuracy of the search results; a judgment comparison matrix is ​​constructed for the importance of each reference field through the hierarchical analysis method, and normalization is performed to obtain the weights corresponding to each reference field, and the hierarchical analysis method is associated with the search scenario to improve the accuracy and flexibility of the search results; the judgment comparison matrix that fails the consistency check is adjusted to further ensure the accuracy of the search results.

[0086] It can be seen from the data search method of the embodiment of the present invention that the maximum eigenvalue and consistency index are used to measure the consistency of the comparison matrix, which is simple to implement and has good reliability; the multiplication result of the weight of the benchmark field and the corresponding matching rate is used as the corrected matching rate to correct the search results and increase the scene coverage; the word frequency and reverse file frequency are used to calculate the matching rate between the target keyword and the benchmark field, which effectively reflects the importance of the benchmark field to the search text and the distribution of the target keyword in the benchmark field; after the search text is semantically segmented and weighted to obtain independent target keywords, the matching rate is calculated, thereby achieving accurate search when the search text is a complete sentence.

[0087] Figure 6 Schematic diagram of the main modules of the data search device according to an embodiment of the present invention. Figure 6 As shown, the data search device 600 of the embodiment of the present invention mainly includes:

[0088] The matching rate calculation module 601 is used to extract at least one target keyword from the search text, and respectively calculate the matching rate between the at least one target keyword and the set multiple reference fields. The implementation process of extracting at least one target keyword from the search text is: first pre-processing the search text to obtain multiple candidate keywords; then constructing a candidate keyword graph, iteratively calculating the weights of multiple candidate keywords; finally, selecting at least one target keyword from multiple candidate keywords based on the weight size.

[0089] The reference field includes a field name and a field value. The implementation process of calculating the matching rate between at least one target keyword and a set reference field is as follows: respectively calculating the frequency of each target keyword in the field value of the reference field and the reverse file frequency of all reference fields; multiplying the frequency of each target keyword in the field value of the reference field and the corresponding reverse file frequency and summing them up, the matching rate between at least one target keyword and the reference field can be obtained. According to the above method, the matching rate between the target keyword and each reference field can be calculated.

[0090] The weight calculation module 602 is used to compare the matching rate with the set first threshold value. When the matching rate is less than the first threshold value, the weights corresponding to the multiple reference fields are calculated using the hierarchical analysis method. Each matching rate is compared with the first threshold value. When the matching rate is less than the first threshold value, it is considered that there is no content with a high degree of fit with the user's search text. It is necessary to use the hierarchical analysis method to construct a judgment comparison matrix for the importance of the field name of each reference field, and then obtain the weights corresponding to the field names of multiple reference fields. When all matching rates are greater than the first threshold value, the field values ​​of multiple reference fields can be sorted in order of matching rates from high to low to obtain search results.

[0091] The correction sorting module 603 is used to correct the matching rate according to the weight, so as to sort the multiple reference fields according to the corrected matching rate to obtain the search results. The weights of the field names of the multiple reference fields are multiplied by the corresponding matching rates to obtain the corrected matching rates. The field values ​​of the multiple reference fields are sorted in descending order according to the corrected matching rates to obtain the search results. The search results can be output and displayed to the user later.

[0092] In addition, the data search device 600 of the embodiment of the present invention may further include: a verification processing module ( Figure 6 Wherein, this module is used to check the consistency of the judgment comparison matrix to adjust the judgment comparison matrix according to the consistency check result.

[0093] From the above description, it can be seen that the hierarchical word segmentation method is used to calculate the weight corresponding to the reference field, and the weight is used to correct the matching rate, so as to determine the search result based on the corrected matching rate, thereby improving the accuracy of the search result.

[0094] Figure 7 An exemplary system architecture 700 is shown to which the data search method or data search device according to the embodiment of the present invention can be applied.

[0095] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, network 704 and server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0096] Users can use terminal devices 701, 702, and 703 to interact with server 705 through network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0097] The terminal devices 701 , 702 , and 703 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.

[0098] The server 705 may be a server that provides various services, such as a background management server that processes search requests sent by users using the terminal devices 701, 702, and 703. The background management server may extract target keywords from the search text, calculate the matching rate, correct the matching rate, and feed back the processing results (such as search results) to the terminal device.

[0099] It should be noted that the data search method provided in the embodiment of the present application is generally executed by the server 705 , and accordingly, the data search device is generally set in the server 705 .

[0100] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0101] According to an embodiment of the present invention, the present invention also provides an electronic device and a computer-readable medium.

[0102] The electronic device of the present invention comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement a data search method of an embodiment of the present invention.

[0103] The computer-readable medium of the present invention stores a computer program, and when the program is executed by a processor, a data search method according to an embodiment of the present invention is implemented.

[0104] Reference below Figure 8 , which shows a schematic diagram of the structure of a computer system 800 suitable for implementing an electronic device of an embodiment of the present invention. Figure 8 The electronic 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.

[0105] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage part 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the computer system 800 are also stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0106] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.

[0107] In particular, according to the embodiments disclosed in the present invention, the process described in the main step diagram above can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the main step diagram. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are executed.

[0108] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0109] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order 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 flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0110] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a matching rate calculation module, a weight calculation module and a correction ranking module. The names of these modules do not constitute a limitation on the modules themselves in some cases. For example, the matching rate calculation module may also be described as "a module for extracting at least one target keyword from a search text and calculating the matching rate between the at least one target keyword and a plurality of set reference fields respectively".

[0111] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: extracting at least one target keyword from the search text, and calculating the matching rate between the at least one target keyword and a plurality of set reference fields respectively; comparing the matching rate with the size of a set first threshold, and in the case that the matching rate is less than the first threshold, calculating the weights corresponding to the plurality of reference fields by using a hierarchical analysis method; correcting the matching rate according to the weight, and sorting the plurality of reference fields according to the corrected matching rate to obtain search results.

[0112] From the above description, it can be seen that the hierarchical word segmentation method is used to calculate the weight corresponding to the reference field, and the weight is used to correct the matching rate, so as to determine the search result based on the corrected matching rate, thereby improving the accuracy of the search result.

[0113] The above product can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.

[0114] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A data search method, characterized in that: include: Extracting at least one target keyword from the search text, and respectively calculating the matching rate between the at least one target keyword and a plurality of set reference fields; comparing the matching rate with a set first threshold, and if the matching rate is less than the first threshold, calculating weights corresponding to the multiple reference fields by using a hierarchy analysis method; The matching rate is modified according to the weight, so that the multiple reference fields are sorted according to the modified matching rate to obtain search results.

2. The method according to claim 1, characterized in that Calculating weights corresponding to the plurality of reference fields using the hierarchical analysis method includes: Establishing a hierarchical model, wherein the hierarchical model includes a target layer, a criterion layer and a solution layer, the overall target of the target layer is the proportion, the criterion layer is the multiple reference fields, and the solution layer is the weight; The importance of elements in the same layer with respect to a single criterion in the previous layer is compared pairwise to construct a judgment comparison matrix; The judgment comparison matrix is ​​normalized to obtain a feature vector, so as to calculate the weights of the multiple reference fields according to the feature vector.

3. The method according to claim 2, characterized in that The method further comprises: Verifying the consistency of the judgment comparison matrix to adjust the judgment comparison matrix according to the consistency verification result; Normalizing the judgment comparison matrix includes: normalizing the adjusted judgment comparison matrix.

4. The method according to claim 3, characterized in that Verifying the consistency of the judgment comparison matrix includes: Calculating the maximum eigenvalue and consistency index of the judgment comparison matrix according to the judgment comparison matrix and the eigenvector; The consistency index is compared with a set second threshold to determine the consistency of the judgment comparison matrix according to the comparison result.

5. The method according to claim 1, characterized in that: Modifying the matching rate according to the weight includes: The weights of the plurality of reference fields are multiplied by the corresponding matching rates to obtain the corrected matching rates.

6. The method according to claim 1, characterized in that Calculating a matching rate between the at least one target keyword and a set reference field includes: respectively calculating the frequency of each target keyword appearing in the reference field and the reverse document frequency in the plurality of reference fields; The frequency of each target keyword appearing in the reference field is multiplied by the corresponding frequency of the reverse file and then summed to obtain a matching rate between the at least one target keyword and the reference field.

7. The method according to claim 1, characterized in that Extract at least one target keyword from the search text, including: Preprocess the search text to obtain multiple candidate keywords; Constructing a candidate keyword graph to iteratively calculate the weights of the plurality of candidate keywords; wherein the candidate keyword graph includes a node set consisting of the plurality of candidate keywords and an edge set between the nodes constructed using a co-occurrence relationship; At least one target keyword is selected from the plurality of candidate keywords according to the weights of the plurality of candidate keywords.

8. A data search device, characterized in that: include: A matching rate calculation module, used to extract at least one target keyword from the search text, and respectively calculate the matching rate between the at least one target keyword and a plurality of set reference fields; A weight calculation module, used for comparing the matching rate with a set first threshold, and when the matching rate is less than the first threshold, calculating the weights corresponding to the multiple reference fields by using a hierarchical analysis method; The correction sorting module is used to correct the matching rate according to the weight, so as to sort the multiple reference fields according to the corrected matching rate to obtain search results.

9. An electronic device, 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.

10. 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

  • Electronic medical record retrieval method and system

    CN107193919A

  • Text data processing method and device and computer readable storage medium

    CN110309251A