An intelligent user tagging system based on natural language processing and a control method thereof

The intelligent user labeling system based on natural language processing solves the problems of slow response and language barriers in existing user labeling schemes, and achieves efficient and intelligent user labeling and system optimization.

CN121900729BActive Publication Date: 2026-06-19ZHOUPU DATA TECH NANJING CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHOUPU DATA TECH NANJING CO LTD
Filing Date
2026-03-24
Publication Date
2026-06-19

Smart Images

  • Figure CN121900729B_ABST
    Figure CN121900729B_ABST
Patent Text Reader

Abstract

This invention provides an intelligent user tagging system and its control method based on natural language processing (NLP). The system includes: a NLP module that receives natural language text input by the user, performs semantic understanding and structured parsing, and outputs structured rule data; a rule conversion module that converts the structured rule data into rule expressions; and a rule execution and feedback module that is data-connected to the rule conversion module to receive and execute the rule expressions to complete user tagging. Based on the feedback dataset of tagging results, the NLP module and rule conversion module are iteratively optimized. This effectively improves readability and agility, completely eliminates language barriers between business personnel and technical implementation, and allows users to quickly define and iterate complex rules by inputting natural language text, greatly enhancing business response speed and innovation capabilities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of user marking, and specifically to an intelligent user marking system and its control method based on natural language processing. Background Technology

[0002] In the field of user profiling and precision marketing, user tagging systems are the core of achieving refined operations. However, current mainstream user tagging technologies have the following significant drawbacks:

[0003] 1) Hard-coded development mode: This mode requires R&D personnel to write SQL or program code to implement the tagging rules. It is slow to respond to business changes, has high communication costs, and cannot adapt to the business needs of rapid iteration.

[0004] 2) Visual Rule Configuration Mode: This mode involves dragging and dropping logic components (such as IF-THEN-ELSE) through a graphical interface. While this mode lowers the technical barrier to entry to some extent, it becomes extremely cumbersome when dealing with complex, nested, and multi-data source related business logic (e.g., "dormant users with higher-than-average purchase frequency and a month-on-month increase in average order value over the past 30 days"). Rule readability and maintainability drop sharply. Furthermore, this mode struggles to support dynamic function calculations and the flexible definition of complex statistical indicators. In addition, while existing visual rule configuration modes can effectively execute complex rules, their use still requires operators to have programming syntax knowledge, failing to fundamentally bridge the semantic gap between natural language expression by business personnel and machine-executable code.

[0005] Therefore, there is an urgent need for an intelligent tagging solution that can understand natural language business intent, automatically generate high-quality execution code, and continuously evolve itself based on actual results. Summary of the Invention

[0006] To address the shortcomings and deficiencies in the existing technology, this invention provides an intelligent user tagging system and its control method based on natural language processing.

[0007] The specific solution provided by this invention is as follows:

[0008] A natural language processing-based intelligent user tagging system, characterized in that: the system includes:

[0009] The natural language processing module receives natural language text input by the user, performs semantic understanding and structured parsing on it, and outputs structured rule data.

[0010] A rule conversion module is connected to a natural language processing module to receive structured rule data and convert the structured rule data into optimized rule expressions.

[0011] The rule execution and feedback module is connected to the rule transformation module to receive and execute optimized rule expressions, and complete user labeling based on the execution results. Then, based on the feedback dataset of the labeling effect, the natural language processing module and the rule transformation module are iteratively optimized.

[0012] As a further preferred embodiment of the present invention

[0013] The natural language processing module includes:

[0014] An interactive interface unit, which provides a natural language text input interface for the user;

[0015] A semantic understanding unit is connected to an interactive interface unit. The semantic understanding unit integrates a pre-trained language model. The pre-trained language model performs named entity recognition and semantic role labeling on the input natural language text to extract rule-based semantic elements from the natural language text.

[0016] The structured abstraction unit is connected to the semantic understanding unit to map the extracted rule semantic elements into an abstract syntax tree. The extracted rule semantic elements are then disambiguated and normalized using the abstract syntax tree. The time description phrases are then dynamically calculated into date ranges or timestamps, and finally, structured rule data is obtained and output.

[0017] As a further preferred embodiment of the present invention

[0018] The rule conversion module includes:

[0019] An expression generator, which converts structured rule data into initial rule expressions that can be run by the rule execution engine according to a preset syntax mapping relationship;

[0020] An expression optimizer, which is data-connected to the expression generator, performs static performance optimization on the initial rule expression to obtain an optimized rule expression.

[0021] As a further preferred embodiment of the present invention, the expression generator is equipped with a syntax mapping dictionary. The preset syntax mapping relationship is obtained through the syntax mapping dictionary. The abstract syntax tree is traversed and each node of the abstract syntax tree is converted into a legal syntax element that the rule execution engine can execute according to the syntax mapping dictionary to generate an initial rule expression.

