Term search method and device, storage medium and computer equipment
By dividing statistical index entries into multiple levels and determining word segmentation weight values, the problem of difficult word order judgment in the prior art is solved, and higher search accuracy is achieved.
Patent Information
- Application Number
- CN202210036469.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-13
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2042-01-13
AI Technical Summary
The existing statistical indicator search methods can only search for keywords and cannot judge the word order, resulting in low search accuracy.
By dividing the entries to be searched into multiple levels, we obtain the word segmentation corresponding to each level, and determine its weight value according to the hierarchy and position of the word segmentation, and then search and sort the word segmentation in the text to be searched to determine the entries to be searched to determine the 's entry weight value and position value ultimately improve search accuracy.
It effectively solves the problem of difficult word order judgment, improves the accuracy of entry search, and ensures that the search results are more accurate.
Smart Images

Figure CN114510938B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vertical search engines for scientific terms based on short phrases and word groups, and in particular to a term search method and device, a storage medium, and a computer device. Background Art
[0002] Statistical indicator searches target the names of these indicators. Each indicator name is a highly specialized scientific term, consisting of several attributives and a subject. It's a phrase rather than a natural semantic sample. For example, for the two indicators "total investment from Beijing to Shandong" and "total investment from Shandong to Beijing," the word order of "Shandong" and "Beijing" is crucial. Existing search methods for statistical indicators rely solely on keyword searches, and the word order of the searched terms often doesn't match the statistical indicator, resulting in low search accuracy. Summary of the Invention
[0003] In view of this, the present application provides a term search method and apparatus, a storage medium, and a computer device, which can search for terms based on word order, thereby improving search accuracy.
[0004] According to one aspect of the present application, a term search method is provided, comprising:
[0005] Dividing the search term into multiple levels according to the length of the search term, obtaining at least one segmentation word corresponding to each level, and determining a weight value for each segmentation word, wherein the total number of levels of the search term is positively correlated with the length, and the weight value of each segmentation word is positively correlated with the level of the segmentation word;
[0006] Sort the segmented words and determine the position of each segmented word;
[0007] Obtaining a text to be searched, searching for the segmented word in the text to be searched, and obtaining a target segmented word;
[0008] Determining a target weight value corresponding to the target participle from the plurality of weight values, determining a target position corresponding to the target participle from the plurality of positions, and determining a term weight value and a term position value of the term to be searched based on the target weight value of the target participle and the target position of the target participle;
[0009] The similarity between the text to be searched and the term to be searched is determined according to the term weight value and the term position value, and the search result is determined according to the similarity.
[0010] Optionally, dividing the search terms into multiple levels and obtaining at least one word segment corresponding to each level specifically includes:
[0011] Obtain the total number N of the levels, where N is a positive integer;
[0012] Dividing the to-be-searched term into a plurality of first-level segmented words corresponding to the first level;
[0013] Each m-1th word segment corresponding to the m-1th layer is divided into multiple mth word segments corresponding to the mth layer, where m is an integer greater than 1 and not greater than N.
[0014] Optionally, determining the weight value of each word segment specifically includes:
[0015] Determine a first weight value corresponding to each first-layer segmentation according to the number of the first-layer segmentations;
[0016] Determine the mth weight corresponding to the mth layer participle according to the length of each mth layer participle, the length of the m-1th layer participle corresponding to the mth layer participle, and the m-1th weight of the m-1th layer participle corresponding to the mth layer participle.
[0017] Optionally, sorting the word segments specifically includes:
[0018] Determining the order of the first-layer segmented words according to the position of each first-layer segmented word in the to-be-searched term;
[0019] Determine the m-th level segmentation corresponding to each m-1-th level segmentation, and obtain the m-th level segmentation group corresponding to each of the m-1-th level segmentations;
[0020] According to the position of each m-th level segmentation in the m-th level segmentation group in the corresponding m-1-th level segmentation, the order of the m-th level segmentation in the m-th level segmentation group is determined, and the m-th level segmentation is placed after the corresponding m-1-th segmentation in order.
[0021] Optionally, determining the term weight value and the term position value of the term to be searched based on the target weight value of the target participle and the target position of the target participle specifically includes:
[0022] The entry position value is determined according to the target position, the position of each target word segment in the entry to be searched, the length of the entry to be searched, and the length of the text to be searched.
[0023] Optionally, searching for the segmented word in the text to be searched to obtain a target segmented word specifically includes:
[0024] Searching for the segmented words in the text to be searched, and using all the segmented words found as a set of candidate segmented words;
[0025] If the candidate segmentation set contains an m-1th level target segmentation and all m-th level target segmentations corresponding to the m-1th level target segmentation, then all m-th level target segmentations corresponding to the m-1th level target segmentation are removed from the candidate segmentation set to obtain a target segmentation set;
[0026] Each word in the target word set is used as the target word.
[0027] Optionally, determining the term weight value and the term position value of the term to be searched based on the target weight value of the target participle and the target position of the target participle specifically includes:
[0028] If the target word segmentation set includes an m-1th level target word and at least one m-th level target word corresponding to the m-1th level target word, then the at least one m-th level target word corresponding to the m-1th level target word is removed from the target word segmentation set;
[0029] The target weight value of each remaining target word in the target word set is accumulated to obtain the term weight value.
[0030] According to another aspect of the present application, a term search device is provided, comprising:
[0031] a hierarchical module, configured to divide the search terms into multiple levels according to the length of the search terms, obtain at least one segmentation word corresponding to each level, and determine a weight value for each segmentation word, wherein the total number of levels of the search terms is positively correlated with the length, and the weight value of each segmentation word is positively correlated with the level of the segmentation word;
[0032] A positioning module, configured to sort the segmented words and determine the position of each segmented word;
[0033] A search module is used to obtain a text to be searched, search for the segmented words in the text to be searched, and obtain a target segmented word;
[0034] a calculation module, configured to determine a target weight value corresponding to the target participle from among the plurality of weight values, determine a target position corresponding to the target participle from among the plurality of positions, and determine a term weight value and a term position value of the term to be searched based on the target weight value and the target position;
[0035] The calculation module is further configured to determine the similarity between the text to be searched and the term to be searched based on the term weight value and the term position value, and determine the search result based on the similarity.
[0036] Optionally, the layering module includes a division unit. The division unit is specifically configured to:
[0037] Obtain the total number N of the levels, where N is a positive integer;
[0038] Dividing the to-be-searched term into a plurality of first-level segmented words corresponding to the first level;
[0039] Each m-1th word segment corresponding to the m-1th layer is divided into multiple mth word segments corresponding to the mth layer, where m is an integer greater than 1 and not greater than N.
[0040] Optionally, the stratification module further includes a weight calculation unit. The weight calculation unit is specifically configured to:
[0041] Determine a first weight value corresponding to each first-layer segmentation according to the number of the first-layer segmentations;
[0042] Determine the mth weight corresponding to the mth layer participle according to the length of each mth layer participle, the length of the m-1th layer participle corresponding to the mth layer participle, and the m-1th weight of the m-1th layer participle corresponding to the mth layer participle.
[0043] Optionally, the positioning module is specifically configured to:
[0044] Determining the order of the first-layer segmented words according to the position of each first-layer segmented word in the to-be-searched term;
[0045] Determine the m-th level segmentation corresponding to each m-1-th level segmentation, and obtain the m-th level segmentation group corresponding to each of the m-1-th level segmentations;
[0046] According to the position of each m-th level segmentation in the m-th level segmentation group in the corresponding m-1-th level segmentation, the order of the m-th level segmentation in the m-th level segmentation group is determined, and the m-th level segmentation is placed after the corresponding m-1-th segmentation in order.
[0047] Optionally, the calculation module is specifically configured to:
[0048] The entry position value is determined according to the target position, the position of each target word segment in the entry to be searched, the length of the entry to be searched, and the length of the text to be searched.
[0049] Optionally, the search module is specifically configured to:
[0050] Searching for the segmented words in the text to be searched, and using all the segmented words found as a set of candidate segmented words;
[0051] If the candidate segmentation set contains an m-1th level target segmentation and all m-th level target segmentations corresponding to the m-1th level target segmentation, then all m-th level target segmentations corresponding to the m-1th level target segmentation are removed from the candidate segmentation set to obtain a target segmentation set;
[0052] Each word in the target word set is used as the target word.
[0053] Optionally, the calculation module is specifically configured to:
[0054] If the target word segmentation set includes an m-1th level target word and at least one m-th level target word corresponding to the m-1th level target word, then the at least one m-th level target word corresponding to the m-1th level target word is removed from the target word segmentation set;
[0055] The target weight value of each remaining target word in the target word set is accumulated to obtain the term weight value.
[0056] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned term search method is implemented.
[0057] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned term search method when executing the program.
[0058] By using the above technical solution, the present application divides a term into multiple participles and determines the term weight and position value of the term based on the target weight and target position of each target participle found, and determines the search results based on the term weight and position value. The present application also considers the text similarity and order similarity of each participle in the term, effectively solving the problem of existing search methods being unable to determine word order and improving the accuracy of term search.
[0059] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0061] Figure 1 A schematic diagram of a flow chart of a term search method provided in an embodiment of the present application is shown;
[0062] Figure 2 A schematic diagram showing a flow chart of another term search method provided in an embodiment of the present application is shown;
[0063] Figure 3 A schematic diagram showing a flow chart of another term search method provided in an embodiment of the present application is shown;
[0064] Figure 4 A schematic diagram showing a flow chart of another term search method provided in an embodiment of the present application is shown;
[0065] Figure 5 A structural block diagram of a term search device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0066] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that, unless there is a conflict, the embodiments and features in the embodiments of the present application can be combined with each other.
[0067] In this embodiment, a term search method is provided, such as Figure 1 As shown, the method includes:
[0068] Step 101: Divide the search terms into multiple levels according to their length, obtain at least one segmentation word corresponding to each level, and determine a weight value for each segmentation word, wherein the total number of levels of the search terms is positively correlated with their length, and the weight value of each segmentation word is positively correlated with the level of the segmentation word;
[0069] The term search method provided in the embodiment of the present application splits the term to be searched into multiple participles, and determines the search results for the term to be searched based on the search results for each participle.
[0070] Specifically, the search terms are divided into multiple levels, and corresponding word segments are obtained based on each level. By dividing the search terms into multiple levels, the search results are made more accurate. It is understandable that the longer the term is, the more word segments it can be divided into, so the total number of levels can be positively correlated with the length of the search terms.
[0071] For example, the search term S can be divided into two levels: the first level includes four segmentations (A, B, C, D), and the second level includes ten segmentations (A1, A2, A3, B1, B2, C1, C2, D1, D2, D3). A weight value is then determined for each of these fourteen segmentations. The weight of each segmentation is positively correlated with the level of the segmentation. The first-level segmentations have the largest weight, ensuring that they have the greatest impact on the overall search results.
[0072] Step 102, sorting the segmented words and determining the position of each segmented word;
[0073] In this embodiment, all the segmented words obtained by splitting are sorted, and the position of each segmented word is determined according to the sorting result. Specifically, the four segmented words in the first layer and the fourteen segmented words in the second layer are sorted together according to the position of each segmented word in the search term.
[0074] Step 103: Obtain the text to be searched, search for the segmented words in the text to be searched, and obtain the target segmented words;
[0075] In this embodiment, the text to be searched is obtained, and a search is performed to determine whether the segmentation in the search term exists in the text to be searched, and the segmentation found is used as the target segmentation. The target segmentation can be a first-level segmentation or a second-level segmentation, and there can be multiple target segmentations.
[0076] Step 104: determining a target weight value corresponding to the target participle from the plurality of weight values, determining a target position corresponding to the target participle from the plurality of positions, and determining a term weight value and a term position value of the term to be searched based on the target weight value and the target position;
[0077] In this embodiment, the weight value corresponding to the target word is used as the target weight value, and the position corresponding to the target word is used as the target position. The target weight values of all target words are comprehensively considered to obtain the word weight value of the searched word; the target positions of all target words are comprehensively considered to obtain the word position value of the searched word.
[0078] Step 105 : Determine the similarity between the text to be searched and the term to be searched based on the term weight value and the term position value, and determine the search result based on the similarity.
[0079] In this embodiment, a plurality of search terms are pre-set and arranged in descending order according to their term weight values. If the term weight values are the same, they are arranged in ascending order according to their term position values. Since a larger term weight value indicates a higher text similarity between the term and the text to be searched, and a smaller term position value indicates a higher word sequence similarity between the term and the text to be searched, the term to be searched with the highest similarity to the text to be searched can be determined based on the arrangement order of the plurality of terms.
[0080] By applying the technical solution of this embodiment, the similarity of the text and the similarity of the word order are taken into consideration at the same time, which can avoid finding results with different word orders and ensure that the search results are more accurate.
[0081] Furthermore, as a refinement and expansion of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another term search method is provided, such as Figure 2 As shown, in this method, the search terms are divided into multiple levels, and at least one word segmentation corresponding to each level is obtained, specifically including:
[0082] Step 201, obtaining the total number of levels N, where N is a positive integer;
[0083] Step 202: Divide the search term into a plurality of first-level segmented words corresponding to the first level;
[0084] In this embodiment, the search term S is divided into a plurality of first-level segmented words (A, B, C, D, ...) corresponding to the first level. For example, "total amount of investment from Beijing to Shandong" can be divided into "Beijing", "towards", "Shandong", and "total amount of investment".
[0085] Step 203: Divide each m-1th word segment corresponding to the m-1th layer into multiple m-th word segments corresponding to the mth layer, where m is an integer greater than 1 and not greater than N.
[0086] In this embodiment, the m-1th level segmentation is further divided. For example, the first level segmentation A of the first level can be divided into three second level segmentations (A1, A2, A3).
[0087] Furthermore, in another term search method, the weight value of each word is determined, specifically including:
[0088] Step 301: determining a first weight value corresponding to each first-layer segmentation according to the number of first-layer segmentations;
[0089] In this embodiment, it can be understood that the more the number of first-layer segmentations is, the smaller the first weight value that can be assigned to each first-layer segmentation is, so the first weight value can be determined according to the number of first-layer segmentations.
[0090] Specifically, for m first-level segmentation words (A, B, C, D, ...), the first weight value corresponding to each first-level segmentation word can be:
[0091] Step 302 : Determine the mth weight corresponding to the mth level segmentation according to the length of each mth level segmentation, the length of the m-1th level segmentation corresponding to the mth level segmentation, and the m-1th weight of the m-1th level segmentation corresponding to the mth level segmentation.
[0092] In this embodiment, after determining the m-1th weight corresponding to the m-1th level segmentation, the mth weight corresponding to each m-th level segmentation split from the m-1th level segmentation can be determined.
[0093] Specifically, for example, after determining that the weight of the first-level segmentation word A is W(A), the weight of the second-level segmentation word Ai obtained by splitting the first-level segmentation word A can be determined as:
[0094]
[0095] Among them, Len(A i ) is the length of the second-level segmentation Ai, and Len(A) is the length of the first-level segmentation A.
[0096] Further, if Figure 3 As shown, in another term search method, the word segments are sorted, specifically including:
[0097] Step 401, determining the order of the first-level segmented words according to the position of each first-level segmented word in the search term;
[0098] In this embodiment, since the first-level segmentation words are obtained by splitting the search terms, each first-level segmentation word has a corresponding position in the search terms, and the order of the first-level segmentation words can be determined according to the position. For example, after the search terms are split into "Beijing's total investment in Shandong" and divided into four first-level segmentation words "Beijing", "towards", "Shandong", and "total investment", the order of the four first-level segmentation words can be determined as ("Beijing", "towards", "Shandong", and "total investment").
[0099] Step 402: determine the m-th level segmentation corresponding to each m-1-th level segmentation, and obtain the m-th level segmentation group corresponding to each m-1-th level segmentation;
[0100] In this embodiment, for each m-1th level segmentation, all m-th level segmentations corresponding to the m-1th level segmentation are determined and used as the m-th level segmentation group corresponding to the m-1th level segmentation.
[0101] For example, for the first-level segmentation A, all second-level segmentations A1, A2, and A3 corresponding to the first-level segmentation A are determined, and the second-level segmentation (A1, A2, A3) is used as the second segmentation group corresponding to the first-level segmentation A.
[0102] Step 403: Determine the order of the m-th level segmentations in the m-th level segmentation group according to the position of each m-th level segmentation in the m-th level segmentation group in the corresponding m-1-th level segmentation, and place the m-th level segmentations in order after the corresponding m-1-th level segmentation.
[0103] In this embodiment, the position of the m-1th level segmentation is first determined, and then the corresponding m-th level segmentation is sequentially inserted after each m-1th level segmentation.
[0104] For example, first determine the order of the first-level segmentation words as (A, B, C, D), then insert the second-level segmentation words A1, A2, and A3 corresponding to the first-level segmentation word A into the first-level segmentation word A in order, and get (A, A1, A2, A3, B, C, D). Similarly, insert the second-level segmentation words B1 and B2 corresponding to the first-level segmentation word B into the second-level segmentation word B in order, and get (A, A1, A2, A3, B, B1, B2, C, D). Thus, according to the order of the segmentation words, the corresponding position of each segmentation word is obtained, P(A) to P(D), where P(A) <P(A1)<P(A2)<P(A3)<P(B)<P(B1)<P(B2)<P(C)<P(D)。
[0105] Furthermore, in another term search method, the term weight value and the term position value of the term to be searched are determined according to the target weight value and the target position of the target segmentation, specifically including:
[0106] The term position value is determined based on the target position, the position of each target word in the term to be searched, the length of the term to be searched, and the length of the text to be searched.
[0107] In this embodiment, after the target segmented word is searched, the position of each target segmented word can be comprehensively considered to obtain the entry position value of the entire entry to be searched.
[0108] Specifically, for example, if k target words are searched, then Calculate the term position value of the term S to be searched.
[0109] in, is the position P of the i-th target word i and the position P′ of the target word in the text to be searched i The distance between them.
[0110] in, len(S) is the length of the search term S, and len(SE) is the length of the search text SE.
[0111] Furthermore, in another term search method, searching for a segmented word in the text to be searched to obtain a target segmented word specifically includes:
[0112] Step 501: Search for segmented words in the text to be searched, and use all the segmented words found as a set of candidate segmented words;
[0113] Step 502: If the candidate segmentation set includes an m-1th level target segmentation and all m-th level target segmentations corresponding to the m-1th level target segmentation, then all m-th level target segmentations corresponding to the m-1th level target segmentation are removed from the candidate segmentation set to obtain a target segmentation set.
[0114] Step 503: Take each word in the target word set as a target word.
[0115] In this embodiment, for example, if the words A, A1, A2, A3, B, B1, and C are found in the text to be searched, all the found words are used as a set of candidate word segments. Since the set of candidate word segments includes the first-level word segment A, it also includes all the second-level word segmentations A1, A2, and A3 corresponding to the first-level word segment A, the second-level word segmentations A1, A2, and A3 can be removed from the candidate set to obtain the target word segmentation set (A, B, B1, C), and A, B, B1, and C are used as the target word segmentations, thereby avoiding repeated calculation of the found word segmentations.
[0116] Further, if Figure 4 As shown, in another term search method, the term weight value and term position value of the term to be searched are determined according to the target weight value of the target segmentation and the target position of the target segmentation, specifically including:
[0117] Step 601: If the target word segmentation set includes an m-1th level target word segmentation and at least one m-th level target word segmentation corresponding to the m-1th level target word segmentation, then the at least one m-th level target word segmentation corresponding to the m-1th level target word segmentation is removed from the target word segmentation set;
[0118] In this embodiment, for example, the target word segmentation set has been determined to be (A, B, B1, C). Since the target word segmentation set includes the first-level word B and all the second-level word B1 corresponding to the first-level word B, the second-level word B1 can be removed from the target set, leaving (A, B, C).
[0119] Step 602: Accumulate the target weight value of each target segmentation word remaining in the target segmentation word set to obtain the term weight value.
[0120] In this embodiment, after at least one target word at the mth level corresponding to the target word at the m-1th level is removed from the target word set, the target weight value of each target word remaining in the target word set is accumulated as the term weight value.
[0121] For example, if the remaining target words in the target word set are (A, B, C), then the word weight value rank of the search term S is s =W(A)+W(B)+W(C), where W(A), W(B) and W(C) are the target weight values of target words A, B and C respectively.
[0122] Furthermore, as a specific implementation of the above-mentioned term search method, the embodiment of the present application provides a term search device, such as Figure 5 As shown, the device includes: a layering module, a positioning module, a search module and a calculation module.
[0123] A hierarchical module is used to divide the search terms into multiple levels according to the length of the search terms, obtain at least one segmentation word corresponding to each level, and determine the weight value of each segmentation word, wherein the total number of levels of the search terms is positively correlated with the length, and the weight value of each segmentation word is positively correlated with the level of the segmentation word;
[0124] Positioning module, used to sort the segmented words and determine the position of each segmented word;
[0125] The search module is used to obtain the text to be searched, find the segmented words in the text to be searched, and obtain the target segmented words;
[0126] A calculation module is used to determine a target weight value corresponding to a target participle from a plurality of weight values, determine a target position corresponding to the target participle from a plurality of positions, and determine a term weight value and a term position value of a term to be searched based on the target weight value and the target position;
[0127] The calculation module is further used to determine the similarity between the text to be searched and the term to be searched based on the term weight value and the term position value, and determine the search result based on the similarity.
[0128] In a specific application scenario, the layering module may optionally include a partitioning unit. The partitioning unit is specifically configured to:
[0129] Get the total number of levels N, where N is a positive integer;
[0130] Divide the search term into multiple first-level segmentations corresponding to the first level;
[0131] Each m-1th word segment corresponding to the m-1th layer is divided into multiple mth word segments corresponding to the mth layer, where m is an integer greater than 1 and not greater than N.
[0132] In a specific application scenario, the hierarchical module may optionally further include a weight calculation unit. The weight calculation unit is specifically used to:
[0133] Determine a first weight value corresponding to each first-layer segmentation according to the number of first-layer segmentations;
[0134] Determine the mth weight corresponding to the mth level participle according to the length of each mth level participle, the length of the m-1th level participle corresponding to the mth level participle, and the m-1th weight of the m-1th level participle corresponding to the mth level participle.
[0135] In a specific application scenario, the positioning module is optionally used to:
[0136] Determine the order of the first-level segmented words according to the position of each first-level segmented word in the search term;
[0137] Determine the m-th level segmentation corresponding to each m-1-th level segmentation, and obtain the m-th level segmentation group corresponding to each m-1-th level segmentation;
[0138] According to the position of each m-th level segmentation in the m-th level segmentation group in the corresponding m-1-th level segmentation, the order of the m-th level segmentation in the m-th level segmentation group is determined, and the m-th level segmentation is placed after the corresponding m-1-th level segmentation in order.
[0139] In a specific application scenario, optionally, the computing module is specifically used to:
[0140] The term position value is determined based on the target position, the position of each target word in the term to be searched, the length of the term to be searched, and the length of the text to be searched.
[0141] In a specific application scenario, optionally, the search module is specifically used to:
[0142] Search for segmented words in the text to be searched, and use all the segmented words found as a set of candidate segmented words;
[0143] If the candidate segmentation set contains an m-1th level target segmentation and all m-th level target segmentations corresponding to the m-1th level target segmentation, then all m-th level target segmentations corresponding to the m-1th level target segmentation are removed from the candidate segmentation set to obtain the target segmentation set;
[0144] Each word in the target word set is used as the target word.
[0145] In a specific application scenario, optionally, the computing module is specifically used to:
[0146] If the target word set contains an m-1th level target word and at least one m-th level target word corresponding to the m-1th level target word, then the at least one m-th level target word corresponding to the m-1th level target word is removed from the target word set;
[0147] The target weight value of each target word remaining in the target word set is accumulated to obtain the term weight value.
[0148] It should be noted that for other corresponding descriptions of the functional modules involved in the term search device provided in the embodiment of the present application, please refer to Figures 1 to 4 The corresponding description in will not be repeated here.
[0149] Based on the above Figures 1 to 4 The method shown in FIG. 1 is a method for performing the above-mentioned operation. Accordingly, the embodiment of the present application further provides a storage medium on which a computer program is stored. When the program is executed by a processor, the above-mentioned operation is performed. Figures 1 to 4 The term search method shown.
[0150] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0151] Based on the above Figures 1 to 4 The method shown, and Figure 5 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 4 The term search method shown.
[0152] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a Wi-Fi module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a Wi-Fi interface), etc.
[0153] Those skilled in the art will understand that the computer device structure provided in this embodiment does not constitute a limitation on the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0154] The storage medium may also include an operating system and a network communication module. An operating system is a program that manages and stores the hardware and software resources of a computer device, supporting the execution of information processing programs and other software and / or programs. The network communication module facilitates communication between components within the storage medium, as well as with other hardware and software within the physical device.
[0155] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform, or by hardware.
[0156] Those skilled in the art will understand that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the units or processes in the accompanying drawings are not necessarily required to implement the present application. Those skilled in the art will understand that the units in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The units of the above-mentioned implementation scenario can be combined into one unit, or can be further split into multiple sub-units.
[0157] The serial numbers of the above application are for descriptive purposes only and do not represent the advantages or disadvantages of the implementation scenarios. The above disclosure only discloses several specific implementation scenarios of the present application, but the present application is not limited thereto. Any changes that can be conceived by those skilled in the art should fall within the scope of protection of the present application.
Claims
1. A term search method, characterized in that: The method comprises: According to the length of the to-be-searched term, the to-be-searched term is divided into a plurality of levels, at least one segmentation word corresponding to each level is obtained, and a weight value of each segmentation word is determined, wherein the total number of levels of the to-be-searched term is positively correlated with the length, and the weight value of each segmentation word is positively correlated with the level of the segmentation word; Sort the segmented words and determine the position of each segmented word respectively; wherein the position of the segmented word includes the position of the segmented word in the term to be searched; Obtaining a text to be searched, searching for the segmented word in the text to be searched, and obtaining a target segmented word; The weight value corresponding to the target participle is used as the target weight value, and the position of the target participle is used as the target position; and the term weight value of the term to be searched is determined according to the target weight value, and the term position value of the term to be searched is determined according to the target position; Determining the similarity between the text to be searched and the term to be searched according to the term weight value and the term position value, and determining the search result according to the similarity; The step of determining the entry position value of the entry to be searched according to the target position includes: according to Calculate the entry position value of the entry to be searched, where k represents the number of target participles; is the position P of the i-th target word i and the position P of the target word in the text to be searched i ′; len(S) is the length of the term S to be searched, and len(SE) is the length of the text SE to be searched.
2. The term search method according to claim 1, characterized in that: The step of dividing the to-be-searched terms into multiple levels and obtaining at least one word segment corresponding to each level specifically includes: Obtain the total number of levels N, where N is a positive integer; Dividing the to-be-searched term into a plurality of first-layer segmented terms corresponding to the first layer; Each m-1th word segment corresponding to the m-1th layer is divided into multiple mth words segment corresponding to the mth layer, where m is an integer greater than 1 and not greater than N.
3. The term search method according to claim 2, characterized in that: Determining the weight value of each word segment specifically includes: Determine a first weight value corresponding to each first-layer participle according to the number of the first-layer participles; The mth weight corresponding to the mth level participle is determined according to the length of each mth level participle, the length of the m-1th level participle corresponding to the mth level participle, and the m-1th weight of the m-1th level participle corresponding to the mth level participle.
4. The term search method according to claim 2 or 3, characterized in that: The step of sorting the word segments specifically includes: Determining the order of the first-layer segmented words according to the position of each first-layer segmented word in the to-be-searched term; Determine the m-th level participle corresponding to each m-1-th level participle, and obtain the m-th level participle group corresponding to each of the m-1-th level participles; According to the position of each m-th level word in the m-th level word group in the corresponding m-1-th level word, the order of the m-th level word in the m-th level word group is determined, and the m-th level word is placed after the corresponding m-1-th level word in order.
5. The term search method according to claim 1, characterized in that: Determining the entry position value of the to-be-searched entry according to the target position specifically includes: The entry position value is determined according to the target position, the position of each target word segment in the entry to be searched, the length of the entry to be searched, and the length of the text to be searched.
6. The term search method according to claim 2, characterized in that: The step of searching the word segment in the text to be searched to obtain the target word segment specifically includes: Searching for the word in the text to be searched, and taking all the found word as a set of candidate word; If the candidate segmentation set includes an m-1th level target segmentation and all m-th level target segmentations corresponding to the m-1th level target segmentation, then all m-th level target segmentations corresponding to the m-1th level target segmentation are removed from the candidate segmentation set to obtain a target segmentation set; Each word in the target word set is used as the target word.
7. The term search method according to claim 6, characterized in that: Determining the entry position value of the to-be-searched entry according to the target position specifically includes: If the target word segmentation set includes an m-1th level target word segmentation and at least one m-th level target word segmentation corresponding to the m-1th level target word segmentation, then the at least one m-th level target word segmentation corresponding to the m-1th level target word segmentation is removed from the target word segmentation set; The target weight value of each remaining target word in the target word set is accumulated to obtain the term weight value.
8. A device for searching entries, characterized in that: The device comprises: A hierarchical module, for dividing the to-be-searched terms into multiple levels according to the length of the to-be-searched terms, obtaining at least one word segment corresponding to each level, and determining a weight value of each word segment, wherein the total number of levels of the to-be-searched terms is positively correlated with the length, and the weight value of each word segment is positively correlated with the level of the word segment; A positioning module, used to sort the segmented words and determine the position of each segmented word respectively; wherein the position of the segmented word includes the position of the segmented word in the to-be-searched term; A search module is used to obtain a text to be searched, search for the segmented word in the text to be searched, and obtain a target segmented word; A calculation module, used to take the weight value corresponding to the target participle as the target weight value, and take the position of the target participle as the target position; and determine the term weight value of the term to be searched according to the target weight value, and determine the term position value of the term to be searched according to the target position; The calculation module is further used to determine the similarity between the text to be searched and the term to be searched according to the term weight value and the term position value, and determine the search result according to the similarity; The calculation module is also used for: according to Calculate the entry position value of the entry to be searched, where k represents the number of target participles; is the position P of the i-th target word i and the position P of the target word in the text to be searched i ′; len(S) is the length of the term S to be searched, and len(SE) is the length of the text SE to be searched.
9. A readable storage medium having a program or instruction stored thereon, characterized in that: When the program or instruction is executed by a processor, the steps of the term search method according to any one of claims 1 to 7 are implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the program, the term search method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Multi-index combining and sequencing algorithm based on improved TF-IDF (term frequency-inverse document frequency)
CN104778276A
Live broadcast room searching method and system, computer equipment and storage medium
CN110430476A
Search method and device based on similarity value, computer equipment and storage medium
CN110737751A
Formal expression method and device oriented to text search demand and storage medium
CN112925873A
Product search method and system
US20130318101A1
