Conversation processing method, electronic equipment and storage medium
By constructing and labeling a personality trait-based emotional dialogue dataset, and combining it with the evolution of social relationships, an emotional dialogue model was trained. This solved the problem of the single language style in existing systems and enabled the language model to achieve humanization and improve its emotional expression capabilities in human-computer interaction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-29
- Publication Date
- 2026-04-07
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing emotional dialogue systems lack social relationship stage annotations, making it impossible to simulate the gradual change in language style as users' relationships evolve from initial acquaintance to familiarity and then to deep interaction. This results in the model remaining in a single tone during interaction, lacking the language changes that occur in the evolution of real interpersonal relationships.
A personality trait-based emotional dialogue dataset is constructed, structured annotations are performed, and a composite structured label sequence is formed by combining social relationship evolution. Through the construction of a combination of training set, validation set, and test set, a perceptual dialogue model is used for fine-tuning training to generate an emotional dialogue model with personality consistency and structured expression capabilities.
It significantly enhances the anthropomorphic ability and emotional expression of language models in long-term human-computer interaction. It can dynamically adjust language style according to the depth of interaction and changes in social relationships, gradually moving from formal to relaxed and then to emotional resonance, thereby improving the immersion and affinity of human-computer interaction.
Smart Images

Figure CN121808013A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent dialogue technology, and in particular to a dialogue processing method, electronic device, and storage medium. Background Technology
[0002] In the field of Natural Language Processing (NLP), emotion-based dialogue systems are one of the key technologies driving the anthropomorphism of human-computer interaction. However, the training datasets of existing models lack annotations of social relationship stages, making it impossible to simulate the gradual changes in language style during the process of user relationships from initial acquaintance to familiarity and then to deep interaction. As a result, the models remain in a single tone during interaction and lack the language changes in the evolution of real interpersonal relationships. Summary of the Invention
[0003] To address the aforementioned technical problems, this invention proposes a dialogue processing method.
[0004] The technical solution to achieve the purpose of this invention is as follows:
[0005] In a first aspect, the present invention provides a dialogue processing method, the dialogue processing method comprising:
[0006] Construct a personality trait-based emotional dialogue dataset;
[0007] Based on diverse personality traits, the personality trait emotional dialogue dataset is structured and annotated, and combined with the evolution of social relationships, a composite structured label sequence is formed to construct a structured labeled dataset.
[0008] The structured labeled datasets are combined and constructed to form training sets, validation sets, and test sets that are adapted to different task input and output formats;
[0009] The perceptual dialogue model is fine-tuned using the training set, and the fine-tuned perceptual dialogue model is evaluated using the validation set and the test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities.
[0010] Obtain the question statement, input the question statement into the emotional dialogue model, and output the response statement corresponding to the question statement.
[0011] In some embodiments, constructing the personality trait-based emotional dialogue dataset for fine-tuning training includes:
[0012] The original dialogue dataset is first segmented to construct a preliminary vocabulary.
[0013] Based on the primary vocabulary and combined with the context window design, the weighted word frequency of each term is statistically analyzed. The weighting factor of the weighted word frequency comprehensively considers the semantic position, syntactic weight, and TF-IDF distribution of the term in the context, so as to further segment the original dialogue dataset, retain high-frequency and semantically significant keywords, and construct the personality trait emotion dialogue dataset. Here, TF-IDF represents the standard word frequency inverse document frequency of a term.
[0014] In some embodiments, the weighting factors include the standard term frequency inverse document frequency, the grammatical weight assigned based on part-of-speech, and the frequency normalization score of the word when it is surrounded by co-occurring keywords in a context window.
[0015] In some embodiments, the structured annotation of the personality trait-based emotional dialogue dataset based on diverse personality characteristics includes:
[0016] Based on the personality trait emotional dialogue dataset, a five-factor personality model is used to perform structured annotation, forming a structured annotated dataset. The personality labels in the annotated dataset serve as the main structural markers. The five-factor personality model includes the openness personality model, conscientiousness personality model, extraversion personality model, amicability personality model, and neuroticism personality model.
[0017] In some embodiments, the evolution of social relationships includes:
[0018] The three stages are: initial acquaintance, familiarity, and deep familiarity.
[0019] In a second aspect, the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, implements the dialogue processing method as described in the first aspect.
[0020] Thirdly, the present invention provides a non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, implements the dialogue processing method as described in the first aspect.
[0021] The significant advantages of this invention compared to existing technologies are:
[0022] This invention introduces a social stage evolution mechanism, enabling the language model to not only focus on semantic accuracy and task completion, but also to gradually change its language style, emotional expression, and emotional tone based on the depth of interaction, user needs, and the evolution of social relationships. This significantly enhances the language model's anthropomorphic ability and emotional expression in long-term human-computer interaction. The invention can dynamically adjust its language style according to changes in the depth of interaction and social relationship with the user, gradually transitioning from formal and restrained language in the initial acquaintance stage to relaxed and warm expression in the familiar stage, and ultimately reaching deep emotional resonance in the intimate stage. This makes the robot's language style more in line with the user's emotional needs and effectively enhances the immersion and friendliness of human-computer interaction. Attached Figure Description
[0023] Figure 1 This is a flowchart illustrating a dialogue processing method provided in one embodiment of the present invention;
[0024] Figure 2 This is a schematic diagram of the physical structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation
[0025] Embodiments of this application relate to dialogue processing methods. For example... Figure 1 As shown, in one embodiment, the dialogue processing method includes the following steps:
[0026] Step S10: Construct a personality trait-based emotional dialogue dataset for fine-tuning training;
[0027] In at least one embodiment, constructing a personality trait-based emotional dialogue dataset for fine-tuning training includes:
[0028] Step S101: Obtain and preprocess the original dialogue dataset to construct a dialogue dataset; in some embodiments, more than 10,000 psychological dialogue samples are obtained by web crawling to construct the original dialogue dataset, and the existing emotional data in the original dialogue dataset is integrated, invalid text is cleaned, the format is standardized, and the order is shuffled to construct the dialogue dataset.
[0029] Step S102: Download the BERT Chinese pre-trained model (BERT-chinese) vocabulary and install the jieba toolkit; use the jieba toolkit to segment the dialogue dataset, add all the segmented words to the BERT Chinese vocabulary and remove duplicate words to form a primary vocabulary;
[0030] In the text preprocessing stage, to improve the semantic concentration of the input corpus and the effectiveness of model training, based on the primary vocabulary and combined with the context window design, the weighted frequency of terms is statistically analyzed. The weighting factor of the weighted frequency of terms comprehensively considers the semantic position, syntactic weight and TF-IDF distribution of the terms in the context, so as to further segment the dialogue dataset, thereby retaining high-frequency and semantically significant keywords and removing low-frequency, functional and redundant terms, thus constructing a personality trait emotion dialogue dataset.
[0031] The formula for the weighted term frequency score is as follows:
[0032] Wi=α.TF-IDFi+β. POS-weighti +γ. ContextScorei
[0033] Where Wi represents the weighted term frequency score of term i, TF-IDFi represents the standard term frequency inverse document frequency of term i, POS-weighti represents the grammatical weight assigned based on part of speech (such as noun, adjective, etc.), ContextScorei represents the frequency normalization score of the term when it is surrounded by co-occurring keywords in the context sliding window, and α, β, γ represent the weight parameters that control each factor.
[0034] The vocabulary is constructed as shown in Table 1 below:
[0035] Step number Process Phase Processing Instructions Example / Result 1 Original word segmentation The original dialogue dataset was initially segmented using the jieba word segmenter. Input sentence: "He is always willing to listen to others." Output word segmentation: ["he", "always", "willing", "listen", "others"] 2 Secondary verification of word segmentation We introduced the BERT Chinese vocabulary list, re-standardized word segmentation, unified vocabulary style, and identified out-of-vocabulary (OOV) words. The output could be: ["he", "always", "willing", "listen", "others"] 3 Word frequency statistics and screening Frequency statistics were performed on all word segmentation results, low-frequency words (e.g., frequency < 5) were removed, and high-frequency keywords in the fields of psychology / emotion were retained. High-frequency words to retain: ["listening", "emotions", "trust", "stress", "gentleness"] 4 Add special markers Add general-purpose special tags required for model training, such as: <unk>(Unknown word) <mask>(masked words) <pad>(Fill in the blank) <cls> 、 <sep>wait < / sep> < / cls> < / pad> < / mask> < / unk> Special words added: [...] <unk> ", " <mask> "," <pad> "] < / pad> < / mask> < / unk> 5 Add alternative markers Increase <unused1>arrive <unused100>Used for injecting custom tags, temporary placeholders, or new concept annotations during fine-tuning. Add to:[" <unused1> ", ..., " <unused100> "] < / unused100> < / unused1> 6 Generate a specialized vocabulary, i.e., a dialogue dataset. All reserved words plus special / spare tags are compiled into a complete vocabulary for word vector encoding in the model's tokenizer. Example dialogue dataset size: approximately 10,000 entries
[0036] Step S102 is mainly used to construct semantic sparse representations, optimize the quality of training corpora, and is used in subsequent models for:
[0037] (1) Construct a structured vocabulary and a sentiment keyword pool;
[0038] (2) Guiding the mapping and generation of tag structures;
[0039] (3) Improve semantic attention concentration in the dialogue modeling process and reduce noise interference.
[0040] Semantic function tags and structural tags are added to the original dialogue dataset to construct the final vocabulary, i.e., the dialogue dataset. The structural tags include special tags, as follows:
[0041] <unk> 、 <mask> 、 <pad> 、 <cls> 、 <sep>spare marker <unused1>to <unused100>And extended tags to enhance semantic recognition<emo_start> ,<emo_end> , <agent> 、 <listener>wait;
[0042] A multi-strategy masking process was applied to the original dialogue dataset to construct a pre-trained dataset Dpre containing incomplete text and original label pairs. The masking strategies included: randomly shuffling the original dialogue dataset to obtain dataset Ds; applying random masking to a portion of the original dialogue dataset to obtain dataset Da; applying keyword-priority masking to another portion of the original dialogue dataset to obtain dataset Db; selecting data from dataset Ds that met the length threshold for whole-sentence masking to obtain dataset Dc; and further introducing a structure label-guided masking method to mask the context based on label regions to obtain dataset Dd. The specific datasets are shown in Table 2 below.
[0043] Mask type Input data subset Masking method cover the target Main purpose Dataset Da Random samples of dataset Ds Randomly select some words and replace them with <mask> < / mask> Random words in the text Improve the model's robustness to normal contexts. Dataset Db Another part of dataset Ds Use TextRank to extract keywords and mask them. Sentiment / Semantic Keywords Enhance the model's ability to identify key information fragments. Dataset Dc The remainder of dataset Ds The entire sentence covers the main clause or the central semantic clause. A whole paragraph or a long sentence (such as the core statement) Improve the model's contextual and inter-sentence reasoning capabilities.
[0044] The datasets Da, Db, Dc, and Dd are merged into a complete pre-training dataset Dpre. All masking operations are performed at the token level, and a "mask coverage control mechanism," a "mask density hierarchical sampling strategy," and an "Auxiliary Prediction Task (APT)" are introduced. The "mask coverage control mechanism" is introduced to limit the range of mask proportions in each class of samples to prevent training bias. The "mask density hierarchical sampling strategy" is introduced to gradually introduce low-density masks in the early stages of training and high-density masks to stabilize the modeling rhythm. The "Auxiliary Prediction Task (APT)" includes: (1) mask position prediction; (2) emotion evolution direction prediction, which is used to enhance the model's context localization and emotion flow modeling capabilities. Each training sample is attached with a supervision signal: mask index + emotion transition path, to achieve multi-objective learning of main task + APT.
[0045] Step S20: Based on diverse personality traits, the personality trait emotional dialogue dataset is structured and labeled, and combined with the evolution of social relationships, a composite structured label sequence is formed to construct a structured labeled dataset.
[0046] In some embodiments, based on the personality trait emotional dialogue dataset, a five-factor personality model (openness, conscientiousness, extraversion, affinity, neuroticism) is used to structurally annotate it, forming a structured annotated dataset. In the annotated dataset, the personality labels in the dataset serve as the primary structure labels, and the social relationship stages (new acquaintance, familiarity, and acquaintance) serve as secondary structure labels. The above structure is mapped to the sample data, and a pair of start and end labels is constructed for each label.
[0047] Step S30: Combine and construct the structured labeled dataset to form training set, validation set, and test set that are adapted to different task input and output formats;
[0048] In some embodiments, the labeled dataset is used to construct training, validation, and test sets according to the following three input-output combination methods: inputting the original text and prompts, and outputting structural words; inputting the original text and outputting complete annotations; inputting structural words and labels, and outputting complete annotations. The above methods generate training subsets Df1, Df2, and Df3 respectively, and the second method is used to construct validation set Dfdev and test set Dftest. The training set, validation set, and test set are divided in an 8:1:1 ratio.
[0049] Step S40: The perceptual dialogue model is fine-tuned using the training set mentioned above, and the fine-tuned perceptual dialogue model is evaluated using the validation set and test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities. With personality dimension as the modeling main line, emotion transfer as the dynamic feature, and structural labels as the generation constraint, a multi-strategy masking mechanism and auxiliary prediction task are introduced throughout the model pre-training and fine-tuning process, which effectively improves the model's ability to simulate character personality, understand context evolution, and output structured content in natural interactions.
[0050] In some embodiments, the Qwen-14B-Chat model is pre-trained using a dialogue dataset constructed from the pre-training dataset Dpre and its structure labels to obtain the basic pre-trained model Mqwen, i.e., the perceptual dialogue model. The following loss function is used to optimize the model parameters during training:
[0051]
[0052] in, Cross-entropy loss is used to measure the difference between the predicted output and the true label.
[0053] This is a set of vectors derived from the original text in the pre-training dataset Dpre after word segmentation and one-hot encoding. Let n be the set of predicted output vectors after the model takes incomplete text as input, and n be the total number of training samples. This indicates nested error items in the output structure tags. It is the true label of the i-th sample. λ is the distribution of the model's predicted output for the i-th sample; λ (lambda) is a hyperparameter / weight coefficient used to control the influence weight of the structural penalty term in the total loss.
[0054] We performed structure-aware pre-training using the Qwen-14B-Chat model to obtain the base model Mqwen with multi-label understanding capabilities. By inputting incomplete dialogue text processed by multi-policy masking and using the original text as the target, we trained the model to infer semantic and structural information from the incomplete context, enabling the model to understand and reconstruct personality expressions, emotional evolution, and relational structures.
[0055] The pre-training phase includes the following core modules:
[0056] Input encoding: The sample text is segmented, embedded, and positionally encoded to generate the token sequence Xinput; Encoder processing: The encoder processes Xinput and outputs the context representation Henc;
[0057] Decoder generation: Based on Henc, a structured label sequence is generated step by step; Multi-task branching: Tasks such as mask position prediction and sentiment trend classification are performed in parallel;
[0058] Tag structure control: Enable LCD mechanism to verify the integrity of tag nesting and automatically correct errors;
[0059] Loss optimization: Combine TextLoss, MaskPositionLoss, and DriftPredictionLoss, and backpropagate to update model parameters;
[0060] Validation mechanism: Use a validation set to validate various structural / sentiment metrics and record the optimal model parameters.
[0061] Training effectiveness evaluation metrics include:
[0062] Structural integrity ratio (SVR): The percentage of samples with valid paired and nested labels;
[0063] BLEU-4: Measures the consistency between generated text and structurally annotated text; Multi-label recall: Evaluates the accuracy of six-category label extraction;
[0064] Sentiment trend prediction accuracy: Tests the model's ability to respond to "emotional turning point" scenarios.
[0065] Training is considered complete when the metrics stabilize (e.g., SVR ≥ 98%, BLEU shows no increase, and Loss converges). The final parameters are saved as the pre-trained model Mqwen.
[0066] The pre-trained model Mqwen (a perceptual dialogue model) is trained using a training set in stages, including: inputting training subsets Df1 and Df2 into the Mqwen model, calculating cross-entropy losses Loss1 and Loss2, and updating the encoder parameters θe and decoder parameters θd respectively; inputting training subset Df3 into the model, updating only the decoder parameters θd, and calculating the cross-entropy loss Loss3. The loss function is defined as follows:
[0067] Loss1 = CrossEntropy(Pf1, Df1)
[0068] Loss2 = CrossEntropy(Pf2, Df2)
[0069] Loss3 = CrossEntropy(Pf3, Df3)
[0070] Update the model parameters by minimizing the above loss function until the validation set performance converges;
[0071] The fine-tuned model was evaluated using the validation set Dfdev and the test set Dftest, ultimately yielding an emotional dialogue model capable of outputting structured, human-style text based on personality dimensions and the stage of the dialogue relationship. The structured emotional elements include openness, conscientiousness, extraversion, affinity, neuroticism, and information on the stage of social relationship development.
[0072] Specifically, during the training cycle, after each training round, the model's performance is evaluated using the validation set Dfdev. Evaluation metrics include: BLEU score (measuring the quality of structured text reconstruction), Structural Completeness Rate (SVR, detecting whether nested labels are correctly closed), and Sentiment Tag Recall (evaluating the model's ability to extract six types of structural labels). The system automatically records the model weights corresponding to the best performance for each metric.
[0073] In some embodiments, this example sets the total training period to 50 epochs and incorporates an early stopping strategy to avoid overfitting. When the validation set performance continues to converge or the metric changes tend to stabilize, the training process is terminated, and the optimal fine-tuned model parameters are saved as the final structured model Mqwen, i.e., the emotion dialogue model.
[0074] During the inference phase, the structured text generated by the sentiment dialogue model must strictly conform to the sentiment tagging format specification. Each output should contain a complete six-pair tag structure, the tag order must be consistent with the predefined format, and the nesting level should be legally closed. If a certain type of tag is missing in actual semantic reasoning, the model should retain the tag pair but leave its content empty to ensure the structural consistency and format parsing capability of the overall output. The finely tuned sentiment dialogue model supports direct input of any real user's natural language dialogue text and automatically generates sentiment tag outputs that conform to the structure specification. This model can be widely used in psychological counseling assistance systems, virtual personality interaction platforms, user emotion profile generation engines, and semantic understanding enhancement modules, significantly improving their structured analysis and interpretability performance.
[0075] In some embodiments, the model training objective is designed as a multi-task joint optimization problem, and its overall loss function is defined as follows:
[0076] TextLoss MaskPositionLoss DriftPredictionLoss
[0077] Among them, TextLoss is the structured text reconstruction loss, which is used to supervise the model to accurately generate personality emotion label sequences with nested structures; MaskPositionLoss is the mask position prediction loss, which is used to guide the model to identify the accurate position of the masked token; DriftPredictionLoss is the emotion evolution trend discrimination loss, which enhances the model's ability to perceive the emotional trend in semantic context (such as "neutral → angry", "anxious → friendly").
[0078] Parameters α, β, and γ are weighting coefficients used to control the loss contribution ratio between the main task and the two auxiliary tasks. In some embodiments, α is 1.0, indicating the main task plays a central role; β is 0.5, indicating the first auxiliary task accounts for a moderate proportion, emphasizing structural guidance; and γ is 0.2, indicating the second auxiliary task provides weak supervision, guiding the emotional transition modeling. Through this weighting method, the model achieves enhanced structural sensitivity and emotional dynamic modeling capabilities while maintaining the performance of the main task. Through this joint optimization objective, the model not only learns language expressions but also simultaneously establishes the ability to judge emotional evolution and locate structural labels, significantly improving its accuracy and stability in structured multi-label emotion generation tasks.
[0079] In some embodiments, a "Label-Constrained Decoding (LCD)" mechanism is introduced during the perceptual dialogue modeling process to verify the legality of label nesting in real time during model generation. In each step of token decoding, the system checks whether the label hierarchy is closed and whether the order is reasonable. If illegal nesting or an unclosed structure is found, a structure rollback and error correction strategy is triggered. A valid label structure satisfies the following conditions:
[0080] ∀j, ∃i <j : match( <ti>,) ∧ NoCross(T)
[0081] Where: match indicates that the start tag and the end tag must be paired and closed; NoCross(T) indicates that tags must not be nested (i.e., the nested structure should be tree-like);
[0082] If the model generates labels with incorrect structure (such as unclosed labels) <o>(Identifying issues such as incorrect tags and illegal nesting). The LCD mechanism automatically reverts to the previous valid state and replaces erroneous tokens with contextual candidates, ensuring the structural correctness and parsability of the final generated result. This structural verification mechanism excels in handling multi-tag nested structures and tasks involving the coexistence of sentiment and personality tags, effectively reducing the rate of illegal structures during generation. It is a key strategy to ensure the robustness and compliance of the model in real-world applications.
[0083] Step S50: Obtain the question statement, input the question statement into the emotional dialogue model, and output the response statement corresponding to the question statement.
[0084] This invention introduces "Auxiliary Prediction Task (APT)" and "Label Structure Constraint Decoding Mechanism (LCD)" during model training, which not only improves language generation capabilities but also enhances the model's ability to detect complex structured label logic, emotional state transitions, and label validity. It is suitable for scenarios with high consistency requirements in multi-turn dialogues.
[0085] This invention expands the emotion labeling system beyond the original four emotion categories to include multiple dimensions such as personality, relationship stage, and emotion attribution, providing a foundation for building a hierarchical semantic labeling system and further enhancing the model's ability to abstract and express multidimensional emotional elements.
[0086] This invention introduces a social stage evolution mechanism, enabling the language model to not only focus on semantic accuracy and task completion, but also to gradually change its language style, emotional expression, and emotional tone based on the depth of interaction, user needs, and the evolution of social relationships. This significantly enhances the language model's anthropomorphic ability and emotional expression in long-term human-computer interaction. The invention can dynamically adjust its language style according to changes in the depth of interaction and social relationship with the user, gradually transitioning from formal and restrained language in the initial acquaintance stage to relaxed and warm expression in the familiar stage, and ultimately reaching deep emotional resonance in the intimate stage. This makes the robot's language style more in line with the user's emotional needs and effectively enhances the immersion and friendliness of human-computer interaction.
[0087] Figure 2 This is a schematic diagram of the physical structure of the electronic device provided by the present invention, such as... Figure 2 As shown, the electronic device may include: a processor 201, a communications interface 202, a memory 203, and a communication bus 204, wherein the processor 201, the communications interface 202, and the memory 203 communicate with each other through the communication bus 204. The processor 201 can call logical instructions in the memory 203 to execute a dialogue processing method, which includes: constructing a personality trait emotional dialogue dataset; based on diversified personality characteristics, performing structured annotation on the personality trait emotional dialogue dataset, and combining it with the evolution of social relationships to form a composite structured label sequence to construct a structured annotation dataset; combining the structured annotation dataset to form a training set, a validation set, and a test set adapted to different task input and output formats; using the training set to fine-tune the perceptual dialogue model, and evaluating the fine-tuned perceptual basic dialogue model through the validation set and the test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities; obtaining a question statement, inputting the question statement into the emotional dialogue model, and outputting a response statement corresponding to the question statement.
[0088] Furthermore, the logical instructions in the aforementioned memory 203 can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a 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 the present invention. 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.
[0089] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the dialogue processing methods provided by the above methods. The method includes: constructing a personality trait emotional dialogue dataset; based on diversified personality characteristics, performing structured annotation on the personality trait emotional dialogue dataset, and combining it with the evolution of social relationships to form a composite structured label sequence to construct a structured annotation dataset; combining the structured annotation dataset to form a training set, a validation set, and a test set adapted to different task input and output formats; using the training set to fine-tune the perceptual dialogue model, and evaluating the fine-tuned perceptual basic dialogue model through the validation set and the test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities; obtaining a question statement, inputting the question statement into the emotional dialogue model, and outputting a response statement corresponding to the question statement.
[0090] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0091] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the dialogue processing methods provided by the above methods. The method includes: constructing a personality trait emotional dialogue dataset; based on diversified personality characteristics, performing structured annotation on the personality trait emotional dialogue dataset, and combining it with the evolution of social relationships to form a composite structured label sequence to construct a structured annotation dataset; combining the structured annotation dataset to form a training set, a validation set, and a test set adapted to different task input and output formats; using the training set to fine-tune the perceptual dialogue model, and evaluating the fine-tuned perceptual basic dialogue model through the validation set and the test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities; obtaining a question statement, inputting the question statement into the emotional dialogue model, and outputting a response statement corresponding to the question statement.
[0092] The aforementioned computer-readable storage medium may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that may be used by or in connection with an instruction execution system, apparatus, or device.
[0093] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including—but not limited to—electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit programs for use by or in connection with an instruction execution system, apparatus, or device.
[0094] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including—but not limited to—wireless, wire, optical fiber, radio frequency (RF), etc., or any suitable combination thereof.
[0095] Computer program code for performing the operations described herein can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0096] The device embodiments described above are merely illustrative. 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 modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0098] The foregoing is merely intended to illustrate the principles of the invention. Furthermore, since many modifications and variations will readily occur to those skilled in the art, it is not intended to limit the invention to the exact structures and operations shown and described. While preferred embodiments have been described, details may be changed without departing from the essential concept of the invention. Therefore, the technical solutions involved in this invention include not only the technical solutions disclosed above, but also technical solutions constituted by equivalent substitutions of the technical features involved in the technical solutions of this invention. Matters not covered in this invention are common knowledge to those skilled in the art.< / o> < / ti> < / listener> < / agent> < / sep> < / cls> < / pad> < / mask> < / unk>
Claims
1. A dialogue processing method, characterized in that, include: Construct a personality trait-based emotional dialogue dataset; Based on diverse personality traits, the personality trait emotional dialogue dataset is structured and annotated, and combined with the evolution of social relationships, a composite structured label sequence is formed to construct a structured labeled dataset. The structured labeled datasets are combined and constructed to form training sets, validation sets, and test sets that are adapted to different task input and output formats; The perceptual dialogue model is fine-tuned using the training set, and the fine-tuned perceptual dialogue model is evaluated using the validation set and the test set to obtain an emotional dialogue model with personality consistency and structured expression capabilities. Obtain the question statement, input the question statement into the emotional dialogue model, and output the response statement corresponding to the question statement.
2. The dialogue processing method according to claim 1, characterized in that, The personality trait-based emotional dialogue dataset used for fine-tuning training includes: The original dialogue dataset is first segmented to construct a preliminary vocabulary. Based on the primary vocabulary and combined with the context window design, the weighted word frequency of each term is statistically analyzed. The weighting factor of the weighted word frequency comprehensively considers the semantic position, syntactic weight, and TF-IDF distribution of the term in the context, so as to further segment the original dialogue dataset, retain high-frequency and semantically significant keywords, and construct the personality trait emotion dialogue dataset. Here, TF-IDF represents the standard word frequency inverse document frequency of a term.
3. The dialogue processing method according to claim 2, characterized in that: The weighting factors include the standard term frequency inverse document frequency, the grammatical weight assigned based on part-of-speech, and the frequency normalization score of the word when it is surrounded by co-occurring keywords in the context window.
4. The dialogue processing method according to claim 3, characterized in that, The structured annotation of the personality trait-based emotional dialogue dataset based on diverse personality characteristics includes: Based on the personality trait emotional dialogue dataset, a five-factor personality model is used to perform structured annotation, forming a structured annotated dataset. The personality labels in the annotated dataset serve as the main structural markers. The five-factor personality model includes the openness personality model, conscientiousness personality model, extraversion personality model, amicability personality model, and neuroticism personality model.
5. The dialogue processing method according to claim 1, characterized in that, The evolution of social relationships includes: The three stages are: initial acquaintance, familiarity, and deep familiarity.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the dialogue processing method as described in any one of claims 1 to 5.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the dialogue processing method as described in any one of claims 1 to 5.