Near-synonym query method, device and equipment, readable storage medium and program product

Through the method of combining large language model and preset the thesaurus, a list of synonyms candidate words is constructed and screened, which solves the problem of large semantic deviation rate in the existing technology, and improves the accuracy and flexibility of synonyms query.

CN120448532APending Publication Date: 2025-08-08CHINA SOUTHERN POWER GRID INTERNET SERVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510597239.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, when synonyms are searched by calculating the word vector similarity between candidate words and input words through statistical language models, the semantic deviation rate is large, resulting in poor query results.

Method used

The first candidate word list is constructed through semantic understanding through large language models, and synonyms are matched with preset thesaurus. The candidate word proportion is dynamically configured based on the query scenario, and candidate word filtering is performed to ensure the validity and accuracy of candidate words.

Benefits of technology

Improve the accuracy and flexibility of synonym query, comprehensively obtain all possible synonym candidate words, avoid omissions, and meet the needs of different business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448532A_ABST
    Figure CN120448532A_ABST
Patent Text Reader

Abstract

The invention relates to a synonym query method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the steps of obtaining a first candidate word list through a large language model based on a synonym query prompt text constructed by input words; based on the input word, calling a preset word bank to perform synonym matching to obtain a second candidate word list; determining a first candidate word proportion and a second candidate word proportion based on the query scene, determining a first candidate word quantity based on the first candidate word proportion and the total quantity of the synonyms, and determining a second candidate word quantity based on the second candidate word proportion and the total quantity of the synonyms; and performing candidate word screening on the first candidate word list based on the first candidate word quantity to obtain a first screening word, performing candidate word screening on the second candidate word list based on the second candidate word quantity to obtain a second screening word, and taking the first screening word and the second screening word as the synonyms of the input word, so that the synonym query effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a synonym query method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] The rapid development of computer technology has led to the emergence of natural language processing (NLP), a technology capable of understanding, generating, and processing human language. It is widely used in areas such as intelligent customer service, text summarization, and machine translation. Synonym queries are now necessary to ensure accurate semantic expression, enrich text content, and improve information retrieval efficiency.

[0003] Related technologies typically use statistical language models (such as TF-IDF (Term Frequency-Inverse Document Frequency) and Word2Vec (word embedding) algorithms) to calculate the word vector similarity between candidate words and the input word. This similarity is then used to search for synonyms of the input word. However, the semantic bias rate calculated by these technologies is high, making them difficult to match actual query requirements, resulting in poor results for synonym searches. Summary of the Invention

[0004] Based on this, it is necessary to provide a synonym query method, device, computer equipment, computer-readable storage medium and computer program product that can improve the synonym query effect in response to the above technical problems.

[0005] In a first aspect, the present application provides a synonym search method, comprising:

[0006] Get the query scenario of the input word and the current synonym query;

[0007] Based on the input word, construct a synonym query prompt text, and based on the synonym query prompt text, perform semantic understanding on the synonym query prompt text through a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words;

[0008] Based on the input word, calling a preset word library to perform synonym matching to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0009] Based on the query scenario, determining a proportion of the first candidate word and a proportion of the second candidate word, determining the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determining the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0010] Based on the number of first candidate words, the first candidate word list is screened to obtain first screened words. Based on the number of second candidate words, the second candidate word list is screened to obtain second screened words. The first screened words and the second screened words are both used as synonyms of the input word.

[0011] In a second aspect, the present application further provides a synonym query device, comprising:

[0012] The acquisition module is used to obtain the query scenario of the input word and the current synonym query;

[0013] an understanding module, configured to construct a synonym query prompt text based on an input word, and perform semantic understanding of the synonym query prompt text using a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words;

[0014] a matching module, configured to call a preset word library to perform synonym matching based on the input word to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0015] a determination module, configured to determine a proportion of a first candidate word and a proportion of a second candidate word based on the query scenario, determine the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determine the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0016] A screening module is used to screen the first candidate word list based on the number of first candidate words to obtain first screening words, and to screen the second candidate word list based on the number of second candidate words to obtain second screening words, and to use the first screening words and the second screening words as synonyms of the input word.

[0017] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0018] Get the query scenario of the input word and the current synonym query;

[0019] Based on the input word, construct a synonym query prompt text, and based on the synonym query prompt text, perform semantic understanding on the synonym query prompt text through a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words;

[0020] Based on the input word, calling a preset word library to perform synonym matching to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0021] Based on the query scenario, determining a proportion of the first candidate word and a proportion of the second candidate word, determining the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determining the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0022] Based on the number of first candidate words, the first candidate word list is screened to obtain first screened words. Based on the number of second candidate words, the second candidate word list is screened to obtain second screened words. The first screened words and the second screened words are both used as synonyms of the input word.

[0023] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:

[0024] Get the query scenario of the input word and the current synonym query;

