Method for sorting search results for search content
By establishing a logic tree and calculating correlation parameters, the problem of poor sorting of search content in the existing technology is solved, and more accurate sorting of search results is achieved.
Patent Information
- Application Number
- CN202210233404.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-03-10
AI Technical Summary
When prior art sorts the search result text by correlation, it is difficult to effectively deal with the complex logical relationships in the search content input by the user, resulting in poor sorting effect.
By establishing a logical tree corresponding to the search content, using the binary (positional parameters and distance parameters) corresponding to the nodes (keywords and logical operators) of the logic tree, the correlation parameters of the search result text and the search content are calculated and sorted accordingly.
This method can more accurately evaluate the correlation between search result text and search content, improving sorting effect, especially when dealing with search content in complex logical relationships.
Smart Images

Figure CN114595319B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of entity relationship extraction, and in particular to a method for sorting search results of search content. Background Art
[0002] For a full-text retrieval system or search engine, it is necessary to search in a specified search scope (such as a database or an Internet webpage) according to the search content input by the user, and display the most relevant text obtained by the search matching to the user. The existing search algorithm generally obtains keywords by segmenting the content input by the user, and then matches them with the words that have appeared in the text in the search scope, and outputs the successfully matched search result text after sorting. In the process of sorting the search result text according to the relevance to the search content input by the user, the prior art generally identifies the search result text with more words successfully matched with the keyword as more relevant to the search content input by the user, and thus sorts it in a more forward position and outputs it to the user. However, when the keywords in the search content input by the user have a more complex logical relationship, the existing search sorting algorithm mainly focuses on the impact of the matching of keywords on the relevance, so the evaluation of the relevance between each search result text and the keyword input by the user is not very reasonable, and the effect of sorting the search result text by relevance is not good. Summary of the invention
[0003] The embodiment of the present application provides a method for sorting search results of search content, so as to solve the problem in the prior art that the sorting effect of search result text by relevance is not good.
[0004] In a first aspect, an embodiment of the present application provides a method for sorting search results of search content, comprising:
[0005] According to the logical expression corresponding to the search content, a logical tree corresponding to the search content is established, wherein the nodes of the logical tree include leaf nodes and non-leaf nodes, the leaf nodes are the keywords, the non-leaf nodes are the logical operators in the logical expression, and the nodes are connected according to the logical relationship of the logical expression;
[0006] For any search result text, a correlation parameter between the search result text and the search content is determined according to the bigram corresponding to the root node of the logic tree; wherein the search result text is a text matched by searching in a specified search range using the keywords of the search content; wherein each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to the appearance position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text;
[0007] The search result texts are sorted according to the relevance parameters corresponding to the search result texts.
[0008] Optionally, the position parameter in the tuple corresponding to each node is determined by:
[0009] For any leaf node in the logic tree, determine the occurrence position of the keyword corresponding to the leaf node in the search result text, and use each of the occurrence positions as a position parameter of a tuple corresponding to the leaf node;
[0010] For any non-leaf node in the logic tree, determine a plurality of next-level nodes corresponding to the non-leaf node, and determine a position parameter of at least one tuple corresponding to the non-leaf node according to position parameters of each tuple corresponding to each of the next-level nodes;
[0011] The distance parameter in the binary pair corresponding to each node is determined as follows:
[0012] For any leaf node in the logic tree, a preset invalid value is used as a distance parameter of all binary groups corresponding to the leaf node;
[0013] For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each next-level node.
[0014] Optionally, if the logical operator corresponding to the non-leaf node is an OR operator, the binary group corresponding to the non-leaf node is all binary groups corresponding to all next-level nodes corresponding to the non-leaf node.
[0015] Optionally, if the logical operator corresponding to the non-leaf node is an AND operator, for any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each of the next-level nodes, including:
[0016] If the next level nodes corresponding to the non-leaf nodes only include leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the position parameters of each binary group corresponding to each next level leaf node;
[0017] If the next level nodes corresponding to the non-leaf nodes only include non-leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the distance parameters of each binary group corresponding to each next level non-leaf node;
[0018] If the next-level nodes corresponding to the non-leaf nodes include both non-leaf nodes and leaf nodes, the distance parameters of at least one binary group corresponding to the non-leaf nodes are jointly determined based on the position parameters of each binary group corresponding to each next-level leaf node and the distance parameters of each binary group corresponding to each next-level non-leaf node.
[0019] Optionally, if the logical operator corresponding to the non-leaf node is an AND operator, the position parameter and the distance parameter in the tuple corresponding to the non-leaf node are determined in the following manner:
[0020] For any next-level node corresponding to the non-leaf node, position parameters of each tuple corresponding to the next-level node are arranged in ascending order to obtain a position parameter sequence;
[0021] Arrange the position parameter sequences corresponding to the next-level nodes in the order of the first item value in the position parameter sequence from small to large;
[0022] Starting from setting the first position parameter in the last position parameter sequence as the reference position parameter, perform the following steps:
[0023] Select a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter, and delete all position parameters in the previous position parameter sequence that are smaller than the selected position parameter; wherein the previous position parameter sequence is a position parameter sequence before the position parameter sequence in which the reference position parameter is located in the position parameter sequence arrangement; then update the determined position parameter to the reference position parameter, and return to the step of selecting a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter in the current position parameter sequence until the selected position parameter is the position parameter of the first position parameter sequence;
[0024] When the selected position parameter is the position parameter of the first position parameter sequence, the first position parameter in each position parameter sequence is taken out as a candidate operation array. If the position parameter exists in all the position parameter sequences at this time, then the step of arranging the position parameter sequences corresponding to each next-level node in ascending order according to the first item value in the position parameter sequence is returned; if there is no position parameter in the position parameter sequence at this time, then for any candidate operation array, the position parameter and distance parameter in a tuple corresponding to the non-leaf node are determined according to the candidate operation array and the distance parameters corresponding to each position parameter in the candidate operation array.
[0025] Optionally, the position parameter and the distance parameter in a tuple corresponding to the non-leaf node are determined according to the candidate operation array in the following manner:
[0026] Taking the average value of the position parameters in the candidate operation array as an integer as the position parameter in a binary group corresponding to the non-leaf node;
[0027] The distance parameter in the binary group is calculated according to the following formula:
[0028]
[0029] distance is the distance parameter in the binary, j and k are serial numbers, and A j is the difference between the jth adjacent items after the position parameters in the candidate operation array are arranged in order of size, B k is the distance parameter of the binary group corresponding to the kth next-level non-leaf node, p is the total number of adjacent item differences, and q is the total number of binary groups corresponding to the next-level non-leaf nodes.
[0030] Optionally, if there are multiple position parameters in the previous position parameter sequence whose difference with the reference position parameter is the smallest, then selecting a position parameter in the previous position parameter sequence whose difference with the reference position parameter is the smallest, includes:
[0031] Select the position parameter with the smallest value among the position parameters in the previous position parameter sequence that have the smallest difference with the reference position parameter.
[0032] Optionally, the correlation parameter between the search result text and the search content is determined specifically by the following formula:
[0033]
[0034] Wherein, Score is the correlation parameter between the search result text and the search content, N is the total number of tuples corresponding to the root node, i is the sequence number, and o i is the position parameter in the i-th tuple corresponding to the root node, d i is the distance parameter in the i-th tuple corresponding to the root node.
[0035] Optionally, the search result text is text matched by searching for keywords of the search content in a specified search range using an inverted index algorithm.
[0036] Optionally, the occurrence position of the keyword corresponding to the leaf node in the search result text is determined by an inverted index list of the search result text, and the inverted index list is obtained by pre-recording the occurrence position of each word in the search result text.
[0037] In a second aspect, an embodiment of the present application further provides a device for sorting search results of search content, including:
[0038] A search content analysis module is used to establish a logic tree corresponding to the search content according to the logic expression corresponding to the search content, wherein the nodes of the logic tree include leaf nodes and non-leaf nodes, the leaf nodes are the keywords, the non-leaf nodes are the logical operators in the logic expression, and the nodes are connected according to the logical relationship of the logic expression;
[0039] A relevance calculation module, for determining, for any search result text, a relevance parameter between the search result text and the search content according to the bigram corresponding to the root node of the logic tree; wherein the search result text is a text matched by searching in a specified search range using the keywords of the search content; wherein each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to an appearance position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text;
[0040] The sorting module is used to sort the search result texts according to the correlation parameters corresponding to the search result texts.
[0041] In a third aspect, an embodiment of the present application further provides an electronic device, including:
[0042] A memory for storing program instructions;
[0043] The processor is used to call the program instructions stored in the memory, and execute the steps included in any one of the methods for sorting search results of search content in the first aspect according to the obtained program instructions.
[0044] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method for sorting search results of search content as described in any one of the first aspects.
[0045] In a fifth aspect, the present application provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the method for sorting search results of search content as described in any one of the first aspects.
[0046] The beneficial effects of this application are as follows:
[0047] The method for sorting search results of search content provided in the embodiment of the present application considers the influence of the position where keywords appear in the search result text on the overall semantics of the search result text, and establishes a logic tree for the search content. The position where keywords appear in the search result text is used to determine the approximate position where the semantics of each logical branch in the search content appear in the search result text, and then the correlation between the search result text and the search content is analyzed using each position and logical relationship, which can better reflect the difference between the semantics of the search result text and the search content. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 A flowchart of a method for sorting search results of search content provided in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of a logic tree established for a search content in an embodiment of the present application;
[0050] Figure 3 One of the partial flow charts of the method for sorting search results of search content provided in an embodiment of the present application;
[0051] Figure 4 A schematic diagram of a logic tree in an embodiment of the present application;
[0052] Figure 5 A second partial flow chart of a method for sorting search results of search content provided in an embodiment of the present application;
[0053] Figure 6 A schematic diagram of the structure of a device for sorting search results of search content provided in an embodiment of the present application;
[0054] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described below in conjunction with the drawings and examples. However, the example embodiments can be implemented in various forms and should not be understood as being limited to the embodiments described herein; on the contrary, these embodiments are provided to make the present application more comprehensive and complete, and to fully convey the concepts of the example embodiments to those skilled in the art. The same figure marks in the figures represent the same or similar structures, and thus their repeated descriptions will be omitted. The words expressing position and direction described in this application are all explained using the drawings as examples, but changes can be made as needed, and the changes made are all included in the scope of protection of this application. The drawings of this application are only used to illustrate the relative position relationship and do not represent the true proportion.
[0056] It should be noted that specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in a variety of other ways different from those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application. Therefore, the present application is not limited to the specific implementation methods disclosed below. The subsequent description of the specification is a preferred implementation method for implementing the present application, but the description is for the purpose of illustrating the general principles of the present application and is not intended to limit the scope of the present application. The scope of protection of the present application shall be determined by the definition of the attached claims.
[0057] The following is a detailed description of a method for sorting search results of search content provided by an embodiment of the present application in conjunction with the accompanying drawings. It should be noted that the acquisition, storage, use, and processing of data in the technical solution of the embodiment of the present application are in compliance with the relevant provisions of national laws and regulations.
[0058] The present application embodiment provides a method for sorting search results of search content, such as Figure 1 As shown, including:
[0059] S110. Establish a logic tree corresponding to the search content according to the logic expression corresponding to the search content; wherein the nodes of the logic tree include leaf nodes and non-leaf nodes, the leaf nodes are the keywords, the non-leaf nodes are the logical operators in the logic expression, and the nodes are connected according to the logical relationship of the logic expression.
[0060] For example, if the search content is "(sports OR fitness) AND (football OR kicking ball) && (happy | joy | (keep && good mood))", the corresponding logic tree is as follows: Figure 2 shown.
[0061] S120. For any search result text, determine the correlation parameter between the search result text and the search content according to the bigram corresponding to the root node of the logic tree. The search result text is a text matched by searching the keywords of the search content in a specified search range; each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to the position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text.
[0062] In a specific implementation process, the specified search scope may be a preset text database, or a web page on the Internet, etc., which is not specifically limited here.
[0063] The following will be<offset,distance> The form represents a tuple, where offset is the position parameter of the tuple and distance is the distance parameter of the tuple.
[0064] S130: Sort the search result texts according to the relevance parameters corresponding to the search result texts.
[0065] In this way, compared with the existing search algorithms, the method for sorting search results of search content provided by the embodiment of the present application takes into account the impact of the position where the keywords appear in the search result text on the overall semantics of the search result text, and establishes a logical tree for the search content. The position where the keywords appear in the search result text is used to determine the approximate position where the semantics of each logical branch in the search content appears in the search result text, and then the correlation between the search result text and the search content is analyzed using each position and logical relationship, which can better reflect the difference between the semantics of the search result text and the search content.
[0066] For example, still using the search content in the above example, there are currently two search result texts as follows:
[0067] (1) “I like sports very much. I play football with my friends every week. This helps me stay in a good mood.”
[0068] (2) "Yesterday, Xiao Ming and I went to play football. I am not a good football player and I don't like watching football games. If he hadn't said that the football team was short of players, I would not have gone to play football. I still like playing basketball to keep fit. After that, he and I went to XX for dinner. After dinner, we watched a movie together. The movie was very good. The main plot was... (omitted hundreds of words). I was very happy after watching the movie."
[0069] In fact, according to semantics, the search result text (1) is highly correlated with the search content, while the search result text (2) is less correlated with the search content. In the existing search sorting algorithm, since the number of times the keyword appears in the search result text (2) is higher than that in the search result text (1), the search result text (2) will be placed before the search result text (1) and output to the user. The method for sorting the search results of the search content provided by the embodiment of the present application, by considering the position where each keyword appears in the search result text, can use the keywords "fitness", "football", "playing football", "fitness" in the search result text (2) to appear at the beginning of the text, and the keyword "happy" to appear at the end of the text, so that the positions of the appearance of each logic branch in the logic tree are far apart, it can be considered that the semantic correlation between the logic branch "(happy|happy|(keep &&good mood))" and other logic branches is not great, and the correlation between the search result text (2) and the search content is relatively low.
[0070] Furthermore, the position parameter in the binary group corresponding to each node is determined by:
[0071] For any leaf node in the logic tree, determine the occurrence position of the keyword corresponding to the leaf node in the search result text, and use each of the occurrence positions as a position parameter of a tuple corresponding to the leaf node;
[0072] For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and position parameters of at least one tuple corresponding to the non-leaf node are determined based on position parameters of each tuple corresponding to each next-level node.
[0073] The distance parameter in the binary pair corresponding to each node is determined as follows:
[0074] For any leaf node in the logic tree, a preset invalid value is used as a distance parameter of all binary groups corresponding to the leaf node;
[0075] For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each next-level node.
[0076] In the specific implementation process, for a leaf node, the position parameter in the corresponding bigram is the position of the keyword corresponding to the leaf node in the search result text, and the position can be a coordinate in the number of words, or a coordinate in the number of words after the search result text is segmented during the search process, which is not limited here. The following will take the coordinate in the number of words as an example for explanation.
[0077] In the specific implementation process, for any leaf node, there is at least one corresponding bigram. For example, for the search result text (2), the keyword "fitness" appears only once, so the bigram corresponding to the leaf node "fitness" is only one <36,-1>; and the keyword "football" appears twice, so the bigram corresponding to the leaf node "football" is two <17,-1> and <23,-1>.
[0078] In the logic tree, a non-leaf node must be the direct or indirect superior node of a leaf node, so the tuples of the non-leaf nodes can ultimately be determined by the tuples of the corresponding leaf nodes.
[0079] The following describes the methods for determining the binary groups of different non-leaf nodes.
[0080] (1) If the logical operator corresponding to the non-leaf node is an OR operator, then the binary group corresponding to the non-leaf node is all binary groups corresponding to all next-level nodes corresponding to the non-leaf node.
[0081] For example, Figure 2 The logical tree shown in includes non-leaf nodes J1-J5, among which the tuple corresponding to the non-leaf node J2 is all the tuples corresponding to the leaf node "sports" and the leaf node "fitness"; the tuple corresponding to the non-leaf node J4 is all the tuples corresponding to the leaf node "happy", the leaf node "joy" and the non-leaf node J5.
[0082] (ii) if the logical operator corresponding to the non-leaf node is an AND operator, then for any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each of the next-level nodes, including:
[0083] If the next level nodes corresponding to the non-leaf nodes only include leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the position parameters of each binary group corresponding to each next level leaf node;
[0084] If the next level nodes corresponding to the non-leaf nodes only include non-leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the distance parameters of each binary group corresponding to each next level non-leaf node;
[0085] If the next-level nodes corresponding to the non-leaf nodes include both non-leaf nodes and leaf nodes, the distance parameters of at least one binary group corresponding to the non-leaf nodes are jointly determined based on the position parameters of each binary group corresponding to each next-level leaf node and the distance parameters of each binary group corresponding to each next-level non-leaf node.
[0086] The following will explain in detail how to determine the binary groups of non-leaf nodes with operators.
[0087] Implementation 1:
[0088] like Figure 3 As shown, the specific steps include:
[0089] S201. Determine all operation arrays corresponding to the non-leaf nodes, wherein each operation array is obtained by selecting a two-tuple position parameter corresponding to any next-level node and combining the selected position parameters.
[0090] S202, calculating the range of the position parameters in each operation array.
[0091] The range is the difference between the maximum and minimum position parameters in the operation array.
[0092] S203, taking the next-level node corresponding to the least number of binary tuples as the reference next-level node, and taking any position parameter corresponding to the reference next-level node as the reference position parameter; for any reference position parameter, determining the operation array with the smallest range in the operation array containing the reference position parameter as the candidate operation array.
[0093] S204 , arranging the candidate operation arrays in order of the reference position parameters from small to large.
[0094] S205: Use the second candidate operation array in the arrangement as a judgment operation array.
[0095] S206: Determine whether any position parameter in the determination operation array has appeared in the candidate operation array at the position before the arrangement.
[0096] If the result of step S206 is yes, execute step S207; if the result of step S206 is no, execute step S208.
[0097] S207, deleting the judgment operation array from all determined operation arrays, and re-determining the operation array with the smallest range in the operation arrays containing the reference position parameters in the deleted judgment operation array, replacing the deleted judgment operation array with the re-determined operation array as a candidate operation array in the arrangement, and updating the replaced candidate operation array as the judgment operation array. Return to step S206.
[0098] S208: Determine whether the determination operation array is the final candidate operation array.
[0099] If the result of step S208 is no, execute step S209; if the result of step S208 is yes, execute step S210.
[0100] S209, updating the candidate operation array at the next position in the arrangement to the judgment operation array. Return to step S206.
[0101] S210. For any one of the candidate operation arrays, determine the position parameter and the distance parameter in a tuple corresponding to the non-leaf node according to the candidate operation array and the distance parameters corresponding to each position parameter in the candidate operation array.
[0102] The position parameter and distance parameter in a binary group corresponding to the non-leaf node are determined according to the candidate operation array in the following manner:
[0103] Taking the average value of the position parameters in the candidate operation array as an integer as the position parameter in a binary group corresponding to the non-leaf node;
[0104] The distance parameter in the binary group is calculated according to the following formula:
[0105]
[0106] distance is the distance parameter in the binary, j and k are serial numbers, and A j is the difference between the jth adjacent items after the position parameters in the candidate operation array are arranged in order of size, B k is the distance parameter of the binary group corresponding to the kth next-level non-leaf node, p is the total number of adjacent item differences, and q is the total number of binary groups corresponding to the next-level non-leaf nodes.
[0107] The above operation process is described below with a specific example.
[0108] like Figure 4 As shown, suppose a non-leaf node J of the AND operator corresponds to three lower-level nodes A, B, and C (that is, the logical expression corresponding to the non-leaf node J is "A and B and C"), where A and B are leaf nodes and C is a non-leaf node. The position parameters of each tuple corresponding to A, B, and C are as follows:
[0109] A: 3, 5, 11
[0110] B: 1, 2, 8, 10
[0111] C: 6, 7, 9, 13, 15, 20
[0112] Determine the operation arrays, each of which includes 3 position parameters, and different position parameters correspond to different next-level nodes. The total number of operation arrays is 3×4×6=72, as follows, where the bracket on the left represents the operation array, and the number pointed to by the right arrow is the range of the position parameter in the operation array:
[0113]
[0114] Since the number of binary groups corresponding to the next-level node A is the least (3 binary groups), the next-level node A is used as the reference next-level node, and the position parameters 3, 5, and 11 corresponding to the next-level node A are used as reference position parameters, respectively. The operation array (3,2,6) with the smallest range in the operation array containing position parameter 3, the operation array (5,8,6) with the smallest range in the operation array containing position parameter 5, and the operation array (11,10,9) with the smallest range in the operation array containing position parameter 11 are determined. (3,2,6), (5,8,6), and (11,10,9) are used as candidate operation arrays, and are arranged in ascending order according to the position parameters 3, 5, and 11 corresponding to the next-level node A:
[0115] (3,2,6)
[0116] (5,8,6)
[0117] (11,10,9)
[0118] Starting from the second candidate operation array (5,8,6) in the arrangement, since the position parameter 6 in (5,8,6) has appeared in the previous candidate operation array (3,2,6), then delete (5,8,6) from all the above operation arrays, and re-determine the operation array (5,8,7) with the smallest range among the operation arrays containing the position parameter 5. Replace (5,8,6) with (5,8,7) in the arrangement. At this time, the sequence of candidate operation arrays is as follows:
[0119] (3,2,6)
[0120] (5,8,7)
[0121] (11,10,9)
[0122] For the candidate operation array (11, 10, 9) and so on, there is no need to delete or replace them, so the final arrangement of the candidate operation array is:
[0123] (3,2,6)
[0124] (5,8,7)
[0125] (11,10,9)
[0126] For the candidate operation array (3,2,6), the corresponding two-tuple is:
[0127] Positional parameters:
[0128] If the next-level node C corresponds to a binary group <6,7>, then:
[0129] Distance parameters:
[0130] Thus, a binary tuple of the non-leaf node J is obtained as <4,4>.
[0131] For the candidate operation array (5,8,7), the corresponding tuple is:
[0132] Positional parameters:
[0133] If the next-level node C corresponds to a binary group <7,3>, then:
[0134] Distance parameters:
[0135] Thus, a binary group of the non-leaf node J is obtained as <7,2>.
[0136] For the candidate operation array (11,10,9), the corresponding two-tuple is:
[0137] Positional parameters:
[0138] If the next-level node C corresponds to a binary group <9,13>, then:
[0139] Distance parameters:
[0140] Thus, a binary group of the non-leaf node J is obtained as <10,5>.
[0141] In summary, the tuples corresponding to the non-leaf node J are <4,4>, <7,2>, and <10,5>.
[0142] Through creative research, the inventors have found that the position of a word and the distance between words will affect the overall semantics of the text to a certain extent. For example, the search result text (2) mentioned above has a large semantic difference with the search content because the distance between different keywords is too far. In the above example, the non-leaf node J corresponds to two leaf nodes and one non-leaf node. In fact, in the logic tree, there must be non-leaf nodes whose next-level nodes are all leaf nodes. Then, if the non-leaf node is regarded as an abstract "keyword", then in the binary group corresponding to this non-leaf node, through the above operation process, the search result text can be divided according to the text in which the keywords corresponding to each next-level node of the non-leaf node appear once, and each operation array represents a division method. The process of finding the operation array with the smallest extreme difference is to find the text division method in which different keywords appear once in a row. The text content of the position range in which different keywords appear in a row is likely to represent the semantics of this non-leaf node, and can therefore be regarded as the "central position" of each keyword of the next-level node in the divided text range, or as the appearance position of the abstract keyword corresponding to the non-leaf node. The process of excluding candidate operation arrays with the same position parameters is to avoid the overlap of the appearance positions of the abstract keywords corresponding to the non-leaf nodes. The distance parameter in the bigram corresponding to the non-leaf node can represent the distance between the words in the text range where such keywords appear continuously. Then, by analogy, for the non-leaf node J in the next-level node that includes both leaf nodes and non-leaf nodes, the position parameter of each bigram can represent the "center position" in the division range where the keyword and abstract keyword of the next-level node appear continuously once, or be regarded as the appearance position of the abstract keyword corresponding to the non-leaf node J; the distance parameter in the bigram corresponding to the non-leaf node J can represent the distance between the words in the text range where such keywords and abstract keywords appear continuously. Correspondingly, the bigram of the leaf node only represents the appearance position of one keyword, and the position parameter in the bigram represents the appearance position coordinate of the keyword. The leaf node only corresponds to one keyword, and there is no concept of the distance between the words between multiple keywords, so its distance parameter is an invalid value.
[0143] The above process calculates the binary pairs of the operator non-leaf nodes by finding the operation array with the smallest range under the premise of non-repetitive values, and can find the optimal division of the text range where the keywords corresponding to each non-leaf node in the search result text appear continuously. (where i is the sequence number, n is the iThe number of binary groups corresponding to the ith next-level node and m the number of next-level nodes corresponding to non-leaf nodes) is processed by an operation array. When there are many keywords in the search content and the logical relationship of the logical expression is more complicated, the amount of operation will be very large. In order to reduce the amount of operation and speed up the operation, the above process can be further improved, such as the implementation scheme 2 described below.
[0144] Implementation 2:
[0145] like Figure 5 As shown, the specific steps include:
[0146] S401. For any next-level node corresponding to the non-leaf node, position parameters of each tuple corresponding to the next-level node are arranged in order from small to large to obtain a position parameter sequence.
[0147] S402: Arrange the position parameter sequences corresponding to the next-level nodes in the order of the first item value in the position parameter sequence from small to large.
[0148] S403: Set the first position parameter in the last position parameter sequence as a reference position parameter.
[0149] S404: Select a position parameter in a previous position parameter sequence that has the smallest difference with the reference position parameter, and delete all position parameters in the previous position parameter sequence that are smaller than the determined position parameter. The previous position parameter sequence is a position parameter sequence before the position parameter sequence where the reference position parameter is located in the position parameter sequence arrangement.
[0150] In a specific implementation process, if there are multiple position parameters in the previous position parameter sequence whose differences with the reference position parameter are the smallest, the position parameter with the smallest value may be selected.
[0151] S405: Update the selected position parameter to the reference position parameter.
[0152] S406: Determine whether the returned reference position parameter is a position parameter in the first position sequence.
[0153] If the result of step S406 is yes, execute step S407; if the result of step S406 is no, execute step S404.
[0154] S407: Take out the first position parameter in each position parameter sequence and combine them into a candidate operation array.
[0155] S408: Determine whether all position parameter sequences contain position parameters.
[0156] If the result of step S408 is yes, return to step S402; if the result of step S408 is no, execute step S409.
[0157] S409, for any candidate operation array, determine the position parameter and distance parameter in a tuple corresponding to the non-leaf node according to the candidate operation array and the distance parameter corresponding to each position parameter in the candidate operation array;
[0158] The position parameter and distance parameter in a binary group corresponding to the non-leaf node are determined according to the candidate operation array in the following manner:
[0159] Taking the average value of the position parameters in the candidate operation array as an integer as the position parameter in a binary group corresponding to the non-leaf node;
[0160] The distance parameter in the binary group is calculated according to the following formula:
[0161]
[0162] distance is the distance parameter in the binary, j and k are serial numbers, and A j is the difference between the jth adjacent items after the position parameters in the candidate operation array are arranged in order of size, B k is the distance parameter of the binary group corresponding to the kth next-level non-leaf node, p is the total number of adjacent item differences, and q is the total number of binary groups corresponding to the next-level non-leaf nodes.
[0163] The following is an example of the case where the non-leaf node J in the above example corresponds to three next-level nodes A, B, and C.
[0164] The positional parameter sequences corresponding to A, B, and C are as follows:
[0165] A: 3, 5, 11
[0166] B: 1, 2, 8, 10
[0167] C: 6, 7, 9, 13, 15, 20
[0168] Arrange the position parameter sequences corresponding to each next-level node in the order of the first item value in the position parameter sequence from small to large, that is:
[0169] B: 1, 2, 8, 10
[0170] A: 3, 5, 11
[0171] C: 6, 7, 9, 13, 15, 20
[0172] First, the first position parameter 6 of the last position parameter sequence is used as the reference position parameter. The position parameter with the smallest difference with the reference position parameter 6 in the previous position parameter sequence A is 5. Then delete the position parameter 3 in the position parameter sequence A. At this time:
[0173] B: 1, 2, 8, 10
[0174] A: 5, 11
[0175] C: 6, 7, 9, 13, 15, 20
[0176] The position parameter 5 in the position parameter sequence A is used as the reference position parameter. The position parameter with the smallest difference with the reference position parameter 5 in the previous position parameter sequence A is selected as 2. Then the position parameter 1 in the position parameter sequence A is deleted. At this time:
[0177] B: 2, 8, 10
[0178] A: 5, 11
[0179] C: 6, 7, 9, 13, 15, 20
[0180] At this point, the first position parameter sequence has been selected, and there is no corresponding previous position parameter sequence. At this point, the first position parameter in each position parameter sequence is taken out and combined into a candidate operation array (2,5,6). At this point:
[0181] B: 8, 10
[0182] A: 11
[0183] C: 7, 9, 13, 15, 20
[0184] Arrange the position parameter sequences corresponding to each next-level node in the order of the first item value in the position parameter sequence from small to large, that is:
[0185] C: 7, 9, 13, 15, 20
[0186] B: 8, 10
[0187] A: 11
[0188] The first position parameter in the last position parameter sequence C is used as the base position parameter, and the above process is repeated to obtain a candidate operation array (11,10,9). At this time:
[0189] C: 13, 15, 20
[0190] Second:
[0191] First:
[0192] At this time, there are no position parameters in the position parameter sequences A and B, and the process of determining the candidate operation array ends, and a total of two candidate operation arrays (2,5,6) and (11,10,9) are obtained.
[0193] For the candidate operation array (2,5,6), the corresponding tuple is:
[0194] Positional parameters:
[0195] If the next-level node C corresponds to a binary group <6,7>, then:
[0196] Distance parameters:
[0197] Thus, a binary tuple of the non-leaf node J is obtained as <4,4>.
[0198] For the candidate operation array (11,10,9), the corresponding two-tuple is:
[0199] Positional parameters:
[0200] If the next-level node C corresponds to a binary group <7,3>, then:
[0201] Distance parameters:
[0202] Thus, a binary tuple of the non-leaf node J is obtained as <7,2>.
[0203] In summary, the tuples corresponding to the non-leaf node J are <4,4> and <7,2>.
[0204] It should be noted that other technical solutions obtained by those skilled in the art through simple transformation of the above process should be regarded as equivalent technical solutions of the embodiments of the present application and belong to the scope of the present application. For example, in the above implementation scheme 2, if the step S402 is modified to: arrange the position parameter sequences corresponding to each next-level node in the order of the first item value in the position parameter sequence from large to small, and at the same time, the step S403 is modified to: set the last position parameter in the last position parameter sequence as the reference position parameter, and the step S407 is modified to: take out the last position parameter in each position parameter sequence and combine them into a candidate operation array, then this modification is equivalent to the above-mentioned solution and does not deviate from the scope of the embodiments of the present application.
[0205] Through the technical solution introduced above, starting from the leaf nodes of the logic tree, the tuples corresponding to all nodes can be determined in order from the lower nodes to the upper nodes, and finally the tuple corresponding to the root node can be obtained.
[0206] In many cases, if the number of words between the positions where the keywords appear is closer, the correlation between the meaning of the text in which these keywords appear and the semantics of the keywords themselves will be higher; in addition, for text content with a large number of words, generally when the keywords appear at important positions such as the beginning of the text content, the correlation between the overall semantics of the text content and the keywords will be higher.
[0207] Optionally, the correlation parameter between the search result text and the search content is determined specifically by the following formula:
[0208]
[0209] Wherein, Score is the correlation parameter between the search result text and the search content, N is the total number of tuples corresponding to the root node, i is the sequence number, and o i is the position parameter in the i-th tuple corresponding to the root node, d i is the distance parameter in the i-th tuple corresponding to the root node.
[0210] Optionally, the search result text is text matched by searching for keywords of the search content in a specified search range using an inverted index algorithm.
[0211] Optionally, the occurrence position of the keyword corresponding to the leaf node in the search result text is determined by an inverted index list of the search result text, and the inverted index list is obtained by pre-recording the occurrence position of each word in the search result text.
[0212] Based on the same inventive concept, the embodiment of the present application also provides a device for sorting search results of search content, such as Figure 6 As shown, including:
[0213] The search content analysis module M110 is used to establish a logic tree corresponding to the search content according to the logic expression corresponding to the search content, wherein the nodes of the logic tree include leaf nodes and non-leaf nodes, the leaf nodes are the keywords, the non-leaf nodes are the logical operators in the logic expression, and the nodes are connected according to the logical relationship of the logic expression;
[0214] A correlation calculation module M120 is used to determine, for any search result text, a correlation parameter between the search result text and the search content according to the bigram corresponding to the root node of the logic tree; wherein the search result text is a text matched by searching in a specified search range using the keywords of the search content; wherein each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to the appearance position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text;
[0215] The sorting module M130 is used to sort the search result texts according to the relevance parameters corresponding to the search result texts.
[0216] Optionally, the position parameter in the tuple corresponding to each node is determined by:
[0217] For any leaf node in the logic tree, determine the occurrence position of the keyword corresponding to the leaf node in the search result text, and use each of the occurrence positions as a position parameter of a tuple corresponding to the leaf node;
[0218] For any non-leaf node in the logic tree, determine a plurality of next-level nodes corresponding to the non-leaf node, and determine a position parameter of at least one tuple corresponding to the non-leaf node according to position parameters of each tuple corresponding to each of the next-level nodes;
[0219] The distance parameter in the binary pair corresponding to each node is determined as follows:
[0220] For any leaf node in the logic tree, a preset invalid value is used as a distance parameter of all binary groups corresponding to the leaf node;
[0221] For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each next-level node.
[0222] Optionally, if the logical operator corresponding to the non-leaf node is an OR operator, the binary group corresponding to the non-leaf node is all binary groups corresponding to all next-level nodes corresponding to the non-leaf node.
[0223] Optionally, if the logical operator corresponding to the non-leaf node is an AND operator, for any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each of the next-level nodes, including:
[0224] If the next level nodes corresponding to the non-leaf nodes only include leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the position parameters of each binary group corresponding to each next level leaf node;
[0225] If the next level nodes corresponding to the non-leaf nodes only include non-leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the distance parameters of each binary group corresponding to each next level non-leaf node;
[0226] If the next-level nodes corresponding to the non-leaf nodes include both non-leaf nodes and leaf nodes, the distance parameters of at least one binary group corresponding to the non-leaf nodes are jointly determined based on the position parameters of each binary group corresponding to each next-level leaf node and the distance parameters of each binary group corresponding to each next-level non-leaf node.
[0227] Optionally, if the logical operator corresponding to the non-leaf node is an AND operator, the position parameter and the distance parameter in the tuple corresponding to the non-leaf node are determined in the following manner:
[0228] For any next-level node corresponding to the non-leaf node, position parameters of each tuple corresponding to the next-level node are arranged in ascending order to obtain a position parameter sequence;
[0229] Arrange the position parameter sequences corresponding to the next-level nodes in the order of the first item value in the position parameter sequence from small to large;
[0230] Starting from setting the first position parameter in the last position parameter sequence as the reference position parameter, perform the following steps:
[0231] Select a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter, and delete all position parameters in the previous position parameter sequence that are smaller than the selected position parameter; wherein the previous position parameter sequence is a position parameter sequence before the position parameter sequence in which the reference position parameter is located in the position parameter sequence arrangement; then update the determined position parameter to the reference position parameter, and return to the step of selecting a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter in the current position parameter sequence until the selected position parameter is the position parameter of the first position parameter sequence;
[0232] When the selected position parameter is the position parameter of the first position parameter sequence, the first position parameter in each position parameter sequence is taken out as a candidate operation array. If the position parameter exists in all the position parameter sequences at this time, then the step of arranging the position parameter sequences corresponding to each next-level node in ascending order according to the first item value in the position parameter sequence is returned; if there is no position parameter in the position parameter sequence at this time, then for any candidate operation array, the position parameter and distance parameter in a tuple corresponding to the non-leaf node are determined according to the candidate operation array and the distance parameters corresponding to each position parameter in the candidate operation array.
[0233] Optionally, the position parameter and the distance parameter in a tuple corresponding to the non-leaf node are determined according to the candidate operation array in the following manner:
[0234] Taking the average value of the position parameters in the candidate operation array as an integer as the position parameter in a binary group corresponding to the non-leaf node;
[0235] The distance parameter in the binary group is calculated according to the following formula:
[0236]
[0237] distance is the distance parameter in the binary, j and k are serial numbers, and A j is the difference between the jth adjacent items after the position parameters in the candidate operation array are arranged in order of size, B k is the distance parameter of the binary group corresponding to the kth next-level non-leaf node, p is the total number of adjacent item differences, and q is the total number of binary groups corresponding to the next-level non-leaf nodes.
[0238] Optionally, if there are multiple position parameters in the previous position parameter sequence whose difference with the reference position parameter is the smallest, then selecting a position parameter in the previous position parameter sequence whose difference with the reference position parameter is the smallest, includes:
[0239] Select the position parameter with the smallest value among the position parameters in the previous position parameter sequence that have the smallest difference with the reference position parameter.
[0240] Optionally, the correlation parameter between the search result text and the search content is determined specifically by the following formula:
[0241]
[0242] Wherein, Score is the correlation parameter between the search result text and the search content, N is the total number of tuples corresponding to the root node, i is the sequence number, and o i is the position parameter in the i-th tuple corresponding to the root node, d i is the distance parameter in the i-th tuple corresponding to the root node.
[0243] Optionally, the search result text is text matched by searching for keywords of the search content in a specified search range using an inverted index algorithm.
[0244] Optionally, the occurrence position of the keyword corresponding to the leaf node in the search result text is determined by an inverted index list of the search result text, and the inverted index list is obtained by pre-recording the occurrence position of each word in the search result text.
[0245] It should be noted that the division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each module in each embodiment of the present application may be integrated into a processing unit, or each module may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional units.
[0246] Since the specific manner in which each module of the apparatus for sorting search results of search content performs operations has been described in detail in the embodiment of the method, it will not be repeated here.
[0247] Based on the same inventive concept, the present application embodiment also provides an electronic device, such as Figure 7 As shown, including:
[0248] Memory 101, used for storing program instructions;
[0249] The processor 102 is used to call the program instructions stored in the memory 101, and execute the steps included in the method for sorting search results of search content according to the obtained program instructions.
[0250] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium, and a computer program product includes: a computer program code, when the computer program code runs on a computer, the computer executes any method for sorting search results of search content as discussed above.
[0251] Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to the above-mentioned method for sorting search results of search content, the implementation of the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0252] Based on the same inventive concept, an embodiment of the present application further provides a computer program product, which includes: a computer program code, which, when executed on a computer, enables the computer to execute any of the methods for sorting search results of search content as discussed above.
[0253] Since the principle of solving the problem by the above computer program product is similar to the above method for sorting search results of search content, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0254] The method for sorting search results of search content provided in the embodiment of the present application considers the influence of the position where keywords appear in the search result text on the overall semantics of the search result text, and establishes a logic tree for the search content. The position where keywords appear in the search result text is used to determine the approximate position where the semantics of each logical branch in the search content appear in the search result text, and then the correlation between the search result text and the search content is analyzed using each position and logical relationship, which can better reflect the difference between the semantics of the search result text and the search content.
[0255] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0256] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0257] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0258] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0259] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for sorting search results of search content, characterized in that: include: According to the logical expression corresponding to the search content, a logical tree corresponding to the search content is established; The nodes of the logic tree include leaf nodes and non-leaf nodes, the leaf nodes are keywords, the non-leaf nodes are logical operators in the logic expression, and the nodes are connected according to the logical relationship of the logic expression; For any search result text, a correlation parameter between the search result text and the search content is determined according to the bigram corresponding to the root node of the logic tree; wherein the search result text is a text matched by searching in a specified search range using the keywords of the search content; wherein each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to the appearance position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text; Sorting each of the search result texts according to the relevance parameter corresponding to each of the search result texts; The position parameter in the binary group corresponding to each node is determined in the following way: For any leaf node in the logic tree, determine the occurrence position of the keyword corresponding to the leaf node in the search result text, and use each of the occurrence positions as a position parameter of a tuple corresponding to the leaf node; For any non-leaf node in the logic tree, determine a plurality of next-level nodes corresponding to the non-leaf node, and determine a position parameter of at least one tuple corresponding to the non-leaf node according to position parameters of each tuple corresponding to each of the next-level nodes; The distance parameter in the binary pair corresponding to each node is determined as follows: For any leaf node in the logic tree, a preset invalid value is used as a distance parameter of all binary groups corresponding to the leaf node; For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each next-level node.
2. The method according to claim 1, characterized in that If the logical operator corresponding to the non-leaf node is an OR operator, then the binary group corresponding to the non-leaf node is all binary groups corresponding to all next-level nodes corresponding to the non-leaf node.
3. The method according to claim 1, characterized in that If the logical operator corresponding to the non-leaf node is an AND operator, for any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each of the next-level nodes, including: If the next level nodes corresponding to the non-leaf nodes only include leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the position parameters of each binary group corresponding to each next level leaf node; If the next level nodes corresponding to the non-leaf nodes only include non-leaf nodes, determining the distance parameter of at least one binary group corresponding to the non-leaf nodes according to the distance parameters of each binary group corresponding to each next level non-leaf node; If the next-level nodes corresponding to the non-leaf nodes include both non-leaf nodes and leaf nodes, the distance parameters of at least one binary group corresponding to the non-leaf nodes are jointly determined based on the position parameters of each binary group corresponding to each next-level leaf node and the distance parameters of each binary group corresponding to each next-level non-leaf node.
4. The method according to claim 3, characterized in that If the logical operator corresponding to the non-leaf node is an AND operator, the position parameter and the distance parameter in the binary group corresponding to the non-leaf node are determined in the following manner: For any next-level node corresponding to the non-leaf node, position parameters of each tuple corresponding to the next-level node are arranged in ascending order to obtain a position parameter sequence; Arrange the position parameter sequences corresponding to the next-level nodes in the order of the first item value in the position parameter sequence from small to large; Starting with the first position parameter in the last position parameter sequence set as the base position parameter, perform the following steps: Select a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter, and delete all position parameters in the previous position parameter sequence that are smaller than the selected position parameter; wherein the previous position parameter sequence is a position parameter sequence before the position parameter sequence in which the reference position parameter is located in the position parameter sequence arrangement; then update the determined position parameter to the reference position parameter, and return to the step of selecting a position parameter in the previous position parameter sequence that has the smallest difference with the reference position parameter in the current position parameter sequence until the selected position parameter is the position parameter of the first position parameter sequence; When the selected position parameter is the position parameter of the first position parameter sequence, the first position parameter in each position parameter sequence is taken out as a candidate operation array, and if the position parameter exists in all position parameter sequences at this time, the step of arranging the position parameter sequences corresponding to each next-level node in ascending order according to the first item value in the position parameter sequence is returned; If there is no position parameter in the position parameter sequence at this time, for any candidate operation array, the position parameter and distance parameter in a tuple corresponding to the non-leaf node are determined based on the candidate operation array and the distance parameters corresponding to each position parameter in the candidate operation array.
5. The method according to claim 4, characterized in that Determine the position parameter and distance parameter in a tuple corresponding to the non-leaf node according to the candidate operation array in the following manner: Taking the average value of the position parameters in the candidate operation array as an integer as the position parameter in a binary group corresponding to the non-leaf node; The distance parameter in the binary group is calculated according to the following formula: distance is the distance parameter in the binary, j and k are serial numbers, and A j is the difference between the jth adjacent items after the position parameters in the candidate operation array are arranged in order of size, B k is the distance parameter of the binary group corresponding to the kth next-level non-leaf node, p is the total number of adjacent item differences, and q is the total number of binary groups corresponding to the next-level non-leaf nodes.
6. The method according to claim 4, characterized in that If there are multiple position parameters with the smallest difference between the previous position parameter sequence and the reference position parameter, then the position parameter with the smallest difference between the previous position parameter sequence and the reference position parameter is selected, including: Select the position parameter with the smallest value among the position parameters in the previous position parameter sequence that have the smallest difference with the reference position parameter.
7. The method according to claim 1, characterized in that Specifically, the correlation parameter between the search result text and the search content is determined by the following formula: Wherein, Score is the correlation parameter between the search result text and the search content, N is the total number of tuples corresponding to the root node, i is the sequence number, and o i is the position parameter in the i-th tuple corresponding to the root node, d i is the distance parameter in the i-th tuple corresponding to the root node.
8. The method according to claim 1, characterized in that The search result text is text that is matched by searching the keywords of the search content in a specified search range using an inverted index algorithm.
9. The method according to claim 8, characterized in that The occurrence position of the keyword corresponding to the leaf node in the search result text is determined by an inverted index list of the search result text, and the inverted index list is obtained by pre-recording the occurrence position of each word in the search result text.
10. A device for sorting search results of search content, characterized in that: include: A search content analysis module is used to establish a logic tree corresponding to the search content according to the logic expression corresponding to the search content, wherein the nodes of the logic tree include leaf nodes and non-leaf nodes, the leaf nodes are keywords, the non-leaf nodes are logical operators in the logic expression, and the nodes are connected according to the logical relationship of the logic expression; A relevance calculation module, for determining, for any search result text, a relevance parameter between the search result text and the search content according to the bigram corresponding to the root node of the logic tree; wherein the search result text is a text matched by searching in a specified search range using the keywords of the search content; wherein each node in the logic tree corresponds to at least one bigram, and each bigram includes a position parameter related to an appearance position of the keyword corresponding to the node in the search result text, and a distance parameter of the keyword corresponding to the node in the search result text; A sorting module, used to sort the search result texts according to the relevance parameters corresponding to the search result texts; The position parameter in the binary group corresponding to each node is determined in the following way: For any leaf node in the logic tree, determine the occurrence position of the keyword corresponding to the leaf node in the search result text, and use each of the occurrence positions as a position parameter of a tuple corresponding to the leaf node; For any non-leaf node in the logic tree, determine a plurality of next-level nodes corresponding to the non-leaf node, and determine a position parameter of at least one tuple corresponding to the non-leaf node according to position parameters of each tuple corresponding to each of the next-level nodes; The distance parameter in the binary pair corresponding to each node is determined as follows: For any leaf node in the logic tree, a preset invalid value is used as a distance parameter of all binary groups corresponding to the leaf node; For any non-leaf node in the logic tree, multiple next-level nodes corresponding to the non-leaf node are determined, and a distance parameter of at least one binary group corresponding to the non-leaf node is determined according to each binary group corresponding to each next-level node.
11. An electronic device, characterized in that: include: A memory for storing program instructions; The processor is used to call the program instructions stored in the memory, and execute the steps included in the method for sorting search results of search content as described in any one of claims 1 to 9 according to the obtained program instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method for sorting search results of search content according to any one of claims 1 to 9.
13. A computer program product, characterized in that The computer program product comprises: a computer program code, which, when executed on a computer, enables the computer to execute the method for sorting search results of search content according to any one of claims 1 to 9.
Citation Information
Patent Citations
Intellectual property matching technology based on keyword extraction and word shift distance
CN111027306A
Data processing method and device and electronic equipment
CN111291069A