[0022] As a further preferred embodiment of the present invention, the static performance optimization methods performed by the expression optimizer on the initial rule expression include constant folding optimization and common subexpression elimination optimization; wherein...

[0023] The constant folding optimization method calculates and simplifies the constant parts that can be predetermined in the initial rule expression;

[0024] The optimization steps of the constant folding optimization method include:

[0025] 1.1) Traversing the initial rule expression: Scanning the initial rule expression using the expression optimizer;

[0026] 1.2) Identify constant expressions: Identify expression fragments in which all operands are constants or can be calculated in advance;

[0027] 1.3) Calculation execution: During the optimization phase, the constant values ​​of the expression fragment are calculated in advance;

[0028] 1.4) Replace the expression: Replace the expression fragment with the calculated constant value;

[0029] The common subexpression elimination optimization method identifies and removes subexpressions that appear multiple times in the initial rule expression and have the same calculation result;

[0030] The optimization steps for the common subexpression elimination optimization method include:

[0031] 2.1) Traversing the expression: Scanning the initial rule expression and analyzing its structure;

[0032] 2.2) Construct an expression dependency graph: Identify all distinct sub-expressions and their dependencies;

[0033] 2.3) Finding equivalent subexpressions: Finding common subexpressions that appear multiple times and yield the same result;

[0034] 2.4) Introduce temporary variables: Store the evaluation results of repeated common subexpressions in temporary variables;

[0035] 2.5) Replace all occurrences: Replace common subexpressions in the initial regular expression with temporary variables.

[0036] As a further preferred embodiment of the present invention

[0037] The rule execution and feedback module includes:

[0038] A data access unit dynamically obtains user context data from an external data source and injects it into the execution environment and the tagging environment;

[0039] The rule execution engine selects an engine based on the optimized rule expression, loads the optimized rule expression through the selected engine, executes the optimized rule expression in combination with the obtained user context data, and obtains the execution result.

[0040] The tag service unit is connected to the rule execution engine and the data access unit to perform tagging actions on the execution results by combining the acquired user context data, and sends the tagged user to the user tag library;

[0041] The effect monitoring and feedback unit collects user feedback on the marking results and forms a feedback dataset.

[0042] An iterative learning unit, which is connected to the effect monitoring and feedback unit, generates rule logic optimization suggestions based on the preset grammatical mapping relationship according to the feedback dataset, and determines whether it is necessary to fine-tune the pre-trained language model in the natural language processing module if necessary.

[0043] As a further preferred embodiment of the present invention, when fine-tuning the pre-trained language model:

[0044] When the accuracy of user correction feedback on the labeling results collected by the effect monitoring and feedback unit is lower than the preset threshold, it is determined that the pre-trained language model needs to be fine-tuned.

[0045] When the accuracy of user feedback on the labeling results collected by the effect monitoring and feedback unit reaches a preset threshold, it is determined to stop fine-tuning the pre-trained language model.

[0046] When generating rule logic optimization suggestions based on preset syntax mapping relationships, the following priority is followed:

[0047] 1) Impact of the error: Optimization suggestions for rule logic are prioritized for feedback data with a large number of incorrectly labeled users compared to feedback data with a small number of incorrectly labeled users; or

[0048] 2) Performance Impact: Optimization suggestions for generating rule logic based on feedback data showing a significant decrease in labeling task speed are given higher priority than optimization suggestions for generating rule logic based on feedback data showing a smaller decrease in labeling task speed; or

[0049] 3) Implementation cost: The priority of generating rule logic optimization suggestions for feedback data with low modification cost is higher than that of generating rule logic optimization suggestions for feedback data with high modification cost.

[0050] As a further preferred embodiment of the present invention, the effect monitoring and feedback unit includes at least error cases, original rule descriptions in natural language text input by the user, and corresponding generated initial rule expressions and optimized rule expressions in the feedback dataset.

[0051] As a further preferred embodiment of the present invention, in the iterative learning unit,

[0052] Based on the error cases in the feedback dataset, fine-tune the pre-trained language model in the natural language processing module;

[0053] Fine-tuning includes the following steps:

[0054] 1) Input data and annotation: The error cases in the feedback dataset are organized into training samples. The input of the training samples is the natural language text input by the user, and the correct structured rule data annotated for the error cases.

[0055] 2) Calculate the loss: Input the natural language text into the pre-trained language model, the pre-trained language model calculates the prediction result for the current text, compares the prediction result with the correctly labeled structured rule data, and calculates the difference between the predicted value and the labeled value.

[0056] 3) Iterative update: Reduce the gap by adjusting the parameters of the pre-trained language model: Repeat steps 1)-3) until the gap no longer decreases or the preset number of iterations is reached;

[0057] Based on the original rule descriptions in the feedback dataset and the rule defects in the generated initial rule expressions and optimized rule expressions, rule logic optimization suggestions are generated for the preset syntax mapping relationship;