[0025] Based on the input word, construct a synonym query prompt text, and based on the synonym query prompt text, perform semantic understanding on the synonym query prompt text through a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words;

[0026] Based on the input word, calling a preset word library to perform synonym matching to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0027] Based on the query scenario, determining a proportion of the first candidate word and a proportion of the second candidate word, determining the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determining the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0028] Based on the number of first candidate words, the first candidate word list is screened to obtain first screened words. Based on the number of second candidate words, the second candidate word list is screened to obtain second screened words. The first screened words and the second screened words are both used as synonyms of the input word.

[0029] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the following steps:

[0030] Get the query scenario of the input word and the current synonym query;

[0031] Based on the input word, construct a synonym query prompt text, and based on the synonym query prompt text, perform semantic understanding on the synonym query prompt text through a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words;

[0032] Based on the input word, calling a preset word library to perform synonym matching to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0033] Based on the query scenario, determining a proportion of the first candidate word and a proportion of the second candidate word, determining the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determining the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0034] Based on the number of first candidate words, the first candidate word list is screened to obtain first screened words. Based on the number of second candidate words, the second candidate word list is screened to obtain second screened words. The first screened words and the second screened words are both used as synonyms of the input word.

[0035] The aforementioned synonym query method, apparatus, computer device, computer-readable storage medium, and computer program product obtain an input word and a query scenario for the current synonym query; construct a synonym query prompt text based on the input word; and, based on the synonym query prompt text, perform semantic understanding of the synonym query prompt text using a large language model to obtain a first candidate word list, which includes ordered first candidate words. In other words, the semantic understanding capabilities of the large language model are used to select a first candidate word list that is likely to be synonyms of the input word. Based on the input word, a preset lexicon is used to perform synonym matching to obtain a second candidate word list, which includes ordered second candidate words. In other words, a second candidate word list that is likely to be synonyms of the input word is selected using the preset lexicon. Next, the proportions of the first and second candidate words are flexibly configured based on the query scenario. To this end, the number of first candidate words is determined based on the proportion of the first candidate words and a preset total number of synonyms, and the number of second candidate words is determined based on the proportion of the second candidate words and the total number of synonyms. Therefore, based on the number of first candidate words, the first candidate word list is targeted for candidate word screening to obtain the first screening word, and based on the number of second candidate words, the second candidate word list is targeted for candidate word screening to obtain the second screening word, so as to ensure the effectiveness and accuracy of the screening of each candidate word, and both the first screening word and the second screening word are used as synonyms of the input word. Throughout the process, the large language model and the preset vocabulary respectively obtain different candidate word lists to comprehensively and completely obtain all candidate words that may be synonyms, avoid missing candidate words that are synonyms, ensure the accuracy of synonym queries, and use query scenarios to dynamically allocate the proportion of candidate words in different candidate word lists, thereby increasing the flexibility of synonym queries and improving the effect of synonym queries. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following briefly introduces the drawings required for use in the embodiments of the present application or related technical descriptions. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying any creative work.

[0037] Figure 1 A diagram showing an application environment of a synonym query method in one embodiment;

[0038] Figure 2 1 is a flow chart of a synonym search method according to an embodiment;

[0039] Figure 3 A schematic diagram of a synonym search process in one embodiment;

[0040] Figure 4is a structural block diagram of a synonym query device in one embodiment;

[0041] Figure 5 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0043] The synonym search method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 via a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The synonym query method provided in the embodiment of the present application can be executed independently by the terminal 102 or the server 104, or it can be executed collaboratively by the terminal 102 and the server 104.

[0044] In one embodiment, the terminal 102 sends the input word to the server 104 , and the server 104 obtains the query scenario of the current synonym query. The server 104 constructs a synonym query prompt text based on the input word. The server 104 performs semantic understanding of the synonym query prompt text through a large language model based on the synonym query prompt text to obtain a first candidate word list, which includes ordered first candidate words; the server 104 calls a preset word library to perform synonym matching based on the input word to obtain a second candidate word list, which includes ordered second candidate words; the server 104 determines the proportion of the first candidate word and the proportion of the second candidate word based on the query scenario, the server 104 determines the number of first candidate words based on the proportion of the first candidate word and the preset total number of synonyms, and the server 104 determines the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms; the server 104 screens the first candidate word list based on the number of the first candidate words to obtain a first screened word, and the server 104 screens the second candidate word list based on the number of the second candidate words to obtain a second screened word, and both the first screened word and the second screened word are used as synonyms of the input word.

[0045] Terminal 102 may include, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart car devices, and projectors. Portable wearable devices may include smart watches, smart bracelets, and head-mounted devices. Head-mounted devices may include virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, and the like. Server 104 may be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services.

[0046] In an exemplary embodiment, Figure 2 As shown, a synonym query method is provided, which is applied to a computer device (which may be Figure 1 The terminal 102 in FIG. 1 may also be the server 104) is used as an example to illustrate the process, including the following steps 202 to 210. In which:

[0047] Step 202: Obtain the query scenario of the input word and the current synonym query.

[0048] The input term is the term for which a synonym search is to be performed. The input term is the term entered into the input box. It can be manually entered or captured from multimedia content and automatically displayed in the input box to trigger a synonym search. For example, in response to an input operation into the input box, the term entered in the input operation is used as the input term. The input operation is entered through a query account. Another example is that after a term captured from text is automatically displayed in the input box, the captured term is used as the input term. Furthermore, the input box can be a product search box on a product push page in a product push application, and the input term can be the product name in the input box on the product push page in the product push application, for example, the input term is a smartphone. The query scenario refers to the scenario for performing a synonym search, reflecting the query requirement when searching for synonyms of the input term from candidate terms. The query requirement can be fuzzy matching or non-fuzzy matching. That is, the query scenario includes query scenarios based on fuzzy matching and query scenarios based on non-fuzzy matching. Fuzzy matching refers to semantic expansion of the input term through contextual semantic understanding to broaden the scope of the synonym search. It's understandable that non-fuzzy matching, in contrast to fuzzy matching, targets the input word itself. Non-fuzzy matching is a "rigid" query that strives for precision and is suitable for critical business scenarios. Therefore, non-fuzzy matching can be considered an exact match. Fuzzy matching is a "flexible" query that seeks broad coverage and is suitable for natural language interaction or noisy data environments.

[0049] Optionally, after acquiring the input word, the computer device determines the query scenario of the current synonym query based on the query habits of the current query account, which is the user account that determines the input word to be queried. Exemplarily, if the query habit of the current query account is that the first frequency of fuzzy matching queries is greater than the second frequency of non-fuzzy matching queries, then the query scenario is determined to be a query scenario based on fuzzy matching. Optionally, after acquiring the input word, the computer device determines the query scenario of the current synonym query based on the acquisition time, and the acquisition time refers to the time when the computer device acquires the input word. Exemplarily, if the acquisition time is within a high-traffic promotion period, then the query scenario is determined to be a query scenario based on non-fuzzy matching; if the acquisition time is not within a high-traffic promotion period, then the query scenario is determined to be a query scenario based on fuzzy matching. Among them, the high-traffic promotion period refers to a period of frequent promotion, which can be understood as a high-traffic marketing period. For example, the period of a certain promotion event is a high-traffic promotion period. Optionally, according to the input scene identifier, the corresponding query scenario is determined based on the scene identifier.

[0050] Step 204 : construct a synonym query prompt text based on the input word, and perform semantic understanding of the synonym query prompt text through a large language model to obtain a first candidate word list, which includes ordered first candidate words.

[0051] The synonym query prompt text is prompt text used to query synonyms. The first candidate word list includes ordered first candidate words. For example, the first candidate words are sorted from high to low according to their synonym confidence scores to obtain the ordered first candidate words, thereby obtaining the first candidate word list. The synonym confidence score refers to the probability that the corresponding first candidate word is a synonym of the input word.

[0052] Exemplarily, the computer device determines a temperature parameter for the large language model based on the input word and query scenario, configures the large language model according to the temperature parameter, and after determining a synonym query prompt text, performs semantic understanding of the synonym query prompt text based on the configured large language model to obtain a first candidate word list. The larger the temperature parameter, the greater the diversity generated by the large language model.

[0053] Step 206: Based on the input word, call the preset word library to perform synonym matching to obtain a second candidate word list, where the second candidate word list includes ordered second candidate words.

[0054] The preset word library is a dynamic word library associated with the input word, and the preset word library has a pre-set set of synonyms for each classification label. The classification label refers to the category of the word. For example, if the word is "smartphone", the classification label is "mobile phone".

[0055] Exemplarily, a computer device determines a category label for an input word, searches a preset vocabulary for a set of synonyms for the category label, and selects words from the searched set of synonyms for the category label as second candidate words. The synonym set also includes a frequency weight for each second candidate word. The second candidate words in the searched set of synonyms are sorted from high to low by frequency weight to obtain ordered second candidate words, thereby obtaining a list of second candidate words. The frequency weight refers to the relative frequency of a word in a corpus of a specific category (e.g., a corpus related to a product push application, which records the set of words that appear in the product push application), reflecting the word's commonality in actual applications. A higher frequency weight indicates that the word is more frequently used in that category and is more likely to be recommended first. For example, if the input word is "smartphone" and the corresponding category label is "mobile phone," the preset vocabulary will search for second candidate words such as "smart phone" and "smart terminal."

