Portrait construction method, electronic device and storage medium based on human-computer dialogue
By selecting a graph database or relational database to store profile data in human-computer dialogue, and performing operations based on operation type and feature information, the problem of missing profile data is solved, enabling more complete and accurate profile construction, and improving user experience and business value.
Patent Information
- Application Number
- CN202310318604.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-23
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-03-23
AI Technical Summary
In existing technologies, the portrait construction method based on human-computer dialogue has problems such as missing portrait data and poor integrity. In particular, it is impossible to effectively store portrait data when complete triple information cannot be extracted.
By obtaining the statements to be extracted, determining the target operation type and profile feature information, selecting a graph database or relational database as the target database, and performing corresponding operations based on the operation type and feature information, including writing, deleting, querying, or updating profile data, the extraction and retrieval capabilities of the graph database are utilized, combined with the flexibility of the relational database to store information that cannot be extracted in complete triplets, to construct a complete profile.
Even when complete triplet information cannot be extracted, it can still effectively store and update profile data, improve the completeness and accuracy of profile construction, avoid data omissions, and enhance the friendliness and personalized recommendation capabilities of the chatbot.
Smart Images

Figure CN116340490B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of human-computer interaction technology, and in particular to a method for constructing a profile based on human-computer dialogue, an electronic device, and a storage medium. Background Technology
[0002] In recent years, the significant improvement in the hardware and network performance of terminal devices has gradually changed traditional human-computer interaction methods, and chatbot modules have gradually become the main interaction method for devices such as cars, chatbots, and smart speakers. In open domain scenarios, during conversations between users and chatbots, users often inadvertently describe their own profiles, such as "name," "gender," and "hobbies." Therefore, extracting and storing profile data in human-computer dialogue is crucial. On the one hand, it can improve the coherence and friendliness of the chatbot's conversations with users, making users feel that the chatbot is truly their own, thus deepening user trust in the chatbot. On the other hand, personalized marketing recommendations can be made to users based on their profiles, which has significant commercial value.
[0003] Graph databases have good extraction, retrieval, and reasoning capabilities. However, currently, the way to store profile data in graph databases is to extract triples to build profiles. If complete triple information cannot be extracted, profile data cannot be stored, resulting in omissions in profile data and poor profile integrity. Summary of the Invention
[0004] The main purpose of this application is to provide a portrait construction method, electronic device and storage medium based on human-computer dialogue, which aims to solve the technical problem of poor integrity of portrait construction based on human-computer dialogue in the prior art.
[0005] To achieve the above objectives, this application provides a method for constructing a profile based on human-computer dialogue, comprising the following steps:
[0006] Get the statement to be extracted;
[0007] The target operation type and profile feature information are determined based on the statement to be extracted.
[0008] Based on the portrait feature information, a graph database or a relational database is selected as the target database;
[0009] The target database is operated on based on the target operation type and the profile feature information.
[0010] This application also provides a portrait construction device based on human-computer dialogue, the portrait construction device based on human-computer dialogue comprising:
[0011] The acquisition module is used to acquire the statements to be extracted;
[0012] The first determining module is used to determine the target operation type and profile feature information based on the statement to be extracted.
[0013] The second determining module is used to select a graph database or a relational database as the target database based on the portrait feature information.
[0014] The operation module is used to operate on the target database based on the target operation type and the portrait feature information.
[0015] This application also provides an electronic device, which is a physical device, comprising: a memory, a processor, and a program of the human-computer dialogue-based portrait construction method stored in the memory and executable on the processor. When the program of the human-computer dialogue-based portrait construction method is executed by the processor, it can implement the steps of the human-computer dialogue-based portrait construction method as described above.
[0016] This application also provides a storage medium, which is a computer-readable storage medium, storing a program that implements a human-computer dialogue-based portrait construction method. When the program is executed by a processor, it implements the steps of the human-computer dialogue-based portrait construction method as described above.
[0017] This application provides a portrait construction method, electronic device, and storage medium based on human-computer dialogue. By acquiring the statement to be extracted, determining the target operation type and portrait feature information based on the statement, the method determines what operation to perform on the portrait data and the portrait feature information. Then, by selecting a graph database or relational database as the target database based on the portrait feature information, the method determines the target database for storing the portrait data. Finally, by operating on the target database based on the target operation type and the portrait feature information, the method operates on the portrait data in the target database to construct a portrait. In other words, it updates the portrait data in the target database based on the portrait feature information extracted from the statement to be extracted, thus constructing a new portrait. Due to their inherent characteristics, graph databases require the identification of two nodes and the relationship between them to create user profiles, necessitating the extraction of triples. Relational databases, however, do not require triple extraction for user profiles. Therefore, compared to methods that rely on triple extraction for profile construction, this application utilizes both graph and relational databases for storing profile data. This approach leverages the extraction, retrieval, and reasoning capabilities of graph databases. Furthermore, even when complete triple information cannot be extracted, profile data can still be stored in a relational database, effectively preventing data omissions and improving data retention. This overcomes the technical limitation of graph databases, which rely on triple extraction for profile construction, leading to data omissions and poor profile integrity when complete triple information cannot be extracted. This approach improves the completeness of profile construction based on human-computer dialogue. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating an embodiment of the portrait construction method based on human-computer dialogue in this application;
[0021] Figure 2 This is a flowchart illustrating another embodiment of the portrait construction method based on human-computer dialogue in this application;
[0022] Figure 3 This is a schematic diagram of the structure of an embodiment of the portrait construction device based on human-computer dialogue in this application;
[0023] Figure 4 This is a schematic diagram of the device structure of the hardware operating environment involved in the human-computer dialogue-based portrait construction method in the embodiments of this application.
[0024] The purpose, features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0025] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] Example 1
[0027] This application provides a portrait construction method based on human-computer dialogue. In the first embodiment of this application's portrait construction method based on human-computer dialogue, referring to... Figure 1 This includes the following steps:
[0028] Step S10: Obtain the statement to be extracted;
[0029] The execution subject of the method in this embodiment can be a human-computer dialogue-based portrait building device, or a human-computer dialogue-based portrait building terminal device or server. This embodiment takes a human-computer dialogue-based portrait building device as an example. This human-computer dialogue-based portrait building device can be integrated into terminal devices such as smartphones and tablets with data processing functions.
[0030] In this embodiment, it should be noted that profile construction refers to the process of storing profile data so that the chatbot can combine user profiles and / or chatbot profiles to converse with users, thereby improving the chatbot's friendliness and human-likeness, making users feel that the chatbot is truly their own chatbot, and deepening users' trust in the chatbot. On the other hand, based on the user's profile, personalized marketing recommendations can be made to the user, which has great commercial value. Graph databases have good extraction, retrieval, and reasoning capabilities and are often used as databases for storing profile data. However, nodes and the relationships between nodes are the basic storage units of graph databases. That is, if profile data is to be stored in a graph database, the profile data needs to contain information about two nodes and the relationship between these two nodes, which is called triple information. The triple information refers to the subject, attribute, and object. The subject is the owner of the profile data, the attribute is the attribute of the profile data, such as gender, age, hobbies, favorite celebrities, disliked foods, etc., and the object is the attribute value corresponding to the attribute. For example, if the attribute is gender, the object can be male or female; if the attribute is hobbies, the object can be playing games, reading books, or listening to music, etc.; if the attribute is disliked foods, the object can be bitter melon, coriander, etc.
[0031] The aforementioned method of constructing profiles by extracting triples requires predefining all attributes. Exhaustive enumeration of attributes cannot be achieved overnight. If any undefined attributes are present, triple information cannot be extracted, resulting in the inability to store profile data in the graph database and thus profile omissions. Furthermore, due to the inherent limitations of the model itself, as well as the diversity of people and the variability of language, not all sentences containing profile attributes can be extracted into triples, which will also lead to profile omissions. Consequently, the constructed profiles contain missing information and have poor completeness.
[0032] In this embodiment, as an example, the current output statement of the user or the chatbot can be obtained as the statement to be extracted during the human-computer dialogue process. Alternatively, the output statement of the user or the chatbot can be obtained from the completed human-computer dialogue as the statement to be extracted after the human-computer dialogue is completed. The output statement can be in the form of audio or text. For audio output statements, the audio can be converted into text using ASR (Automatic Speech Recognition) technology.
[0033] Optionally, the statements to be extracted include user statements to be extracted and chatbot statements to be extracted, and the profiles include user profiles and chatbot profiles.
[0034] In this embodiment, the statement to be extracted includes a user statement to be extracted and a chatbot statement to be extracted. The output party of the statement to be extracted can be determined by the dialogue input role parameters. The output party can be a user or a chatbot. If the statement to be extracted is a user statement, the constructed profile is a user profile. If the statement to be extracted is a chatbot statement, the constructed profile is a chatbot profile.
[0035] Step S20: Determine the target operation type and profile feature information based on the statement to be extracted;
[0036] In this embodiment, as an example, the step of determining the target operation type based on the statement to be extracted includes: preprocessing the statement to be extracted or not preprocessing; inputting the preprocessed or unprocessed statement to be extracted into a sentence classification model to determine the target statement type corresponding to the statement to be extracted; and determining the target operation type corresponding to the statement to be extracted based on the target statement type corresponding to the statement to be extracted and a preset mapping relationship between statement type and operation type. The target statement type can be one of affirmative, negative, or interrogative sentences, etc., and the target operation type refers to the method of operating on the target database. This refers to one of the following operations: writing data, deleting data, querying data, adding data, or updating data. Writing data refers to the operation of writing portrait feature information into a target database. The written data can be added data or updated data. Adding data refers to the operation of writing portrait feature information into the target database in the form of new portrait data. Updating data refers to the operation of replacing the portrait data already stored in the target database with portrait feature information. Deleting data refers to the operation of deleting the portrait data already stored in the target database corresponding to the portrait feature information. Querying data refers to the operation of querying the target database for the portrait data already stored corresponding to the portrait feature information.
[0037] In one feasible approach, the mapping relationship between the preset statement type and operation type can include at least one of the following: affirmative sentences correspond to write operations, negative sentences correspond to delete operations, and interrogative sentences correspond to query operations. For example, "I am not an engineer" is a negative statement, so the corresponding profile (I, job, engineer) in the target database will be deleted; "I like Zhang San" is an affirmative statement, so the profile (I, favorite celebrity, Zhang San) will be written to the target database.
[0038] In this embodiment, as an example, the step of determining the portrait feature information based on the statement to be extracted includes: preprocessing the statement to be extracted or not preprocessing it, and obtaining the portrait feature information by inputting the preprocessed statement to be extracted or the unprocessed statement to be extracted into the portrait extraction model.
[0039] It should be noted that this application does not limit the order of the steps of determining the target operation type based on the statement to be extracted and the steps of determining the portrait feature information based on the statement to be extracted; they can be executed simultaneously or in any order.
[0040] Step S30: Select a graph database or relational database as the target database based on the portrait feature information;
[0041] In this embodiment, it should be noted that the graph database is a data management system designed with the efficient storage and querying of graph data as its basic storage unit, based on points and edges. A graph is a collection of points and edges, where "points" represent entities and "edges" represent relationships between entities. In a graph database, the relationships between data are just as important as the data itself; they are stored as part of the data. This architecture enables the graph database to quickly respond to complex relational queries because the relationships between entities are pre-stored in the database. Graph databases can intuitively visualize relationships and are the optimal method for storing, querying, and analyzing highly interconnected data. However, since nodes and the relationships between nodes are the basic storage units of graph databases, if profile data is to be stored in a graph database, the profile data needs to contain information about two nodes and the relationship between these two nodes, that is, triple information. The triple information refers to the subject, attribute, and object. The subject refers to the owner of the profile data, the attribute refers to the attributes of the profile data, such as gender, age, hobbies, favorite celebrities, disliked foods, etc., and the object refers to the attribute value corresponding to the attribute. For example, if the attribute is gender, the object can be male or female; if the attribute is hobbies, the object can be playing games, reading books, or listening to music, etc.; if the attribute is disliked foods, the object can be bitter melon, coriander, etc.
[0042] A relational database is a database that uses a relational model to organize data. It stores data in rows and columns for user understanding. These rows and columns are called tables, and a set of tables constitutes the database. Since this embodiment extracts profiles from human-computer dialogue, the subject of potential profile feature information can be determined by the dialogue output and / or dialogue content. Therefore, regardless of the extracted profile feature information, it can be stored in the relational database based on the subject. Compared to graph databases, relational databases have lower query speed and efficiency, but lower requirements for the extracted profile feature information. Even in cases where triple information cannot be extracted due to incomplete profile attribute definitions or model issues, the profile feature information can still be stored in the relational database, improving profile retention. Furthermore, this profile feature information can be used for model training, improving model performance.
[0043] In this embodiment, as an example, it is detected whether the portrait feature information meets the preset graph database storage conditions. If it is determined that the portrait feature information meets the preset graph database storage conditions, the graph database is determined as the target database. If it is determined that the portrait feature information does not meet the preset graph database storage conditions, the relational database is determined as the target database. In one implementable approach, the graph database can be neo4j (a high-performance non-relational graph database), Galaxybase (a distributed graph database), etc., and the relational database can be MySQL (a relational database), Oracle (a relational database), etc. The preset graph database storage conditions can be set according to actual conditions, such as whether it contains portrait data or triple information, etc. This embodiment does not impose any restrictions on this.
[0044] Optionally, the step of determining the target database based on the portrait feature information includes:
[0045] Step A10: If it is determined that the portrait feature information contains complete triplet information, then the graph database is determined as the target database;
[0046] Step A20: If it is determined that the portrait feature information does not contain complete triple information, then the relational database is determined as the target database.
[0047] In this embodiment, as an example, after extracting the portrait feature information, it is possible to further detect whether the extracted portrait feature information contains complete triple information. If it is determined that the portrait feature information contains complete triple information, then the graph database is determined as the target database; if it is determined that the portrait feature information does not contain complete triple information, then the relational database is determined as the target database.
[0048] Step S40: Based on the target operation type and the portrait feature information, perform operations on the target database.
[0049] In this embodiment, as an example, based on the target operation type and the portrait feature information, the target database is subjected to operations such as adding portrait data corresponding to the portrait feature information, updating portrait data corresponding to the portrait feature information, deleting portrait data corresponding to the portrait feature information, or querying portrait data corresponding to the portrait feature information.
[0050] Optionally, the step of operating on the target database based on the target operation type and the profile feature information includes:
[0051] Step B10: If the target database is a graph database, retrieve the standard word corresponding to the object in the portrait feature information from the preset similar word dictionary;
[0052] In this embodiment, it should be noted that in real-world human-computer dialogue scenarios, due to the diversity of language, the same meaning may have many expressions. For example, "(I, hobby, science fiction movies)" and "(I, hobby, science fiction movies)" have the same actual meaning, but are not equivalent in wording. If only information extraction is performed, it will result in many nodes with the same actual meaning in the graph database, leading to data redundancy. To address the lack of data redundancy in the database caused by semantic generalization, this embodiment uses a similar word dictionary for standardization processing, which can merge many nodes with the same actual meaning into one, reducing data redundancy.
[0053] In this embodiment, as an example, in order to reduce data redundancy in the graph database, a similar word dictionary can be set in advance based on big data, actual situation, etc. When the target database is determined to be a graph database, the standard word corresponding to the object in the portrait feature information can be retrieved from the preset similar word dictionary.
[0054] Step B20: Replace the object in the portrait feature information with the standard word to obtain new portrait feature information;
[0055] In this embodiment, as an example, if a standard word corresponding to the object in the portrait feature information is retrieved from a preset similar word dictionary, the standard word replaces the object in the portrait feature information to obtain new portrait feature information, thereby achieving the standardization of some nodes in the graph database. If no standard word corresponding to the object in the portrait feature information is retrieved from the preset similar word dictionary, the object in the original portrait feature information remains unchanged.
[0056] Step B30: Based on the target operation type and the new profile feature information, perform operations on the target database.
[0057] In this embodiment, as an example, based on the target operation type and the new portrait feature information, the target database is subjected to operations such as adding portrait data corresponding to the new portrait feature information, updating portrait data corresponding to the new portrait feature information, deleting portrait data corresponding to the new portrait feature information, or querying portrait data corresponding to the new portrait feature information.
[0058] Optionally, the step of operating on the target database based on the target operation type and the profile feature information includes:
[0059] Step C10: If the target database is a relational database and the target operation type is a write operation type, retrieve similar portrait data in the target database that has a similarity to the portrait feature information that is higher than a preset similarity threshold.
[0060] Step C20: Update the similar portrait data based on the portrait feature information.
[0061] In this embodiment, it should be noted that in real-world human-computer dialogue scenarios, due to the diversity of language, the same meaning may have many expressions. For example, "I like watching science fiction movies" and "I love watching science fiction movies" have the same actual meaning, but are not equivalent in wording. If only information extraction is performed, it will result in a lot of profile data with the same actual meaning in the relational database, leading to data redundancy. To address the lack of profile data redundancy in the database caused by semantic generalization, this embodiment can effectively reduce the repeated storage of profile data with the same meaning in the relational database through similarity comparison, thereby reducing data redundancy.
[0062] In this embodiment, as an example, when the target database is determined to be a relational database and the target operation type is a write operation type, the portrait feature information is compared with all or part of the existing portrait data in the target database for similarity detection, and it is determined whether the detected similarity is greater than a preset similarity threshold. If similar portrait data with a similarity higher than the preset similarity threshold is detected in the existing portrait data of the target database, the similar portrait data is updated based on the portrait feature information; if no similar portrait data with a similarity higher than the preset similarity threshold is detected in the existing portrait data of the target database, the portrait feature information is added to the target database.
[0063] In one feasible approach, the step of performing similarity detection between the portrait feature information and all or part of the existing portrait data in the target database includes: determining the target portrait attribute corresponding to the portrait feature information, filtering out the target existing portrait data corresponding to the target portrait attribute from the target database, and performing similarity detection between the portrait feature information and each of the target existing portrait data.
[0064] Optionally, the step of operating on the target database based on the target operation type and the profile feature information includes:
[0065] Step D10: If the target database is a graph database, detect whether contradictory profile data corresponding to the profile characteristic information exists in the target database;
[0066] In this embodiment, it should be noted that due to human variability or the accuracy of model extraction, the object of an attribute may change. For example, a person may have previously enjoyed watching science fiction films but no longer does. Or, a conversation may contain too much information, causing the model to extract only "I, gender, male, female." In such cases, contradictory profile feature information may arise. This embodiment uses a chatbot to send queries to the user to reconfirm contradictory profile feature information, ensuring the accuracy of the profile data ultimately stored in the database.
[0067] In this embodiment, as an example, when the target database is determined to be a graph database, it is detected whether there is contradictory portrait data corresponding to the portrait feature information in the existing portrait data in the target database. The contradictory portrait data refers to existing portrait data that contradicts the portrait feature information.
[0068] Step D20: If contradictory portrait data corresponding to the portrait characteristic information is detected, a portrait query message is sent to the user terminal.
[0069] In this embodiment, as an example, if contradictory portrait data corresponding to the portrait feature information is detected, a portrait query message is sent to the user terminal. The portrait query message refers to information asking the user which of two contradictory portrait data is the correct portrait data. If no contradictory portrait data corresponding to the portrait feature information is detected, the target database can be operated directly based on the target operation type and the portrait feature information.
[0070] In one feasible approach, attributes can also be characterized to improve the accuracy and efficiency of conflict profile data detection. The characteristic markers include at least one of unique value attributes, fixed value attributes, multi-value attributes, and opposing attributes. Fixed value attributes refer to attributes whose values do not change, such as "birthday" or "zodiac sign". Unique value attributes refer to attributes that can only have one value, such as "gender" or "age". Multi-value attributes refer to profile attributes that can have multiple values, such as "hobbies" or "skills". Opposing attributes refer to attributes that do not exist simultaneously, that is, if an attribute exists in one attribute, it will not exist in another attribute. For example, the opposing attribute of "hobbies" can be "dislikes", and the opposing attribute of "skills" can be "weaknesses".
[0071] Step D30: If the user terminal receives a positive response to the profile query information regarding the profile feature information, then update the contradictory profile data based on the profile feature information.
[0072] In this embodiment, as an example, if the user terminal receives a positive response regarding the portrait feature information in response to the portrait query, it indicates that the currently extracted portrait feature information is correct. Therefore, the contradictory portrait data can be updated based on the portrait feature information. If the user terminal does not receive a positive response regarding the portrait feature information in response to the portrait query, in this case, no information may be returned, or a negative response regarding the portrait feature information may be returned, or a positive response regarding the existing portrait data may be returned. In this case, there may be an error or deviation in the extraction process of the portrait feature information. Therefore, no operation is performed on the portrait data in the database.
[0073] Optionally, after the step of operating on the target database based on the target operation type and the profile feature information, the method further includes:
[0074] Step S50: If the target database is a graph database, retrieve the externality knowledge corresponding to the portrait feature information from the preset knowledge graph;
[0075] Step S60: Add the externality knowledge to the graph database.
[0076] In this embodiment, as an example, when a graph database is selected as the target database, externality knowledge corresponding to the portrait feature information can be further retrieved from a preset knowledge graph. If externality knowledge corresponding to the portrait feature information is found in the preset knowledge graph, the externality knowledge is added to the graph database; if no externality knowledge corresponding to the portrait feature information is detected, no addition is required. Here, externality knowledge refers to extended information related to the portrait feature information. The knowledge graph can be pre-established according to actual conditions and needs. For example, for video applications, a knowledge graph in the film and television field can be established. For instance, if the portrait feature information is (me, hobbies, Infernal Affairs), externality knowledge such as film types and lead actors related to Infernal Affairs can be retrieved from the knowledge graph.
[0077] Optionally, the step of retrieving the externality knowledge corresponding to the portrait feature information from a preset knowledge graph includes:
[0078] Step S51: Obtain the context dialogue corresponding to the statement to be extracted, and determine the portrait theme corresponding to the portrait feature information based on the context dialogue.
[0079] Step S52: Retrieve externality knowledge from the preset knowledge graph based on the portrait theme and the portrait feature information.
[0080] In this embodiment, as an example, when a graph database is selected as the target database, externality knowledge corresponding to the portrait feature information can be further retrieved from a pre-set knowledge graph. In this case, the context dialogue corresponding to the statement to be extracted can be obtained first. By inputting the context dialogue into a topic classification model, the portrait topic corresponding to the portrait feature information can be determined. Then, externality knowledge matching both the portrait topic and the portrait feature information can be filtered from the pre-set knowledge graph to reduce the potential ambiguity of the portrait feature information. The topic classification model is a pre-trained multi-classification model, and its training process is similar to that of existing technologies, which will not be elaborated here.
[0081] For example, if the image topic temporarily stored by the global variable is books, and the statement to be extracted is "I like Tian Long Ba Bu", then it can be determined that "Tian Long Ba Bu" in the statement to be extracted refers to "books" rather than "games". On the one hand, it can disambiguate entities, and on the other hand, it improves the accuracy of introducing externality knowledge, introducing externality knowledge of Tian Long Ba Bu books rather than externality knowledge of Tian Long Ba Bu games.
[0082] In this embodiment, by introducing external knowledge, on the one hand, the chatbot can use this external knowledge to guide the conversation and expand the topic, such as from talking about movies to talking about actors, making human-computer dialogue more intelligent and allowing users to be more immersed in it; on the other hand, it can explore user needs, for example, if it is found that there are many science fiction movies among the user's favorite movies, then some science fiction movies can be recommended to the user in a targeted manner to achieve more accurate personalized recommendations.
[0083] In this embodiment, by acquiring the statement to be extracted, determining the target operation type and portrait feature information based on the statement, the method for determining what operation to perform on the portrait data and extracting the portrait feature information is realized. Then, by selecting a graph database or relational database as the target database based on the portrait feature information, the target database for storing the portrait data is determined. Finally, by operating on the target database based on the target operation type and the portrait feature information, the operation on the portrait data in the target database is realized. That is, the portrait data in the target database is updated based on the portrait feature information extracted from the statement to be extracted, and a new portrait is constructed. Due to their inherent characteristics, graph databases require the identification of two nodes and the relationship between them to create user profiles, necessitating the extraction of triples. Relational databases, on the other hand, do not require this triple extraction method. Therefore, compared to methods that rely on triple extraction for profile construction, this application utilizes both graph and relational databases for storing profile data. This approach leverages the extraction, retrieval, and reasoning capabilities of graph databases. Furthermore, even when complete triple information cannot be extracted, profile data can still be stored in a relational database, effectively preventing data omissions and improving data retention. This overcomes the technical limitation of graph databases, which rely on triple extraction for profile construction, leading to data omissions and poor profile integrity when complete triple information cannot be extracted. This approach improves the completeness of profile construction based on human-computer dialogue.
[0084] Example 2
[0085] Furthermore, referring to Figure 2Based on the above embodiments of this application, in the second embodiment of this application, the same or similar content as the above embodiments can be referred to the above description, and will not be repeated hereafter. Based on this, the step of determining the target operation type and profile feature information according to the statement to be extracted includes:
[0086] Step S21: Obtain the context dialogue corresponding to the statement to be extracted, and rewrite the statement to be extracted based on the context dialogue to restore the omitted information and referential information in the statement to be extracted, thereby obtaining the rewritten statement.
[0087] In this embodiment, as an example, the contextual dialogue corresponding to the sentence to be extracted is obtained from the human-computer dialogue. By inputting the contextual dialogue and the sentence to be extracted into the sentence rewriting model, the sentence to be extracted is rewritten to restore the omitted information and referential information in the sentence to be extracted, thereby obtaining the rewritten sentence. The rewritten sentence is a semantically complete sentence that can be understood without context. The contextual dialogue can be the dialogue content within a period of time adjacent to the sentence to be extracted, or it can be a certain number of dialogue contents adjacent to the sentence to be extracted. The specific settings can be made according to the actual situation. This embodiment does not limit this. The sentence rewriting model is similar to the prior art and will not be described in detail here.
[0088] For example, the sentence to be extracted is ["I like it!"], and the context dialogue is [A: "Do you like Zhang San?", B: "I like it!"]. The sentence rewriting model will rewrite ["I like it!"] and the context dialogue into ["I like Zhang San!"], thus restoring the subject "I" and the object "Zhang San" corresponding to "I like" in the sentence to be extracted.
[0089] Step S22: Determine the target operation type by performing sentence structure analysis on the rewritten statement;
[0090] In this embodiment, as an example, the target statement type corresponding to the rewritten statement is determined by inputting the rewritten statement into a sentence classification model. Based on the target statement type and the preset mapping relationship between statement type and operation type, the target operation type corresponding to the rewritten statement is determined. The target statement type can be one of affirmative, negative, or interrogative sentences. The target operation type refers to the method of operating on the target database, which can be one of writing data, deleting data, querying data, adding data, or updating data. Writing data refers to the operation of writing portrait feature information into the target database. The written data can be added data or updated data. Adding data refers to the operation of writing portrait feature information into the target database in the form of new portrait data. Updating data refers to the operation of replacing already stored portrait data in the target database with portrait feature information. Deleting data refers to the operation of deleting already stored portrait data in the target database corresponding to the portrait feature information. Querying data refers to the operation of querying already stored portrait data corresponding to the portrait feature information from the target database.
[0091] Optionally, before the step of determining the target operation type by performing sentence structure analysis on the rewritten statement, the method further includes:
[0092] Step E10: By inputting the rewritten statement into the portrait recognition model, determine whether the rewritten statement carries portrait information;
[0093] Step E20: If it is determined that the rewritten statement carries portrait information, the target operation type is determined by performing sentence structure analysis on the rewritten statement.
[0094] In this embodiment, as an example, the rewritten statement is input into a profile recognition model to determine whether it carries profile information. If it is determined that the rewritten statement carries profile information, the target operation type is determined by performing sentence structure analysis on the rewritten statement. If it is determined that the rewritten statement does not carry profile information, it means that the current rewritten statement does not carry profile information, and the subsequent profile construction process is unnecessary. Therefore, the step of obtaining the statement to be extracted can be returned to obtain a new statement to be extracted. The profile recognition model is a binary classification model. After obtaining the statement to be extracted, the more accurate binary classification model is used first to accurately determine whether the statement to be extracted carries profile information, thereby improving the accuracy of profile recognition and reducing the possibility of profile omissions caused by multi-classification models.
[0095] Step S23: By inputting the rewritten statement into the attribute classification model, the target profile attribute of the rewritten statement is determined;
[0096] In this embodiment, as an example, the target profile attribute of the rewritten statement is determined by inputting the rewritten statement into an attribute classification model. The attribute classification model is a pre-trained multi-classification model. The training process of the attribute classification model is similar to the prior art and will not be described in detail here. It should be noted that the training process of the attribute classification model can be carried out locally or can be trained on other devices or equipment and then deployed on the profile building device based on human-computer dialogue. This embodiment does not impose any restrictions on this.
[0097] It should be noted that this application does not limit the order of steps S22 and S23; they can be executed simultaneously or in any order.
[0098] Optionally, the profile construction method based on human-computer dialogue further includes:
[0099] Step F10: Obtain first initial training sample data, and obtain profile data from a relational database as second initial training sample data. Construct target training sample data based on the first initial training sample data and the second initial training sample data.
[0100] Step F20: Label the target training sample data to obtain training sample data labels;
[0101] Step F30: By inputting the target training sample data into the attribute classification model to be trained, the prediction result of the training model for the target training sample data is determined.
[0102] Step F40: Based on the training sample data labels and the prediction results of the training model, the attribute classification model to be trained is iteratively optimized by calculating the model prediction loss of the attribute classification model to be trained.
[0103] In this embodiment, as an example, first initial training sample data is obtained, and portrait data is obtained from a relational database as second initial training sample data. Target training sample data is constructed based on the first and second initial training sample data. The target training sample data is labeled to obtain training sample data labels. By inputting the target training sample data into the attribute classification model to be trained, the training model prediction result of the target training sample data is determined. Based on the training sample data labels and the training model prediction result, the model prediction loss of the attribute classification model to be trained is calculated. It is then determined whether the model prediction loss has converged. If the model prediction loss converges... If the loss converges, the attribute classification model is considered to be trained successfully. If the model prediction loss does not converge, the attribute classification model is updated once based on the model gradient calculated from the model prediction loss. Then, the process returns to the steps of obtaining the first initial training sample data, obtaining portrait data from the relational database as the second initial training sample data, and constructing target training sample data based on the first and second initial training sample data. This process continues until the calculated model prediction loss converges, resulting in a trained attribute classification model. The trained attribute classification model is then used in the portrait construction method based on human-computer dialogue.
[0104] By using profile data from relational databases as training samples to train the attribute classification model, the accuracy of the attribute classification model in identifying profile attributes of rewritten statements can be effectively improved.
[0105] Step S24: Extract portrait feature information from the rewritten statement based on the target portrait attributes.
[0106] In this embodiment, as an example, the target portrait attribute and the rewritten statement are input into the portrait extraction model to obtain portrait feature information. The portrait extraction model extracts the corresponding portrait feature information through named entity recognition, thereby constructing triples. The target portrait attribute may include at least one of gender, preferences, age, and others. Other portrait attributes used to characterize the portrait in the rewritten statement cannot match the defined portrait attributes. By setting the "other" category, the omission of portrait data that cannot match the defined portrait attributes can be effectively avoided.
[0107] Optionally, the step of extracting portrait feature information from the rewritten statement based on the target portrait attributes includes:
[0108] Step S241: If the target image attribute is another image attribute, the rewritten statement is determined as image feature information;
[0109] In this embodiment, as an example, when the target profile attribute is another profile attribute, since the attribute cannot be determined and the attribute value corresponding to the attribute cannot be extracted subsequently, it is not necessary to extract the attribute value. The rewritten statement can be directly determined as profile feature information and subsequently saved to a relational database.
[0110] Step S242: If the target portrait attribute is not another portrait attribute, the subject and object corresponding to the target portrait attribute are obtained by inputting the rewritten statement into the portrait feature extraction model, and the subject and object corresponding to the target portrait attribute and the target portrait attribute are concatenated into portrait feature information.
[0111] In this embodiment, as an example, when the target portrait attribute is not another portrait attribute, by inputting the rewritten statement into the portrait feature extraction model, if the subject and object corresponding to the target portrait attribute can be obtained, then the subject and object corresponding to the target portrait attribute and the target portrait attribute are concatenated into portrait feature information.
[0112] Step S243: If the target portrait attribute is not another portrait attribute, and the subject and / or object corresponding to the target portrait attribute cannot be obtained by inputting the rewritten statement into the portrait feature extraction model, the rewritten statement is determined as portrait feature information.
[0113] In this embodiment, as an example, when the target profile attribute is not another profile attribute, if the subject and / or object corresponding to the target profile attribute cannot be obtained by inputting the rewritten statement into the profile feature extraction model, then the complete triplet information cannot be obtained either. Therefore, the rewritten statement is determined as profile feature information and subsequently saved to the relational database.
[0114] In this embodiment, during human-computer dialogue, the statement to be extracted is usually a sentence or part of a whole dialogue. Therefore, when the statement to be extracted is independent of the whole dialogue, its semantics may be incomplete, which may lead to the inability to extract accurate and effective profile feature information. This embodiment improves the accuracy and efficiency of extracting profile feature information by obtaining the context of the dialogue, recovering the omitted and referential information in the statement to be extracted, and then performing attribute recognition and profile feature information extraction on the rewritten statement after recovering the omitted and referential information.
[0115] Example 3
[0116] Furthermore, embodiments of this application also provide a portrait construction device based on human-computer dialogue, referring to... Figure 3 The human-computer dialogue-based portrait construction device is applied to a human-computer dialogue-based portrait construction method, comprising:
[0117] The first acquisition module 10 is used to acquire the statement to be extracted;
[0118] The first determining module 20 is used to determine the target operation type and profile feature information based on the statement to be extracted.
[0119] The second determining module 30 is used to select a graph database or a relational database as the target database based on the portrait feature information.
[0120] The operation module 40 is used to operate on the target database based on the target operation type and the portrait feature information.
[0121] Optionally, the first determining module 20 is further configured to:
[0122] Obtain the context dialogue corresponding to the statement to be extracted, and rewrite the statement to be extracted based on the context dialogue to restore the omitted information and referential information in the statement to be extracted, thereby obtaining the rewritten statement.
[0123] The target operation type is determined by performing sentence structure analysis on the rewritten statement;
[0124] By inputting the rewritten statement into an attribute classification model, the target profile attribute of the rewritten statement is determined.
[0125] Based on the target profile attributes, profile feature information is extracted from the rewritten statement.
[0126] Optionally, the first determining module 20 is further configured to:
[0127] If the target profile attribute is another profile attribute, the rewritten statement will be identified as profile feature information;
[0128] When the target profile attribute is not another profile attribute, the subject and object corresponding to the target profile attribute are obtained by inputting the rewritten statement into the profile feature extraction model, and the subject and object corresponding to the target profile attribute and the target profile attribute are concatenated to form profile feature information.
[0129] If the target profile attribute is not another profile attribute, and the subject and / or object corresponding to the target profile attribute cannot be obtained by inputting the rewritten statement into the profile feature extraction model, the rewritten statement will be identified as profile feature information.
[0130] Optionally, the human-computer dialogue-based profile building device further includes a training module, which is used for:
[0131] Obtain first initial training sample data, and obtain profile data from a relational database as second initial training sample data. Construct target training sample data based on the first initial training sample data and the second initial training sample data.
[0132] The target training sample data is labeled to obtain training sample data labels;
[0133] By inputting the target training sample data into the attribute classification model to be trained, the prediction result of the training model for the target training sample data is determined.
[0134] Based on the training sample data labels and the prediction results of the training model, the attribute classification model to be trained is iteratively optimized by calculating the model prediction loss of the attribute classification model to be trained.
[0135] Optionally, the portrait construction device based on human-computer dialogue further includes a portrait recognition module, which is used for:
[0136] By inputting the rewritten statement into the portrait recognition model, it is determined whether the rewritten statement carries portrait information;
[0137] If it is determined that the rewritten statement carries profile information, the target operation type is determined by performing sentence structure analysis on the rewritten statement.
[0138] Optionally, the second determining module 30 is further configured to:
[0139] If it is determined that the portrait feature information contains complete triple information, then the graph database is determined as the target database;
[0140] If it is determined that the portrait feature information does not contain complete triple information, then the relational database is determined as the target database.
[0141] Optionally, the operation module 40 is further configured to:
[0142] When the target database is a graph database, the standard word corresponding to the object in the portrait feature information is retrieved from a preset similar word dictionary;
[0143] Replace the object in the portrait feature information with the standard word to obtain new portrait feature information;
[0144] Based on the target operation type and the new profile feature information, the target database is operated.
[0145] Optionally, the operation module 40 is further configured to:
[0146] When the target database is a relational database and the target operation type is a write operation type, retrieve similar portrait data in the target database that has a similarity to the portrait feature information that is higher than a preset similarity threshold;
[0147] Based on the portrait feature information, the similar portrait data is updated.
[0148] Optionally, the operation module 40 is further configured to:
[0149] If the target database is a graph database, detect whether contradictory profile data corresponding to the profile characteristic information exists in the target database;
[0150] If contradictory profile data corresponding to the profile feature information is detected, a profile query message is sent to the user terminal.
[0151] If the user terminal receives a positive response to the profile query information regarding the profile feature information, then the contradictory profile data is updated based on the profile feature information.
[0152] Optionally, the human-computer dialogue-based profile building device further includes an externality knowledge supplementation module, which is used for:
[0153] When the target database is a graph database, externality knowledge corresponding to the portrait feature information is retrieved from a preset knowledge graph;
[0154] The externality knowledge is then added to the graph database.
[0155] Optionally, the externality knowledge supplementation module is further configured to:
[0156] Obtain the context dialogue corresponding to the statement to be extracted, and determine the portrait theme corresponding to the portrait feature information based on the context dialogue;
[0157] Externality knowledge is retrieved from the preset knowledge graph based on the portrait theme and the portrait feature information.
[0158] The portrait construction device based on human-computer dialogue provided by this invention adopts the portrait construction method based on human-computer dialogue in the above embodiments, solving the technical problem of poor integrity in the portrait construction based on human-computer dialogue in the prior art. Compared with the prior art, the beneficial effects of the portrait construction device based on human-computer dialogue provided by the embodiments of this invention are the same as the beneficial effects of the portrait construction method based on human-computer dialogue provided in the above embodiments, and other technical features in the portrait construction device based on human-computer dialogue are the same as the features disclosed in the methods of the above embodiments, and will not be repeated here.
[0159] Example 4
[0160] Furthermore, embodiments of the present invention provide an electronic device, the electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to execute the human-computer dialogue-based portrait construction method or the conversion qualification truncation parameter determination method in the above embodiments.
[0161] The following is for reference. Figure 4 The diagram illustrates a structural schematic of an electronic device suitable for implementing embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as Bluetooth headsets, mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0162] like Figure 4 As shown, an electronic device may include a processing unit (such as a central processing unit, graphics processing unit, etc.) that can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) or a program loaded from a storage device into random access memory (RAM). The RAM also stores various programs and arrays required for the operation of the electronic device. The processing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.
[0163] Typically, the following systems can be connected to the I / O interface: input devices including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices including, for example, magnetic tapes, hard disks, etc.; and communication devices. Communication devices allow electronic devices to communicate wirelessly or wiredly with other devices to exchange arrays. Although electronic devices with various systems are shown in the figures, it should be understood that it is not required to implement or possess all the systems shown. More or fewer systems may be implemented alternatively.
[0164] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, it performs the functions defined above in the methods of embodiments of this disclosure.
[0165] The electronic device provided by this invention employs the human-computer dialogue-based profile construction method or the conversion qualification truncation parameter determination method described in the above embodiments, thus solving the technical problem of poor integrity in the prior art's human-computer dialogue-based profile construction. Compared with the prior art, the beneficial effects of the electronic device provided by the embodiments of this invention are the same as those of the human-computer dialogue-based profile construction method or the conversion qualification truncation parameter determination method provided in the above embodiments, and other technical features of this electronic device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.
[0166] It should be understood that various parts of this disclosure can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.
[0167] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
[0168] Example 5
[0169] Furthermore, this embodiment provides a computer-readable storage medium having computer-readable program instructions stored thereon, which are used to execute the human-computer dialogue-based portrait construction method or the conversion qualification truncation parameter determination method in the above embodiments.
[0170] The computer-readable storage medium provided in this embodiment of the invention may be, for example, a USB flash drive, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: 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 embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0171] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.
[0172] The aforementioned computer-readable storage medium carries one or more programs. When the aforementioned one or more programs are executed by an electronic device, the electronic device causes the electronic device to: acquire a statement to be extracted; determine a target operation type and profile feature information based on the statement to be extracted; select a graph database or a relational database as the target database based on the profile feature information; and perform operations on the target database based on the target operation type and the profile feature information.
[0173] Computer program code for performing the operations of this disclosure 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 the "C" language 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 can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0174] The flow charts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0175] The modules described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.
[0176] The computer-readable storage medium provided by this invention stores computer-readable program instructions for executing the aforementioned human-computer dialogue-based portrait construction method or conversion qualification truncation parameter determination method, thus solving the technical problem of poor integrity in existing human-computer dialogue-based portrait construction methods. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this invention are the same as those of the human-computer dialogue-based portrait construction method or conversion qualification truncation parameter determination method provided in the above embodiments, and will not be repeated here.
[0177] Example 6
[0178] Furthermore, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the above-described method for constructing a profile based on human-computer dialogue or a method for determining conversion qualification truncation parameters.
[0179] The computer program product provided in this application solves the technical problem of poor integrity in the prior art of human-computer dialogue-based profile construction. Compared with the prior art, the beneficial effects of the computer program product provided in this invention are the same as those of the human-computer dialogue-based profile construction method or the conversion qualification truncation parameter determination method provided in the above embodiments, and will not be repeated here.
[0180] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent scope of this application.
Claims
1. A method for constructing user profiles based on human-computer dialogue, characterized in that, The human-computer dialogue-based profile construction method includes the following steps: Get the statement to be extracted; The target operation type and profile feature information are determined based on the statement to be extracted. Selecting a graph database or relational database as the target database based on the portrait feature information, the steps of determining the target database based on the portrait feature information include: If it is determined that the portrait feature information contains complete triple information, then the graph database is determined as the target database; if it is determined that the portrait feature information does not contain complete triple information, then the relational database is determined as the target database. Based on the target operation type and the portrait feature information, operations are performed on the target database. The steps of performing operations on the target database based on the target operation type and the portrait feature information include: when the target database is a relational database and the target operation type is a write operation, performing similarity detection on the portrait feature information and existing portrait data in the target database one by one to retrieve similar portrait data in the target database whose similarity to the portrait feature information is higher than a preset similarity threshold; and updating the similar portrait data based on the portrait feature information. The steps of performing similarity detection on the portrait feature information and existing portrait data in the target database one by one include: determining the target portrait attribute corresponding to the portrait feature information, filtering out the target existing portrait data corresponding to the target portrait attribute from the target database, and performing similarity detection on the portrait feature information and each of the target existing portrait data.
2. The portrait construction method based on human-computer dialogue as described in claim 1, characterized in that, The step of determining the target operation type and profile feature information based on the statement to be extracted includes: Obtain the context dialogue corresponding to the statement to be extracted, and rewrite the statement to be extracted based on the context dialogue to restore the omitted information and referential information in the statement to be extracted, thereby obtaining the rewritten statement. The target operation type is determined by performing sentence structure analysis on the rewritten statement; By inputting the rewritten statement into an attribute classification model, the target profile attribute of the rewritten statement is determined. Based on the target profile attributes, profile feature information is extracted from the rewritten statement.
3. The portrait construction method based on human-computer dialogue as described in claim 2, characterized in that, The step of extracting portrait feature information from the rewritten statement based on the target portrait attributes includes: If the target profile attribute is another profile attribute, the rewritten statement will be identified as profile feature information; When the target profile attribute is not another profile attribute, the subject and object corresponding to the target profile attribute are obtained by inputting the rewritten statement into the profile feature extraction model, and the subject and object corresponding to the target profile attribute and the target profile attribute are concatenated to form profile feature information. If the target profile attribute is not another profile attribute, and the subject and / or object corresponding to the target profile attribute cannot be obtained by inputting the rewritten statement into the profile feature extraction model, the rewritten statement will be identified as profile feature information.
4. The portrait construction method based on human-computer dialogue as described in claim 2, characterized in that, The human-computer dialogue-based profile construction method also includes: Obtain first initial training sample data, and obtain profile data from a relational database as second initial training sample data. Construct target training sample data based on the first initial training sample data and the second initial training sample data. The target training sample data is labeled to obtain training sample data labels; By inputting the target training sample data into the attribute classification model to be trained, the prediction result of the training model for the target training sample data is determined. Based on the training sample data labels and the prediction results of the training model, the attribute classification model to be trained is iteratively optimized by calculating the model prediction loss of the attribute classification model to be trained.
5. The portrait construction method based on human-computer dialogue as described in claim 2, characterized in that, Before the step of determining the target operation type by performing sentence structure analysis on the rewritten statement, the method further includes: By inputting the rewritten statement into the portrait recognition model, it is determined whether the rewritten statement carries portrait information; If it is determined that the rewritten statement carries profile information, the target operation type is determined by performing sentence structure analysis on the rewritten statement.
6. The portrait construction method based on human-computer dialogue as described in any one of claims 1-5, characterized in that, The steps for operating the target database based on the target operation type and the profile feature information include: When the target database is a graph database, the standard word corresponding to the object in the portrait feature information is retrieved from a preset similar word dictionary; Replace the object in the portrait feature information with the standard word to obtain new portrait feature information; Based on the target operation type and the new profile feature information, the target database is operated.
7. The portrait construction method based on human-computer dialogue as described in any one of claims 1-5, characterized in that, The steps for operating the target database based on the target operation type and the profile feature information include: If the target database is a graph database, detect whether contradictory portrait data corresponding to the portrait feature information exists in the target database; If contradictory portrait data corresponding to the portrait feature information is detected, a portrait query message is sent to the user terminal. If the user terminal receives a positive response to the profile query information regarding the profile feature information, then the contradictory profile data is updated based on the profile feature information.
8. The portrait construction method based on human-computer dialogue as described in any one of claims 1-5, characterized in that, After the step of operating the target database based on the target operation type and the profile feature information, the method further includes: When the target database is a graph database, externality knowledge corresponding to the portrait feature information is retrieved from a preset knowledge graph; The externality knowledge is then added to the graph database.
9. The portrait construction method based on human-computer dialogue as described in claim 8, characterized in that, The step of retrieving the externality knowledge corresponding to the portrait feature information from the pre-set knowledge graph includes: Obtain the context dialogue corresponding to the statement to be extracted, and determine the portrait theme corresponding to the portrait feature information based on the context dialogue; Externality knowledge is retrieved from the preset knowledge graph based on the portrait theme and the portrait feature information.
10. The portrait construction method based on human-computer dialogue as described in any one of claims 1-5, characterized in that, The statements to be extracted include user statements to be extracted and chatbot statements to be extracted, and the profiles include user profiles and chatbot profiles.
11. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the steps of the portrait construction method based on human-computer dialogue as described in any one of claims 1 to 10.
12. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and the computer-readable storage medium stores a program that implements the portrait construction method based on human-computer dialogue. The program that implements the portrait construction method based on human-computer dialogue is executed by a processor to implement the steps of the portrait construction method based on human-computer dialogue as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Automatic user profile extracting method and device based on man-machine interaction
CN107025278A
Software sample hybrid storage system based on multiple databases and file system
CN111858483A
Multi-round dialogue rewriting method and device and medium
CN115587598A