Full-color-coverage digital color intelligent interaction method, system and equipment and medium

By employing rule matching and model prediction strategies, a digital color intelligent interaction covering all color types is achieved, solving the problems of low efficiency and insufficient intelligence in existing technologies, and improving the level of interactive intelligence and response accuracy.

CN121786154APending Publication Date: 2026-04-03SUZHOU YIDUODUO INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-23
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing digital color analysis software is inefficient, lacks full color coverage and intelligent interaction, has a high user learning cost, and is difficult to achieve multi-level analysis and professional assistance.

Method used

The system employs rule matching and model prediction strategies to extract color types, intents, and entity information from user input. Through multi-turn dialogue management, color type recognition, intent recognition, knowledge retrieval, and dynamic context loading, it achieves intelligent interaction covering all color types.

Benefits of technology

It achieves full-color intelligent interaction, breaks down data and service silos, improves the level of interactive intelligence, reduces user learning costs, and ensures the accuracy and efficiency of responses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121786154A_ABST
    Figure CN121786154A_ABST
Patent Text Reader

Abstract

The invention discloses a full-color-coverage digital color intelligent interaction method, system and device and a medium. The method comprises the following steps: performing multi-round dialogue process management by adopting a rule matching and model prediction strategy; a strong rule priority and model bottom-out strategy is adopted to identify various color species; core intentions of lottery drawing query, statistical analysis and number recommendation are identified through keyword matching, entity verification and model depth judgment; performing knowledge retrieval based on text preprocessing, regular extraction, keyword retrieval and semantic retrieval in combination with data filtering and integration; dynamic decision-making of historical dialogue context loading is carried out by judging the problem self-inclusion and the intention switching state; according to the method, full-color intelligent interaction can be realized, and the fuzzy expression understanding ability is improved based on a mixed architecture of rules and models; the experience and efficiency are balanced based on dynamic context loading, the response accuracy is guaranteed based on multi-strategy knowledge retrieval, the learning cost of lottery buyers is reduced, and the interaction intelligence level is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, specifically to the field of digital color, and particularly to a digital color intelligent interactive method, system, device and medium covering all color types. Background Technology

[0002] In the field of digital lottery, lottery players need to consult historical lottery data and analyze indicators such as odd-even ratio to assist in decision-making. Some lottery players manually create trend charts and use calculators to calculate, which is inefficient and makes it difficult to find correlations between indicators.

[0003] Existing lottery analysis software is mostly static tools with little functional difference and lacks multi-level analysis guidance. At the same time, digital lottery includes a variety of lottery types, and the professional terminology and analytical logic have a knowledge threshold. Novice lottery players lack dedicated intelligent assistants, making it difficult to reduce the learning cost. Existing solutions cannot meet the interactive needs of all lottery types and intelligent operation. Summary of the Invention

[0004] The purpose of this invention is to provide a digital color intelligent interactive method, system, device and medium with full color coverage, thereby solving all or one of the above-mentioned problems in the prior art.

[0005] To solve the above-mentioned technical problems, the specific technical solution of the present invention is as follows:

[0006] On one hand, the present invention provides a digital color intelligent interaction method with full color coverage, comprising the following steps:

[0007] Multi-turn dialogue management steps:

[0008] Initialize the dialogue state, and use rule matching and model prediction strategies to extract and store the color type, intent and entity information from the user input.

[0009] Lottery type identification steps:

[0010] After preprocessing user input, multi-dimensional features are extracted, and a strong rule-first and model fallback strategy is used to identify multiple lottery types and update the dialogue state.

[0011] Intent recognition steps:

[0012] By using keyword matching, entity verification, and model depth judgment, the core intent of lottery result query, statistical analysis, and number recommendation is identified and updated accordingly.

[0013] Knowledge retrieval steps:

[0014] Knowledge retrieval is performed based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration.

[0015] Dynamic context loading steps:

[0016] By judging the self-containment of the question and the intention switching state, the system makes dynamic decisions on loading historical dialogue context and provides intelligent interactive responses.

[0017] Furthermore, the step of extracting and storing color type, intent, and entity information from user input using rule matching and model prediction strategies further includes:

[0018] In response to receiving user input, a combination of rule matching and model prediction is used to extract entity information such as lottery type changes, user intent, focus period, numbers, and time.

[0019] The extracted information is stored in a structured manner.

[0020] Furthermore, the extraction of multi-dimensional features after preprocessing the user input further includes:

[0021] Cleaning, word segmentation, and error correction preprocessing are performed on user input;

[0022] After preprocessing, text keywords, numbers, gameplay, and rounds are extracted as the multi-dimensional features.

[0023] Furthermore, the step of employing a strong rule-first and model-backup strategy to identify multiple lottery types and update the dialogue state further includes:

[0024] First, strong rules are used to quickly match explicit lottery types, number-related lottery types, lottery types corresponding to the draw, and lottery types to which the gameplay belongs;

[0025] Then, for fuzzy inputs not covered by the rules, a fine-tuned BERT classification model is used for deep recognition, outputting multiple color results;

[0026] Update the matching and recognition results to the dialog state.

