Commodity recommendation data processing method and device and electronic equipment
By using a two-way window queue mechanism on the e-commerce platform, a product identifier is generated for each shuffling rule, and the frequency of its appearance in the queue is determined. This solves the problems of similar product clustering and complex rule maintenance, and realizes the diversity and flexibility of product recommendation.
Patent Information
- Application Number
- CN202411097542.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
In product recommendations, existing technologies on e-commerce platforms struggle to effectively break down similar products, resulting in a large number of similar products clustering on the user interface. Furthermore, the code for maintaining the breakdown rules is complex and difficult to adapt to the diverse needs of operators.
A two-way window queue mechanism is adopted. By creating a product identifier for each shuffling rule, it is determined whether the number of times the product appears in the queue meets the limit. The window view is dynamically maintained to ensure that the candidate product is recommended after meeting all rules, thus achieving fast response and flexible adjustment.
It improves the diversity and maintainability of product recommendations, ensuring the diversity and flexibility of recommendation results, adapting to changes in business needs, and requiring no complex code modifications.
Smart Images

Figure CN119006106A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a data processing method, device and electronic device for commodity recommendation. Background Art
[0002] The essence of an e-commerce platform is to efficiently match and complete transactions through a platform. As the number and type of information on e-commerce products becomes increasingly overloaded, e-commerce platforms are gradually shifting from the original inefficient commodity transaction method dominated by commodity search and active discovery to a more efficient personalized intelligent recommendation matching method. The e-commerce platform recommendation system preliminarily selects a part of candidate commodities from a large number of commodities, sorts the candidate commodities according to a certain algorithm, and further adjusts the sorted commodities. However, when the ranking of candidate commodities of the same type is similar, a large number of similar commodities may appear on the user interface. Therefore, it is necessary to break up the sorted commodities to optimize the user experience and improve the diversity of commodities. In the related technology, when commodities are scattered, multiple scattering rules are generally set, and each scattering rule is separately written with corresponding code. However, due to the diverse needs of the operator, it is difficult to set a fixed set of scattering rules that can adapt to all situations in advance. Therefore, when these scattering rules need to be adjusted or added, it will be difficult to maintain the code of these scattering rules. Summary of the invention
[0003] The embodiments of the present application provide a data processing method, device and electronic device for product recommendation. The data processing method for product recommendation can ensure the diversity of recommended products and enhance the maintainability and flexibility of the break-up rules.
[0004] In a first aspect, an embodiment of the present application provides a data processing method for product recommendation, the method comprising:
[0005] Obtaining a candidate commodity list, wherein the candidate commodity list includes a plurality of candidate commodities;
[0006] Obtain at least one scatter rule, each of which includes a set of target attribute parameters, and create a bidirectional window queue for each scatter rule;
[0007] generating corresponding commodity identifiers for the candidate commodities according to the target attribute parameters of the scattering rule, and obtaining at least one commodity identifier for the candidate commodities;
[0008] Determine whether the number of occurrences of any of the commodity identifiers of the candidate commodities in the bidirectional window queue associated with the corresponding scattering rule meets a restriction condition, wherein the bidirectional window queue is used to store the commodity identifiers of the candidate commodities recommended to the user;
[0009] If the restriction condition is met, the candidate commodity is recommended to the user, and the commodity identifier of the candidate commodity is updated into the bidirectional window queue associated with each of the scattering rules.
[0010] Optionally, the target attribute parameter includes an attribute field and / or an attribute condition, and generating a corresponding commodity identifier for a candidate commodity according to the target attribute parameter of the scattering rule includes:
[0011] Extracting the parameter value of the attribute field corresponding to the candidate product, and / or obtaining the logical value of the attribute condition corresponding to the candidate product;
[0012] The commodity identifier corresponding to the candidate commodity is obtained according to the parameter value and / or the logic value.
[0013] Optionally, a counter is created for each of the scattering rules to count the number of times each product identifier appears in the bidirectional window queue associated with the scattering rule, and the determining whether the number of times any product identifier of the candidate product appears in the bidirectional window queue associated with the corresponding scattering rule satisfies a restriction condition, and if the restriction condition is satisfied, recommending the candidate product to the user includes:
[0014] Obtaining the number of times any of the commodity identifiers of the candidate commodities appear in the counter associated with the corresponding scattering rule;
[0015] Determine whether the number of times reaches the maximum number of times the product identifier is allowed to appear in the bidirectional window queue as defined in the corresponding scattering rule;
[0016] If the maximum number of times is not reached, the candidate product is recommended to the user.
[0017] Optionally, after determining whether the number of times reaches the maximum number of times the commodity identifier is allowed to appear in the bidirectional window queue as defined in the corresponding scattering rule, the method further includes:
[0018] If the maximum number of times is reached, determining whether the number of commodity identifiers stored in the bidirectional window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule;
[0019] If the maximum number is reached, determining whether the commodity identifier of the candidate commodity is consistent with the commodity identifier stored at the head of the bidirectional window queue;
[0020] If they are consistent, the candidate product is recommended to the user.
[0021] Optionally, the updating of the commodity identifier of the candidate commodity into the bidirectional window queue associated with each of the scattering rules includes:
[0022] If the number of commodity identifiers stored in the bidirectional window queue does not reach the maximum number that can be stored as defined in the corresponding scattering rule, the commodity identifiers of the candidate commodities are added to the bidirectional window queue in order, and the count of the newly added commodity identifiers is increased by 1 in the corresponding counter;
[0023] If the number of commodity identifiers stored in the two-way window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule, the commodity identifier stored at the head of the two-way window queue is deleted, and the commodity identifier of the candidate commodity is added to the tail of the two-way window queue, and the count of the newly added commodity identifier is increased by 1 in the corresponding counter, and the count of the deleted commodity identifier is reduced by 1.
[0024] Optionally, recommending the candidate products to the user includes:
[0025] Deleting the candidate product from the candidate product list and adding it to the recommendation queue;
[0026] After determining whether the number of occurrences of any of the commodity identifiers of the candidate commodities in the bidirectional window queue associated with the corresponding scattering rule meets a restriction condition, the method further includes:
[0027] If the restriction condition is not met, the candidate product is deleted from the candidate product list and added to the waiting queue;
[0028] Determine the next candidate product in the candidate product list in order until a candidate product that meets the restriction condition is found, delete the candidate product that meets the restriction condition from the candidate product list, add it to the recommendation queue, and update the product identifier of the candidate product that meets the restriction condition into the two-way window queue associated with each of the scattering rules;
[0029] The candidate products in the waiting queue are added to the front of the candidate product list, and the occurrence times of any product identifier of each candidate product in the candidate product list in the bidirectional window queue associated with the corresponding scattering rule are determined again in order to see whether they meet the restriction condition.
[0030] Optionally, recommending the candidate product to the user includes:
[0031] If the candidate commodity list is empty and the number of candidate commodities in the recommendation queue does not reach the target recommendation number, the candidate commodities in the waiting queue are added to the recommendation queue until the number of candidate commodities in the recommendation queue reaches the target recommendation number;
[0032] The candidate commodities in the recommendation queue are recommended to the user.
[0033] Optionally, obtaining a candidate product list includes:
[0034] In response to the received candidate commodity scattering request, obtaining the candidate commodity list and request parameters carried in the scattering request;
[0035] The obtaining of at least one scattering rule comprises:
[0036] The predefined scattering rules are filtered according to the candidate commodity list and the request parameters to obtain at least one scattering rule matching the scattering request.
[0037] In a second aspect, an embodiment of the present application provides a data processing device for product recommendation, the device comprising:
[0038] A first acquisition module is used to acquire a candidate commodity list, wherein the candidate commodity list includes a plurality of candidate commodities;
[0039] A second acquisition module is used to acquire at least one scattering rule, each of which includes a set of target attribute parameters, and to create a bidirectional window queue for each scattering rule;
[0040] A generating module, configured to generate a corresponding commodity identifier for the candidate commodity according to the target attribute parameter of the scattering rule, and obtain at least one commodity identifier of the candidate commodity;
[0041] a judgment module, used to judge whether the number of occurrences of any of the commodity identifiers of the candidate commodities in the bidirectional window queue associated with the corresponding scattering rule meets a restriction condition, wherein the bidirectional window queue is used to store the commodity identifiers of the candidate commodities recommended to the user;
[0042] The recommendation module is used to recommend the candidate commodity to the user if the restriction condition is met, and update the commodity identifier of the candidate commodity into the bidirectional window queue associated with each of the scattering rules.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the method described in any one of the above embodiments when executing the computer program.
[0044] All the scattering rules of the embodiments of the present application follow the same data structure and judgment logic. Regardless of the specific scattering rule content, they all include a set of target attribute parameters and are associated with a two-way window queue. They can all be determined by the commodity identifier determined by the target attribute parameters, and by checking whether the number of times the commodity identifier appears in the two-way window queue associated with the corresponding scattering rule satisfies the restriction condition to determine whether the candidate commodity satisfies the scattering rule. Therefore, when evaluating whether a candidate commodity satisfies a scattering rule, no matter how complex the scattering rule is, the time complexity required by the embodiments of the present application is O(1), and the ability to respond quickly to each scattering rule is maintained. By multiplying the O(1) time complexity by the total number of scattering rules (m) and the length of the candidate commodity queue (n), it can be calculated that the time complexity of the entire algorithm will be O(m*n), so even when processing a large number of scattering rules and candidate commodities, reasonable performance and fast response can be maintained, thereby ensuring the efficiency of the algorithm. Among them, a two-way window queue is created for each scattering rule, which can not only conveniently add the product identifier of the candidate product at the end of the queue, but also remove the first product identifier added at the head of the queue, and dynamically maintain a fixed-length window view to always track the fixed number of product identifiers of the latest candidate products recommended to the user, providing accurate data support for the subsequent evaluation of whether the new candidate products meet the restriction conditions. It can be understood that each scattering rule can be designed for the dimensions of the candidate product, such as brand, model, price, and evaluation level, and a candidate product is considered to meet the recommendation criteria only when all its product identifiers meet the restriction conditions of the corresponding scattering rules. If any product identifier of the candidate product does not meet the restriction conditions of its corresponding scattering rule, the candidate product will not be recommended to the user, thereby ensuring that the candidate products recommended to the user are diverse in all dimensions considered by the scattering rules, such as brand, model, price, and evaluation level. Moreover, the embodiments of the present application standardize each breakup rule so that all the breakup rules can be parsed and applied in a unified manner to determine whether a candidate product should be recommended. There is no need to write separate code for each breakup rule. When business needs change, there is no need to make complex modifications to the code. Only the target attribute parameters in the breakup rule need to be adjusted to quickly adapt to new business needs. When new breakup rules need to be added, they can also be seamlessly integrated into existing breakup rules, ensuring the maintainability, scalability and flexibility of the data processing method for product recommendation in this implementation, thereby providing strong adaptability to changes in business needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 It is a flowchart of a data processing method for commodity recommendation provided by an embodiment of the present application;
[0047] Figure 2 Another flowchart of a data processing method for product recommendation is provided for an embodiment of the present application;
[0048] Figure 3 A schematic diagram of a scenario of a data processing method for product recommendation provided in an embodiment of the present application;
[0049] Figure 4 A schematic diagram of a scenario for determining whether a candidate product meets the breakup rule provided in an embodiment of the present application;
[0050] Figure 5 A schematic diagram of a scenario in which a product identifier is updated into a bidirectional window queue according to an embodiment of the present application;
[0051] Figure 6 A schematic diagram of another scenario for determining whether a candidate product meets the breakup rule provided in an embodiment of the present application;
[0052] Figure 7 A schematic diagram of another scenario of updating a product identifier into a bidirectional window queue provided in an embodiment of the present application;
[0053] Figure 8 A schematic diagram of the structure of a data processing device for commodity recommendation provided in an embodiment of the present application;
[0054] Fig. 9 Another structural schematic diagram of a data processing device for commodity recommendation provided in an embodiment of the present application;
[0055] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0056] Fig.11 Another schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0058] Please refer to Figure 1 , the present application embodiment provides a flowchart of a data processing method for product recommendation. The specific process of the data processing method for product recommendation can be as follows:
[0059] In 101, a candidate commodity list is obtained, where the candidate commodity list includes a plurality of candidate commodities;
[0060] In 102, at least one scatter rule is obtained, each scatter rule includes a set of target attribute parameters, and a bidirectional window queue is created for each scatter rule;
[0061] In 103, a corresponding commodity identifier is generated for the candidate commodity according to the target attribute parameter of the scattering rule, and at least one commodity identifier of the candidate commodity is obtained.
[0062] The recommendation system of e-commerce platforms generally includes three stages: recall, sorting and re-sorting. In the recall stage, the system will initially select a number of candidate products from a large number of products; in the sorting stage, the recalled candidate products are sorted, and the order of the candidate products is determined according to a certain algorithm. For example, each candidate product can be scored and the order of the candidate products is determined according to the score. However, when the ranking of candidate products of the same type is similar, a large number of similar products may appear on the user interface. Therefore, it is necessary to break up the sorted candidate products in the re-sorting stage to optimize the recommendation results.
[0063] When receiving a request to break up candidate products, this embodiment obtains a list of candidate products, which includes multiple candidate products to be evaluated, and obtains at least one break-up rule, which is used to define how to break up candidate products to avoid a large number of similar products appearing in the recommendation results. Exemplarily, the break-up rules include restrictions on the same brand and model combination. For example, on the recommendation homepage, products with the same brand and model cannot appear more than 2 times in a row, so as to show more types of products in the user's first impression. In another example, the break-up rules include restrictions on the same brand and evaluation level combination. For example, for products with the same brand and evaluation level, they cannot appear more than 4 times in a row, so as to balance products with different evaluation levels in the recommendation and avoid users from seeing only high-rated or low-rated products. In another example, the break-up rules include restrictions on the frequency of occurrence of the same brand. In any page, products of the same brand cannot appear more than 8 times, which helps to maintain the diversity of product brands on the page. In another example, the scattering rule includes a frequency limit for a specific brand. For example, for specific brands such as Brand 1, Brand 2, and Brand 3, they cannot appear more than 5 times on any page. This is mainly due to the high popularity of these brands in the market and user preferences. The embodiment of the present application can flexibly set more scattering rules according to operation strategies and user needs. Through the appropriate application of these scattering rules, the diversity of recommendation results can be ensured.
[0064] In this embodiment, all the scattering rules follow the same data structure, and each scattering rule includes a set of target attribute parameters. According to the target attribute parameters of each scattering rule, a corresponding commodity identifier can be generated for the candidate commodity. It can be understood that each scattering rule includes a set of target attribute parameters, and the candidate commodity generates a commodity identifier corresponding to the target attribute parameters of each scattering rule, that is, when there are multiple scattering rules, a candidate commodity generates multiple commodity identifiers, each commodity identifier corresponds to a scattering rule, and the commodity identifier corresponds to the scattering rule one by one.
[0065] In one embodiment, the target attribute parameter includes an attribute field and / or an attribute condition. According to the target attribute parameter of the scattering rule, the step of generating a corresponding commodity identifier for the candidate commodity may include: extracting the parameter value of the attribute field corresponding to the candidate commodity, and / or the logical value of the attribute condition corresponding to the candidate commodity; obtaining the commodity identifier corresponding to the candidate commodity according to the parameter value and / or the logical value. Exemplarily, the target attribute parameter may include the attribute field and / or attribute condition of the commodity concerned by each scattering rule, and the attribute field may include, for example, brand, model, quality grade (evaluation), commodity price (price), etc. The attribute condition may include, for example, price range (price>1000) or quality grade (evaluation>'A0'), etc.
[0066] Exemplarily, the target attribute parameters of the scatter rule may include: type (Type), impact scope (PagingScope), unique pointer (Unique), rule window (Window) and limit (Limit). Among them, type refers to the type of the scatter rule, for example, it can be defined as: contains. The impact scope defines the page range affected by the scatter rule, for example, [2,1000] means that it affects pages 2 to 1000. The unique pointer may include one or more attribute fields, and one or more attribute fields may form a commodity identifier that can uniquely identify a single candidate commodity. For example, if the unique pointer of the scatter rule is brand:model, it includes the two fields of brand (brand) and model (model). The unique pointer may also include one or more attribute conditions, and one or more attribute conditions are used to define the commodity attributes constrained by the scatter rule. For example, if the attribute condition combination is: evaluation>'A0':price>1000, then the scatter rule is applicable to commodities with an evaluation level higher than A0 and a price greater than 1000. The rule window is a set value that defines the number of consecutive candidate commodities considered by the scatter rule. For example, if the value of Window is 5, the scatter rule will always check the last five consecutive candidate products. In order to effectively track these consecutive candidate products, a two-way window queue can be created for each scatter rule. The rule window defines the window length of the two-way window queue. The two-way window queue can be used to easily add new products to the end of the queue and remove the first product at the head of the queue. Limit defines the maximum number of candidate products that meet specific restrictions within the rule window. For example, if limit is 2, then within any given five consecutive products, the number of products that meet specific conditions cannot exceed 2.
[0067] Specifically, this embodiment can extract attribute fields and / or attribute conditions from the unique pointer in the target attribute parameter. When the unique pointer only contains the attribute field, there is no additional attribute condition, and the attribute field is one, the parameter value of the attribute field corresponding to the candidate commodity is extracted, and the parameter value is used as the commodity identifier corresponding to the candidate commodity; when the attribute field is multiple, multiple parameter values of multiple attribute fields corresponding to the candidate commodity are extracted, and the multiple parameter values are spliced in a predetermined order to obtain the commodity identifier corresponding to the candidate commodity. For example, the unique pointer is brand:model, and the brand of the candidate commodity is: brand 1, and the model is: X1, then the spliced commodity identifier can be: brand 1_X1. When the unique pointer includes not only the attribute field but also the attribute condition, it is also necessary to check whether the candidate commodity meets these attribute conditions, and obtain the logical value (true or false) according to the result; then the extracted parameter value and the logical value are spliced in a predetermined order to generate the commodity identifier of the candidate commodity. For example, if the uniqueness pointer is: brand: evaluation>'A0', then the uniqueness pointer consists of two parts: an attribute field brand, which indicates the brand, and an attribute condition evaluation>'A0', which indicates that the quality grade must be higher than 'A0'. If the brand (brand) of a candidate product is: brand 2, and the quality grade (evaluation) is A1, then for the brand field, directly take out the brand value of the candidate product, that is, brand 2. For the condition evaluation>'A0', determine whether the quality grade of the candidate product meets the condition. Since the quality grade is A1, which is higher than A0, the judgment result is true. Then, corresponding to the scattering rule, the spliced brand 2_true is used as the product identifier of the candidate product. If the brand of another candidate product is: brand 3, and the quality grade is B0, which does not meet the attribute condition evaluation>'A0', then the product identifier will be brand 3_false. In addition, the uniqueness indicator may not include the attribute field, but only include one or more attribute conditions. When there is only one attribute condition, the logical value of the attribute condition corresponding to the candidate product is obtained, and the logical value is used as the product identifier corresponding to the candidate product; when there are multiple attribute conditions, it is checked whether the candidate product meets these attribute conditions, and multiple logical values are obtained according to the results, and the multiple logical values are concatenated in a predetermined order to generate the product identifier of the candidate product. For example, the uniqueness pointer is: evaluation>'A0':price>'1000', then the uniqueness pointer is composed of two attribute conditions: one attribute condition evaluation>'A0', indicating that the color grade must be higher than 'A0', and the other attribute condition price>'1000', indicating that the price must be higher than '1000'.If the quality grade (evaluation) of a candidate product and the price (price) is 500, for the attribute condition evaluation>'A0', since the quality grade is A1, which is higher than A0, the logical value is true, and for the attribute condition price>'1000', since the price is 500, which is lower than 1000, the logical value is false, then the product identifier will be true_false. Therefore, each candidate product can be normalized and identified based on the target attribute parameter of the scatter rule, so that each candidate product has a unique product identifier.
[0068] Exemplarily, the scattering rules may be stored in a configuration file. For example, the configuration file is as follows, and the configuration file defines the target attribute parameters included in each scattering rule:
[0069]
[0070]
[0071] In 104, it is determined whether the number of occurrences of any product identifier of the candidate product in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition, and the bidirectional window queue is used to store the product identifiers of the candidate products recommended to the user;
[0072] In 105 , if the restriction condition is met, the candidate product is recommended to the user, and the product identifier of the candidate product is updated into the bidirectional window queue associated with each scattering rule.
[0073] Each scattering rule includes an associated bidirectional window queue. The rule window defines the window length of the bidirectional window queue. The bidirectional window queue can be used to easily add new candidate products to the end of the queue and remove the first candidate products from the head of the queue. As candidate products are continuously added and removed, the bidirectional window queue dynamically maintains a fixed-length window view, which always tracks a fixed number of the latest candidate product sets recommended to users. For example, if the window length is 5, the bidirectional window queue can store the product identifiers of the 5 latest candidate products recommended to users, so as to track the latest 5 candidate product sets recommended to users in real time.
[0074] This embodiment determines whether the number of times the commodity identifier of the current candidate commodity appears in the bidirectional window queue meets the restriction condition. Specifically, for each candidate commodity, it is necessary to determine whether it meets all the scattering rules. Specifically, it is determined whether the number of times any commodity identifier of the candidate commodity appears in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition. Only when all commodity identifiers of the candidate commodity meet the restriction condition of their respective corresponding scattering rules, the candidate commodity is considered to meet the recommendation standard and is recommended to the user. If any commodity identifier of the candidate commodity does not meet the restriction condition of its corresponding scattering rule, the candidate commodity will not be directly recommended to the user.
[0075] When a candidate product is judged to meet the restrictions of all relevant scattering rules and is recommended to the user, the multiple product identifiers of the recommended candidate product will be updated to the two-way window queues associated with the multiple corresponding scattering rules to reflect the latest recommendation status. The dynamic maintenance of the two-way window queue ensures that the two-way window queue always contains the product identifiers of the latest candidate products recommended to the user, and provides data support for the subsequent accurate evaluation of whether the new candidate products meet the recommendation criteria.
[0076] For a clearer explanation, the following example illustrates how to determine whether a candidate product should be recommended to a user. Exemplarily, the scattering rule includes a first scattering rule and a second scattering rule, the first scattering rule includes a target attribute parameter 1, and is associated with a bidirectional window queue 1, and the second scattering rule includes a target attribute parameter 2, and is associated with a bidirectional window queue 2. Among them, according to the target attribute parameter 1 of the first scattering rule, the product identifier 1 of the candidate product is generated, and it is determined whether the number of occurrences of the product identifier 1 of the candidate product in the bidirectional window queue 1 meets the restriction condition of the first scattering rule. If the restriction condition of the first scattering rule is met, it is considered that the candidate product meets the first scattering rule. According to the target attribute parameter 2 of the second scattering rule, the product identifier 2 of the candidate product is generated, and it is determined whether the number of occurrences of the product identifier 2 of the candidate product in the bidirectional window queue 2 meets the restriction condition of the second scattering rule. If the restriction condition of the second scattering rule is also met, it is considered that the candidate product also meets the second scattering rule. That is, if the candidate product can meet all the scattering rules, then the candidate product should be recommended to the user. If it is determined that the number of occurrences of the candidate product identifier 1 in the two-way window queue 1 does not meet the restrictions of the first scattering rule, or the number of occurrences of the candidate product identifier 2 in the two-way window queue 2 does not meet the restrictions of the second scattering rule, it is considered that the candidate product should not be recommended to the user temporarily.
[0077] Specifically, for example, the first scattering rule is: products of the same brand appear no more than twice in the window, and the current state of the two-way window queue 1 (the window length is 4): [Brand 1, Brand 2, Brand 1, Brand 2]; the second scattering rule: high-priced products (price > 1000) appear no more than once in the window, and the current state of the two-way window queue 2 (the window length is 4): [false, false, false, true].
[0078] For candidate product 1 (brand 2, price 1500), according to the first dispersal rule, the product identifier of candidate product 1 is: brand 2. Brand 2 has appeared twice in bidirectional window queue 1. If candidate product 1 is added to bidirectional window queue 1 again, it violates the restriction in the first dispersal rule that the number of times the same brand of products appear in the window does not exceed 2 times. Therefore, candidate product 1 cannot be recommended to the user temporarily.
[0079] For candidate product 2 (brand 3, price 500), since the identifier of candidate product 2 is: brand 3, brand 3 does not appear in the two-way window queue 1, if candidate product 2 is added to the two-way window queue 1, it satisfies the restriction condition of the first scattering rule that the number of times the products of the same brand appear in the window does not exceed 2 times, and for the second scattering rule, the product identifier of candidate product 2 is: false. Since the price of candidate product 2 is 500 and does not exceed 1000, it also satisfies the restriction condition specified in the second scattering rule that high-priced products (price>1000) appear no more than 1 time in the window. Therefore, candidate product 2 can satisfy both the first scattering rule and the second scattering rule and can be recommended to the user.
[0080] All the scattering rules of the embodiments of the present application follow the same data structure and judgment logic. Regardless of the specific scattering rule content, they all include a set of target attribute parameters and are associated with a two-way window queue. They can all be determined by the target attribute parameters to determine the commodity identifier, and by checking whether the number of times the commodity identifier appears in the two-way window queue associated with the corresponding scattering rule meets the restriction condition to determine whether the candidate commodity meets the scattering rule. Therefore, when evaluating whether a candidate commodity meets a scattering rule, no matter how complex the scattering rule is, the time complexity required by this embodiment is O(1), maintaining the ability to respond quickly to each scattering rule. Multiplying the O(1) time complexity by the total number of scattering rules (m) and the length of the candidate commodity queue (n), it can be calculated that the time complexity of the entire algorithm will be O(m*n), so even when processing a large number of scattering rules and candidate commodities, reasonable performance and fast response can be maintained, thereby ensuring the efficiency of the algorithm. Among them, a two-way window queue is created for each scattering rule, which can not only conveniently add the product identifier of the candidate product at the end of the queue, but also remove the first product identifier added at the head of the queue, and dynamically maintain a fixed-length window view to always track the fixed number of product identifiers of the latest candidate products recommended to the user, providing accurate data support for the subsequent evaluation of whether the new candidate products meet the restriction conditions. It can be understood that each scattering rule can be designed for the dimensions of the candidate product, such as brand, model, price, and evaluation level, and a candidate product is considered to meet the recommendation criteria only when all its product identifiers meet the restriction conditions of the corresponding scattering rules. If any product identifier of the candidate product does not meet the restriction conditions of its corresponding scattering rule, the candidate product will not be recommended to the user, thereby ensuring that the candidate products recommended to the user are diverse in all dimensions considered by the scattering rules, such as brand, model, price, and evaluation level. Moreover, the embodiments of the present application standardize each breakup rule so that all the breakup rules can be parsed and applied in a unified manner to determine whether a candidate product should be recommended. When business needs change, only the target attribute parameters in the breakup rules need to be adjusted to quickly adapt to new business needs. Or when new breakup rules need to be added, they can be seamlessly integrated into existing breakup rules without complex code modifications, thereby ensuring the maintainability, scalability and flexibility of the data processing method for product recommendation in this implementation, thereby providing strong adaptability to changes in business needs.
[0081] Please refer to Figure 2 , Figure 2 Another flowchart of the data processing method for product recommendation provided in the embodiment of the present application is shown in FIG. The specific flow of the data processing method for product recommendation can be as follows:
[0082] In 201, in response to the received candidate commodity scattering request, the candidate commodity list and request parameters carried in the scattering request are obtained;
[0083] In 202, predefined scattering rules are filtered according to the candidate product list and the request parameters to obtain at least one scattering rule matching the scattering request, each scattering rule includes a set of target attribute parameters, and a bidirectional window queue is created for each scattering rule.
[0084] In response to receiving a breakup request, a candidate product list and related request parameters carried in the breakup request are obtained. The candidate product list includes multiple candidate products arranged in order, such as the candidate products are arranged from high to low according to scores, and these scores may be calculated based on user behavior, product attributes or other factors. The request parameters may include context information such as the page number of the current request.
[0085] Then, the predefined scattering rules are filtered based on the candidate product list and the request parameters to determine which scattering rules match the current scattering request. Exemplarily, the target attribute parameters of the scattering rule include an impact scope (Paging Scope), which defines the page range affected by the scattering rule. Some scattering rules may only apply to the homepage or a specific page range. If the request page number carried in the scattering request does not match the page range defined in the scattering rule, the scattering rule is not applicable to the scattering request. In another example, the target attribute parameters of the scattering rule include a rule window (Window), which defines the range of the number of products that the scattering rule focuses on when considering product diversity. For example, the rule window size is set to 5, and the scattering rule requires diversity to be achieved in the last 5 products. If the number of candidate products in the candidate product list is less than the window length defined by the scattering rule, the diversity consideration cannot be achieved in enough candidate products, so the scattering rule is also not applicable to the scattering request. In another example, the target attribute parameter of the scatter rule includes a uniqueness pointer, which defines which attribute characteristics of the candidate product the scatter rule needs to rely on to execute, such as brand, model, price, etc. If these key attributes are missing in the candidate product, the scatter rule will not be applied correctly, so the scatter rule is not applicable to the scatter request. Different scatter requests may require different recommendation needs. The scatter rule that matches the current scatter request can be flexibly selected from a large number of scatter rules, which improves the accuracy of the scatter rule application and ensures that the recommendation results are more in line with the actual needs of the user. By excluding inapplicable or invalid scatter rules, the algorithm can reduce unnecessary calculations and improve processing speed and efficiency. In an environment where business needs are constantly changing, the embodiments of the present application can dynamically select and apply scatter rules and can adapt to these changes more flexibly.
[0086] In one implementation, after receiving a commodity dispersal request, a configuration file storing dispersal rules is read, and an operable instance class is created for the dispersal rules. For example, the instance class of the dispersal rule is:
[0087] ScatterRuleConfig rule
[0088] Deque <object>objectWindow
[0089] Map<Object,Integer> counter=new HashMap<>()
[0090] That is, the created operational instance class of the scatter rule includes target attribute parameters, bidirectional window queues, and calculators, wherein the target attribute parameters define how to scatter candidate products, the bidirectional window queue is used to store the product identifiers of the most recent N candidate products within the window length, and the bidirectional window queue has a corresponding counter, the purpose of the counter is to monitor the number of times each product identifier appears in the bidirectional window queue. The instance class of the scatter rule provides a structured way for each scatter rule to scatter candidate products in the candidate product list, thereby improving the efficiency of product scattering.
[0091] In 203, the target attribute parameter includes an attribute field and / or an attribute condition, and the parameter value of the attribute field corresponding to the candidate product and / or the logical value of the attribute condition corresponding to the candidate product are extracted;
[0092] In 204 , a commodity identifier corresponding to the candidate commodity is obtained according to the parameter value and / or the logic value.
[0093] Each scattering rule corresponds to a set of target attribute parameters, which may include attribute field combinations and / or attribute condition combinations of the commodities concerned by each scattering rule, such as attribute field combinations that may include brand, model, quality grade (evaluation), commodity price (price), etc. Attribute conditions include price range (price>1000) or quality grade (evaluation>'A0'), etc. According to the target attribute parameters of each scattering rule, a corresponding commodity identifier can be generated for the candidate commodity, that is, the candidate commodity can be identified by normalization through the commodity identifier, and the commodity identifier is used to uniquely identify the candidate commodity.
[0094] In one embodiment, attribute fields and / or attribute conditions can be extracted from the unique pointer in the scattering rule. If the unique pointer only contains attribute fields and no additional attribute conditions, the parameter values corresponding to these attribute fields can be directly extracted and spliced together in a predetermined order to form the commodity identifier of the candidate commodity. For example, the unique pointer is brand:model_id, and the brand of the candidate commodity is Apple, and the model ID is X1, then the spliced commodity identifier can be: Apple_X1. If the unique pointer includes not only attribute fields but also attribute conditions, it is also necessary to check whether the candidate commodity meets these attribute conditions and obtain a logical value (true or false) based on the result; then the extracted parameter values and logical values are spliced in a predetermined order to generate the commodity identifier of the candidate commodity. For example, the unique pointer is: brand, evaluation>'A0', then the unique pointer consists of two parts: an attribute field brand, indicating the brand, and an attribute condition evaluation>'A0', indicating that the color grade must be higher than 'A0'. If the brand (brand) of a candidate product is: Brand 2, and the quality grade (evaluation) is A1, then for the brand field, directly take out the brand value of the candidate product, that is, Brand 2. For the condition evaluation>'A0', determine whether the quality grade of the candidate product meets the condition. Since the quality grade is A1, which is higher than A0, the judgment result is true. Then, corresponding to the scattering rule, the spliced brand 2_true is used as the product identifier of the candidate product. If the brand of another candidate product is: Brand 3, the quality grade is B0, and it does not meet the attribute condition evaluation>'A0', then the product identifier will be Brand 3_false.
[0095] In 205, it is determined whether the number of occurrences of any product identifier of the candidate product in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition, and the bidirectional window queue is used to store the product identifiers of the candidate products recommended to the user;
[0096] In 206 , if the restriction condition is met, the candidate product is deleted from the candidate product list and added to the recommendation queue, and the product identifier of the candidate product is updated into the bidirectional window queue associated with each scattering rule.
[0097] In one embodiment, a counter is created for each of the scattering rules to count the number of times each product identifier appears in the bidirectional window queue associated with the scattering rule. The number of times any product identifier of the candidate product appears in the counter associated with the corresponding scattering rule is obtained; whether the number reaches the maximum number of times the product identifier defined in the corresponding scattering rule is allowed to appear in the bidirectional window queue; if the number does not reach the maximum number, the candidate product is deleted from the candidate product list and added to the recommendation queue.
[0098] A counter is created for each scattering rule, and the counter corresponds to the two-way window queue. The purpose of the counter is to monitor the number of times each product identifier appears in the two-way window queue. When judging whether a candidate product should be recommended, the number of times any product identifier of the candidate product appears in the corresponding counter is obtained, and it is checked whether the number of times any product identifier appears does not reach the maximum number preset in the corresponding scattering rule, wherein the target attribute parameter of the scattering rule includes a limit "Limit", which defines the maximum number of times the same product identifier is allowed to appear in the two-way window queue. If the number of times all product identifiers appear in the corresponding counters does not reach their respective maximum number limits, it means that the candidate product meets all the scattering rules, and the candidate product has not been excessively repeated under each scattering rule, and can be recommended to the user, so the candidate product is deleted from the candidate product list and added to the recommendation queue.
[0099] In one embodiment, after determining whether the number of times reaches the maximum number of times that the commodity identifier defined in the corresponding scattering rule is allowed to appear in the two-way window queue, if the maximum number is reached, it can be further determined whether the number of commodity identifiers stored in the two-way window queue reaches the maximum number that can be stored defined in the scattering rule. If the maximum number is reached, it is determined whether the commodity identifier of the candidate commodity is consistent with the commodity identifier stored at the head of the two-way window queue. If they are consistent, the candidate commodity is deleted from the candidate commodity list and added to the recommendation queue. Since when the commodity identifier of the candidate commodity is added to the tail of the two-way window queue, the commodity identifier stored at the head of the two-way window queue is also deleted at the same time, it can be ensured that the number of occurrences of the commodity identifier does not exceed the maximum limit defined in the scattering rule within the window length of the two-way window queue, and it can be considered that the candidate commodity also meets the scattering rule. The number of times all commodity identifiers appear in the corresponding counters does not exceed the respective maximum number limits, indicating that the candidate commodity meets all the scattering rules and can be recommended to the user, so the candidate commodity is deleted from the candidate commodity list and added to the recommendation queue.
[0100] After determining that the candidate product can be recommended to the user, each product identifier of the candidate product will be updated to the bidirectional window queue associated with the corresponding scattering rule. Specifically, it is determined whether the number of product identifiers in the bidirectional window queue has reached the maximum number preset by the scattering rule. If the number of product identifiers stored in the bidirectional window queue does not reach the maximum number that can be stored defined in the corresponding scattering rule, the product identifiers of the candidate products are added to the bidirectional window queue in order, and the corresponding counter increases the count of the newly added product identifier by 1; if the number of product identifiers stored in the bidirectional window queue reaches the maximum number that can be stored defined in the corresponding scattering rule, the product identifier stored at the head of the bidirectional window queue is deleted, and the product identifier of the candidate product is added to the tail of the bidirectional window queue, and the counter increases the count of the newly added product identifier by 1, and decreases the count of the deleted product identifier by 1. In this way, the product identifiers of the candidate products recommended to the user can always be stored in the bidirectional window queue. The update of the counter ensures the accurate tracking of the number of occurrences of each product identifier stored in the bidirectional window queue, and provides data support for evaluating the next new candidate product.
[0101] It should be noted that in addition to using a counter to count the number of times each product identifier appears in the bidirectional window queue, other methods can also be used, which are not limited in this embodiment. For example, the product identifier can be stored in a database, and then queried or counted from the database when needed.
[0102] In 207 , if the restriction condition is not met, the candidate product is deleted from the candidate product list and added to the waiting queue;
[0103] In 208, the next candidate product in the candidate product list is determined in order until a candidate product that meets the restriction condition is found, the candidate product that meets the restriction condition is deleted from the candidate product list, added to the recommendation queue, and the product identifier of the candidate product that meets the restriction condition is updated into the bidirectional window queue associated with each scattering rule;
[0104] In 209, the candidate products in the waiting queue are added to the front of the candidate product list, and the number of occurrences of any product identifier of each candidate product in the candidate product list in the bidirectional window queue associated with the corresponding scattering rule is determined again in order to see whether it meets the restriction condition;
[0105] In 210 , if the candidate product list is empty and the number of candidate products in the recommendation queue has not reached the target recommendation number, the candidate products in the waiting queue are added to the recommendation queue until the number of candidate products in the recommendation queue reaches the target recommendation number;
[0106] In 211 , the candidate commodities in the recommendation queue are recommended to the user.
[0107] In one embodiment, when a candidate commodity does not meet the restriction condition, the candidate commodity will not be directly recommended to the user, but will be added to the waiting queue. Continue to traverse the candidate commodity list until a candidate commodity that meets the restriction condition is found, delete the candidate commodity that meets the restriction condition from the candidate commodity list, add it to the recommendation queue, and then add the candidate commodity in the waiting queue back to the front end of the candidate commodity list to evaluate whether it should be recommended to the user again. It can be understood that the waiting queue is only a temporary storage area for storing candidate commodities that temporarily do not meet the scattering rules, that is, the number of occurrences of at least one commodity identifier of these candidate commodities in the bidirectional window queue associated with the corresponding scattering rule does not meet the restriction condition, but when the next candidate commodity that meets the restriction condition and can be recommended to the user is found, the commodity identifier of the candidate commodity that meets the restriction condition will be updated into the bidirectional window queue associated with each scattering rule, and the corresponding counter will be updated accordingly, so the candidate commodities in the waiting queue can be re-evaluated. Among them, the candidate product list contains multiple candidate products arranged in order. For example, the candidate products can be arranged from high to low according to the scores. The candidate products closer to the front have higher scores and are more likely to meet user needs. Therefore, placing the candidate products in the waiting queue at the front can ensure that these candidate products are given priority during evaluation, which helps to improve the accuracy of the recommendation. That is, after adding the candidate products in the waiting queue to the front of the candidate product list, starting from the candidate products at the front of the candidate product list, reapply each scattering rule to evaluate the candidate products, and repeat this process until all the products in the candidate product list have been evaluated, or the termination condition of the recommendation is reached, such as reaching the upper limit of the number of recommendations. Exemplary, the pseudo code is as follows:
[0108]
[0109] In one embodiment, if the candidate product list is empty and the number of candidate products in the recommendation queue does not reach the target recommendation number, the candidate products in the waiting queue are added to the recommendation queue until the number of candidate products in the recommendation queue reaches the target recommendation number. That is, each candidate product in the candidate product list is evaluated in turn, and for each candidate product, it is checked whether it meets the restriction conditions of all the scattering rules. If the candidate product meets the restriction conditions, it is added to the recommendation queue and deleted from the candidate product list. If the candidate product does not meet the restriction conditions, it can be temporarily added to the waiting queue. After all the products in the candidate product list have been evaluated, it is checked whether the number of candidate products in the recommendation queue has reached the target recommendation number. If the number of products in the recommendation queue has not reached the target recommendation number, although the candidate products in the waiting queue do not meet all the scattering rules, since the target recommendation number has not been reached in the recommendation queue and there are no more candidate products in the candidate product list that can be added to the recommendation queue, the candidate products in the waiting queue can be added to the recommendation queue so that the number of candidate products in the recommendation queue reaches the target recommendation number, and then the candidate products in the recommendation queue are recommended to the user. For example, a strategy may be predefined to determine how to select candidate products in the waiting queue to be added to the recommendation queue. For example, certain breakup conditions may be relaxed, or candidate products may be selectively added to the recommendation queue based on factors such as scores.
[0110] It should be noted that, in this embodiment, each scattering rule includes a set of target attribute parameters and is associated with a bidirectional window queue. Based on the target attribute parameters of the scattering rule, the candidate commodities are normalized and identified, so that corresponding to a scattering rule, each candidate commodity has a unique commodity identifier, and whether the scattering rule is satisfied is determined by checking whether the number of times the commodity identifier appears in the bidirectional window queue associated with the corresponding scattering rule satisfies the restriction condition. Therefore, when evaluating whether a candidate commodity satisfies a scattering rule, no matter how complex the scattering rule is, the time complexity required for evaluating a candidate commodity in this embodiment is O(1), maintaining the ability to respond quickly to each scattering rule. By multiplying the O(1) time complexity by the total number of scattering rules (m) and the length of the candidate commodity queue (n), it can be calculated that the time complexity of the entire algorithm will be O(m*n). Therefore, even when processing a large number of scattering rules and candidate commodities, reasonable performance and fast response can be maintained, thereby ensuring the efficiency of the algorithm.
[0111] Please refer to Figure 3 , Figure 3 A schematic diagram of a scenario of a data processing method for product recommendation provided in an embodiment of the present application.
[0112] In response to the received candidate commodity scattering request, a candidate commodity list carried in the scattering request is obtained, where the candidate commodity list includes a plurality of candidate commodities arranged in order, for example, the candidate commodities are arranged in descending order according to scores.
[0113] In response to the scattering request, a recommendation queue and a waiting queue are initialized. The recommendation queue is used to store candidate products that meet the recommendation criteria and can be recommended to the user, and the waiting queue is used to store candidate products that do not meet the recommendation criteria and are temporarily recommended to the user directly.
[0114] Each candidate product in the candidate product list is traversed in order to determine whether the candidate product meets all the scattering rules. If all the scattering rules are met, the candidate product is added to the recommendation queue, and the product identifier of the candidate product is updated into the two-way window queue associated with each scattering rule. If all the scattering rules are not met, the candidate product is added to the waiting queue.
[0115] When determining whether a candidate product should be recommended, it is necessary to determine whether the candidate product satisfies each of the scattering rules. Specifically, for any scattering rule, the scattering rule includes a set of target attribute parameters, and a corresponding product identifier can be generated for the candidate product according to the target attribute parameters, that is, the product identifier corresponds to the scattering rule, and the product identifier is used to uniquely identify the candidate product under the specific scattering rule.
[0116] A two-way window queue is created for each scattering rule. A counter is set corresponding to the two-way window queue to count the number of times each product identifier appears in the two-way window queue.
[0117] According to the target attribute parameters of the scattering rule, the product identifier of the candidate product can be generated, the number of times the product identifier of the candidate product appears in the counter is obtained, and it is determined whether the number reaches the maximum number of times the product identifier defined in the scattering rule is allowed to appear in the two-way window queue. If the maximum number is not reached, it means that even if the product identifier of the candidate product is added to the two-way window queue, the number of times this product identifier appears in the two-way window queue will not exceed the maximum number of times allowed, so the candidate product meets the scattering rule.
[0118] If the maximum number of times is reached, it can be further determined whether the number of product identifiers stored in the two-way window queue has reached the maximum number that can be stored as defined by the scattering rule. If the maximum number is reached, it is determined whether the product identifier of the candidate product is consistent with the product identifier stored at the head of the two-way window queue. If they are consistent, since the product identifier of the candidate product is newly added to the tail of the two-way window queue, the product identifier stored at the head of the two-way window queue will also be deleted at the same time. This ensures that within the window length of the two-way window queue, the number of occurrences of the product identifier will not exceed the maximum limit defined in the scattering rule. Therefore, it can be considered that the candidate product also meets the scattering rule.
[0119] If the candidate product meets all the scattering rules and can be recommended to the user, the candidate product will be deleted from the candidate product list and added to the recommendation queue. After the candidate product is placed in the recommendation queue, the product identifier of the candidate product will be updated to the two-way window queue associated with the scattering rules.
[0120] Specifically, it is determined whether the number of product identifiers in the two-way window queue has reached the maximum number preset by the scattering rule; if the maximum number has not been reached, the product identifiers of the candidate products are added to the two-way window queue in order, and the corresponding counter increases the count of the newly added product identifiers by 1; if the maximum number has been reached, the product identifiers stored at the head of the two-way window queue are deleted, and the product identifiers of the candidate products are added to the tail of the two-way window queue, and the counter increases the count of the newly added product identifiers by 1, and decreases the count of the deleted product identifiers by 1. In this way, the product identifiers of the candidate products recommended to the user can always be stored in the two-way window queue, and the update of the counter ensures the accurate tracking of the number of occurrences of each product identifier stored in the two-way window queue, providing data support for the evaluation of the next new candidate product.
[0121] Please refer to Figure 4 and Figure 5 , Figure 4 A schematic diagram of a scenario for determining whether a candidate product meets the breakup rule provided in an embodiment of the present application, Figure 5 A schematic diagram of a scenario for updating a product identifier into a bidirectional window queue provided in an embodiment of the present application.
[0122] For example, a scattering rule is defined as: the same brand and model of goods cannot appear more than 2 times in the two-way window queue, and the maximum storage capacity of the two-way window queue is 4. Figure 4 As shown: the two-way window queue of the current scatter rule stores the product identifier of candidate product 1: Brand 1_Model 1, the product identifier of candidate product 2: Brand 2_Model 2, and the product identifier of candidate product 3: Brand 1_Model 1, and the corresponding counters count the number of product identifiers (Brand 1_Model 1) as 2 and the number of product identifiers (Brand 2_Model 2) as 1.
[0123] For example, when determining whether candidate product 4 meets the scattering rule, the product identifier of candidate product 4 is generated according to the target attribute parameter of the scattering rule: brand 3_model 3. Since the product identifier of candidate product 4 (brand 3_model 3) has never appeared in the two-way window queue, candidate product 4 meets the scattering rule, and it is determined that the current two-way window queue has not reached the maximum storage capacity. Figure 5 As shown, the product identifier (brand 3_model 3) is sequentially added to the fourth blank storage position of the two-way window queue, and the counter updates the number of product identifiers (brand 3_model 3) to 1, that is, the counter updates the number of product identifiers (brand 1_model 1) to 2, the number of product identifiers (brand 2_model 2) to 1, and the number of product identifiers (brand 3_model 3) to 1. The updated two-way window queue and counter are as follows: Figure 5 shown.
[0124] For example, please refer to Figure 6 and Figure 7 , Figure 6 A schematic diagram of another scenario for determining whether a candidate product meets the breakup rule provided in an embodiment of the present application, Figure 7 A schematic diagram of another scenario of updating a product identifier into a bidirectional window queue provided in an embodiment of the present application.
[0125] When continuing to judge whether candidate product 5 meets the breakup rule, the product identifier of candidate product 5 is generated according to the target attribute parameter of the breakup rule as: brand 1_model 1. Since the product identifier (brand 1_model 1) of candidate product 5 has appeared twice in the two-way window queue, reaching the maximum number of times, but since it is judged that the number of product identifiers currently stored in the two-way window queue has reached the maximum number, and the product identifier (brand 1_model 1) of candidate product 5 is consistent with the product identifier (brand 1_model 1) stored at the head of the two-way window queue, the product identifier (brand 1_model 1) of candidate product 5 can be added to the end of the two-way window queue, and the product identifier (brand 1_model 1) of candidate product 1 stored at the head of the two-way window queue is deleted, and the arrangement of the product identifiers stored in the two-way window queue is updated as: the product identifier (brand 2_model 2) of candidate product 2, the product identifier (brand 1_model 1) of candidate product 3, the product identifier (brand 3_model 3) of candidate product 4, and the product identifier (brand 1_model 1) of candidate product 5. The counter of the two-way window queue is also updated accordingly. The counter increases the count of the newly added product identifier "Brand 1_Model 1" by 1, and decreases the count of the deleted product identifier (Brand 1_Model 1) by 1. That is, the number of times the product identifier (Brand 1_Model 1) appears in the counter is still 2 times, which does not exceed the maximum limit of 2 times. The updated two-way window queue and counter are as follows Figure 7 shown.
[0126] For another example, when judging whether candidate product 6 meets the breakup rule, for example, the product identifier of candidate product 6 generated according to the target attribute parameters of the breakup rule is: Brand 1_Model 1. Since the product identifier of candidate product 5 (Brand 1_Model 1) has appeared twice in the two-way window queue, reaching the maximum number of times, and the number of product identifiers currently stored in the two-way window queue has reached the maximum number, the product identifier of candidate product 6 (Brand 1_Model 1) is inconsistent with the product identifier (Brand 2_Model 2) stored at the head of the two-way window queue. Therefore, candidate product 6 does not meet the breakup rule, and candidate product 6 is added to the waiting queue.
[0127] The next candidate product in the candidate product list is determined in sequence until a candidate product that meets the restriction conditions is found. The candidate product that meets the restriction conditions is deleted from the candidate product list, added to the recommendation queue, and the product identifier of the candidate product that meets the restriction conditions is updated in the two-way window queue associated with each scattering rule.
[0128] For example, continue to determine whether candidate product 7 meets the breakup rule. According to the target attribute parameters of the breakup rule, the product identifier of candidate product 7 is generated as: brand 3_model 3. Since the product identifier (brand 3_model 3) of candidate product 7 only appears once in the two-way window queue, which does not reach the maximum number of times of 2, and since the number of product identifiers currently stored in the two-way window queue has reached the maximum number, the product identifier (brand 3_model 3) of candidate product 7 can be added to the end of the two-way window queue, and the product identifier (brand 2_model 2) of candidate product 2 stored at the head of the two-way window queue is deleted. The arrangement of the product identifiers stored in the two-way window queue is updated as follows: the product identifier (brand 1_model 1) of candidate product 3, the product identifier (brand 3_model 3) of candidate product 4, the product identifier (brand 1_model 1) of candidate product 5, and the product identifier (brand 3_model 3) of candidate product 7. The counter corresponding to the two-way window queue is also updated accordingly. The counter increases the count by 1 for the newly added product identifier (brand 3_model 3) and decreases the count by 1 for the deleted product identifier (brand 2_model 2). That is, the corresponding counter update quantity is: the number of product identifiers (brand 1_model 1) is 2, and the number of product identifiers (brand 3_model 3) is 2.
[0129] Then, before adding the candidate products in the waiting queue to the front end of the candidate product list, that is, adding candidate product 6 in the waiting queue to the front end of the candidate product list, it is determined again in sequence whether the number of occurrences of any product identifier of each candidate product in the candidate product list in the bidirectional window queue associated with the corresponding scatter rule meets the restriction condition, that is, it can be preferentially determined whether candidate product 6 in the candidate product list meets the restriction condition.
[0130] That is, when it is determined that the number of commodity identifiers currently stored in the two-way window queue has reached the maximum number, as long as the number of times the commodity identifier of the candidate commodity appears in the two-way window queue has not reached the maximum number, or the commodity identifier of the candidate commodity is consistent with the commodity identifier at the head of the two-way window queue, then the candidate commodity can be considered to meet the scattering rule. That is, the program can determine whether the number of times the commodity identifier of the candidate commodity appears in the two-way window queue has reached the maximum number and whether the commodity identifier of the candidate commodity is inconsistent with the commodity identifier at the head of the two-way window queue. If not, it can be added to the recommendation queue. If so, it is added to the waiting queue. Exemplarily, the pseudo code for determining whether a candidate commodity can be added to the recommendation queue is as follows:
[0131]
[0132] In addition, after adding the candidate products to the recommendation queue, the bidirectional window queue and counter need to be updated accordingly. For example, the pseudo code is as follows:
[0133]
[0134] If the candidate product list is empty and the number of candidate products in the recommendation queue has not reached the target recommendation number, the candidate products in the waiting queue will be added to the recommendation queue until the number of candidate products in the recommendation queue reaches the target recommendation number; the candidate products in the recommendation queue will be recommended to the user.
[0135] See also Figure 8 and Fig. 9 , Figure 8 A schematic diagram of the structure of a data processing device for commodity recommendation provided in an embodiment of the present application, Fig. 9 Another structural diagram of a data processing device for product recommendation provided in an embodiment of the present application. The data processing device 300 for product recommendation may include a first acquisition module 301 , a second acquisition module 302 , a generation module 303 , a judgment module 304 and a recommendation module 305 .
[0136] The first acquisition module 301 is used to: acquire a candidate commodity list, where the candidate commodity list includes a plurality of candidate commodities;
[0137] The second acquisition module 302 is used to: acquire at least one scattering rule, each scattering rule includes a set of target attribute parameters, and create a bidirectional window queue bidirectional window queue for each scattering rule;
[0138] The generating module 303 is used to: generate corresponding commodity identifiers for candidate commodities according to the target attribute parameters of the scattering rule, and obtain at least one commodity identifier of the candidate commodity;
[0139] The judgment module 304 is used to: judge whether the number of occurrences of any commodity identifier of the candidate commodity in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition, and the bidirectional window queue is used to store the commodity identifiers of the candidate commodities recommended to the user;
[0140] The recommendation module 305 is used to recommend the candidate commodity to the user if the restriction condition is met, and update the commodity identifier of the candidate commodity into the bidirectional window queue associated with each scattering rule.
[0141] In one embodiment, the target attribute parameters include attribute fields and / or attribute conditions, and the generation module 303 can be used to: extract the parameter values of the attribute fields corresponding to the candidate products, and / or obtain the logical values of the attribute conditions corresponding to the candidate products; and obtain the product identifier corresponding to the candidate products based on the parameter values and / or logical values.
[0142] In one embodiment, a counter is created for each scattering rule to count the number of times each product identifier appears in the bidirectional window queue associated with the scattering rule. The judgment module 304 can be used to: obtain the number of times any product identifier of the candidate product appears in the counter of the bidirectional window queue associated with the corresponding scattering rule; determine whether the number reaches the maximum number of times the product identifier defined in the corresponding scattering rule is allowed to appear in the bidirectional window queue; if the maximum number is not reached, recommend the candidate product to the user.
[0143] In one embodiment, the judgment module 304 can be used to: if the maximum number of times is reached, then determine whether the number of product identifiers stored in the two-way window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule; if the maximum number is reached, then determine whether the product identifier of the candidate product is consistent with the product identifier stored at the head of the two-way window queue; if they are consistent, then recommend the candidate product to the user.
[0144] In one embodiment, the recommendation module 305 can be used to: if the number of commodity identifiers stored in the two-way window queue does not reach the maximum number that can be stored as defined in the corresponding scattering rule, then the commodity identifiers of the candidate commodities are added to the two-way window queue in order, and the count of the newly added commodity identifiers is increased by 1 in the corresponding counter; if the number of commodity identifiers stored in the two-way window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule, then the commodity identifiers stored at the head of the two-way window queue are deleted, and the commodity identifiers of the candidate commodities are added to the tail of the two-way window queue, and the count of the newly added commodity identifiers is increased by 1 in the counter, and the count of the deleted commodity identifiers is decreased by 1.
[0145] In one embodiment, the recommendation module 305 can be used to: delete the candidate product from the candidate product list and add it to the recommendation queue; the judgment module 304 can be used to: if the restriction condition is not met, then delete the candidate product from the candidate product list and add it to the waiting queue; judge the next candidate product in the candidate product list in sequence until a candidate product that meets the restriction condition is found, delete the candidate product that meets the restriction condition from the candidate product list, add it to the recommendation queue, and update the product identifier of the candidate product that meets the restriction condition into each bidirectional window queue associated with the scattering rule; add the candidate product in the waiting queue to the front end of the candidate product list, and again judge in sequence whether the number of occurrences of any product identifier of each candidate product in the candidate product list in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition.
[0146] In one embodiment, the recommendation module 305 can be used to: if the candidate product list is empty and the number of candidate products in the recommendation queue has not reached the target recommendation number, then the candidate products in the waiting queue will be added to the recommendation queue until the number of candidate products in the recommendation queue reaches the target recommendation number; and the candidate products in the recommendation queue will be recommended to the user.
[0147] In one embodiment, the first acquisition module 301 can be used to: in response to a received candidate product scattering request, obtain a candidate product list and request parameters carried in the scattering request; the second acquisition module 302 can be used to: filter pre-defined scattering rules according to the candidate product list and request parameters to obtain at least one scattering rule that matches the scattering request.
[0148] In one embodiment, the data processing device 300 for product recommendation is also associated with an initialization module 306. The initialization module 306 is used to read a rule configuration file, in which a plurality of break-up rules are defined. The break-up rules are parsed and some preprocessing work is performed to ensure the validity of the break-up rules, such as removing invalid and redundant break-up rules, which can reduce the processing burden. For example, with respect to the uniqueness index of the break-up rule, the attribute fields and / or attribute conditions in the uniqueness index are sorted to ensure that each subsequent candidate product can generate a corresponding product identifier in this order, thereby simplifying the subsequent parsing and application of the break-up rule and improving the efficiency of the algorithm.
[0149] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed on a computer, the computer executes the process in the data processing method for product recommendation provided in the present embodiment.
[0150] The present application also provides an electronic device, including a memory and a processor, wherein the processor is used to execute the process in the data processing method for product recommendation provided in the present embodiment by calling a computer program stored in the memory. For example, the electronic device may be a mobile terminal such as a tablet computer or a smart phone. Fig.10 , Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0151] The electronic device 400 may include components such as a memory 402 and a processor 401. Those skilled in the art will appreciate that Figure 5 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0152] The memory 402 may be used to store applications and data. The applications stored in the memory 402 include executable codes. The applications may be composed of various functional modules. The processor 401 executes various functional applications and data processing by running the applications stored in the memory 402. The processor 401 is electrically connected to the memory 402.
[0153] The processor 401 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or executing applications stored in the memory 402 and calling data stored in the memory 402, thereby monitoring the electronic device as a whole.
[0154] In this embodiment, the processor 401 in the electronic device loads the executable code corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application program stored in the memory 402, thereby executing:
[0155] Obtain a candidate product list, the candidate product list including multiple candidate products;
[0156] Obtain at least one scatter rule, each scatter rule including a set of target attribute parameters, and create a bidirectional window queue for each scatter rule;
[0157] Generate a corresponding commodity identifier for the candidate commodity according to the target attribute parameter of the scattering rule, and obtain at least one commodity identifier of the candidate commodity;
[0158] Determine whether the number of occurrences of any product identifier of the candidate product in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition, and the bidirectional window queue is used to store the product identifiers of the candidate products recommended to the user;
[0159] If the restriction conditions are met, the candidate product is recommended to the user, and the product identifier of the candidate product is updated into the bidirectional window queue associated with each scattering rule.
[0160] See also Fig.11 , Fig.11 Another structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 400 further includes components such as a radio frequency circuit 403, a display screen 404, a control circuit 405, an input unit 406, an audio circuit 407, a sensor 408, and a power supply 409. The processor 401 is electrically connected to the radio frequency circuit 403, the display screen 404, the control circuit 405, the input unit 406, the audio circuit 407, the sensor 408, and the power supply 409, respectively.
[0161] The radio frequency circuit 403 is used to send and receive radio frequency signals to communicate with network devices or other electronic devices through wireless communication.
[0162] The display screen 404 may be used to display information input by a user or information provided to a user and various graphical user interfaces of the electronic device. These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.
[0163] The control circuit 405 is electrically connected to the display screen 404 and is used to control the display screen 404 to display information.
[0164] The input unit 406 can be used to receive input numbers, character information or user feature information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. The input unit 406 can include a fingerprint recognition module.
[0165] The audio circuit 407 can provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 407 includes a microphone. The microphone is electrically connected to the processor 401. The microphone is used to receive voice information input by the user.
[0166] The sensor 408 is used to collect external environment information. The sensor 408 may include one or more sensors such as an environment brightness sensor, an acceleration sensor, and a gyroscope.
[0167] The power supply 409 is used to supply power to various components of the electronic device 400. In some embodiments, the power supply 409 may be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, power consumption, and other functions.
[0168] Although not shown in the figure, the electronic device 400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0169] In this embodiment, the processor 401 in the electronic device 400 will load the executable code corresponding to the process of one or more applications into the memory 402 according to the following instructions, and the processor 401 will run the application stored in the memory 402 to execute:
[0170] Obtain a candidate product list, the candidate product list including multiple candidate products;
[0171] Obtain at least one scatter rule, each scatter rule including a set of target attribute parameters, and create a bidirectional window queue for each scatter rule;
[0172] Generate a corresponding commodity identifier for the candidate commodity according to the target attribute parameter of the scattering rule, and obtain at least one commodity identifier of the candidate commodity;
[0173] Determine whether the number of occurrences of any product identifier of the candidate product in the bidirectional window queue associated with the corresponding scattering rule meets the restriction condition, and the bidirectional window queue is used to store the product identifiers of the candidate products recommended to the user;
[0174] If the restriction conditions are met, the candidate product is recommended to the user, and the product identifier of the candidate product is updated into the bidirectional window queue associated with each scattering rule.
[0175] In one embodiment, the target attribute parameters include attribute fields and / or attribute conditions. In generating a corresponding product identifier for a candidate product based on the target attribute parameters of a scattering rule, the processor 401 executes: extracting the parameter value of the attribute field corresponding to the candidate product, and / or obtaining the logical value of the attribute condition corresponding to the candidate product; and obtaining the product identifier corresponding to the candidate product based on the parameter value and / or the logical value.
[0176] In one embodiment, a counter is created for each scatter rule to count the number of times each product identifier appears in the bidirectional window queue associated with the scatter rule. When determining whether the number of times any product identifier of a candidate product appears in the bidirectional window queue associated with the corresponding scatter rule satisfies a restriction, if so, the candidate product is recommended to the user. The processor 401 executes: obtaining the number of times any product identifier of a candidate product appears in the counter of the bidirectional window queue associated with the corresponding scatter rule; determining whether the number reaches the maximum number of times a product identifier defined in the corresponding scatter rule is allowed to appear in the bidirectional window queue; if not, recommending the candidate product to the user.
[0177] In one embodiment, after determining whether the number of times reaches the maximum number of times a product identifier defined in the corresponding scatter rule is allowed to appear in the two-way window queue, the processor 401 executes: if the maximum number is reached, determining whether the number of product identifiers stored in the two-way window queue reaches the maximum number that can be stored defined in the corresponding scatter rule; if the maximum number is reached, determining whether the product identifier of the candidate product is consistent with the product identifier stored at the head of the two-way window queue; if they are consistent, recommending the candidate product to the user.
[0178] In one embodiment, the product identifiers of the candidate products are updated into the bidirectional window queues associated with each scatter rule, and the processor 401 executes: if the number of product identifiers stored in the bidirectional window queue does not reach the maximum number that can be stored as defined in the corresponding scatter rule, the product identifiers of the candidate products are added to the bidirectional window queue in order, and the count of the newly added product identifiers is increased by 1 in the corresponding counter; if the number of product identifiers stored in the bidirectional window queue reaches the maximum number that can be stored as defined in the corresponding scatter rule, the product identifiers stored at the head of the bidirectional window queue are deleted, the product identifiers of the candidate products are added to the tail of the bidirectional window queue, and the count of the newly added product identifiers is increased by 1 in the counter, and the count of the deleted product identifiers is decreased by 1.
[0179] In one embodiment, when recommending candidate products to users, the processor 401 executes: deleting the candidate product from the candidate product list and adding it to the recommendation queue; after determining whether the number of occurrences of any product identifier of the candidate product in the two-way window queue associated with the corresponding scattering rule meets the restriction condition, the method further includes: if the restriction condition is not met, deleting the candidate product from the candidate product list and adding it to the waiting queue; determining the next candidate product in the candidate product list in sequence until a candidate product that meets the restriction condition is found, deleting the candidate product that meets the restriction condition from the candidate product list, adding it to the recommendation queue, and updating the product identifier of the candidate product that meets the restriction condition into each two-way window queue associated with the scattering rule; adding the candidate product in the waiting queue to the front end of the candidate product list, and determining again in sequence whether the number of occurrences of any product identifier of each candidate product in the candidate product list in the two-way window queue associated with the corresponding scattering rule meets the restriction condition.
[0180] In one embodiment, when recommending candidate products to a user, the processor 401 executes: if the candidate product list is empty and the number of candidate products in the recommendation queue has not reached the target recommendation number, the candidate products in the waiting queue are added to the recommendation queue until the number of candidate products in the recommendation queue reaches the target recommendation number; and the candidate products in the recommendation queue are recommended to the user.
[0181] In one embodiment, in obtaining a list of candidate products, the processor 401 executes: in response to a received request to scatter candidate products, obtaining a list of candidate products and request parameters carried in the scatter request; in obtaining at least one scatter rule, the processor 401 executes: filtering predefined scatter rules according to the list of candidate products and the request parameters to obtain at least one scatter rule that matches the scatter request.
[0182] In the above embodiments, the description of each embodiment has its own focus. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the data processing method for product recommendation above, which will not be repeated here.
[0183] The data processing device for commodity recommendation provided in the embodiment of the present application and the data processing method for commodity recommendation in the above embodiment belong to the same concept. Any method provided in the embodiment of the data processing method for commodity recommendation can be run on the data processing device for commodity recommendation. The specific implementation process is detailed in the embodiment of the data processing method for commodity recommendation, which will not be repeated here. For the data processing device for commodity recommendation in the embodiment of the present application, its various functional modules can be integrated in a processing chip, or each module can exist physically separately, or two or more modules can be integrated in one module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk.
[0184] It should be noted that, for the data processing method for product recommendation in the embodiment of the present application, a person of ordinary skill in the art can understand that all or part of the process of implementing the data processing method for product recommendation in the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, such as a memory, and executed by at least one processor, and the execution process may include the process of the embodiment of the data processing method for product recommendation. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM, Read Only Memory), a random access memory (RAM, Random Access Memory), etc.
[0185] The above is a detailed introduction to the data processing method, device, storage medium and electronic device for product recommendation provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.< / object>
Claims
1. A data processing method for commodity recommendation, characterized in that: include: Obtaining a candidate commodity list, wherein the candidate commodity list includes a plurality of candidate commodities; Obtain at least one scatter rule, each of which includes a set of target attribute parameters, and create a bidirectional window queue for each scatter rule; generating corresponding commodity identifiers for the candidate commodities according to the target attribute parameters of the scattering rule, and obtaining at least one commodity identifier for the candidate commodities; Determine whether the number of occurrences of any of the commodity identifiers of the candidate commodities in a bidirectional window queue associated with a corresponding scattering rule satisfies a restriction condition, wherein the bidirectional window queue is used to store commodity identifiers of the candidate commodities recommended to the user; If the restriction condition is met, the candidate commodity is recommended to the user, and the commodity identifier of the candidate commodity is updated into the bidirectional window queue associated with each of the scattering rules.
2. The method according to claim 1, characterized in that The target attribute parameter includes an attribute field and / or an attribute condition, and the generating a corresponding commodity identifier for a candidate commodity according to the target attribute parameter of the scattering rule includes: Extracting the parameter value of the attribute field corresponding to the candidate product, and / or obtaining the logical value of the attribute condition corresponding to the candidate product; The commodity identifier corresponding to the candidate commodity is obtained according to the parameter value and / or the logic value.
3. The method according to claim 1, characterized in that A counter is created for each of the scattering rules to count the number of occurrences of each product identifier in the bidirectional window queue associated with the scattering rule, and the determining whether the number of occurrences of any product identifier of the candidate product in the bidirectional window queue associated with the corresponding scattering rule satisfies a restriction condition, and if the restriction condition is satisfied, recommending the candidate product to the user comprises: Obtaining the number of times any of the commodity identifiers of the candidate commodities appear in the counter associated with the corresponding scattering rule; Determine whether the number of times reaches the maximum number of times the product identifier is allowed to appear in the bidirectional window queue as defined in the corresponding scattering rule; If the maximum number of times is not reached, the candidate product is recommended to the user.
4. The method according to claim 3, characterized in that After determining whether the number of times reaches the maximum number of times the commodity identifier is allowed to appear in the bidirectional window queue as defined in the corresponding scattering rule, the method further includes: If the maximum number of times is reached, determining whether the number of commodity identifiers stored in the bidirectional window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule; If the maximum number is reached, determining whether the commodity identifier of the candidate commodity is consistent with the commodity identifier stored at the head of the queue in the bidirectional window queue; If they are consistent, the candidate product is recommended to the user.
5. The method according to claim 3 or 4, characterized in that: The updating of the commodity identifier of the candidate commodity into the bidirectional window queue associated with each of the scattering rules comprises: If the number of commodity identifiers stored in the bidirectional window queue does not reach the maximum number that can be stored as defined in the corresponding scattering rule, the commodity identifiers of the candidate commodities are added to the bidirectional window queue in order, and the count of the newly added commodity identifiers is increased by 1 in the corresponding counter; If the number of commodity identifiers stored in the two-way window queue reaches the maximum number that can be stored as defined in the corresponding scattering rule, the commodity identifier stored at the head of the two-way window queue is deleted, and the commodity identifier of the candidate commodity is added to the tail of the two-way window queue, and the count of the newly added commodity identifier is increased by 1 in the corresponding counter, and the count of the deleted commodity identifier is reduced by 1.
6. The method according to claim 1, characterized in that The candidate products are recommended to the user including: Deleting the candidate product from the candidate product list and adding it to the recommendation queue; After determining whether the number of occurrences of any of the commodity identifiers of the candidate commodities in the bidirectional window queue associated with the corresponding scattering rule meets a restriction condition, the method further includes: If the restriction condition is not met, the candidate product is deleted from the candidate product list and added to the waiting queue; Determine the next candidate product in the candidate product list in order until a candidate product that meets the restriction condition is found, delete the candidate product that meets the restriction condition from the candidate product list, add it to the recommendation queue, and update the product identifier of the candidate product that meets the restriction condition into the two-way window queue associated with each of the scattering rules; The candidate products in the waiting queue are added to the front of the candidate product list, and the occurrence times of any product identifier of each candidate product in the candidate product list in the bidirectional window queue associated with the corresponding scattering rule are determined again in order to see whether they meet the restriction condition.
7. The method according to claim 6, characterized in that The recommending the candidate products to the user comprises: If the candidate commodity list is empty and the number of candidate commodities in the recommendation queue does not reach the target recommendation number, the candidate commodities in the waiting queue are added to the recommendation queue until the number of candidate commodities in the recommendation queue reaches the target recommendation number; The candidate commodities in the recommendation queue are recommended to the user.
8. The method according to claim 1, characterized in that The obtaining of the candidate commodity list comprises: In response to the received candidate commodity scattering request, obtaining the candidate commodity list and request parameters carried in the scattering request; The obtaining of at least one scattering rule comprises: The predefined scattering rules are filtered according to the candidate commodity list and the request parameters to obtain at least one scattering rule matching the scattering request.
9. A data processing device for commodity recommendation, characterized in that: The device comprises: A first acquisition module is used to acquire a candidate commodity list, wherein the candidate commodity list includes a plurality of candidate commodities; A second acquisition module is used to acquire at least one scattering rule, each of which includes a set of target attribute parameters, and create a bidirectional window queue for each scattering rule; A generating module, configured to generate a corresponding commodity identifier for the candidate commodity according to the target attribute parameter of the scattering rule, and obtain at least one commodity identifier of the candidate commodity; a judgment module, used to judge whether the number of occurrences of any of the commodity identifiers of the candidate commodities in the bidirectional window queue associated with the corresponding scattering rule meets a restriction condition, wherein the bidirectional window queue is used to store the commodity identifiers of the candidate commodities recommended to the user; The recommendation module is used to recommend the candidate commodity to the user if the restriction condition is met, and update the commodity identifier of the candidate commodity into the bidirectional window queue associated with each of the scattering rules.
10. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 8 is implemented.