[0058] The steps involved in generating rule logic optimization suggestions are as follows:

[0059] 1) Analyze the composition of error cases and extract their corresponding features;

[0060] 2) Based on the extracted features, match the error cases to the corresponding rule defect patterns;

[0061] 3) Generate corresponding optimization suggestions for the matched rule defect patterns;

[0062] 4) Output optimization suggestions and their optimization priorities.

[0063] Furthermore, the present invention also provides a control method for an intelligent user tagging system based on natural language processing, characterized by comprising the following steps:

[0064] S100: The natural language processing module receives natural language text input by the user, performs semantic understanding and structured parsing on the input natural language text, and outputs structured rule data;

[0065] S200: The rule transformation module converts structured rule data into optimized rule expressions;

[0066] S300: Executes optimized rule expressions to complete user tagging, and then iteratively optimizes the natural language processing module and rule conversion module based on the feedback data of the tagging effect.

[0067] Compared with existing technologies, the technical effects that this invention can achieve include:

[0068] 1) This invention provides an intelligent user tagging system and its control method based on natural language processing, which effectively improves readability and agility, completely eliminates language barriers between business personnel and technical implementation, and allows users to quickly define and iterate complex rules by inputting natural language text, greatly improving business response speed and innovation capabilities.

[0069] 2) This invention provides an intelligent user tagging system and its control method based on natural language processing, which effectively improves tagging accuracy and efficiency: through the sequential processing flow of semantic understanding, structural parsing and rule transformation, the accuracy of intent transformation is guaranteed. At the same time, by combining the initial rule expression and the optimized rule expression, it ensures that it can have high-precision and high-efficiency real-time processing capabilities even under massive user data.

[0070] 3) This invention provides an intelligent user tagging system and its control method based on natural language processing. It can continuously optimize the system's tagging capabilities. Through the rule execution and feedback module, the natural language processing module and the rule conversion module are iteratively optimized based on the feedback dataset of the tagging effect. It can continuously optimize its core components, namely the pre-trained language model and rule logic, using actual application data to achieve the effect of becoming smarter with use, thus building a long-term technical barrier.

[0071] 4) This invention provides an intelligent user tagging system and its control method based on natural language processing. It has strong maintainability and interpretability. The system retains a complete traceability chain from business intent (natural language text) to execution code (optimized rule expression). Any rule can be understood and traced back, which greatly reduces the complexity and risk of long-term system operation and maintenance, while also providing parameter basis for continuous system optimization. Attached Figure Description

[0072] Figure 1 The diagram shown is a structural schematic of the marking system provided by the present invention.

[0073] Figure 2The diagram shows the steps of the control method provided by the present invention. Detailed Implementation

[0074] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0075] In the description of this invention, it should be noted that the terms "upper," "lower," "inner," "outer," "front end," "rear end," "both ends," "one end," and "the other end," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0076] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installed," "equipped with," "connected," etc., should be interpreted broadly. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be a connection within two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0077] [First Embodiment]

[0078] like Figure 1 The image shows an intelligent user tagging system based on natural language processing provided in the first embodiment of the present invention. The system includes:

[0079] The Natural Language Processing (NLP) module receives natural language text input from the user, performs semantic understanding and structured parsing on it, and outputs structured rule data.

[0080] like Figure 1 As shown, in this embodiment, the natural language processing module includes:

[0081] The interactive interface unit provides a natural language text input interface for users. In this embodiment, the natural language text input by the user through the natural language text input interface can be, for example, marking users who spent more than 3,000 yuan last month but did not log in this month as "users who need to be activated".

[0082] The semantic understanding unit is connected to the interaction interface unit. The semantic understanding unit integrates a pre-trained language model. The pre-trained language model performs named entity recognition and semantic role labeling on the input natural language text in order to extract the regular semantic elements in the natural language text.

[0083] In this embodiment, the selected pre-trained language model is a deep neural network (such as the Transformer architecture). Its recognition rules are embodied in billions of parameters (weights) in the network. These weights are continuous floating-point numbers, which together determine how the model converts the input text (token sequence) into a vector representation that can capture semantic and contextual information.

[0084] The working process of the pre-trained language model selected in this embodiment includes:

[0085] 1) Input text: Input natural language text, such as "Mark users who spent more than 3,000 yuan last month but did not log in this month as 'users who need to be activated'";

[0086] 2) Tokenization: The text is segmented into the smallest unit that the model can process, such as "tag", "last month", "consumption", "full", "3000", "yuan", "but", "this month", "not", "login", "of", "user", "for", "need", "activation", "user";

[0087] 3) Vectorization and Encoding: The tokenized sequence is input into the pre-trained language model. The model uses its multi-layer Transformer structure and internal attention mechanism and weight parameters to generate a dynamic vector related to its context for each tokenized smallest unit. This vector not only contains the information of the smallest unit itself, but also integrates its position in the sentence and its grammatical and semantic relationships with other words.