[0027] Furthermore, the process of identifying and updating the core intent of lottery result queries, statistical analysis, and number recommendations through keyword matching, entity verification, and model depth judgment further includes:

[0028] By accurately matching user input text with keywords, a preliminary intent is determined, and then the preliminary intent is validated and optimized by combining entity information.

[0029] The BERT intent classification model is used for deep recognition of fuzzy and complex inputs; single-turn dialogue inputs include the current query, and multi-turn dialogue inputs include the current query, the previous query, and the previous intent.

[0030] The obtained lottery results, statistical analysis, and number recommendations will be updated to the chat status as the core intent.

[0031] Furthermore, the knowledge retrieval based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration, further includes:

[0032] Clean and remove color interference information from user input, and extract the corresponding structured data;

[0033] A knowledge base inverted index is built according to lottery type, and keyword retrieval is performed based on Whoosh.

[0034] Text embeddings are generated using the BGE vector model, and semantic retrieval is performed based on the FAISS vector database.

[0035] The search results from multiple channels are validated and filtered, and the valid data is integrated as the final search result.

[0036] Furthermore, the step of dynamically deciding on historical dialogue context loading and making intelligent interactive responses by judging the self-containment of the question and the intent switching state further includes:

[0037] Based on the clarity of the intent and the completeness of the core entities in the current question input by the user, determine whether the current question input by the user is a self-contained question;

[0038] The response thus becomes self-contained, failing to load the preceding text;

[0039] If the current intent is unrelated to the previous round, a topic switch is detected, and the historical context is not loaded.

[0040] In response to a non-self-contained issue and without switching topics, load the information above.

[0041] On the other hand, the present invention also provides a digital color intelligent interactive system with full color coverage, comprising:

[0042] The multi-turn dialogue management module is used to: initialize the dialogue state, and extract and store the color type, intent and entity information from the user input using rule matching and model prediction strategies.

[0043] The lottery type identification module is used to: extract multi-dimensional features after preprocessing user input, identify multiple lottery types using a strong rule-first and model fallback strategy, and update the dialogue state.

[0044] The intent recognition module is used to: identify and update the core intents of lottery result queries, statistical analysis, and number recommendations through keyword matching, entity verification, and model depth judgment;

[0045] The knowledge retrieval module is used for knowledge retrieval based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration.

[0046] The dynamic context loading module is used to make dynamic decisions on loading historical dialogue context by judging the self-containment of the question and the intent switching state, and to make intelligent interactive responses.

[0047] On the other hand, the present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of the full-color digital color intelligent interactive method.

[0048] On the other hand, the present invention also provides a computer device, the computer device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein:

[0049] The memory is used to store computer programs;

[0050] The processor is configured to execute the steps of the full-color digital color intelligent interaction method by running a program stored in the memory.

[0051] The beneficial effects of the technical solution of this invention are:

[0052] 1. The digital lottery intelligent interaction method covering all lottery types described in this invention can realize intelligent interaction across all lottery types, breaking down data and service silos; multiple modules work collaboratively based on a unified dialogue state; a hybrid architecture based on rules and models enhances the ability to understand fuzzy expressions; dynamic context loading balances experience and efficiency; multi-strategy knowledge retrieval ensures response accuracy, reduces the learning cost for lottery players, and improves the level of intelligent interaction.

[0053] 2. The full-color intelligent interactive system for digital coloring described in this invention can achieve the full-color intelligent interactive method for digital coloring by the cooperation of system modules.

[0054] 3. The computer-readable storage medium of the present invention can enable the guidance system module to cooperate and thereby realize the digital color intelligent interaction method with full color coverage of the present invention. In addition, the computer-readable storage medium of the present invention also effectively improves the operability of the digital color intelligent interaction method with full color coverage.

[0055] 4. The computer device described in this invention can store and execute the computer-readable storage medium, thereby realizing the full-color intelligent interactive digital color method described in this invention. Attached Figure Description

[0056] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0057] Figure 1 This is a flowchart illustrating the full-color intelligent interactive method for digital color coverage as described in Embodiment 1 of the present invention;

[0058] Figure 2 This is a schematic diagram of the architecture of the full-color digital color intelligent interactive system described in Embodiment 2 of the present invention;

[0059] Figure 3 This is a schematic diagram of the structure of the computer device described in Embodiment 4 of the present invention;

[0060] The markings in the attached diagram are explained as follows:

[0061] 1501. Processor; 1502. Communication interface; 1503. Memory; 1504. Communication bus. Detailed Implementation

[0062] The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, so that the advantages and features of the present invention can be more easily understood by those skilled in the art, thereby providing a clearer and more explicit definition of the scope of protection of the present invention.

[0063] In the description of this invention, it should be noted that the embodiments described in this invention are only some embodiments of this invention, not all embodiments; based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0064] The terms "first," "second," etc., used in this specification, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.

[0065] In the description of this invention, it should be noted that the following problems may exist in the interaction process of the digital color intelligent agent:

