Recommendation method and device for search entries, equipment and storage medium

The historical search entries are stored through keyword indexes and tree structures, and the search time and popularity values are used to represent the search time and popularity, which solves the memory consumption problem and maintains the recommended performance of the search entries.

CN120448526APending Publication Date: 2025-08-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410156741.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-02
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

When the prior art saves a large number of historical search entries, memory resources are consumed more, which affects the recommended performance of search entries.

Method used

The keyword index and tree structure are used to store historical search entries, and the time stamp and popularity value are used to represent search time and popularity, avoid repeated storage, and store historical search entries through tree structure association.

Benefits of technology

Reduces memory usage, maintains the recommended performance of search terms, and avoids memory consumption and retrieval performance degradation caused by repeated storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448526A_ABST
    Figure CN120448526A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a search entry recommendation method and device, equipment and a storage medium. The search entry recommendation method and device are used for reducing memory occupation and not reducing search entry recommendation performance. The method can be applied to the technical fields of computers, artificial intelligence, Internet of Vehicles and the like. The method includes: acquiring a search request; a target keyword index set is screened from a first word set according to the search request, the first word set is used for storing initial search keywords of the historical search entries as keyword indexes, and the keyword indexes further store timestamps and popularity values of the initial keywords; a target tree structure set is determined according to the target keyword index set, each tree structure in the target tree structure set is used for storing historical search entries, one sub-tree of each tree structure corresponds to one historical search entry, and each node of the tree structure further stores a timestamp and a popularity value of each search keyword; screening from the target tree structure set according to the search request to obtain recommended search entries; and displaying the recommended search entry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method, apparatus, device, and storage medium for recommending search terms. Background Art

[0002] With the development of computer technology and search technology, various websites or forums have begun to have search functions. Search usually refers to the in-depth mining and integration of a certain type of specialized information in the website (page) library according to the user's search request, and then returning the results to the user in some form.

[0003] In real-world applications, search engines, e-commerce websites, forums, and other search platforms often encounter scenarios such as collecting statistics and recommendations on the most searched terms or posts by other users over the past hour or day. This requires saving historical search terms from each website (page) and collecting information such as their search popularity. Currently, the common approach is to store these historical search terms one by one in memory, but this consumes a lot of memory resources for websites (pages) with a large number of historical search terms.

[0004] Therefore, there is an urgent need for a method to reduce memory usage while maintaining search term recommendation performance. Summary of the Invention

[0005] Embodiments of the present application provide a search term recommendation method, apparatus, device, and storage medium for reducing memory usage while maintaining search term recommendation performance.

[0006] In view of this, the present application provides, on the one hand, a method for recommending search terms, comprising: obtaining a search request; filtering a target keyword index set from a first word set according to the search request, the first word set being used to store the starting search keyword of a historical search term as a keyword index, the keyword index also storing a timestamp and a heat value of the starting keyword, the timestamp being used to indicate the search time of the keyword index, and the heat value being used to indicate the number of historical searches of the keyword; determining a target tree structure set according to the target keyword index set, each tree structure in the target tree structure set being used to store the historical search term, a subtree formed by the root node and child nodes of the tree structure corresponding to a historical search term, the root node in the tree structure being used to store the starting search keyword, each child node of the tree structure storing a search keyword, each node of the tree structure also storing a timestamp and a heat value of each search keyword, the tree structure and the first word set being used to associate and store the historical search term; filtering a recommended search term from the target tree structure set according to the search request; and displaying the recommended search term.

[0007] On the other hand, the present application provides a search term recommendation device, comprising: an acquisition module, configured to acquire a search request;

[0008] A processing module is configured to filter a target keyword index set from a first word set according to the search request, the first word set being used to store the starting search keyword of a historical search term as a keyword index, the keyword index also storing a timestamp and a heat value of the starting keyword, the timestamp being used to indicate the search time of the keyword index, and the heat value being used to indicate the number of historical searches of the keyword; determine a target tree structure set according to the target keyword index set, each tree structure in the target tree structure set being used to store the historical search term, a subtree consisting of a root node and child nodes of the tree structure corresponding to a historical search term, the root node in the tree structure being used to store the starting search keyword, each child node of the tree structure storing a search keyword, each node of the tree structure also storing a timestamp and a heat value of each search keyword, the tree structure and the first word set being used to associate and store the historical search term; filter a recommended search term from the target tree structure set according to the search request;

[0009] The display module is used to display the recommended search terms.

[0010] In one possible design, in another implementation of another aspect of an embodiment of the present application, the search request recommends the top N search terms ranked from high to low in popularity value within a first time period, where N is a positive integer; the processing module is used to traverse the timestamps of each keyword index in the first word set, and assign the keyword index whose timestamp meets the first time period to the target keyword index set.

[0011] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to obtain a heat value set of each keyword index in the target keyword index set;

[0012] Sort the heat values in the heat value set from high to low;

[0013] The tree structures corresponding to the top N keyword indexes are assigned to the target tree structure set.

[0014] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to traverse the timestamps of each node in the target tree structure set and delete the nodes whose timestamps do not meet the first time period to obtain the target node set;

[0015] Generate a search term to be recommended according to the target node set;

[0016] Traverse the popularity values of the search terms to be recommended, and take the top N search terms to be recommended ranked from high to low popularity values as the recommended search terms.

[0017] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to traverse the target node set in the order from the root node to the last layer of child nodes, and use the search term corresponding to the complete subtree obtained by traversal as the search term to be recommended.

[0018] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is used to traverse the heat value of the terminating keyword of the search term to be recommended, and select the top N search terms to be recommended that are ranked from high to low in terms of the heat value of the terminating keyword as the recommended search term.

[0019] In one possible design, in another implementation of another aspect of the embodiment of the present application, the search request is to recommend the top N search terms ranked by popularity value within a first time period, and the keyword index is a first keyword; the processing module is used to match the first keyword with each keyword index in the first word set to obtain a matching result;

[0020] When the matching result indicates that the first keyword exists in the first word set, a first keyword index corresponding to the first keyword is determined to be the target keyword index set.

[0021] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to use the first tree structure corresponding to the first keyword index as the target tree structure set.

[0022] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to, when the timestamp of the root node of the first tree structure satisfies the first time period, traverse the timestamps of each child node of the first tree structure, and delete the child nodes whose timestamps do not satisfy the first time period, to obtain a target child node set;

[0023] Generate a search term to be recommended based on the root node and the target child node set;

[0024] Traverse the popularity values of the search terms to be recommended, and take the top N search terms to be recommended ranked from high to low popularity values as the recommended search terms.

[0025] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to determine that the recommended search term is empty when the timestamp of the root node of the first tree structure does not satisfy the first time period;

[0026] or,

[0027] When the timestamp of the root node of the first tree structure does not meet the first time period, the heat values of each subtree of the first tree structure are traversed, and the top N search terms ranked from high to low in heat value are used as the recommended search terms.

[0028] In one possible design, in another implementation of another aspect of the embodiment of the present application, the acquisition module is used to acquire the historical search term;

[0029] The processing module is used to perform word segmentation processing on the historical search term to obtain M search keywords, where M is a positive integer; traverse the first word set, and when the first search keyword does not exist in the first word set, create a first keyword index corresponding to the first search keyword, and the first search keyword is ranked first among the multiple search keywords, and the first keyword index includes the timestamp and initial heat value of the first search keyword; create a root node of the historical search term based on the first keyword index; store the first search keyword in the root node, and create a tree structure of the historical search term based on the root node according to the word ranking, and the number of child nodes of the tree structure is M-1; each child node of the tree structure stores the multiple search keywords in sequence, wherein each child node stores the timestamp and heat value of the search keyword of the historical search term.

