A method, device and medium for searching words
By obtaining the length of the target search terms in the search platform, judging and applying appropriate matching rules, including comprehensive matching, extended words, synonyms and short word matching rules, the problems of inaccurate search and waste of resources are solved, and the search accuracy is improved Sex and user experience.
Patent Information
- Application Number
- CN202210366446.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-08
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-04-08
AI Technical Summary
The existing search platforms rely on search vocabulary databases during the search process, resulting in inaccurate word segmentation and inability to match new words and professional nouns. In addition, short words and long words are searched to generate word segmentation pressure and waste of computing resources, resulting in inaccurate search and resource consumption. , reduce user experience.
By obtaining the length of the target search word, we can determine whether the preset conditions are met. If it is greater than the first threshold, if it is fully matched, if it is less than the second threshold, use the extended word and synonym loading rules. If it is not met, use the short word matching rules to avoid dependency Single search vocabulary and word segmentation pressure to improve search accuracy.
Improve search accuracy, avoid word segmentation pressure and waste of computing resources due to short and long word queries, and enhance user experience.
Smart Images

Figure CN114661869B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of word retrieval, and in particular to a method, device and medium for retrieval of words. Background Art
[0002] Suppliers need to check on the procurement platform whether the products can be searched by buyers. However, due to different attributes of the products, such as product status, sales area, delivery area, and inventory, the search conditions on the procurement platform cannot be matched, and the products cannot be searched.
[0003] Existing search platforms rely heavily on search terms during the search process, resulting in inaccurate corresponding word segmentation and failure to enter new words and professional terms into the search terms, which results in the inability to search for corresponding target products; short words are set as the smallest word segmentation units, which results in the inability to search for target products, such as black tea, green tea, etc., which are the smallest word segmentation units. When the search term is a short word "tea", black tea and green tea cannot be retrieved, and can only be retrieved when the search term corresponds to the smallest word segmentation unit; or the word segmentation pressure and computing resources generated by matching aggregation during long word query searches result in slow searches or even failure to search for target words, which reduces user experience and consumes a large amount of computing resources generated during the search process.
[0004] Therefore, it is urgent for those skilled in the art to find a method for retrieving words. Summary of the invention
[0005] The purpose of the present invention is to provide a method, device and medium for searching words to improve the search accuracy.
[0006] In order to solve the above technical problems, the present invention provides a method for searching words, comprising:
[0007] Obtain the target search term and the term length corresponding to the target search term;
[0008] When the word length and the target search word meet the preset conditions, it is determined whether the word length is greater than a first threshold;
[0009] If so, perform a comprehensive match search on the target search terms to obtain search results;
[0010] If not, searching the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result, and determining whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold;
[0011] If it is less than the second threshold, the target search word is searched according to the short word matching rule to obtain the search result;
[0012] If it is not less than the second threshold, the preset search result is used as the search result.
[0013] Preferably, the preset condition is that the word length is less than or equal to a preset value and the target search word does not contain sensitive words, wherein the preset value is greater than a first threshold.
[0014] Preferably, performing a comprehensive match search on the target search terms to obtain search results includes:
[0015] Split the target search term into multiple words;
[0016] Multiple word segments are matched and searched to obtain search results.
[0017] Preferably, the expansion word loading rule is determined by:
[0018] Obtain the search term to be written and the corresponding extended term;
[0019] A one-way mapping relationship is determined between the search terms to be written and the expansion terms to determine the expansion term loading rules.
[0020] Preferably, the synonym loading rule is determined by:
[0021] Get the search terms to be written and their corresponding synonyms;
[0022] A bidirectional mapping relationship is determined between the search terms to be written and the synonyms to determine the synonym loading rules.
[0023] Preferably, the short word matching rule is determined by:
[0024] The search word to be written is divided into multiple characters according to the finest granularity word segmentation and the position order corresponding to the multiple characters is recorded;
[0025] The preset matching word count and the preset movement times are set according to the mapping relationship between the search words to be written and the position sequence to determine the short word matching rule.
[0026] Preferably, the target search word is searched according to the short word matching rule to obtain the search results, including:
[0027] Divide the target search word into multiple target words according to the finest granularity word segmentation and record the target position order corresponding to the multiple target words;
[0028] Match the target search word and the target position sequence to the search word and position sequence to be written in the short word matching rule;
[0029] When the target search word and the target position sequence meet the preset matching word count and preset movement times respectively, the search result is output.
[0030] In order to solve the above technical problems, the present invention also provides a device for searching words, comprising:
[0031] An acquisition module, used for acquiring a target search word and a word length corresponding to the target search word;
[0032] A first judgment module is used to judge whether the word length is greater than a first threshold when the word length and the target search word meet the preset conditions, and if so, trigger the comprehensive search module, and if not, trigger the second judgment module;
[0033] A comprehensive search module is used to perform a comprehensive match search on the target search terms to obtain search results;
[0034] A second judgment module is used to search the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result, and judge whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold, if it is less than the second threshold, the short word search module is triggered, and if it is not less than the second threshold, the result module is triggered;
[0035] A short word search module is used to search the target search words according to the short word matching rules to obtain the search results;
[0036] The result module is used to use the preset search results as the search results.
[0037] In order to solve the above technical problems, the present invention also provides a device for searching words, comprising:
[0038] Memory for storing computer programs;
[0039] A processor is used to implement the steps of the above-mentioned method for retrieving words when executing a computer program.
[0040] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for retrieving words as described above are implemented.
[0041] The present invention provides a method for searching words, which obtains a target search word and a word length corresponding to the target search word; when the word length and the target search word meet a preset condition, it is determined whether the word length is greater than a first threshold; if so, the target search word is searched for a comprehensive match to obtain a search result; if not, the target search word is searched for a preset search result according to an expansion word loading rule and a synonym loading rule, and it is determined whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold; if it is less than the second threshold, the target search word is searched for a search result according to a short word matching rule; if it is not less than the second threshold, the preset search result is used as the search result. The method searches for the target search word according to the expansion word loading rule and the synonym loading rule to avoid the problem that the existing search platform cannot search only by relying on the existing search word library, and searches for short words according to the short word matching rule to avoid the problem that the existing short words cannot search, and performs a comprehensive match search for long words under the preset conditions, thereby avoiding the existing word segmentation pressure and matching aggregation consumption of computing resources, thereby improving the search accuracy.
[0042] In addition, the present invention also provides a device and medium for searching words, which have the same beneficial effects as the above-mentioned method for searching words. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 A flowchart of a method for searching words provided by an embodiment of the present invention;
[0045] Figure 2 A structural diagram of a device for searching words provided by an embodiment of the present invention;
[0046] Figure 3 A structural diagram of another device for searching words provided by an embodiment of the present invention;
[0047] Figure 4 A flowchart of another method for searching words provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of the present invention.
[0049] The core of the present invention is to provide a method, device and medium for searching words to improve the search accuracy.
[0050] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0051] It should be noted that the method for searching for words provided by the present invention is applicable not only to the procurement platform but also to any search engine platform, without any specific limitation, and is set according to the actual situation.
[0052] Figure 1 A flowchart of a method for searching words provided by an embodiment of the present invention is shown in FIG. Figure 1 As shown, the method includes:
[0053] S11: Obtain the target search term and the term length corresponding to the target search term.
[0054] It is understandable that the target search term, that is, the search term input by the user on the search engine platform, can be input by typing, by voice, or by decoding the user's brain wave signal through a decoding device to obtain the target search term, without specific limitation.
[0055] According to the user's voice input, it is necessary to obtain the user's voice information, and the voice information is filtered and decoded to obtain the corresponding search words. For example, if a user who cannot speak or has limited finger movement cannot complete the above input, the user's brain wave signal is collected according to the brain wave collection device, and the brain wave signal is decoded to obtain the target search word.
[0056] After obtaining the target search term, you need to obtain the corresponding term length for subsequent search work.
[0057] S12: When the word length and the target search word meet the preset conditions, determine whether the word length is greater than the first threshold. If so, proceed to step S13, if not, proceed to step S14.
[0058] When the target search word and the corresponding word length are obtained, further detection is performed to determine whether the corresponding preset conditions are met. In order to establish a safe and healthy network environment, whether the target search word contains sensitive words in the search engine. For longer words, on the one hand, if the length is greater than the maximum length limit when the search engine platform is established, the search will be invalid; on the other hand, it will cause a waste of search resources on the search engine platform.
[0059] Therefore, the above situation needs to be avoided during the initial judgment. When the word length and the target search word do not meet the preset conditions, the search request is rejected. It should be noted that the search in the above two situations needs to meet the preset conditions corresponding to the word length and the target search word at the same time before entering the subsequent steps. If only one of the preset conditions is met, the subsequent steps will not be entered.
[0060] It is understandable that the preset conditions of word length and target search word are set for two situations. Sensitive words can be virtual private network (VPN), banned drugs, etc., in order to avoid legal risks. The maximum word length limit is to prevent performance problems caused by overly long word queries.
[0061] When the word length and the target search word meet the preset conditions, it is further determined whether the word length is greater than the first threshold. After preliminary screening, it is necessary to determine whether the current word length is greater than the first threshold. If it is, the query is degraded to a complete match, the statistics function is turned off, and the query is performed word by word. If it is not, the current target search word needs to be refined to solve the problem of not being able to search due to the existing search database that is dependent on the establishment.
[0062] S13: Perform a comprehensive match search on the target search terms to obtain search results.
[0063] Since the length of the target search word is greater than the first threshold but less than the maximum length limit, it means that the word length is relatively long and needs to be accurately matched word by word. Based on the performance of the search, a comprehensive matching search with accurate matching is performed to obtain the search results.
[0064] S14: Search the target search word according to the expansion word loading rules and synonym loading rules to obtain the preset search results, and determine whether the word length is less than the second threshold, where the first threshold is greater than the second threshold. If it is less than the second threshold, enter step S15, if it is not less than the second threshold, enter step S16.
[0065] When the current word length is not greater than the first threshold, word mapping is performed to expand the word recall range. The target search word needs to be searched according to the expansion word loading rules and synonym loading rules to obtain the preset search results.
[0066] The expansion word loading rule generalizes the word by expanding the search scope of the target search word as a major category. For example, searching for the word "meat" can search for the specific subcategories of tenderloin and ribs. Even if the search word does not contain the word "meat", it can be searched. However, if the word "ribs" is searched, meat or the tenderloin word parallel to it cannot be found, and the transmission is one-way.
[0067] The synonym loading rule is based on the bidirectional mapping of the target search term, so that users can search for alternative products of the term when searching for the term. For example, searching for "toilet" can search for words with toilet as the name, and searching for "toilet" can search for words with toilet as the name.
[0068] According to the above two search rules, the preset search results are obtained, and it is further determined whether the word length of the target search vocabulary is less than the second threshold, where the first threshold is greater than the second threshold. If it is less than, the target search vocabulary is further searched for short sentence matching to enter step S15. If it is not less than, the current search is terminated and step S16 is entered to use the preset search results as the search results.
[0069] S15: Search the target search word according to the short word matching rule to obtain the search result.
[0070] When the word length is less than the second threshold, the target search word is searched according to the short word matching rule to obtain the search result.
[0071] The short word matching rule matches the search based on the position order of the characters. It is necessary to record the characters of the word segmentation and the position order between the characters.
[0072] S16: Use the preset search result as the search result.
[0073] When the word length is greater than or equal to the second threshold, the preset search result is used as the search result. It should be noted that the search result is the word or product name corresponding to the target search word, or if no result is found, it is necessary to display "No corresponding product found, please try another name search" or the like.
[0074] The present invention provides a method for searching words, which obtains a target search word and a word length corresponding to the target search word; when the word length and the target search word meet a preset condition, it is determined whether the word length is greater than a first threshold; if so, the target search word is searched for a comprehensive match to obtain a search result; if not, the target search word is searched for a preset search result according to an expansion word loading rule and a synonym loading rule, and it is determined whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold; if it is less than the second threshold, the target search word is searched for a search result according to a short word matching rule; if it is not less than the second threshold, the preset search result is used as the search result. The method searches for the target search word according to the expansion word loading rule and the synonym loading rule to avoid the problem that the existing search platform cannot search only by relying on the existing search word library, and searches for short words according to the short word matching rule to avoid the problem that the existing short words cannot search, and performs a comprehensive match search for long words under the preset conditions, thereby avoiding the existing word segmentation pressure and matching aggregation consumption of computing resources, thereby improving the search accuracy.
[0075] Based on the above embodiment, in step S12, when the word length and the target search word meet the preset conditions, it is determined whether the word length is greater than the first threshold, wherein the preset conditions are that the word length is less than or equal to the preset value and the target search word does not contain sensitive words, wherein the preset value is greater than the first threshold.
[0076] Specifically, there are two situations corresponding to the preset conditions of word length and target search words. In order to avoid the legal risks caused by sensitive words contained in the target search words and the maximum word length limitation, and to prevent performance problems caused by overly long word queries, the preset conditions are that the word length is less than or equal to the preset value, and the target search words do not contain sensitive words.
[0077] It is understandable that when the word length and the target search word meet any of the preset conditions, the subsequent process cannot be entered. Only when all conditions are met can the relationship between the word length and the first threshold be further determined.
[0078] The preset value is the maximum length set by the search engine platform. When it is greater than the preset value, the search request is rejected. Therefore, when the preset value is greater than the first threshold and further meets the preset conditions, the relationship between the word length and the first threshold is determined.
[0079] The preset conditions provided in this embodiment are that the word length is less than or equal to the preset value and the target search word does not contain sensitive words, wherein the preset value is greater than the first threshold, thereby avoiding legal risks and performance issues caused by overly long word queries.
[0080] Based on the above embodiment, the step S13 of performing a comprehensive matching search on the target search term to obtain the search results includes:
[0081] Split the target search term into multiple words;
[0082] Multiple word segments are matched and searched to obtain search results.
[0083] When the word length of the target search word is greater than the first threshold value, but less than or equal to the preset value, it means that the word length is relatively long and needs to be accurately matched word by word, based on the performance of the search. A comprehensive matching search with accurate matching is performed to obtain the search result, that is, the accurate search in the existing situation. The target search word does not have the problem of short word matching. The target search word is split into multiple subwords, and the subwords are matched and searched to obtain the search result.
[0084] This embodiment provides a method of splitting a target search word into multiple participles, performing matching searches on the participles to obtain search results. The target search word is relatively long, and a comprehensive matching search is performed on the long word under preset conditions, thereby avoiding existing participle pressure and matching aggregation problems that consume computing resources.
[0085] Based on the above embodiment, the determination of the expansion word loading rule is obtained in the following manner:
[0086] Obtain the search term to be written and the corresponding extended term;
[0087] A one-way mapping relationship is determined between the search terms to be written and the expansion terms to determine the expansion term loading rules.
[0088] Specifically, the expanded word unidirectionally expands the search scope of the word and generalizes the word, which can only be from A to B but not from B to A. This prevents the scope from being expanded when the user performs a precise search. For example: bed sheet -> four-piece set / velvet quilt / six-piece set / quilt / quilt. This one-way mapping allows users to search for velvet quilts when searching for bed sheets, but will not search for bed sheets when searching for a more specific word such as velvet quilt.
[0089] It is necessary to establish a mapping relationship between the search words to be written and the corresponding extended words, and determine it as a one-way mapping relationship to determine the extended word loading rules.
[0090] The present embodiment provides the method of obtaining the search words to be written and the corresponding extended words; determining a one-way mapping relationship between the search words to be written and the extended words to determine the extended word loading rules, so as to avoid further expansion of the search scope when the user is searching.
[0091] Based on the above embodiment, the synonym loading rule is determined by the following method:
[0092] Get the search terms to be written and their corresponding synonyms;
[0093] A bidirectional mapping relationship is determined between the search terms to be written and the synonyms to determine the synonym loading rules.
[0094] Specifically, the synonym loading rule is different from the above-mentioned expansion word loading rule. It belongs to a bidirectional mapping relationship, which can be from A to B and from B to A. It is mainly used for multiple different descriptions of the same thing. For example, toilet and toilet, printing paper and copy paper. When the user searches for toilet, the query is synchronously rewritten to toilet or toilet. When the user searches for toilet, the query is also synchronously rewritten to toilet or toilet. In this way, no matter whether the supplier's product input is toilet or toilet, it can be recalled. Then improve the overall search experience.
[0095] It is understandable that when the word length is less than or equal to the first threshold, the corresponding target search word is first searched by the expansion word loading rule, then by the synonym word loading rule, and then by the subsequent search.
[0096] This embodiment provides the method of obtaining the search words to be written and the corresponding synonyms; determining a bidirectional mapping relationship between the search words to be written and the synonyms to determine the synonym loading rules, thereby improving the user's search experience and avoiding the problem that the existing search platform cannot search by relying only on the existing search word library.
[0097] Based on the above embodiment, the short word matching rule is determined by the following method:
[0098] The search word to be written is divided into multiple characters according to the finest granularity word segmentation and the position order corresponding to the multiple characters is recorded;
[0099] The preset matching word count and the preset movement times are set according to the mapping relationship between the search words to be written and the position sequence to determine the short word matching rule.
[0100] Specifically, the search word to be written is divided into multiple words according to the finest strength word segmentation and the corresponding position relationship is recorded, and then the preset matching word number and the preset movement number are set according to the mapping relationship between the search word to be written and the position sequence.
[0101] For example, the search word to be written is "Longjing tea", and the order of its words and positions is as shown in the position table in Table 1:
[0102] Table 1 Word position table
[0103]
[0104]
[0105] During the search, word segmentation needs to be performed according to the above rules, and the preset matching word count and the preset moving word count are set. For example, the preset matching word count is set to 2, and the preset moving count is set to 2. When the input is "Longcha" (Dragon Tea), its corresponding positions are 0 and 1. The position of "cha" (tea) is larger than that of "long" (dragon). The matching word count is 2. Compared with the word "Longjing Tea", there is a movement of one character, that is, the moving word count is 1. When the number of characters greater than the preset matching word count and the number of times less than the preset moving count, "Longjing Tea" can also be searched by searching "Longcha".
[0106] In this embodiment, the to-be-written retrieval words are divided into multiple characters according to the finest-grained word segmentation, and the corresponding position order of the multiple characters is recorded; according to the mapping relationship between the to-be-written retrieval words and the position order, the preset matching word count and the preset moving count are set to determine the short-word matching rule, and the problem that existing short words cannot be searched is avoided according to the short-word matching rule.
[0107] Based on the above embodiment, retrieving the target retrieval words according to the short-word matching rule in step S15 to obtain a retrieval result includes:[[]]
[0108] Dividing the target retrieval words into multiple target characters according to the finest-grained word segmentation and recording the corresponding target position order of the multiple target characters;
[0109] Matching the target retrieval words and the target position order with the to-be-written retrieval words and the position order that match the short-word matching rule;
[0110] When the target retrieval words and the target position order respectively meet the preset matching word count and the preset moving count, the retrieval result is output.
[0111] Specifically, for word segmentation, there are two situations. One is the dependence on the thesaurus, and the other is the word segmentation algorithm problem. Due to the word graph and word segmentation path selection problems of the word segmentation algorithm, the final word segmentation result is uncontrollable. To solve the above two situations, the target retrieval words need to be divided into multiple target characters according to the finest-grained word segmentation, and the corresponding target position order of the multiple target characters is recorded. For example, when searching for "Longjing Tea", it will be divided into "Longjing Tea", and at the same time, the position and order of each character are recorded, and the query should also be matched according to this order to prevent the product from being recalled when searching for "Cha Jing Long", resulting in a decrease in the recall accuracy rate.
[0112] At the same time, considering the part of the field that the user misses in the search, the preset matching word count and the preset moving count are set. For example, when searching for "red paper", the user can also search for the product by searching for "red paper". Since the position order of the characters is recorded, the preset matching word count is greater than or equal to 2, and the preset moving count is less than 2. In the case of meeting the preset matching word count and the preset moving count, the product can be matched.
[0113] The short word matching rule solves the problem of unreasonable word segmentation caused by traditional word segmentation, which leads to the problem of not being able to search for products. However, the word order needs to be guaranteed, which loses the word-skipping function of traditional word segmentation. For example, "Tibetan super delicious hand-torn beef jerky", traditionally, you can search for this product by searching "Tibetan beef jerky", but the new word segmentation model depends on word order, because the distance between Tibet and beef jerky is too long, it will lead to the problem of not being able to search. Therefore, the final solution is to mix the two search modes, which solves the problem of not being able to search caused by traditional word segmentation results, and has the word-skipping search capability of traditional word segmentation search.
[0114] At the same time, in order to solve the search engine performance problems caused by long words, the word length degradation function is used. In general search scenarios, users' search terms are often short. For example, searching for "printer" often results in "printer", "laser printer", and "hp printer". Long words often mean that users use the full name of the product. In order to solve this problem, when initializing the product name results, in addition to the normal word segmentation results, the full name of the product name is also initialized as an independent word segmentation. In this way, when facing long-tail words, only full matching is required, which greatly reduces the search calculation amount.
[0115] The present embodiment provides a method of retrieving a target search word according to a short word matching rule to obtain a search result. Searching according to the short word matching rule avoids the problem that the existing short words cannot be searched, thereby improving the search accuracy.
[0116] The above describes in detail various embodiments corresponding to the method for searching for words. On this basis, the present invention also discloses a device for searching words corresponding to the above method. Figure 2 The structure diagram of a device for searching words provided by an embodiment of the present invention is shown in FIG. Figure 2 As shown, the device for retrieving words includes:
[0117] An acquisition module 11 is used to acquire a target search word and a word length corresponding to the target search word;
[0118] The first judgment module 12 is used to judge whether the word length is greater than a first threshold when the word length and the target search word meet the preset conditions, and if so, trigger the comprehensive search module 13, and if not, trigger the second judgment module 14;
[0119] A comprehensive search module 13 is used to perform a comprehensive matching search on the target search words to obtain search results;
[0120] The second judgment module 14 is used to search the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result, and judge whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold, if it is less than the second threshold, the short word search module 15 is triggered, and if it is not less than the second threshold, the result module 16 is triggered;
[0121] A short word search module 15 is used to search the target search word according to the short word matching rule to obtain the search result;
[0122] The result module 16 is used to use the preset search result as the search result.
[0123] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.
[0124] The present invention provides a device for searching words, which obtains the word length corresponding to the target search word and the target search word; when the word length and the target search word meet the preset conditions, it is determined whether the word length is greater than the first threshold; if so, the target search word is searched for a comprehensive match to obtain a search result; if not, the target search word is searched for according to the expansion word loading rule and the synonym loading rule to obtain a preset search result, and it is determined whether the word length is less than the second threshold, wherein the first threshold is greater than the second threshold; if it is less than the second threshold, the target search word is searched for according to the short word matching rule to obtain a search result; if it is not less than the second threshold, the preset search result is used as the search result. The device searches the target search word according to the expansion word loading rule and the synonym loading rule to avoid the problem that the existing search platform cannot search only by relying on the existing search word library, and the short word is searched according to the short word matching rule to avoid the problem that the existing short word cannot search, and performs a comprehensive match search for long words under the preset conditions, avoiding the existing word segmentation pressure and matching aggregation consumption of computing resources, thereby improving the search accuracy.
[0125] Figure 3 A structural diagram of another device for searching words provided by an embodiment of the present invention, such as Figure 3 As shown, the device comprises:
[0126] A memory 21, used for storing computer programs;
[0127] The processor 22 is used to implement the steps of the method for retrieving words when executing a computer program.
[0128] The device for searching words provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer, or a desktop computer.
[0129] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0130] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used to store the following computer program 211, wherein, after the computer program is loaded and executed by the processor 22, it can implement the relevant steps of the method for retrieving words disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include but is not limited to the data involved in the method for retrieving words, etc.
[0131] In some embodiments, the word retrieval device may also include a display screen 23, an input and output interface 24, a communication interface 25, a power supply 26 and a communication bus 27.
[0132] Those skilled in the art can understand that Figure 3 The structure shown in the figure does not constitute a limitation on the device for retrieving words, and may include more or less components than those shown in the figure.
[0133] The processor 22 implements the word retrieval method provided in any of the above embodiments by calling the instructions stored in the memory 21.
[0134] The present invention provides a device for searching words, which obtains the word length corresponding to the target search word and the target search word; when the word length and the target search word meet the preset conditions, it is determined whether the word length is greater than the first threshold; if so, the target search word is searched for a comprehensive match to obtain a search result; if not, the target search word is searched for according to the expansion word loading rule and the synonym loading rule to obtain a preset search result, and it is determined whether the word length is less than the second threshold, wherein the first threshold is greater than the second threshold; if it is less than the second threshold, the target search word is searched for according to the short word matching rule to obtain a search result; if it is not less than the second threshold, the preset search result is used as the search result. The device searches the target search word according to the expansion word loading rule and the synonym loading rule to avoid the problem that the existing search platform cannot search only by relying on the existing search word library, and the short word is searched according to the short word matching rule to avoid the problem that the existing short word cannot search, and performs a comprehensive match search for long words under the preset conditions, avoiding the existing word segmentation pressure and matching aggregation consumption of computing resources, thereby improving the search accuracy.
[0135] Furthermore, the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by the processor 22, the steps of the above-mentioned method for retrieving words are implemented.
[0136] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0137] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. It has the same beneficial effects as the above method for retrieving words.
[0138] In order to enable those skilled in the art to better understand the technical solution of the present invention, the method, device and medium for searching words provided by the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings.
[0139] Figure 4 A flowchart of another method for searching words provided by an embodiment of the present invention, such as Figure 4 As shown, the flow chart includes:
[0140] S11: Obtain the target search word and the word length corresponding to the target search word;
[0141] S21: Determine whether the word length is greater than a preset value, if so, proceed to step S22, if not, proceed to step S23;
[0142] S22: Request rejected;
[0143] S23: Determine whether the target search word contains sensitive words, if yes, proceed to step S24, if no, proceed to step S25;
[0144] S24: Request rejected;
[0145] S25: Determine whether the word length is greater than a first threshold, wherein the first threshold is less than a preset value. If so, proceed to step S13; if not, proceed to step S26;
[0146] S13: Perform a comprehensive matching search on the target search terms to obtain search results;
[0147] S26: searching the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result;
[0148] S27: Determine whether the word length is greater than a second threshold, wherein the second threshold is less than the first threshold. If so, proceed to step S16; if not, proceed to step S28;
[0149] S16: taking the preset search result as the search result;
[0150] S28: Search the target search word according to the short word matching rule to obtain the search result.
[0151] The above describes another method for searching words provided by an embodiment of the present invention through a flowchart, which has the same beneficial effects as the above-mentioned method for searching words.
[0152] The above is a detailed introduction to a method, device and medium for searching words provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0153] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for searching for words, It is characterized in that include: Obtaining a target search term and the term length corresponding to the target search term; When the word length and the target search word meet the preset conditions, determining whether the word length is greater than a first threshold; If yes, perform a comprehensive match search on the target search terms to obtain search results; If not, searching the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result, and determining whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold; If it is less than the second threshold, searching the target search word according to the short word matching rule to obtain the search result; If it is not less than the second threshold, taking the preset search result as the search result; The expansion word loading rule is determined by: Obtain the search term to be written and the corresponding extended term; Determine a one-way mapping relationship between the search word to be written and the extended word to determine the extended word loading rule; Correspondingly, the synonym loading rule is determined by: Obtaining the search word to be written and the corresponding synonyms; Determine a bidirectional mapping relationship between the search word to be written and the synonym to determine the synonym loading rule; Correspondingly, the determination of the short word matching rule is obtained in the following manner: Divide the search word to be written into multiple characters according to the finest granularity of word segmentation and record the position order corresponding to the multiple characters; The preset matching word number and the preset movement number are set according to the mapping relationship between the search word to be written and the position sequence to determine the short word matching rule.
2. The method for searching words according to claim 1, It is characterized in that The preset condition is that the word length is less than or equal to a preset value and the target search word does not contain sensitive words, wherein the preset value is greater than the first threshold.
3. The method for searching words according to claim 1, It is characterized in that The performing a comprehensive matching search on the target search term to obtain the search results comprises: Splitting the target search term into multiple participles; The search result is obtained by matching and searching the multiple word segments.
4. The method for searching words according to claim 1, It is characterized in that The step of searching the target search word according to a short word matching rule to obtain the search result includes: Divide the target search word into multiple target words according to the finest granularity word segmentation and record the target position sequence corresponding to the multiple target words; Matching the target search word and the target position sequence with the search word to be written and the position sequence of the short word matching rule; When the target search word and the target position sequence respectively satisfy the preset matching word count and the preset movement times, the search result is output.
5. A device for searching words, It is characterized in that include: An acquisition module, used for acquiring a target search word and a word length corresponding to the target search word; A first judgment module, configured to judge whether the word length is greater than a first threshold when the word length and the target search word meet a preset condition, and if so, trigger a comprehensive search module, and if not, trigger a second judgment module; The comprehensive search module is used to perform a comprehensive matching search on the target search terms to obtain search results; The second judgment module is used to search the target search word according to the expansion word loading rule and the synonym word loading rule to obtain a preset search result, and judge whether the word length is less than a second threshold, wherein the first threshold is greater than the second threshold, if it is less than the second threshold, the short word search module is triggered, and if it is not less than the second threshold, the result module is triggered; The short word search module is used to search the target search word according to the short word matching rule to obtain the search result; The result module is used to use the preset search result as the search result; The expansion word loading rule is determined by: Obtain the search term to be written and the corresponding extended term; Determine a one-way mapping relationship between the search word to be written and the extended word to determine the extended word loading rule; Correspondingly, the synonym loading rule is determined by: Obtaining the search word to be written and the corresponding synonyms; Determine a bidirectional mapping relationship between the search word to be written and the synonym to determine the synonym loading rule; Correspondingly, the determination of the short word matching rule is obtained in the following manner: Divide the search word to be written into multiple characters according to the finest granularity of word segmentation and record the position order corresponding to the multiple characters; The preset matching word number and the preset movement number are set according to the mapping relationship between the search word to be written and the position sequence to determine the short word matching rule.
6. A device for searching words, It is characterized in that include: Memory for storing computer programs; A processor is used to implement the steps of the method for retrieving words as described in any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for retrieving words as described in any one of claims 1 to 4 are implemented.