[0066] (1) Multi-turn dialogue management problem: In the multi-turn dialogue of digital lottery intelligent agents, user behavior has significant characteristics of "dynamic switching and context dependence". Specifically, it is manifested in frequent switching of lottery types (such as "first ask about the Double Color Ball lottery results, then ask about the hot and cold numbers of the Welfare Lottery 3D"), dependence on the previous context (such as "How is this number?", "What is its omission value?") and dependence on the intention of the previous round (such as "first ask about the Double Color Ball lottery results, then ask about the Welfare Lottery 3D", at which time the Welfare Lottery 3D lottery results need to be output). Therefore, in order to have a more intelligent dialogue with users, it is necessary to manage this type of multi-turn dialogue. The goal is to record the lottery type changes, user needs (intents), attention periods, numbers and time during the chat process in real time.

[0067] (2) Lottery type identification problem: Lottery type identification is very necessary. On the one hand, the rules, lottery mechanisms and analysis methods of different lottery types are completely different. If the lottery type is misunderstood, it will lead to incorrect results and affect the user experience. On the other hand, users usually do not mention the lottery type name in every conversation. Accurate identification of the lottery type can continue the historical settings to provide a consistent service when there is no clear lottery type input. At the same time, it can avoid unnecessary calculations and only load the data and analysis modules of the relevant lottery type to improve system efficiency. However, since the lottery covers all age groups and the user input method is flexible, there are many typos, which also brings many problems to lottery type identification. Specifically, the user input contains uncontrollable typos such as "three places" and "big lottery", and some expressions involve specific gameplay (such as "select three" corresponding to Happy 8, "group selection", "group three", "group six" corresponding to Arrangement 3 and Welfare Lottery 3D). The system addresses various lottery types, including: Lottery 3D, Lottery 5D, 3D Lottery, and 7-Star Lottery; lottery type determination based on number analysis (e.g., "How about the number 07111322273312?"); lottery type determination based on draw number (e.g., "What will be drawn in draw 92?", where the user is actually referring to the Double Color Ball lottery in the latest draw 2025091); mixed lottery types (e.g., asking for the Super Lotto winning numbers based on the omissions of Double Color Ball and Super Lotto); full-color lottery types (e.g., asking "What draws were held tonight?" or "What were the lottery numbers yesterday?"); and situations where no lottery type is input and the previous lottery type is inherited to improve the user experience. Therefore, it is necessary to determine the 11 lottery types—Double Color Ball, Super Lotto, Happy 8, 3D Lottery, Lottery 3D, Lottery 5D, 7-Star Lottery, full-color lottery, mixed lottery, and no-color lottery—based on user input.

[0068] (3) Intent recognition issues: Lottery mainly involves user intent such as lottery result query, data statistical analysis, and number recommendation, and intent recognition is essential: On the one hand, the lottery field has strict compliance requirements, and number recommendations must be clearly identified as predictive in nature. Accurate intent recognition is the foundation for ensuring compliance; on the other hand, intent confusion may lead to erroneous data. For example, when users query historical lottery results, the system must ensure absolute accuracy and cannot return predictive data, while number recommendations are based on probability analysis. The two are completely different in nature, and improper distinction will affect data accuracy; at the same time, different intents require calling different services and calculations, which can avoid resource waste; intent recognition also faces some other problems:

[0069] First, the issue number or date may imply a specific intention. For example, if a user enters "What are the results of issue 92?" (the latest issue of the Double Color Ball lottery is currently 2025091), the apparent intention is to check the results, but the real intention is to recommend numbers (because issue 92 has not yet been drawn). Some users even directly enter "Double Color Ball 92" (real online users are usually too lazy to type). Simply replying "Issue 92 has not been drawn" is not intelligent enough. A better reply would be "Issue 92 has not been drawn. Here is a possible number combination for you...".

[0070] Second, contextual intent is crucial. For example, if a user asks "Yesterday's winning numbers for the Double Color Ball lottery" in the first round (intending to check the lottery results), and then asks "What about the 3D lottery?" in the second round, the current intent must be determined by combining the intent from the previous round.

[0071] Third, the intention is vaguely expressed. Users will not explicitly use "prediction" or "recommendation" to indicate their need for number recommendations. They need to make judgments by category, such as inputs like "what will be drawn today" or "give 2 double-color balls".

[0072] (4) Knowledge retrieval issues: Since the winning numbers of various lottery types have a strong similarity, combined with the lottery type identification results mentioned above, each lottery type can be stored separately; in the lottery field, the accuracy of knowledge retrieval is crucial. If the retrieved data is incorrect or not retrieved, it will directly lead to the inability to answer lottery players' questions. At the same time, historical data must be accurate and cannot be fabricated; knowledge retrieval is closely related to whether user questions can be answered well, and it is itself quite complex. Seemingly simple questions often involve complex steps, and simple retrieval is difficult to guarantee the effect. For example, if a user asks "Which issue is most similar to the 92nd issue of Double Color Ball?", the user needs to complete the following steps in sequence: understand the question, retrieve the winning numbers of the 2025092nd issue of Double Color Ball, load all winning numbers from 2003 to this year, and calculate the number and all winning numbers. The steps involved in data similarity analysis are as follows: Furthermore, real lottery players rarely provide precise query conditions such as complete draw numbers; they mostly provide range-based or fuzzy queries. For example, "Double Color Ball data from April 2023 to May 2024" requires a range-based search across years and months. When Double Color Ball draw number 2025093 has not yet been drawn, users asking for "data from the last 92 draws in the past six years" or "the first and last draws of each month this year" requires identifying the "first" and "last" draws of each month. On Tuesdays, the day of the Double Color Ball draw, users asking for "the winning numbers from the last 20 Tuesday draws" or "how many draws has the number 05 not appeared"—typical "omission value" calculations—as well as queries involving lottery indicator statistics such as odd-even ratio, size ratio, prime-composite ratio, 012 road, and three-zone ratio, all require semantic retrieval to obtain relevant historical statistical data.