[0088] 4) Task Head and Output: Add a corresponding task head (a simple neural network layer) on top of the model to complete the specific natural language processing (NLP) task;

[0089] 5) Named Entity Recognition (NER): The task header will classify the dynamic vector corresponding to each tokenized smallest unit to determine whether it is part of an entity such as "time", "value", or "behavior".

[0090] 6) Semantic Role Labeling (SRL): The task head analyzes the predicates in the sentence (such as "mark", "consume", "login", etc.) and classifies the relationship between other components and the predicate, such as "the doer of the action (who)", "the receiver of the action (label name)", "condition (when, where)", etc.

[0091] In summary, the working process of the pre-trained language model selected in this embodiment can be summarized as follows: input text → segmentation unit → vectorization and encoding → adding task header → classifying the vector through a specific task layer (such as NER) and outputting entity recognition and role labeling.

[0092] In this embodiment, the named entities include at least time entities (e.g., "last month" and "this month"), behavior entities (e.g., "consumption" and "login"), numerical entities (e.g., "3000"), and conditional entities (e.g., "consumption of 3000 yuan last month" and "not logged in this month"); semantic roles may include action intent (e.g., "mark"), tag name (e.g., "users need to be activated"), logical relationship (e.g., "but"), etc.; and an abstract syntax tree (AST) is constructed based on this.

[0093] The structured abstraction unit (AST) is connected to the semantic understanding unit to map the extracted rule semantic elements into an abstract syntax tree (AST). By using the AST, the following effects can be achieved: 1) Eliminating ambiguity: transforming fuzzy natural language into a unique and definite structured logic tree; 2) Facilitating operation: making it easy to traverse, verify, optimize (such as constant folding), and transform (generate code) the rule semantic elements; 3) Supporting normalization: enabling unified expression (e.g., converting "full" to ">=", etc.) and adding dynamically calculated values. In this embodiment, the AST can be serialized using JSON or Protobuf format.

[0094] The node types of this Abstract Syntax Tree (AST) include at least: condition nodes, logical operator nodes, data source nodes, and action nodes. It performs disambiguation and normalization operations on the extracted rule semantic elements, and then dynamically calculates the time description phrases into date ranges or timestamps, for example: Action(label, "need to activate users") <- Condition(AND(consumption statistics (last month)>=3000, NOT(existence (login event, this month)))), and standardizes "full" into the symbol ">=", and finally obtains and outputs structured rule data.

[0095] The rule conversion module connects with the natural language processing module to receive structured rule data and convert it into optimized rule expressions. Through the sequential processing flow of semantic understanding, structural parsing, and rule conversion, the accuracy of intent conversion is ensured. At the same time, by combining the initial rule expression and the optimized rule expression, it ensures high-precision and high-efficiency real-time processing capabilities even with massive amounts of user data.

[0096] like Figure 1 As shown, in this embodiment, the rule conversion module includes:

[0097] An expression generator converts structured rule data into initial rule expressions that the rule execution engine can run, based on a preset syntax mapping relationship.

[0098] As a further preferred embodiment, the expression generator in this embodiment is equipped with a syntax mapping dictionary. The preset syntax mapping relationship is obtained through the syntax mapping dictionary. By traversing the abstract syntax tree (AST), each node of the AST is converted into a legal syntax element that the rule execution engine can execute according to the syntax mapping dictionary, so as to generate the initial rule expression.

[0099] In this embodiment, the syntax mapping dictionary can be set as a configurable YAML markup language or a database table, storing mappings from domain concepts to technical implementations, for example: {"concept": "last N days", "mapping type": "time function", "Aviator implementation": "dateRange('day, -N)"}; this allows the system to flexibly adapt to different business terms.

[0100] An expression optimizer connects to the expression generator to perform static performance optimization on the initial rule expression, thereby obtaining an optimized rule expression.

[0101] For example, given the input natural language text: users who spent over 3000 yuan last month but did not log in this month are labeled as "users requiring activation," the expression generator traverses this abstract syntax tree (AST), and the syntax mapping dictionary defines transformation rules such as: consumption statistics (time range) -> sumConsumption(userId, startDate, endDate). The generated initial rule expression might be: `sumConsumption(userId, 2023-10-01, 2023-10-31)>= ​​3000&&!hasLoginEvent(userId, 2023-11-01, 2023-11-15)`. The expression optimizer then checks and optimizes this initial rule expression, such as pre-compiling fixed date range strings.

[0102] As a further preferred embodiment, the static performance optimization methods performed by the expression optimizer on the initial regular expression in this embodiment include constant folding optimization and common subexpression elimination optimization. Both of these optimization methods are static optimization techniques, which can improve performance without running the code.

[0103] 1) Constant folding optimization method:

[0104] Optimization: Calculate and simplify the constant parts of expressions that can be predetermined at compile time to avoid repeated calculations at runtime.

[0105] The specific steps include:

[0106] 1.1) Traversing the expression: Scanning the initial rule expression using the expression optimizer;

[0107] 1.2) Identify constant expressions: Identify expression fragments in which all operands are constants or can be calculated in advance;

[0108] For example, in the method `sumConsumption(userId, '2023-10-01', '2023-10-31')`, if 2023-10-01 and 2023-10-31 are two fixed strings, then this method call itself is not treated as a constant because it depends on `userId`, but the date parameter inside the method is a constant.

[0109] For more general constant expressions, such as (30*24*60*60*1000) (i.e., the number of milliseconds in 30 days), or dateRange('day, -7) (if the date method is available at compile time).

[0110] 1.3) Perform the calculation: During the optimization phase, calculate the value of this expression fragment in advance;

[0111] 1.4) Expression Substitution: Replace the original expression fragment with the calculated constant value; for example:

[0112] Before optimization: timestamp>getCurrentTimeMillis()-30*24*60*60*1000

[0113] After optimization: timestamp>1678901234567-2592000000 (assuming the current timestamp is 1678901234567, the number of milliseconds in 30 days is 2592000000, and it can even be further folded into timestamp>1672981234567).

[0114] 2) Common subexpression elimination optimization method:

[0115] Optimization: Identify and remove subexpressions that appear multiple times in an expression and have the same calculation result, calculate them only once and reuse their results to avoid duplicate calculations.

[0116] The specific steps include:

[0117] 2.1) Traversing the expression: Scan the entire expression and analyze its structure;

[0118] 2.2) Construct an expression dependency graph: Identify all distinct sub-expressions and their dependencies;

[0119] 2.3) Finding equivalent subexpressions: Finding subexpression fragments that are syntactically and semantically identical;

[0120] For example, a complex rule: sumConsumption(userId, lastMonth)>1000 AND sumConsumption(userId, lastMonth)<5000.

[0121] 2.4) Introduce a temporary variable: Store the calculation result of the repeated common subexpression sumConsumption(userId, lastMonth) in a temporary variable;

[0122] 2.5) Replace all occurrences: Replace all occurrences of the common subexpression in the expression with this temporary variable; for example:

[0123] Before optimization: sumConsumption(userId, lastMonth)>1000ANDsumConsumption(userId, lastMonth)<5000

[0124] Optimized version: let $tmp = sumConsumption(userId, lastMonth); $tmp > 1000 AND $tmp < 5000

[0125] This ensures that the potentially time-consuming function sumConsumption is only called once.

[0126] The rule execution and feedback module connects with the rule transformation module to receive and execute optimized rule expressions. Based on the execution results, it performs user labeling and iteratively optimizes the natural language processing and rule transformation modules based on the feedback dataset of the labeling results. This allows for continuous optimization of the system's labeling capabilities. By using the rule execution and feedback module to iteratively optimize the natural language processing and rule transformation modules based on the feedback dataset of the labeling results, the system can continuously optimize its core components—the pre-trained language model and rule logic—using real-world application data to achieve a "the more you use it, the smarter it becomes" effect, thus building a long-term technological barrier.

[0127] like Figure 1 As shown, in this embodiment, the rule execution and feedback module includes:

[0128] The data access unit dynamically obtains user context data from external data sources (such as user profiles and behavior logs) and injects it into the execution environment and tagging environment;

[0129] User context data is used both in the rule execution process and in the tagging process:

[0130] When used in the rule execution process:

[0131] User context data (including user ID, attributes, and behavior records) is essential material for the rule execution engine to compute and optimize rule expressions. It allows the engine to determine whether any user meets the criteria. Therefore, the primary purpose of this data is to be input into the rule execution engine so that it can calculate a True or False result.

[0132] When performing the marking process:

[0133] When the rule execution engine calculates a result of True, the tag service unit needs to know:

[0134] Which users to tag: We need to obtain the user ID from the user context data to determine which users should be tagged;

[0135] What tags to assign: We need to know the specific tag content (e.g., "dormant user"). This tag information may come directly from the rules, or it may need to be extracted from the context data.

[0136] The rule execution engine selects an engine based on the optimized rule expression, such as the Aviator documentation example engine or another engine, to ensure that the optimized rule expression generated by the rule transformation module is a legal syntax that the selected engine can understand and execute. For example, if the Aviator documentation example engine is selected, the optimized rule expression generated by the rule transformation module must conform to Aviator's syntax specifications. The selected engine then loads the optimized rule expression, executes it in conjunction with the obtained user context data, and obtains the execution result.

[0137] The purpose of executing the expression is to determine whether a user meets the preset rule conditions, thus completing the core logic of user tagging. For example:

[0138] Input: The rule execution engine receives optimized rule expressions (e.g., sumConsumption(userId, lastMonth)>1000);