[0030] In one possible design, in another implementation of another aspect of the embodiment of the present application, the processing module is configured to, when the first search keyword exists in the first word set, obtain the root node where the first search keyword is located, and update the timestamp and heat value of the root node corresponding to the first search keyword;

[0031] Read the i-th search keyword of the historical search term in the order of the words, where i is an integer ranging from 2 to M;

[0032] When the i-th search keyword is less than M, traverse the i-th layer node. When the second search keyword exists in the i-th layer node, update the timestamp and heat value of the first child node in the i-th layer node. The first child node is the node storing the i-th search keyword.

[0033] When the i-th search keyword does not exist in the i-th layer node, create a second child node, and store the i-th search keyword, the timestamp and the heat value of the i-th search keyword in the second child node, and the second child node is included in the i-th layer node;

[0034] Creating a target subtree based on the second child node according to the word sorting, and sequentially storing the remaining search keywords after the i-th search keyword, the timestamps and heat values of the remaining search keywords in the target subtree;

[0035] When the i-th search keyword is greater than M, the storage of the historical search term is terminated.

[0036] Another aspect of the present application provides a computer device, comprising: a memory, a processor, and a bus system;

[0037] Wherein, the memory is used to store programs;

[0038] The processor is used to execute the program in the memory, and the processor is used to perform the above-mentioned methods according to the instructions in the program code;

[0039] The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

[0040] Another aspect of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium. When the computer-readable storage medium is run on a computer, the computer is enabled to execute the above-mentioned methods.

[0041] Another aspect of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the above aspects.

[0042] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: historical search terms are stored using keyword indexes and tree structures, so that each term is only stored once in a tree structure. That is, repeated search terms are not stored repeatedly, thereby reducing memory usage. At the same time, each search term is stored, and its retrieval time and search heat are represented by timestamps and heat values. This can effectively achieve the recommendation of search terms according to time or heat. At the same time, the tree structure does not store terms repeatedly, so the tree structure will not increase significantly, and the number of searches will not increase during the search recommendation process, thereby maintaining the recommendation performance of the search term conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Figure 1 This is an architectural diagram of a tree structure;

[0044] Figure 2 This is a schematic diagram of an application scenario of a search term recommendation solution in an embodiment of the present application;

[0045] Figure 3 A flowchart of a method for storing search terms in an embodiment of the present application is shown;

[0046] Figure 4a This is a schematic diagram of the tree structure in the embodiment of the present application;

[0047] Figure 4b This is another schematic diagram of the tree structure in the embodiment of the present application;

[0048] Figure 5 A schematic diagram of an embodiment of a method for recommending search terms in an embodiment of the present application;

[0049] Figure 6 A schematic diagram showing recommended search terms in an embodiment of the present application;

[0050] Figure 7 A schematic diagram of an embodiment of a device for recommending search terms in an embodiment of the present application;

[0051] Figure 8 This is a schematic diagram of another embodiment of a search term recommendation device in an embodiment of the present application;

[0052] Figure 9 This is a schematic diagram of another embodiment of a search term recommendation device in an embodiment of the present application. DETAILED DESCRIPTION

[0053] Embodiments of the present application provide a search term recommendation method, apparatus, device, and storage medium for reducing memory usage without reducing search term recommendation performance.

[0054] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the numbers used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0055] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0056] Those skilled in the art will understand that, unless otherwise stated, the singular forms "a", "an", "the" and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the present technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the element can be directly connected or coupled to the other element, or it can refer to the element and the other element establishing a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used here can include wireless connection or wireless coupling. The term "and / or" used here indicates at least one of the items defined by the term, for example, "A and / or B" can be implemented as "A", or as "B", or as "A and B".

[0057] With the advancement of computer and search technologies, various websites and forums have begun to incorporate search functionality. Search typically involves deeply mining and integrating specialized information within a website's (or webpage's) database based on a user's search request, and then returning the results to the user in some form. In practical applications, search engines, e-commerce websites, forums, and other platforms that utilize search functionality often encounter scenarios such as statistically recommending the most searched terms or posts by other users over the past hour or day. A common approach utilizes the ordered set (Zset) data structure of the Remote Dictionary Server (Redis). A Zset is a sorted data structure, often considered a sorted set. Zset functions typically take parameters (key, value, score). The key is the index stored in Redis, which retrieves the result data based on the key. The value is the result data to be retrieved. The score indicates a score or popularity value (which evaluates the number of searches for the result data). Combined with its common functions, Zset can store data such as recent search terms, the number of search terms, and the ranking or popularity of the search terms. The Redis solution offers excellent recommendation performance because data is stored and retrieved in memory. However, this also requires a certain amount of memory to store each search term. This consumes a significant amount of memory for websites (or pages) with a large number of historical search terms. Furthermore, when Redis stores a large amount of data, its retrieval performance degrades, impacting search term recommendation performance. Therefore, a method is urgently needed to reduce memory usage while maintaining search term recommendation performance.

[0058] In order to solve the above problem, the present application provides the following technical solution: obtain a search request; filter a target keyword index set from a first word set according to the search request, the first word set is used to store the starting search keyword of the historical search term as a keyword index, the keyword index also stores the timestamp and heat value of the starting keyword, the timestamp is used to indicate the search time of the keyword index, and the heat value is used to indicate the number of historical searches of the keyword; determine a target tree structure set according to the target keyword index set, each tree structure in the target tree structure set is used to store the historical search term, a subtree composed of a root node and child nodes of the tree structure corresponds to a historical search term, the root node of the tree structure is used to store the starting search keyword, each child node of the tree structure stores a search keyword, each node of the tree structure also stores the timestamp and heat value of each search keyword, the tree structure and the first word set are used to associate and store the historical search term; filter a recommended search term from the target tree structure set according to the search request; and display the recommended search term. In this way, the keyword index and the tree structure are used to store the historical search terms, so that each term is only stored once in a tree structure. That is, repeated search terms are not stored repeatedly, thus reducing memory usage. At the same time, each search term is stored, and its retrieval time and search popularity are represented by a timestamp and popularity value. This can effectively recommend search terms based on time or popularity. At the same time, the tree structure does not store terms repeatedly, so the tree structure does not increase significantly. The number of searches during the search recommendation process does not increase, thus maintaining the recommendation performance of the search term conditions.

[0059] The search term recommendation method provided in the embodiment of the present application can be applied to artificial intelligence (AI) technology. For example, the latest information can be recommended to users based on the recommended search terms. AI is a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. With the research and progress of artificial intelligence technology, artificial intelligence technology has been widely studied and applied in many fields. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0060] Natural Language Processing (NLP) is an interdisciplinary field in computer science, artificial intelligence, and linguistics. It mainly focuses on enabling computers to understand, process, generate, and simulate human language capabilities, thus achieving the ability to conduct natural conversations with humans. Through natural language processing technologies, various applications such as machine translation, question - answering systems, sentiment analysis, and text summarization can be realized. With the development of deep learning technologies, artificial neural networks and other machine - learning methods have made important progress in the field of natural language processing. Future development directions include deeper semantic understanding, better dialogue systems, more extensive cross - language processing, and more powerful transfer - learning technologies.

[0061] For ease of understanding, some terms in this application are explained below:

[0062] Search keyword / keyword: That is, a single foreign word or Chinese character in a search term. For example, when the search term is "The purchase process of a fan", its search keywords are as follows: "风", "扇", "的", "购", "买", "流", "程". That is, each Chinese character is a search keyword. When the search term is "The growth habits of apple trees", its search keywords are as follows: "The", "growth", "habits", "of", "apple", "trees". It should be understood that this foreign language refers to other languages except Chinese.