[0073] (5) Dynamic loading of context: The core of dynamic loading of context is to intelligently determine whether to load the historical dialogue context. Loading the context may bring two problems. First, it will cause waste of resources. Redundant historical dialogues in long conversations will cause excessive computation, which will lead to increased model response latency. Second, it will lead to decreased accuracy. If the current question is a new topic or independent query (such as the user previously asked about the Double Color Ball lottery and now asks about the Happy 8 lottery), loading irrelevant context will interfere with the model's intent recognition. For example, the model may mistakenly associate "Happy 8" with the historical "Double Color Ball lottery", causing answer deviation. At the same time, it will also increase the probability of hallucination. On the other hand, not loading the context will lead to a worse user experience and make it impossible to handle context-dependent questions. For example, if the user first asks about the odd-even ratio of the 3D lottery and then asks about the Super Lotto, "what about the odd-even ratio" in the context, it is impossible to accurately understand the user's needs without loading the context.

[0074] In the description of this invention, it should be noted that the code format described in the embodiments of this invention does not represent the final code format, but only represents an example of code content.

[0075] Example 1

[0076] This embodiment provides a digital color intelligent interaction method covering all color types, such as... Figure 1As shown, it includes the following steps:

[0077] The core function of this method is to achieve intelligent interaction of all types of digital lottery through the coordinated action of five core steps, as follows:

[0078] S100, multi-turn dialogue management steps, including:

[0079] S101. Initialize the empty conversation state when the session starts;

[0080] S102. After receiving user input, use a combination of "rule matching + model prediction" to extract entity information such as lottery type change, user intent, focus period, number, and time.

[0081] S103. The extracted information is stored in a structured manner to provide unified data support for subsequent modules such as lottery type identification and knowledge retrieval, ensuring a coherent response across contexts.

[0082] S200, Color type identification steps, including:

[0083] S201. Clean, segment, and preprocess the user's original input, and extract features such as text keywords, numbers, gameplay, and rounds.

[0084] S202. Prioritize the rapid matching of explicit lottery types, number-related lottery types, lottery types corresponding to the draw period, and lottery types to which the gameplay belongs through strong rules;

[0085] S203. For fuzzy inputs not covered by the rules, a fine-tuned BERT classification model is used for deep recognition, outputting 11 types of lottery results and updating the dialogue state to ensure data accuracy and dialogue coherence.

[0086] The corresponding code for step S200 is as follows:

[0087] Lottery Classification Model:

[0088] ## Constructing a lottery type classification model

[0089] class LotteryClassificationModel(nn.Module):

[0090] def __init__(self, num_lottery_types: int = 11, bert_model_name: str= "bert-base-chinese"):

[0091] super().__init__()

[0092] self.bert = BertModel.from_pretrained(bert_model_name)

[0093] self.tokenizer = BertTokenizer.from_pretrained(bert_model_name)

[0094] self.dropout = nn.Dropout(0.1)

[0095] self.classifier = nn.Linear(self.bert.config.hidden_size, num_lottery_types)

[0096] def forward(self, input_ids, attention_mask):

[0097] outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)

[0098] pooled_output = outputs.pooler_output

[0099] logits = self.classifier(pooled_output)

[0100] return logits

[0101] # Model training and inference code

[0102] class LotteryClassifier:

[0103] def __init__(self, model_path=None):

[0104] self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

[0105] self.model = LotteryClassificationModel().to(self.device)

[0106] if model_path:

[0107] self.model.load_state_dict(torch.load(model_path, map_location=self.device))

[0108] def preprocess_text(self, text: str, max_length: int = 128):

[0109] """Preprocess text"""

[0110] encoding = self.model.tokenizer(

[0111] text,

[0112] max_length=max_length,

[0113] padding="max_length",

[0114] truncation=True,

[0115] return_tensors="pt" )

[0117] return encoding

[0118] def predict(self, text: str):

[0119] """Predict lottery type"""

[0120] encoding = self.preprocess_text(text)

[0121] input_ids = encoding["input_ids"].to(self.device)

[0122] attention_mask = encoding["attention_mask"].to(self.device)

[0123] self.model.eval() <--

[0124] with torch.no_grad():

[0125] logits = self.model(input_ids, attention_mask)

[0126] probs = torch.softmax(logits, dim=1)