[0139] Data: The data access unit obtains context data of a single user from external systems (e.g., the user's ID, historical spending amount, last login time, etc.).

[0140] Execution: The rule execution engine substitutes the user's context data into the optimized rule expression for calculation;

[0141] Result: The execution will return a boolean value (True if the rule is met, False if the rule is not met).

[0142] Tagging: The tagging service unit performs the corresponding tagging action based on the execution result. If the result is True (i.e., the rule is met), the user is tagged with the corresponding tag (e.g., "high-value user"). If the result is False, no action is taken or the tag is not applied. In other words, the rule execution engine executes optimized rule expressions as a pre-judgment step to determine which users should be tagged.

[0143] The tag service unit is connected to the rule execution engine and the data access unit to perform tagging actions based on the acquired user context data and send the tagged user to the user tag library; the rule execution engine executes optimized rule expressions to complete the tagging action for users, performs batch execution of optimized rule expressions on all users, assigns corresponding tags to users who meet the conditions, and sends the tagged user to the user tag library;

[0144] The effect monitoring and feedback unit monitors the tag generation effect and provides an interface for users to sample, verify, and annotate the tagging results. It then collects user feedback on the tagging results to form a feedback dataset. The feedback dataset includes at least error cases, the original rule descriptions in the user-input natural language text, and the corresponding generated initial and optimized rule expressions. These provide optimization basis for subsequent fine-tuning of the pre-trained language model and suggestions for optimizing the generated rule logic. Notably, in this embodiment, the feedback data in the feedback dataset includes not only manually annotated positive and negative samples but also online test metrics such as click-through rate and conversion rate, to align the optimization goals with the final business results.

[0145] The iterative learning unit is connected to the effect monitoring and feedback unit to generate rule logic optimization suggestions based on the preset grammar mapping relationship according to the feedback dataset, and to determine whether it is necessary to fine-tune the pre-trained language model in the natural language processing module.

[0146] When fine-tuning a pre-trained language model:

[0147] When the accuracy of user correction feedback on the labeling results collected by the effect monitoring and feedback unit is lower than the preset threshold, it is determined that the pre-trained language model needs to be fine-tuned.

[0148] When the accuracy of user feedback on the labeling results collected by the effect monitoring and feedback unit reaches a preset threshold, it is determined to stop fine-tuning the pre-trained language model.

[0149] When generating rule logic optimization suggestions for preset syntax mapping relationships, the following priorities should be followed:

[0150] 1) Impact of the error: Fine-tuning and generating rule logic optimization suggestions based on feedback data with a large number of mislabeled users has a higher priority than fine-tuning and generating rule logic optimization suggestions based on feedback data with a small number of mislabeled users; or

[0151] 2) Performance impact: Fine-tuning and generating rule logic optimization suggestions based on feedback data that significantly reduces the marking task speed has a higher priority than fine-tuning and generating rule logic optimization suggestions based on feedback data that slightly reduces the marking task speed.

[0152] 3) Implementation cost: Fine-tuning and generating rule logic optimization suggestions for feedback data with low modification cost has a higher priority than fine-tuning and generating rule logic optimization suggestions for feedback data with high modification cost.

[0153] The system prioritizes the rules and logic optimization suggestions based on various factors to fine-tune them and meet the optimization needs of different scenarios.

[0154] In the iterative learning unit,

[0155] Based on the error cases in the feedback dataset, fine-tune the pre-trained language model in the natural language processing module;

[0156] Fine-tuning includes the following steps:

[0157] 1) Input data and annotation: The error cases in the feedback dataset are organized into training samples. The input of the training samples is the natural language text input by the user, and the correct structured rule data annotated for the error cases.

[0158] 2) Calculate the loss: Input the natural language text into the pre-trained language model. The pre-trained language model calculates the prediction result for the current text. The prediction result is compared with the correctly labeled structured rule data. The difference between the predicted value and the labeled value is calculated through cross-entropy loss function, etc. The larger the difference, the higher the loss.

[0159] 3) Iterative update: Reduce the gap by adjusting the parameters of the pre-trained language model: Repeat steps 1)-3) until the gap no longer decreases or the preset number of iterations is reached;

[0160] Based on the original rule descriptions in the feedback dataset and the rule defects in the generated initial rule expressions and optimized rule expressions, rule logic optimization suggestions are generated for the preset syntax mapping relationship;

[0161] The steps involved in generating rule logic optimization suggestions are as follows:

[0162] 1) Analyze the composition of error cases and extract their corresponding characteristics; for example:

[0163] Original rule description: Its composition and characteristics are natural language;

[0164] Initial rule expressions and optimized rule expressions: their components and characteristics are the generated code;

[0165] Error types: Their components and characteristics can include: omissions, mislabeling, etc.

[0166] User feedback corrections: Its components and characteristics can be: This user is not logged in because they are on vacation and should not be tagged;