[0056] For example, in a product push scenario, the classification label is a product classification label. In this case, based on the product push interface where the input word is located, the mall category of the mall corresponding to the product push interface is determined, and a preset vocabulary corresponding to the mall category is obtained. Based on the classification label of the input word, a synonym set corresponding to the classification label is obtained from the obtained preset vocabulary, and each word in the synonym set is used as a second candidate word. In this case, the steps for constructing the preset vocabulary are as follows: determining the target mall category, obtaining a product push application for the target mall category, determining the product classification label involved in the product push application, for each product classification label, obtaining all synonyms related to the product classification label and the word frequency weight of each synonym from the product push application, constructing a corresponding synonym set based on all synonyms related to the product classification label and the word frequency weight of each synonym, and constructing a preset vocabulary for the target mall category based on the synonym set of each product classification label. For example, if the mall category is Mall Category 1 and the product category label is Mobile Phone, all synonyms related to "Mobile Phone" in the product push application for Mobile Mall Category 1, such as smart phone, smart terminal, and smart machine, are used to build a corresponding synonym set. By dividing the vocabulary dimension according to needs, the applicability and accuracy of synonyms are ensured to meet the needs of different business scenarios.

[0057] Step 208: Based on the query scenario, determine the proportion of the first candidate word and the proportion of the second candidate word, determine the number of first candidate words based on the proportion of the first candidate word and the preset total number of synonyms, and determine the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms.

[0058] Among them, the preset total number of synonyms refers to the total number of synonyms required to obtain when performing a synonym query for the input word, the first candidate word proportion refers to the ratio of the number of first candidate words as synonyms (the number of first candidate words that are synonyms in the first candidate word list) to the total number of synonyms, and the second candidate word proportion refers to the ratio of the number of second candidate words as synonyms (the number of second candidate words that are synonyms in the second candidate word list) to the total number of synonyms. The number of first candidate words refers to the number of first candidate words as synonyms, and the number of second candidate words refers to the number of second candidate words as synonyms. For example, if the total number of synonyms is 10, the first candidate words account for 70%, and the second candidate words account for 30%, then the number of first candidate words is 7 and the number of second candidate words is 3.

[0059] Exemplarily, the computer device uses the product of the proportion of the first candidate word and the total number of synonyms as the number of first candidate words, and uses the product of the proportion of the second candidate word and the total number of synonyms as the number of second candidate words.

[0060] Step 210, screen the first candidate word list based on the number of first candidate words to obtain first screened words, screen the second candidate word list based on the number of second candidate words to obtain second screened words, and use both the first screened words and the second screened words as synonyms of the input word.

[0061] The number of the first screening words is less than or equal to the number of the first candidate words, and the number of the second screening words is less than or equal to the number of the second candidate words.

[0062] In one embodiment, the first candidate word list is screened for candidates based on the number of first candidate words to obtain first screened words, including: based on the ordered first candidate words in the first candidate word list, the first candidate words with the first candidate word number at the front are used as first screened words, and the earlier the number, the higher the synonym confidence score of the first candidate word corresponding to the corresponding number in the first candidate word list; the second candidate word list is screened for candidates based on the number of second candidate words to obtain second screened words, including: based on the ordered second candidate words in the second candidate word list, the second candidate words with the second candidate word number at the front are used as second screened words, and the earlier the number, the higher the word frequency weight of the second candidate word corresponding to the corresponding number in the second candidate word list.

[0063] Exemplarily, if the number of first candidate words and the number of second candidate words are 7 and 3 respectively, the first 7 first candidate words in the first candidate word list are used as the first screening words, and the first 3 second candidate words in the second candidate word list are used as the second screening words.

[0064] In this embodiment, the first candidate word list and the second candidate word list are screened respectively by the synonym confidence score of each first candidate word and the word frequency weight of each second candidate word, thereby realizing dynamic allocation of candidate words of different candidate word lists according to the query scenario, and realizing intelligent allocation of the number of candidate words based on the characteristics of the query scenario, so as to ensure the effectiveness and accuracy of the screening of each candidate word and improve the flexibility of synonym query.

[0065] In one embodiment, the method also includes: calculating the first similarity between the input word and each first filter word, and calculating the second similarity between the input word and each second filter word; treating the first filter word whose first similarity is greater than or equal to the first threshold and the second filter word whose second similarity is greater than or equal to the second threshold as synonyms of the input word.

[0066] Exemplarily, the computer device calculates the semantic distance between the input word and each first screening word using cosine similarity to obtain a first similarity corresponding to each first screening word. Exemplarily, the computer device calculates the semantic distance between the input word and each second screening word using cosine similarity to obtain a second similarity corresponding to each second screening word.

[0067] In this embodiment, by calculating the first similarity and the second similarity, the first filter words whose first similarity is less than the first threshold and the second filter words whose second similarity is less than the second threshold can be eliminated, the semantic deviation items are filtered out, and the accuracy and effectiveness of the synonym query are ensured.

