A customer tag circle method and system
By constructing tag collection expressions using tag set operators and parsing reusable operators to generate SQL statements, the problem of high technical dependence in customer tag collection methods is solved. This enables flexible operation by business personnel and efficient utilization of computing resources, thereby reducing costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 重庆富民银行股份有限公司
- Filing Date
- 2026-02-28
- Publication Date
- 2026-06-02
AI Technical Summary
Existing customer tagging methods rely heavily on technical personnel, making it difficult for business staff to independently complete complex tagging needs. Furthermore, computing resources cannot be effectively reused, resulting in high costs.
The system uses label set operators (intersection, union, difference) to construct the encirclement expression, identifies reusable operators through postfix expression parsing, generates structured query language statements, and executes them in parallel using a real-time computing task scheduling system.
It lowers the technical threshold, enabling business personnel to flexibly adjust the criteria for identifying users, improve response speed, achieve effective reuse of computing resources, reduce costs, and support complex business logic and large-scale data scenarios.
Smart Images

Figure CN122132628A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing, and in particular relates to a method and system for customer tagging. Background Technology
[0002] In business scenarios such as precision marketing and personalized recommendations, companies typically need to analyze and mine massive amounts of customer data to tag customers across various dimensions. Based on these customer tags, business personnel can perform "targeting," that is, filtering customer groups from the customer database that meet specific marketing criteria in order to conduct subsequent targeted marketing campaigns.
[0003] Currently, the main methods for customer tagging and segmentation include: 1. Based on the programming implementation of Structured Query Language (SQL), technicians write complex SQL statements to perform multi-table joins and conditional filtering on the customer database to obtain the target audience; however, this method requires extremely high technical skills from the operator, and business personnel have difficulty participating directly, resulting in a gap between requirements communication and technical implementation, and low efficiency in target audience acquisition.
[0004] 2. Based on preset simple tag combinations, the system provides a limited number of drop-down menus or checkboxes, allowing users to select a small number of tags for filtering. Although this method is simple to operate, it can only support combinations of simple logic such as "AND" and "OR", and cannot express the needs of segmenting users that include complex business logic such as nesting and priority, and lacks general business applicability. Summary of the Invention
[0005] This invention provides a customer tagging and targeting method and system, which solves the problems in the prior art where customer tagging and targeting operations are highly dependent on technical personnel, business personnel cannot independently complete complex targeting needs, and computing resources cannot be effectively reused, resulting in high costs.
[0006] This invention provides a basic solution: a customer tagging method, which specifically includes the following steps: S1: Obtain the tagging expression, which consists of a label and set operators, including the intersection operator, the union operator, and the difference operator; S2: Convert the circle expression to a postfix expression; S3: Parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators; S4: Generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operators are generated. S5: Perform the task of identifying the target audience to obtain a list of potential members.
[0007] Preferably, it also includes S0: extracting the corresponding population identifiers of each label from the data source according to the pre-configured label metadata, and forming a label-population identifier set mapping relationship.
[0008] More preferably, S0 comprises: Configure the metadata information for each tag, which includes the tag name, data source database name, data source table name, data source field name, field type, and value range; Based on the metadata information, execute a single-table query statement to extract the population identifiers that meet the tag conditions from the corresponding data table; The extracted set of crowd identifiers is stored in a preset format.
[0009] Preferably, S3 includes: S3-1) Decompose the postfix form of the circle expression into a series of basic operators, each of which corresponds to a triplet operation consisting of two label identifiers and a set operator; S3-2) Perform string equality comparisons between each basic operator of the current expression and all basic operators of the historical expressions; S3-3) For basic operators that are equal to strings, further determine whether the historical calculation results of the basic operator are within the preset validity period; S3-4) Identify basic operators that are equal in string and within their validity period as common operators and mark them as reusable operators.
[0010] Preferably, S4 includes: S4-1) Establish the mapping relationship between set operators and structured query language keywords, where the intersection operator is mapped to INNER JOIN or INTERSECT, the union operator is mapped to UNION, and the difference operator is mapped to LEFT JOIN ISNULL or EXCEPT. S4-2) A stack data structure is used to traverse the postfix expression. When a label is encountered, if the basic operator corresponding to the label is marked as reusable, the name of the historical calculation result table of the basic operator is pushed onto the stack; if it is not marked as reusable, the name of the original data table corresponding to the label is pushed onto the stack; when an operator is encountered, the corresponding number of operands are popped from the stack, the corresponding SQL fragment is generated according to the mapping relationship, and the generated SQL fragment is pushed back onto the stack as a new operand. (S4-3) After the traversal is complete, the top element of the stack is the complete structured query language statement.
[0011] Preferably, S5 includes: S5-1) When the task of identifying people contains multiple subtasks, the subtasks with no dependencies are submitted to the real-time computing task scheduling system for parallel execution. Execute dependent subtasks in sequence according to their dependencies; S5-2) Merge the execution results of all subtasks according to the logic of the original target audience expression to obtain the final target audience list.
[0012] This invention provides a basic solution: a customer tagging and segmentation system, comprising: The customer data platform includes an expression acquisition module, an expression conversion module, a reuse recognition module, and a task generation module; The expression acquisition module is used to acquire the tagging expression, which consists of a label and set operators, including the intersection operator, the union operator and the difference operator. The expression conversion module is used to convert the tagging expression into a postfix expression; The reuse identification module is used to parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators. The task generation module is used to generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operator are generated. A real-time computing task scheduling system executes segmentation tasks to obtain a list of target customer groups.
[0013] Preferably, the customer data platform further includes a tag management module, which is used to extract the corresponding audience identifiers of each tag from the data source according to the pre-configured tag metadata, and form a tag-audience identifier set mapping relationship.
[0014] Preferably, the task generation module includes: The mapping unit is used to establish the mapping relationship between set operators and structured query language keywords; The traversal unit is used to traverse the postfix form of the group expression using a stack data structure and generate the corresponding structured query language fragments based on the mapping relationship. The reuse processing unit is used to directly reference the historical calculation result table of basic operators marked as reusable when generating structured query language statements; The task splitting unit is used to split the person-circling task into multiple subtasks when the person-circling expression contains multiple independently computable basic operators, and to establish the dependency relationship between the subtasks.
[0015] The principles and advantages of this invention are as follows: 1. By abstracting complex SQL queries into tag set operations, business personnel can construct targeting expressions simply by selecting tags and choosing intersection, union, and difference operators, without having to write SQL code or understand database structures. Compared with existing SQL programming methods, this invention eliminates the communication gap between business and technology, enabling business personnel to adjust targeting conditions in real time according to marketing strategies. This not only significantly lowers the technical threshold but also greatly improves response speed and flexibility.
[0016] 2. By using a common operator identification mechanism, the current expression is decomposed into basic operators and compared with historical expressions. After identifying reusable operators, their historical calculation results are directly referenced, realizing the effective reuse of computing resources. This is suitable for business scenarios with large task scale and large customer data volume, and the resource saving effect is more significant, directly reducing the enterprise's computing and storage costs.
[0017] 3. Set operators include intersection, union, and difference. By combining these three basic operations with the control of parenthesis precedence, arbitrarily complex business logic can be expressed. Compared with the existing technology that only supports simple tag combinations, this invention can meet the needs of audience targeting in various complex business scenarios such as precision marketing, customer segmentation, churn warning, and cross-selling. It can flexibly support both composite filtering with multiple conditions and audience targeting with exclusion logic, truly achieving universal applicability to business.
[0018] 4. The generated structured query language statements are executed using a real-time computing task scheduling system, which supports distributed computing and horizontal scaling. By splitting the person-catching expression into multiple subtasks and scheduling them in parallel according to dependencies, the system makes full use of distributed computing resources and significantly shortens the execution time of complex person-catching tasks. Attached Figure Description
[0019] Figure 1 This is a flowchart of the present invention; Figure 2 This is a system block diagram of the present invention. Detailed Implementation
[0020] The following detailed description illustrates the specific implementation method: The specific implementation process is as follows: Example 1 See Figure 1 A customer tagging and segmentation method, specifically including the following steps: S0: Based on the pre-configured tag metadata, extract the corresponding audience identifiers for each tag from the data source to form a tag-audience identifier set mapping relationship.
[0021] Specifically, S0 includes: Configure the metadata information for each tag, which includes the tag name, data source database name, data source table name, data source field name, field type, and value range; Based on the metadata information, execute a single-table query statement to extract the population identifiers that meet the tag conditions from the corresponding data table; The extracted set of crowd identifiers is stored in a preset format.
[0022] S1: Obtain the tagging expression, which consists of a tag identifier and set operators, including the intersection operator, the union operator, and the difference operator.
[0023] Marketers can use the visualization interface provided by the customer data platform to construct targeting expressions by selecting tags and operators. If a marketer needs to target "customers who are over 25 years old and have purchased electronic products, or customers with a gold membership level", they can construct the expression: (tag_001 ∩ tag_002) ∪ tag_003, where tag_001 represents those over 25 years old, tag_002 represents those who have purchased electronic products, and tag_003 is the identifier for the tag "gold membership level".
[0024] S2: Convert the circle expression to a postfix expression.
[0025] Specifically, the expression constructed by the front end is converted into a postfix expression, and the matching relationship between operators and operands is checked during the conversion process. If there are missing operands or mismatched parentheses, the expression is deemed invalid and an error message is generated. In this embodiment, the converted postfix expression is tag_001 tag_002 ∩ tag_003 ∪.
[0026] S3: Parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators.
[0027] Specifically, S3-1) decomposes the postfix form of the circle expression into a series of basic operators, each of which corresponds to a triplet operation consisting of two label identifiers and a set operator; S3-2) Perform string equality comparisons between each basic operator of the current expression and all basic operators of the historical expressions; S3-3) For basic operators that are equal to strings, further determine whether the historical calculation results of the basic operator are within the preset validity period; S3-4) Identify basic operators that are equal in string and within their validity period as common operators and mark them as reusable operators.
[0028] In this embodiment, the basic operator obtained after decomposition is: Operator 1: tag_001 ∩ tag_002 (corresponding to the intersection operation of sets); Operator 2: The result of (tag_001 ∩ tag_002) ∪ tag_003 (corresponding to the set union operation); Assume the following tagging tasks exist in the history: Task History 1: The expression tag_001 ∩ tag_002 generates a crowd of people, crowd_001; Task History 2: Expression tag_004 ∪ tag_005, generates crowd_002; The operator 1tag_001 ∩ tag_002 in the current expression is compared with the historical basic operators for string equality. It is found that it completely matches the expression of task history 1. Then, the generation time of the historical calculation result crowd_001 of the matching operator tag_001 ∩ tag_002 is queried. It is found that the system preset validity period is 7 days. crowd_001 was generated 3 days ago and is still within the validity period. Therefore, the operator tag_001 ∩ tag_002 is marked as a reusable operator and associated with its historical calculation result crowd_001; the result of operator 2 (tag_001 ∩ tag_002) ∪ tag_003 is marked as non-reusable because it involves the unique logic of the current expression.
[0029] S4: Generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operators are generated.
[0030] S4 also includes: When a postfix expression contains multiple independently computable basic operators, the task of identifying people is split into multiple subtasks, and each subtask corresponds to the computation of one or more basic operators. Establish dependencies between multiple subtasks, where if the computation of subtask B depends on the computation result of subtask A, then subtask A is a prerequisite task for subtask B.
[0031] Specifically, S4-1) Establish the mapping relationship between set operators and structured query language keywords, where the intersection operator is mapped to INNER JOIN or INTERSECT, the union operator is mapped to UNION, and the difference operator is mapped to LEFT JOIN ISNULL or EXCEPT. S4-2) A stack data structure is used to traverse the postfix expression. When a label is encountered, if the basic operator corresponding to the label is marked as reusable, the name of the historical calculation result table of the basic operator is pushed onto the stack; if it is not marked as reusable, the name of the original data table corresponding to the label is pushed onto the stack; when an operator is encountered, the corresponding number of operands are popped from the stack, the corresponding SQL fragment is generated according to the mapping relationship, and the generated SQL fragment is pushed back onto the stack as a new operand. (S4-3) After the traversal is complete, the top element of the stack is the complete structured query language statement.
[0032] In this embodiment, based on the parsing result of step S3 and combined with the target user generation strategy of step S4, the final structured query language statement is obtained as follows: SELECT user_id FROM ( SELECT user_id FROM crowd_001 UNION SELECT user_id FROM set_tag_003 AS final_crowd.
[0033] S5: Perform the task of identifying the target audience to obtain a list of potential members.
[0034] S5 includes: S5-1) When the task of identifying people contains multiple subtasks, the subtasks with no dependencies are submitted to the real-time computing task scheduling system for parallel execution. Execute dependent subtasks in sequence according to their dependencies; S5-2) Merge the execution results of all subtasks according to the logic of the original target audience expression to obtain the final target audience list.
[0035] In this embodiment, based on the SQL generated in step S4, the historical calculation result table crowd_001 is first read (this table already exists and does not need to be calculated), and then the tag set set_tag_003 is read; a UNION operation is performed to merge the two sets to obtain a list of users containing two types of users: Users aged 25 and older who have purchased electronic products; Users with a Gold membership level; This audience list is stored in a database and used to return it to marketers for subsequent marketing campaigns.
[0036] Preferably, it also includes S6: pushing the target audience list to the target business system.
[0037] This includes 6-1) Exporting the generated target audience list to a specified format according to business needs and pushing it to the target business system; 6-2) Associate the audience with specific marketing campaigns; that is, record information such as which marketing campaign the audience participated in, the start and end times of the campaign, and the campaign's results. 6-3) Collect marketing campaign performance data and analyze the response of different groups to provide data support for the optimization of the tag system. For example, if the conversion rate of a certain group is consistently low, it may be necessary to adjust the corresponding tag definition or weight.
[0038] More preferably, the system also includes recording the generation information of the population, including input expressions, basic operators used, and referenced historical results, forming a population lineage relationship for reuse in subsequent tasks. Specifically, firstly, by recording the execution process of each population-identifying task, the recorded content includes input (which label sets and common operators were used), output (which new population set was generated), and execution process (the execution order of each operator and the computational resources consumed), a complete population lineage relationship graph is formed. Then, the above lineage relationships are persistently stored in the form of a graph database or relational table, supporting traceability queries by population, label, time, and other dimensions. Furthermore, when a new population-identifying task is submitted, the system can further optimize the task scheduling strategy based on the existing lineage relationships. For example, if a population set already exists and the label data has not been updated, the existing results can be returned directly; if the label data has been updated, the lineage relationships can be used to accurately locate which populations need to be recalculated.
[0039] Example 2 See Figure 2 The present invention also provides a customer tagging system for running the above-mentioned customer tagging method, comprising: The customer data platform includes an expression acquisition module, an expression conversion module, a reuse recognition module, and a task generation module; The expression acquisition module is used to acquire the tagging expression, which consists of a label and set operators, including the intersection operator, the union operator and the difference operator. The expression conversion module is used to convert the tagging expression into a postfix expression; The reuse identification module is used to parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators. The task generation module is used to generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operator are generated. The task generation module includes: The mapping unit is used to establish the mapping relationship between set operators and structured query language keywords; The traversal unit is used to traverse the postfix form of the group expression using a stack data structure and generate the corresponding structured query language fragments based on the mapping relationship. The reuse processing unit is used to directly reference the historical calculation result table of basic operators marked as reusable when generating structured query language statements; The task splitting unit is used to split the person-circling task into multiple subtasks when the person-circling expression contains multiple independently computable basic operators, and to establish the dependency relationship between the subtasks.
[0040] A real-time computing task scheduling system executes segmentation tasks to obtain a list of target customer groups.
[0041] Preferably, the customer data platform further includes a tag management module, which is used to extract the corresponding audience identifiers of each tag from the data source according to the pre-configured tag metadata, and form a tag-audience identifier set mapping relationship.
[0042] The above are merely embodiments of the present invention. Commonly known structures and characteristics are not described in detail here. Those skilled in the art are aware of all common technical knowledge in the field prior to the application date or priority date, are aware of all existing technologies in that field, and have the ability to apply conventional experimental methods prior to that date. Those skilled in the art can, under the guidance of this application, improve and implement this solution in combination with their own capabilities. Some typical known structures or methods should not be obstacles for those skilled in the art to implement this application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the structure of the present invention. These should also be considered within the scope of protection of the present invention, and will not affect the effectiveness of the implementation of the present invention or the practicality of the patent. The scope of protection claimed in this application should be determined by the content of its claims, and the specific embodiments described in the specification can be used to interpret the content of the claims.
Claims
1. A method for customer tagging and segmentation, characterized in that, Specifically, the following steps are included: S1: Obtain the tagging expression, which consists of a label and set operators, including the intersection operator, the union operator, and the difference operator; S2: Convert the circle expression to a postfix expression; S3: Parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators; S4: Generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operators are generated. S5: Perform the task of identifying the target audience to obtain a list of potential members.
2. The customer tagging method according to claim 1, characterized in that: It also includes S0: Based on the pre-configured tag metadata, extract the corresponding audience identifiers from the data source to form a tag-audience identifier set mapping relationship.
3. The customer tagging method according to claim 2, characterized in that: S0 includes: Configure the metadata information for each tag, which includes the tag name, data source database name, data source table name, data source field name, field type, and value range; Based on the metadata information, execute a single-table query statement to extract the population identifiers that meet the tag conditions from the corresponding data table; The extracted set of crowd identifiers is stored in a preset format.
4. The customer tagging method according to claim 1, characterized in that: S3 includes: S3-1) Decompose the postfix form of the circle expression into a series of basic operators, each of which corresponds to a triplet operation consisting of two label identifiers and a set operator; S3-2) Perform string equality comparisons between each basic operator of the current expression and all basic operators of the historical expressions; S3-3) For basic operators that are equal to strings, further determine whether the historical calculation results of the basic operator are within the preset validity period; S3-4) Identify basic operators that are equal in string and within their validity period as common operators and mark them as reusable operators.
5. The customer tagging method according to claim 1, characterized in that: S4 includes: S4-1) Establish the mapping relationship between set operators and structured query language keywords, where the intersection operator is mapped to INNER JOIN or INTERSECT, the union operator is mapped to UNION, and the difference operator is mapped to LEFT JOIN IS NULL or EXCEPT; S4-2) Use a stack data structure to traverse the postfix expression. When a label is encountered, if the basic operator corresponding to the label is marked as reusable, then push the historical calculation result table name of the basic operator onto the stack. If it is not marked as reusable, the original data table name corresponding to the label is pushed onto the stack; when an operator is encountered, the corresponding number of operands are popped from the stack, the corresponding SQL fragment is generated according to the mapping relationship, and the generated SQL fragment is pushed back onto the stack as a new operand. (S4-3) After the traversal is complete, the top element of the stack is the complete structured query language statement.
6. The customer tagging method according to claim 1, characterized in that: S5 includes: S5-1) When the task of identifying people contains multiple subtasks, the subtasks with no dependencies are submitted to the real-time computing task scheduling system for parallel execution. Execute dependent subtasks in sequence according to their dependencies; S5-2) Merge the execution results of all subtasks according to the logic of the original target audience expression to obtain the final target audience list.
7. A customer tagging and segmentation system, characterized in that, include: The customer data platform includes an expression acquisition module, an expression conversion module, a reuse recognition module, and a task generation module; The expression acquisition module is used to acquire the tagging expression, which consists of a label and set operators, including the intersection operator, the union operator and the difference operator. The expression conversion module is used to convert the tagging expression into a postfix expression; The reuse identification module is used to parse the postfix expression, identify the basic operators in the postfix expression, compare the basic operators of the current expression with the basic operators of the historical expressions, and mark the common operators as reusable operators. The task generation module is used to generate a user identification task based on the parsing result of the postfix expression. The user identification task includes one or more structured query language statements. For basic operators marked as reusable, the historical calculation results of the basic operators are directly referenced when generating structured query language statements. For basic operators not marked as reusable, query statements for the original label data involved in the basic operator are generated. A real-time computing task scheduling system executes segmentation tasks to obtain a list of target customer groups.
8. The customer tagging system according to claim 7, characterized in that, The customer data platform also includes a tag management module, which is used to extract the corresponding audience identifiers of each tag from the data source according to the pre-configured tag metadata, and form a tag-audience identifier set mapping relationship.
9. The customer tagging system according to claim 8, characterized in that, The task generation module includes: The mapping unit is used to establish the mapping relationship between set operators and structured query language keywords; The traversal unit is used to traverse the postfix form of the group expression using a stack data structure and generate the corresponding structured query language fragments based on the mapping relationship. The reuse processing unit is used to directly reference the historical calculation result table of basic operators marked as reusable when generating structured query language statements; The task splitting unit is used to split the person-circling task into multiple subtasks when the person-circling expression contains multiple independently computable basic operators, and to establish the dependency relationship between the subtasks.