[0167] 2) Based on the extracted features, match the error cases to the corresponding rule defect patterns;

[0168] For example:

[0169] Pattern A: If the error case is "mislabeling" and the correction feedback mentions an ignored business context (such as "vacation"), but this context does not exist in the current expression, then the "rule logic missing" pattern is matched.

[0170] Pattern B: If "last month" is interpreted as a fixed date range, but user feedback expects a dynamic range of "last 30 days", then it matches the "semantic mapping ambiguity" pattern.

[0171] 3) Generate corresponding optimization suggestions for the matched rule defect patterns;

[0172] For Pattern A (missing rule logic), the optimization suggestion is: "Consider excluding users who have applied for [leave] in the rules." Additionally, it might attempt to extract the key entity "leave" from user feedback to populate the suggestion.

[0173] For pattern B (semantic mapping ambiguity), the optimization suggestion is: "It is recommended to adjust the mapping of the term 'last month' from [fixed calendar month] to [dynamic scrolling window]".

[0174] 4) Output optimization suggestions and their optimization priorities (based on the error impact, performance impact and implementation cost mentioned above), and record them for system administrators or rule developers to review and adopt, and as the basis for future automated rule repair.

[0175] For example, the rule execution engine loads and optimizes rule expressions, and queries specific users' consumption and login data from external data sources (such as user behavior logs) for evaluation. For users who meet the criteria, the tagging service is invoked to complete the tagging. The performance monitoring and feedback unit displays the tag coverage. When users discover that some users have been incorrectly tagged (such as those who are not logged in due to vacation), these cases are marked as "errors" through the feedback interface. The iterative learning unit collects these cases and uses them to fine-tune the pre-trained language model in the next training cycle, and may generate a rule optimization suggestion: "Consider excluding users who have submitted vacation applications in the rule."

[0176] [Second Embodiment]

[0177] like Figure 2 As shown, the second embodiment of the present invention also provides a control method for an intelligent user tagging system based on natural language processing, comprising the following steps:

[0178] S100: The natural language processing module receives natural language text input by the user, performs semantic understanding and structured parsing on the input natural language text, and outputs structured rule data;

[0179] S200: The rule transformation module converts structured rule data into optimized rule expressions;

[0180] S300: Executes optimized rule expressions to complete user tagging, and then iteratively optimizes the natural language processing module and rule conversion module based on the feedback data of the tagging effect.

[0181] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

Claims

1. An intelligent user tagging system based on natural language processing, characterized in that: The system includes: The natural language processing module receives natural language text input by the user, performs semantic understanding and structured parsing on it, and outputs structured rule data. A rule conversion module is connected to a natural language processing module to receive structured rule data and convert the structured rule data into optimized rule expressions. The rule execution and feedback module is connected to the rule transformation module to receive and execute optimized rule expressions, and complete user labeling based on the execution results. Then, based on the feedback dataset of the labeling effect, the natural language processing module and the rule transformation module are iteratively optimized. Based on the feedback dataset, the system generates rule logic optimization suggestions for the preset grammatical mapping relationship, and determines whether it is necessary to fine-tune the pre-trained language model in the natural language processing module if necessary. When fine-tuning is needed, the pre-trained language model in the natural language processing module is fine-tuned based on the error cases in the feedback dataset. Fine-tuning includes the following steps: 1) Input data and annotation: The error cases in the feedback dataset are organized into training samples. The input of the training samples is the natural language text input by the user, and the correct structured rule data annotated for the error cases. 2) Calculate the loss: Input the natural language text into the pre-trained language model, the pre-trained language model calculates the prediction result for the current text, compares the prediction result with the correctly labeled structured rule data, and calculates the difference between the predicted value and the labeled value. 3) Iterative update: Reduce the gap by adjusting the parameters of the pre-trained language model: Repeat steps 1)-3) until the gap no longer decreases or the preset number of iterations is reached; Based on the original rule descriptions in the feedback dataset and the rule defects in the generated initial rule expressions and optimized rule expressions, rule logic optimization suggestions are generated for the preset syntax mapping relationship; The steps involved in generating rule logic optimization suggestions are as follows: 1) Analyze the composition of error cases and extract their corresponding features; 2) Based on the extracted features, match the error cases to the corresponding rule defect patterns; 3) Generate corresponding optimization suggestions for the matched rule defect patterns; 4) Output optimization suggestions and their optimization priorities.

2. The intelligent user tagging system based on natural language processing according to claim 1, characterized in that: The natural language processing module includes: An interactive interface unit, which provides a natural language text input interface for the user; A semantic understanding unit is connected to an interactive interface unit. The semantic understanding unit integrates a pre-trained language model. The pre-trained language model performs named entity recognition and semantic role labeling on the input natural language text to extract rule-based semantic elements from the natural language text. The structured abstraction unit is connected to the semantic understanding unit to map the extracted rule semantic elements into an abstract syntax tree. The extracted rule semantic elements are then disambiguated and normalized using the abstract syntax tree. The time description phrases are then dynamically calculated into date ranges or timestamps, and finally, structured rule data is obtained and output.