[0068] In the above-mentioned synonym query method, an input word and a query scenario of the current synonym query are obtained; based on the input word, a synonym query prompt text is constructed; based on the synonym query prompt text, a semantic understanding of the synonym query prompt text is performed on the synonym query prompt text using a large language model to obtain a first candidate word list, which includes ordered first candidate words. In other words, the semantic understanding ability of the large language model is used to select a first candidate word list that may be synonyms of the input word. Based on the input word, a preset word library is called to perform synonym matching to obtain a second candidate word list, which includes ordered second candidates. In other words, a second candidate word list that may be synonyms of the input word is selected using the preset word library. Next, the proportion of the first candidate word and the proportion of the second candidate word are flexibly configured based on the query scenario. To this end, the number of first candidate words is determined based on the proportion of the first candidate word and the preset total number of synonyms, and the number of second candidate words is determined based on the proportion of the second candidate word and the total number of synonyms. Therefore, based on the number of first candidate words, the first candidate word list is targeted for candidate word screening to obtain the first screening word, and based on the number of second candidate words, the second candidate word list is targeted for candidate word screening to obtain the second screening word, so as to ensure the effectiveness and accuracy of the screening of each candidate word, and both the first screening word and the second screening word are used as synonyms of the input word. Throughout the process, the large language model and the preset vocabulary respectively obtain different candidate word lists to comprehensively and completely obtain all candidate words that may be synonyms, avoid missing candidate words that are synonyms, ensure the accuracy of synonym queries, and use query scenarios to dynamically allocate the proportion of candidate words in different candidate word lists, thereby increasing the flexibility of synonym queries and improving the effect of synonym queries.

[0069] In one embodiment, if the query scenario is a query scenario based on fuzzy matching, the proportion of the first candidate word is greater than that of the second candidate word; if the query scenario is a query scenario based on non-fuzzy matching, the proportion of the first candidate word is less than that of the second candidate word.

[0070] Exemplarily, if the query scenario is a query scenario based on fuzzy matching, the proportion of the first candidate word and the proportion of the second candidate word are determined to be the first ratio and the second ratio respectively, and the first ratio is greater than the second ratio. If the query scenario is a query scenario based on non-fuzzy matching, the proportion of the first candidate word and the proportion of the second candidate word are determined to be the second ratio and the first ratio respectively.

[0071] For example, if the query scenario is a query scenario based on fuzzy matching, the first candidate word accounts for 70% and the second candidate word accounts for 30% respectively; if the query scenario is a query scenario based on non-fuzzy matching, the first candidate word accounts for 30% and the second candidate word accounts for 70% respectively.

[0072] Exemplarily, the computer device also supports a proportional elastic floating mechanism, which can dynamically fine-tune the proportion of the first candidate word and the second candidate word (floating range ±15%) according to real-time traffic data. For example, based on the scene identification of the input scene, it is determined that the corresponding query scene is a query scene based on non-fuzzy matching, and the proportion of the first candidate word and the proportion of the second candidate word are determined to be the second ratio and the first ratio respectively according to the query scene based on non-fuzzy matching. If the current moment is in a high-traffic promotion period, the preset increase ratio is superimposed on the first ratio to obtain the increased ratio, and the increased ratio is used as the updated second candidate word proportion. The increase ratio is subtracted from the second ratio to obtain the reduced ratio, and the reduced ratio is used as the updated second candidate word proportion. Based on the updated first candidate word proportion and the updated second candidate word proportion, the first candidate word quantity determination step and the second candidate word quantity determination step are returned to continue execution.

[0073] For example, the proportion of the first candidate word and the second candidate word are 30% and 70% respectively. If the current moment is during a certain big promotion, then 70% will be added to 15% (increase ratio) to get the adjusted proportion of the second candidate word, which is 85%. 30% minus 15% will get the adjusted proportion of the first candidate word, which is 15%.

[0074] In this embodiment, the proportion of the first candidate word and the proportion of the second candidate word are adaptively allocated based on whether the query scenario is a fuzzy matching-based query scenario, thereby improving the flexibility of synonym query.

[0075] In one embodiment, the method further includes: in response to a repeated query operation for the input word triggered by the current query account, increasing the proportion of the first candidate word and decreasing the proportion of the second candidate word.

[0076] The repeated query operation is a query operation that is performed multiple times in succession, and the query operation may be an input operation of inputting the input word.

[0077] Exemplarily, the computer device obtains the operation record of the current query account on the product push interface. If the operation record indicates that the current query account has repeatedly performed query operations for the same input word on the product push interface, the proportion of the first candidate word is increased and the proportion of the second candidate word is decreased. The number of first candidate words is determined based on the adjusted proportion of the first candidate word and the total number of synonyms. The number of first candidate words is determined based on the adjusted proportion of the second candidate word and the total number of synonyms, and the computer device returns to step 210 to continue. For example, after executing step 208, if a preset number of consecutive query operations are detected within a preset time period, the proportion of the first candidate word is increased and the proportion of the second candidate word is decreased.