[0063] Keyword index: In this application, it is the index used to indicate the storage generation of the first search keyword of a search term. Its main function is to be associated with the root node of the tree structure. That is, through this keyword index, the corresponding tree structure can be found. For example, the "风" in the search term "The purchase process of a fan" is stored in a certain storage manner. Among them, this storage manner includes but is not limited to hashmap data structures, linked lists, and arrays.

[0064] Tree structure: A tree is a finite set of n (n>=0) nodes. When n=0, it is called an empty tree. In any non-empty tree, it should satisfy: there is only one specific node called the root (referred to as the root node in this application). When n>1, the remaining nodes can be divided into m (m>0) mutually non-intersecting finite sets T1, T2,…, Tm, where each set itself is a tree and is called a subtree of the root. Obviously, the definition of a tree is recursive, that is, the definition of a tree uses itself again, and the tree is a recursive data structure. As a logical structure, a tree is also a hierarchical structure (that is, subnodes at the same height are referred to as subnodes of the same level in this application), with the following two characteristics: the root node of the tree has no predecessor, and all nodes except the root node have one and only one predecessor. All nodes in the tree can have zero or more successors (also referred to as subnodes in this application). Therefore, there are n-1 edges in a tree of n nodes. For example Figure 1 The tree structure shown in the figure is a tree structure where "A" is called the root node and "B" to "M" are called child nodes. The set consisting of "A", "C" and "G" is called a subtree; the set consisting of "A", "B", "E", "F", "K" and "L" is also called a subtree. Figure 1 The tree structure shown includes 4 layers, among which the root node "A" is the first layer; "B", "C" and "D" are child nodes in the same layer, and these three child nodes are in the second layer; "E", "F", "G", "H", "I" and "J" are child nodes in the same layer, and these six child nodes are in the third layer; "K", "L" and "M" are child nodes in the same layer, and these three child nodes are in the fourth layer.

[0065] The embodiments of the present application provide a search term recommendation method, apparatus, device, and storage medium for reducing memory usage while maintaining search term recommendation performance. The following describes exemplary applications of the electronic device provided by the embodiments of the present application. The electronic device provided by the embodiments of the present application can be implemented as various types of user terminals or as a server.

[0066] By running the search term recommendation method provided in the embodiments of the present application, the electronic device can reduce memory usage while maintaining search term recommendation performance. That is, the performance of the electronic device in performing search term recommendation can be maintained while reducing the memory resources occupied by the search terms.

[0067] The above solution can be applied to any scenario where information search is required, including but not limited to search engines or e-commerce websites. When the search term recommendation method provided in the embodiments of the present application is used to help users recommend search terms, the method can be implemented as an independent online application and installed on the computer device or backend server used by the user, so that the user can use the program to recommend search terms.

[0068] In this scenario, the user generates a trigger operation through the application interface to trigger the function of recommending search terms; then the terminal device determines the search request based on the trigger operation; and according to the search request, filters the target keyword index from the stored first word set; and determines the target tree structure based on the target keyword index; finally, determines the recommended search term from the target tree structure according to the search request, and displays the recommended search term in the application interface.

[0069] See also Figure 2 , Figure 2This is an optional architecture diagram of an application scenario of the search term recommendation scheme provided in an embodiment of the present application. In order to implement a recommendation scheme supporting a search term, the terminal device 100 is connected to the server 300 through the network 200, and the server 300 is connected to the database 400. The network 200 can be a wide area network or a local area network, or a combination of the two. The client for implementing the search term recommendation scheme is deployed on the terminal device 100, wherein the client can be run on the terminal device 100 in the form of a browser, or can be run on the terminal device 100 in the form of an independent application (application, APP), etc. The specific presentation form of the client is not limited here. The server 300 involved in the present application can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal device 100 can be a smartphone, tablet computer, laptop computer, PDA, personal computer, smart TV, smart watch, in-vehicle device, wearable device, intelligent voice interaction device, smart home appliance, aircraft, etc., but is not limited to these. The terminal device 100 and server 300 can be directly or indirectly connected via the network 200 via wired or wireless communication, and this application does not impose any restrictions on this. The number of servers 300 and terminal devices 100 is also not limited. The solution provided in this application can be implemented independently by the terminal device 100, independently by the server 300, or in cooperation with the terminal device 100 and server 300, and this application does not impose any specific restrictions on this. Among them, the database 400 can be simply regarded as an electronic filing cabinet - a place to store electronic files, where users can add, query, update, delete, and other operations on the data in the files. The so-called "database" is a collection of data stored together in a certain manner, which can be shared by multiple users, has minimal redundancy, and is independent of each application. A database management system (DBMS) is a computer software system designed for managing databases. It generally has basic functions such as storage, retrieval, security, and backup.Database management systems can be classified according to the database models they support, such as relational and Extensible Markup Language (XML); or according to the types of computers they support, such as server clusters and mobile phones; or according to the query languages used, such as Structured Query Language (SQL) and XQuery; or according to performance impulse focus, such as maximum scale and maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages at the same time. In the present application, the database 400 can be used to store historical search terms. Of course, the storage location for historical search terms is not limited to the database. For example, it can also be stored in the terminal device 100, the blockchain, or the distributed file system of the server 300.

[0070] In some embodiments, both the server 300 and the terminal device 100 can execute the search term recommendation method provided in the embodiments of the present application.

[0071] It is understandable that in the specific implementation of this application, related data such as historical search terms are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0072] Combined with the above introduction, the following is an introduction to the storage method of historical search terms in this application with the server as the execution body. For details, please refer to Figure 3 ,include:

[0073] 301. Get historical search terms.

[0074] In this embodiment, the server can set corresponding search term libraries for different platforms or set the same search term library for different platforms, which is not limited here. The server can obtain search terms entered by users on various websites, web pages, or mobile terminal applications as the historical search terms.

[0075] 302. Perform word segmentation processing on the historical search term to obtain M search keywords, where M is a positive integer.

[0076] In this embodiment, the server uses a pre-trained word segmentation model or a pre-set word segmentation rule to segment the historical search terms into single Chinese characters or single foreign words to obtain M search keywords. In this way, the historical search terms can be stored in units of keywords, which is convenient for users to search.

[0077] For example, when the search term is "Purchase process of a fan", its search keywords are as follows: "wind", "fan", "of", "purchase", "buy", "process", "flow". That is, each Chinese character is a search keyword.

[0078] In this embodiment, the trained word segmentation model can be a neural network model based on computer vision technology (Computer Vision, CV) or a neural network model based on natural language processing algorithms.

[0079] In an exemplary solution, the above-mentioned trained word segmentation model can be a pre-training model (Pre-training model), also known as a foundation model or a large model, which refers to a deep neural network (Deep neural network, DNN) with a large number of parameters. It is trained on a large amount of unlabeled data, and the function approximation ability of the large-parameter DNN is used to enable the PTM to extract common features from the data. Through techniques such as fine-tuning (fine tune), parameter-efficient fine-tuning (PEFT), and prompt-tuning, it is applicable to downstream tasks. Therefore, the pre-training model can achieve ideal results in few-shot or zero-shot scenarios. PTM can be divided into language models (ELMO, BERT, GPT), vision models (swin-transformer, ViT, V-MOE), speech models (VALL-E), multi-modal models (ViBERT, CLIP, Flamingo, Gato), etc. according to the data modalities processed. Among them, the multi-modal model refers to a model that establishes feature representations of two or more data modalities. The pre-training model is an important tool for outputting artificial intelligence-generated content (AIGC) and can also be used as a general interface connecting multiple specific task models.