3. The intelligent user tagging system based on natural language processing according to claim 1, characterized in that: The rule conversion module includes: An expression generator, which converts structured rule data into initial rule expressions that can be run by the rule execution engine according to a preset syntax mapping relationship; An expression optimizer, which is data-connected to the expression generator, performs static performance optimization on the initial rule expression to obtain an optimized rule expression.

4. The intelligent user tagging system based on natural language processing of claim 3, wherein: The expression generator has a syntax mapping dictionary inside. It obtains the preset syntax mapping relationship through the syntax mapping dictionary, traverses the abstract syntax tree, and converts each node of the abstract syntax tree into a legal syntax element that the rule execution engine can execute according to the syntax mapping dictionary, so as to generate the initial rule expression.

5. The intelligent user tagging system based on natural language processing according to claim 3, characterized in that: The expression optimizer performs static performance optimizations on the initial rule expression using two methods: constant folding optimization and common subexpression elimination optimization. The constant folding optimization method calculates and simplifies the constant parts that can be predetermined in the initial rule expression; The optimization steps of the constant folding optimization method include: 1.1) Traversing the initial rule expression: Scanning the initial rule expression using the expression optimizer; 1.2) Identify constant expressions: Identify expression fragments in which all operands are constants or can be calculated in advance; 1.3) Calculation execution: During the optimization phase, the constant values ​​of the expression fragment are calculated in advance; 1.4) Replace the expression: Replace the expression fragment with the calculated constant value; The common subexpression elimination optimization method identifies and removes subexpressions that appear multiple times in the initial rule expression and have the same calculation result; The optimization steps for the common subexpression elimination optimization method include: 2.1) Traversing the expression: Scanning the initial rule expression and analyzing its structure; 2.2) Construct an expression dependency graph: Identify all distinct sub-expressions and their dependencies; 2.3) Finding equivalent subexpressions: Finding common subexpressions that appear multiple times and yield the same result; 2.4) Introduce temporary variables: Store the evaluation results of repeated common subexpressions in temporary variables; 2.5) Replace all occurrences: Replace common subexpressions in the initial regular expression with temporary variables.

6. The intelligent user tagging system based on natural language processing according to claim 3, characterized in that: The rule execution and feedback module includes: The data access unit dynamically obtains user context data from external data sources and injects it into the execution environment and labeling environment; The rule execution engine selects an engine based on the optimized rule expression, loads the optimized rule expression through the selected engine, executes the optimized rule expression in combination with the obtained user context data, and obtains the execution result. The tag service unit is connected to the rule execution engine and the data access unit to perform tagging actions on the execution results by combining the acquired user context data, and sends the tagged user to the user tag library; The effect monitoring and feedback unit collects user feedback on the marking results and forms a feedback dataset. An iterative learning unit is connected to the effect monitoring and feedback unit via data connection.

7. The intelligent user tagging system based on natural language processing according to claim 6, characterized in that: When fine-tuning a pre-trained language model: When the accuracy of user correction feedback on the labeling results collected by the effect monitoring and feedback unit is lower than the preset threshold, it is determined that the pre-trained language model needs to be fine-tuned. When the accuracy of user feedback on the labeling results collected by the effect monitoring and feedback unit reaches a preset threshold, it is determined to stop fine-tuning the pre-trained language model. When generating rule logic optimization suggestions based on preset syntax mapping relationships, the following priority is followed: 1) Impact of the error: Optimization suggestions for rule logic are prioritized for feedback data with a large number of incorrectly labeled users compared to feedback data with a small number of incorrectly labeled users; or 2) Performance impact: Optimization suggestions for generating rule logic are prioritized for feedback data that significantly reduces the labeling task speed, compared to those that only slightly reduce the speed. or 3) Implementation cost: The priority of generating rule logic optimization suggestions for feedback data with low modification cost is higher than that of generating rule logic optimization suggestions for feedback data with high modification cost.

8. The intelligent user tagging system based on natural language processing according to claim 6, characterized in that: In the effect monitoring and feedback unit, the feedback dataset includes at least error cases, the original rule description in the natural language text input by the user, and the corresponding generated initial rule expression and optimized rule expression.

9. A control method for an intelligent user tagging system based on natural language processing according to any one of claims 1-8, characterized in that, Includes the following steps: S100: The natural language processing module receives natural language text input by the user, performs semantic understanding and structured parsing on the input natural language text, and outputs structured rule data; S2 00: The rule transformation module converts structured rule data into optimized rule expressions; S300: Executes optimized rule expressions to complete user tagging, and then iteratively optimizes the natural language processing module and rule conversion module based on the feedback data of the tagging effect.