[0078] In this embodiment, if repeated query operations occur continuously, the first candidate word ratio of the first candidate word generated by the large language model is increased to meet the user's demand for a wider range of fuzzy searches.

[0079] In one embodiment, based on the query scenario, the proportion of the first candidate word and the proportion of the second candidate word are determined, including: obtaining the historical search times of the input word; constructing a prompt text to confirm the proportion of the candidate word based on the historical search times, the query scenario and the input word; based on the prompt text to confirm the proportion of the candidate word, calling a large language model for semantic understanding, and outputting the proportion of the first candidate word and the proportion of the second candidate word.

[0080] The number of historical searches may be the number of historical searches for the input word by the current query account, or the number of historical searches for the input word by all query accounts within a fixed time period.

[0081] For example, the candidate word ratio confirmation prompt text is as follows:

[0082]

Mission Instructions

[0083] As a search optimization engine, dynamically predict the proportion of the first candidate word and the proportion of the second candidate word based on the following input features:

[0084] - Enter keywords: {keyword}

[0085] - Whether to enable fuzzy search: {is_fuzzy_search} (True / False)

[0086] -Number of historical searches: {search_count} (integer)

[0087] Output requirements

[0088] - Proportion of the first candidate word: integer percentage (0%-100%)

[0089] - Second candidate word ratio: integer percentage (0%-100%)

[0090] It should be noted that the keyword is the input word, and whether to enable fuzzy search refers to whether the query scenario is based on fuzzy matching. If so, enter True; if not, enter False.

[0091] Of course, the large language model can simultaneously predict the temperature parameter and the candidate word proportion. The temperature parameter is the temperature parameter of the large language model used in the subsequent step of determining the first candidate word list. At this time, the above-mentioned candidate word proportion confirmation prompt text is input into the large language model, and the temperature parameter, the proportion of the first candidate word, and the proportion of the second candidate word are output.

[0092] In this embodiment, the historical search times, query scenarios, and input words are used to construct a prompt text for confirming the proportion of candidate words, so that the proportion of the first candidate word and the proportion of the second candidate word can be accurately determined.

[0093] In a specific embodiment, Figure 3 The following is a flowchart of a synonym search process in one embodiment. The specific steps are as follows:

[0094] Step 1: The server obtains an input word and generates candidate words based on the input word.

[0095] Optionally, the server obtains an input word sent by the terminal and determines a query scenario for the current synonym query. Based on the input word, the server constructs a synonym query prompt text. Based on the synonym query prompt text, the server performs semantic understanding of the synonym query prompt text using a large language model to obtain a first candidate word list, where the first candidate word list includes ordered first candidate words. Based on the input word, the server calls a preset vocabulary to perform synonym matching to obtain a second candidate word list, where the second candidate word list includes ordered second candidate words.

[0096] Step 2: The server filters the candidate words and obtains synonyms.

[0097] Optionally, the server determines the proportion of the first candidate word and the proportion of the second candidate word based on the query scenario. If the query scenario is a query scenario based on fuzzy matching, the proportion of the first candidate word is greater than the proportion of the second candidate word; if the query scenario is a query scenario based on non-fuzzy matching, the proportion of the first candidate word is less than the proportion of the second candidate word. Exemplarily, the number of historical searches for the input word is obtained; based on the number of historical searches, the query scenario, and the input word, a prompt text is constructed to confirm the proportion of the candidate word; based on the prompt text confirming the proportion of the candidate word, the large language model is called for semantic understanding, and the proportion of the first candidate word and the proportion of the second candidate word are output.

[0098] Optionally, the number of first candidate words is determined based on the proportion of first candidate words and the total number of preset synonyms, and the number of second candidate words is determined based on the proportion of second candidate words and the total number of synonyms.

[0099] Optionally, based on the ordered first candidate words in the first candidate word list, the first candidate words with the first candidate word quantity at the front of the sequence number are used as the first screening words, and the earlier the sequence number, the higher the synonym confidence score of the first candidate words corresponding to the corresponding sequence number in the first candidate word list; based on the ordered second candidate words in the second candidate word list, the second candidate words with the second candidate word quantity at the front of the sequence number are used as the second screening words, and the earlier the sequence number, the higher the word frequency weight of the second candidate words corresponding to the corresponding sequence number in the second candidate word list.

[0100] Optionally, the server calculates the first similarity between the input word and each first filter word, and calculates the second similarity between the input word and each second filter word; the first filter word whose first similarity is greater than or equal to the first threshold and the second filter word whose second similarity is greater than or equal to the second threshold are both regarded as synonyms of the input word.

[0101] Step 3: Based on the user feedback behavior, the server confirms whether to adjust the parameters. If so, the parameters are adjusted. If not, the synonyms are output and the process ends.

[0102] The parameters include the proportion of the first candidate word and the proportion of the second candidate word. User feedback behavior refers to the behavior of the current query account.