[0080] 303. Traverse the first word set and determine whether there is a first search keyword in the first word set, where the word ranking of the first search keyword in the multiple search keywords is the first; if not, execute steps 304 to 307; if so, execute steps 308 to 314.

[0081] The server reads the first search keyword of the M search keywords in the word sorting in the historical search term, wherein the first search keyword is located at the first position in the word sorting; then a traversal search is performed in the first word set to determine whether the first search keyword exists in the first word set; if so, it means that the search term starting with the first search keyword has been stored, and then the tree structure corresponding to the first search keyword can be traversed to see whether the historical search term exists; if not, it means that the search term starting with the first search keyword has not been stored, and it appears for the first time, and then a new storage data structure for the historical search term needs to be created.

[0082] It should be understood that the word order is a normal language sequence. For example, when searching for the term "fan purchasing process," the search keywords should be ordered as follows: first: "wind," second: "fan," third: "of," fourth: "buy," fifth: "buy," sixth: "flow," and seventh: "process."

[0083] 304. Create a first keyword index corresponding to the first search keyword, where the first keyword index includes a timestamp and an initial popularity value of the first search keyword.

[0084] In this embodiment, when the server needs to create a new storage data structure for the historical search terms, it first needs to create a keyword index of the first search keyword in the first word set. The keyword index is used to point to the tree structure of the historical search terms.

[0085] When the server creates the keyword index of the first search keyword, the storage method includes but is not limited to a hashmap data structure, a linked list, and an array.

[0086] 305. Create a root node of the historical search term based on the first keyword index.

[0087] The server creates a root node associated with the first keyword index based on the first keyword index. At this time, the root node is used to store the first search keyword of the historical search term.

[0088] 306. Store the first search keyword in the root node, and create a tree structure of the historical search terms based on the root node and sort by the word. The number of child nodes in the tree structure is M-1.

[0089] The server stores the first search keyword in the root node and initializes the timestamp and heat value of the root node; at the same time, it creates a tree structure of the historical search term based on the root node. The timestamp is used to indicate the generation time of the historical search term (which can also be understood as the time when the historical search term is used to search for information). For example, at 20:00 on January 14, 2024, the search term "the purchase process of fans" was searched once, then the timestamp is used to represent "20:00 on January 14, 2024". The heat value is used to indicate the number of historical searches for the historical search term. For example, at 20:00 on January 14, 2024, the search term "the purchase process of fans" was searched for the first time, then the heat value can be recorded as 1.

[0090] 307. Store the multiple search keywords in sequence in each child node of the tree structure, wherein each child node includes a timestamp and a popularity value of the search keyword of the historical search term.

[0091] The server stores the remaining search keywords of the historical search term in order of the word order, wherein the order of the search keywords corresponds to the child nodes of the tree structure in a one-to-one relationship. For example, the tree structure corresponding to the search term "fan purchase process" should include seven layers, wherein the first layer where the root node is located is used to store "wind", the second layer's child nodes are used to store "fan", the third layer's child nodes are used to store "of", the fourth layer's child nodes are used to store "buy", the fifth layer's child nodes are used to store "buy", the sixth layer's child nodes are used to store "flow", and the seventh layer's child nodes are used to store "process".

[0092] It should be understood that when storing the remaining search keywords, their corresponding timestamps and heat values also need to be initialized. In an exemplary scenario, the search term "fan purchase process" was first searched at "January 14, 2024 20:00", and the corresponding tree structure can be as follows Figure 4a As shown, the timestamp of the keyword index corresponding to "wind" is "January 14, 2024 20:00", and the heat value is 1; similarly, the timestamp of the keyword index corresponding to "fan", "of", "buy", "buy", "flow" and "process" is also "January 14, 2024 20:00", and the heat value is also 1.

[0093] 308. Obtain the root node where the first search keyword is located, and update the root node corresponding to the first search keyword and the timestamp and heat value of the keyword index.

[0094] When the server confirms the existence of the keyword index of the first search keyword from the first word set, the tree structure of the first search keyword and the root node of the tree structure are determined according to the keyword index of the first search keyword, and then the root node corresponding to the first search keyword and the timestamp of the keyword index are updated according to the current timestamp, and the heat value of the root node corresponding to the first search keyword and the keyword index are updated at the same time. For example, the search term "Fan purchase process" was first searched at "January 14, 2024 20:00", of which the timestamp of the keyword index corresponding to "wind" is "January 14, 2024 20:00" and the heat value is 1; similarly, the timestamp of the keyword index corresponding to "fan", "of", "purchase", "buy", "flow" and "process" is also "January 14, 2024 20:00", and the heat value is also 1. Then, the search term "fan purchase process" is searched for the second time at "January 14, 2024 21:00", among which the timestamp of the keyword index corresponding to "wind" is updated to "January 14, 2024 21:00", and the heat value is 2; similarly, the timestamp of the keyword index corresponding to "fan", "of", "purchase", "buy", "flow" and "process" is also updated to "January 14, 2024 21:00", and the heat value is also updated to 2.

[0095] 309. Read the i-th search keyword of the historical search term in word order and determine whether the value of i is greater than M; if it is less than or equal to M, execute steps 310 to 313; if it is greater than M, execute step 314.

[0096] After updating the timestamp and popularity value of the first search keyword, the server completes the storage of the first search keyword. It then reads the i-th search keyword of the historical search term in word order. Steps 309 to 313 form a loop, where the value of i ranges from 2 to M. It then determines whether the value of i is greater than M. If not, it indicates that the historical search term has not been fully stored, and the loop continues. If it is greater than M, it indicates that the historical search term has been fully stored, and the storage operation ends.

[0097] 310. Traverse the i-th layer node corresponding to the i-th search keyword and determine whether the i-th search keyword exists in the i-th layer node; if so, execute step 311; if not, execute steps 312 to 313.

[0098] The server traverses the node layer corresponding to the i-th search keyword. If the i-th search keyword exists, it means that the i-th search keyword has been stored, and the timestamp and heat value of the i-th search keyword can be updated in the node corresponding to the i-th search keyword; if the i-th search keyword does not exist, it means that the i-th search keyword has not been stored and it appears for the first time, so a new storage data structure for the i-th search keyword needs to be created.

[0099] 311. Update the timestamp and heat value of the first child node in the i-th layer node, where the first child node is used to store the i-th search keyword, the timestamp and heat value of the i-th search keyword.

[0100] When the server confirms the existence of the i-th search keyword from the i-th layer node, it traverses and searches to determine the node storing the i-th search keyword, and then updates the timestamp and heat value of the node storing the i-th search keyword according to its current timestamp. For example, the search term "fan purchase process" was first searched at "January 14, 2024 20:00", where the timestamp of the keyword index corresponding to "wind" is "January 14, 2024 20:00" and the heat value is 1; similarly, the timestamp of the keyword index corresponding to "fan", "of", "purchase", "buy", "flow" and "process" is also "January 14, 2024 20:00", and the heat value is also 1. Then, the search term "fan purchase process" is searched for the second time at "January 14, 2024 21:00", among which the timestamp of the keyword index corresponding to "wind" is updated to "January 14, 2024 21:00", and the heat value is 2; similarly, the timestamp of the keyword index corresponding to "fan", "of", "purchase", "buy", "flow" and "process" is also updated to "January 14, 2024 21:00", and the heat value is also updated to 2.

[0101] 312. Create a second child node in the i-th layer node, and store the i-th search keyword, the timestamp and the heat value of the i-th search keyword in the second child node, and the second child node is included in the i-th layer node.

