Personalized care method, device and equipment based on AI technology and storage medium
By constructing an LSTM-GRU hybrid neural network and memory storage hierarchical architecture, combined with knowledge graph technology, the problem of lack of personalized interaction and deep emotional understanding of dialogue systems in the existing technology is solved, and the generation of personalized care strategies and deep understanding of user emotions is achieved.
Patent Information
- Application Number
- CN202510274494.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-10
- Publication Date
- 2025-06-27
AI Technical Summary
The existing artificial intelligence dialogue system lacks personalized interaction and deep emotional understanding, resulting in mechanical inquiry and superficial emotional recognition, and is unable to provide coherent psychological support.
Dynamic user feature vectors are generated by constructing an LSTM-GRU hybrid neural network structure, and dynamic user portrait evolution is achieved by combining incremental learning and memory attenuation. Memory storage hierarchical architecture and knowledge graph technology are used to establish causal and temporal relationships, conduct compound analysis of emotional memory, and generate personalized care strategies.
It realizes a deep understanding and personalized response to user personalized care, improves the depth and emotional experience of interaction, and can reflect user changes in real time and accurately.
Smart Images

Figure CN120216636A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of artificial intelligence, and specifically to a personalized care method, device, equipment and storage medium based on AI technology. Background Art
[0002] The current technical bottlenecks of artificial intelligence dialogue systems are concentrated in the dual lack of interaction depth and humanistic care. Dialogue systems generally adopt fixed response templates and lack the ability to dynamically remember user individual characteristics, resulting in repeated mechanical inquiries in continuous conversations and making it difficult to form a personalized interaction context. In the emotional computing module, only shallow matching based on text keywords is relied on, and multi-modal signals such as speech emotion detection are not integrated, resulting in superficial emotion state recognition and being unable to build long-term emotional connections, and it is difficult to provide coherent psychological support when facing user emotional fluctuations. The existing data architecture design has continuity breaks, session information is stored as isolated events, lacks a multi-dimensional user portrait update mechanism, and also lacks the correlation analysis of cross-cycle behavior trajectories, resulting in the separation of historical data and real-time interaction. These technical defects jointly restrict the ability of dialogue systems to evolve towards deep emotional and personalized services.
[0003] Therefore, it is urgent to make breakthroughs in the directions of dynamic memory networks, multi-modal emotion perception, and incremental portrait construction. Summary of the Invention
[0004] In order to solve the problems existing in the above-mentioned prior art, the purpose of the present application is to provide a personalized care method, device, equipment and storage medium based on AI technology, which generates care strategies through constructing a multi-dimensional dynamic portrait based on memory storage and emotional analysis, and improves the personalization and interaction depth of artificial intelligence dialogue systems.
[0005] To achieve the above purpose, in the first aspect, an embodiment of the present application provides a personalized care method based on AI technology, including:
[0006] Collect data for preprocessing;
[0007] Generate dynamic user feature vectors by constructing an LSTM-GRU hybrid neural network structure; realize the dynamic evolution of the user portrait through incremental learning and memory decay, and construct a multi-dimensional user portrait;
[0008] Construct a memory storage hierarchical architecture, which includes a short-term memory storage system, a medium-term memory storage system, and a long-term memory storage system;
[0009] Extract and optimize keywords based on the medium-term memory storage system, and optimize and construct an interest map by using the hierarchical clustering method according to the keyword weight enhancement formula;
[0010] Based on the memory storage hierarchical architecture, establish a causal relationship and a temporal relationship between entity nodes and emotion nodes to construct a memory-associated knowledge graph;
[0011] Establish a triggering mechanism, perform composite analysis of emotional memory based on the memory-associated knowledge graph, and generate a care strategy.
[0012] Preferably, by constructing an LSTM-GRU hybrid neural network structure, a dynamic user feature vector is generated, where the LSTM-GRU hybrid neural network structure includes:
[0013] An LSTM layer for capturing seasonal interest evolution;
[0014] A GRU layer for tracking weekly mood fluctuations;
[0015] A Dense layer for generating a dynamic user feature vector;
[0016] The fusion formula of the dynamic user feature vector is: dynamic user feature vector = α * long-term interest vector + β * recent emotion vector + γ * real-time conversation feature, where α, β, and γ are the weight coefficients of the corresponding vectors respectively.
[0017] Preferably, the short-term memory storage system uses a Sorted Set data structure to store feature vectors with timestamps as Score values, retains data using a sliding window, and uses an LRU cache for hot data;
[0018] The medium-term memory storage system uses Neo4j to store data and creates relationship types between user nodes and interest nodes;
[0019] The long-term memory storage system uses an SQLite database table, including a life event table and a verification log table, migrates data from Neo4j through a data migration mechanism, and archives the data after an artificial review workflow.
[0020] Preferably, based on the medium-term memory storage system, extract and optimize keywords, and optimize and construct an interest graph using the hierarchical clustering method according to the keyword weight enhancement formula, including:
[0021] Use the BERT model to extract and optimize keywords, use the TF-IDF weight enhancement formula to generate vectors, use the Ward hierarchical clustering algorithm to optimize the vectors, and update the interest graph.
[0022] Preferably, based on the memory storage hierarchical architecture, establish a causal relationship and a temporal relationship between entity nodes and emotion nodes to construct a memory-associated knowledge graph, including:
[0023] Define node attributes, where the node attributes include entity nodes and emotion nodes;
[0024] Define the relationship types, which include causal relationship and temporal relationship;
[0025] Define the dynamic association rules, which include causal relationship update and temporal relationship mining;
[0026] The causal relationship update is to update the relationship in the database by calculating the causal probability between entity nodes and sentiment nodes;
[0027] The temporal relationship mining is to extract the user emotion series in the database, use the PrefixSpan algorithm to mine frequent sequences, and store the significant patterns in the graph.
[0028] Preferably, the collected data is preprocessed, including dialogue text processing:
[0029] Normalize the dialogue text timestamps for unifying the non-standardized times in the original dialogue;
[0030] Stop word filtering, by customizing the stop word list, to eliminate redundant information;
[0031] Punctuation cleaning, for deleting regular punctuation and retaining sentiment-related symbols;
[0032] Identify entities based on the pre-trained BERT model;
[0033] Associate the identified entities with their corresponding timestamps to generate structured metadata.
[0034] Preferably, the preprocessing of the collected data further includes:
[0035] Text sentiment analysis:
[0036] Perform attention weighting processing on the text data based on the Bi-LSTM model;
[0037] Through the text augmentation function, use sentiment synonyms replacement to augment the text data to obtain enhanced text;
[0038] Balance the text categories through the Focal Loss function;
[0039] Speech emotion recognition:
[0040] Load the audio for frame adding and windowing processing, calculate the static MFCC coefficients and the first-order difference coefficients, and combine them into a feature matrix;
[0041] Use the trained PCA to perform dimensionality reduction processing on the feature data;
[0042] Classify the speech emotion using the SVM classifier optimized by grid search.
[0043] Preferably, the establishment of the trigger mechanism is based on the memory - associated knowledge graph for emotional memory composite analysis to generate a care strategy, including:
[0044] Calculating the loneliness index, which is generated based on the conversation interval, the frequency of negative emotions, the active duration at night, and the number of mentions of a set person;
[0045] When the loneliness index exceeds the threshold, based on the memory - associated knowledge graph based on the speech emotion recognition and the text emotion analysis, a care strategy is generated, and the care strategy includes personalized care words and care reminders.
[0046] In a second aspect, an embodiment of the present application provides a personalized care device based on AI technology, including:
[0047] A pre - processing module for collecting and pre - processing data;
[0048] A user multi - dimensional portrait construction module for generating dynamic user feature vectors by constructing an LSTM - GRU hybrid neural network structure; realizing the dynamic evolution of the user portrait through incremental learning and memory decay, and constructing a user multi - dimensional portrait;
[0049] A memory storage hierarchical architecture construction module, where the storage hierarchical architecture includes a short - term memory storage system, a medium - term memory storage system, and a long - term memory storage system;
[0050] An interest graph construction module for extracting and optimizing keywords based on the medium - term memory storage system, and optimizing and constructing an interest graph using the hierarchical clustering method according to the keyword weight enhancement formula;
[0051] A knowledge graph construction module for establishing a causal relationship and a temporal relationship between entity nodes and emotional nodes based on the memory storage hierarchical architecture to construct a memory - associated knowledge graph;
[0052] A care strategy generation module for establishing a trigger mechanism, performing emotional memory composite analysis based on the memory - associated knowledge graph, and generating a care strategy.
[0053] In a third aspect, an embodiment of the present application provides a personalized care device based on AI technology. The electronic device includes at least one processor and a memory connected to the processor, where:
[0054] The memory is used to store a computer program;
[0055] The processor is used to execute the computer program so that the electronic device can implement the personalized care method as described in any one of the above.
[0056] Fourthly, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the personalized care method as described in any one of the above.
[0057] The present invention has the following beneficial effects:
[0058] (1) The personalized care method based on AI technology in the present application constructs an LSTM-GRU hybrid neural network structure, uses LSTM to capture seasonal interest evolution, and GRU to track weekly mood fluctuations. Through the dynamic user feature vector fusion formula, the long-term interest vector, recent mood vector, and real-time conversation features are combined to comprehensively reflect the features of users at different time scales. And through incremental learning and memory decay, the user portrait is dynamically evolved, and a multi-dimensional user portrait is constructed, so that the user portrait can reflect the changes of users in real time and accurately.
[0059] (2) The personalized care method based on AI technology in the present application uses a memory storage hierarchical architecture to perform hierarchical storage management according to memory characteristics, and manages memory data with different time spans more efficiently. The interest map constructed based on the memory storage hierarchical architecture takes into account the influence of recent data on interest hotspots, making the interest map better reflect the real-time interests of users. The memory association knowledge map constructed based on the memory storage hierarchical architecture can better understand the law of users' mood changes and provide support data for personalized care.
[0060] (3) The personalized care method based on AI technology in the present application performs emotional memory composite analysis based on the memory association knowledge map to generate a care strategy. By calculating the loneliness index comprehensively through the conversation interval, the frequency of negative emotions, the active duration at night, and the number of mentions of a set person, the care mode is triggered. The personalized care conversation and care reminder generate personalized natural text by integrating the multi-dimensional memory of users, effectively improving the emotional experience of users. Description of the Drawings
[0061] Figure 1 It is a schematic flowchart of the personalized care method based on AI technology disclosed in the embodiment of the present invention;
[0062] Figure 2 It is a schematic flowchart of preprocessing the collected data disclosed in the embodiment of the present invention;
[0063] Figure 3 It is a schematic flowchart of dialogue text processing disclosed in the embodiment of the present invention;
[0064] Figure 4 It is a schematic flowchart of text sentiment analysis disclosed in the embodiment of the present invention;
[0065] Figure 5Schematic diagram of the process of speech emotion recognition disclosed in the embodiments of the present invention;
[0066] Figure 6 Schematic diagram of the process of constructing an interest graph disclosed in the embodiments of the present invention;
[0067] Figure 7 Block diagram of a personalized care device based on AI technology disclosed in the embodiments of the present invention;
[0068] Figure 8 Schematic diagram of the structure of an electronic device disclosed in the embodiments of the present invention. Detailed implementation manners
[0069] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments.
[0070] Terms such as "first" and "second" in the specification and claims of this application and the above-mentioned accompanying drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules does not necessarily have to be limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or are inherent to these processes, methods, products, or devices. The naming or numbering of steps that appear in this application does not mean that the steps in the method flow must be executed in the time / logical order indicated by the naming or numbering. The named or numbered process steps can be changed in the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules that appears in this application is a logical division, and there may be other division methods in actual implementation. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. And the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed to multiple circuit modules, and some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this application.
[0071] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation manners.
[0072] The method of this application will be described below in the scenario facing the elderly, such as Figure 1As shown in the first aspect, an embodiment of the present application provides a personalized care method based on AI technology, and the method includes the following steps:
[0073] S11, collect data for preprocessing, such as Figure 2 shown, including the following steps:
[0074] S21, process dialogue text, such as Figure 3 shown, including:
[0075] Normalize the dialogue text timestamp to unify the non-standardized time in the original dialogue;
[0076] In some specific embodiments, all timestamp information is removed from the original text, and the processed text is stored in a variable; at the same time, the extracted timestamps are stored separately as a time series.
[0077] Stop word filtering, by customizing a stop word list, to eliminate redundant information;
[0078] In some specific embodiments, the Chinese stop word list provided by nltk and a custom stop word set that conforms to the speaking habits of the elderly are used, combined with the jieba word segmentation library, to perform word segmentation and stop word filtering on the input Chinese text, obtaining a cleaned word list to prepare for subsequent text analysis tasks.
[0079] Punctuation cleaning, used to delete regular punctuation and retain emotion-related symbols;
[0080] In some specific embodiments, using the string module and the replace and translate methods of strings, the removal operation of specific punctuation in the text retains emotion-related symbols such as "!", "?", "~", and the processed text can be used for subsequent natural language processing tasks.
[0081] Identify entities based on the pre-trained BERT model;
[0082] In some specific embodiments, load the pre-trained Chinese medical named entity recognition model and tokenizer through the transformers library, process the input text, identify the medical entities in it, such as symptoms - hypertension, drugs - metformin, and output the types and specific values of these entities, store the results in the entities variable, and identify entities using the BERT model to improve the disease symptom recognition accuracy.
[0083] Associate the identified entities with their corresponding timestamps to generate structured metadata;
[0084] In some specific embodiments, the timestamp information and the entity information of the person and the health status extracted from the text are recorded in JSON format, where the health status information includes the start time; the structured data obtained in this way can be directly used as the input features of the LSTM-GRU network to support the temporal modeling of the dynamic portrait.
[0085] S22, Text sentiment analysis, such as Figure 4 shown, including:
[0086] Perform attention weighting processing on the text data based on the Bi-LSTM model;
[0087] In some specific embodiments, the context is captured through a Bidirectional Long Short-Term Memory (Bi-LSTM) model, an AttentionLayer class is created and initialized; by calculating the attention weights, the input data is weighted and summed to highlight the important parts in the input sequence.
[0088] Through the text augmentation function, the text data is augmented by replacing with sentiment synonyms to obtain the augmented text;
[0089] In some specific embodiments, first create a dictionary for storing words and their corresponding synonym tables, such as the synonyms of "lonely" are "alone" and "desolate"; define the text augmentation function, tokenize the input text, traverse the word list to determine whether the word is in the synonym dictionary, and randomly replace the specific words in the input text to generate a new text with the same semantics as the original text but different expressions, so as to increase the diversity of the text data.
[0090] Balance the text categories through the Focal Loss function;
[0091] In some specific embodiments, create the Focal Loss function, set the hyperparameters for the Focal Loss function; handle the boundary cases of the predicted values, calculate the cross-entropy loss, calculate the weight part in the Focal Loss, multiply the weight by the cross-entropy loss to obtain the Focal Loss of each sample; after returning the internal loss function, apply it to the compilation process of the model, so that the model can pay more attention to the difficult-to-classify samples when dealing with class-imbalanced data, thereby improving the performance of the model and effectively solving the class imbalance problem caused by the implicit emotional expression of the elderly.
[0092] S23, Speech emotion recognition, such as Figure 5 shown, including:
[0093] Load the audio for frame addition and windowing processing, calculate the static MFCC coefficients and the first-order difference coefficients, and merge them into a feature matrix;
[0094] In some specific embodiments, an audio file is loaded, framed, and windowed, Mel Frequency Cepstral Coefficient (MFCC) features are extracted from the windowed audio frame data, the delta function is called to calculate the first-order difference of the static MFCC coefficients, and the static MFCC coefficients and their first-order difference features are merged, and the merged feature matrix is returned.
[0095] The dimensionality reduction of the feature data is performed using the trained PCA;
[0096] In some specific embodiments, through data standardization and principal component analysis, in the training phase, the parameters of standardization and PCA dimensionality reduction are calculated; in the inference phase, these parameters are used to perform dimensionality reduction on the new feature data, and finally low-dimensional feature data is obtained.
[0097] The speech emotion is classified using an SVM classifier optimized by grid search;
[0098] In some specific embodiments, GridSearchCV is used for grid search and cross-validation to optimize the kernel function parameters of the SVM classifier to find the optimal hyperparameter combination; confidence threshold processing is performed on the trained model to improve the reliability of the prediction results;
[0099] By fusing the dual-channel analysis of text and speech and adopting confidence-weighted fusion, the recognition accuracy is improved. Especially in contradictory scenarios, such as when the text content is "I am very happy recently" and the speech emotion feature is "sad intonation (pitch decreased by 30%, speech rate slowed down by 40%)", it is marked as "sad".
[0100] S12, by constructing an LSTM-GRU hybrid neural network structure, a dynamic user feature vector is generated; through incremental learning and memory decay, the dynamic evolution of the user portrait is realized, and a multi-dimensional user portrait is constructed;
[0101] Wherein, the LSTM-GRU hybrid neural network structure includes:
[0102] An LSTM layer for capturing seasonal-level interest evolution;
[0103] A GRU layer for tracking weekly-level mood fluctuations;
[0104] A Dense layer for generating a dynamic user feature vector;
[0105] In some specific embodiments, the hierarchical configuration parameters are shown in Table 1:
[0106] Table 1: Hierarchical configuration parameters of the LSTM-GRU hybrid neural network structure
[0107] Level Type Number of units Input dimension Output dimension 1 LSTM 128 300 128 2 GRU 64 128 64 3 Dense - 64 256
[0108] When inputting a batch of sequential data (word vectors), first perform feature extraction and sequential information processing through the LSTM layer, then use the output of the LSTM layer as input and pass it into the GRU layer for further processing. Next, take the features of the last time step of each sequence output by the GRU layer. Finally, linearly transform these features through the fully connected layer to obtain the final output feature vector. This hybrid architecture combines the advantages of LSTM and GRU and can be used for various tasks such as sequence classification and sentiment analysis.
[0109] The fusion formula for the dynamic user feature vector is: Dynamic user feature vector = α * long-term interest vector + β * recent emotion vector + γ * real-time conversation feature, where α, β, and γ are the weight coefficients corresponding to the respective vectors.
[0110] In some specific embodiments, the dynamic user feature vector = 0.6 * long-term interest vector + 0.3 * recent emotion vector + 0.1 * real-time conversation feature; by defining weights and performing matrix multiplication operations, the three vectors of different time scales are combined according to the set weights to generate a new vector that synthesizes information of different time scales;
[0111] The dynamic evolution of the user profile is achieved through incremental learning and memory decay. In incremental learning, to ensure that the similarity of user vectors at adjacent time steps is higher than that across time steps, the contrastive loss function L = max(0, cosine_sim(v_t, v_{t + 1}) - cosine_sim(v_t, v_{t - 1}) + margin) is used. Combining the set margin value, by comparing the cosine similarity between vectors at adjacent time steps, the model is prompted to learn a vector representation that makes the current time step vector v t more similar (compared to the vector at the previous time step v t+1 ) to the next time step vector v t-1 ;
[0112] A memory replay buffer is established to retain the input data of the last 100 conversations. Each time of update, 20% of the historical data is randomly selected to participate in the training. To enable the model to reasonably update its own parameters according to the feedback of the loss function in each iteration, the parameter update process of each iteration of the model includes four steps: gradient clearing, backpropagation, gradient clipping, and parameter update; gradient clearing ensures that the gradient calculation of each iteration is independent; backpropagation calculates the gradient to provide a basis for parameter update; gradient clipping prevents gradient explosion and ensures the stability of training; parameter update adjusts the parameters of the model according to the gradient to continuously optimize the model;
[0113] The memory decay uses a time decay function to decay the memory weight. In some specific embodiments, the rule of the decay factor is as follows: every 72 hours, the memory weight decays to 30% of the original value. That is, after 72 hours, the decay factor takes the value of 0.3; after 144 hours, the decay factor takes the value of 0.09. Multiplying the original weight of the memory by the decay factor can obtain the decayed weight. At the same time, the decay factor can also be adaptively adjusted. For example, if the user is active for 3 consecutive days, the decay factor drops to 0.2; if the user is inactive for 7 days, the decay factor rises to 0.4.
[0114] To protect important events, when processing memories, it is necessary to check whether the memory content contains specific keywords, such as "surgery" and "birthday". If these keywords are included, the decay function is not applied and the memory weight remains unchanged.
[0115] In this step, based on the LSTM-GRU hybrid neural network structure, the long-term interest vector, recent emotion vector, and real-time conversation features are fused to generate a dynamic feature vector. A multi-dimensional user portrait library is established, and the dynamic update of the user portrait is realized by combining incremental learning and the memory decay factor. It can effectively capture the evolution of the user's interests and emotional changes, comprehensively grasp the user's emotional state, enable the system to adapt to the changes in the user's emotions and interests, improve the anthropomorphic degree of the interaction during the interaction process, and maintain the timeliness and accuracy of the interaction.
[0116] S13, construct a memory storage hierarchical architecture, which includes a short-term memory storage system, a medium-term memory storage system, and a long-term memory storage system;
[0117] The short-term memory storage system uses the Sorted Set data structure to store feature vectors with timestamps as Score values, retains data using a sliding window, and uses an LRU cache for hot data;
[0118] Sorted Set is an ordered set provided by Redis. Each element has a corresponding score, and the elements in the set are sorted according to the scores. In some specific embodiments, the conversation data is stored as a member in the Sorted Set in the form of a JSON string, and the timestamp is used as the score at the same time. Through Crontab configuration, a cleanup script is executed every 24 hours. To improve the access efficiency of short-term memory data, the LRU cache is enabled for the data in the most recent 2 hours, caching the most frequently accessed and latest data to reduce direct access to Redis.
[0119] The medium-term memory storage system uses Neo4j to store data and creates the relationship types between user nodes and interest nodes;
[0120] In the Neo4j database, information such as users, interests, and emotion events is stored in the graph database in the form of nodes and relationships. For example, a user node u1 is created, and an interest node "gardening" is created. The attributes of this interest node include interest name, interest weight, and the last update time. A directed relationship is established between the user node and the interest node, indicating that user u1 is interested in gardening. The attributes of the emotion node include emotion type, emotion intensity, and triggering event. A directed relationship is established between the user node and the emotion node, presenting the association between the user and the emotion node. Through this data model of the graph structure, the interest preferences and emotion states of users can be intuitively displayed.
[0121] The long-term memory storage system uses SQLite database tables, including a life event table and a verification log table. It migrates data from Neo4j through a data migration mechanism and archives the data after an artificial review workflow.
[0122] Based on the different characteristics of short-term, medium-term, and long-term memory data, this memory storage hierarchical architecture respectively adopts appropriate storage technologies and management strategies, achieving refined management of different types of data. At the same time, this collaborative method across storage systems can better support complex business requirements, such as dynamic updates of user portraits, sentiment analysis, and mining of long-term behavior patterns, etc., providing more powerful functions and scalability for the system.
[0123] S14, extract and optimize keywords based on the medium-term memory storage system. According to the keyword weight enhancement formula, use the hierarchical clustering method to optimize and construct an interest map, as Figure 6 shown, including:
[0124] Use the BERT model to extract and optimize keywords, use the TF-IDF weight enhancement formula to generate vectors, use the Ward hierarchical clustering algorithm to optimize the vectors, and update the interest map;
[0125] In some specific embodiments, using the BERT model to extract and optimize keywords includes: adopting the bert-base-chinese Chinese pre-training model, loading the BertForTokenClassification model and the BertTokenizer tokenizer, screening verbs and nouns, filtering low-frequency words, reducing noise interference, and finally taking the first N words as keywords;
[0126] In some specific embodiments, the TF-IDF weight enhancement formula is: TF-IDF_score = (0.6 * term_freq + 0.4 * recent_freq) * log(1 + N / (doc_freq + 1)), where term_freq represents the term frequency, recent_freq represents the number of times the word appears in the most recent 7 days, N represents the total number of documents, and doc_freq represents the number of documents containing the word; compared with the traditional TF-IDF formula that only considers the term frequency (TF) and the inverse document frequency (IDF), this application introduces recent_freq. Through the weighted average method, words with a high recent occurrence frequency account for a larger proportion in the weight calculation, thus better reflecting the current interest hotspots;
[0127] The Ward hierarchical clustering algorithm performs clustering operations on the generated vectors and assigns clustering labels to each vector. The clustering results are visually displayed by generating a label tree, which helps to analyze the relationships and characteristics between each cluster. Based on this, user interest categories can be more accurately identified, and then a more accurate, effective, and real-time interest map can be constructed.
[0128] S15, based on the memory storage hierarchical architecture, establish causal and temporal relationships between entity nodes and emotional nodes to construct a memory association knowledge graph;
[0129] Including:
[0130] Define node attributes, where the node attributes include entity nodes and emotional nodes;
[0131] Define relationship types, where the relationship types include causal relationships and temporal relationships;
[0132] Define dynamic association rules, where the dynamic association rules include causal relationship updates and temporal relationship mining;
[0133] The causal relationship update is to update the relationship in the database by calculating the causal probability between entity nodes and emotional nodes;
[0134] The temporal relationship mining is to extract the user emotion series in the database, use the PrefixSpan algorithm to mine frequent sequences, and store the significant patterns in the knowledge graph.
[0135] In some specific embodiments, the entity node attributes include the event unique identifier, event type, event description, and event occurrence time; the emotional nodes include the emotion unique identifier, emotion type, emotion intensity, and emotion start time;
[0136] The causal relationship is to find specific entity nodes and sentiment nodes through the MATCH statement, and create a directed relationship of the TRIGGERS type to indicate that an event triggers a certain sentiment. The attributes of this causal relationship include trigger probability, trigger delay hours, and relationship confidence; the temporal relationship is to find two sentiment nodes through the MATCH statement and create a directed relationship of the PRECEDES type to indicate that one sentiment precedes another in time; the attributes of this temporal relationship include time interval and the correlation between the two sentiments.
[0137] For the update of the causal relationship, the causal probability is calculated by counting the number of times the entity node and the sentiment node appear simultaneously and the total number of nodes of this type. The MERGE statement is used to search for or create the TRIGGERS relationship in the knowledge graph. If the relationship already exists, its probability attribute and last update time attribute are updated; through the causal relationship update logic, the causal relationship strength between entity events and sentiments can be continuously adjusted according to new data, ensuring the accuracy and timeliness of the relationship.
[0138] For the mining of the temporal relationship, the emotion sequence of the user is extracted through Neo4j query statements and sorted by time; the PrefixSpan algorithm is used to perform frequent sequence mining on the emotion sequence, and the minimum support is set; the mined significant patterns are traversed and these significant patterns are stored in the knowledge graph as temporal relationships; through the temporal relationship mining algorithm, potential temporal patterns can be mined from the user's emotion sequence and added to the knowledge graph, enriching the content of the knowledge graph, better understanding the law of the user's emotion changes, and providing support for personalized care output.
[0139] S16. Establish a trigger mechanism, perform sentiment memory compound analysis based on the memory-associated knowledge graph, and generate a care strategy.
[0140] Furthermore, it includes the following steps:
[0141] Calculate the loneliness index, which is generated based on the conversation interval, the frequency of negative emotions, the active duration at night, and the number of times a set person is mentioned.
[0142] In some specific embodiments, user-related data is obtained from the memory storage hierarchical architecture. For example, the user's most recent activity time is obtained from the short-term memory storage system Redis and assigned to the conversation interval variable, and the conversation interval flag is calculated. For example, by comparing whether the difference between the current time and the user's most recent activity time is greater than M hours, if it is greater, the conversation interval flag interval_flag is set to 1, otherwise it is set to 0; through the query statement of the medium-term memory storage system Neo4j, the relationship between the user node and the emotion node is matched, and the records where the user is a specified value and the emotion type is "lonely", "anxious", or "sad" are filtered out, and the quantity is counted and assigned to the negative emotion frequency variable, and the negative emotion frequency variable is normalized to obtain the negative emotion index normalized_negative; the user's nighttime activity duration is obtained and assigned to the nighttime active duration variable, and the nighttime active duration variable is normalized to obtain the nighttime activity index normalized_night; using the query statement of the long-term memory storage system SQLite, the number of records where the user is a specified value, the type is "relative", and the value is "son" or "daughter" is queried, the first value of the query result is obtained and assigned to the variable of the number of times the specified person is mentioned, and the variable of the number of times the specified person is mentioned is normalized to obtain the index of the number of times the specified person is mentioned normalized_children;
[0143] Using the formula: L = ω1 * interval_flag + ω2 * normalized_negative + ω3 * normalized_night + ω4 * normalized_children, the above-mentioned various indicators are weighted and summed to obtain the loneliness index L. In some preferred embodiments, ω1 is 0.4, ω2 is 0.3, ω3 is 0.2, and ω4 is 0.1. This loneliness index comprehensively considers factors such as the user's activity time interval, negative emotions, nighttime activities, and family relationships, and evaluates the user's mental state in a data-driven manner.
[0144] When the loneliness index exceeds the threshold, based on the memory association knowledge graph based on the speech emotion recognition and the text emotion analysis, a care strategy is generated. The care strategy includes personalized care words and care reminders;
[0145] In some specific embodiments, the threshold is determined by calculating the ROC curve. Among them, 1000 samples are manually labeled as whether they are lonely, the 4 indicators of each sample are calculated, trained using a logistic regression model, and the threshold is determined by maximizing the Youden index; this threshold is used to regularly check the loneliness index of active users, and the care mode is triggered when the loneliness index exceeds the threshold;
[0146] The personalized caring words are: retrieve relevant information of the designated user from the memory storage hierarchical architecture library, integrate the user's short-term memory, long-term memory and emotional memory into a dictionary; select a greeting template, select a suitable memory reference according to user data, select a suitable emotional response according to the user's current emotion, and combine the greeting, memory reference and emotional response into a complete character; this application is based on a memory-related knowledge graph, integrates the user's short-term, long-term and emotional memory, selects a suitable response according to the user's current emotion, combines voice emotion recognition and text emotion analysis, and generates personalized caring words and caring reminders, which effectively enhances the user's emotional experience.
[0147] Load the pre-trained large language model and word segmenter. In some specific embodiments, the T5 model can be used, and the original text is further optimized, and the specified dialect is added to generate a more natural and rich text. The exemplary output text is:
[0148] "Good morning, you mentioned knee pain last time, you should get more rest! I haven't heard you mention your son recently, how is he doing?";
[0149] In some specific embodiments, the caring reminder includes holiday greetings, by searching the user node corresponding to the specified user ID in the Neo4j graph database, finding the relative node associated with it through the kinship relationship, and sending holiday reminders before holidays through routine function checks. The relative nodes are combined with holiday information and memory content to generate personalized holiday greetings. An exemplary output text is "Auntie Wang, Mid-Autumn Festival is coming soon. I remember that the mooncakes you made last year were very delicious. Say hello to Xiao Ming and Xiao Fang on my behalf!".
[0150] Second, as Figure 7 As shown, an embodiment of the present application provides a personalized care device based on AI technology, including:
[0151] A preprocessing module 31 is used to collect data for preprocessing;
[0152] The user multi-dimensional portrait construction module 32 is used to generate a dynamic user feature vector by constructing an LSTM-GRU hybrid neural network structure; realize the dynamic evolution of the user portrait through incremental learning and memory decay, and construct a user multi-dimensional portrait;
[0153] A memory storage hierarchical architecture building module 33, wherein the storage hierarchical architecture includes a short-term memory storage system, a medium-term memory storage system, and a long-term memory storage system;
[0154] The interest graph construction module 34 is used to extract and optimize keywords based on the medium-term memory storage system, and optimize and construct the interest graph using a hierarchical clustering method according to a keyword weight enhancement formula;
[0155] A knowledge graph construction module 35, configured to construct a memory - associated knowledge graph by establishing a causal relationship and a temporal relationship between entity nodes and sentiment nodes based on a memory storage hierarchical architecture;
[0156] A care strategy generation module 36, configured to establish a trigger mechanism, perform composite analysis of emotional memory based on the memory - associated knowledge graph, and generate a care strategy.
[0157] In a third aspect, as Figure 8 shown, an embodiment of the present application provides an electronic device. The electronic device 40 includes: a processor 41, a memory 43, and an application loader stored on the memory 43 and executable on the processor. The application loader is configured to implement the personalized care method as described in any one of the above.
[0158] The memory 43 is used to store executable instructions of the processor 41;
[0159] Wherein, the processor 41 is configured to execute the technical solutions in any one of the foregoing method embodiments by executing the executable instructions.
[0160] Optionally, the memory 43 can be either independent or integrated with the processor 41.
[0161] Optionally, when the memory 43 is a device independent of the processor 41, the device 40 may further include:
[0162] A bus 44. The memory 43 and the communication interface 42 are connected to the processor 41 through the bus 44 to complete mutual communication. The communication interface 42 is used to communicate with other devices.
[0163] Optionally, the communication interface 42 can be specifically implemented by a transceiver. The communication interface is used to implement communication between the database access device and other devices (such as clients, read - write libraries, and read - only libraries). The memory may include a random access memory (RAM), and may also include a non - volatile memory, such as at least one disk memory.
[0164] The bus 44 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.
[0165] The above-mentioned processor 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, discrete hardware components.
[0166] This device is used to execute the technical solutions in any of the foregoing method embodiments. The implementation principles and technical effects are similar and will not be elaborated here.
[0167] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the personalized care method as described in any one of the above.
[0168] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general-purpose hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0169] Finally, it should be noted that the above embodiments are only preferred specific implementation manners of the present invention, and the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention, according to the technical solution and inventive concept of the present invention, makes equivalent substitutions or changes, and should be covered by the protection scope of the present invention.
Claims
1. A personalized care method based on AI technology, characterized in that: include: Collect data for preprocessing; Generate dynamic user feature vectors by building a LSTM-GRU hybrid neural network structure; realize dynamic evolution of user portraits through incremental learning and memory decay, and build multi-dimensional user portraits; Constructing a memory storage hierarchical architecture, wherein the memory storage hierarchical architecture includes a short-term memory storage system, a medium-term memory storage system, and a long-term memory storage system; Extract and optimize keywords based on the medium-term memory storage system, and use the hierarchical clustering method to optimize and construct the interest graph according to the keyword weight enhancement formula; Based on the memory storage hierarchical architecture, the causal and temporal relationships between entity nodes and emotional nodes are established to construct a memory-related knowledge graph; Establish a trigger mechanism, conduct complex analysis of emotional memories based on the memory-related knowledge graph, and generate care strategies.
2. The personalized care method according to claim 1, characterized in that: The dynamic user feature vector is generated by constructing an LSTM-GRU hybrid neural network structure, wherein the LSTM-GRU hybrid neural network structure includes: LSTM layer to capture seasonal interest evolution; GRU layer, used to track week-level sentiment fluctuations; Dense layer, used to generate dynamic user feature vectors; The fusion formula of the dynamic user feature vector is: dynamic user feature vector = α*long-term interest vector+β*recent emotion vector+γ*real-time conversation feature, where α, β, and γ are weight coefficients of the corresponding vectors respectively.
3. The personalized care method according to claim 1, characterized in that: The short-term memory storage system adopts a Sorted Set data structure, stores feature vectors with timestamps as Score values, uses a sliding window to retain data, and uses an LRU cache for hot data; The medium-term memory storage system uses Neo4j to store data and create relationship types between user nodes and interest nodes; The long-term memory storage system uses SQLite database tables, including life event tables and verification log tables, migrates data from Neo4j through a data migration mechanism, and archives the data after a manual review workflow.
4. The personalized care method according to claim 1, characterized in that: The method of extracting and optimizing keywords based on the medium-term memory storage system, optimizing and constructing the interest graph using the hierarchical clustering method according to the keyword weight enhancement formula, includes: Use the BERT model to extract and optimize keywords, use the TF-IDF weight enhancement formula to generate vectors, use the Ward hierarchical clustering algorithm to optimize the vectors, and update the interest graph.
5. The personalized care method according to claim 1, characterized in that: The memory-related knowledge graph is constructed by establishing causal and temporal relationships between entity nodes and emotion nodes based on the memory storage hierarchical architecture, including: Defining node attributes, wherein the node attributes include entity nodes and sentiment nodes; Defining relationship types, wherein the relationship types include causal relationships and temporal relationships; Defining dynamic association rules, wherein the dynamic association rules include causal relationship updating and temporal relationship mining; The causal relationship updating is to update the relationship in the database by calculating the causal probability between the entity node and the sentiment node; The temporal relationship mining is to extract the user emotion series from the database, use the PrefixSpan algorithm to mine frequent sequences, and store significant patterns in the graph.
6. The personalized care method according to claim 1, characterized in that: The collected data is preprocessed, including conversation text processing: Normalize the timestamps of conversation texts to unify the non-standardized times in the original conversations; Stop word filtering, remove redundant information through custom stop word lists; Punctuation cleaning, which is used to remove regular punctuation and retain emotion-related symbols; Recognize entities based on the pre-trained BERT model; Associate the identified entities with their corresponding timestamps to generate structured metadata.
7. The personalized care method according to claim 6, characterized in that: The collected data is preprocessed, and further comprises: Text Sentiment Analysis: Perform attention weighted processing on text data based on the Bi-LSTM model; Through the text enhancement function, sentiment synonyms are used to replace and expand text data to obtain enhanced text; Balance text categories through FocalLoss loss function; Speech Emotion Recognition: Load the audio for frame segmentation and windowing, calculate the static MFCC coefficients and first-order difference coefficients, and merge them into a feature matrix; Use the trained PCA to reduce the dimension of feature data; Speech emotion classification is performed using SVM classifier optimized by grid search.
8. The personalized care method according to claim 7, characterized in that: The trigger mechanism is established to perform complex analysis of emotional memory based on the memory association knowledge graph and generate a care strategy, including: Calculating a loneliness index, where the loneliness index is generated based on conversation intervals, frequency of negative emotions, duration of nighttime activity, and number of times a set character is mentioned; When the loneliness index exceeds a threshold, a care strategy is generated based on the memory-associated knowledge graph based on the voice emotion recognition and the text emotion analysis. The care strategy includes personalized care words and care reminders.
9. A personalized care device based on AI technology, characterized in that: include: A preprocessing module is used to collect data for preprocessing; The user multi-dimensional portrait construction module is used to generate dynamic user feature vectors by constructing an LSTM-GRU hybrid neural network structure; it realizes the dynamic evolution of user portraits through incremental learning and memory decay, and constructs user multi-dimensional portraits; A memory storage hierarchical architecture building module, wherein the storage hierarchical architecture includes a short-term memory storage system, a medium-term memory storage system, and a long-term memory storage system; The interest graph construction module is used to extract and optimize keywords based on the medium-term memory storage system, and optimize the construction of the interest graph using the hierarchical clustering method according to the keyword weight enhancement formula; The knowledge graph construction module is used to build a memory-related knowledge graph by establishing causal and temporal relationships between entity nodes and emotion nodes based on the memory storage hierarchical architecture; The care strategy generation module is used to establish a trigger mechanism, conduct a complex analysis of emotional memories based on the memory-related knowledge graph, and generate care strategies.
10. An electronic device, characterized in that: The electronic device comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the personalized care method according to any one of claims 1 to 8.
11. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the personalized care method as described in any one of claims 1 to 8.
Citation Information
Cited By
Digital employee collaborative screening method and system
CN120633673A
Sleep health dynamic evaluation method and system based on user feedback driving and medium
CN120727303A
Multi-terminal long-memory multi-mode intelligent personification interaction method and system
CN121436181A
Multi-modal intelligent humanization interaction method and system for multi-end long memory
CN121436181B
Dynamic memory and context management system for AI chat agent
CN121478924A