[0127] pred_idx = torch.argmax(probs, dim=1).item()

[0128] return pred_idx

[0129] def train(self, train_data, epochs: int = 10):

[0130] """Train the model"""

[0131] optimizer = torch.optim.AdamW(self.model.parameters(), lr=2e-5)

[0132] criterion = nn.CrossEntropyLoss()

[0133] for epoch in range(epochs):

[0134] self.model.train()

[0135] total_loss = 0

[0136] for batch in train_data:

[0137] inputs = batch["input_ids"].to(self.device)

[0138] masks = batch["attention_mask"].to(self.device)

[0139] labels = batch["labels"].to(self.device)

[0140] optimizer.zero_grad()

[0141] outputs = self.model(inputs, masks)

[0142] ## Loss Calculation

[0143] loss = criterion(outputs, labels)

[0144] ## Gradient Calculation

[0145] loss.backward()

[0146] ## Update Learning Rate

[0147] optimizer.step()

[0148] total_loss += loss.item()

[0149] ## Rule-based

[0150] #1. Try matching dominant lottery types

[0151] result = explicit_match(text)

[0152] # 2. Attempt number matching

[0153] result = number_based_match(text)

[0154] # 3. Attempt to match periods

[0155] result = period_based_match(text)

[0156] #4. Try different gameplay matchmaking.

[0157] result = term_based_match(text)

[0158] The above approach prioritizes rules and uses models as a fallback. Rules can significantly improve speed, while models are used to make judgments when rules cannot meet the requirements, thereby improving the recognition success rate.

[0159] S300, Intent recognition steps, including:

[0160] S301. Preprocess the user input text, make a preliminary judgment on intent through precise keyword matching, and optimize the preliminary judgment result by combining entity verification such as period and time range.

[0161] S302. For fuzzy and complex inputs, use the BERT intent classification model for deep recognition. Single-turn dialogue input includes the current query, while multi-turn dialogue input includes the current query, the previous query, and the previous intent.

[0162] S303. The identification results are categorized into three types: lottery result query, statistical analysis, and number recommendation. The results are updated to the dialogue status to ensure compliance and efficient use of resources.

[0163] Specifically, when using a model to determine intent, the model is input in the following way:

[0164] The format for a single-turn dialogue (initial query) is: [CLS]Current User Query[SEP];

[0165] The multi-turn dialogue format (considering context) uses: [CLS] Current user query [SEP] Previous user query [SEP] Intent identified by the system in the previous turn [SEP];

[0166] The final hidden state of the [CLS] token is used for the aggregated sequence representation of the classification task; the [SEP] token is used to clearly separate information from different segments (such as the current question, historical questions, and historical intents). It should be noted that historical intents are introduced instead of historical answers because historical intents are systematically standardized and have had their linguistic diversity removed from the label information. They can more stably and reliably represent the historical state of the dialogue and reduce model learning noise.

[0167] The corresponding code for step S300 is as follows:

[0168] Code related to the intent recognition model:

[0169] class IntentClassificationModel(nn.Module):

[0170] def __init__(self, bert_model_name="bert-base-chinese", num_intent_labels=3, dropout_prob=0.1):

[0171] super().__init__()

[0172] self.bert = BertModel.from_pretrained(bert_model_name)

[0173] self.tokenizer = BertTokenizer.from_pretrained(bert_model_name)

[0174] self.dropout = nn.Dropout(dropout_prob)

[0175] hidden_size = self.bert.config.hidden_size

[0176] self.intent_classifier = nn.Linear(hidden_size, num_intent_labels)

[0177] def forward(self, input_ids, attention_mask):

[0178] outputs = self.bert(input_ids=input_ids, attention_mask=attention_mask)

[0179] pooled_output = outputs.pooler_output #[CLS] token's representation

[0180] pooled_output = self.dropout(pooled_output)

[0181] intent_logits = self.intent_classifier(pooled_output)

[0182] return intent_logits

[0183] # Model training and inference code

[0184] class IntentClassifier:

[0185] def __init__(self, model_path=None):

[0186] self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")

[0187] self.model = IntentClassificationModel().to(self.device)

[0188] if model_path:

[0189] self.model.load_state_dict(torch.load(model_path, map_location=self.device)

[0190] def preprocess_text(self, item: str, max_length: int = 256):

[0191] texts =

[0192] for cq, hq, hi in zip(item['current_query'], item['history_query'],item['history_intent']):

[0193] if hq is None or hi is None:

[0194] text = f"{cq}"

[0195] else: # multi-turn conversation

[0196] text = f"{cq}[SEP]{hq}[SEP]{hi}"

[0197] [[ID=z4]]texts.append(text)

[0198] # Encoding using the tokenizer

[0199] encoding = model.tokenizer(

[0200] texts,

[0201] max_length=max_length,

[0202] padding='max_length',

[0203] truncation=True,

[0204] return_tensors='pt' )

[0206] return encoding

[0207] def predict(self, item):

[0208] """Predict the intent type"""

[0209] encoding = self.preprocess_text(item)

[0210] input_ids = encoding["input_ids"].to(self.device)

[0211] attention_mask = encoding["attention_mask"].to(self.device)

[0212] self.model.eval()

[0213] with torch.no_grad():

[0214] logits = self.model(input_ids, attention_mask)

[0215] probs = torch.softmax(logits, dim=1)

[0216] pred_idx = torch.argmax(probs, dim=1).item()

[0217] return pred_idx

[0218] def train(self, train_data, epochs: int = 10):

[0219] """Train the model"""

[0220] optimizer = torch.optim.AdamW(self.model.parameters(), lr=2e-5)

[0221] criterion = nn.CrossEntropyLoss()

[0222] for epoch in range(epochs):

[0223] self.model.train()

[0224] total_loss = 0

[0225] for batch in train_data:

[0226] inputs = batch["input_ids"].to(self.device)

[0227] masks = batch["attention_mask"].to(self.device)

[0228] labels = batch["labels"].to(self.device)

[0229] optimizer.zero_grad()

[0230] outputs = self.model(inputs, masks)

[0231] ## Loss Calculation

[0232] loss = criterion(outputs, labels)

[0233] ## Gradient Calculation

[0234] loss.backward()

[0235] ## Update Learning Rate

[0236] optimizer.step()

[0237] total_loss += loss.item();

[0238] Similarly, the above steps still adopt a rule-first, model-last approach. Based on rules, the speed can be greatly improved. When the rules cannot meet the requirements, model recognition is used.

[0239] S400, Knowledge Retrieval Steps, including:

[0240] S401. Clean and remove lottery interference information from user input (this interference information is lottery information, which will interfere with the subsequent retrieval process), and extract structured data such as period, time, number and indicators through regular expressions.

[0241] S402. Construct an inverted index for the knowledge base by color type, and implement fast keyword retrieval based on Whoosh;

[0242] S403. Use the BGE vector model to generate text embeddings and construct the FAISS vector database to achieve semantic retrieval.

[0243] S404. Perform strict verification and filtering on the multi-channel search results, and integrate the valid data to support the interactive response.

[0244] Correspondingly, the corresponding code for step S400 is as follows:

[0245] Extract based on the regular expression method:

[0246] Here, take the date as an example:

[0247] patterns =

[0248] # Process the complete date (year, month, day) - Modified: Support dates without "day" or "number" (

[0250] r'(\d{4}|\d{2})年(0?[1 - 9]|1[0 - 2]|一|二|三|四|五|六|七|八|九|十|十一|十二)月'

[0251] r'((?:

[12] [0 - 9]|3

[01] |0?[1 - 9])(?:日|号)?|(?:二十[一二三四五六七八九]?|三十[一二]?|十[一二三四五六七八九]?|[一二三四五六七八九十])(?:日|号)?)',

[0252] lambda m: (m.group(1), m.group(2), m.group(3).replace('日', '').replace('号', '') if m.group(3) else None)

[0253] ),

[0254] # Process the standard format date (YYYY - MM - DD, etc.) - Modified: Support the YY - MM - DD format (

[0256] r'(\d{4}|\d{2})[- / .](0?[1 - 9]|1[0 - 2])[- / .](0?[1 - 9]|

[12] [0 - 9]|3

[01] )',

[0257] lambda m: (m.group(1), m.group(2), m.group(3))

[0258] ),

[0259] # Process the digital month + day (without year) - Preferentially match the date with "day" or "number" (

[0261] r'(?:^|[^\d])(\d{1,2}) month (0?[1-9]|

[12] [0-9]|3

[01] )( day|number)',

[0262] lambda m: (None, m.group(1), m.group(2))

[0263] ),

[0264] # Handle Chinese month + day (without year) - Prioritize matching dates with "day" or "number" (

[0266] r'(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve) month'

[0267] r'(twenty[one|two|three|four|five|six|seven|eight|nine]?|thirty[one|two]?|ten[one|two|three|four|five|six|seven|eight|nine]?|[one|two|three|four|five|six|seven|eight|nine|ten])( day|number)',

[0268] lambda m: (None, m.group(1), m.group(2))

[0269] ),

[0270] # Handle numeric month + day (without year) - Dates without "day" or "number" (

[0272] r'(?:^|[^\d])(\d{1,2}) month (0?[1-9]|

[12] [0-9]|3

[01] )(?!\d)',

[0273] lambda m: (None, m.group(^|[^\d])(\d{1,2}) month (0?[1-9]|

[12] [0-9]|3

[01] )(?!\d)',

[0274] ),

[0275] # Handle Chinese month + day (without year) - Dates without "day" or "number" (

[0277] r'(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve) month'

[0278] r'(twenty[one|two|three|four|five|six|seven|eight|nine]?|thirty[one|two]?|ten[one|two|three|four|five|six|seven|eight|nine]?|[one|two|three|four|five|six|seven|eight|nine|ten])(?!\d)',

[0279] lambda m: (None, m.group(1), m.group(2))

[0280] ),

[0281] # Processing year and month (without day) - Modified: Support 2-digit year (

[0283] r'(\d{4}|\d{2}) year (0?[1-9]|1[0-2]|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve) month',