[0102] When the server determines that the i-th search keyword does not exist in the i-th layer node, it needs to create a second child node for the i-th search keyword, store the i-th search keyword, and initialize the timestamp and heat value of the second child node.

[0103] In an exemplary embodiment, Figure 4b As shown in the figure, assuming the search term is "the purchase process of fans on platform A" at "January 14, 2024 20:30", the search term will be stored in Figure 4aIn the shown tree structure, then the search keyword "in" Figure 4a does not exist in the shown tree structure. Then, a new node is created for the search keyword "in" in the third-level nodes, and the search keyword "in" is stored. At the same time, the timestamp of the search keyword "in" is initialized to "January 14, 2024, 20:30", and the popularity value is 1. The timestamps of "wind" and "fan" will be updated to "January 14, 2024, 20:30", and the popularity values will be updated to 2.

[0104] 313. Create a target subtree based on the second child node sorted by the word, and in the target subtree, sequentially store the remaining search keywords after the i-th search keyword, the timestamps and popularity values of the remaining search keywords.

[0105] After creating the second child node, the server will create a subtree of the historical search term in the tree structure based on the second child node sorted by the word, and store the remaining search keywords in the subtree.

[0106] In an exemplary solution, as Figure 4b shown, assuming the search term is "Purchase process of the fan on platform A" at "January 14, 2024, 20:30", then this search term will be stored in Figure 4a the shown tree structure. Then the search keyword "in" Figure 4a does not exist in the shown tree structure. Then, a new node is created for the search keyword "in" in the third-level nodes, and the search keyword "in" is stored. At the same time, the timestamp of the search keyword "in" is initialized to "January 14, 2024, 20:30", and the popularity value is 1. The timestamps of "wind" and "fan" will be updated to "January 14, 2024, 20:30", and the popularity values will be updated to 2. At the same time, "A", "platform", "of", "purchase", "flow", and "process" will be stored in the remaining nodes of the subtree, and their corresponding timestamps are "January 14, 2024, 20:30", and the popularity values are 1.

[0107] 314. End the storage of the historical search term.

[0108] When i is greater than M, it is determined that the storage of the historical search term is completed. At this time, end the storage operation of the historical search term.

[0109] Based on the above description of the storage process of the historical search term, taking the server as the execution entity, the search term recommendation method in this application will be described below. For details, please refer to Figure 5 shown. An embodiment of the search term recommendation method in this application includes:

[0110] 501. Obtain a search request.

[0111] In this embodiment, the server may obtain the search request through a user triggering an input field in the application program, wherein the search request is used to indicate different recommendation conditions for the search terms.

[0112] In an exemplary scenario, if the user only activates the input bar of the application (for example, clicks on the input bar so that a cursor indicator control for input appears in the input bar), the search request may default to "recommending the top N search terms ranked from high to low in popularity value within the first time period, where N is a positive integer."

[0113] In another exemplary embodiment, if the user enters a search keyword in the application's input field, the search request may default to "recommending the top N search terms with the first keyword as the keyword index within the first time period." Optionally, the first keyword may be understood as a single keyword or multiple keywords.

[0114] It should be understood that the above two solutions are merely exemplary solutions, and the specific form of the search request can be set according to actual conditions and is not limited here.

[0115] 502. Filter a target keyword index set from the first word set according to the search request. The first word set is used to store the starting search keyword of the historical search term as a keyword index. The keyword index also stores the timestamp and heat value of the starting keyword. The timestamp is used to indicate the search time of the keyword index, and the heat value is used to indicate the number of historical searches for the keyword.

[0116] In this embodiment, the server may filter and obtain the recommended search terms according to different recommendation processes based on different situations of the search request. The following describes a specific application scenario:

[0117] In an exemplary solution, if the search request is to recommend the top N search terms ranked from high to low in popularity within a first time period, N is a positive integer. This means that only N search terms with higher popularity values within a preset time period need to be recommended. At this time, the server can first read the timestamps of each keyword index in the first word set, and then compare the timestamps with the first time period to filter out keyword indexes that meet the conditions and generate the target keyword index. Specifically, the timestamps of each keyword index in the first word set are traversed, and the keyword indexes whose timestamps meet the first time period are assigned to the target keyword index set.

[0118] In another exemplary embodiment, if the search request is to recommend the top N popularity values within the first time period, and the keyword index is the search term of the first keyword. This means that specific keyword conditions need to exist while satisfying the preset time period and popularity value. At this time, a unique keyword index can be screened out based on the keyword. Specifically, the first keyword is matched with each keyword index in the first word set to obtain a matching result; when the matching result indicates that the first keyword exists in the first word set, the first keyword index corresponding to the first keyword is determined to be the target keyword index set.

[0119] It should be understood that when there are multiple first keywords, only the first one in the input order needs to be used for keyword index screening. For example, if the first keyword is "fan", keyword index screening can be performed only based on "wind".

[0120] 503. Determine a target tree structure set based on the target keyword index set, wherein each tree structure in the target tree structure set is used to store the historical search terms, and a subtree composed of the root node and child nodes of the tree structure corresponds to a historical search term. The root node in the tree structure is used to store the starting search keyword, and each child node of the tree structure stores a search keyword. Each node of the tree structure also stores the timestamp and heat value of each search keyword. The tree structure and the first word set are used to associate and store the historical search terms.

[0121] After the server determines the target keyword index, it can also filter the target tree structure according to the search request.

[0122] The following describes the specific application scenarios:

[0123] In an exemplary embodiment, if the search request is to recommend the top N search terms ranked from high to low in popularity within a first time period, N is a positive integer. This means that only the N search terms with higher popularity values within a preset time period need to be recommended. At this time, the server can first read the timestamps of each keyword index in the first word set, and then compare the timestamps with the first time period to filter out the keyword indexes that meet the conditions to generate the target keyword index; if the number of the target keyword sub-indexes is greater than N, the top N keyword indexes can be taken in descending order of popularity value, and then the tree structure corresponding to the N keyword indexes can be used as the target tree structure set.

[0124] In another exemplary scenario, if the search request is to recommend the top N popularity values within a first time period, and the keyword index is a search term for the first keyword, this means that specific keyword conditions must exist while meeting the preset time period and popularity value. In this case, a unique keyword index can be filtered out based on the keyword, and the tree structure corresponding to the unique keyword index is simply used as the target tree structure set.

[0125] 504. According to the search request, recommended search terms are obtained by screening the target tree structure set.

[0126] In this embodiment, after the target tree structure is determined, the recommended search term may be determined from the target tree structure according to the search request.

[0127] The following describes the specific application scenarios:

[0128] In an exemplary embodiment, if the search request is to recommend the top N search terms ranked by popularity in a first time period, N is a positive integer. This means that only the N search terms with higher popularity in a preset time period need to be recommended. At this time, the server determines the target tree structure set; then traverses the timestamps of each node in the target tree structure set, deletes the nodes whose timestamps do not meet the first time period, to obtain a target node set; generates search terms to be recommended based on the target node set; traverses the popularity values of the search terms to be recommended, and selects the top N search terms to be recommended ranked by popularity in a descending order as the recommended search terms.

[0129] In this process, the search terms corresponding to some subtrees that do not meet the time conditions can be filtered out, and what will eventually remain will be the search terms to be recommended corresponding to the subtrees that meet the time conditions. If the number of the search terms to be recommended is greater than N, they can be filtered again according to the heat value to obtain the recommended search terms. The specific method can be as follows: traverse the target node set in the order from the root node to the last layer of child nodes, and use the search terms corresponding to the complete subtree obtained by traversal as the search terms to be recommended: traverse the heat value of the termination keyword of the search terms to be recommended, and rank the top N search terms to be recommended from the heat value of the termination keyword of the search terms to be recommended from high to low as the recommended search terms.