[0103] Optionally, in response to repeated query operations for the input word triggered by the current query account, it is determined that the proportion of the first candidate word and the proportion of the second candidate word need to be adjusted, that is, the proportion of the first candidate word is increased and the proportion of the second candidate word is decreased, and the adjusted proportion of the first candidate word and the adjusted proportion of the second candidate word are obtained. Based on the adjusted proportion of the first candidate word and the preset total number of synonyms, the number of first candidate words is determined, and based on the adjusted proportion of the second candidate word and the total number of synonyms, the number of second candidate words is determined. Then, the first candidate word in the first candidate word list is returned to its ordered order, and the step of using the first candidate word with the first candidate word number at the front as the first screening word is continued.

[0104] If it is a non-repeated query operation, confirm that the parameters will not be adjusted and directly output the synonyms obtained in step 2.

[0105] In this embodiment, the query scenario of the input word and the current synonym query is obtained; based on the input word, a synonym query prompt text is constructed; based on the synonym query prompt text, the synonym query prompt text is semantically understood by the large language model to obtain a first candidate word list, and the first candidate word list includes ordered first candidate words. In other words, the semantic understanding ability of the large language model is used to select a first candidate word list that may be synonyms of the input word. Based on the input word, a preset word library is called to perform synonym matching to obtain a second candidate word list, and the second candidate word list includes ordered second candidates. In other words, a second candidate word list that may be synonyms of the input word is selected by the preset word library. Then, the proportion of the first candidate word and the proportion of the second candidate word are flexibly configured based on the query scenario. To this end, the number of first candidate words is determined based on the proportion of the first candidate word and the preset total number of synonyms, and the number of second candidate words is determined based on the proportion of the second candidate word and the total number of synonyms. Therefore, based on the number of first candidate words, the first candidate word list is targeted for candidate word screening to obtain the first screening word, and based on the number of second candidate words, the second candidate word list is targeted for candidate word screening to obtain the second screening word, so as to ensure the effectiveness and accuracy of the screening of each candidate word, and both the first screening word and the second screening word are used as synonyms of the input word. Throughout the process, the large language model and the preset vocabulary respectively obtain different candidate word lists to comprehensively and completely obtain all candidate words that may be synonyms, avoid missing candidate words that are synonyms, ensure the accuracy of synonym queries, and use query scenarios to dynamically allocate the proportion of candidate words in different candidate word lists, thereby increasing the flexibility of synonym queries and improving the effect of synonym queries.

[0106] It should be understood that, although the various steps in the flowcharts involved in the various embodiments described above are displayed in sequence according to the instructions of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowcharts involved in the various embodiments described above can include multiple steps or multiple stages, and these steps or stages are not necessarily executed and completed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of steps or stages in other steps.

[0107] Based on the same inventive concept, the present application also provides a synonym query device for implementing the aforementioned synonym query method. The solution provided by this device is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more synonym query device embodiments provided below can be found in the above-mentioned limitations of the synonym query method and will not be repeated here.

[0108] In an exemplary embodiment, Figure 4 As shown, a synonym query device 400 is provided, comprising: an acquisition module 402, an understanding module 404, a matching module 406, a determination module 408 and a screening module 410, wherein:

[0109] Acquisition module 402, for acquiring the input word and the query scenario of the current synonym query;

[0110] An understanding module 404 is configured to construct a synonym query prompt text based on the input word, and perform semantic understanding of the synonym query prompt text using a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words.

[0111] A matching module 406 is configured to call a preset word library to perform synonym matching based on the input word to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words;

[0112] Determination module 408, configured to determine a proportion of the first candidate word and a proportion of the second candidate word based on the query scenario, determine the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determine the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms;

[0113] The screening module 410 is used to screen the first candidate word list based on the number of first candidate words to obtain first screening words, and to screen the second candidate word list based on the number of second candidate words to obtain second screening words, and to use both the first screening words and the second screening words as synonyms of the input word.

[0114] In one embodiment, if the query scenario is a query scenario based on fuzzy matching, the proportion of the first candidate word is greater than that of the second candidate word; if the query scenario is a query scenario based on non-fuzzy matching, the proportion of the first candidate word is less than that of the second candidate word.

[0115] In one embodiment, the determination module 408 is used to obtain the historical search times of the input word; based on the historical search times, the query scenario and the input word, construct a prompt text to confirm the proportion of candidate words; according to the prompt text, the large language model is called for semantic understanding, and the proportion of the first candidate word and the proportion of the second candidate word are output.

[0116] In one embodiment, the screening module 410 is used to use the first candidate words with the first candidate word quantity at the front of the sequence number as the first screening word based on the ordered first candidate words in the first candidate word list, and the higher the sequence number, the higher the synonym confidence score of the first candidate word corresponding to the corresponding sequence number in the first candidate word list; the screening module 410 is used to use the second candidate words with the second candidate word quantity at the front of the sequence number as the second screening word based on the ordered second candidate words in the second candidate word list, and the higher the sequence number, the higher the word frequency weight of the second candidate word corresponding to the corresponding sequence number in the second candidate word list.