[0284] lambda m: (m.group(1), m.group(2), None)

[0285] ), (

[0287] r'(?:^|[^\d])(\d{1,2})[- / .](\d{1,2}) (day|number)(?!\d)',

[0288] lambda m: (None, m.group(1), m.group(2))

[0289] ),

[0290] # Processing numeric month (without year and day) (

[0292] r'(?:^|[^\d])(\d{1,2}) month',

[0293] lambda m: (None, m.group(1), None)

[0294] ),

[0295] # Processing pure Chinese month (without year and day) (

[0297] r'(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve) month',

[0298] lambda m: (None, m.group(1), None) )

[0301] ## Use project model for retrieval

[0302] class BGERetrievalSystem:

[0303] ​def __init__(self, model_name="BAAI / bge-base-zh-v1.5"):

[0304] Initialize the retrieval system.

[0305] self.model = SentenceTransformer(model_name)

[0306] # Vector Database (FAISS)

[0307] self.index = None

[0308] self.knowledge_base = []

[0309] def encode_text(self, texts, is_query=False):

[0310] """Vector embedding for generating text"""

[0311] if is_query:

[0312] texts = [text for text in texts]

[0313] else:

[0314] texts = [text for text in texts]

[0315] embeddings = self.model.encode(

[0316] texts,

[0317] normalize_embeddings=True # Normalize vectors )

[0319] return embeddings

[0320] def build_knowledge_base(self, knowledge_texts):

[0321] """Constructing a knowledge base vector index"""

[0322] self.knowledge_base = knowledge_texts

[0323] # Generate vectors of knowledge base text

[0324] doc_embeddings = self.encode_text(knowledge_texts, is_query=False)

[0325] # Initialize the FAISS index (use inner product to calculate similarity, recommended for BGE models)

[0326] dimension = doc_embeddings.shape[1] # Vector dimension (768)

[0327] self.index = faiss.IndexFlatIP(dimension)

[0328] # Add vector to index

[0329] self.index.add(doc_embeddings)

[0330] def retrieve(self, query, top_k=10):

[0331] """Retrieving and querying the most similar knowledge base text"""

[0332] # Generate query vectors

[0333] # Retrieve the most similar vectors (returns similarity score and index)

[0334] scores, indices = self.index.search(query_embedding, top_k)

[0335] return indices.

[0336] S500, Dynamic Context Loading Steps, including:

[0337] S501. Determine whether the current problem has a clear intent and a complete core entity. If so, it is a self-contained problem and there is no need to load the previous text.

[0338] S502. If the current intent is detected to be completely unrelated to the previous round, a topic switch is determined and the historical context is not loaded.

[0339] S503. If it is a non-self-contained problem and the topic has not been switched, load the above information to balance response efficiency and interaction accuracy.

[0340] It should be noted that the above examples are merely for explaining the present invention and should not be construed as limiting the scope of protection of the present invention.

[0341] Example 2

[0342] This embodiment is based on the same inventive concept as the full-color digital color intelligent interaction method described in Embodiment 1, and provides a full-color digital color intelligent interaction system, such as... Figure 2 As shown, it includes:

[0343] The multi-turn dialogue management module is used to: initialize the dialogue state, and extract and store the color type, intent and entity information from the user input using rule matching and model prediction strategies.

[0344] The lottery type identification module is used to: extract multi-dimensional features after preprocessing user input, identify multiple lottery types using a strong rule-first and model fallback strategy, and update the dialogue state.

[0345] The intent recognition module is used to: identify and update the core intents of lottery result queries, statistical analysis, and number recommendations through keyword matching, entity verification, and model depth judgment;

[0346] The knowledge retrieval module is used for knowledge retrieval based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration.

[0347] The dynamic context loading module is used to make dynamic decisions on loading historical dialogue context by judging the self-containment of the question and the intent switching state, and to make intelligent interactive responses.

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

[0349] Example 3

[0350] This embodiment provides a computer-readable storage medium, including:

[0351] The storage medium is used to store computer software instructions for implementing the full-color intelligent interactive digital color scheme described in Embodiment 1 above. It includes a program for executing the program set for the full-color intelligent interactive digital color scheme described above. Specifically, the executable program can be built into the full-color intelligent interactive digital color scheme system described in Embodiment 2. In this way, the full-color intelligent interactive digital color scheme system can implement the full-color intelligent interactive digital color scheme system described in Embodiment 1 by executing the built-in executable program.

[0352] Furthermore, the computer-readable storage medium in this embodiment can be any combination of one or more readable storage media, wherein the readable storage medium includes an electrical, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof.

[0353] Example 4

[0354] This embodiment provides an electronic device, such as... Figure 3 As shown, the electronic device may include: a processor 1501, a communication interface 1502, a memory 1503, and a communication bus 1504, wherein the processor 1501, the communication interface 1502, and the memory 1503 communicate with each other through the communication bus 1504.

[0355] Memory 1503 is used to store computer programs;

[0356] When the processor 1501 executes the computer program stored in the memory 1503, it implements the steps of the full-color intelligent interactive digital color method described in Embodiment 1 above.

[0357] As one embodiment of the present invention, the communication bus mentioned in the terminal above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0358] As one embodiment of the present invention, the communication interface is used for communication between the aforementioned terminal and other devices.