[0130] In another exemplary scenario, if the search request is to recommend the top N search terms ranked by popularity within a first time period, and the keyword index is the search term for the first keyword, this means that specific keyword conditions must exist while meeting the preset time period and popularity value. In this case, after the server determines the unique target tree structure, it can process the results based on the timestamp, as follows:

[0131] When the timestamp of the root node of the first tree structure meets the first time period, the timestamps of the child nodes of the first tree structure are traversed, and the child nodes whose timestamps do not meet the first time period are deleted to obtain a target child node set; the search terms to be recommended are generated based on the root node and the target child node set; the heat values of the search terms to be recommended are traversed, and the top N search terms to be recommended that are ranked from high to low in heat value are used as the recommended search terms.

[0132] When the timestamp of the root node of the first tree structure does not meet the first time period, the recommended search term is determined to be empty; or, the heat values of each subtree of the first tree structure are traversed, and the top N search terms ranked from high to low in heat value are used as the recommended search terms.

[0133] 505. Display the recommended search term.

[0134] After the recommended search term is determined, the recommended search term may be displayed on a display interface of the application.

[0135] An exemplary scheme, such as Figure 6 As shown, the recommended search term is displayed in the drop-down interface of the input bar.

[0136] The following is a detailed description of the search term recommendation device in this application. Figure 7 , Figure 7 This is a schematic diagram of an embodiment of a search term recommendation device in an embodiment of the present application. The search term recommendation device 20 includes:

[0137] Acquisition module 201, used to obtain a search request;

[0138] Processing module 202 is used to filter a target keyword index set from a first word set according to the search request, the first word set is used to store the starting search keyword of the historical search term as a keyword index, the keyword index also stores the timestamp and heat value of the starting keyword, the timestamp is used to indicate the search time of the keyword index, and the heat value is used to indicate the number of historical searches of the keyword; determine a target tree structure set according to the target keyword index set, each tree structure in the target tree structure set is used to store the historical search term, a subtree composed of a root node and child nodes of the tree structure corresponds to a historical search term, the root node in the tree structure is used to store the starting search keyword, each child node of the tree structure stores a search keyword, each node of the tree structure also stores the timestamp and heat value of each search keyword, the tree structure and the first word set are used to associate and store the historical search term; filter the target tree structure set to obtain recommended search terms according to the search request;

[0139] The display module 203 is used to display the recommended search terms.

[0140] In an embodiment of the present application, a device for recommending search terms is provided. Using the above device, historical search terms are stored using a keyword index and a tree structure, so that each term is stored only once within a tree structure. That is, repeated search terms are not stored repeatedly, thereby reducing memory usage. At the same time, each search term is stored, and its retrieval time and search popularity are represented using a timestamp and popularity value. This effectively recommends search terms based on time or popularity, thereby maintaining the recommendation performance of the search term condition.

[0141] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0142] The search request recommends the top N search terms ranked from high to low in popularity value within a first time period, where N is a positive integer; the processing module 202 is used to traverse the timestamps of each keyword index in the first word set, and assign the keyword index whose timestamp meets the first time period to the target keyword index set.

[0143] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, when only the top N search terms ranked by popularity within a preset time period need to be recommended, since the keyword indexes of the first word set have the latest timestamps, each keyword index can be filtered according to the timestamps, thereby enabling quick and convenient filtering of recommended search terms.

[0144] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided by the embodiment of the present application, the processing module 202 is used to obtain a heat value set of each keyword index in the target keyword index set;

[0145] Sort the heat values in the heat value set from high to low;

[0146] The tree structures corresponding to the top N keyword indexes are assigned to the target tree structure set.

[0147] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, when only the top N search terms ranked by popularity within a preset time period need to be recommended, since the keyword indexes of the first word set have accumulated keyword popularity values, the popularity values of the keyword indexes that match the time period can be screened. This facilitates statistical analysis of the popularity values, thereby screening out tree structures that are highly likely to match the search popularity, and thus obtaining recommended search terms.

[0148] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application, the processing module 202 is configured to traverse the timestamps of each node in the target tree structure set and delete the nodes whose timestamps do not meet the first time period to obtain the target node set;

[0149] Generate a search term to be recommended according to the target node set;

[0150] Traverse the popularity values of the search terms to be recommended, and take the top N search terms to be recommended ranked from high to low popularity values as the recommended search terms.

[0151] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, since each node in a tree structure stores the most recent search time and total popularity value of a search keyword, the stored search terms in the tree structure can be searched based on the timestamp and popularity value, thereby quickly and efficiently obtaining recommended search terms.

[0152] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0153] The processing module 202 is configured to traverse the target node set in the order from the root node to the last-layer child node, and use the search term corresponding to the complete subtree obtained through the traversal as the search term to be recommended.

[0154] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, nodes that have been re-filtered based on timestamps are traversed to obtain complete search terms, thereby obtaining complete recommended search terms, allowing users to effectively access their search history and improve user experience.

[0155] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0156] The processing module 202 is used to traverse the popularity values of the terminating keyword of the search term to be recommended, and rank the top N search terms to be recommended by the popularity values of the terminating keyword of the search term to be recommended from high to low as the recommended search term.

[0157] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, search terms are sorted according to their popularity, thereby selecting the top-ranked recommended search terms as the recommended search terms, which can help users understand the current search popularity and thus improve the user experience.

[0158] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided by the embodiment of the present application, the search request is to recommend the search terms ranked in the top N by popularity value within a first time period, and the keyword index is a first keyword; the processing module 202 is configured to match the first keyword with each keyword index in the first word set to obtain a matching result;

[0159] When the matching result indicates that the first keyword exists in the first word set, a first keyword index corresponding to the first keyword is determined to be the target keyword index set.

[0160] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, when it is necessary to recommend the top N search terms that contain keywords and rank in popularity within a preset time period, a target keyword index is determined from a word set based on the keywords. This allows for rapid determination of a single tree structure, thereby reducing subsequent filtering and calculation processes and enabling quick and convenient filtering of recommended search terms.

[0161] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided by the embodiment of the present application, the processing module 202 is configured to use the first tree structure corresponding to the first keyword index as the target tree structure set.

[0162] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, a target keyword index is determined from a word set based on a keyword, so that only one tree structure can be determined as soon as possible, thereby reducing the subsequent screening and calculation process, and further allowing for quick and convenient screening of recommended search terms.

[0163] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided by the embodiment of the present application, the processing module 202 is configured to, when the timestamp of the root node of the first tree structure meets the first time period, traverse the timestamps of each child node of the first tree structure, and delete the child nodes whose timestamps do not meet the first time period, to obtain a target child node set;

[0164] Generate a search term to be recommended based on the root node and the target child node set;

[0165] Traverse the popularity values of the search terms to be recommended, and take the top N search terms to be recommended ranked from high to low popularity values as the recommended search terms.

[0166] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, when a tree structure meets a preset time period, the search terms in the tree structure are filtered according to the timestamp, so that the filtered recommended search terms are more consistent with the search request, thereby improving the user experience.

[0167] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0168] The processing module 202 is configured to determine that the recommended search term is empty when the timestamp of the root node of the first tree structure does not satisfy the first time period;

[0169] or,

[0170] When the timestamp of the root node of the first tree structure does not meet the first time period, the heat values of each subtree of the first tree structure are traversed, and the top N search terms ranked from high to low in heat value are used as the recommended search terms.