[0117] In one embodiment, the device also includes a calculation module for calculating the first similarity between the input word and each first filter word, and calculating the second similarity between the input word and each second filter word; the first filter word whose first similarity is greater than or equal to the first threshold and the second filter word whose second similarity is greater than or equal to the second threshold are both used as synonyms of the input word.

[0118] In one embodiment, the device further includes an adjustment module for increasing the proportion of the first candidate word and decreasing the proportion of the second candidate word in response to a repeated query operation for the input word triggered by the current query account.

[0119] Each module in the aforementioned synonym query device may be implemented in whole or in part through software, hardware, or a combination thereof. Each module may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each module.

[0120] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. The processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a synonym query method is implemented.

[0121] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0122] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0124] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0125] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0126] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), quantum computing-based data processing logic devices, artificial intelligence (AI) processors, and the like.

[0127] The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0128] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, and these modifications and improvements fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A synonym search method, characterized in that: The method comprises: Get the query scenario of the input word and the current synonym query; Based on the input word, construct a synonym query prompt text, and based on the synonym query prompt text, perform semantic understanding on the synonym query prompt text through a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words; Based on the input word, calling a preset word library to perform synonym matching to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words; Based on the query scenario, determining a proportion of the first candidate word and a proportion of the second candidate word, determining the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determining the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms; Based on the number of first candidate words, the first candidate word list is screened to obtain first screened words. Based on the number of second candidate words, the second candidate word list is screened to obtain second screened words. The first screened words and the second screened words are both used as synonyms of the input word.

2. The method according to claim 1, characterized in that If the query scenario is a query scenario based on fuzzy matching, the proportion of the first candidate word is greater than the proportion of the second candidate word. If the query scenario is a query scenario based on non-fuzzy matching, the proportion of the first candidate word is less than the proportion of the second candidate word.

3. The method according to claim 1, characterized in that The determining, based on the query scenario, the proportion of the first candidate word and the proportion of the second candidate word includes: Obtain the historical search count of the input word; Based on the number of historical searches, the query scenario, and the input word, construct a prompt text to confirm the candidate word ratio; Confirm the prompt text based on the proportion of candidate words, call the large language model for semantic understanding, and output the proportion of the first candidate word and the proportion of the second candidate word.

4. The method according to claim 1, wherein The step of screening the first candidate word list based on the number of first candidate words to obtain first screened words includes: Based on the ordered first candidate words in the first candidate word list, the first candidate words with the highest number of first candidate words are used as first screening words, wherein the higher the number, the higher the synonym confidence score of the first candidate word corresponding to the corresponding number in the first candidate word list; The step of screening the second candidate word list based on the number of second candidate words to obtain second screened words includes: Based on the ordered second candidate words in the second candidate word list, the second candidate words with the earliest serial numbers are used as second screening words. The earlier the serial number, the higher the frequency weight of the second candidate word corresponding to the corresponding serial number in the second candidate word list.

5. The method according to claim 1, wherein The method further comprises: Calculating a first similarity between the input word and each first screening word, and calculating a second similarity between the input word and each second screening word; A first screening word with a first similarity greater than or equal to a first threshold and a second screening word with a second similarity greater than or equal to a second threshold are both used as synonyms of the input word.

6. The method according to claim 1, characterized in that The method further comprises: In response to a repeated query operation for the input word triggered by the current query account, the proportion of the first candidate word is increased, and the proportion of the second candidate word is decreased.

7. A synonym search device, characterized in that: The device comprises: The acquisition module is used to obtain the query scenario of the input word and the current synonym query; an understanding module, configured to construct a synonym query prompt text based on an input word, and perform semantic understanding of the synonym query prompt text using a large language model to obtain a first candidate word list, wherein the first candidate word list includes ordered first candidate words; a matching module, configured to call a preset word library to perform synonym matching based on the input word to obtain a second candidate word list, wherein the second candidate word list includes ordered second candidate words; a determination module, configured to determine a proportion of a first candidate word and a proportion of a second candidate word based on the query scenario, determine the number of first candidate words based on the proportion of the first candidate word and a preset total number of synonyms, and determine the number of second candidate words based on the proportion of the second candidate word and the total number of synonyms; A screening module is used to screen the first candidate word list based on the number of first candidate words to obtain first screening words, and to screen the second candidate word list based on the number of second candidate words to obtain second screening words, and to use the first screening words and the second screening words as synonyms of the input word.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Semantic information retrieval method

    CN104199965A

  • Synonym screening method and system

    CN107451126A

  • Synonym mining method and related equipment

    CN113822039A

  • Prompt word optimization method and system based on large language model

    CN119047482A

  • Near-synonym pushing method and apparatus, electronic device, and medium

    WO2021174783A1