[0359] In one embodiment of the present invention, the memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0360] As one embodiment of the present invention, the processor described above may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0361] It should be understood that in the various embodiments of this document, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.

[0362] It should also be understood that, in the embodiments herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following associated objects have an "or" relationship.

[0363] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.

[0364] In the embodiments provided herein, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.

[0365] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described herein, depending on actual needs.

[0366] Furthermore, the functional units in the various embodiments of this document can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0367] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this paper, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this paper. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0368] The above description is merely an embodiment of the present invention and does not limit the patent scope of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of the present invention.

Claims

1. A digital color intelligent interaction method with full color coverage, characterized in that, Includes the following steps: Multi-turn dialogue management steps: Initialize the dialogue state, and use rule matching and model prediction strategies to extract and store the color type, intent and entity information from the user input. Lottery type identification steps: After preprocessing user input, multi-dimensional features are extracted, and a strong rule-first and model fallback strategy is used to identify multiple lottery types and update the dialogue state. Intent recognition steps: By using keyword matching, entity verification, and model depth analysis, the core intent of lottery result query, statistical analysis, and number recommendation is identified. Knowledge retrieval steps: Knowledge retrieval is performed based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration. Dynamic context loading steps: Dynamic decisions are made regarding loading historical dialogue context by judging the self-containment of the question and the intention switching state.

2. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The step of extracting and storing color type, intent, and entity information from user input using rule matching and model prediction strategies further includes: In response to receiving user input, a combination of rule matching and model prediction is used to extract entity information such as lottery type changes, user intent, focus period, numbers, and time. The extracted information is stored in a structured manner.

3. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The step of extracting multi-dimensional features after preprocessing user input further includes: Cleaning, word segmentation, and error correction preprocessing are performed on user input; After preprocessing, text keywords, numbers, gameplay, and rounds are extracted as the multi-dimensional features.

4. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The method of identifying multiple lottery types using a strong rule-first and model-backup strategy and updating the dialogue state further includes: First, strong rules are used to quickly match explicit lottery types, number-related lottery types, lottery types corresponding to the draw, and lottery types to which the gameplay belongs; Then, for fuzzy inputs not covered by the rules, a fine-tuned BERT classification model is used for deep recognition, outputting multiple color results; Update the matching and recognition results to the dialog state.

5. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The process of identifying the core intent of lottery result queries, statistical analysis, and number recommendations through keyword matching, entity verification, and model depth judgment further includes: By accurately matching user input text with keywords, a preliminary intent is determined, and then the preliminary intent is validated and optimized by combining entity information. The BERT intent classification model is used for deep recognition of fuzzy and complex inputs; single-turn dialogue inputs include the current query, and multi-turn dialogue inputs include the current query, the previous query, and the previous intent. The obtained lottery results, statistical analysis, and number recommendations will be updated to the chat status as the core intent.

6. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The knowledge retrieval based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration, further includes: Clean and remove color interference information from user input, and extract the corresponding structured data; A knowledge base inverted index is built according to lottery type, and keyword retrieval is performed based on Whoosh. Text embeddings are generated using the BGE vector model, and semantic retrieval is performed based on the FAISS vector database. The search results from multiple channels are validated and filtered, and the valid data is integrated as the final search result.

7. The digital color intelligent interaction method with full color coverage according to claim 1, characterized in that: The dynamic decision-making process for loading historical dialogue context by judging the self-containment of the question and the intent switching state further includes: Based on the clarity of the intent and the completeness of the core entities in the current question input by the user, determine whether the current question input by the user is a self-contained question; The response thus becomes self-contained, failing to load the preceding text; If the current intent is unrelated to the previous round, a topic switch is detected, and the historical context is not loaded. In response to a non-self-contained issue and without switching topics, load the information above.

8. A digital color intelligent interactive system with full color coverage, characterized in that, include: The multi-turn dialogue management module is used to: initialize the dialogue state, and extract and store the color type, intent and entity information from the user input using rule matching and model prediction strategies. The lottery type identification module is used to: extract multi-dimensional features after preprocessing user input, identify multiple lottery types using a strong rule-first and model fallback strategy, and update the dialogue state. The intent recognition module is used to: identify and update the core intents of lottery result queries, statistical analysis, and number recommendations through keyword matching, entity verification, and model depth judgment; The knowledge retrieval module is used for knowledge retrieval based on text preprocessing, regular expression extraction, keyword retrieval, and semantic retrieval, combined with data filtering and integration. The dynamic context loading module is used to make dynamic decisions on loading historical dialogue context by judging the self-containment of the question and the intent switching state, and to make intelligent interactive responses.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the full-color digital color intelligent interactive method according to any one of claims 1 to 7.

10. A computer device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein: The memory is used to store computer programs; The processor is configured to execute the steps of the full-color digital color intelligent interaction method according to any one of claims 1 to 7 by running a program stored in the memory.