[0171] In an embodiment of the present application, a device for recommending search terms is provided. Using this device, when the timestamp of the root node of a tree structure does not meet a preset time period, i.e., when a search request cannot be satisfied, no search term recommendation is made. Alternatively, the time limit can be removed, and only search terms meeting the popularity value under the target keyword can be recommended. This allows the present solution to have more application scenarios and increases its practicality.

[0172] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0173] The acquisition module 201 is used to acquire the historical search terms;

[0174] The processing module 202 is used to perform word segmentation processing on the historical search term to obtain M search keywords, where M is a positive integer; traverse the first word set, and when the first search keyword does not exist in the first word set, create a first keyword index corresponding to the first search keyword, and the first search keyword is ranked first among the multiple search keywords, and the first keyword index includes the timestamp and initial heat value of the first search keyword; create a root node of the historical search term based on the first keyword index; store the first search keyword in the root node, and create a tree structure of the historical search term based on the root node according to the word ranking, and the number of child nodes of the tree structure is M-1; store the multiple search keywords in each child node of the tree structure in sequence, wherein each child node stores the timestamp and heat value of the search keyword of the historical search term.

[0175] In an embodiment of the present application, a device for recommending search terms is provided. Using the above device, historical search terms are stored using a keyword index and a tree structure, so that each term is stored only once within a tree structure. That is, repeated search terms are not stored repeatedly, thereby reducing memory usage. At the same time, each search term is stored, and its retrieval time and search popularity are represented using a timestamp and popularity value. This effectively recommends search terms based on time or popularity, thereby maintaining the recommendation performance of the search term condition.

[0176] Optionally, in the above Figure 7 On the basis of the corresponding embodiment, in another embodiment of the search term recommendation device 20 provided in the embodiment of the present application,

[0177] The processing module 202 is configured to obtain a root node where the first search keyword is located when the first search keyword exists in the first word set, and update a timestamp and a heat value of the root node corresponding to the first search keyword;

[0178] Read the i-th search keyword of the historical search term in the order of the words, where i is an integer ranging from 2 to M;

[0179] When the i-th search keyword is less than M, traverse the i-th layer node. When the second search keyword exists in the i-th layer node, update the timestamp and heat value of the first child node in the i-th layer node. The first child node is the node storing the i-th search keyword.

[0180] When the i-th search keyword does not exist in the i-th layer node, create a second child node, and store the i-th search keyword, the timestamp and the heat value of the i-th search keyword in the second child node, and the second child node is included in the i-th layer node;

[0181] A target subtree is created based on the second child node according to the word sorting, and the remaining search keywords after the i-th search keyword, the timestamps and heat values of the remaining search keywords are stored in the target subtree in sequence.

[0182] When the i-th search keyword is greater than M, the storage of the historical search term is terminated.

[0183] In an embodiment of the present application, a device for recommending search terms is provided. Using the device, existing keywords are no longer stored, but their timestamps and popularity values are updated. This saves storage memory occupied by search terms and effectively recommends search terms based on time or popularity, without reducing the recommendation performance of the search term conditions.

[0184] The search term recommendation device provided by this application can be used in the server, please refer to Figure 8 , Figure 8 This is a schematic diagram of a server structure provided in an embodiment of the present application. The server 300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) for storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or persistent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processing unit 322 can be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the server 300.

[0185] The server 300 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Windows Server 2003 or Windows Server 2003R. TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM etc.

[0186] The steps performed by the server in the above embodiment can be based on the Figure 8 The server structure shown.

[0187] The search term recommendation device provided by this application can be used in terminal devices, please refer to Figure 9 For the sake of convenience, only the parts related to the embodiment of this application are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of this application. In the embodiment of this application, the terminal device is a smartphone as an example for explanation:

[0188] Figure 9 The block diagram shows a partial structure of a smart phone related to the terminal device provided in the embodiment of the present application. Figure 9 The smartphone includes components such as a radio frequency (RF) circuit 410, a memory 420, an input unit 430, a display unit 440, a sensor 450, an audio circuit 460, a wireless fidelity (WiFi) module 470, a processor 480, and a power supply 490. Those skilled in the art will appreciate that Figure 9 The structure of the smartphone shown in the figure does not constitute a limitation on the smartphone, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0189] The following combination Figure 9 A detailed introduction to the various components of a smartphone:

[0190] The RF circuit 410 can be used to receive and send signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor 480 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit 410 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 410 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to the global system of mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), long term evolution (LTE), email, short messaging service (SMS), etc.

[0191] The memory 420 can be used to store software programs and modules. The processor 480 executes the various functional applications and data processing of the smartphone by running the software programs and modules stored in the memory 420. The memory 420 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function (such as a sound playback function, an image playback function, etc.); the data storage area may store data created based on the use of the smartphone (such as audio data, a phone book, etc.). In addition, the memory 420 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0192] The input unit 430 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the smartphone. Specifically, the input unit 430 may include a touch panel 431 and other input devices 432. The touch panel 431, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using any suitable object or accessory such as a finger, stylus, etc. on or near the touch panel 431) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 431 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 480, and can receive commands sent by the processor 480 and execute them. In addition, the touch panel 431 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 431, the input unit 430 may further include other input devices 432. Specifically, the other input devices 432 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, and a joystick.

[0193] The display unit 440 can be used to display information input by the user or information provided to the user and various menus of the smartphone. The display unit 440 may include a display panel 441. Optionally, the display panel 441 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch panel 431 may cover the display panel 441. When the touch panel 431 detects a touch operation on or near it, it is transmitted to the processor 480 to determine the type of touch event. Subsequently, the processor 480 provides a corresponding visual output on the display panel 441 according to the type of touch event. Although in Figure 9 In the embodiment, the touch panel 431 and the display panel 441 are used as two independent components to realize the input and output functions of the smartphone, but in some embodiments, the touch panel 431 and the display panel 441 can be integrated to realize the input and output functions of the smartphone.

[0194] The smartphone may also include at least one sensor 450, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 441 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 441 and / or the backlight when the smartphone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the smartphone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can be configured in the smartphone, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.

[0195] Audio circuit 460, speaker 461, and microphone 462 provide an audio interface between the user and the smartphone. Audio circuit 460 converts received audio data into electrical signals and transmits them to speaker 461, where they are converted into sound signals for output. Microphone 462, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 460 and converted into audio data. The audio data is then output to processor 480 for processing, then sent to, for example, another smartphone via RF circuit 410, or stored in memory 420 for further processing.

[0196] WiFi is a short-range wireless transmission technology. Smartphones can help users send and receive emails, browse the web, and access streaming media through the WiFi module 470. It provides users with wireless broadband Internet access. Figure 9 A WiFi module 470 is shown, but it is understandable that it is not an essential component of the smartphone and can be omitted as needed without changing the essence of the invention.

[0197] Processor 480 is the control center of the smartphone, connecting all components of the smartphone using various interfaces and circuits. By running or executing software programs and / or modules stored in memory 420 and accessing data stored in memory 420, it executes various smartphone functions and processes data, thereby providing overall smartphone monitoring. Optionally, processor 480 may include one or more processing units; alternatively, processor 480 may integrate an application processor and a modem processor, with the application processor primarily handling the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 480.

[0198] The smartphone also includes a power supply 490 (such as a battery) for supplying power to various components. Optionally, the power supply can be logically connected to the processor 480 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0199] Although not shown, the smartphone may also include a camera, a Bluetooth module, etc., which will not be described in detail here.

[0200] The steps performed by the terminal device in the above embodiment can be based on the Figure 9 The terminal device structure shown.

[0201] A computer-readable storage medium is also provided in an embodiment of the present application. The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.

[0202] An embodiment of the present application also provides a computer program product including a program, which, when executed on a computer, enables the computer to execute the methods described in the aforementioned embodiments.

[0203] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0204] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0205] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0206] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0207] If the integrated unit 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 application 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, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0208] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for recommending search terms, characterized in that: include: Get the search request; Filtering a target keyword index set from a first word set according to the search request, wherein the first word set is used to store a starting search keyword of a historical search term as a keyword index, the keyword index further storing a timestamp and a popularity value of the starting keyword, the timestamp being used to indicate a search time of the keyword index, and the popularity value being used to indicate a number of historical searches of the keyword index; Determine a target tree structure set based on the target keyword index set, each tree structure in the target tree structure set is used to store the historical search terms, a subtree consisting of a root node and child nodes of the tree structure corresponds to a historical search term, the root node in the tree structure is used to store the starting search keyword, each child node of the tree structure stores a search keyword, each node of the tree structure also stores a timestamp and a popularity value of each search keyword, and the tree structure and the first word set are used to store the historical search terms in association; Filtering the target tree structure set to obtain recommended search terms according to the search request; The recommended search terms are displayed.

2. The method according to claim 1, characterized in that The search request is to recommend the top N search terms ranked by popularity in descending order within a first time period, where N is a positive integer; The step of filtering the target keyword index set from the first word set according to the search request includes: The timestamps of the keyword indexes in the first word set are traversed, and the keyword indexes whose timestamps meet the first time period are assigned to the target keyword index set.

3. The method according to claim 2, characterized in that Determining the target tree structure set according to the target keyword index set includes: Obtaining a heat value set of each keyword index in the target keyword index set; Sort the heat values in the heat value set from high to low; The tree structures corresponding to the top N keyword indexes are assigned to the target tree structure set.

4. The method according to claim 2, characterized in that The step of filtering the target tree structure set according to the search request to obtain recommended search terms includes: Traversing the timestamps of each node in the target tree structure set, and deleting the nodes whose timestamps do not meet the first time period, to obtain a target node set; Generate a search term to be recommended according to the target node set; The popularity values of the search terms to be recommended are traversed, and the top N search terms to be recommended that are ranked from high to low in popularity value are used as the recommended search terms.

5. The method according to claim 4, characterized in that Generating the search terms to be recommended according to the target node set includes: The target node set is traversed in the order from the root node to the last-layer child node, and the search terms corresponding to the complete subtree obtained by the traversal are used as the search terms to be recommended.

6. The method according to claim 4, characterized in that The step of traversing the popularity values of the search terms to be recommended and ranking the top N search terms to be recommended from high to low popularity values as the recommended search terms includes: The heat values of the terminating keywords of the search terms to be recommended are traversed, and the top N search terms to be recommended whose heat values of the terminating keywords of the search terms to be recommended are ranked from high to low are used as the recommended search terms.

7. The method according to claim 1, characterized in that The search request is to recommend the top N search terms ranked by popularity value within a first time period, and the keyword index is the first keyword; The step of filtering the target keyword index set from the first word set according to the search request includes: Matching the first keyword with each keyword index in the first word set to obtain a matching result; When the matching result indicates that the first keyword exists in the first word set, a first keyword index corresponding to the first keyword is determined as the target keyword index set.

8. The method according to claim 7, characterized in that Determining a target tree structure set according to the target keyword index set includes: The first tree structure corresponding to the first keyword index is used as the target tree structure set.

9. The method according to claim 8, characterized in that The step of filtering the target tree structure set according to the search request to obtain recommended search terms includes: When the timestamp of the root node of the first tree structure meets the first time period, traversing the timestamps of each child node of the first tree structure and deleting the child nodes whose timestamps do not meet the first time period to obtain a target child node set; Generate a search term to be recommended according to the root node and the target child node set; The popularity values of the search terms to be recommended are traversed, and the top N search terms to be recommended that are ranked from high to low in popularity value are used as the recommended search terms.

10. The method according to claim 7, characterized in that The step of filtering the target tree structure set according to the search request to obtain recommended search terms includes: When the timestamp of the root node of the first tree structure does not satisfy the first time period, determining that the recommended search term is empty; or, When the timestamp of the root node of the first tree structure does not meet the first time period, the heat values of each subtree of the first tree structure are traversed, and the top N search terms ranked from high to low in heat value are used as the recommended search terms.

11. The method according to any one of claims 1 to 10, characterized in that The method further comprises: Obtaining the historical search terms; Perform word segmentation on the historical search terms to obtain M search keywords, where M is a positive integer; Traversing the first word set, and when the first search keyword does not exist in the first word set, creating a first keyword index corresponding to the first search keyword, wherein the first search keyword is ranked first among the multiple search keywords, and the first keyword index includes a timestamp and an initial popularity value of the first search keyword; Creating a root node of the historical search terms based on the first keyword index; Storing the first search keyword in the root node, and creating a tree structure of the historical search terms based on the root node according to the word sorting, wherein the number of child nodes of the tree structure is M-1; The plurality of search keywords are stored in sequence in each child node of the tree structure, wherein each child node includes a timestamp and a heat value of the search keyword of the historical search term.

12. The method according to claim 11, characterized in that After traversing the first word set, the method further includes: When the first search keyword exists in the first word set, obtaining the root node where the first search keyword is located, and updating the timestamp and heat value of the root node corresponding to the first search keyword; Reading the i-th search keyword of the historical search term in the word order, where i is an integer ranging from 2 to M; When the i-th search keyword is less than M, traverse the i-th layer node, and when the second search keyword exists in the i-th layer node, update the timestamp and heat value of the first child node in the i-th layer node, where the first child node is the node storing the i-th search keyword; When the i-th search keyword does not exist in the i-th layer node, create a second child node, and store the i-th search keyword, the timestamp and the heat value of the i-th search keyword in the second child node, and the second child node is included in the i-th layer node; Creating a target subtree based on the second child node according to the word sorting, and sequentially storing the remaining search keywords after the i-th search keyword, and the timestamps and heat values of the remaining search keywords in the target subtree; When the i-th search keyword is greater than M, the storage of the historical search terms is terminated.

13. A search term recommendation device, characterized in that: include: Acquisition module, used to obtain search requests; a processing module, configured to filter a target keyword index set from a first word set according to the search request, wherein the first word set is used to store the starting search keyword of a historical search term as a keyword index, and the keyword index further stores a timestamp and a popularity value of the starting keyword, wherein the timestamp is used to indicate the search time of the keyword index, and the popularity value is used to indicate the number of historical searches of the keyword; a target tree structure set is determined according to the target keyword index set, wherein each tree structure in the target tree structure set is used to store the historical search terms, wherein a subtree formed by a root node and child nodes of the tree structure corresponds to a historical search term, the root node in the tree structure is used to store the starting search keyword, each child node of the tree structure stores a search keyword, and each node of the tree structure further stores a timestamp and a popularity value of each search keyword, and the tree structure and the first word set are used to associate and store the historical search terms; and a recommended search term is obtained by filtering from the target tree structure set according to the search request; A display module is used to display the recommended search terms.

14. A computer device, characterized in that: include: Memory, processor, and bus system; Wherein, the memory is used to store programs; The processor is configured to execute the program in the memory, and the processor is configured to execute the method according to any one of claims 1 to 12 according to instructions in the program code; The bus system is used to connect the memory and the processor so that the memory and the processor can communicate with each other.

15. A computer-readable storage medium comprising instructions, which, when executed on a computer, causes the computer to perform the method according to any one of claims 1 to 12.